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

83 lines
1.7 KiB

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