From 859b9851a9867bad530b5854e20d0d31c2cb4a96 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=B7=A6=E5=93=A5?= <17630302050@163.com> Date: Mon, 4 Aug 2025 22:24:03 +0800 Subject: [PATCH] 123 --- api/request.js | 9 +++------ pages/home/index.js | 12 +++++++++++- pages/login/login.json | 2 +- pages/login/login.less | 24 +++++++++++++++++------ pages/login/login.wxml | 13 +++++++++++-- pages/message/index.js | 39 +++++++++++++++++++++++++------------ pages/my/index.js | 18 +++++++++++++++-- pages/my/index.wxml | 4 ++-- pages/my/info-edit/index.js | 7 +++++++ 9 files changed, 96 insertions(+), 32 deletions(-) diff --git a/api/request.js b/api/request.js index af3b3c8..7ae802f 100644 --- a/api/request.js +++ b/api/request.js @@ -22,12 +22,9 @@ function request(url, method = 'GET', data = {}) { if (res.data.code) { if (res.data.code == 10103) { wx.removeStorageSync('access_token'); - wx.navigateTo({ - url: '/pages/login/login', - complete: () => { - isNavigatingToLogin = false; - } - }); + // wx.navigateTo({ + // url: '/pages/login/login', + // }); reject(res.data); return; } diff --git a/pages/home/index.js b/pages/home/index.js index 13a3ad3..64836d5 100644 --- a/pages/home/index.js +++ b/pages/home/index.js @@ -216,7 +216,14 @@ Page({ url: '/pages/clockIn/index', }) }, - toEmergency() { + async toEmergency() { + const token = await wx.getStorageSync('access_token') + if (!token) { + wx.navigateTo({ + url: '/pages/login/login', + }); + return + } wx.navigateTo({ url: '/pages/emergency/index', }) @@ -459,6 +466,9 @@ Page({ return chart; }); } + }, + handleBack() { + wx.navigateBack() }, /** * 用户点击右上角分享 diff --git a/pages/login/login.json b/pages/login/login.json index 172cb9d..1a94c57 100644 --- a/pages/login/login.json +++ b/pages/login/login.json @@ -1,6 +1,6 @@ { "navigationStyle": "custom", "usingComponents": { - + "t-navbar": "tdesign-miniprogram/navbar/navbar" } } diff --git a/pages/login/login.less b/pages/login/login.less index 93f0a1b..623d04f 100644 --- a/pages/login/login.less +++ b/pages/login/login.less @@ -7,6 +7,17 @@ display: flex; flex-direction: column; } +.t-navbar-content{ + z-index: 100; + background-color: transparent; +} +.login-content{ + position: absolute; + top: 0; + left: 0; + right: 0; + bottom: 0; +} .image-wrapper_1 { background: url('https://image-fudan.oss-cn-beijing.aliyuncs.com/mini_images/top-bg.png') center center no-repeat; background-size: 100% 100%; @@ -35,10 +46,11 @@ margin: 12rpx 12rpx 0 564rpx; } .image_3 { + margin-top: 20vh; + width: 160rpx; height: 160rpx; align-self: center; - margin-top: 196rpx; border-radius: 160px; } .box_1 { @@ -96,11 +108,11 @@ margin-top: 40rpx; } .text-wrapper_3 { - width: 520rpx; - flex-direction: row; - display: flex; - justify-content: space-between; - margin: 552rpx 50rpx 0 52rpx; + position: absolute; + bottom: 10vh; + left: 0; + right: 0; + text-align: center; } .text_4 { overflow-wrap: break-word; diff --git a/pages/login/login.wxml b/pages/login/login.wxml index d361ddc..f389803 100644 --- a/pages/login/login.wxml +++ b/pages/login/login.wxml @@ -1,7 +1,14 @@ + + + + \ No newline at end of file diff --git a/pages/message/index.js b/pages/message/index.js index e4eb7f5..fe53be5 100644 --- a/pages/message/index.js +++ b/pages/message/index.js @@ -9,14 +9,14 @@ Page({ dataList: [], // planId: '', }, - - async getList(){ + + async getList() { const res = await request('patient/follow_plans', 'get', { page: 1, page_size: 100, type: 2 }) - + // Process the list to check dates const processedList = res.list.map(item => { const planDate = new Date(item.plan_date); @@ -29,7 +29,7 @@ Page({ } // If within 7 days and status is 1, update to 2 if (diffDays <= 7 && diffDays >= 0 && item.status === 1) { - return { ...item, status: 3, diffDays}; + return { ...item, status: 3, diffDays }; } return item; }); @@ -42,21 +42,21 @@ Page({ // planId: actObj.id // }) // } - + }, /** * 生命周期函数--监听页面加载 */ onLoad(options) { - - + + }, /** * 生命周期函数--监听页面初次渲染完成 */ onReady() { - + }, /** @@ -103,14 +103,22 @@ Page({ toQuestionnaire(e) { const { item } = e.currentTarget.dataset wx.navigateTo({ - url: `/pages/followUp/index?planId=${item.id}&name=${item.plan_name}&time=${item.plan_date}&questionnaire_id=${item.questionnaire_id}` , + url: `/pages/followUp/index?planId=${item.id}&name=${item.plan_name}&time=${item.plan_date}&questionnaire_id=${item.questionnaire_id}`, }) }, - goQuestionnaire(e) { + async goQuestionnaire(e) { // const data = this.data.dataList // const target = data.find(item => item.questionnaire_id == 0 && item.status == 2); + const token = await wx.getStorageSync('access_token') + if (!token) { + wx.navigateTo({ + url: '/pages/login/login', + }); + return + } + wx.navigateTo({ - url: `/pages/followUp/index?planId=0&name=&time=&questionnaire_id=0` , + url: `/pages/followUp/index?planId=0&name=&time=&questionnaire_id=0`, }) }, toRegister() { @@ -118,7 +126,14 @@ Page({ url: '/pages/register/index', }) }, - toEmergency(){ + async toEmergency() { + const token = await wx.getStorageSync('access_token') + if (!token) { + wx.navigateTo({ + url: '/pages/login/login', + }); + return + } wx.navigateTo({ url: '/pages/emergency/index', }) diff --git a/pages/my/index.js b/pages/my/index.js index 05d96c2..c0123f7 100644 --- a/pages/my/index.js +++ b/pages/my/index.js @@ -115,7 +115,14 @@ Page({ if (url) return; this.onShowToast('#t-toast', name); }, - toPath(e){ + async toPath(e){ + const token = await wx.getStorageSync('access_token') + if (!token) { + wx.navigateTo({ + url: '/pages/login/login', + }); + return + } wx.navigateTo({ url: e.currentTarget.dataset.url, }) @@ -127,7 +134,14 @@ Page({ }) }, - toEmergency(){ + async toEmergency(){ + const token = await wx.getStorageSync('access_token') + if (!token) { + wx.navigateTo({ + url: '/pages/login/login', + }); + return + } wx.navigateTo({ url: '/pages/emergency/index', }) diff --git a/pages/my/index.wxml b/pages/my/index.wxml index aaf7a4d..d443c1c 100644 --- a/pages/my/index.wxml +++ b/pages/my/index.wxml @@ -78,13 +78,13 @@ - + diff --git a/pages/my/info-edit/index.js b/pages/my/info-edit/index.js index 1da6976..e492b6b 100644 --- a/pages/my/info-edit/index.js +++ b/pages/my/info-edit/index.js @@ -133,6 +133,13 @@ Page({ if (options.scrm_userid) { await wx.setStorageSync('scrm_userid', options.scrm_userid); } + const token = await wx.getStorageSync('access_token') + if (!token) { + wx.navigateTo({ + url: '/pages/login/login', + }); + return + } }, onShow() { this.getPersonalInfo()