048f25f580
Show privacy popup on launch, gate login on legal consent, and link user agreement and privacy policy pages in the mini program. Co-authored-by: Cursor <cursoragent@cursor.com>
46 lines
982 B
JavaScript
46 lines
982 B
JavaScript
const { openPrivacyContract } = require('../../utils/privacy');
|
|
|
|
Component({
|
|
data: {
|
|
show: false,
|
|
privacyContractName: '《用户隐私保护指引》',
|
|
},
|
|
|
|
lifetimes: {
|
|
attached() {
|
|
if (typeof wx.onNeedPrivacyAuthorization !== 'function') {
|
|
return;
|
|
}
|
|
wx.onNeedPrivacyAuthorization((resolve) => {
|
|
this._privacyResolve = resolve;
|
|
this.setData({ show: true });
|
|
});
|
|
},
|
|
},
|
|
|
|
methods: {
|
|
openPrivacyContract() {
|
|
openPrivacyContract();
|
|
},
|
|
|
|
handleDisagree() {
|
|
this.setData({ show: false });
|
|
if (this._privacyResolve) {
|
|
this._privacyResolve({ event: 'disagree' });
|
|
this._privacyResolve = null;
|
|
}
|
|
},
|
|
|
|
handleAgree() {
|
|
this.setData({ show: false });
|
|
if (this._privacyResolve) {
|
|
this._privacyResolve({
|
|
buttonId: 'agree-privacy-btn',
|
|
event: 'agree',
|
|
});
|
|
this._privacyResolve = null;
|
|
}
|
|
},
|
|
},
|
|
});
|