gov_propagandize/pages/invest-detail/invest-detail.js

55 lines
1.3 KiB
JavaScript
Raw Normal View History

2025-01-20 17:19:30 +08:00
// pages/invest-detail/invest-detail.js
import IndexService from '../../utils/api/indexApi';
import utils from '../../utils/util';
const app = getApp();
Page({
/**
* 页面的初始数据
*/
data: {
bean: {},
showPageLoading: true,
imgBasePath: app.globalData.imgPath
},
/**
* 生命周期函数--监听页面加载
*/
onLoad(options) {
var id = options.id
if (id) {
this.getDetailBean(id)
} else {
wx.navigateBack()
}
},
getDetailBean(id) {
var _self = this
IndexService.doGetInvestDetail({
id: id
})
.then(res => {
_self.setData({
showPageLoading: false
})
if (res) {
wx.setNavigationBarTitle({
title: res.title,
})
res.content = utils.formatHtml(res.content)
_self.setData({
bean: res
})
}
}, err => {
_self.setData({
showPageLoading: false
})
wx.showToast({
title: '网络错误',
})
})
}
})