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

67 lines
1.4 KiB

6 years ago
// pages/billboards/park/park-category/index.js
import { BillboardModel } from '../../../../models/billboard.js'
let billboard = new BillboardModel()
Page({
/**
* 页面的初始数据
*/
data: {
list: [],
curCode: '' //
6 years ago
},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
const { code,title } = options
wx.setNavigationBarTitle({
title: title,
})
console.log(code)
this.setData({
curCode: code,
})
4 years ago
this.fetchList()
},
onTapMoreItem (e) {
const {code, name} = e.currentTarget.dataset
wx.navigateTo({
url: `/pages/billboards/park/park-detail/index?code=${code}&name=${name}`,
})
},
clickCardItem(e) {
4 years ago
var id = e.currentTarget.dataset.id
wx.navigateTo({
4 years ago
url: '/pages/article/index?id=' + id,
})
6 years ago
},
4 years ago
fetchList() {
billboard.fetchBailList(this.data.curCode, 1, res => {
this.setData({
4 years ago
list: res.list,
})
6 years ago
})
},
// 获取分类Tags
fetchTags() {
wx.showLoading({
title: '加载中...',
})
billboard.fetchTagsByCode(this.data.curCode, res => {
6 years ago
console.log(res)
const categorys = res.result.records
6 years ago
this.setData({
list: categorys,
})
categorys.forEach((item, index) => {
this.fetchList(item.code, index)
6 years ago
})
wx.hideLoading()
6 years ago
})
},
})