54 lines
1.3 KiB
JavaScript
54 lines
1.3 KiB
JavaScript
// pages/unique-detail/unique-detail.js
|
|
import DomainService from '../../utils/api/domainApi';
|
|
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.getDetail(id)
|
|
} else {
|
|
wx.navigateBack()
|
|
}
|
|
},
|
|
getDetail(id) {
|
|
var _self = this
|
|
DomainService.doDetail(id)
|
|
.then(res => {
|
|
|
|
if (res) {
|
|
wx.setNavigationBarTitle({
|
|
title: res.newsContentTitle,
|
|
})
|
|
res.newsContentContent = utils.formatHtml(res.newsContentContent)
|
|
_self.setData({
|
|
bean: res
|
|
})
|
|
}
|
|
_self.setData({
|
|
showPageLoading: false
|
|
})
|
|
}, err => {
|
|
_self.setData({
|
|
showPageLoading: false
|
|
})
|
|
wx.showToast({
|
|
icon: 'none',
|
|
title: '网络错误(unique)',
|
|
})
|
|
})
|
|
}
|
|
}) |