Browse Source

fix: 修复多项体验问题并优化部分页面细节

1. 修复多个页面定时器未清理的内存泄漏问题
2. 调整就诊相关页面标题、文案与样式细节
3. 优化问诊表单输入与音频播放逻辑
4. 完善弹窗与选择器组件的适配逻辑
master
kola-web 3 weeks ago
parent
commit
a4173dc213
  1. 9
      src/components/freeAudio/index.js
  2. 8
      src/components/pickerArea/index.ts
  3. 3
      src/components/toast/index.wxml
  4. 14
      src/doctor/pages/d_changeDoctor/index.ts
  5. 11
      src/doctor/pages/d_changePhone/index.ts
  6. 11
      src/doctor/pages/d_login/index.ts
  7. 14
      src/pages/changePhone/index.ts
  8. 14
      src/pages/changeUser/index.ts
  9. 2
      src/pages/doctor/index.json
  10. 1
      src/pages/doctorDetail/index.scss
  11. 9
      src/pages/hospital/index.scss
  12. 2
      src/pages/hospital/index.wxml
  13. 11
      src/pages/login/index.ts
  14. 18
      src/pages/qaForm/index.scss
  15. 30
      src/pages/qaForm/index.wxml
  16. 2
      src/pages/qaFormDetail/index.wxml

9
src/components/freeAudio/index.js

