榆山数据端小程序
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.
 
 

119 lines
2.4 KiB

const app = getApp()
import { getTypicalList } from '../../api/index'
Page({
/**
* 页面的初始数据
*/
data: {
// 此页面 页面内容距最顶部的距离
height: app.globalData.navHeight ,
id:'',
caseTitle:'',
createdTime:'',
backId:'',
caseData:[],
isComplete:false
},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
console.log("options",options)
this.setData({
id:options.id
})
this.getTypicalList()
},
/*****打开更多案例 ******/
getMoreCase(){
wx.navigateTo({
url: '/pages/classicCase/classicCase'
});
},
async getTypicalList(){
wx.showLoading({
title: '加载中',
})
try{
let res:any= await getTypicalList(this.data.id)
res.data.dynamicItem[0].contentDescription = res.data.dynamicItem[0].contentDescription.replace(/\<img/gi, '<img style="max-width:100%;height:auto" ')
this.setData({
caseData:res.data.dynamicItem,
caseTitle:res.data.caseTitle,
createdTime:res.data.createdTime,
typicalAbstract:res.data.typicalAbstract,
backId:res.data.id,
isComplete:true
})
wx.hideLoading()
}catch (err) {
console.log(err)
this.setData({
isComplete:false
})
wx.hideLoading()
}
},
goProject(e){
if(e.currentTarget.dataset.associatedtype=="0"){
wx.navigateTo({ url: `/subpages/issue/pages/detail/IssueDetails/issueDetails?Id=${e.currentTarget.dataset.id}` });
// 议题
}else if(e.currentTarget.dataset.associatedtype=="1"){
// 项目
wx.navigateTo({ url: `/subpages/issue/pages/detail/projectDetails/projectDetails?Id=${e.currentTarget.dataset.id}` });
}else if(e.currentTarget.dataset.associatedtype==="2"){
// 话题
wx.navigateTo({ url: `/subpages/issue/pages/detail/topicDetail/topicDetail?Id=${e.currentTarget.dataset.id}` });
}
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady: function () {
},
/**
* 生命周期函数--监听页面显示
*/
onShow: function () {
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide: function () {
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload: function () {
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh: function () {
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom: function () {
},
/**
* 用户点击右上角分享
*/
// onShareAppMessage: function () {
// }
})