jialh
2025-08-05 c962819a919d9bc7c6340a4afac055c4f35437ea
更新
4个文件已修改
2个文件已添加
587 ■■■■ 已修改文件
components/index/index-noshow.vue 260 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
components/index/index-notice.vue 141 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
conf/config.js 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pages.json 6 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pages/activites/notice.vue 170 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pages/index/index.vue 6 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
components/index/index-noshow.vue
New file
@@ -0,0 +1,260 @@
<template>
    <view>
        <view class="active_box">
            <!-- <view class="active_title">社区公告</view> -->
            <view class="active_title">社区公告<text class="more" @click="tomore()">更多</text></view>
            <view class="active_list">
                <!--:scroll-left="scrollLeft"-->
                <!-- <scroll-view scroll-x class="bg-white nav" scroll-with-animation>
                    <view class="cu-item" :class="item.typeCd==curTypeCd?'text-green cur':''"
                        v-for="(item,index) in activitiTitle" :key="index" @tap="selectActiviti(item)" :data-id="index">
                        {{item.typeName}}
                    </view>
                </scroll-view> -->
                <!-- <view class="active_title">社区公告<text class="more" @click="tomore()">更多</text></view> -->
                <view class="noticesList bg-white margin-top-1" v-if="notices && notices.length > 0">
                    <!-- <block v-for="(item,index) in notices" :key="index" wx:key="index"> -->
                        <view class="noticesList-list" @tap="_toDetail(notices[0])">
                            <view class="notices-info">
                                <view class="notices-info-name">{{notices[0].title}}</view>
                                <view class="notice-bottom">
                                    <view>
                                        <text class="lg text-gray cuIcon-time"></text>
                                        <text class="notice-startTime margin-left-xs">{{notices[0].startTime}}</text>
                                    </view>
                                </view>
                            </view>
                            <view class="notices-info-image">
                                <image :src="notices[0].src" />
                            </view>
                        </view>
                    <!-- </block> -->
                </view>
                <view class="active_empty" v-else>
                    <image :src="noImg" />
                    <text class="text">暂无活动哦~</text>
                </view>
            </view>
        </view>
    </view>
</template>
<script>
    import {
        getActivitiTitle,
        getCategoryList,
        loadActivites,
        loadAdverts
    } from '../../api/index/indexApi.js'
import { loginByOpenId } from '../../api/user/sessionApi.js';
    export default {
        name: "indexNoshow",
        data() {
            return {
                notices: [],
                activitiTitle: [],
                noImg:this.imgUrl+'/h5/images/serve/empty.png',
                curTypeCd: '',
                page: 1,
                row: 7,
                communityId: '',
            };
        },
        created() {
            this._loadData();
        },
        methods:{
            tomore: function() {
                console.log("1111111111111111")
                this.vc.navigateTo({
                    url: '/pages/activites/notice'
                })
            },
            _loadData:function(){
                let _that = this;
                this.vc.getCurCommunity()
                    .then(function(_communityInfo) {
                        _that.communityId = _communityInfo.communityId;
                        _that._loadActivitiesType();
                    })
            },
            _loadActivitiesType: function() {
                let _that = this;
                let _objData = {
                    page: 1,
                    row: 10,
                    communityId: _that.communityId,
                    defaultShow: 'Y'
                };
                //查询 活动标题
                getActivitiTitle(_objData)
                    .then((actType) => {
                        _that.activitiTitle = actType;
                    })
                    .then((acts) => {
                        if (_that.activitiTitle.length > 0) {
                            _that.curTypeCd = _that.activitiTitle[0].typeCd;
                        }
                        _that._loadActivites();
                    })
            },
            _loadActivites: function() {
                let _that = this;
                if (this.curTypeCd == '') {
                    return;
                }
                let _objData = {
                    page: this.page,
                    row: this.row,
                    communityId: this.communityId,
                    typeCd: this.curTypeCd,
                    defaultShow: 'Y',
                    clientType: 'H5'
                };
                //加载活动
                loadActivites(_objData)
                    .then(function(_acts) {
                        _that.notices = _acts;
                    });
            },
            _toDetail: function(_item) {
                this.vc.navigateTo({
                    url: '/pages/activites/activitesDetail?activitiesId=' + _item.activitiesId +
                        '&title=' + _item.title +
                        '&communityId=' + _item.communityId
                });
            },
            selectActiviti: function(_item) {
                this.curTypeCd = _item.typeCd;
                this.notices = [];
                this.page = 1;
                this._loadActivites();
            },
        }
    }
