card-mini/pages/mine/columnlist/columnlist.js

72 lines
1.9 KiB
JavaScript

// pages/mine/columnlist/columnlist.js
const app = getApp()
Page({
/**
* 页面的初始数据
*/
data: {
groupId: '',
menuList: [],
title: '栏目',
imgUrl: app.urls.baseImgUrl
},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
this.setData({
groupId: options.id,
title: options.title
})
this.getList()
},
getList() {
wx.showLoading({
title: '加载中...',
})
var _self = this
app.http.get(app.urls.getColumnListByGroupId, {
header: {
token: app.globalData.token
},
data: {
configColumnGroupId: _self.data.groupId
}
})
.then(res => {
wx.hideLoading({})
_self.setData({
menuList: res.data
})
})
.catch(err => {
wx.hideLoading({})
})
},
choosePage(e) {
// 栏目列表页跳转方式1:小程序页面,2:其他小程序,3:网址
var path = e.currentTarget.dataset.path
var type = e.currentTarget.dataset.type
var item = e.currentTarget.dataset.item
switch (type) {
case '1': //跳转小程序内部
case '3': //链接
wx.navigateTo({
url: path + '?id=' + item.configColumnId + '&mode=' + item.configTableMode + '&type=' + item.configColumnType + '&title=' + item.configColumnName
})
break
case '2': //其他小程序
wx.navigateToMiniProgram({
appId: '',
success(res) {
// 打开成功
}
})
break
}
},
})