Browse Source

no message

featrue/v4.5
xpz2018 4 years ago
parent
commit
8ca9b2a87f
4 changed files with 54 additions and 2 deletions
  1. 45
      pages/mall/search-list/index.js
  2. 7
      pages/mall/search-list/index.wxml
  3. 1
      pages/moment/moment-item/index.js
  4. 3
      pages/moment/moment-item/index.wxml

45
pages/mall/search-list/index.js

@ -26,6 +26,7 @@ Page({
loading: false, loading: false,
requesting: false, requesting: false,
finished: false, finished: false,
dataIndex: 0,
taskList: [] taskList: []
}, },
/** /**
@ -82,6 +83,13 @@ Page({
return return
} }
this.data.tabIndex = Number(detail.index) this.data.tabIndex = Number(detail.index)
if (!app.globalData.userInfo && Number(detail.index) == 2) {
this.data.form.pageNum = 1
this.data.dataIndex = 0
this.setData({ taskList: [], finished: false, requesting: false })
wx.navigateTo({ url: '/pages/login/index' })
return
}
if(util.isEmpty(this.data.form.searchKey)){ if(util.isEmpty(this.data.form.searchKey)){
return return
} }
@ -117,6 +125,7 @@ Page({
searchList = rearchStringList searchList = rearchStringList
} }
this.data.form.pageNum = 1 this.data.form.pageNum = 1
this.data.dataIndex = 0
this.setData({ taskList: [], loading: true, finished: false, searchList, keyIndex: this.data.keyIndex, focus: false, ['form.searchKey']: detail.value }) this.setData({ taskList: [], loading: true, finished: false, searchList, keyIndex: this.data.keyIndex, focus: false, ['form.searchKey']: detail.value })
this.fetchTaskList() this.fetchTaskList()
}, },
@ -143,7 +152,7 @@ Page({
} else if(this.data.tabIndex == 1){ } else if(this.data.tabIndex == 1){
getInformationList(this.data.form).then(result => { getInformationList(this.data.form).then(result => {
if (result.data && result.data.records.length) { if (result.data && result.data.records.length) {
this.handRespList(result.data)
this.handMomentResult(result.data)
} else { } else {
this.setData({ finished: true, requesting: false, loading: false, tabIndex: this.data.tabIndex }) this.setData({ finished: true, requesting: false, loading: false, tabIndex: this.data.tabIndex })
} }
@ -175,6 +184,40 @@ Page({
}) })
} }
}, },
handMomentResult: function(data){
var respList = data.records
var lastTime = null
if(this.data.dataIndex < 2){
// 对返回的消息列表进行处理,将同一天的消息显示在一起
var qrtime = new Date(this.data.form.date).getTime()
for (let i = 0; i < respList.length; i++) {
if(this.data.dataIndex == 2){
continue
}
lastTime = respList[i].latestQuoteTime
if (lastTime && lastTime.length > 10) {
lastTime = lastTime.substring(0, 10)
}
var itemtime = new Date(lastTime).getTime()
if(this.data.dataIndex == 0){
if(itemtime > qrtime){
this.data.dataIndex = 1
respList[i].tipsTime = lastTime
} else {
this.data.dataIndex = 2
respList[i].tipsTime = this.data.form.date
}
} else if(this.data.dataIndex == 1 && itemtime <= qrtime){
this.data.dataIndex = 2
respList[i].tipsTime = this.data.form.date
}
}
}
let nowList = `taskList[${this.data.taskList.length}]`
var num = this.data.form.pageNum
var finished = this.data.form.pageNum >= data.pages
this.setData({ [nowList]: respList, total: data.total, ['form.pageNum']: (num + 1), finished, requesting: false, loading: false, tabIndex: this.data.tabIndex })
},
handRespList: function(data){ handRespList: function(data){
let nowList = `taskList[${this.data.taskList.length}]` let nowList = `taskList[${this.data.taskList.length}]`
var num = this.data.form.pageNum var num = this.data.form.pageNum

7
pages/mall/search-list/index.wxml

@ -34,6 +34,13 @@
<view class="text-empty">暂无数据</view> <view class="text-empty">暂无数据</view>
</view> </view>
<scroll-view scroll-y scroll-top="{{top}}" style="height:{{height - 90}}rpx;" wx:else bindscrolltolower="fetchTaskList"> <scroll-view scroll-y scroll-top="{{top}}" style="height:{{height - 90}}rpx;" wx:else bindscrolltolower="fetchTaskList">
<view class="bg-white flex flex-center" style="height: 80rpx;padding: 0rpx 32rpx;" wx:if="{{tabIndex == 1}}">
<view style="width: 30%;">纸厂名称</view>
<view style="width: 30%;">涨跌幅</view>
<view style="width: 20%;">车辆排队</view>
<view style="width: 16%;">起扣点</view>
<view style="min-width: 48rpx;height: 24rpx;"><text></text></view>
</view>
<view wx:for-item="pageItem" wx:for-index="pageIndex" wx:for="{{taskList}}" wx:key="pageIndex"> <view wx:for-item="pageItem" wx:for-index="pageIndex" wx:for="{{taskList}}" wx:key="pageIndex">
<view wx:for="{{pageItem}}" wx:key="index"> <view wx:for="{{pageItem}}" wx:key="index">
<view style="height:16rpx" wx:if="{{ (tabIndex == 0 || tabIndex == 2) && (pageIndex != 0 || index != 0)}}"></view> <view style="height:16rpx" wx:if="{{ (tabIndex == 0 || tabIndex == 2) && (pageIndex != 0 || index != 0)}}"></view>

1
pages/moment/moment-item/index.js

@ -10,6 +10,7 @@ Component({
multipleSlots: true multipleSlots: true
}, },
properties: { properties: {
keyword: { type: String, value: null },
item: { type: Object, value: null }, item: { type: Object, value: null },
mclick: { type: Boolean, value: true } mclick: { type: Boolean, value: true }
}, },

3
pages/moment/moment-item/index.wxml

@ -3,7 +3,8 @@
<view class="item-tips" wx:if="{{item.tipsTime}}">{{moment.formateDate(item.tipsTime)}}</view> <view class="item-tips" wx:if="{{item.tipsTime}}">{{moment.formateDate(item.tipsTime)}}</view>
<view class="bg-white flex flex-justify" style="padding:18rpx 32rpx"> <view class="bg-white flex flex-justify" style="padding:18rpx 32rpx">
<view style="width: 30%;" > <view style="width: 30%;" >
<view class="text-df text-black text-cut" bindtap="lookItem">{{item.shortName}}</view>
<highlight-text content="{{item.shortName}}" keyword="{{keyword}}" class="text-df text-black text-cut"/>
<!-- <view class="text-df text-black text-cut" bindtap="lookItem">{{item.shortName}}</view> -->
<view class="{{item.hasFollowed ? 'attention-bg' : 'attention-unbg'}}" catchtap="attention"> <view class="{{item.hasFollowed ? 'attention-bg' : 'attention-unbg'}}" catchtap="attention">
<text>{{item.hasFollowed ? '已关注' : '点击关注'}}</text> <text>{{item.hasFollowed ? '已关注' : '点击关注'}}</text>
</view> </view>

Loading…
Cancel
Save