| "pages/myModule/components/myRelease/myRelease", | "pages/myModule/components/myRelease/myRelease", | ||||
| "pages/myModule/components/myAttention/myAttention", | "pages/myModule/components/myAttention/myAttention", | ||||
| "pages/outLink/outLink", | "pages/outLink/outLink", | ||||
| "pages/login/login" | |||||
| "pages/login/login", | |||||
| "pages/msgModule/wechat2/wechat2" | |||||
| ], | ], | ||||
| "usingComponents": { | "usingComponents": { | ||||
| "tabBar": "/components/tabbar/tabbar", | "tabBar": "/components/tabbar/tabbar", |
| text: "我关注的", | text: "我关注的", | ||||
| value: "my1" | value: "my1" | ||||
| }, | }, | ||||
| { | |||||
| text: "工商类", | |||||
| value: "工商类" | |||||
| }, | |||||
| { | |||||
| text: "财税类", | |||||
| value: "财税类" | |||||
| }, | |||||
| { | |||||
| text: "资质类", | |||||
| value: "资质类" | |||||
| }, | |||||
| ], | ], | ||||
| currentTab: "all", | currentTab: "all", | ||||
| // 更多tab | // 更多tab | ||||
| moreTabOption: [], | |||||
| moreTabOption: [ | |||||
| { | |||||
| text: "公司转让", | |||||
| value: "公司转让" | |||||
| }, | |||||
| { | |||||
| text: "知识产权", | |||||
| value: "知识产权" | |||||
| }, | |||||
| { | |||||
| text: "银行服务", | |||||
| value: "银行服务" | |||||
| }, | |||||
| { | |||||
| text: "法律服务", | |||||
| value: "法律服务" | |||||
| }, | |||||
| { | |||||
| text: "其他", | |||||
| value: "其他" | |||||
| }, | |||||
| ], | |||||
| moreTab: "gengduo", | moreTab: "gengduo", | ||||
| moreTitle: "更多", | moreTitle: "更多", | ||||
| // list数据加载 | // list数据加载 | ||||
| // list块加载 | // list块加载 | ||||
| listLoading: false, | |||||
| listLoading: true, | |||||
| // item行加载 | // item行加载 | ||||
| itemLoading: false, | itemLoading: false, | ||||
| // 数据是否加载完成 | // 数据是否加载完成 | ||||
| onRefresh: true, | onRefresh: true, | ||||
| }, | }, | ||||
| onLoad() { | onLoad() { | ||||
| this.setData({ | |||||
| listLoading: true, | |||||
| }) | |||||
| // 获取分类 | |||||
| this.getAllType(); | |||||
| this.getListData(); | |||||
| }, | }, | ||||
| toggleMore() { | toggleMore() { | ||||
| this.selectComponent('#item').toggle(); | this.selectComponent('#item').toggle(); |
| // pages/release/release.js | // pages/release/release.js | ||||
| // 获取应用实例 | // 获取应用实例 | ||||
| const app = getApp() | const app = getApp() | ||||
| const $request = require('../../utils/request.js'); | |||||
| const $util = require('../../utils/util.js'); | |||||
| Page({ | Page({ | ||||
| data: { | data: { | ||||
| currentIndex: 2, | currentIndex: 2, | ||||
| customerId: "", | customerId: "", | ||||
| // 前往关注公众号 | // 前往关注公众号 | ||||
| topShow: true, | topShow: true, | ||||
| msgData: [], | |||||
| page: 1, | |||||
| size: 10, | |||||
| total: 0, | |||||
| // 是否加载数据,true加载,false不加载 | |||||
| onRefresh: true, | |||||
| }, | }, | ||||
| /** | /** | ||||
| * 生命周期函数--监听页面加载 | * 生命周期函数--监听页面加载 | ||||
| }) | }) | ||||
| }, | }, | ||||
| getMsgData() { | getMsgData() { | ||||
| setTimeout(() => { | |||||
| let { page, size } = this.data; | |||||
| $request.get('/businessCommunicationDemand/getChatRecordTable.action', { page, size }).then(res => { | |||||
| console.log(res); | |||||
| let tempListData = this.data.msgData; | |||||
| if (res.status == 0) { | |||||
| let datas = res.data; | |||||
| console.log(datas, 'datas') | |||||
| // 先push数据 | |||||
| tempListData.push(...datas.chatRecordTable); | |||||
| tempListData.forEach(el => { | |||||
| el.createdOn = $util.formatTime(new Date(el.createdOn), true); | |||||
| if (typeof el.type == 'string') { | |||||
| el.type = el.type.split(','); | |||||
| } | |||||
| }) | |||||
| // 设置总数 | |||||
| this.setData({ | |||||
| msgData: tempListData, | |||||
| total: datas.total, | |||||
| }) | |||||
| // 如果数据大于了返回的总数 | |||||
| if (tempListData.length >= this.data.total) { | |||||
| // 停止累加数据 | |||||
| this.setData({ | |||||
| onRefresh: false, | |||||
| itemLoading: false, | |||||
| }) | |||||
| } else { | |||||
| this.setData({ | |||||
| onRefresh: true, | |||||
| itemLoading: false, | |||||
| page: page + 1 | |||||
| }) | |||||
| } | |||||
| console.log('-------------消息 beg-------------------') | |||||
| console.log(this.data.msgData); | |||||
| console.log('-------------消息 end-------------------') | |||||
| } | |||||
| this.setData({ | |||||
| pageLoading: false, | |||||
| }) | |||||
| }).catch(error => { | |||||
| console.log(error, 'error appletLogin') | |||||
| }) | |||||
| }, | |||||
| /** | |||||
| * 页面上拉触底事件的处理函数 | |||||
| */ | |||||
| onReachBottom: function () { | |||||
| if (this.data.onRefresh) { | |||||
| this.setData({ | this.setData({ | ||||
| pageLoading: false | |||||
| itemLoading: true | |||||
| }) | }) | ||||
| }, 500); | |||||
| this.getListData(); | |||||
| } | |||||
| }, | }, | ||||
| }) | }) |
| <view class="list-loading text-center" wx:if="{{ pageLoading }}"> | <view class="list-loading text-center" wx:if="{{ pageLoading }}"> | ||||
| <van-loading size="24px">加载中...</van-loading> | <van-loading size="24px">加载中...</van-loading> | ||||
| </view> | </view> | ||||
| <view wx:else> | |||||
| <view wx:else class="body-view"> | |||||
| <view class="top-view" wx:if="{{ topShow }}"> | <view class="top-view" wx:if="{{ topShow }}"> | ||||
| <image class="msg-top-img fl" src="/images/home/msg-top-icon.png" /> | <image class="msg-top-img fl" src="/images/home/msg-top-icon.png" /> | ||||
| <view class="msg-text fl">关注公众号可随时接收离线消息~</view> | <view class="msg-text fl">关注公众号可随时接收离线消息~</view> | ||||
| <van-button color="#5e73e5" round class="msg-btn-go fl" size="small">前往关注</van-button> | <van-button color="#5e73e5" round class="msg-btn-go fl" size="small">前往关注</van-button> | ||||
| <image class="msg-colse-img fl" src="/images/home/close.png" bind:tap="closeTopShow"/> | |||||
| <image class="msg-colse-img fl" src="/images/home/close.png" bind:tap="closeTopShow" /> | |||||
| </view> | </view> | ||||
| <view class="msg-box-view"> | |||||
| <view class="msg-box-view {{ topShow ? 'topShow' : '' }} not-msg-data" wx:if="{{ msgData.length < 1 }}"> | |||||
| <image class="not-msg-data-img " src="/images/home/not-msg-data.png"/> | |||||
| <view class="not-data-msg-info">暂无消息记录</view> | |||||
| </view> | </view> | ||||
| <view wx:else class="msg-box-view {{ topShow ? 'topShow' : '' }}"></view> | |||||
| </view> | </view> | ||||
| <tabBar currentIndex="{{currentIndex}}"></tabBar> | <tabBar currentIndex="{{currentIndex}}"></tabBar> | ||||
| </view> | </view> |
| /* pages/msgPage/msgPage.wxss */ | /* pages/msgPage/msgPage.wxss */ | ||||
| .msg-page { | |||||
| min-height: calc(100vh - 150rpx); | |||||
| } | |||||
| .top-view { | .top-view { | ||||
| background: #fff; | background: #fff; | ||||
| box-sizing: border-box; | box-sizing: border-box; | ||||
| line-height: 88rpx; | line-height: 88rpx; | ||||
| box-shadow: -1px 3px 12px 4px rgba(186, 186, 186, 0.1); | box-shadow: -1px 3px 12px 4px rgba(186, 186, 186, 0.1); | ||||
| border-radius: 20rpx; | border-radius: 20rpx; | ||||
| margin-bottom: 20rpx; | |||||
| } | } | ||||
| .top-view .msg-top-img { | .top-view .msg-top-img { | ||||
| width: 87rpx; | width: 87rpx; | ||||
| height: 30rpx; | height: 30rpx; | ||||
| margin-left: 10rpx; | margin-left: 10rpx; | ||||
| margin-top: 29rpx; | margin-top: 29rpx; | ||||
| } | |||||
| .msg-box-view { | |||||
| background: #fff; | |||||
| box-sizing: border-box; | |||||
| border-radius: 20rpx; | |||||
| min-height: calc(100vh - 150rpx); | |||||
| } | |||||
| .msg-box-view.topShow{ | |||||
| min-height: calc(100vh - 258rpx); | |||||
| } | |||||
| .msg-box-view.not-msg-data{ | |||||
| text-align: center; | |||||
| box-sizing: border-box; | |||||
| padding-top: 140rpx; | |||||
| } | |||||
| .msg-box-view.not-msg-data .not-msg-data-img{ | |||||
| width: 302rpx; | |||||
| height: 224rpx; | |||||
| } | |||||
| .msg-box-view.not-msg-data .not-data-msg-info{ | |||||
| font-size: 24rpx; | |||||
| color: #b3bfcb; | |||||
| margin-top: 20rpx; | |||||
| } | } |
| // pages/msgModule/wechat2/wechat2.js | |||||
| Page({ | |||||
| /** | |||||
| * 页面的初始数据 | |||||
| */ | |||||
| data: { | |||||
| }, | |||||
| /** | |||||
| * 生命周期函数--监听页面加载 | |||||
| */ | |||||
| onLoad: function (options) { | |||||
| }, | |||||
| /** | |||||
| * 生命周期函数--监听页面初次渲染完成 | |||||
| */ | |||||
| onReady: function () { | |||||
| }, | |||||
| /** | |||||
| * 生命周期函数--监听页面显示 | |||||
| */ | |||||
| onShow: function () { | |||||
| }, | |||||
| /** | |||||
| * 生命周期函数--监听页面隐藏 | |||||
| */ | |||||
| onHide: function () { | |||||
| }, | |||||
| /** | |||||
| * 生命周期函数--监听页面卸载 | |||||
| */ | |||||
| onUnload: function () { | |||||
| }, | |||||
| /** | |||||
| * 页面相关事件处理函数--监听用户下拉动作 | |||||
| */ | |||||
| onPullDownRefresh: function () { | |||||
| }, | |||||
| /** | |||||
| * 页面上拉触底事件的处理函数 | |||||
| */ | |||||
| onReachBottom: function () { | |||||
| }, | |||||
| /** | |||||
| * 用户点击右上角分享 | |||||
| */ | |||||
| onShareAppMessage: function () { | |||||
| } | |||||
| }) |
| { | |||||
| "usingComponents": {} | |||||
| } |
| <!--pages/msgModule/wechat2/wechat2.wxml--> | |||||
| <text>pages/msgModule/wechat2/wechat2.wxml</text> |
| /* pages/msgModule/wechat2/wechat2.wxss */ |
| // 我发布的需求---- | // 我发布的需求---- | ||||
| // item行加载 | // item行加载 | ||||
| itemLoading: false, | itemLoading: false, | ||||
| // 数据是否加载完成 | |||||
| isFinished: false, | |||||
| listData: [], | listData: [], | ||||
| page: 1, | page: 1, | ||||
| size: 10, | size: 10, | ||||
| this.setData({ | this.setData({ | ||||
| listData: [], | listData: [], | ||||
| onRefresh: true, | onRefresh: true, | ||||
| isFinished: false, | |||||
| listLoading: true, | listLoading: true, | ||||
| page: 1, | page: 1, | ||||
| }) | }) | ||||
| this.setData({ | this.setData({ | ||||
| onRefresh: false, | onRefresh: false, | ||||
| itemLoading: false, | itemLoading: false, | ||||
| isFinished: true, | |||||
| }) | }) | ||||
| } else { | } else { | ||||
| this.setData({ | this.setData({ | ||||
| onRefresh: true, | onRefresh: true, | ||||
| itemLoading: false, | itemLoading: false, | ||||
| isFinished: false, | |||||
| page: page + 1 | page: page + 1 | ||||
| }) | }) | ||||
| } | } |