privacy_pop.js 1.83 KB
var t = getApp(),os =t.globalData.setting;
Component({
  properties: {
  },
  data: {
    show_pri:0,
    is_all_ok:0,
    store:null
  },
  //获取一下商家的信息
  ready: function () {
      getApp().getConfig(e=>{
           this.setData({store:e})
      })
  },
    
  methods: {
    //判断用户有没有同意安全隐私
    check_pri_show(){
        if(wx.getPrivacySetting){
                wx.getPrivacySetting({
                    success: res => {
                        console.log(res) // 返回结果为: res = { needAuthorization: true/false, privacyContractName: '《xxx隐私保护指引》' }
                        if (res.needAuthorization) {
                            // 需要弹出隐私协议
                            this.setData({
                                show_pri: 1
                            })
                        }else{
                            this.setData({
                                show_pri: 0
                            })
                            this.triggerEvent('agree_pri');// 调用同意的函数
                        }
                    }
                })
        }
    },
    //--- 分享 ---
    goto:function (e) {
       var url= e.currentTarget.dataset.url;
       getApp().goto(url);
    },
    need_ok:function (){
        wx.showToast({
            title: '请您先阅读和勾选指定的内容',
            icon: 'none',
        });
    },
    //同意隐私的内容
    AgreePrivacy:function (){
       this.setData({show_pri:0,});
       this.triggerEvent('agree_pri');// 调用同意的函数
    },

    // 是否同意协议
    isAgree(e) {
          let isAgree = null;
          if (e.detail.value[0]) {
              isAgree = true;
          } else { isAgree = false;}

          this.setData({
              is_all_ok:isAgree,
          });
    },

  }

})