123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657 |
- <template>
- <view class="page">
- <navBar title="隐私弹窗" :back="true" color="white" background="green" />
- <button v-if="showPrivacy" class="btn" @click="getPrivacy">获取头像</button>
- <!-- <button v-else class="btn" open-type="getPhoneNumber" @getphonenumber="onGetPhoneNumber">手机号快捷登录</button> -->
- <button v-else class="btn" open-type="chooseAvatar" @chooseavatar="onChooseAvatar">
- 获取头像
- </button>
- <privacy-popup ref="privacyPopup" @confirm="confirm"></privacy-popup>
- </view>
- </template>
- <script>
- import PrivacyPopup from "@/components/privacyPopup/index.vue";
- export default {
- components: {
- PrivacyPopup
- },
- data() {
- return {
- showPrivacy: getApp().globalData.showPrivacy,
- // showPrivacy: true,
- }
- },
- onLoad(options) {},
- methods: {
- confirm() {
- this.showPrivacy = false;
- },
- getPrivacy() {
- if (getApp().globalData.showPrivacy) {
- // if (true) {
- this.$refs.privacyPopup.$refs.popup.open();
- return;
- }
- },
- // 获取手机号
- onGetPhoneNumber(e) {
- // 用户拒绝授权
- if (e.detail.errMsg == "getPhoneNumber:fail:user deny") {
- uni.showToast({
- icon: 'none',
- title: '用户拒绝'
- });
- } else if (e.detail.code) { // 允许授权
- this.loginWeiXin(e.detail.code);
- }
- },
- }
- }
- </script>
- <style lang="scss" scoped>
- @import "./index.scss";
- </style>
|