quanyawei
2023-11-06 1e61215b48e59e94c1ed98e4ef956227d689d6bc
pages/login/login.vue
@@ -29,6 +29,7 @@
            <u-button @click="submit">登录</u-button>
         </view>
      </view>
      <ws-wx-privacy id="privacy-popup" enableAutoProtocol></ws-wx-privacy>
   </view>
</template>
<script>
@@ -41,9 +42,13 @@
      httpGet
   } from '@/utils/http.js'
   import store from '@/store/index.js'
   import {
      subScribeMsg
   } from '@/utils/subscribe.js'
   export default {
      data() {
         return {
            titlePrivacy: '用户隐私保护提示',
            labelStyle: {
               color: '#fff'
            },
@@ -81,9 +86,32 @@
         uni.hideHomeButton()
      },
      methods: {
         // 点击时触发订阅信息
         async aClick() {
            let data = await subScribeMsg()
            console.log('data', data)
            if (data['YNqUZ1MgMvwY3G-NENVbcmIBR5dUotSdnwcz96CWrho'] === 'accept') { // 用户点击确定后
            } else {
               console.log('拒绝')
            }
         },
         doRequire() {
            uni.requirePrivacyAuthorize({
               success: () => {
                  console.log('同意')
                  // 用户同意授权
                  // 继续小程序逻辑
                  this.getlogin()
               },
               fail: () => {
                  console.log('拒绝')
               }, // 用户拒绝授权
               complete: () => {}
            })
         },
         submit() {
            this.$refs.uForm.validate().then(res => {
               this.getlogin()
               this.doRequire()
            }).catch(errors => {})
         },
         //登录
@@ -91,8 +119,8 @@
            const value = uni.getStorageSync('openId')
            console.log('openId', value)
            if (value) {
               this.aClick()
               this.logining(value)
               console.log('openId', openId)
            }
         },
         logining(openId) {