From 3da20be625230721d245ffde5e46dda93a0b67d2 Mon Sep 17 00:00:00 2001 From: kola-web Date: Tue, 21 Jul 2026 14:47:17 +0800 Subject: [PATCH] stash --- README.md | 2 +- api-doc/PSVT协议模块接口文档.md | 4 +- api-doc/psvt-patient-api-doc.md | 70 ++++++++++---- src/app.ts | 50 ++-------- src/pages/confirmInfo/index.ts | 109 +++++++++++++++++++++- src/pages/confirmInfo/index.wxml | 126 ++++++++++++++++++++----- src/pages/login/index.scss | 2 +- src/pages/login/index.ts | 160 ++++---------------------------- src/pages/login/index.wxml | 4 +- 9 files changed, 292 insertions(+), 235 deletions(-) diff --git a/README.md b/README.md index 9a6c9f0..f59f66f 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,7 @@ -svn://39.106.86.127:28386/projects/wutian_xueyoubing_b/proj_src/shop/frontend/web/GeneB +svn://39.106.86.127:28386/projects/psvt/proj_src/shop/frontend/web/psvt ### vscode diff --git a/api-doc/PSVT协议模块接口文档.md b/api-doc/PSVT协议模块接口文档.md index d80677f..6c76324 100644 --- a/api-doc/PSVT协议模块接口文档.md +++ b/api-doc/PSVT协议模块接口文档.md @@ -136,7 +136,7 @@ data为数组类型,每个元素字段同"按类型获取协议详情"接口 ### 1. 获取协议列表 -- **路由**: `?r=psvtw/agreement/get-list` +- **路由**: `?r=agreement/get-list` - **请求方式**: GET - **是否需要登录**: 是 @@ -207,7 +207,7 @@ data为数组类型,每个元素字段同"按类型获取协议详情"接口 ### 2. 更新协议文案 -- **路由**: `?r=psvtw/agreement/update` +- **路由**: `?r=agreement/update` - **请求方式**: POST - **是否需要登录**: 是 - **事务**: 是 diff --git a/api-doc/psvt-patient-api-doc.md b/api-doc/psvt-patient-api-doc.md index a42eb5a..092d118 100644 --- a/api-doc/psvt-patient-api-doc.md +++ b/api-doc/psvt-patient-api-doc.md @@ -531,7 +531,7 @@ --- -### 2.3 渠道码列表 `GET ?r=?r=channel/list` +### 2.3 渠道码列表 `GET ?r=channel/list` **说明**: 获取所有有效渠道码列表。 @@ -547,7 +547,9 @@ "channelId": 1, "channelName": "渠道A", "channelDesc": "渠道A说明", - "miniCodeUrl": "https://xxx/minicode_1.png" + "miniCodeUrl": "https://xxx/minicode_1.png", + "createDate": "2023-01-01", + "updateDate": "2023-01-01" } ] } @@ -629,7 +631,42 @@ --- -### 2.6 获取小程序渠道码 `GET ?r=channel/get-minicode` +### 2.6 删除渠道码 `POST ?r=channel/delete` + +**说明**: 逻辑删除渠道码,将Status置为100(删除状态)。事务操作。 + +**请求参数**: + +| 参数名 | 类型 | 必填 | 说明 | +|---|---|---|---| +| channelId | int | 是 | 渠道ID | + +**响应示例**: +```json +{ + "code": 0, + "message": "success", + "data": { + "channelId": 1 + } +} +``` + +**响应字段说明**: + +| 字段名 | 类型 | 说明 | +|---|---|---| +| channelId | int | 已删除的渠道ID | + +**业务逻辑**: +1. 校验渠道存在 +2. 将渠道的Status置为100(删除状态),逻辑删除 +3. 更新UpdateBy和UpdateTime +4. 使用事务 + +--- + +### 2.7 获取小程序渠道码 `GET ?r=channel/get-minicode` **说明**: 根据渠道ID获取或生成小程序码图片URL。 @@ -667,7 +704,7 @@ --- -### 2.7 渠道码统计 `GET ?r=channel/stat` +### 2.8 渠道码统计 `GET ?r=channel/stat` **说明**: 根据日期范围和渠道ID获取渠道统计数据,从统计表获取。 @@ -689,6 +726,7 @@ "statDate": "2023-01-01", "channelId": 1, "channelName": "渠道A", + "channelDesc": "渠道A说明", "openPatientCount": 100, "phoneRegisteredCount": 80, "infoSubmittedCount": 50, @@ -705,6 +743,7 @@ | statDate | string | 统计日期 | | channelId | int | 渠道ID | | channelName | string | 渠道名称 | +| channelDesc | string | 渠道码说明 | | openPatientCount | int | 邀约打开患者数 | | phoneRegisteredCount | int | 邀约注册手机号患者数 | | infoSubmittedCount | int | 邀约提交信息患者数 | @@ -712,7 +751,7 @@ --- -### 2.8 渠道码原始数据列表 `GET ?r=channel/raw-list` +### 2.9 渠道码原始数据列表 `GET ?r=channel/raw-list` **说明**: 获取渠道邀约的原始记录列表,支持分页。通过JOIN t_psvt_user_info和t_psvt_patient_info获取用户属性和患者属性,不冗余存储。 @@ -740,32 +779,27 @@ { "id": 1, "inviteTime": "2023-01-01 10:00:00", + "inviteDate": "2023-01-01", "channelId": 1, "channelName": "渠道A", + "channelDesc": "渠道A说明", "inviteType": 1, + "inviteTypeName": "用户打开", "userId": "xxx", "patientId": 5, "nickName": "abcd12345678", "gender": 1, + "genderName": "男", "ageRange": 1, + "ageRangeName": "18-24岁", "provinceName": "北京", "cityName": "北京", "diagnosisStatus": 2, + "diagnosisStatusName": "确诊", "diagnosisTime": "2023-06", "surgeryStatus": 1, + "surgeryStatusName": "已手术", "telephone": "138xxxx1234", - "firstOpenTime": "2023-01-01 10:00:00", - "phoneRegisterTime": "2023-01-01 10:05:00", - "infoSubmitTime": "2023-01-01 10:10:00", - "isFirstOpenPhoneRegistered": true, - "isFirstOpenInfoSubmitted": true, - "isPhoneRegisteredNotLost": true, - "scanChannelId": 1, - "scanChannelName": "渠道A", - "telChannelId": 2, - "telChannelName": "渠道B", - "submitChannelId": 3, - "submitChannelName": "渠道C" } ] } @@ -816,7 +850,7 @@ --- -### 2.9 获取基础数据列表 `GET ?r=patient/base-data` +### 2.10 获取基础数据列表 `GET ?r=patient/base-data` **说明**: 返回性别、年龄段、确诊状态、手术状态等枚举数据,供后台管理端渲染下拉选项。 diff --git a/src/app.ts b/src/app.ts index bcecd06..3584d0e 100644 --- a/src/app.ts +++ b/src/app.ts @@ -69,11 +69,13 @@ App({ startLogin(callback?: () => void) { wx.login({ success: (res) => { + const channelId = this.globalData.scene?.channelId || '' wx.ajax({ method: 'GET', url: '?r=psvt/user/init-login', data: { code: res.code, + channelId, }, }).then((res) => { this.globalData.loginState = res.loginState @@ -85,18 +87,6 @@ App({ }, }) }, - updateLoginInfo(callback?: () => void) { - wx.ajax({ - method: 'GET', - url: '?r=wtx/user/init-info', - data: {}, - }).then((res) => { - this.globalData.initLoginInfo = res - if (callback) { - callback() - } - }) - }, waitLogin({ type = 0 } = { type: 'any' }) { return new Promise((resolve) => { const checkLogin = () => { @@ -113,41 +103,23 @@ App({ checkLogin() }) }, - checkLoginType(type: 0 | 1 | 2 | 'any') { - const { loginType, isLogin, isReg } = this.globalData.initLoginInfo + checkLoginType(type = 'any') { + const { isPhoneRegistered, isInfoSubmitted } = this.globalData.initLoginInfo if (type === 'any') { return true } - if (isLogin !== 1) { - if (type === 0) { - return true - } + if (!isPhoneRegistered) { wx.reLaunch({ - url: '/pages/index/index', + url: '/pages/login/index', }) return false } - if (isReg !== 1) { - const typePageUrl = { - 1: '/patient/pages/entryInfo/index', - 2: '/doctor/pages/login/index', - }[loginType as 1 | 2] + if (!isInfoSubmitted) { 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, + url: '/pages/confirmInfo/index', }) return false } @@ -155,11 +127,7 @@ App({ 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] + const url = '?r=wtx/mp-behavior/add' wx.ajax({ method: 'POST', url, diff --git a/src/pages/confirmInfo/index.ts b/src/pages/confirmInfo/index.ts index 3ab7aa9..c56ba14 100644 --- a/src/pages/confirmInfo/index.ts +++ b/src/pages/confirmInfo/index.ts @@ -1,14 +1,121 @@ -const _app = getApp() +const app = getApp() Page({ data: { menuTop: 0, step: 1, + + // Step 1: 基础信息 + ageRange: 0 as number, + gender: 0 as number, + provinceId: '' as string | number, + provinceName: '', + cityId: '' as string | number, + cityName: '', + regionText: '', + + // Step 2: PSVT情况 + diagnosisStatus: 0 as number, + diagnosisTime: '', + surgeryStatus: 0 as number, + currentMonth: '', }, onLoad() { const menuRes = wx.getMenuButtonBoundingClientRect() + const now = new Date() + const currentMonth = `${now.getFullYear()}-${String(now.getMonth() + 1).padStart(2, '0')}` this.setData({ menuTop: menuRes.top, + currentMonth, + }) + }, + handleSelect(e: WechatMiniprogram.TouchEvent) { + const { key, value } = e.currentTarget.dataset + this.setData({ + [key]: Number(value), + }) + }, + handleRegionChange(e: WechatMiniprogram.PickerChange) { + const region = e.detail.value as string[] + this.setData({ + provinceName: region[0], + cityName: region[2] || region[1], + regionText: region.filter((r) => r && r !== '全部').join(' '), + }) + }, + handleDiagnosisTimeChange(e: WechatMiniprogram.PickerChange) { + this.setData({ + diagnosisTime: e.detail.value as string, + }) + }, + handleNext() { + const { ageRange, gender } = this.data + if (!ageRange) { + wx.showToast({ title: '请选择年龄段', icon: 'none' }) + return + } + if (!gender) { + wx.showToast({ title: '请选择性别', icon: 'none' }) + return + } + this.setData({ step: 2 }) + }, + handlePrev() { + this.setData({ step: 1 }) + }, + handleSubmit() { + const { diagnosisStatus, surgeryStatus } = this.data + if (!diagnosisStatus) { + wx.showToast({ title: '请选择确诊状态', icon: 'none' }) + return + } + if (!surgeryStatus) { + wx.showToast({ title: '请选择手术状态', icon: 'none' }) + return + } + + const { + ageRange, + gender, + provinceId, + provinceName, + cityId, + cityName, + diagnosisStatus: ds, + diagnosisTime, + surgeryStatus: ss, + } = this.data + const channelId = app.globalData.scene?.channelId || '' + + const data: Record = { + ageRange, + gender, + diagnosisStatus: ds, + surgeryStatus: ss, + channelId, + } + if (provinceName) data.provinceName = provinceName + if (provinceId) data.provinceId = provinceId + if (cityName) data.cityName = cityName + if (cityId) data.cityId = cityId + if (diagnosisTime) data.diagnosisTime = diagnosisTime + + wx.ajax({ + method: 'POST', + url: '?r=psvt/patient/register', + data, + loading: true, + loadingText: '提交中...', + }).then((res) => { + const { isRegistered } = res + if (isRegistered) { + if (app.globalData.initLoginInfo) { + app.globalData.initLoginInfo.isInfoSubmitted = true + } + wx.reLaunch({ + url: '/pages/index/index', + }) + } }) }, }) diff --git a/src/pages/confirmInfo/index.wxml b/src/pages/confirmInfo/index.wxml index 3da8897..05d61e0 100644 --- a/src/pages/confirmInfo/index.wxml +++ b/src/pages/confirmInfo/index.wxml @@ -6,7 +6,7 @@ 1 - 1 + 基础信息 @@ -19,24 +19,56 @@ 这些信息将用于优化内容推荐与服务提醒,不作为诊断或 治疗建议依据。 - + + + 我的年龄段 - 18-28岁 - 18-28岁 - 18-28岁 - 18-28岁 + 18-28岁 + 29-40岁 + 41-50岁 + 50岁以上 我的性别 - + - + @@ -45,35 +77,64 @@ 所在地区 - + - + {{regionText || ''}} - + + + - 我的年龄段 + 确诊状态 - + 疑似PSVT 正在了解中 - - 疑似PSVT - 正在了解中 + + 已确诊PSVT + + + 心悸/心跳过快 + 尚未就诊 + + + 亲友相关 + 想了解更多 - + 确诊时间 - + - + {{diagnosisTime || ''}} @@ -82,13 +143,28 @@ 是否接受过相关手术治疗 - + 已接受射频消融 /相关手术 - + 尚未接受手术 - + 正在评估 @@ -96,10 +172,10 @@ - 下一步 + 下一步 - 上一步 - 立即加入 + 上一步 + 立即加入 diff --git a/src/pages/login/index.scss b/src/pages/login/index.scss index c9eae56..40bcc74 100644 --- a/src/pages/login/index.scss +++ b/src/pages/login/index.scss @@ -25,7 +25,7 @@ height: 96rpx; line-height: 96rpx; text-align: center; - font-size: 36rpx; + font-size: 32rpx; color: #ffffff; background: linear-gradient(270deg, #439fc7 0%, #2f82a9 100%); border-radius: 24rpx 24rpx 24rpx 24rpx; diff --git a/src/pages/login/index.ts b/src/pages/login/index.ts index 7442378..4b813de 100644 --- a/src/pages/login/index.ts +++ b/src/pages/login/index.ts @@ -1,191 +1,63 @@ const app = getApp() -let timer = null as null | number Page({ data: { menuTop: 0, - mobile: '', - code: '', - - check1: false, - check2: false, - - codeText: '发送验证码', - page: '', - - toastShow: false, - toastType: '', - toastParams: {} as any, + checked: false, }, - onLoad(options) { + onLoad(_options) { const menuRes = wx.getMenuButtonBoundingClientRect() this.setData({ menuTop: menuRes.top, }) - - if (timer) { - clearInterval(timer) - timer = null - this.setData({ codeText: '发送验证码' }) - } - this.setData({ - page: options.page, - }) - }, - onUnload() { - if (timer) { - clearInterval(timer) - timer = null - } - }, - getCode() { - if (timer) return - const mobile = this.data.mobile - if (!mobile) { - wx.showToast({ - title: '手机号不能为空', - icon: 'none', - }) - return - } - // 验证手机号 - if (!/^1[3-9,]\d{9}$/.test(mobile)) { - wx.showToast({ - title: '手机号格式不正确', - icon: 'none', - }) - return - } - wx.ajax({ - method: 'POST', - url: '?r=igg4/login/send-verify-code', - data: { - mobile, - }, - }).then((_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) - }) + app.waitLogin({ type: 'any' }).then(() => {}) }, - handleSubmit() { - const { mobile, code } = this.data - const { registrationSource, registChannel, regBusinessId } = app.globalData - wx.ajax({ - method: 'POST', - url: '?r=igg4/login/reg-login', - data: { - mobile, - code, - registrationSource, - registChannel, - regBusinessId, - }, - }).then((_res) => { - this.submitCallback() + handleCheck() { + this.setData({ + checked: !this.data.checked, }) }, handleWxSubmit(e: WechatMiniprogram.CustomEvent) { const { iv, encryptedData } = e.detail - const { registrationSource, registChannel, regBusinessId } = app.globalData if (iv && encryptedData) { + const channelId = app.globalData.scene?.channelId || '' wx.ajax({ method: 'POST', - url: '?r=igg4/login/wx-reg-login', + url: '?r=psvt/patient/phone-register', data: { iv: encodeURIComponent(iv), encryptedData: encodeURIComponent(encryptedData), - registrationSource, - registChannel, - regBusinessId, + channelId, }, - }).then((_res) => { + }).then(() => { this.submitCallback() }) } }, handleWxCheck() { - this.setData({ - toastShow: true, - toastType: 'popup11', - toastParams: { isDoctor: false }, + wx.showToast({ + title: '请先阅读并同意相关协议', + icon: 'none', }) }, submitCallback() { - app.globalData.loginType = 1 - app.globalData.isLogin = true - app.getUserInfo(this, true, (userInfo) => { - // 1-空白用户,2-注册用户,3-疾病患者,4-用药患者 - const { PatientId, UserType } = userInfo - const backPage = app.globalData.backPage - let urlKey = '' - if (UserType >= 3) { - urlKey = 'home' - } else if (!PatientId) { - urlKey = 'enterInfo' - } - const navUrl = { - home: backPage || '/pages/index/index', - enterInfo: '/pages/enterInfo/index', - }[urlKey] - - if (['enterInfo'].includes(urlKey)) { - wx.navigateTo({ - url: navUrl, - }) - } else { - wx.reLaunch({ - url: navUrl, - }) - } + app.globalData.initLoginInfo.isReg = 1 + wx.redirectTo({ + url: '/pages/confirmInfo/index', }) }, handleVisitors() { app.globalData.anyWhere = true - app.globalData.first = true - app.globalData.loginType = 1 wx.reLaunch({ url: '/pages/index/index', }) }, - handleDoctor() { - wx.reLaunch({ - url: '/doctor/pages/d_login/index', - }) - }, handleLink(e: any) { const { url } = e.currentTarget.dataset wx.navigateTo({ url, }) }, - handleCheck(e: any) { - const { key } = e.currentTarget.dataset - this.setData({ - [key]: !this.data[key], - }) - }, - handleToastCancel() { - this.setData({ - toastShow: false, - toastType: '', - }) - }, }) export {} diff --git a/src/pages/login/index.wxml b/src/pages/login/index.wxml index af0d827..0d89053 100644 --- a/src/pages/login/index.wxml +++ b/src/pages/login/index.wxml @@ -3,7 +3,7 @@ 请先阅读并同意相关协议。立即加入后,我们将为您提供更匹配的科普内容与服务支持。