扩大问诊开关的点击区域

This commit is contained in:
haomingming 2023-05-25 09:44:17 +08:00
parent bd97a69fb4
commit 70dca249c3
6 changed files with 76 additions and 25 deletions

View File

@ -62,17 +62,34 @@ Page({
}).catch(errors => {console.error(errors);}) }).catch(errors => {console.error(errors);})
}, },
changeON(){
let is_open = this.data.info.is_open
console.log("changeON:", is_open)
let detail = false
if(is_open == 0){
detail = true
}else{
detail = false
}
this.doChange(detail)
},
onChange({ detail }) { onChange({ detail }) {
console.log("onChange: ", detail); console.log("onChange: ", detail);
this.doChange(detail)
},
doChange(detail){
let is_open = 0;
if(detail){ if(detail){
this.setData({ note: this.data.open_note }); this.setData({ note: this.data.open_note });
wx.vibrateShort({ wx.vibrateShort({
"type": "heavy" "type": "heavy"
}) })
is_open = 1
}else{ }else{
this.setData({ note: this.data.close_note }); this.setData({ note: this.data.close_note });
is_open = 0
} }
this.setData({ "info.is_open": detail }); this.setData({ "info.is_open": is_open });
//修改开关 //修改开关
let params = {}; let params = {};

View File

@ -2,15 +2,15 @@
<view class="container"> <view class="container">
<view class="switch_box"> <view class="switch_box">
<view class="switch_box_top"> <view class="switch_box_top">
<view class="switch_box_item"> <view class="switch_box_item" bindtap="changeON">
<view class="switch_box_item_name">接诊开关</view> <view class="switch_box_item_name">接诊开关</view>
<view class="switch_box_item_btn"> <view class="switch_box_item_btn">
<van-switch <van-switch
active-color="#3CC7C0" active-color="#3CC7C0"
inactive-color="#E7E7E7" inactive-color="#E7E7E7"
size="40rpx" size="40rpx"
checked="{{ info.is_open==1 }}" checked="{{ info.is_open==1 }}"
bind:change="onChange" /> />
</view> </view>
</view> </view>
<view class="switch_box_note">{{ note }}</view> <view class="switch_box_note">{{ note }}</view>

View File

@ -54,8 +54,23 @@ Page({
}) })
}).catch(errors => {console.error(errors);}) }).catch(errors => {console.error(errors);})
}, },
changeON(){
let is_open = this.data.info.is_open
console.log("changeON:", is_open)
let detail = false
if(is_open == 0){
detail = true
}else{
detail = false
}
this.doChange(detail)
},
onChange({ detail }) { onChange({ detail }) {
this.doChange(detail)
},
doChange(detail){
console.log("onChange: ", detail); console.log("onChange: ", detail);
let is_open = 0;
if(detail){ if(detail){
let inquiry_price = this.data.info.inquiry_price; let inquiry_price = this.data.info.inquiry_price;
let check = this.checkPrice(inquiry_price); let check = this.checkPrice(inquiry_price);
@ -64,10 +79,12 @@ Page({
wx.vibrateShort({ wx.vibrateShort({
"type": "heavy" "type": "heavy"
}) })
is_open = 1
}else{ }else{
this.setData({ note: this.data.close_note }); this.setData({ note: this.data.close_note });
is_open = 0
} }
this.setData({ "info.is_open": detail }); this.setData({ "info.is_open": is_open });
//修改开关 //修改开关
let params = {}; let params = {};

View File

@ -2,15 +2,14 @@
<view class="container"> <view class="container">
<view class="switch_box"> <view class="switch_box">
<view class="switch_box_top"> <view class="switch_box_top">
<view class="switch_box_item"> <view class="switch_box_item" bindtap="changeON">
<view class="switch_box_item_name">接诊开关</view> <view class="switch_box_item_name">接诊开关</view>
<view class="switch_box_item_btn"> <view class="switch_box_item_btn">
<van-switch <van-switch
active-color="#3CC7C0" active-color="#3CC7C0"
inactive-color="#E7E7E7" inactive-color="#E7E7E7"
size="40rpx" size="40rpx"
checked="{{ info.is_open==1 }}" checked="{{ info.is_open==1 }}" />
bind:change="onChange" />
</view> </view>
</view> </view>
<view class="switch_box_note">{{ note }}</view> <view class="switch_box_note">{{ note }}</view>

View File

@ -85,20 +85,37 @@ Page({
amountText: val amountText: val
}) })
}, },
changeON(){
let is_open = this.data.info.is_open
console.log("changeON:", is_open)
let detail = false
if(is_open == 0){
detail = true
}else{
detail = false
}
this.doChange(detail)
},
onChange({ detail }) { onChange({ detail }) {
console.log("onChange: ", detail); console.log("onChange: ", detail);
this.doChange(detail)
if(detail){ },
wx.vibrateShort({ doChange(detail){
"type": "heavy" let is_open = 0;
}) if(detail){
} wx.vibrateShort({
//修改开关 "type": "heavy"
let params = {}; })
params.inquiry_type = this.data.inquiry_type;//接诊类型1:专家问诊 2:快速问诊 3:公益问诊 4:问诊购药) is_open = 1;
params.inquiry_mode = this.data.inquiry_mode;//接诊方式1:图文 2:视频 3:语音 4:电话 5:会员) }else{
params.is_open = detail?1:0; is_open = 0
api.putDoctorInquiryOpen(params).then(response => { }
//修改开关
let params = {};
params.inquiry_type = this.data.inquiry_type;//接诊类型1:专家问诊 2:快速问诊 3:公益问诊 4:问诊购药)
params.inquiry_mode = this.data.inquiry_mode;//接诊方式1:图文 2:视频 3:语音 4:电话 5:会员)
params.is_open = detail?1:0;
api.putDoctorInquiryOpen(params).then(response => {
console.log(response); console.log(response);
}).then(()=>{ }).then(()=>{
if(detail){ if(detail){
@ -123,8 +140,9 @@ Page({
}else{ }else{
this.setData({ note: this.data.close_note }); this.setData({ note: this.data.close_note });
} }
this.setData({ "info.is_open": detail }); this.setData({ "info.is_open": is_open });
}).catch(errors => {console.error(errors);}) }).catch(errors => {console.error(errors);})
}, },
subcancelDialog(){ subcancelDialog(){
this.setData({ this.setData({

View File

@ -2,15 +2,15 @@
<view class="container"> <view class="container">
<view class="switch_box"> <view class="switch_box">
<view class="switch_box_top"> <view class="switch_box_top">
<view class="switch_box_item"> <view class="switch_box_item" bindtap="changeON">
<view class="switch_box_item_name">接诊开关</view> <view class="switch_box_item_name">接诊开关</view>
<view class="switch_box_item_btn"> <view class="switch_box_item_btn">
<van-switch <van-switch
active-color="#3CC7C0" active-color="#3CC7C0"
inactive-color="#E7E7E7" inactive-color="#E7E7E7"
size="40rpx" size="40rpx"
checked="{{ info.is_open==1 }}" checked="{{ info.is_open==1 }}"
bind:change="onChange" /> />
</view> </view>
</view> </view>
<view class="switch_box_note">{{ note }}</view> <view class="switch_box_note">{{ note }}</view>