From ef94ce1fdc6165426c1f918838873b648ab558f7 Mon Sep 17 00:00:00 2001 From: kola-web Date: Mon, 2 Mar 2026 10:25:16 +0800 Subject: [PATCH] =?UTF-8?q?=E5=B0=8F=E7=A8=8B=E5=BA=8F=E6=8E=A5=E5=8F=A3?= =?UTF-8?q?=E8=81=94=E8=B0=83?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .trae/rules/project_rules.md | 19 +-- src/api/request.ts | 6 +- src/app.ts | 105 ++++++----------- src/doctor/pages/article/index.ts | 11 +- src/doctor/pages/articleList/index.ts | 35 +++++- src/doctor/pages/changeNickname/index.ts | 9 +- src/doctor/pages/changeTel/index.ts | 84 +++----------- src/doctor/pages/home/index.ts | 151 +++++++++++++++++++++--- src/doctor/pages/invite/index.ts | 9 +- src/doctor/pages/login/index.ts | 23 ++-- src/doctor/pages/loginForm/index.ts | 39 ++++--- src/doctor/pages/my/index.ts | 9 +- src/doctor/pages/patientList/index.ts | 46 +++++--- src/doctor/pages/stat/index.ts | 9 +- src/ground/pages/changeNickname/index.ts | 9 +- src/ground/pages/changeTel/index.ts | 84 +++----------- src/ground/pages/home/index.ts | 193 +++++++++++++++++++++++++++---- src/ground/pages/invite/index.ts | 9 +- src/ground/pages/login/index.ts | 24 ++-- src/ground/pages/my/index.ts | 9 +- src/ground/pages/pharmacist/index.ts | 9 +- src/ground/pages/stat/index.ts | 9 +- src/pages/index/index.ts | 142 +++++++++++++++++++---- src/pages/index/index.wxml | 4 +- src/pages/work/index.ts | 9 +- typings/index.d.ts | 10 +- 26 files changed, 698 insertions(+), 368 deletions(-) diff --git a/.trae/rules/project_rules.md b/.trae/rules/project_rules.md index fc0c517..9d6df34 100644 --- a/.trae/rules/project_rules.md +++ b/.trae/rules/project_rules.md @@ -1,9 +1,10 @@ -1. 本项目是一个基于微信小程序的药品查询应用 -2. 使用原生微信小程序+typescript+scss -3. figma设计稿的宽度是375px,1px=2rpx -4. 小程序的scss单位是rpx -5. 导航栏使用自定义导航栏,使用自定义组件 /components/navbar -6. 除了onLoad比寻存在外,其他生命周期函数,无须额外定义 -7. onLoad函数中需要隐去getApp().waitLogin(),页面使用的接口需要在登录后调用 -8. 生命周期函数和事件处理函数不应使用箭头函数 -9. getApp()应提取到全局变量中,避免重复调用 +1. 接口文档在"C:\Users\kola\project\drugs\prompt\backend\portal_api.md" +2. 本项目是一个基于微信小程序的药品查询应用 +3. 使用原生微信小程序+typescript+scss +4. figma设计稿的宽度是375px,1px=2rpx +5. 小程序的scss单位是rpx +6. 导航栏使用自定义导航栏,使用自定义组件 /components/navbar +7. 除了onLoad比寻存在外,其他生命周期函数,无须额外定义 +8. onLoad函数中需要隐去getApp().waitLogin(),页面使用的接口需要在登录后调用 +9. 生命周期函数和事件处理函数不应使用箭头函数 +10. getApp()应提取到全局变量中,避免重复调用 diff --git a/src/api/request.ts b/src/api/request.ts index 0eaa79a..a7e0e4c 100644 --- a/src/api/request.ts +++ b/src/api/request.ts @@ -1,10 +1,9 @@ interface IGlobalParams { gUrl: string - version: string } export const request = function ( - { gUrl, version }: IGlobalParams, + { gUrl }: IGlobalParams, { url, method, @@ -27,6 +26,7 @@ export const request = function ( wx.request({ header: { loginState: getApp().globalData.loginState, + 'content-type': isJSON ? 'application/json' : 'application/x-www-form-urlencoded', ...header, }, url: gUrl + url, @@ -39,7 +39,7 @@ export const request = function ( success(res: any) { const { code, data } = res.data if (isJSON) { - resolve(res.data) + resolve(data) } else if (code === 0) { resolve(data) } else if (showMsg) { diff --git a/src/app.ts b/src/app.ts index 9df5a17..8510285 100644 --- a/src/app.ts +++ b/src/app.ts @@ -15,10 +15,9 @@ plugin.use(todo).use(solarLunar).use(selectable).use(week) const dayjs = require('dayjs') require('/utils/dayjs/day-zh-cn.js') const relativeTime = require('/utils/dayjs/relativeTime.js') -dayjs.locale('zh-cn') // 全局使用 +dayjs.locale('zh-cn') dayjs.extend(relativeTime) -// page import page from '@/utils/page' App({ @@ -43,7 +42,6 @@ App({ loginState: '', initLoginInfo: {}, - // anyWhere: true, anyWhere: false, userInfo: {}, @@ -64,19 +62,19 @@ App({ if (options.query.scene) { this.globalData.scene = parseScene(options.query.scene) as { workerId: string } } - // this.startLogin() + this.startLogin() }, startLogin(callback?: () => void) { wx.login({ success: (res) => { wx.ajax({ - method: 'GET', - url: '?r=wtx/user/init-login', + method: 'POST', + url: '/app/common/common/wx-login', data: { code: res.code, }, }).then((res) => { - this.globalData.loginState = res.loginState + this.globalData.loginState = res.token || res.sessionKey this.globalData.initLoginInfo = res if (callback) { callback() @@ -88,7 +86,7 @@ App({ updateLoginInfo(callback?: () => void) { wx.ajax({ method: 'GET', - url: '?r=wtx/user/init-info', + url: '/app/common/common/user-info', data: {}, }).then((res) => { this.globalData.initLoginInfo = res @@ -97,11 +95,11 @@ App({ } }) }, - waitLogin({ type = 0 } = { type: 'any' }) { + waitLogin({ types = [] as number[] } = {}) { return new Promise((resolve) => { const checkLogin = () => { if (this.globalData.loginState) { - if (this.checkLoginType(type)) { + if (this.checkLoginTypes(types)) { resolve() } return @@ -113,15 +111,15 @@ App({ checkLogin() }) }, - checkLoginType(type: 0 | 1 | 2 | 'any') { - const { loginType, isLogin, isReg } = this.globalData.initLoginInfo + checkLoginTypes(types: number[]) { + const { loginIdentity, isRegistered } = this.globalData.initLoginInfo - if (type === 'any') { + if (!types || types.length === 0) { return true } - if (isLogin !== 1) { - if (type === 0) { + if (!isRegistered) { + if (types.includes(1)) { return true } wx.reLaunch({ @@ -130,40 +128,32 @@ App({ return false } - if (isReg !== 1) { + if (loginIdentity && !types.includes(loginIdentity)) { const typePageUrl = { - 1: '/patient/pages/entryInfo/index', - 2: '/doctor/pages/login/index', - }[loginType as 1 | 2] - wx.reLaunch({ - url: typePageUrl, - }) - return false - } - - if (loginType !== type) { - const typePageUrl = { - 1: '/patient/pages/index/index', - 2: '/doctor/pages/index/index', - }[loginType as 1 | 2] - wx.reLaunch({ - url: typePageUrl, - }) - return false + 2: '/pages/index/index', + 3: '/ground/pages/home/index', + 4: '/doctor/pages/home/index', + }[loginIdentity as 2 | 3 | 4] + if (typePageUrl) { + wx.reLaunch({ + url: typePageUrl, + }) + return false + } } return true }, mpBehavior(data: { PageName: string }) { - const { loginType } = this.globalData.initLoginInfo - const url = { - 1: '?r=wtx/mp-behavior/add', - 2: '?r=wtx/doctor/mp-behavior/add', - }[loginType as 1 | 2] wx.ajax({ method: 'POST', - url, - data: data, + url: '/app/common/common/log', + data: { + eventType: 'page_view', + eventName: data.PageName, + pagePath: data.PageName, + params: {}, + }, loading: false, showMsg: false, }).then((res) => { @@ -171,53 +161,32 @@ App({ }) }, - getUserInfo(type: 0 | 1 | 2 = 0) { - const url = { - 0: '?r=wtx/user/userinfo', - 1: '?r=wtx/account/info', - 2: '?r=wtx/doctor/account/info', - }[type] + getUserInfo() { return wx.ajax({ method: 'GET', - url: url, - }) - }, - getDoctorInfo(doctorId: string) { - return wx.ajax({ - method: 'GET', - url: '?r=wtx/doctor/get-info', - data: { - doctorId, - }, + url: '/app/common/common/user-info', }) }, autoUpdate: function () { var self = this - // 获取小程序更新机制兼容 if (wx.canIUse('getUpdateManager')) { const updateManager = wx.getUpdateManager() - //1. 检查小程序是否有新版本发布 updateManager.onCheckForUpdate(function (res) { - // 请求完新版本信息的回调 if (res.hasUpdate) { - //检测到新版本,需要更新,给出提示 wx.showModal({ title: '更新提示', content: '检测到新版本,是否下载新版本并重启小程序?', success: function (res) { if (res.confirm) { - //2. 用户确定下载更新小程序,小程序下载及更新静默进行 self.downLoadAndUpdate(updateManager) } else if (res.cancel) { - //用户点击取消按钮的处理,如果需要强制更新,则给出二次弹窗,如果不需要,则这里的代码都可以删掉了 wx.showModal({ title: '温馨提示~', content: '本次版本更新涉及到新的功能添加,旧版本无法正常访问的哦~', - showCancel: false, //隐藏取消按钮 - confirmText: '确定更新', //只保留确定更新按钮 + showCancel: false, + confirmText: '确定更新', success: function (res) { if (res.confirm) { - //下载新版本,并重新应用 self.downLoadAndUpdate(updateManager) } }, @@ -228,7 +197,6 @@ App({ } }) } else { - // 如果希望用户在最新版本的客户端上体验您的小程序,可以这样子提示 wx.showModal({ title: '提示', content: '当前微信版本过低,无法使用该功能,请升级到最新微信版本后重试。', @@ -236,14 +204,11 @@ App({ } }, downLoadAndUpdate: function (updateManager) { - //静默下载更新小程序新版本 updateManager.onUpdateReady(function () { wx.hideLoading() - //新的版本已经下载好,调用 applyUpdate 应用新版本并重启 updateManager.applyUpdate() }) updateManager.onUpdateFailed(function () { - // 新的版本下载失败 wx.showModal({ title: '新版本更新失败', content: '您可删除当前小程序,重新打开尝试', diff --git a/src/doctor/pages/article/index.ts b/src/doctor/pages/article/index.ts index ade269c..224a985 100644 --- a/src/doctor/pages/article/index.ts +++ b/src/doctor/pages/article/index.ts @@ -1,10 +1,13 @@ -const _app = getApp() +const app = getApp() Page({ - data: { - doc: `
糖尿病是当前威胁全球人类健康的严重慢性非传染性疾病之一[1]。据国际糖尿病联盟(IDF)估计,全球各型糖尿病患者(20~79岁)共计4.25亿,预计到2045年将达6.29亿[1],我国糖尿病患病人数已达1.144亿(占全国总人数的10.9%),高居全球首位[2],预计到2045年增长至1.198亿[3],可见糖尿病的防控形势严峻。 2型糖尿病(T2DM)作为糖尿病的主要类型,危害在于其并发症。其中心血管疾病(CVD)是T2DM患者死亡的首要原因,而合并慢性肾脏疾病(CKD)则显著增加T2DM患者的死亡风险。此外,T2DM患者常伴有高血压、血脂紊乱等心脑血管病变的重要危险因素。因此,对T2DM合并CVD或心血管危险因素患者的管理一直是糖尿病治疗领域关注的焦点。近年,随着相关临床研究的增加和深入,人们对糖尿病及其并发症的认知和管理方法也随之发展变化。这种变化和进步于国内外糖尿病诊疗指南的更新中可见一斑,尤其是T2DM管理的相关内容,越来越体现出从以"降糖"为中心到以"结局"为中心的观念变革。一、疾病控制-强化降糖的重要性 国内外主要的糖尿病指南包括美国糖尿病学会(ADA)、美国临床内分泌协会(AACE)、欧洲糖尿病研究协会(EASD)、国际糖尿病联盟(IDF)等国际机构制定的指南,以及中华医学会糖尿病学分会(CDS)制定的中国2型糖尿病防治指南。 1993年糖尿病控制与并发症试验(DCCT)发现强化血糖控制(维持血糖浓度接近正常范围,HbA1C<6.5%)可以有效延缓1型糖尿病(T1DM)视网膜、肾脏和神经病变的发生和发展[4]。1998年英国前瞻性糖尿病研究(UKPDS)提示T2DM使用磺脲类药物或胰岛素强化血糖控制(空腹血糖FPG<6 mmol/L)可以显著降低微血管并发症风险[5]。基于这些早期大型临床研究的循证依据,在稍早版本指南中,如2004年CDS指南、2005年ADA指南[6]与2006年IDF指南[7],均突出了强化降糖在T2DM治疗中的重要性,尤其推荐大多数糖尿病患者将HbA1C降至7%以下。至此,对于T2DM管理的主流意见还是集中于血糖的控制,并期待强化降糖可以降低远期大血管并发症的发生风险。 随后,多项针对强化降糖是否能够控制糖尿病患者大血管和微血管并发症发生和发展的大型临床研究陆续展开。其中,控制糖尿病心血管风险行动计划(ACCORD)研究在纳入了糖尿病病程较长、年龄较大且具有多个心血管危险因素或已有心血管病史的T2DM患者后,发现强化血糖控制组全因死亡率增加且并未降低主要心血管事件的发生,而提前终止了研究[8]。随后,2008年糖尿病与血管疾病行动(ADVANCE)研究进一步显示,强化降糖并不能显著降低T2DM患者的主要心血管事件和全因死亡率[9]。而2009年发表的美国退伍军人糖尿病研究(VADT)也显示,对于血糖控制不佳的T2DM患者,强化降糖对主要心血管事件、死亡或微血管并发症(蛋白尿除外)的发生率没有显著影响[10]。基于对过往研究的分析发现,DCCT研究中强化控制组有降低CVD的趋势,但发生CVD的事件数太少。UKPDS研究中,虽然强化治疗组较标准治疗组CVD事件下降16%,但差异无显著性[11]。可见,强化血糖控制能否降低CVD事件既往研究未得出明确的结论。 二、"以患者为中心"的个体化治疗 随着人们对强化降糖的重新认识,各大指南也逐渐推荐放宽HbA1C达标的目标,并提出应根据实际情况为患者制定个体化的治疗。ADA、美国心脏病学会基金会(ACCF)和美国心脏协会(AHA)于2009年发表联合声明[11],指出虽然强化降糖并未体现出明确的可降低CVD发生的益处,但无论是对微血管疾病还是大血管疾病,HbA1C<7%仍是当时T1DM、T2DM患者最为合理和推荐的降糖目标,并推荐个体化的治疗方案。随后,CDS指南(2010年版)[12]和IDF指南(2012年版)[13]也强调了应兼顾心血管获益和用药安全,将HbA1C放宽至7%,并强调血糖控制目标应个体化。糖尿病管理也从单纯关注"血糖"控制的理念逐渐转变为管理"患者",开启了以患者为中心重新探索治疗安全性和个体化治疗的时代。此后"以患者为中心"根据患者的疾病特征制定个体化的管理策略一直贯穿整个糖尿病的治疗。 近期,瑞典隆德大学Leif Groop教授团队的研究成果则进一步推进了糖尿病患者的个体化治疗。该研究基于6项临床指标(发病年龄、BMI、HbA1C、β细胞功能、胰岛素抵抗和GADA)将糖尿病重新划分为5种类型[14],其中不同类型糖尿病患者所使用的治疗方案不同,而且不同类型患者的并发症发生风险也不同,如严重胰岛素缺乏型糖尿病(SIDD)患者视网膜病变发生率更高,严重胰岛素抵抗型糖尿病(SIRD)患者发生慢性肾病和糖尿病肾病的风险及非酒精性脂肪肝的风险更高。这一糖尿病精细化分型为糖尿病并发症的危险分层和个体化治疗奠定了基石。基于此,未来的糖尿病治疗,亦可以患者为中心,根据各型的结局特征,优先选择瞄准并发症、改善结局的药物进行更加精准的治疗,这将会成为糖尿病治疗的新策略。
`, + data: {}, + onLoad() { + // 药店端文章详情页面,仅允许药店人员访问 + app.waitLogin({ types: [4] }).then(() => { + // 页面加载完成 + }) }, - onLoad() {}, handleBack() { wx.navigateBack() }, diff --git a/src/doctor/pages/articleList/index.ts b/src/doctor/pages/articleList/index.ts index 5916308..465b86d 100644 --- a/src/doctor/pages/articleList/index.ts +++ b/src/doctor/pages/articleList/index.ts @@ -1,9 +1,36 @@ -const _app = getApp() +const app = getApp() Page({ - data: {}, - onLoad() {}, - handleDetail() { + data: { + names: [ + '张吉惟', + '林国瑞', + '林玟书', + '林雅南', + '江奕云', + '刘柏宏', + '阮建安', + '林子帆', + '夏志豪', + '吉茹定', + '李中冰', + '黄文隆', + '谢彦文', + '傅智翔', + '洪振霞', + '刘姿婷', + '荣姿康', + '吕致盈', + '方一强', + ], + }, + onLoad() { + // 药店端文章列表页面,仅允许药店人员访问 + app.waitLogin({ types: [4] }).then(() => { + // 页面加载完成 + }) + }, + handleInfo() { wx.navigateTo({ url: '/doctor/pages/article/index', }) diff --git a/src/doctor/pages/changeNickname/index.ts b/src/doctor/pages/changeNickname/index.ts index c563ebc..23c350b 100644 --- a/src/doctor/pages/changeNickname/index.ts +++ b/src/doctor/pages/changeNickname/index.ts @@ -1,8 +1,13 @@ -const _app = getApp() +const app = getApp() Page({ data: {}, - onLoad() {}, + onLoad() { + // 药店端修改昵称页面,仅允许药店人员访问 + app.waitLogin({ types: [4] }).then(() => { + // 页面加载完成 + }) + }, handleBack() { wx.navigateBack() }, diff --git a/src/doctor/pages/changeTel/index.ts b/src/doctor/pages/changeTel/index.ts index 9da5da1..03abe3a 100644 --- a/src/doctor/pages/changeTel/index.ts +++ b/src/doctor/pages/changeTel/index.ts @@ -1,78 +1,26 @@ -const app = getApp(); -let timer = null as null | number; +const app = getApp() Page({ data: { - mobile: "", - code: "", - - codeText: "发送验证码", + mobile: '', + code: '', + codeText: '发送验证码', + }, + onLoad() { + // 药店端修改手机号页面,仅允许药店人员访问 + app.waitLogin({ types: [4] }).then(() => { + // 页面加载完成 + }) }, - onLoad() {}, getCode() { - if (timer) return; - const mobile = this.data.mobile; - if (!mobile) { - wx.showToast({ - title: "手机号不能为空", - icon: "none", - }); - return; - } - // 验证手机号 - if (!/^(13[0-9]|14[579]|15[0-3,5-9]|16[6]|17[0135678]|18[0-9]|19[89])\d{8}$/.test(mobile)) { - wx.showToast({ - title: "手机号格式不正确", - icon: "none", - }); - return; - } - wx.ajax({ - method: "POST", - url: "?r=zd/login/send-verify-code", - data: { - mobile, - }, - }).then((res) => { - console.log(res); - wx.showToast({ - icon: "none", - title: "验证码已发送~", - }); - let time = 60; - timer = setInterval(() => { - time--; - this.setData({ - codeText: time + "s后重新发送", - }); - if (time <= 0) { - clearInterval(timer as number); - timer = null; - this.setData({ - codeText: "发送验证码", - }); - } - }, 1000); - }); + // TODO: 需要更新为新的接口 }, handleSubmit() { - const { mobile, code } = this.data; - const { registrationSource, registChannel, regBusinessId } = app.globalData; - wx.ajax({ - method: "POST", - url: "?r=zd/account/update-telephone", - data: { - mobile, - code, - registrationSource, - registChannel, - regBusinessId, - }, - }).then((_res) => { - wx.navigateBack(); - }); + // TODO: 需要更新为新的接口 }, handleBack() { - wx.navigateBack(); + wx.navigateBack() }, -}); +}) + +export {} diff --git a/src/doctor/pages/home/index.ts b/src/doctor/pages/home/index.ts index b547fe7..ea76d63 100644 --- a/src/doctor/pages/home/index.ts +++ b/src/doctor/pages/home/index.ts @@ -4,25 +4,137 @@ Page({ data: { fold1: true, fold2: true, + + // 用户信息 + pharmacistName: '', + pharmacistAvatar: '', + pharmacyName: '', + + // 待处理患者数 + pendingCount: 0, + + // 统计数据 + invitePatientCount: 0, + jumpPatientCount: 0, + enrollPatientCount: 0, + + // 图表数据 + chartData: [] as Array<{ date: string, count: number }>, + + // 日期范围 + startDate: '', + endDate: '', + + // 统计类型: day-日统计, month-月统计 + statType: 'day', }, + ecDataTrendComponent1_1: null as any, + async onLoad() { const app = getApp() - app.waitLogin().then(() => {}) - const list = [ - { StatMonth: '2026-01', MonthInvitePCount: 1 }, - { StatMonth: '2026-02', MonthInvitePCount: 2 }, - { StatMonth: '2026-03', MonthInvitePCount: 3 }, - { StatMonth: '2026-04', MonthInvitePCount: 2 }, - { StatMonth: '2026-05', MonthInvitePCount: 5 }, - { StatMonth: '2026-06', MonthInvitePCount: 7 }, - { StatMonth: '2026-07', MonthInvitePCount: 5 }, - { StatMonth: '2026-08', MonthInvitePCount: 3 }, - { StatMonth: '2026-09', MonthInvitePCount: 8 }, - { StatMonth: '2026-10', MonthInvitePCount: 10 }, - ] - this.initChartBar(list) + // 药店端页面,仅允许药店人员(4)访问 + app.waitLogin({ types: [4] }).then(() => { + this.getUserInfo() + this.getPendingCount() + this.getStatistics() + this.getPatientChart() + }) + + // 初始化日期范围为最近30天 + const endDate = this.formatDate(new Date()) + const startDate = this.formatDate(new Date(Date.now() - 30 * 24 * 60 * 60 * 1000)) + this.setData({ + startDate, + endDate, + }) + }, + + // 格式化日期 + formatDate(date: Date): string { + const year = date.getFullYear() + const month = String(date.getMonth() + 1).padStart(2, '0') + const day = String(date.getDate()).padStart(2, '0') + return `${year}-${month}-${day}` + }, + + // 获取用户信息 + getUserInfo() { + wx.ajax({ + method: 'GET', + url: '/app/pharmacist/pharmacist/info', + }).then((res: any) => { + this.setData({ + pharmacistName: res.name, + pharmacistAvatar: res.avatar, + pharmacyName: res.pharmacyName, + }) + }) + }, + + // 获取待处理患者数 + getPendingCount() { + wx.ajax({ + method: 'GET', + url: '/app/pharmacist/pharmacist/pending-count', + }).then((res: any) => { + this.setData({ + pendingCount: res.count || 0, + }) + }) + }, + + // 获取统计数据看板 + getStatistics() { + wx.ajax({ + method: 'GET', + url: '/app/pharmacist/pharmacist/statistics', + }).then((res: any) => { + this.setData({ + invitePatientCount: res.invitePatientCount, + jumpPatientCount: res.jumpPatientCount, + enrollPatientCount: res.enrollPatientCount, + }) + }) }, + + // 获取邀约患者统计图表 + getPatientChart() { + wx.ajax({ + method: 'GET', + url: '/app/pharmacist/pharmacist/patient-chart', + data: { + type: this.data.statType, + startDate: this.data.startDate, + endDate: this.data.endDate, + }, + }).then((res: any) => { + this.setData({ + chartData: res.list || [], + }) + this.initChartBar(res.list || []) + }) + }, + + // 切换统计类型 + switchStatType(e: WechatMiniprogram.CustomEvent) { + const type = e.currentTarget.dataset.type + this.setData({ + statType: type, + }) + this.getPatientChart() + }, + + // 日期选择变化 + onDateChange(e: WechatMiniprogram.CustomEvent) { + const { field } = e.currentTarget.dataset + this.setData({ + [field]: e.detail.value, + }) + // 重新加载图表数据 + this.getPatientChart() + }, + initChartBar(list: any[]) { return new Promise((reslove) => { this.ecDataTrendComponent1_1 = this.selectComponent('#chart1_1') @@ -30,14 +142,14 @@ Page({ const chart = echarts.init(canvas, null, { width, height, - devicePixelRatio: dpr, // new + devicePixelRatio: dpr, }) canvas.setChart(chart) const x: string[] = [] const y1: string[] = [] list.forEach((item) => { - x.push(item.StatMonth) - y1.push(item.MonthInvitePCount) + x.push(item.date || item.StatMonth) + y1.push(item.count || item.MonthInvitePCount) }) const option = { @@ -124,7 +236,7 @@ Page({ }, ], dataZoom: { - type: 'inside', // 有type这个属性,滚动条在最下面,也可以不行,写y:36,这表示距离顶端36px,一般就是在图上面。 + type: 'inside', startValue: x.length - 6, endValue: x.length - 1, filterMode: 'none', @@ -137,16 +249,19 @@ Page({ }) }) }, + handleInvite() { wx.navigateTo({ url: '/doctor/pages/invite/index', }) }, + handleStat() { wx.navigateTo({ url: '/doctor/pages/stat/index', }) }, + handleFold(e) { const { key } = e.currentTarget.dataset this.setData({ diff --git a/src/doctor/pages/invite/index.ts b/src/doctor/pages/invite/index.ts index c563ebc..13dc5bf 100644 --- a/src/doctor/pages/invite/index.ts +++ b/src/doctor/pages/invite/index.ts @@ -1,8 +1,13 @@ -const _app = getApp() +const app = getApp() Page({ data: {}, - onLoad() {}, + onLoad() { + // 药店端邀约页面,仅允许药店人员访问 + app.waitLogin({ types: [4] }).then(() => { + // 页面加载完成 + }) + }, handleBack() { wx.navigateBack() }, diff --git a/src/doctor/pages/login/index.ts b/src/doctor/pages/login/index.ts index 698b976..e8d65cb 100644 --- a/src/doctor/pages/login/index.ts +++ b/src/doctor/pages/login/index.ts @@ -37,9 +37,10 @@ Page({ } wx.ajax({ method: 'POST', - url: '?r=zd/login/send-verify-code', + url: '/app/common/common/send-code', data: { - mobile, + phone: mobile, + type: 1, }, }).then((_res) => { wx.showToast({ @@ -86,12 +87,20 @@ Page({ } wx.ajax({ method: 'POST', - url: '?r=zd/doctor/login/reg-login', + url: '/app/pharmacist/pharmacist/sms-login', data: { - mobile: this.data.mobile, + phone: this.data.mobile, code: this.data.code, }, - }).then((_res) => { + }).then((res) => { + const app = getApp() + app.globalData.loginState = res.token + app.globalData.initLoginInfo = { + loginType: 4, + isLogin: 1, + isReg: 1, + ...res, + } this.submitCallback() }) }, @@ -122,10 +131,8 @@ Page({ } }, submitCallback() { - app.globalData.loginType = 2 - app.globalData.isLogin = true wx.reLaunch({ - url: '/doctor/pages/d_home/index', + url: '/doctor/pages/home/index', }) }, handlePatient() { diff --git a/src/doctor/pages/loginForm/index.ts b/src/doctor/pages/loginForm/index.ts index d162f1b..c4ae984 100644 --- a/src/doctor/pages/loginForm/index.ts +++ b/src/doctor/pages/loginForm/index.ts @@ -12,11 +12,14 @@ Page({ show: false, }, onLoad(option) { - if (option.back) { - this.setData({ - back: true, - }) - } + // 登录表单页面,允许游客访问 + app.waitLogin({ types: [1] }).then(() => { + if (option.back) { + this.setData({ + back: true, + }) + } + }) }, getCode() { if (timer) return @@ -29,7 +32,7 @@ Page({ return } // 验证手机号 - if (!/^1[3-9,]\d{9}$/.test(mobile)) { + if (!/^1[3-9]\d{9}$/.test(mobile)) { wx.showToast({ title: '手机号格式不正确', icon: 'none', @@ -38,9 +41,10 @@ Page({ } wx.ajax({ method: 'POST', - url: '?r=zd/login/send-verify-code', + url: '/app/common/common/send-code', data: { - mobile, + phone: mobile, + type: 1, }, }).then((_res) => { wx.showToast({ @@ -87,12 +91,19 @@ Page({ } wx.ajax({ method: 'POST', - url: '?r=zd/doctor/login/reg-login', + url: '/app/pharmacist/pharmacist/sms-login', data: { - mobile: this.data.mobile, + phone: this.data.mobile, code: this.data.code, }, - }).then((_res) => { + }).then((res: any) => { + app.globalData.loginState = res.token + app.globalData.initLoginInfo = { + loginType: 4, + isLogin: 1, + isReg: 1, + ...res, + } this.submitCallback() }) }, @@ -123,15 +134,13 @@ Page({ } }, submitCallback() { - app.globalData.loginType = 2 - app.globalData.isLogin = true wx.reLaunch({ - url: '/doctor/pages/d_home/index', + url: '/doctor/pages/home/index', }) }, handlePatient() { wx.redirectTo({ - url: '/pages/login/index', + url: '/pages/index/index', }) }, handleTelCode() { diff --git a/src/doctor/pages/my/index.ts b/src/doctor/pages/my/index.ts index 60760b6..c44ecd1 100644 --- a/src/doctor/pages/my/index.ts +++ b/src/doctor/pages/my/index.ts @@ -1,8 +1,13 @@ -const _app = getApp() +const app = getApp() Page({ data: {}, - onLoad() {}, + onLoad() { + // 药店端我的页面,仅允许药店人员访问 + app.waitLogin({ types: [4] }).then(() => { + // 页面加载完成 + }) + }, handleNickname() { wx.navigateTo({ url: '/doctor/pages/changeNickname/index', diff --git a/src/doctor/pages/patientList/index.ts b/src/doctor/pages/patientList/index.ts index 34f287c..031f726 100644 --- a/src/doctor/pages/patientList/index.ts +++ b/src/doctor/pages/patientList/index.ts @@ -1,26 +1,38 @@ -const _app = getApp() +const app = getApp() Page({ data: { - popupShow: false, - popupType: 'popup1', - popupParams: {}, + names: [ + '张吉惟', + '林国瑞', + '林玟书', + '林雅南', + '江奕云', + '刘柏宏', + '阮建安', + '林子帆', + '夏志豪', + '吉茹定', + '李中冰', + '黄文隆', + '谢彦文', + '傅智翔', + '洪振霞', + '刘姿婷', + '荣姿康', + '吕致盈', + '方一强', + ], }, - onLoad() {}, - handleUpload() { - this.setData({ - popupShow: true, - popupType: 'popup1', + onLoad() { + // 药店端患者列表页面,仅允许药店人员访问 + app.waitLogin({ types: [4] }).then(() => { + // 页面加载完成 }) }, - handlePopupOk() { - this.setData({ - popupShow: false, - }) - }, - handlePopupCancel() { - this.setData({ - popupShow: false, + handleInfo() { + wx.navigateTo({ + url: '/doctor/pages/stat/index', }) }, }) diff --git a/src/doctor/pages/stat/index.ts b/src/doctor/pages/stat/index.ts index c563ebc..1b35888 100644 --- a/src/doctor/pages/stat/index.ts +++ b/src/doctor/pages/stat/index.ts @@ -1,8 +1,13 @@ -const _app = getApp() +const app = getApp() Page({ data: {}, - onLoad() {}, + onLoad() { + // 药店端统计页面,仅允许药店人员访问 + app.waitLogin({ types: [4] }).then(() => { + // 页面加载完成 + }) + }, handleBack() { wx.navigateBack() }, diff --git a/src/ground/pages/changeNickname/index.ts b/src/ground/pages/changeNickname/index.ts index c563ebc..37a7f3c 100644 --- a/src/ground/pages/changeNickname/index.ts +++ b/src/ground/pages/changeNickname/index.ts @@ -1,8 +1,13 @@ -const _app = getApp() +const app = getApp() Page({ data: {}, - onLoad() {}, + onLoad() { + // 地推端修改昵称页面,仅允许地推人员访问 + app.waitLogin({ types: [3] }).then(() => { + // 页面加载完成 + }) + }, handleBack() { wx.navigateBack() }, diff --git a/src/ground/pages/changeTel/index.ts b/src/ground/pages/changeTel/index.ts index 9da5da1..fc9dfd3 100644 --- a/src/ground/pages/changeTel/index.ts +++ b/src/ground/pages/changeTel/index.ts @@ -1,78 +1,26 @@ -const app = getApp(); -let timer = null as null | number; +const app = getApp() Page({ data: { - mobile: "", - code: "", - - codeText: "发送验证码", + mobile: '', + code: '', + codeText: '发送验证码', + }, + onLoad() { + // 地推端修改手机号页面,仅允许地推人员访问 + app.waitLogin({ types: [3] }).then(() => { + // 页面加载完成 + }) }, - onLoad() {}, getCode() { - if (timer) return; - const mobile = this.data.mobile; - if (!mobile) { - wx.showToast({ - title: "手机号不能为空", - icon: "none", - }); - return; - } - // 验证手机号 - if (!/^(13[0-9]|14[579]|15[0-3,5-9]|16[6]|17[0135678]|18[0-9]|19[89])\d{8}$/.test(mobile)) { - wx.showToast({ - title: "手机号格式不正确", - icon: "none", - }); - return; - } - wx.ajax({ - method: "POST", - url: "?r=zd/login/send-verify-code", - data: { - mobile, - }, - }).then((res) => { - console.log(res); - wx.showToast({ - icon: "none", - title: "验证码已发送~", - }); - let time = 60; - timer = setInterval(() => { - time--; - this.setData({ - codeText: time + "s后重新发送", - }); - if (time <= 0) { - clearInterval(timer as number); - timer = null; - this.setData({ - codeText: "发送验证码", - }); - } - }, 1000); - }); + // TODO: 需要更新为新的接口 }, handleSubmit() { - const { mobile, code } = this.data; - const { registrationSource, registChannel, regBusinessId } = app.globalData; - wx.ajax({ - method: "POST", - url: "?r=zd/account/update-telephone", - data: { - mobile, - code, - registrationSource, - registChannel, - regBusinessId, - }, - }).then((_res) => { - wx.navigateBack(); - }); + // TODO: 需要更新为新的接口 }, handleBack() { - wx.navigateBack(); + wx.navigateBack() }, -}); +}) + +export {} diff --git a/src/ground/pages/home/index.ts b/src/ground/pages/home/index.ts index 62dd082..65c7f6e 100644 --- a/src/ground/pages/home/index.ts +++ b/src/ground/pages/home/index.ts @@ -4,29 +4,170 @@ Page({ data: { fold1: true, fold2: true, + + // 用户信息 + promoterName: '', + promoterAvatar: '', + label: '邀约专员', + + // 统计数据 + invitePharmacyCount: 0, + invitePharmacistCount: 0, + invitePatientCount: 0, + jumpPatientCount: 0, + enrollPatientCount: 0, + indicationStats: [] as Array<{ + indicationId: number + indicationName: string + invitePatientCount: number + jumpPatientCount: number + enrollPatientCount: number + }>, + + // 图表数据 + chartData: [] as Array<{ date: string, count: number }>, + + // 日期范围 + startDate: '', + endDate: '', + + // 统计类型: day-日统计, month-月统计 + statType: 'day', }, + ecDataTrendComponent1_1: null as any, ecDataTrendComponent2_1: null as any, ecDataTrendComponent3_1: null as any, + async onLoad() { const app = getApp() - app.waitLogin().then(() => {}) - const list = [ - { StatMonth: '2026-01', MonthInvitePCount: 1 }, - { StatMonth: '2026-02', MonthInvitePCount: 2 }, - { StatMonth: '2026-03', MonthInvitePCount: 3 }, - { StatMonth: '2026-04', MonthInvitePCount: 2 }, - { StatMonth: '2026-05', MonthInvitePCount: 5 }, - { StatMonth: '2026-06', MonthInvitePCount: 7 }, - { StatMonth: '2026-07', MonthInvitePCount: 5 }, - { StatMonth: '2026-08', MonthInvitePCount: 3 }, - { StatMonth: '2026-09', MonthInvitePCount: 8 }, - { StatMonth: '2026-10', MonthInvitePCount: 10 }, - ] - this.initChartBar(list) - this.initChartLine(list, '#chart2_1', this.ecDataTrendComponent2_1) - this.initChartLine(list, '#chart3_1', this.ecDataTrendComponent3_1) + // 地推端页面,仅允许地推人员(3)访问 + app.waitLogin({ types: [3] }).then(() => { + this.getUserInfo() + this.getStatistics() + this.getPatientChart() + this.getPharmacistChart() + this.getPharmacyChart() + }) + + // 初始化日期范围为最近30天 + const endDate = this.formatDate(new Date()) + const startDate = this.formatDate(new Date(Date.now() - 30 * 24 * 60 * 60 * 1000)) + this.setData({ + startDate, + endDate, + }) + }, + + // 格式化日期 + formatDate(date: Date): string { + const year = date.getFullYear() + const month = String(date.getMonth() + 1).padStart(2, '0') + const day = String(date.getDate()).padStart(2, '0') + return `${year}-${month}-${day}` + }, + + // 获取用户信息 + getUserInfo() { + wx.ajax({ + method: 'GET', + url: '/app/promoter/promoter/info', + }).then((res: any) => { + this.setData({ + promoterName: res.name, + promoterAvatar: res.avatar, + }) + }) + }, + + // 获取统计数据看板 + getStatistics() { + wx.ajax({ + method: 'GET', + url: '/app/promoter/promoter/statistics', + }).then((res: any) => { + this.setData({ + invitePharmacyCount: res.invitePharmacyCount, + invitePharmacistCount: res.invitePharmacistCount, + invitePatientCount: res.invitePatientCount, + jumpPatientCount: res.jumpPatientCount, + enrollPatientCount: res.enrollPatientCount, + indicationStats: res.indicationStats || [], + }) + }) + }, + + // 获取邀约患者统计图表 + getPatientChart() { + wx.ajax({ + method: 'GET', + url: '/app/promoter/promoter/patient-chart', + data: { + type: this.data.statType, + startDate: this.data.startDate, + endDate: this.data.endDate, + }, + }).then((res: any) => { + this.setData({ + chartData: res.list || [], + }) + this.initChartBar(res.list || []) + }) + }, + + // 获取邀约药师统计图表 + getPharmacistChart() { + wx.ajax({ + method: 'GET', + url: '/app/promoter/promoter/pharmacist-chart', + data: { + type: this.data.statType, + startDate: this.data.startDate, + endDate: this.data.endDate, + }, + }).then((res: any) => { + this.initChartLine(res.list || [], '#chart2_1', 'ecDataTrendComponent2_1') + }) + }, + + // 获取邀约药店统计图表 + getPharmacyChart() { + wx.ajax({ + method: 'GET', + url: '/app/promoter/promoter/pharmacy-chart', + data: { + type: this.data.statType, + startDate: this.data.startDate, + endDate: this.data.endDate, + }, + }).then((res: any) => { + this.initChartLine(res.list || [], '#chart3_1', 'ecDataTrendComponent3_1') + }) + }, + + // 切换统计类型 + switchStatType(e: WechatMiniprogram.CustomEvent) { + const type = e.currentTarget.dataset.type + this.setData({ + statType: type, + }) + this.getPatientChart() + this.getPharmacistChart() + this.getPharmacyChart() + }, + + // 日期选择变化 + onDateChange(e: WechatMiniprogram.CustomEvent) { + const { field } = e.currentTarget.dataset + this.setData({ + [field]: e.detail.value, + }) + // 重新加载图表数据 + this.getPatientChart() + this.getPharmacistChart() + this.getPharmacyChart() }, + initChartBar(list: any[]) { return new Promise((reslove) => { this.ecDataTrendComponent1_1 = this.selectComponent('#chart1_1') @@ -34,14 +175,14 @@ Page({ const chart = echarts.init(canvas, null, { width, height, - devicePixelRatio: dpr, // new + devicePixelRatio: dpr, }) canvas.setChart(chart) const x: string[] = [] const y1: string[] = [] list.forEach((item) => { - x.push(item.StatMonth) - y1.push(item.MonthInvitePCount) + x.push(item.date || item.StatMonth) + y1.push(item.count || item.MonthInvitePCount) }) const option = { @@ -128,7 +269,7 @@ Page({ }, ], dataZoom: { - type: 'inside', // 有type这个属性,滚动条在最下面,也可以不行,写y:36,这表示距离顶端36px,一般就是在图上面。 + type: 'inside', startValue: x.length - 6, endValue: x.length - 1, filterMode: 'none', @@ -141,6 +282,7 @@ Page({ }) }) }, + initChartLine(list: any[], name: string, componentName: string) { return new Promise((reslove) => { this[componentName] = this.selectComponent(name) @@ -148,14 +290,14 @@ Page({ const chart = echarts.init(canvas, null, { width, height, - devicePixelRatio: dpr, // new + devicePixelRatio: dpr, }) canvas.setChart(chart) const x: string[] = [] const y1: string[] = [] list.forEach((item) => { - x.push(item.StatMonth) - y1.push(item.MonthInvitePCount) + x.push(item.date || item.StatMonth) + y1.push(item.count || item.MonthInvitePCount) }) const option = { @@ -234,7 +376,7 @@ Page({ }, ], dataZoom: { - type: 'inside', // 有type这个属性,滚动条在最下面,也可以不行,写y:36,这表示距离顶端36px,一般就是在图上面。 + type: 'inside', startValue: x.length - 6, endValue: x.length - 1, filterMode: 'none', @@ -247,16 +389,19 @@ Page({ }) }) }, + handleInvite() { wx.navigateTo({ url: '/ground/pages/invite/index', }) }, + handleInfo() { wx.navigateTo({ url: '/ground/pages/stat/index', }) }, + handleFold(e) { const { key } = e.currentTarget.dataset this.setData({ diff --git a/src/ground/pages/invite/index.ts b/src/ground/pages/invite/index.ts index c563ebc..71ee455 100644 --- a/src/ground/pages/invite/index.ts +++ b/src/ground/pages/invite/index.ts @@ -1,8 +1,13 @@ -const _app = getApp() +const app = getApp() Page({ data: {}, - onLoad() {}, + onLoad() { + // 地推端邀约页面,仅允许地推人员访问 + app.waitLogin({ types: [3] }).then(() => { + // 页面加载完成 + }) + }, handleBack() { wx.navigateBack() }, diff --git a/src/ground/pages/login/index.ts b/src/ground/pages/login/index.ts index 221b523..b0b5fa2 100644 --- a/src/ground/pages/login/index.ts +++ b/src/ground/pages/login/index.ts @@ -1,4 +1,3 @@ -const app = getApp() let timer = null as null | number Page({ @@ -37,9 +36,10 @@ Page({ } wx.ajax({ method: 'POST', - url: '?r=zd/login/send-verify-code', + url: '/app/common/common/send-code', data: { - mobile, + phone: mobile, + type: 1, }, }).then((_res) => { wx.showToast({ @@ -86,12 +86,20 @@ Page({ } wx.ajax({ method: 'POST', - url: '?r=zd/doctor/login/reg-login', + url: '/app/promoter/promoter/sms-login', data: { - mobile: this.data.mobile, + phone: this.data.mobile, code: this.data.code, }, - }).then((_res) => { + }).then((res) => { + const app = getApp() + app.globalData.loginState = res.token + app.globalData.initLoginInfo = { + loginType: 3, + isLogin: 1, + isReg: 1, + ...res, + } this.submitCallback() }) }, @@ -122,10 +130,8 @@ Page({ } }, submitCallback() { - app.globalData.loginType = 2 - app.globalData.isLogin = true wx.reLaunch({ - url: '/doctor/pages/d_home/index', + url: '/ground/pages/home/index', }) }, handlePatient() { diff --git a/src/ground/pages/my/index.ts b/src/ground/pages/my/index.ts index 71f0832..a9a3591 100644 --- a/src/ground/pages/my/index.ts +++ b/src/ground/pages/my/index.ts @@ -1,8 +1,13 @@ -const _app = getApp() +const app = getApp() Page({ data: {}, - onLoad() {}, + onLoad() { + // 地推端我的页面,仅允许地推人员访问 + app.waitLogin({ types: [3] }).then(() => { + // 页面加载完成 + }) + }, handleNickname() { wx.navigateTo({ url: '/ground/pages/changeNickname/index', diff --git a/src/ground/pages/pharmacist/index.ts b/src/ground/pages/pharmacist/index.ts index 91d04b9..e0ba091 100644 --- a/src/ground/pages/pharmacist/index.ts +++ b/src/ground/pages/pharmacist/index.ts @@ -1,4 +1,4 @@ -const _app = getApp() +const app = getApp() Page({ data: { @@ -24,7 +24,12 @@ Page({ '方一强', ], }, - onLoad() {}, + onLoad() { + // 地推端药师页面,仅允许地推人员访问 + app.waitLogin({ types: [3] }).then(() => { + // 页面加载完成 + }) + }, handleInfo() { wx.navigateTo({ url: '/ground/pages/stat/index', diff --git a/src/ground/pages/stat/index.ts b/src/ground/pages/stat/index.ts index c563ebc..b1d50b7 100644 --- a/src/ground/pages/stat/index.ts +++ b/src/ground/pages/stat/index.ts @@ -1,8 +1,13 @@ -const _app = getApp() +const app = getApp() Page({ data: {}, - onLoad() {}, + onLoad() { + // 地推端统计页面,仅允许地推人员访问 + app.waitLogin({ types: [3] }).then(() => { + // 页面加载完成 + }) + }, handleBack() { wx.navigateBack() }, diff --git a/src/pages/index/index.ts b/src/pages/index/index.ts index 8c7bc9f..4179832 100644 --- a/src/pages/index/index.ts +++ b/src/pages/index/index.ts @@ -1,67 +1,160 @@ Page({ data: { - // 导航栏背景 background: 'transparent', - // 图片URL imageUrl: '', - // 时间戳,用于图片缓存 Timestamp: Date.now(), - // 弹窗控制 popupShow: false, popupType: '', popupParams: {}, - // 适应症选项 - options: [ - { id: 1, name: '斑块状银屑病', active: false }, - { id: 2, name: '克罗恩病', active: false }, - { id: 3, name: '溃疡性结肠炎', active: false }, - ], - // 协议勾选状态 + options: [] as Array<{ indicationId: number; indicationName: string; active: boolean }>, agreementChecked: true, + + projectId: 0, + projectName: '', + + isLogin: 0, + isPatient: 0, + + bannerList: [] as any[], }, - // 生命周期函数:页面加载 onLoad() { const app = getApp() - app.waitLogin().then(() => { - // 登录后调用页面所需的接口 + app.waitLogin({ types: [1, 2] }).then(() => { + this.getBanner() + this.checkStatus() + }) + }, + getBanner() { + wx.ajax({ + method: 'GET', + url: '/app/patient/patient/banner-list', + data: { + projectId: this.data.projectId, + }, + }).then((res: any) => { + this.setData({ + bannerList: res, + }) + }) + }, + checkStatus() { + wx.ajax({ + method: 'GET', + url: '/app/patient/patient/check-status', + }).then((res: any) => { + this.setData({ + isLogin: res.isLogin, + isPatient: res.isPatient, + projectId: res.projectId, + projectName: res.projectName, + }) + if (res.isLogin === 1 && res.isPatient === 1 && res.projectId) { + this.setData({ + options: [ + { + indicationId: res.indicationId, + indicationName: res.indicationName, + active: true, + }, + ], + }) + } else { + this.getProjectInfo() + } + }) + }, + + getProjectInfo() { + wx.ajax({ + method: 'GET', + url: '/app/patient/patient/project-info', + }).then((res: any) => { + this.setData({ + projectId: res.projectId, + projectName: res.projectName, + options: res.indications.map((item: any) => ({ + indicationId: item.indicationId, + indicationName: item.indicationName, + active: false, + })), + }) }) }, - // 弹窗确认操作 handlePopupOk() { this.setData({ popupShow: false, }) }, - // 弹窗取消操作 handlePopupCancel() { this.setData({ popupShow: false, }) }, - // 选择适应症 selectOption(e) { - const id = e.currentTarget.dataset.id as number + const indicationId = e.currentTarget.dataset.id as number const newOptions = this.data.options.map((option) => ({ ...option, - active: option.id === id, + active: option.indicationId === indicationId, })) this.setData({ options: newOptions, }) }, - handleWxSubmit() { - wx.navigateToMiniProgram({ - appId: 'wx05551c5ee1fd1c12', - }) + + handleWxSubmit(e: WechatMiniprogram.CustomEvent) { + if (!this.data.agreementChecked) { + wx.showToast({ + icon: 'none', + title: '请同意用户协议', + }) + return + } + + const selectedOption = this.data.options.find((item) => item.active) + if (!selectedOption) { + wx.showToast({ + icon: 'none', + title: '请选择适应症', + }) + return + } + + const { iv, encryptedData } = e.detail + if (iv && encryptedData) { + wx.login({ + success: (loginRes) => { + wx.ajax({ + method: 'POST', + url: '/app/common/common/wx-login', + data: { + code: loginRes.code, + }, + }).then(() => { + wx.ajax({ + method: 'POST', + url: '/app/patient/patient/select-indication', + data: { + projectId: this.data.projectId, + indicationId: selectedOption.indicationId, + }, + }).then((res: any) => { + wx.navigateToMiniProgram({ + appId: 'wx05551c5ee1fd1c12', + path: res.jumpUrl, + }) + }) + }) + }, + }) + } }, - // 切换协议勾选状态 toggleAgreement() { this.setData({ agreementChecked: !this.data.agreementChecked, @@ -74,7 +167,6 @@ Page({ }) }, - // 用户点击右上角分享 onShareAppMessage() { return { title: '华观健康', diff --git a/src/pages/index/index.wxml b/src/pages/index/index.wxml index 6ffe7d3..fa04ce2 100644 --- a/src/pages/index/index.wxml +++ b/src/pages/index/index.wxml @@ -6,9 +6,9 @@ class="page" style="background: url('{{imageUrl}}bg2.png?t={{Timestamp}}') no-repeat top center/100% 558rpx;padding-top: {{pageTop+24}}px;" > -