</script>
<style lang="less">
    .active_box {
        padding: 0 20upx;
        margin-bottom: 20upx;
        .active_title {
            display: flex;
            align-items: center;
            justify-content: space-between;
            padding: 20upx 0;
            font-size: 30upx;
            font-weight: 600;
            .more {
                font-size: 24upx;
                font-weight: 400;
                color: #999;
            }
        }
        .active_list {
            border-radius: 5px;
        }
        .active_empty {
            background: #fff;
            display: flex;
            align-items: center;
            justify-content: center;
            flex-direction: column;
            padding: 100rpx 0;
            border-radius: 10px;
            image {
                width: 50%;
                height: 200upx;
            }
            .text {
                font-size: 28rpx;
                color: #333;
                margin-top: 20rpx;
            }
        }
        .active_item {
            display: inline-block;
            padding: 20upx;
            width: 20%;
            text-align: center;
            font-size: 28upx;
            image {
                height: 64upx;
                width: 64upx;
            }
            .text {
                white-space: nowrap;
                font-size: 20upx;
                font-weight: 400;
            }
        }
        .home_item:last-child {
            margin-right: 0;
        }
    }
    .noticesList-list{
      font-size: 25rpx;
      display: flex;
      width: 100%;
      padding: 10rpx 0;
      border-bottom: 1rpx solid #ECECEC;
      color: #6D6D6D;
      justify-content: space-between;
    }
    .notices-info-name{
      margin-top: 10rpx;
      color: black;
      font-size: 30rpx;
      display: -webkit-box;  /*设置为弹性盒子*/
      -webkit-line-clamp: 2;  /*最多显示5行*/
      overflow: hidden;  /*超出隐藏*/
      text-overflow: ellipsis;  /*超出显示为省略号*/
      -webkit-box-orient: vertical;
      word-break: break-all;  /*强制英文单词自动换行*/
    }
    .notices-info-image image{
      width: 200rpx;
      height: 150rpx;
      margin: 10rpx 20rpx 0rpx 20rpx;
      border-radius: 10rpx;
    }
    .notices-info{
      margin: 10rpx 0rpx 0rpx 20rpx;
      height: 150rpx;
      flex-direction: column;
      display: flex;
      justify-content: space-between;
    }
    .notice-bottom{
      display: flex;
      text-align: left;
    }
    .notice-bottom view{
      margin-right: 20rpx;
    }
    .notice-bottom icon{
      color: #8a8a8a;
      display: inline-block;
      width: 40rpx;
      height: 40rpx;
    }
    .notice-bottom view text{
      font-size: 25rpx;
      line-height: 40rpx;
    }
</style>
components/index/index-notice.vue
@@ -1,7 +1,7 @@
<template>
    <view>
        <view class="active_box">
            <view class="active_title">社区公告</view>
            <!-- <view class="active_title">社区公告列表</view> -->
            <view class="active_list">
                <!--:scroll-left="scrollLeft"-->
                <scroll-view scroll-x class="bg-white nav" scroll-with-animation>
@@ -10,7 +10,7 @@
                        {{item.typeName}}
                    </view>
                </scroll-view>
                <view class="noticesList bg-white margin-top-1" v-if="notices && notices.length > 0">
                <scroll-view class="noticesList bg-white margin-top-1" v-if="notices && notices.length > 0" scroll-y @scrolltolower="loadMore" style="height: 100vh; overflow-y: scroll;">
                    <block v-for="(item,index) in notices" :key="index" wx:key="index">
                        <view class="noticesList-list" @tap="_toDetail(item)">
                            <view class="notices-info">
@@ -28,7 +28,7 @@
                            </view>
                        </view>
                    </block>
                </view>
                </scroll-view>
                <view class="active_empty" v-else>
                    <image :src="noImg" />
                    <text class="text">暂无活动哦~</text>
