From c04555d8a81f1b7381561d0ad431342880d9acb9 Mon Sep 17 00:00:00 2001 From: "@zuopngfei" Date: Fri, 4 Jul 2025 20:50:40 +0800 Subject: [PATCH] =?UTF-8?q?=E5=84=BF=E7=A7=91=E6=82=A3=E8=80=85=E7=AB=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- api/request.js | 16 +++++++++++----- pages/home/index.js | 13 ++++++++----- pages/login/login.js | 28 ++++++++++++---------------- pages/message/index.js | 6 +++--- 4 files changed, 34 insertions(+), 29 deletions(-) diff --git a/api/request.js b/api/request.js index 90968ab..a8007df 100644 --- a/api/request.js +++ b/api/request.js @@ -1,5 +1,5 @@ -const baseUrl = 'http://1.15.53.35:9998/'; - +const baseUrl = 'https://ddbs.1024tool.vip/'; +let isNavigatingToLogin = false; function request(url, method = 'GET', data = {}) { const header = { 'content-type': 'application/json', @@ -21,9 +21,15 @@ function request(url, method = 'GET', data = {}) { if (res.data.code) { if (res.data.code == 10103) { wx.removeStorageSync('access_token'); - wx.switchTab({ - url: '/pages/my/index', - }) + if (!isNavigatingToLogin) { + isNavigatingToLogin = true; + wx.navigateTo({ + url: '/pages/login/login', + complete: () => { + isNavigatingToLogin = false; + } + }); + } reject(res.data); } reject(res.data); diff --git a/pages/home/index.js b/pages/home/index.js index 447f0bf..c41e351 100644 --- a/pages/home/index.js +++ b/pages/home/index.js @@ -152,14 +152,17 @@ Page({ onLoad(){ - this.getSfList() - this.getChartData() - this.getPersonalInfo() + }, onReady() { }, + onShow(){ + this.getSfList() + this.getChartData() + this.getPersonalInfo() + }, changeChart(e) { const index = e.currentTarget.dataset.index; @@ -220,7 +223,7 @@ Page({ let totalList = [] standardHeight.forEach(item => { - props.xAxis.forEach(item2 => { + this.data.xAxis.forEach(item2 => { if(item.age == item2) { totalList.push(item.value) } @@ -289,7 +292,7 @@ Page({ let totalList = [] standardWeight.forEach(item => { - props.xAxis.forEach(item2 => { + this.data.xAxis.forEach(item2 => { if(item.age == item2) { totalList.push(item.value) } diff --git a/pages/login/login.js b/pages/login/login.js index b2e6a07..ef9363d 100644 --- a/pages/login/login.js +++ b/pages/login/login.js @@ -15,17 +15,17 @@ Page({ code: '' }, onLoad() { - wx.login({ - success(res) { - console.log(res.code) - if (res.code) { - //发起网络请求 + // wx.login({ + // success(res) { + // console.log(res.code) + // if (res.code) { + // //发起网络请求 - } else { - console.log('登录失败!' + res.errMsg) - } - } - }) + // } else { + // console.log('登录失败!' + res.errMsg) + // } + // } + // }) }, async getPhoneNumber(e) { // console.log(e.detail.code) // 动态令牌 @@ -37,9 +37,7 @@ Page({ }) await wx.setStorageSync('access_token', res.token); if (res.is_personal_information_complete) { - wx.switchTab({ - url: `/pages/my/index`, - }); + wx.navigateBack(); } else { wx.navigateTo({ url: `/pages/my/info-edit/index`, @@ -143,9 +141,7 @@ Page({ }); await wx.setStorageSync('access_token', res.token); if (res.is_personal_information_complete) { - wx.switchTab({ - url: `/pages/my/index`, - }); + wx.navigateBack(); } else { wx.navigateTo({ url: `/pages/my/info-edit/index`, diff --git a/pages/message/index.js b/pages/message/index.js index 9a82c52..f8a105d 100644 --- a/pages/message/index.js +++ b/pages/message/index.js @@ -48,7 +48,7 @@ Page({ * 生命周期函数--监听页面加载 */ onLoad(options) { - this.getList() + }, @@ -56,14 +56,14 @@ Page({ * 生命周期函数--监听页面初次渲染完成 */ onReady() { - + }, /** * 生命周期函数--监听页面显示 */ onShow() { - + this.getList() }, /**