Browse Source

登录体验优化

dev
kola-web 3 weeks ago
parent
commit
eb0f042730
  1. 2
      project.config.json
  2. 12
      src/app.ts
  3. 53
      src/components/popup/index.scss
  4. 3
      src/components/popup/index.ts
  5. 24
      src/components/popup/index.wxml
  6. 2
      src/pages/home/index.wxml
  7. 42
      src/pages/login/index.ts
  8. 3
      src/pages/login/index.wxml
  9. 2
      src/pages/my/index.wxml
  10. 3
      src/patient/pages/login/index.json
  11. 28
      src/patient/pages/login/index.ts
  12. 13
      src/patient/pages/login/index.wxml

2
project.config.json

@ -71,5 +71,5 @@
} }
] ]
}, },
"appid": "wx71ac9c27c3c3e3f4" "appid": "wxf9ce8010f1ad24aa"
} }

12
src/app.ts

@ -17,15 +17,15 @@ App<IAppOption>({
// 测试号 wx2b0bb13edf717c1d // 测试号 wx2b0bb13edf717c1d
// dev // dev
// appid:wxf9ce8010f1ad24aa // appid:wxf9ce8010f1ad24aa
// url: 'https://m.xd.hbraas.com', url: 'https://m.xd.hbraas.com',
// upFileUrl: 'https://m.xd.hbraas.com/', upFileUrl: 'https://m.xd.hbraas.com/',
// imageUrl: 'https://m.xd.hbraas.com/xd/', imageUrl: 'https://m.xd.hbraas.com/xd/',
// pro // pro
// appid:wx71ac9c27c3c3e3f4 // appid:wx71ac9c27c3c3e3f4
url: 'https://m.xd.hbsaas.com', // url: 'https://m.xd.hbsaas.com',
upFileUrl: 'https://m.xd.hbsaas.com/', // upFileUrl: 'https://m.xd.hbsaas.com/',
imageUrl: 'https://m.xd.hbsaas.com/api/xd/', // imageUrl: 'https://m.xd.hbsaas.com/api/xd/',
loginState: '', loginState: '',
isLogin: 0, isLogin: 0,

53
src/components/popup/index.scss

@ -231,12 +231,63 @@
height: 88rpx; height: 88rpx;
line-height: 88rpx; line-height: 88rpx;
font-size: 32rpx; font-size: 32rpx;
color: #FFFFFF; color: #ffffff;
background: linear-gradient(197deg, #ffbcf9 0%, #b982ff 100%); background: linear-gradient(197deg, #ffbcf9 0%, #b982ff 100%);
border-radius: 100rpx 100rpx 100rpx 100rpx; border-radius: 100rpx 100rpx 100rpx 100rpx;
} }
} }
.popup10,
.popup11 {
padding: 48rpx 50rpx 48rpx;
width: 650rpx;
box-sizing: border-box;
background-color: #fff;
border-radius: 24rpx;
.title {
margin-top: 24rpx;
font-size: 40rpx;
color: #211d2e;
font-weight: bold;
line-height: 56rpx;
text-align: center;
}
.content {
margin-top: 24rpx;
text-align: center;
.link {
font-size: 32rpx;
color: #b982ff;
}
}
.footer {
margin-top: 40rpx;
display: flex;
gap: 30rpx;
.sure,
.cancel {
flex: 1;
padding: 20rpx;
text-align: center;
font-size: 36rpx;
border-radius: 100rpx;
}
.cancel {
padding: 18rpx 0;
color: #b982ff;
border: 1px solid #b982ff;
}
.sure {
padding: 0;
background: linear-gradient(344deg, #ffbcf9 0%, #b982ff 100%);
color: #ffffff;
display: flex;
align-items: center;
justify-content: center;
}
}
}
.close { .close {
margin: 48rpx auto 0; margin: 48rpx auto 0;
display: block; display: block;

3
src/components/popup/index.ts

@ -36,6 +36,9 @@ Component({
handleCancel() { handleCancel() {
this.triggerEvent('cancel') this.triggerEvent('cancel')
}, },
handlePhone(e) {
this.triggerEvent('phone', e.detail)
},
routerTo(e: any) { routerTo(e: any) {
const { url } = e.currentTarget.dataset const { url } = e.currentTarget.dataset
wx.navigateTo({ wx.navigateTo({

24
src/components/popup/index.wxml

@ -81,6 +81,30 @@
</view> </view>
<view class="btn" bind:tap="handleOk">知道了</view> <view class="btn" bind:tap="handleOk">知道了</view>
</view> </view>
<view class="popup10" wx:if="{{type==='popup10'}}">
<view class="title">我已阅读并同意</view>
<view class="content">
<text class="link" bind:tap="routerTo" data-url="/doc/pages/doc2/index?active=1">《用户协议》</text>
<text class="link" bind:tap="routerTo" data-url="/doc/pages/doc2/index">《隐私政策》</text>
<view></view>
<text class="link" bind:tap="routerTo" data-url="/doc/pages/doc2/index?active=2">《个人信息共享知情同意书》</text>
</view>
<view class="footer">
<view class="cancel" bind:tap="handleCancel">取消</view>
<button class="sure" open-type="getPhoneNumber" bindgetphonenumber="handlePhone">确定</button>
</view>
</view>
<view class="popup11" wx:if="{{type==='popup11'}}">
<view class="title">我已阅读并同意</view>
<view class="content">
<text class="link" bind:tap="routerTo" data-url="/doc/pages/doc1/index">《隐私协议保护政策》</text>
</view>
<view class="footer">
<view class="cancel" bind:tap="handleCancel">取消</view>
<view wx:if="{{params.customPhone}}" class="sure" bind:tap="handleOk">确定</view>
<button wx:else class="sure" open-type="getPhoneNumber" bindgetphonenumber="handlePhone">确定</button>
</view>
</view>
<image <image
wx:if="{{params.close}}" wx:if="{{params.close}}"

2
src/pages/home/index.wxml

@ -8,7 +8,7 @@
> >
<view class="user"> <view class="user">
<button class="avatar-wrapper"> <button class="avatar-wrapper">
<image class="avatar" src="{{userInfo.Img}}"></image> <image class="avatar" mode="aspectFill" src="{{userInfo.Img}}"></image>
</button> </button>
<view class="wrap"> <view class="wrap">
<view class="nickname">{{userInfo.welcome}},{{userInfo.Name}}医生</view> <view class="nickname">{{userInfo.welcome}},{{userInfo.Name}}医生</view>

42
src/pages/login/index.ts

@ -5,6 +5,7 @@ Page({
data: { data: {
popupShow: false, popupShow: false,
popupType: 'popup4', // 登录失败弹窗 popupType: 'popup4', // 登录失败弹窗
// popupType: 'popup11', // 隐私协议二级确认弹窗
popupParams: { popupParams: {
close: true, close: true,
} as any, } as any,
@ -28,7 +29,8 @@ Page({
}) })
}, },
getCode() { getCode() {
if (timer) return if (timer)
return
const mobile = this.data.mobile const mobile = this.data.mobile
if (!mobile) { if (!mobile) {
wx.showToast({ wx.showToast({
@ -78,21 +80,24 @@ Page({
check1: !this.data.check1, check1: !this.data.check1,
}) })
}, },
handleDocRule() { handleDocRule(customPhone = false) {
const { check1 } = this.data const { check1 } = this.data
return new Promise((resolve) => { return new Promise((resolve) => {
if (check1) { if (check1) {
return resolve(true) return resolve(true)
} }
wx.showToast({ this.setData({
title: '请同意相关协议', popupShow: true,
icon: 'none', popupType: 'popup11',
popupParams: {
close: false,
customPhone,
},
}) })
}) })
}, },
async handleSubmit() { async handleSubmit() {
app.mpBehavior({ doctor: true, PageName: 'BTN_DoctorLogin' }) app.mpBehavior({ doctor: true, PageName: 'BTN_DoctorLogin' })
await this.handleDocRule()
const { mobile, code } = this.data const { mobile, code } = this.data
if (!mobile) { if (!mobile) {
wx.showToast({ wx.showToast({
@ -108,6 +113,7 @@ Page({
}) })
return return
} }
await this.handleDocRule(true)
wx.ajax({ wx.ajax({
method: 'POST', method: 'POST',
url: '?r=xd/login/reg-login', url: '?r=xd/login/reg-login',
@ -123,7 +129,8 @@ Page({
.catch((err) => { .catch((err) => {
if (err.data.code == 100) { if (err.data.code == 100) {
this.handleShowPopup() this.handleShowPopup()
} else if (err.data.msg) { }
else if (err.data.msg) {
wx.showToast({ wx.showToast({
title: err.data.msg, title: err.data.msg,
icon: 'none', icon: 'none',
@ -138,6 +145,7 @@ Page({
handleWxSubmit(e: WechatMiniprogram.CustomEvent) { handleWxSubmit(e: WechatMiniprogram.CustomEvent) {
app.mpBehavior({ doctor: true, PageName: 'BTN_DoctorQuickLogin' }) app.mpBehavior({ doctor: true, PageName: 'BTN_DoctorQuickLogin' })
const { iv, encryptedData } = e.detail const { iv, encryptedData } = e.detail
this.handlePopupCancel()
if (iv && encryptedData) { if (iv && encryptedData) {
wx.ajax({ wx.ajax({
method: 'POST', method: 'POST',
@ -154,7 +162,8 @@ Page({
.catch((err) => { .catch((err) => {
if (err.data.code == 100) { if (err.data.code == 100) {
this.handleShowPopup() this.handleShowPopup()
} else if (err.data.msg) { }
else if (err.data.msg) {
wx.showToast({ wx.showToast({
title: err.data.msg, title: err.data.msg,
icon: 'none', icon: 'none',
@ -170,10 +179,12 @@ Page({
wx.reLaunch({ wx.reLaunch({
url: '/pages/home/index', url: '/pages/home/index',
}) })
} else { }
else {
this.handleShowPopup() this.handleShowPopup()
} }
} else { }
else {
this.handleShowPopup() this.handleShowPopup()
} }
}) })
@ -210,6 +221,17 @@ Page({
url: '/doc/pages/doc1/index', url: '/doc/pages/doc1/index',
}) })
}, },
handlePopupOk() {
const { popupType } = this.data
if (popupType == 'popup11') {
this.setData({
check1: true,
popupShow: false,
})
this.handleSubmit()
this.handlePopupCancel()
}
},
handlePopupCancel() { handlePopupCancel() {
this.setData({ this.setData({
popupShow: false, popupShow: false,

3
src/pages/login/index.wxml

@ -1,5 +1,5 @@
<navbar wx:if="{{back==='1'}}" fixed title="" custom-style="background:{{background}}" z-index="10"> <navbar wx:if="{{back==='1'}}" fixed title="" custom-style="background:{{background}}" z-index="10">
<van-icon name="arrow-left" slot="left" size="18px" color="#000" bind:tap="handleBack" /> <van-icon name="arrow-left" slot="left" size="18px" color="#000" bind:tap="handleBack" />
</navbar> </navbar>
<view <view
@ -86,5 +86,6 @@
type="{{popupType}}" type="{{popupType}}"
params="{{popupParams}}" params="{{popupParams}}"
bind:ok="handlePopupOk" bind:ok="handlePopupOk"
bind:phone="handleWxSubmit"
bind:cancel="handlePopupCancel" bind:cancel="handlePopupCancel"
></popup> ></popup>

2
src/pages/my/index.wxml

@ -5,7 +5,7 @@
> >
<view class="user"> <view class="user">
<button class="avatar-wrapper" open-type="chooseAvatar" bind:chooseavatar="onChooseAvatar"> <button class="avatar-wrapper" open-type="chooseAvatar" bind:chooseavatar="onChooseAvatar">
<image class="avatar" src="{{userInfo.Img}}"></image> <image class="avatar" mode="aspectFill" src="{{userInfo.Img}}"></image>
</button> </button>
<view class="wrap"> <view class="wrap">
<view class="nickname">{{userInfo.Name}}</view> <view class="nickname">{{userInfo.Name}}</view>

3
src/patient/pages/login/index.json

@ -2,6 +2,7 @@
"navigationStyle": "custom", "navigationStyle": "custom",
"usingComponents": { "usingComponents": {
"van-icon": "@vant/weapp/icon/index", "van-icon": "@vant/weapp/icon/index",
"van-divider": "@vant/weapp/divider/index" "van-divider": "@vant/weapp/divider/index",
"popup": "/components/popup/index"
} }
} }

28
src/patient/pages/login/index.ts

@ -3,6 +3,12 @@ let timer = null as null | number
Page({ Page({
data: { data: {
popupShow: false,
popupType: 'popup10', // 隐私协议二级确认弹窗
popupParams: {
close: true,
} as any,
mobile: '', mobile: '',
code: '', code: '',
@ -21,7 +27,8 @@ Page({
}) })
}, },
getCode() { getCode() {
if (timer) return if (timer)
return
const mobile = this.data.mobile const mobile = this.data.mobile
if (!mobile) { if (!mobile) {
wx.showToast({ wx.showToast({
@ -83,9 +90,11 @@ Page({
}) })
}, },
handleWxSubmit(e: WechatMiniprogram.CustomEvent) { handleWxSubmit(e: WechatMiniprogram.CustomEvent) {
console.log("DEBUGPRINT[171]: index.ts:92: e=", e)
app.mpBehavior({ PageName: 'BTN_PatientQuickLogin' }) app.mpBehavior({ PageName: 'BTN_PatientQuickLogin' })
const { iv, encryptedData } = e.detail const { iv, encryptedData } = e.detail
const { registrationSource, registChannel, regBusinessId } = app.globalData const { registrationSource, registChannel, regBusinessId } = app.globalData
this.handlePopupCancel()
if (iv && encryptedData) { if (iv && encryptedData) {
wx.ajax({ wx.ajax({
method: 'POST', method: 'POST',
@ -104,16 +113,19 @@ Page({
}, },
handleWxCheck() { handleWxCheck() {
app.mpBehavior({ PageName: 'BTN_PatientQuickLogin' }) app.mpBehavior({ PageName: 'BTN_PatientQuickLogin' })
wx.showToast({ this.setData({
icon: 'none', popupShow: true,
title: '请先同意隐私政策', popupType: 'popup10',
popupParams: {
close: false,
},
}) })
}, },
submitCallback() { submitCallback() {
app.globalData.loginType = 1 app.globalData.loginType = 1
app.globalData.isLogin = 1 app.globalData.isLogin = 1
app.updateLoginInfo((res) => { app.updateLoginInfo((res) => {
const { loginType, isNewReg, isLogin } = res const { isNewReg } = res
const backPage = app.globalData.backPage const backPage = app.globalData.backPage
let url = backPage || '/patient/pages/index/index' let url = backPage || '/patient/pages/index/index'
if (isNewReg === 0) { if (isNewReg === 0) {
@ -152,6 +164,12 @@ Page({
[key]: !this.data[key], [key]: !this.data[key],
}) })
}, },
handlePopupOk() {},
handlePopupCancel() {
this.setData({
popupShow: false,
})
},
}) })
export {} export {}

13
src/patient/pages/login/index.wxml

@ -53,7 +53,9 @@
<view class="a-content"> <view class="a-content">
我同意依照 我同意依照
<text class="link" bind:tap="handleLink" data-url="/doc/pages/doc2/index">《隐私政策》</text> <text class="link" bind:tap="handleLink" data-url="/doc/pages/doc2/index">《隐私政策》</text>
<text class="link" bind:tap="handleLink" data-url="/doc/pages/doc2/index?active=2">《个人信息共享知情同意书》</text> <text class="link" bind:tap="handleLink" data-url="/doc/pages/doc2/index?active=2">
《个人信息共享知情同意书》
</text>
规定收集和共享我的个人敏感信息 规定收集和共享我的个人敏感信息
</view> </view>
</view> </view>
@ -73,3 +75,12 @@
</view> </view>
</view> </view>
</view> </view>
<popup
show="{{popupShow}}"
type="{{popupType}}"
params="{{popupParams}}"
bind:ok="handlePopupOk"
bind:phone="handleWxSubmit"
bind:cancel="handlePopupCancel"
></popup>

Loading…
Cancel
Save