优化
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
import { API } from './../../../utils/network/api'
|
||||
import Toast from '@vant/weapp/toast/toast';
|
||||
import { requestSubscribeMessage } from './../../../utils/requestSubscribeUtil';
|
||||
let api = new API()
|
||||
const app = getApp()
|
||||
Page({
|
||||
@@ -35,7 +36,8 @@ Page({
|
||||
"5",
|
||||
"10"
|
||||
]
|
||||
}
|
||||
},
|
||||
sub_visible: false,
|
||||
},
|
||||
|
||||
onShow(){
|
||||
@@ -98,16 +100,39 @@ 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 = {};
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
"van-cell-group": "@vant/weapp/cell-group/index",
|
||||
"van-stepper": "@vant/weapp/stepper/index",
|
||||
"van-button": "@vant/weapp/button/index",
|
||||
"van-toast": "@vant/weapp/toast/index"
|
||||
"van-toast": "@vant/weapp/toast/index",
|
||||
"t-dialog": "tdesign-miniprogram/dialog/dialog"
|
||||
}
|
||||
}
|
||||
@@ -46,4 +46,17 @@
|
||||
</t-picker>
|
||||
|
||||
<van-toast id="van-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>
|
||||
@@ -120,4 +120,18 @@ page{
|
||||
.van-cell__value{
|
||||
font-size: 32rpx !important;
|
||||
color: red !important;
|
||||
}
|
||||
.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