Browse Source

no message

featrue/v4.5
xpz2018 4 years ago
parent
commit
bb72fc0bf3
2 changed files with 22 additions and 45 deletions
  1. 38
      pages/agent/factory/index.js
  2. 29
      pages/article/detail/index.js

38
pages/agent/factory/index.js

@ -66,7 +66,6 @@ Page({
wx.hideLoading()
}).catch(err => {
wx.hideLoading()
console.log(err)
util.showToast(err)
})
}
@ -74,6 +73,8 @@ Page({
onEvent: function (message) {
if (message.what == 570 || message.what == 571 || message.what == 572 || message.what == 573) {
this.onRefreshList()
} else if(message.what == 200){
this.setData({ visible: false })
}
},
onFixedChange: function ({ detail }) {
@ -140,11 +141,7 @@ Page({
if (this.data.requesting) {
return
}
this.setData({
momentList: [],
['form.pageNum']: 1,
finished: false
})
this.setData({ momentList: [], ['form.pageNum']: 1, finished: false })
this.fetchMomentList()
},
fetchMomentList: function () {
@ -158,22 +155,12 @@ Page({
let nowList = `momentList[${this.data.momentList.length}]`
var num = this.data.form.pageNum
var finished = this.data.form.pageNum >= result.data.pages
this.setData({
[nowList]: respList,
['form.pageNum']: (num + 1),
requesting: false,
finished
})
this.setData({ [nowList]: respList, ['form.pageNum']: (num + 1), requesting: false, finished })
} else {
this.setData({
finished: true,
requesting: false
})
this.setData({ finished: true, requesting: false })
}
}).catch(err => {
this.setData({
requesting: false
})
this.setData({ requesting: false })
})
},
//分享至朋友
@ -185,10 +172,9 @@ Page({
},
//分享至朋友圈
onShareTimeline(res){
console.log(res)
return {
title: this.data.factoryDetail.name + '废纸报价',
path: 'pages/index/index?url=/pages/agent/factory/index&key=id&value=' + this.data.factoryDetail.paperMillId
title: this.data.factoryDetail.name + '废纸报价',
path: 'pages/index/index?url=/pages/agent/factory/index&key=id&value=' + this.data.factoryDetail.paperMillId
}
},
toService: function () {
@ -235,15 +221,11 @@ Page({
if (result.data.paperCategoryList && result.data.paperCategoryList.length) {
this.data.cateId = result.data.paperCategoryList[this.data.cateIndex].categoryId
}
this.setData({
factoryDetail: result.data,
hasFollowed:result.data.hasFollowed
})
this.setData({ factoryDetail: result.data, hasFollowed:result.data.hasFollowed })
wx.hideLoading()
}).catch(err => {
wx.hideLoading()
util.showToast(err)
})
},
}
})

29
pages/article/detail/index.js

@ -1,6 +1,7 @@
import { getMomentDetail, getCommentList, likeMoment, likeComment, commentMoment } from "../../../api/moment"
const util = require('../../../utils/util')
const tdsdk = require('../../../libs/tdweapp')
const event = require('../../../utils/event.js')
const app = getApp()
Page({
@ -34,11 +35,8 @@ Page({
if (options.type) {
this.data.type = Number(options.type)
}
this.setData({
type: this.data.type,
safeBottom: app.globalData.safeBottom,
height: app.globalData.safeFragmentHeight - 100
})
event.on('EventMessage', this, this.onEvent)
this.setData({ type: this.data.type, safeBottom: app.globalData.safeBottom, height: app.globalData.safeFragmentHeight - 100 })
if (options.id) {
this.data.id = options.id
this.data.form.articleId = options.id
@ -68,11 +66,7 @@ Page({
if (this.data.requesting) {
return
}
this.setData({
commentList: [],
['form.pageNum']: 1,
finished: false
})
this.setData({ commentList: [], ['form.pageNum']: 1, finished: false })
this.fetchCommentList()
},
fetchCommentList: function () {
@ -107,15 +101,10 @@ Page({
})
}
} else {
this.setData({
requesting: false,
finished: true
})
this.setData({ requesting: false, finished: true })
}
}).catch(err => {
this.setData({
requesting: false
})
this.setData({ requesting: false })
})
},
onTabChange: function (e) {
@ -421,10 +410,16 @@ Page({
onShow: function () {
tdsdk.Page.onShow()
},
onEvent: function (message) {
if(message.what == 200){
this.setData({ visible: false })
}
},
onHide: function(){
tdsdk.Page.onHide()
},
onUnload: function () {
event.remove('EventMessage', this)
tdsdk.Page.onUnload()
}
})
Loading…
Cancel
Save