Browse Source

stash

master
kola-web 5 days ago
parent
commit
3da20be625
  1. 2
      README.md
  2. 4
      api-doc/PSVT协议模块接口文档.md
  3. 70
      api-doc/psvt-patient-api-doc.md
  4. 50
      src/app.ts
  5. 109
      src/pages/confirmInfo/index.ts
  6. 126
      src/pages/confirmInfo/index.wxml
  7. 2
      src/pages/login/index.scss
  8. 160
      src/pages/login/index.ts
  9. 4
      src/pages/login/index.wxml

2
README.md

@ -2,7 +2,7 @@
<!--图片文件夹svn地址--> <!--图片文件夹svn地址-->
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 ### vscode

4
api-doc/PSVT协议模块接口文档.md

@ -136,7 +136,7 @@ data为数组类型,每个元素字段同"按类型获取协议详情"接口
### 1. 获取协议列表 ### 1. 获取协议列表
- **路由**: `?r=psvtw/agreement/get-list` - **路由**: `?r=agreement/get-list`
- **请求方式**: GET - **请求方式**: GET
- **是否需要登录**: 是 - **是否需要登录**: 是
@ -207,7 +207,7 @@ data为数组类型,每个元素字段同"按类型获取协议详情"接口
### 2. 更新协议文案 ### 2. 更新协议文案
- **路由**: `?r=psvtw/agreement/update` - **路由**: `?r=agreement/update`
- **请求方式**: POST - **请求方式**: POST
- **是否需要登录**: 是 - **是否需要登录**: 是
- **事务**: 是 - **事务**: 是

