时间:2019-05-03 来源:小程序工厂
J***:
你好,方便给一下详情页的简单demo么,可以剔除掉敏感的业务代码,换成无关紧要的代码。
一***:
//初始化数据
initData() {
let postData = {
url: 'xxx',
data: {
partJobId: this.data.partJobId,
lat: wx.getStorageSync('latitude'),
lon: wx.getStorageSync('longitude')
}
}
wx.showLoading({
title: '加载中'
})
app.ajax(postData).then((res) => {
wx.hideLoading()
if (res.success) {
var eventList = []
eventList.push({
eventId: 'P0240001',
partJobId: this.data.partJobId
})
util.buriedPoint(JSON.stringify(eventList))
if (res.data.targetUrlContent) {
WxParse.wxParse('article', 'html', res.data.targetUrlContent, this, 5)
}
this.setData({
partJobVo: res.data,
evaluateStar: Math.round(res.data.company.evaluateStar)
})
if (res.data.entryCountDown) {
this.data.entryCountDown = res.data.entryCountDown
}
if (res.data.partJobApplyStatus === 5) {
this.data.countdown = res.data.applyCountdown - 60
let that = this
var timer = setInterval(() => {
if (this.data.countdown <= 0) {
clearInterval(timer)
that.data.partJobVo.partJobApplyStatus = 6
let obj = that.data.partJobVo
obj.partJobApplyStatus = 6
that.setData({
partJobVo: obj
})
that.Timersertim(that.data.entryCountDown)
that.changeApplyStatus()
} else {
that.data.countdown -= 1
}
}, 1000)
}
if (res.data.jobDate) {
if (res.data.cycleType.key === '2') {
this.timedata = res.data.jobDate
} else if (res.data.cycleType.key === '1') {
let datesStr = res.data.jobDate
let dateJson = {
dateJson: util.sprDay(datesStr)
}
for (var z = 0; z < util.sprDay(datesStr).length; z++) {
this.timedata = util.sprDay(datesStr)[z].mouth
for (var i = 0; i < this.timedata.length; i++) {
this.timedata[i].mouth = util.convertToChinese(this.timedata[i].mouth)
}
this.setData({
timedata: this.timedata
})
}
}
}
this.changeApplyStatus()
if (res.data.entryCountDown) {
this.dataentryCountDown = res.data.entryCountDown
}
if (this.data.partJobVo.hasFavorite) {
this.setData({
collectimg: 'https://ojlf2aayk.qnssl.com/stars.png'
})
} else {
this.setData({
collectimg: 'https://ojlf2aayk.qnssl.com/iscollect-gray.png'
})
}
} else {
this.wetoast.toast({
title: res.msg,
duration: 1500
})
}
}, () => {
this.wetoast.toast({
title: '服务器错误,请稍后重试',
duration: 1500
})
})
},
launchApp使用后如果其他打开用户没有安装APP怎么办
一***:
引入了一个WxParse的插件,但是另外一个页面没引入 也没啥问题
一***:
/页面初始化加载
onLoad: function(options) {
app.mta.Page.init()
new app.WeToast()
if (!options.scene) {
this.setData({
partJobId: options.partJobId,
authorizedKey: options.authorizedKey
})
} else {
this.setData({
partJobId: decodeURIComponent(options.scene)
})
}
// let that = this
// wx.getSystemInfo({
// success: function(res) {
// if (res.system.indexOf('iOS') > -1 && res.version === '6.5.22') {
// that.setData({
// isVersion: false
// })
// }
// that.setData({
// screenWidth: res.screenWidth,
// canvasWidth: res.screenWidth / 375 * 343,
// canvasHeight: res.screenHeight / 667 * 220