From cc40abe69d2bca2bc02412752978b08a61d516a2 Mon Sep 17 00:00:00 2001 From: kola-web Date: Sat, 16 Aug 2025 11:15:30 +0800 Subject: [PATCH] =?UTF-8?q?=E6=82=A3=E8=80=85=E7=AB=AF=E8=BF=81=E7=A7=BB?= =?UTF-8?q?=E5=A4=84=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/app.ts | 26 ++++++++++------ src/components/pickerArea/index.ts | 54 ++++++++++++++++----------------- src/components/pickerArea/index.wxml | 4 +-- src/patient/pages/cancellation/index.ts | 7 +++-- src/patient/pages/index/index.wxml | 2 +- typings/index.d.ts | 1 + 6 files changed, 51 insertions(+), 43 deletions(-) diff --git a/src/app.ts b/src/app.ts index 37b6a7b..50e4d62 100644 --- a/src/app.ts +++ b/src/app.ts @@ -89,6 +89,19 @@ App({ wx.ajax = licia.curry(request)({ gUrl: this.globalData.url }); + this.startLogin(); + + wx.setInnerAudioOption({ + obeyMuteSwitch: false, + mixWithOther: false, + }); + }, + onShow(options) { + if (options.query.scene) { + this.globalData.scene = parseScene(options.query.scene); + } + }, + startLogin(callback) { wx.login({ success: (res) => { wx.ajax({ @@ -102,19 +115,12 @@ App({ this.globalData.isLogin = res.isLogin; this.globalData.isNewReg = res.isNewReg; this.globalData.loginType = res.loginType; + if (callback) { + callback(); + } }); }, }); - - wx.setInnerAudioOption({ - obeyMuteSwitch: false, - mixWithOther: false, - }); - }, - onShow(options) { - if (options.query.scene) { - this.globalData.scene = parseScene(options.query.scene); - } }, updateLoginInfo(callback?: (any) => void) { wx.ajax({ diff --git a/src/components/pickerArea/index.ts b/src/components/pickerArea/index.ts index 3e2c22c..9ff77e1 100644 --- a/src/components/pickerArea/index.ts +++ b/src/components/pickerArea/index.ts @@ -1,4 +1,4 @@ -const app = getApp() +const app = getApp(); Component({ properties: { @@ -25,7 +25,7 @@ Component({ }, observers: { show(newVal: boolean) { - this.triggerEvent('show', newVal) + this.triggerEvent('show', newVal); }, }, data: { @@ -224,8 +224,8 @@ Component({ scrollIntoView0: this.data.pid || '', scrollIntoView1: this.data.cid || '', - }) - this.getArea() + }); + this.getArea(); }, getArea() { wx.ajax({ @@ -235,78 +235,78 @@ Component({ }).then((res) => { this.setData({ area: res, - }) - this.getRangeList() - }) + }); + this.getRangeList(); + }); }, handleItem(e: any) { - const { code, name } = e.currentTarget.dataset + const { code, name } = e.currentTarget.dataset; this.setData({ ProvinceId: code, ProvinceName: name, CityId: '', CityName: '', - }) - this.getRangeList() + }); + this.getRangeList(); }, handleChangeCity(e: any) { - const { code, name } = e.currentTarget.dataset + const { code, name } = e.currentTarget.dataset; this.setData({ CityId: code, CityName: name, - }) + }); }, handleShare() { this.setData({ show: false, - }) + }); this.triggerEvent('ok', { ProvinceName: this.data.ProvinceName, ProvinceId: this.data.ProvinceId, CityName: this.data.CityName, CityId: this.data.CityId, - }) + }); }, handleSelect(e) { - const { id } = e.currentTarget.dataset + const { id } = e.currentTarget.dataset; this.setData({ word: id, scrollIntoView0: id, - }) + }); }, getRangeList() { - const { area, ProvinceId } = this.data - if (!ProvinceId) return - const range = area.filter((item: any) => item.value == ProvinceId)[0].children + const { area, ProvinceId } = this.data; + if (!ProvinceId) return; + const range = area.filter((item: any) => item.value == ProvinceId)[0].children; this.setData({ range, active: 1, scrollIntoView0: '', scrollIntoView1: `id${this.data.CityId}`, - }) + }); }, handleProvince() { this.setData({ active: 0, scrollIntoView0: this.data.word || `id${this.data.ProvinceId}`, scrollIntoView1: '', - }) + }); }, handleCity() { - const { ProvinceId } = this.data + const { ProvinceId } = this.data; if (!ProvinceId) { wx.showToast({ title: '请先选择省份', icon: 'none', - }) - return + }); + return; } - this.getRangeList() + this.getRangeList(); }, handleClose() { this.setData({ show: false, - }) + }); }, }, -}) +}); diff --git a/src/components/pickerArea/index.wxml b/src/components/pickerArea/index.wxml index 7b4f01e..669ec1f 100644 --- a/src/components/pickerArea/index.wxml +++ b/src/components/pickerArea/index.wxml @@ -9,11 +9,11 @@ {{ProvinceName || '请选择省份'}} - + {{CityName || '请选择城市'}} - + 确定 diff --git a/src/patient/pages/cancellation/index.ts b/src/patient/pages/cancellation/index.ts index 9aecf09..9ce3728 100644 --- a/src/patient/pages/cancellation/index.ts +++ b/src/patient/pages/cancellation/index.ts @@ -33,9 +33,10 @@ Page({ app.globalData.backPage = ''; app.globalData.loginState = ''; app.globalData.userInfo = {}; - app.startLogin(); - wx.reLaunch({ - url: '/pages/login/index', + app.startLogin(() => { + wx.reLaunch({ + url: '/patient/pages/login/index', + }); }); }); } diff --git a/src/patient/pages/index/index.wxml b/src/patient/pages/index/index.wxml index 1cf846d..71223a3 100644 --- a/src/patient/pages/index/index.wxml +++ b/src/patient/pages/index/index.wxml @@ -231,7 +231,7 @@ - + {{card.name}} Promise; + startLogin: (callback?: () => void) => void; checkLoginType: (type: pageType[] | 'any') => boolean; getMenuInfo: (arg0: WechatMiniprogram.Page.Instance) => void; getUserInfo: (type: 0 | 1 | 2) => Promise;