patient-mini/pages/my/index.js
码农搬砖工 9018a4f868 xxx
2025-04-23 18:23:41 +08:00

92 lines
2.0 KiB
JavaScript

import request from '~/api/request';
import useToastBehavior from '~/behaviors/useToast';
Page({
behaviors: [useToastBehavior],
data: {
isLoad: false,
service: [],
personalInfo: {},
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: '姓名', text: '张三', icon: 'service', type: 'text' },
{ label: '性别', text: '男', icon: 'setting', type: 'text' },
{ label: '出生日期', text: '1990-01-01', icon: 'setting', type: 'text' },
{ label: '身份证号', text: '13800138000', icon: 'setting', type: 'text' },
{ label: '手机号', text: '421033201810101601', icon: 'setting', type: 'text' },
{ label: '胆道闭锁手术时间', text: '2025-01-01', icon: 'setting', type: 'text' },
],
},
onLoad() {
this.getServiceList();
},
async onShow() {
const Token = wx.getStorageSync('access_token');
const personalInfo = await this.getPersonalInfo();
if (Token) {
this.setData({
isLoad: true,
personalInfo,
});
}
},
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);
},
});