108 lines
2.3 KiB
JavaScript
108 lines
2.3 KiB
JavaScript
import request from '~/api/request';
|
|
import useToastBehavior from '~/behaviors/useToast';
|
|
|
|
Page({
|
|
behaviors: [useToastBehavior],
|
|
|
|
data: {
|
|
isLoad: true,
|
|
service: [],
|
|
personalInfo: {
|
|
name: '邹方成'
|
|
},
|
|
gridList: [
|
|
{
|
|
name: '全部发布',
|
|
icon: 'root-list',
|
|
type: 'all',
|
|
url: '',
|
|
},
|
|
{
|
|
name: '审核中',
|
|
icon: 'search',
|
|
type: 'progress',
|
|
url: '',
|
|
},
|
|
{
|
|
name: '已发布',
|
|
icon: 'upload',
|
|
type: 'published',
|
|
url: '',
|
|
},
|
|
{
|
|
name: '草稿箱',
|
|
icon: 'file-copy',
|
|
type: 'draft',
|
|
url: '',
|
|
},
|
|
],
|
|
|
|
settingList: [
|
|
{ label: '用药方案', path: '/pages/therapeuticRegimen/index', icon: 'service', type: 'text' },
|
|
{ label: '健康教育', path: '/pages/article/index', icon: 'setting', type: 'text' },
|
|
|
|
],
|
|
},
|
|
|
|
onLoad() {
|
|
// this.getServiceList();
|
|
},
|
|
|
|
handelClick(e) {
|
|
console.log(e)
|
|
},
|
|
|
|
async onShow() {
|
|
const Token = wx.getStorageSync('access_token');
|
|
// const personalInfo = await this.getPersonalInfo();
|
|
console.log(Token)
|
|
if (Token) {
|
|
this.setData({
|
|
isLoad: false,
|
|
settingList: [
|
|
{ label: '用药方案', path: '/pages/therapeuticRegimen/index', icon: 'service', type: 'text' },
|
|
{ label: '健康教育', path: '/pages/article/index', icon: 'setting', type: 'text' },
|
|
|
|
],
|
|
});
|
|
} else {
|
|
this.setData({
|
|
isLoad: true,
|
|
settingList: [
|
|
{ label: '用药方案', path: '', icon: 'service', type: 'text' },
|
|
{ label: '健康教育', path: '', icon: 'setting', type: 'text' },
|
|
|
|
],
|
|
});
|
|
}
|
|
},
|
|
|
|
getServiceList() {
|
|
request('/api/getServiceList').then((res) => {
|
|
const { service } = res.data.data;
|
|
this.setData({ service });
|
|
});
|
|
},
|
|
|
|
async getPersonalInfo() {
|
|
const info = await request('/api/genPersonalInfo').then((res) => res.data.data);
|
|
return info;
|
|
},
|
|
|
|
onLogin(e) {
|
|
wx.navigateTo({
|
|
url: '/pages/login/login',
|
|
});
|
|
},
|
|
|
|
onNavigateTo() {
|
|
wx.navigateTo({ url: `/pages/my/info-edit/index` });
|
|
},
|
|
|
|
onEleClick(e) {
|
|
const { name, url } = e.currentTarget.dataset.data;
|
|
if (url) return;
|
|
this.onShowToast('#t-toast', name);
|
|
},
|
|
});
|