Commit eaabc2d1 by 姜雷

添加点击授权订阅

parent 876a0654
import { IMyApp } from '../../app'; import { IMyApp } from '../../app';
import { systemFetch } from '../../api/fetch';
type Menu = { type Menu = {
pagePath: string; pagePath: string;
...@@ -27,6 +28,7 @@ const tabList: Menu[] = [ ...@@ -27,6 +28,7 @@ const tabList: Menu[] = [
Page({ Page({
onLoad() { onLoad() {
this.fetchTemplate();
let userRoles = app.globalData.userRoles; let userRoles = app.globalData.userRoles;
let list = userRoles let list = userRoles
.map(item => tabList.find(menu => menu.code === item.menuCode)) .map(item => tabList.find(menu => menu.code === item.menuCode))
...@@ -47,6 +49,18 @@ Page({ ...@@ -47,6 +49,18 @@ Page({
data: { data: {
selected: '', selected: '',
list: [], list: [],
tmplIds: [],
},
fetchTemplate() {
systemFetch({
url: '/boss/login/init/data',
method: 'GET',
}).then(res => {
console.log(res);
this.setData!({
tmplIds: res.templates,
});
});
}, },
clickHandle(e) { clickHandle(e) {
console.log('in click', e); console.log('in click', e);
...@@ -56,5 +70,17 @@ Page({ ...@@ -56,5 +70,17 @@ Page({
this.setData!({ this.setData!({
selected: index, selected: index,
}); });
wx.requestSubscribeMessage({
tmplIds: this.data.tmplIds.map(item => item.templateId),
success(res) {
console.log('in success', res);
},
fail(res) {
console.log('in fail', res);
},
complete(res) {
console.log('in complete', res);
},
});
}, },
}); });
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment