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

8
src/components/pickerArea/index.ts

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

3
src/components/toast/index.wxml

@ -918,7 +918,8 @@ @@ -918,7 +918,8 @@
</view>
<view class="footer">
<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 class="popup12" wx:if="{{type==='popup12'}}">

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

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

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

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

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

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

14
src/pages/changePhone/index.ts

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

14
src/pages/changeUser/index.ts

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

2
src/pages/doctor/index.json

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

1
src/pages/doctorDetail/index.scss

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

9
src/pages/hospital/index.scss

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

2
src/pages/hospital/index.wxml

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

11
src/pages/login/index.ts

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

18
src/pages/qaForm/index.scss

@ -41,7 +41,7 @@ page { @@ -41,7 +41,7 @@ page {
}
.content {
font-size: 36rpx;
color: rgba(34, 34, 34, 0.70);
color: rgba(34, 34, 34, 0.7);
}
&.active {
.radio {
@ -98,7 +98,7 @@ page { @@ -98,7 +98,7 @@ page {
}
.content {
font-size: 36rpx;
color: rgba(34, 34, 34, 0.70);
color: rgba(34, 34, 34, 0.7);
}
&.active {
.check {
@ -147,6 +147,20 @@ page { @@ -147,6 +147,20 @@ page {
font-size: 32rpx;
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 {
margin-top: 32rpx;
padding: 26rpx 32rpx;

30
src/pages/qaForm/index.wxml

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

2
src/pages/qaFormDetail/index.wxml

@ -21,7 +21,7 @@ @@ -21,7 +21,7 @@
</view>
<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 wx:if="{{item.QuestionType === 5 && item.Images.length}}" class="image-group">

Loading…
Cancel
Save