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. 1
      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 @@ @@ -71,5 +71,5 @@
}
]
},
"appid": "wx71ac9c27c3c3e3f4"
"appid": "wxf9ce8010f1ad24aa"
}

12
src/app.ts

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

53
src/components/popup/index.scss

@ -231,12 +231,63 @@ @@ -231,12 +231,63 @@
height: 88rpx;
line-height: 88rpx;
font-size: 32rpx;
color: #FFFFFF;
color: #ffffff;
background: linear-gradient(197deg, #ffbcf9 0%, #b982ff 100%);
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 {
margin: 48rpx auto 0;
display: block;

3
src/components/popup/index.ts

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

24
src/components/popup/index.wxml

@ -81,6 +81,30 @@ @@ -81,6 +81,30 @@
</view>
<view class="btn" bind:tap="handleOk">知道了</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
wx:if="{{params.close}}"

2
src/pages/home/index.wxml

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

42
src/pages/login/index.ts

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

1
src/pages/login/index.wxml

@ -86,5 +86,6 @@ @@ -86,5 +86,6 @@
type="{{popupType}}"
params="{{popupParams}}"
bind:ok="handlePopupOk"
bind:phone="handleWxSubmit"
bind:cancel="handlePopupCancel"
></popup>

2
src/pages/my/index.wxml

@ -5,7 +5,7 @@ @@ -5,7 +5,7 @@
>
<view class="user">
<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>
<view class="wrap">
<view class="nickname">{{userInfo.Name}}</view>

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

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

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

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

Loading…
Cancel
Save