You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

59 lines
1.3 KiB

var Api = require("../../../utils/util.js");
Page({
data: {
detail:{}
},
onLoad: function(options) {
if(options.id){
this.setData({
id: options.id,
})
}
var that = this,
data = {
id: options.id,
readId: wx.getStorageSync('userId'),
}
wx.showLoading({
title: '加载中...',
})
Api.req('sf/platformAnnouncement/detail', data, 'get')
.then(res => {
wx.hideLoading()
if(res.code == 200){
var html = res.data.html
html = html.replace('<img','<img style="max-width:100%;height:auto;margin:0 auto;display:block"')
that.setData({
detail: res.data,
html
})
if(!res.data.bid){
this.readFun()
}
}else{
wx.showToast({
title: res.msg,
icon: 'none'
})
}
})
},
//已读
readFun(){
Api.req('sf/announcementReadinfo/save', {
platformAnnouncementId: this.data.id,
readId: wx.getStorageSync('userId'),
reader: wx.getStorageSync('name'),
}, 'post','','1')
.then(res => {
if(res.code == 200){
}else{
wx.showToast({
title: res.msg,
icon: 'none'
})
}
})
}
})