@@ -52,18 +52,24 @@
            return {
                notices: [],
                activitiTitle: [],
                noImg:this.imgUrl+'/h5/images/serve/empty.png',
                noImg: this.imgUrl + '/h5/images/serve/empty.png',
                curTypeCd: '',
                page: 1,
                row: 7,
                row: 8,
                communityId: '',
                isLoading: false, // 加载状态
                hasMore: true // 是否还有更多数据
            };
        },
        created() {
            this._loadData();
        },
        methods:{
            _loadData:function(){
        methods: {
            loadMore() {
                console.log(1111111)
                this._loadActivites(); // 调用加载数据的方法
            },
            _loadData: function() {
                let _that = this;
                this.vc.getCurCommunity()
                    .then(function(_communityInfo) {
@@ -93,9 +99,11 @@
            },
            _loadActivites: function() {
                let _that = this;
                if (this.curTypeCd == '') {
                    return;
                if (this.curTypeCd === '' || this.isLoading || !this.hasMore) {
                    return; // 如果当前没有选中的类型码,或者已经在加载中,或者没有更多数据,直接返回
                }
                this.isLoading = true; // 设置加载状态
                let _objData = {
                    page: this.page,
                    row: this.row,
@@ -107,7 +115,15 @@
                //加载活动
                loadActivites(_objData)
                    .then(function(_acts) {
                        _that.notices = _acts;
                        if (_acts.length < _that.row) {
                            _that.hasMore = false; // 如果返回的数据少于当前请求的行数,表示没有更多数据
                        } else {
                            _that.page++; // 增加页码,准备下一次请求
                        }
                        _that.notices = _that.notices.concat(_acts); // 合并新加载的数据
                    })
                    .finally(() => {
                        _that.isLoading = false; // 重置加载状态
                    });
            },
            _toDetail: function(_item) {
@@ -121,6 +137,7 @@
                this.curTypeCd = _item.typeCd;
                this.notices = [];
                this.page = 1;
                this.hasMore = true;
                this._loadActivites();
            },
        }
@@ -148,6 +165,7 @@
        }
        .active_list {
            margin-top: 10px;
            border-radius: 5px;
        }
@@ -195,57 +213,68 @@
            margin-right: 0;
        }
    }
    .noticesList-list{
      font-size: 25rpx;
      display: flex;
      width: 100%;
      padding: 10rpx 0;
      border-bottom: 1rpx solid #ECECEC;
      color: #6D6D6D;
      justify-content: space-between;
    .noticesList-list {
        font-size: 25rpx;
        display: flex;
        width: 100%;
        padding: 10rpx 0;
        border-bottom: 1rpx solid #ECECEC;
        color: #6D6D6D;
        justify-content: space-between;
    }
    .notices-info-name{
      margin-top: 10rpx;
      color: black;
      font-size: 30rpx;
      display: -webkit-box;  /*设置为弹性盒子*/
      -webkit-line-clamp: 2;  /*最多显示5行*/
      overflow: hidden;  /*超出隐藏*/
      text-overflow: ellipsis;  /*超出显示为省略号*/
      -webkit-box-orient: vertical;
      word-break: break-all;  /*强制英文单词自动换行*/
    .notices-info-name {
        margin-top: 10rpx;
        color: black;
        font-size: 30rpx;
        display: -webkit-box;
        /*设置为弹性盒子*/
        -webkit-line-clamp: 2;
        /*最多显示5行*/
        overflow: hidden;
        /*超出隐藏*/
        text-overflow: ellipsis;
        /*超出显示为省略号*/
        -webkit-box-orient: vertical;
        word-break: break-all;
        /*强制英文单词自动换行*/
    }
    .notices-info-image image{
      width: 200rpx;
      height: 150rpx;
      margin: 10rpx 20rpx 0rpx 20rpx;
      border-radius: 10rpx;
    .notices-info-image image {
        width: 200rpx;
        height: 150rpx;
        margin: 10rpx 20rpx 0rpx 20rpx;
        border-radius: 10rpx;
    }
    .notices-info{
      margin: 10rpx 0rpx 0rpx 20rpx;
      height: 150rpx;
      flex-direction: column;
      display: flex;
      justify-content: space-between;
    .notices-info {
        margin: 10rpx 0rpx 0rpx 20rpx;
        height: 150rpx;
        flex-direction: column;
        display: flex;
        justify-content: space-between;
    }
    .notice-bottom{
      display: flex;
      text-align: left;
    .notice-bottom {
        display: flex;
        text-align: left;
    }
    .notice-bottom view{
      margin-right: 20rpx;
    .notice-bottom view {
        margin-right: 20rpx;
    }
    .notice-bottom icon{
      color: #8a8a8a;
      display: inline-block;
      width: 40rpx;
      height: 40rpx;
    .notice-bottom icon {
        color: #8a8a8a;
        display: inline-block;
        width: 40rpx;
        height: 40rpx;
    }
    .notice-bottom view text{
      font-size: 25rpx;
      line-height: 40rpx;
    .notice-bottom view text {
        font-size: 25rpx;
        line-height: 40rpx;
    }
</style>
</style>
conf/config.js
@@ -15,9 +15,9 @@
// #ifndef H5
//服务器域名 小程序 或者 app 时 后端地址 
const baseUrl = 'https://zxshlx.com/';
// const baseUrl = 'https://zxshlx.com/';
// const baseUrl = 'http://192.168.31.137:8008/';
// const baseUrl = 'http://localhost:3000/';
const baseUrl = 'http://47.92.223.85:8008/';
// #endif
let commonBaseUrl = 'https://zxshlx.com/';
pages.json
@@ -158,6 +158,12 @@
            }
        },
        {
            "path": "pages/activites/notice",
            "style": {
                "navigationBarTitleText": "公告列表"
            }
        },
        {
            "path": "pages/activites/activitesDetail",
            "style": {
                "navigationBarTitleText": "详情"
pages/activites/notice.vue
New file
@@ -0,0 +1,170 @@
<template>
    <view>
        <index-notice ref="indexNoticeRef"></index-notice>
    </view>
</template>
<script>
    import uniNoticeBar from '@/components/uni-notice-bar/uni-notice-bar.vue'
    import indexAds from '@/components/index/index-ads.vue'
    import indexMenu from '@/components/index/index-menu.vue'
    import indexNotice from '@/components/index/index-notice.vue';
    import {
        getActivitiTitle,
        getCategoryList,
        loadActivites,
        loadAdverts
    } from '../../api/index/indexApi.js'
    import {
        getCommunityId,
        getMallCommunityId,
        getMallCommunityName
    } from '../../api/community/communityApi.js';
    import {
        getCurOwner
    } from '../../api/owner/ownerApi.js'
    import {
        hasLogin
    } from '../../lib/java110/page/Page.js'
    import {
        hasOwner
    } from '../../api/owner/ownerApi.js';
    import conf from '@/conf/config.js';
    import {autoLogin} from '../../api/user/sessionApi.js';
    export default {
        data() {
            return {
                selectCommunityName: "",
                communityId: '',
                selected: 0,
                mask1Hidden: true,
                mask2Hidden: true,
                animationData: "",
                location: "",
                characteristicSelected: [false, false, false, false, false, false, false],
                discountSelected: null,
                selectedNumb: 0,
                sortSelected: "综合排序",
            };
        },
        components: {
            uniNoticeBar,
            indexAds,
            indexMenu,
            indexNotice,
        },
        /**
         * 生命周期函数--监听页面加载
         */
        onLoad: function(options) {
            let _that = this;
            uni.setNavigationBarTitle({
                title:conf.systemName
            })
            this.vc.onLoad(options);
            autoLogin(options);
            //查询目录
        },
        onShareAppMessage: function() {
            return {
                title: '首页',
                path: '/pages/index/index?wAppId=' + this.vc.getWAppId(),
                success: function(res) {
                    // 转发成功
                },
                fail: function(res) {
                    // 转发失败
                }
            }
        },
        /**
         * 生命周期函数--监听页面显示
         */
        onShow: function() {
            this.selectCommunityName = getMallCommunityName();
            let _that = this;
            _that.location = this.vc.getStorageSync('location');
            if (hasLogin()) {
                _that.judgeBindOwnerFun();
            }
            if(this.$refs.indexNoticeRef){
                this.$refs.indexNoticeRef._loadData();
            }
        },
        /**
         * 页面上拉触底事件的处理函数
         */
        onReachBottom: function() {
        },
        methods: {
            judgeBindOwnerFun: function() {
                //查询业主
                getCurOwner();
            },
            /**
             * 加载活动
             * 第一次加载是可能没有小区 则直接下载固定小区
             *
             */
            showModal: function(e) {
                this.vc.navigateTo({
                    url: '../bindOwner/bindOwner'
                });
            },
            toPage: function(pageUrl) {
                hasOwner();
                this.vc.navigateTo({
                    url: pageUrl
                });
            },
        }
    };
</script>
<style lang="less">
    // @import "./index.css";
    .bock-icon {
        height: 34upx;
        width: 14upx;
        line-height: 100upx;
        background-color: #00AA00;
    }
    .margin-top-1 {
        margin-top: 2upx;
    }
    .tec-height {
        height: 120upx;
    }
    .home_hd {
        position: relative;
        height: 30upx;
        margin-bottom: 20upx;
        display: flex;
        align-items: center;
        justify-content: space-between;
    }
    .home_wrap {
        padding: 20upx 20upx 0;
    }
    .home_swiper {
        margin-bottom: 20upx;
    }
</style>
pages/index/index.vue
@@ -6,7 +6,7 @@
            <index-menu></index-menu>
        </view>
        <index-notice ref="indexNoticeRef"></index-notice>
        <index-noshow ref="indexNoticeRef"></index-noshow>
        
    
    </view>
@@ -16,7 +16,7 @@
    import uniNoticeBar from '@/components/uni-notice-bar/uni-notice-bar.vue'
    import indexAds from '@/components/index/index-ads.vue'
    import indexMenu from '@/components/index/index-menu.vue'
    import indexNotice from '@/components/index/index-notice.vue';
    import indexNoshow from '@/components/index/index-noshow.vue';
    import {
        getActivitiTitle,
        getCategoryList,
@@ -64,7 +64,7 @@
            uniNoticeBar,
            indexAds,
            indexMenu,
            indexNotice,
            indexNoshow,
        },
        /**
         * 生命周期函数--监听页面加载