市北人才赋能平台 --小程序端
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.
 

88 lines
1.8 KiB

// pages/billboards/policy/policy-list/index.js
import { PolicyModel } from '../../../../models/policy.js'
let policy = new PolicyModel()
Page({
/**
* 页面的初始数据
*/
data: {
navSelectIndex: 0,
nodes: '',
navs: [],
tags: [], // 导航的原始数据
curCode: '',
show: false,
},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
//console.log(options)
const tags = wx.getStorageSync('PolicyTags')
let navs = tags.map(item=> {return item.name})
const {index} = options
this.setData({
tags: tags,
navSelectIndex: index,
navs: navs,
curCode: tags[index].code
})
this.fetchPolicyArtice()
},
onHiddenPopView () {
this.setData({
show:false,
})
},
onShowAllButton () {
console.log('show All tbn')
const show = this.data.show
this.setData({
show: !show
})
},
onClickAllBtnItem (e) {
const index = e.currentTarget.dataset.index
this.setData({
navSelectIndex: index,
curCode: this.data.tags[index].code,
show: false,
})
this.fetchPolicyArtice()
},
tapSegemnt (e) {
//console.log(e.detail)
const index = e.detail.index
this.setData({
curCode: this.data.tags[index].code,
show: false
})
this.fetchPolicyArtice()
},
fetchPolicyArtice () {
wx.showLoading({
title: '加载中...',
})
policy.fetchPolicyArtice(this.data.curCode, res => {
console.log(res)
if (res.data) {
this.setData({
readNum: res.data.readNum,
nodes: res.data.content || '',
})
} else {
this.setData({
nodes: ''
})
}
wx.hideLoading()
})
},
maskTouchMove () {
return
}
})