mirror of
http://36.133.248.69:3088/admin/RentWeAppFront.git
synced 2026-06-07 14:32:27 +08:00
优化,完善代码
This commit is contained in:
@@ -5,11 +5,11 @@
|
||||
<view class="setting-content">
|
||||
<u-cell-group>
|
||||
<u-cell-item title="账号实名信息" @click="profile"></u-cell-item>
|
||||
<u-cell-item title="订阅系统消息" :arrow="false">
|
||||
<!-- <u-cell-item title="订阅系统消息" :arrow="false">
|
||||
|
||||
<u-switch v-model="longSubscribe" @change="toggleLongSubscribe" />
|
||||
|
||||
</u-cell-item>
|
||||
</u-cell-item> -->
|
||||
</u-cell-group>
|
||||
</view>
|
||||
|
||||
@@ -53,32 +53,30 @@
|
||||
// 微信小程序专用
|
||||
// #ifdef MP-WEIXIN
|
||||
if (this.longSubscribe) {
|
||||
const tmplIds = ['ZVl9bkFv8Nzha2n_6wO36IBqe0H5VwJBvV-7OkVT5jo'] // 在小程序后台配置的长期订阅模板
|
||||
wx.requestSubscribeMessage({
|
||||
tmplIds,
|
||||
success: (res) => {
|
||||
// 用户同意才生效
|
||||
console.log('长期订阅授权结果', res)
|
||||
if (Object.values(res).some((v) => v === 'accept')) {
|
||||
uni.showToast({
|
||||
title: '长期订阅开启成功',
|
||||
icon: 'success'
|
||||
})
|
||||
// 可以把状态保存到后端
|
||||
this.saveLongSubscribeStatus(true)
|
||||
} else {
|
||||
uni.showToast({
|
||||
title: '未授权订阅',
|
||||
icon: 'none'
|
||||
})
|
||||
this.longSubscribe = false
|
||||
}
|
||||
},
|
||||
fail: (err) => {
|
||||
console.error(err)
|
||||
this.longSubscribe = false
|
||||
},
|
||||
})
|
||||
// const tmplIds = ['9QlNxNONJBICzw3Vcetqbf9yv4lI9q9cR_px8ujlOu8']
|
||||
// wx.requestSubscribeMessage({
|
||||
// tmplIds,
|
||||
// success: (res) => {
|
||||
// if (Object.values(res).some((v) => v === 'accept')) {
|
||||
// uni.showToast({
|
||||
// title: '长期订阅开启成功',
|
||||
// icon: 'success'
|
||||
// })
|
||||
// this.saveLongSubscribeStatus(true)
|
||||
// } else {
|
||||
// uni.showToast({
|
||||
// title: '未授权订阅',
|
||||
// icon: 'none'
|
||||
// })
|
||||
// this.longSubscribe = false
|
||||
// }
|
||||
// },
|
||||
// fail: (err) => {
|
||||
// console.error(err)
|
||||
// this.longSubscribe = false
|
||||
// },
|
||||
// })
|
||||
this.saveLongSubscribeStatus(true)
|
||||
} else {
|
||||
// 取消订阅
|
||||
uni.showToast({
|
||||
|
||||
Reference in New Issue
Block a user