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