70
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, "channelId": 1,
"channelName": "渠道A", "channelName": "渠道A",
"channelDesc": "渠道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。 **说明**: 根据渠道ID获取或生成小程序码图片URL。
@ -667,7 +704,7 @@
--- ---
### 2.7 渠道码统计 `GET ?r=channel/stat` ### 2.8 渠道码统计 `GET ?r=channel/stat`
**说明**: 根据日期范围和渠道ID获取渠道统计数据,从统计表获取。 **说明**: 根据日期范围和渠道ID获取渠道统计数据,从统计表获取。
@ -689,6 +726,7 @@
"statDate": "2023-01-01", "statDate": "2023-01-01",
"channelId": 1, "channelId": 1,
"channelName": "渠道A", "channelName": "渠道A",
"channelDesc": "渠道A说明",
"openPatientCount": 100, "openPatientCount": 100,
"phoneRegisteredCount": 80, "phoneRegisteredCount": 80,
"infoSubmittedCount": 50, "infoSubmittedCount": 50,
@ -705,6 +743,7 @@
| statDate | string | 统计日期 | | statDate | string | 统计日期 |
| channelId | int | 渠道ID | | channelId | int | 渠道ID |
| channelName | string | 渠道名称 | | channelName | string | 渠道名称 |
| channelDesc | string | 渠道码说明 |
| openPatientCount | int | 邀约打开患者数 | | openPatientCount | int | 邀约打开患者数 |
| phoneRegisteredCount | int | 邀约注册手机号患者数 | | phoneRegisteredCount | int | 邀约注册手机号患者数 |
| infoSubmittedCount | 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获取用户属性和患者属性,不冗余存储。 **说明**: 获取渠道邀约的原始记录列表,支持分页。通过JOIN t_psvt_user_info和t_psvt_patient_info获取用户属性和患者属性,不冗余存储。
@ -740,32 +779,27 @@
{ {
"id": 1, "id": 1,
"inviteTime": "2023-01-01 10:00:00", "inviteTime": "2023-01-01 10:00:00",
"inviteDate": "2023-01-01",
"channelId": 1, "channelId": 1,
"channelName": "渠道A", "channelName": "渠道A",
"channelDesc": "渠道A说明",
"inviteType": 1, "inviteType": 1,
"inviteTypeName": "用户打开",
"userId": "xxx", "userId": "xxx",
"patientId": 5, "patientId": 5,
"nickName": "abcd12345678", "nickName": "abcd12345678",
"gender": 1, "gender": 1,
"genderName": "男",
"ageRange": 1, "ageRange": 1,
"ageRangeName": "18-24岁",
"provinceName": "北京", "provinceName": "北京",
"cityName": "北京", "cityName": "北京",
"diagnosisStatus": 2, "diagnosisStatus": 2,
"diagnosisStatusName": "确诊",
"diagnosisTime": "2023-06", "diagnosisTime": "2023-06",
"surgeryStatus": 1, "surgeryStatus": 1,
"surgeryStatusName": "已手术",
"telephone": "138xxxx1234", "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`
**说明**: 返回性别、年龄段、确诊状态、手术状态等枚举数据,供后台管理端渲染下拉选项。 **说明**: 返回性别、年龄段、确诊状态、手术状态等枚举数据,供后台管理端渲染下拉选项。

50
src/app.ts

@ -69,11 +69,13 @@ App<IAppOption>({
startLogin(callback?: () => void) { startLogin(callback?: () => void) {
wx.login({ wx.login({
success: (res) => { success: (res) => {
const channelId = this.globalData.scene?.channelId || ''
wx.ajax({ wx.ajax({
method: 'GET', method: 'GET',
url: '?r=psvt/user/init-login', url: '?r=psvt/user/init-login',
data: { data: {
code: res.code, code: res.code,
channelId,
}, },
}).then((res) => { }).then((res) => {
this.globalData.loginState = res.loginState this.globalData.loginState = res.loginState
@ -85,18 +87,6 @@ App<IAppOption>({
}, },
}) })
}, },
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' }) { waitLogin({ type = 0 } = { type: 'any' }) {
return new Promise((resolve) => { return new Promise((resolve) => {
const checkLogin = () => { const checkLogin = () => {
@ -113,41 +103,23 @@ App<IAppOption>({
checkLogin() checkLogin()
}) })
}, },
checkLoginType(type: 0 | 1 | 2 | 'any') { checkLoginType(type = 'any') {
const { loginType, isLogin, isReg } = this.globalData.initLoginInfo const { isPhoneRegistered, isInfoSubmitted } = this.globalData.initLoginInfo
if (type === 'any') { if (type === 'any') {
return true return true
} }
if (isLogin !== 1) { if (!isPhoneRegistered) {
if (type === 0) {
return true
}
wx.reLaunch({ wx.reLaunch({
url: '/pages/index/index', url: '/pages/login/index',
}) })
return false return false
} }
if (isReg !== 1) { if (!isInfoSubmitted) {
const typePageUrl = {
1: '/patient/pages/entryInfo/index',
2: '/doctor/pages/login/index',
}[loginType as 1 | 2]
wx.reLaunch({ wx.reLaunch({
url: typePageUrl, url: '/pages/confirmInfo/index',
})
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 return false
} }
@ -155,11 +127,7 @@ App<IAppOption>({
return true return true
}, },
mpBehavior(data: { PageName: string }) { mpBehavior(data: { PageName: string }) {
const { loginType } = this.globalData.initLoginInfo const url = '?r=wtx/mp-behavior/add'
const url = {
1: '?r=wtx/mp-behavior/add',
2: '?r=wtx/doctor/mp-behavior/add',
}[loginType as 1 | 2]
wx.ajax({ wx.ajax({
method: 'POST', method: 'POST',
url, url,

109
src/pages/confirmInfo/index.ts

@ -1,14 +1,121 @@
const _app = getApp<IAppOption>() const app = getApp<IAppOption>()
Page({ Page({
data: { data: {
menuTop: 0, menuTop: 0,
step: 1, 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() { onLoad() {
const menuRes = wx.getMenuButtonBoundingClientRect() const menuRes = wx.getMenuButtonBoundingClientRect()
const now = new Date()
const currentMonth = `${now.getFullYear()}-${String(now.getMonth() + 1).padStart(2, '0')}`
this.setData({ this.setData({
menuTop: menuRes.top, 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<string, any> = {
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',
})
}
}) })
}, },
}) })

126
src/pages/confirmInfo/index.wxml

@ -6,7 +6,7 @@
<view class="page-header"> <view class="page-header">
<view class="item {{step==1 &&'active'}}"> <view class="item {{step==1 &&'active'}}">
<view class="order" wx:if="{{step===1}}">1</view> <view class="order" wx:if="{{step===1}}">1</view>
<view class="order" wx:else><image class="icon" src="/images/icon3.png">1</image></view> <view class="order" wx:else><image class="icon" src="/images/icon3.png"></image></view>
<view class="name">基础信息</view> <view class="name">基础信息</view>
</view> </view>
<view class="line {{step>1 &&'active'}}"></view> <view class="line {{step>1 &&'active'}}"></view>
@ -19,24 +19,56 @@
<image class="icon" src="/images/icon4.png"></image> <image class="icon" src="/images/icon4.png"></image>
<view class="content">这些信息将用于优化内容推荐与服务提醒,不作为诊断或 治疗建议依据。</view> <view class="content">这些信息将用于优化内容推荐与服务提醒,不作为诊断或 治疗建议依据。</view>
</view> </view>
<view class="step1">
<!-- Step 1: 基础信息 -->
<view class="step1" wx:if="{{step===1}}">
<view class="row"> <view class="row">
<view class="row-title">我的年龄段</view> <view class="row-title">我的年龄段</view>
<view class="select1"> <view class="select1">
<view class="s-item active">18-28岁</view> <view
<view class="s-item">18-28岁</view> class="s-item {{ageRange===1 && 'active'}}"
<view class="s-item">18-28岁</view> bind:tap="handleSelect"
<view class="s-item">18-28岁</view> data-key="ageRange"
data-value="1"
>18-28岁</view>
<view
class="s-item {{ageRange===2 && 'active'}}"
bind:tap="handleSelect"
data-key="ageRange"
data-value="2"
>29-40岁</view>
<view
class="s-item {{ageRange===3 && 'active'}}"
bind:tap="handleSelect"
data-key="ageRange"
data-value="3"
>41-50岁</view>
<view
class="s-item {{ageRange===4 && 'active'}}"
bind:tap="handleSelect"
data-key="ageRange"
data-value="4"
>50岁以上</view>
</view> </view>
</view> </view>
<view class="row"> <view class="row">
<view class="row-title">我的性别</view> <view class="row-title">我的性别</view>
<view class="select2"> <view class="select2">
<view class="s-item active1"> <view
class="s-item {{gender===1 && 'active1'}}"
bind:tap="handleSelect"
data-key="gender"
data-value="1"
>
<image class="icon" src="/images/icon5.png"></image> <image class="icon" src="/images/icon5.png"></image>
</view> </view>
<view class="s-item active2"> <view
class="s-item {{gender===2 && 'active2'}}"
bind:tap="handleSelect"
data-key="gender"
data-value="2"
>
<image class="icon" src="/images/icon6.png"></image> <image class="icon" src="/images/icon6.png"></image>
</view> </view>
@ -45,35 +77,64 @@
<view class="row"> <view class="row">
<view class="row-title">所在地区</view> <view class="row-title">所在地区</view>
<view class="select3"> <view class="select3">
<picker mode="region"> <picker mode="region" bindchange="handleRegionChange">
<view class="picker-content"> <view class="picker-content">
<view class="content" data-place="请选择所在地区"></view> <view class="content" data-place="请选择所在地区">{{regionText || ''}}</view>
<image class="icon" src="/images/icon7.png"></image> <image class="icon" src="/images/icon7.png"></image>
</view> </view>
</picker> </picker>
</view> </view>
</view> </view>
</view> </view>
<view class="step2">
<!-- Step 2: PSVT情况 -->
<view class="step2" wx:if="{{step===2}}">
<view class="row"> <view class="row">
<view class="row-title">我的年龄段</view> <view class="row-title">确诊状态</view>
<view class="select4"> <view class="select4">
<view class="s-item active"> <view
class="s-item {{diagnosisStatus===1 && 'active'}}"
bind:tap="handleSelect"
data-key="diagnosisStatus"
data-value="1"
>
<view class="title">疑似PSVT</view> <view class="title">疑似PSVT</view>
<view class="content">正在了解中</view> <view class="content">正在了解中</view>
</view> </view>
<view class="s-item"> <view
<view class="title">疑似PSVT</view> class="s-item {{diagnosisStatus===2 && 'active'}}"
<view class="content">正在了解中</view> bind:tap="handleSelect"
data-key="diagnosisStatus"
data-value="2"
>
<view class="title">已确诊PSVT</view>
</view>
<view
class="s-item {{diagnosisStatus===3 && 'active'}}"
bind:tap="handleSelect"
data-key="diagnosisStatus"
data-value="3"
>
<view class="title">心悸/心跳过快</view>
<view class="content">尚未就诊</view>
</view>
<view
class="s-item {{diagnosisStatus===4 && 'active'}}"
bind:tap="handleSelect"
data-key="diagnosisStatus"
data-value="4"
>
<view class="title">亲友相关</view>
<view class="content">想了解更多</view>
</view> </view>
</view> </view>
</view> </view>
<view class="row"> <view class="row" wx:if="{{diagnosisStatus===2}}">
<view class="row-title">确诊时间</view> <view class="row-title">确诊时间</view>
<view class="select3"> <view class="select3">
<picker mode="date"> <picker mode="date" fields="month" bindchange="handleDiagnosisTimeChange" end="{{currentMonth}}">
<view class="picker-content"> <view class="picker-content">
<view class="content" data-place="选择日期"></view> <view class="content" data-place="选择确诊时间">{{diagnosisTime || ''}}</view>
<image class="icon" src="/images/icon7.png"></image> <image class="icon" src="/images/icon7.png"></image>
</view> </view>
</picker> </picker>
@ -82,13 +143,28 @@
<view class="row"> <view class="row">
<view class="row-title">是否接受过相关手术治疗</view> <view class="row-title">是否接受过相关手术治疗</view>
<view class="select4"> <view class="select4">
<view class="s-item active"> <view
class="s-item {{surgeryStatus===1 && 'active'}}"
bind:tap="handleSelect"
data-key="surgeryStatus"
data-value="1"
>
<view class="title">已接受射频消融 /相关手术</view> <view class="title">已接受射频消融 /相关手术</view>
</view> </view>
<view class="s-item"> <view
class="s-item {{surgeryStatus===2 && 'active'}}"
bind:tap="handleSelect"
data-key="surgeryStatus"
data-value="2"
>
<view class="title">尚未接受手术</view> <view class="title">尚未接受手术</view>
</view> </view>
<view class="s-item"> <view
class="s-item {{surgeryStatus===3 && 'active'}}"
bind:tap="handleSelect"
data-key="surgeryStatus"
data-value="3"
>
<view class="title">正在评估</view> <view class="title">正在评估</view>
</view> </view>
</view> </view>
@ -96,10 +172,10 @@
</view> </view>
<view class="page-footer"> <view class="page-footer">
<view class="next" wx:if="{{step==1}}">下一步</view> <view class="next" wx:if="{{step===1}}" bind:tap="handleNext">下一步</view>
<block wx:else> <block wx:else>
<view class="prev">上一步</view> <view class="prev" bind:tap="handlePrev">上一步</view>
<view class="submit">立即加入</view> <view class="next" bind:tap="handleSubmit">立即加入</view>
</block> </block>
</view> </view>
</view> </view>

2
src/pages/login/index.scss

@ -25,7 +25,7 @@
height: 96rpx; height: 96rpx;
line-height: 96rpx; line-height: 96rpx;
text-align: center; text-align: center;
font-size: 36rpx; font-size: 32rpx;
color: #ffffff; color: #ffffff;
background: linear-gradient(270deg, #439fc7 0%, #2f82a9 100%); background: linear-gradient(270deg, #439fc7 0%, #2f82a9 100%);
border-radius: 24rpx 24rpx 24rpx 24rpx; border-radius: 24rpx 24rpx 24rpx 24rpx;

160
src/pages/login/index.ts

@ -1,191 +1,63 @@
const app = getApp<IAppOption>() const app = getApp<IAppOption>()
let timer = null as null | number
Page({ Page({
data: { data: {
menuTop: 0, menuTop: 0,
mobile: '', checked: false,
code: '',
check1: false,
check2: false,
codeText: '发送验证码',
page: '',
toastShow: false,
toastType: '',
toastParams: {} as any,
}, },
onLoad(options) { onLoad(_options) {
const menuRes = wx.getMenuButtonBoundingClientRect() const menuRes = wx.getMenuButtonBoundingClientRect()
this.setData({ this.setData({
menuTop: menuRes.top, menuTop: menuRes.top,
}) })
app.waitLogin({ type: 'any' }).then(() => {})
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)
})
}, },
handleSubmit() { handleCheck() {
const { mobile, code } = this.data this.setData({
const { registrationSource, registChannel, regBusinessId } = app.globalData checked: !this.data.checked,
wx.ajax({
method: 'POST',
url: '?r=igg4/login/reg-login',
data: {
mobile,
code,
registrationSource,
registChannel,
regBusinessId,
},
}).then((_res) => {
this.submitCallback()
}) })
}, },
handleWxSubmit(e: WechatMiniprogram.CustomEvent) { handleWxSubmit(e: WechatMiniprogram.CustomEvent) {
const { iv, encryptedData } = e.detail const { iv, encryptedData } = e.detail
const { registrationSource, registChannel, regBusinessId } = app.globalData
if (iv && encryptedData) { if (iv && encryptedData) {
const channelId = app.globalData.scene?.channelId || ''
wx.ajax({ wx.ajax({
method: 'POST', method: 'POST',
url: '?r=igg4/login/wx-reg-login', url: '?r=psvt/patient/phone-register',
data: { data: {
iv: encodeURIComponent(iv), iv: encodeURIComponent(iv),
encryptedData: encodeURIComponent(encryptedData), encryptedData: encodeURIComponent(encryptedData),
registrationSource, channelId,
registChannel,
regBusinessId,
}, },
}).then((_res) => { }).then(() => {
this.submitCallback() this.submitCallback()
}) })
} }
}, },
handleWxCheck() { handleWxCheck() {
this.setData({ wx.showToast({
toastShow: true, title: '请先阅读并同意相关协议',
toastType: 'popup11', icon: 'none',
toastParams: { isDoctor: false },
}) })
}, },
submitCallback() { submitCallback() {
app.globalData.loginType = 1 app.globalData.initLoginInfo.isReg = 1
app.globalData.isLogin = true wx.redirectTo({
app.getUserInfo(this, true, (userInfo) => { url: '/pages/confirmInfo/index',
// 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,
})
}
}) })
}, },
handleVisitors() { handleVisitors() {
app.globalData.anyWhere = true app.globalData.anyWhere = true
app.globalData.first = true
app.globalData.loginType = 1
wx.reLaunch({ wx.reLaunch({
url: '/pages/index/index', url: '/pages/index/index',
}) })
}, },
handleDoctor() {
wx.reLaunch({
url: '/doctor/pages/d_login/index',
})
},
handleLink(e: any) { handleLink(e: any) {
const { url } = e.currentTarget.dataset const { url } = e.currentTarget.dataset
wx.navigateTo({ wx.navigateTo({
url, url,
}) })
}, },
handleCheck(e: any) {
const { key } = e.currentTarget.dataset
this.setData({
[key]: !this.data[key],
})
},
handleToastCancel() {
this.setData({
toastShow: false,
toastType: '',
})
},
}) })
export {} export {}

4
src/pages/login/index.wxml

@ -3,7 +3,7 @@
<view class="container"> <view class="container">
<view class="tip">请先阅读并同意相关协议。立即加入后,我们将为您提供更匹配的科普内容与服务支持。</view> <view class="tip">请先阅读并同意相关协议。立即加入后,我们将为您提供更匹配的科普内容与服务支持。</view>
<button <button
wx:if="{{check1 && check2}}" wx:if="{{checked}}"
class="phone-btn" class="phone-btn"
open-type="getPhoneNumber" open-type="getPhoneNumber"
bindgetphonenumber="handleWxSubmit" bindgetphonenumber="handleWxSubmit"
@ -18,7 +18,7 @@
<view class="switch">或输入手机号</view> <view class="switch">或输入手机号</view>
<view class="argument"> <view class="argument">
<view class="a-col"> <view class="a-col">
<checkbox class="check"> <checkbox class="check" checked="{{checked}}" bind:tap="handleCheck">
<view class="check-content"> <view class="check-content">
我已阅读并同意 我已阅读并同意
<view class="link" bind:tap="handleLink" data-url="/doc/pages/privacyAgreement/index?active=1"> <view class="link" bind:tap="handleLink" data-url="/doc/pages/privacyAgreement/index?active=1">

Loading…
Cancel
Save