Browse Source

no message

featrue/v4.5
xpz2018 4 years ago
parent
commit
af5117065f
6 changed files with 33 additions and 11 deletions
  1. 3
      pages/moment/attention/index.json
  2. 30
      pages/moment/fragment/index.js
  3. 2
      pages/moment/fragment/index.wxml
  4. 3
      pages/moment/information/index.json
  5. 3
      pages/moment/theall/index.js
  6. 3
      pages/moment/theall/index.json

3
pages/moment/attention/index.json

@ -3,6 +3,7 @@
"usingComponents": {
"wux-skeleton": "/components/skeleton/index",
"wux-skeleton-paragraph": "/components/skeleton-paragraph/index",
"moment-item": "/pages/moment/moment-item/index"
"moment-item": "/pages/moment/moment-item/index",
"wux-divider": "/components/divider/index"
}
}

30
pages/moment/fragment/index.js

@ -1,8 +1,10 @@
// pages/message/index.js
import { getSuccessNotices } from "../../../api/ztb"
import { getInformationList } from "../../../api/moment"
const event = require('../../../utils/event')
const util = require('../../../utils/util')
const math = require('../../../utils/math')
const app = getApp()
var params = {byQueryType: 2, pageNum: 1}
Component({
options: {
@ -45,6 +47,7 @@ Component({
tabIndex: 0,
firstShow: true
})
params.date = util.formatDate(new Date(), 'Y-M-D')
}
this.data.firstShow = true
if(!this.data.noticeList.length){
@ -94,22 +97,37 @@ Component({
return
}
this.data.loopRequesting = true
getSuccessNotices().then(result => {
getInformationList(params).then(result => {
this.data.loopRequesting = false
this.data.noticeList = []
if(result.data && result.data.length){
for (let index = 0; index < result.data.length; index++) {
this.data.noticeList.push(result.data[index].msg)
if(result.data && result.data.records.length){
for (let index = 0; index < result.data.records.length; index++) {
this.handResult(result.data.records[index])
}
this.setData({noticeList: this.data.noticeList})
}
}).catch(err => {
console.log(err)
this.data.loopRequesting = false
})
},
handResult: function(record){
console.log(record)
// if(record.latestQuoteTime.indexOf(params.data) < 0){
// return
// }
if(record.typicalFloatingQuotedPrice > 0){
record.content = record.paperMillName + '上涨' + math.times(record.typicalFloatingQuotedPrice, 1000) + '元/吨'
} else if(record.typicalFloatingQuotedPrice < 0){
record.content = record.paperMillName + '下降' + math.times(-record.typicalFloatingQuotedPrice, 1000) + '元/吨'
} else if(record.typicalFloatingQuotedPrice == 0){
record.content = record.paperMillName + '最新收购价格:' + math.times(record.typicalFloatingQuotedPrice, 1000) + '元/吨'
}
this.data.noticeList.push(record)
},
toNotice: function(e){
var item = this.data.noticeList[e.currentTarget.dataset.index]
console.log(item)
util.navigateTo('/pages/agent/factory/index?id=' + item.paperMillId)
},
onResume: function(){
var fragment = null

2
pages/moment/fragment/index.wxml

@ -21,7 +21,7 @@
<swiper vertical="{{true}}" autoplay="{{true}}" circular="{{true}}" interval="3000" class="tui-swiper">
<swiper-item wx:for="{{noticeList}}" wx:key="index" class="flex flex-center" catchtouchmove="stopTouchMove" style="justify-content: flex-start">
<view class="flex flex-justify" style="width: 100%;height: 100%;" data-index="{{index}}" bindtap="toNotice">
<view class="tui-news-item">{{item}}</view>
<view class="tui-news-item">{{item.content}}</view>
<image src="/assets/image/icon-arrow.png" style="height: 24rpx;width: 24rpx;margin-left: 8rpx;"></image>
</view>
</swiper-item>

3
pages/moment/information/index.json

@ -4,6 +4,7 @@
"wux-tabi": "/components/tabi/index",
"wux-skeleton": "/components/skeleton/index",
"wux-skeleton-paragraph": "/components/skeleton-paragraph/index",
"info-item": "/pages/moment/info-item/index"
"info-item": "/pages/moment/info-item/index",
"wux-divider": "/components/divider/index"
}
}

3
pages/moment/theall/index.js

@ -79,7 +79,7 @@ Component({
getInformationList(this.data.form).then(result => {
if (result.data && result.data.records.length) {
var respList = result.data.records
let nowList = `orderList[${this.data.orderList2.length}]`
let nowList = `orderList[${this.data.orderList.length}]`
var num = this.data.form.pageNum
var finished = this.data.form.pageNum >= result.data.pages
this.setData({ [nowList]: respList, ['form.pageNum']: (num + 1), finished, requesting: false, loading: false })
@ -87,6 +87,7 @@ Component({
this.setData({ finished: true, requesting: false, loading: false })
}
}).catch(err => {
console.log(err)
this.setData({ requesting: false, loading: false })
util.showToast(err)
})

3
pages/moment/theall/index.json

@ -4,6 +4,7 @@
"wux-tabi": "/components/tabi/index",
"wux-skeleton": "/components/skeleton/index",
"wux-skeleton-paragraph": "/components/skeleton-paragraph/index",
"moment-item": "/pages/moment/moment-item/index"
"moment-item": "/pages/moment/moment-item/index",
"wux-divider": "/components/divider/index"
}
}
Loading…
Cancel
Save