qingyiay
2023-08-28 82a7eba143cc761b303b99889193f7aad2dc9d08
pages/bindBackground/bindBackground.vue
@@ -46,6 +46,27 @@
            }
            this.setUpWxOpenid(this.username, this.password, uni.getStorageSync('bindCode'))
         },
         getUserAuth() {
            wx.getSetting({
               withSubscriptions: true,
               success(res) {
                  if (res.subscriptionsSetting == null || res.subscriptionsSetting == undefined ||
                     res.subscriptionsSetting.itemSettings == null || res.subscriptionsSetting
                     .itemSettings == undefined || res.subscriptionsSetting[
                        "bvDqcHRRKEewTz7XVrdwUbrF6ZewSRmiUIB1V_IBJq4"] != 'accept') {
                     wx.requestSubscribeMessage({
                        tmplIds: ['bvDqcHRRKEewTz7XVrdwUbrF6ZewSRmiUIB1V_IBJq4'],
                        success(res) {
                           console.log(res, '获取订阅消息');
                        },
                        fail(e) {
                           console.log(e, '订阅消息失败');
                        }
                     })
                  }
               }
            })
         },
         setUpWxOpenid(userName, passWord, code) {
            uni.request({
               url: `${BaseUrl}/admin/user/setUpWxOpenid`,
@@ -62,6 +83,8 @@
                  console.log(res, '绑定结果');
                  if (res.data.code === 1) {
                     this.$u.toast(res.data.msg ? res.data.msg : '绑定失败')
                  } else {
                     this.$u.toast('操作成功')
                  }
               }
            })