@ -66,11 +66,16 @@ Component({
}, },
}, },
pageLifetimes: { pageLifetimes: {
// 组件所在页面的生命周期函数 show: function () {
show: function () {}, if (this.data._pausedByHide && this.audioContext) {
this.data._pausedByHide = false
this.audioContext.play()
}
},
hide: function () { hide: function () {
const { play } = this.data const { play } = this.data
if (play) { if (play) {
this.data._pausedByHide = true
this.audioContext.pause() this.audioContext.pause()
} }
}, },

8
src/components/pickerArea/index.ts

@ -238,7 +238,7 @@ Component({
}, },
getArea() { getArea() {
if (this.data.area.length) { if (this.data.area.length) {
this.getRangeList() this.getRangeList(0)
return return
} }
wx.ajax({ wx.ajax({
@ -249,7 +249,7 @@ Component({
this.setData({ this.setData({
area: res, area: res,
}) })
this.getRangeList() this.getRangeList(0)
}) })
}, },
handleItem(e: any) { handleItem(e: any) {
@ -287,13 +287,13 @@ Component({
scrollIntoView0: id, scrollIntoView0: id,
}) })
}, },
getRangeList() { getRangeList(active = 1) {
const { area, ProvinceId } = this.data const { area, ProvinceId } = this.data
if (!ProvinceId) return if (!ProvinceId) return
const range = area.filter((item: any) => item.value == ProvinceId)[0].children const range = area.filter((item: any) => item.value == ProvinceId)[0].children
this.setData({ this.setData({
range, range,
active: 1, active,
scrollIntoView0: '', scrollIntoView0: '',
scrollIntoView1: `id${this.data.CityId}`, scrollIntoView1: `id${this.data.CityId}`,
}) })

3
src/components/toast/index.wxml

@ -918,7 +918,8 @@
</view> </view>
<view class="footer"> <view class="footer">
<view class="cancel" bind:tap="handleCancel">取消</view> <view class="cancel" bind:tap="handleCancel">取消</view>
<button class="sure" open-type="getPhoneNumber" bindgetphonenumber="handlePhone">确定</button> <button wx:if="{{params.customPhone}}" class="sure" bind:tap="handleOk">确定</button>
<button wx:else class="sure" open-type="getPhoneNumber" bindgetphonenumber="handlePhone">确定</button>
</view> </view>
</view> </view>
<view class="popup12" wx:if="{{type==='popup12'}}"> <view class="popup12" wx:if="{{type==='popup12'}}">

14
src/doctor/pages/d_changeDoctor/index.ts

@ -8,7 +8,19 @@ Page({
codeText: '发送验证码', codeText: '发送验证码',
check: false, check: false,
}, },
onLoad() {}, onLoad() {
if (timer) {
clearInterval(timer)
timer = null
this.setData({ codeText: '发送验证码' })
}
},
onUnload() {
if (timer) {
clearInterval(timer)
timer = null
}
},
getCode() { getCode() {
if (timer) return if (timer) return
const mobile = this.data.mobile const mobile = this.data.mobile

11
src/doctor/pages/d_changePhone/index.ts

@ -8,10 +8,21 @@ Page({
codeText: '发送验证码', codeText: '发送验证码',
}, },
onLoad() { onLoad() {
if (timer) {
clearInterval(timer)
timer = null
this.setData({ codeText: '发送验证码' })
}
app.waitLogin().then((_res) => { app.waitLogin().then((_res) => {
this.getDetail() this.getDetail()
}) })
}, },
onUnload() {
if (timer) {
clearInterval(timer)
timer = null
}
},
getDetail() { getDetail() {
wx.ajax({ wx.ajax({
method: 'GET', method: 'GET',

11
src/doctor/pages/d_login/index.ts

@ -18,12 +18,23 @@ Page({
check: false, check: false,
}, },
onLoad(option) { onLoad(option) {
if (timer) {
clearInterval(timer)
timer = null
this.setData({ codeText: '发送验证码' })
}
if (option.back) { if (option.back) {
this.setData({ this.setData({
back: true, back: true,
}) })
} }
}, },
onUnload() {
if (timer) {
clearInterval(timer)
timer = null
}
},
getCode() { getCode() {
if (timer) return if (timer) return
const mobile = this.data.mobile const mobile = this.data.mobile

14
src/pages/changePhone/index.ts

@ -8,7 +8,19 @@ Page({
codeText: '发送验证码', codeText: '发送验证码',
}, },
onLoad() {}, onLoad() {
if (timer) {
clearInterval(timer)
timer = null
this.setData({ codeText: '发送验证码' })
}
},
onUnload() {
if (timer) {
clearInterval(timer)
timer = null
}
},
getCode() { getCode() {
if (timer) return if (timer) return
const mobile = this.data.mobile const mobile = this.data.mobile

14
src/pages/changeUser/index.ts

@ -8,7 +8,19 @@ Page({
codeText: "发送验证码", codeText: "发送验证码",
}, },
onLoad() {}, onLoad() {
if (timer) {
clearInterval(timer)
timer = null
this.setData({ codeText: '发送验证码' })
}
},
onUnload() {
if (timer) {
clearInterval(timer)
timer = null
}
},
getCode() { getCode() {
if (timer) return; if (timer) return;
const mobile = this.data.mobile; const mobile = this.data.mobile;

2
src/pages/doctor/index.json

@ -1,5 +1,5 @@
{ {
"navigationBarTitleText": "寻找一个专家", "navigationBarTitleText": "就诊地图",
"usingComponents": { "usingComponents": {
"navBar": "/components/navBar/navBar", "navBar": "/components/navBar/navBar",
"van-icon": "@vant/weapp/icon/index", "van-icon": "@vant/weapp/icon/index",

1
src/pages/doctorDetail/index.scss

@ -31,6 +31,7 @@ page {
line-height: 1; line-height: 1;
display: flex; display: flex;
align-items: baseline; align-items: baseline;
flex-wrap: wrap;
gap: 20rpx; gap: 20rpx;
.label { .label {
font-weight: normal; font-weight: normal;

9
src/pages/hospital/index.scss

@ -52,14 +52,15 @@ page {
padding-bottom: 32rpx; padding-bottom: 32rpx;
} }
.content { .content {
margin-top: 28rpx;
.row { .row {
margin-top: 28rpx;
display: flex; display: flex;
align-items: flex-start;
font-size: 32rpx; font-size: 32rpx;
color: #222222; color: #222222;
line-height: 48rpx; line-height: 48rpx;
.icon { .icon {
margin-top: 10rpx; margin-top: 6rpx;
flex-shrink: 0; flex-shrink: 0;
width: 36rpx; width: 36rpx;
height: 36rpx; height: 36rpx;
@ -200,6 +201,7 @@ page {
display: flex; display: flex;
align-items: center; align-items: center;
justify-content: center; justify-content: center;
font-size: 40rpx;
gap: 16rpx; gap: 16rpx;
border: 1px solid #0eb66d; border: 1px solid #0eb66d;
border-radius: 16rpx; border-radius: 16rpx;
@ -216,6 +218,7 @@ page {
display: flex; display: flex;
align-items: center; align-items: center;
justify-content: center; justify-content: center;
gap: 16rpx;
border-radius: 16rpx; border-radius: 16rpx;
background: linear-gradient(94deg, #0eb66d 0%, #00d277 100%); background: linear-gradient(94deg, #0eb66d 0%, #00d277 100%);
.icon { .icon {
@ -251,7 +254,7 @@ page {
.site { .site {
background: linear-gradient(270deg, #b384f4 0%, #5956e9 100%); background: linear-gradient(270deg, #b384f4 0%, #5956e9 100%);
} }
.week-name{ .week-name {
background-color: rgba(245, 244, 255, 1); background-color: rgba(245, 244, 255, 1);
} }
} }

2
src/pages/hospital/index.wxml

@ -25,7 +25,7 @@
</view> </view>
<view class="module"> <view class="module">
<view class="module-container"> <view class="module-container">
<view class="m-title">诊医生</view> <view class="m-title">诊医生</view>
<view <view
class="new-card" class="new-card"
wx:for="{{detail.doctors}}" wx:for="{{detail.doctors}}"

11
src/pages/login/index.ts

@ -17,12 +17,23 @@ Page({
toastParams: {} as any, toastParams: {} as any,
}, },
onLoad(options: any) { onLoad(options: any) {
if (timer) {
clearInterval(timer)
timer = null
this.setData({ codeText: '发送验证码' })
}
this.setData({ this.setData({
page: options.page, page: options.page,
}) })
app.waitLogin({ isReg: false, loginPage: true }).then(() => { app.waitLogin({ isReg: false, loginPage: true }).then(() => {
}) })
}, },
onUnload() {
if (timer) {
clearInterval(timer)
timer = null
}
},
getCode() { getCode() {
if (timer) return if (timer) return
const mobile = this.data.mobile const mobile = this.data.mobile

18
src/pages/qaForm/index.scss

@ -41,7 +41,7 @@ page {
} }
.content { .content {
font-size: 36rpx; font-size: 36rpx;
color: rgba(34, 34, 34, 0.70); color: rgba(34, 34, 34, 0.7);
} }
&.active { &.active {
.radio { .radio {
@ -98,7 +98,7 @@ page {
} }
.content { .content {
font-size: 36rpx; font-size: 36rpx;
color: rgba(34, 34, 34, 0.70); color: rgba(34, 34, 34, 0.7);
} }
&.active { &.active {
.check { .check {
@ -147,6 +147,20 @@ page {
font-size: 32rpx; font-size: 32rpx;
color: rgba(34, 34, 34, 1); color: rgba(34, 34, 34, 1);
} }
.num-wrap {
margin-top: 32rpx;
display: flex;
align-items: center;
gap: 10rpx;
.input {
flex: 1;
margin-top: 0;
}
.dight {
font-size: 32rpx;
color: rgba(34, 34, 34, 0.7);
}
}
.input { .input {
margin-top: 32rpx; margin-top: 32rpx;
padding: 26rpx 32rpx; padding: 26rpx 32rpx;

30
src/pages/qaForm/index.wxml

@ -72,39 +72,31 @@
</view> </view>
</picker> </picker>
<!-- 文本 QuestionType=4 --> <!-- 数字 QuestionType=4 -->
<textarea <view class="num-wrap" wx:if="{{item.QuestionType === 4}}">
wx:if="{{item.QuestionType === 4}}" <input
class="textarea" class="input"
type="digit"
placeholder-class="place-input" placeholder-class="place-input"
placeholder="请输入" placeholder="请输入数字"
value="{{item.TextValue}}" value="{{item.TextValue}}"
bindinput="handleTextInput" bindinput="handleTextInput"
data-index="{{qIndex}}" data-index="{{qIndex}}"
maxlength="500" maxlength="500"
auto-height auto-height
></textarea> />
<view class="dight">mg/天</view>
</view>
<!-- 图片 QuestionType=5 --> <!-- 图片 QuestionType=5 -->
<view wx:if="{{item.QuestionType === 5}}" class="image-group"> <view wx:if="{{item.QuestionType === 5}}" class="image-group">
<view <view wx:for="{{item.Images}}" wx:for-item="img" wx:for-index="imgIndex" wx:key="imgIndex" class="image-item">
wx:for="{{item.Images}}"
wx:for-item="img"
wx:for-index="imgIndex"
wx:key="imgIndex"
class="image-item"
>
<image class="img" mode="aspectFill" src="{{img.url}}"></image> <image class="img" mode="aspectFill" src="{{img.url}}"></image>
<view class="del" catch:tap="handleImageDelete" data-index="{{qIndex}}" data-imgindex="{{imgIndex}}"> <view class="del" catch:tap="handleImageDelete" data-index="{{qIndex}}" data-imgindex="{{imgIndex}}">
<van-icon name="cross" /> <van-icon name="cross" />
</view> </view>
</view> </view>
<view <view wx:if="{{item.Images.length < 9}}" class="image-add" bind:tap="handleImageUpload" data-index="{{qIndex}}">
wx:if="{{item.Images.length < 9}}"
class="image-add"
bind:tap="handleImageUpload"
data-index="{{qIndex}}"
>
<van-icon name="plus" class="add-icon" /> <van-icon name="plus" class="add-icon" />
<view class="add-text">添加图片</view> <view class="add-text">添加图片</view>
</view> </view>

2
src/pages/qaFormDetail/index.wxml

@ -21,7 +21,7 @@
</view> </view>
<view wx:if="{{item.QuestionType === 4 && item.TextValue}}" class="answer-text"> <view wx:if="{{item.QuestionType === 4 && item.TextValue}}" class="answer-text">
<view class="answer-content">{{item.TextValue}}</view> <view class="answer-content">{{item.TextValue}}mg/天</view>
</view> </view>
<view wx:if="{{item.QuestionType === 5 && item.Images.length}}" class="image-group"> <view wx:if="{{item.QuestionType === 5 && item.Images.length}}" class="image-group">

Loading…
Cancel
Save