优化
This commit is contained in:
@@ -1,5 +1,7 @@
|
||||
import { API } from './../../../utils/network/api'
|
||||
import Toast from 'tdesign-miniprogram/toast/index';
|
||||
import { requestSubscribeMessage } from './../../../utils/requestSubscribeUtil';
|
||||
|
||||
let api = new API()
|
||||
const app = getApp()
|
||||
Page({
|
||||
@@ -32,7 +34,8 @@ Page({
|
||||
"5",
|
||||
"10"
|
||||
]
|
||||
}
|
||||
},
|
||||
sub_visible: false,
|
||||
},
|
||||
onLoad(){
|
||||
|
||||
@@ -72,16 +75,41 @@ Page({
|
||||
console.log(response);
|
||||
}).then(()=>{
|
||||
if(detail){
|
||||
wx.requestSubscribeMessage({
|
||||
tmplIds: ['G1RIs0RYqsTQ2CuPQWalIMyb6_deuEEbJfajfhGvNzc'],
|
||||
success (res) {
|
||||
console.log(res);//同意授权
|
||||
|
||||
let tmplIds = ['G1RIs0RYqsTQ2CuPQWalIMyb6_deuEEbJfajfhGvNzc']
|
||||
let sub_promise = requestSubscribeMessage(tmplIds)
|
||||
sub_promise.then(res => {
|
||||
console.log("订阅成功")
|
||||
|
||||
}).catch(err => {
|
||||
console.log(err)
|
||||
let errCode = err.errCode
|
||||
if(errCode == 20004){
|
||||
this.setData({
|
||||
sub_visible: true,
|
||||
})
|
||||
}
|
||||
})
|
||||
|
||||
}
|
||||
}).catch(errors => {console.error(errors);})
|
||||
|
||||
},
|
||||
subcancelDialog(){
|
||||
this.setData({
|
||||
sub_visible: false
|
||||
})
|
||||
},
|
||||
subconfirmDialog(){
|
||||
this.setData({
|
||||
sub_visible: false
|
||||
})
|
||||
wx.openSetting({
|
||||
success (res) {
|
||||
console.log(res.authSetting)
|
||||
}
|
||||
})
|
||||
},
|
||||
putDoctorInquiryConfig(){
|
||||
//修改医生问诊配置
|
||||
// let params = {};
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
"van-stepper": "@vant/weapp/stepper/index",
|
||||
"van-switch": "@vant/weapp/switch/index",
|
||||
"van-button": "@vant/weapp/button/index",
|
||||
"t-toast": "tdesign-miniprogram/toast/toast"
|
||||
"t-toast": "tdesign-miniprogram/toast/toast",
|
||||
"t-dialog": "tdesign-miniprogram/dialog/dialog"
|
||||
}
|
||||
}
|
||||
@@ -51,4 +51,17 @@
|
||||
</view>
|
||||
|
||||
<t-toast id="t-toast" />
|
||||
|
||||
<t-dialog
|
||||
visible="{{ sub_visible }}"
|
||||
title="温馨提示"
|
||||
content="您已关闭订阅消息通知,请点击“确认”按钮在设置中打开订阅通知。"
|
||||
>
|
||||
<view slot="cancel-btn" class="dialog dialog_cancel_btn" bindtap="subcancelDialog">
|
||||
取消
|
||||
</view>
|
||||
<view slot="confirm-btn" class="dialog dialog_confirm_btn" bindtap="subconfirmDialog">
|
||||
确定
|
||||
</view>
|
||||
</t-dialog>
|
||||
</view>
|
||||
@@ -137,4 +137,18 @@ page{
|
||||
}
|
||||
.cell_value{
|
||||
color: #000;
|
||||
}
|
||||
.dialog{
|
||||
width: 50%;
|
||||
text-align: center;
|
||||
height: 100rpx;
|
||||
line-height: 100rpx;
|
||||
}
|
||||
.dialog_cancel_btn{
|
||||
border-top: 1px solid #E9E9E9;
|
||||
border-right: 1px solid #E9E9E9;
|
||||
}
|
||||
.dialog_confirm_btn{
|
||||
border-top: 1px solid #E9E9E9;
|
||||
color: #3CC7C0;
|
||||
}
|
||||
Reference in New Issue
Block a user