80 lines
2.2 KiB
JavaScript
80 lines
2.2 KiB
JavaScript
var o, n = new Set(), t = new Set();
|
|
|
|
wx.onNeedPrivacyAuthorization && wx.onNeedPrivacyAuthorization(function(n) {
|
|
console.log("触发 onNeedPrivacyAuthorization"), "function" == typeof o && o(n);
|
|
});
|
|
|
|
var e = function(o) {
|
|
t.forEach(function(n) {
|
|
o !== n && n();
|
|
});
|
|
};
|
|
|
|
Component({
|
|
data: {
|
|
title: "用户隐私保护提示",
|
|
desc1: "在您使用本服务前应当阅读并同意",
|
|
urlTitle: "《用户隐私保护指引》。",
|
|
desc2: "如您同意该指引,请点击“同意”继续使用。",
|
|
innerShow: !1,
|
|
height: 0
|
|
},
|
|
lifetimes: {
|
|
attached: function() {
|
|
var i = this, c = function() {
|
|
i.disPopUp();
|
|
};
|
|
o = function(o) {
|
|
n.add(o), i.popUp(), e(c);
|
|
}, this.closePopUp = c, t.add(this.closePopUp);
|
|
},
|
|
detached: function() {
|
|
t.delete(this.closePopUp);
|
|
}
|
|
},
|
|
pageLifetimes: {
|
|
show: function() {
|
|
var t = this;
|
|
this.closePopUp && (o = function(o) {
|
|
n.add(o), t.popUp(), e(t.closePopUp);
|
|
});
|
|
}
|
|
},
|
|
methods: {
|
|
handleAgree: function(o) {
|
|
this.disPopUp(), n.forEach(function(o) {
|
|
o({
|
|
event: "agree",
|
|
buttonId: "agree-btn"
|
|
});
|
|
}), n.clear();
|
|
},
|
|
handleDisagree: function(o) {
|
|
this.disPopUp(), n.forEach(function(o) {
|
|
o({
|
|
event: "disagree"
|
|
});
|
|
}), n.clear();
|
|
},
|
|
popUp: function() {
|
|
!1 === this.data.innerShow && this.setData({
|
|
innerShow: !0
|
|
});
|
|
},
|
|
disPopUp: function() {
|
|
!0 === this.data.innerShow && this.setData({
|
|
innerShow: !1
|
|
});
|
|
},
|
|
openPrivacyContract: function() {
|
|
wx.openPrivacyContract({
|
|
success: function(o) {
|
|
console.log("openPrivacyContract success");
|
|
},
|
|
fail: function(o) {
|
|
console.error("openPrivacyContract fail", o);
|
|
}
|
|
});
|
|
}
|
|
}
|
|
}); |