Files
memind/miniapp/components/privacy-popup/index.js
john 048f25f580 feat(miniapp): add privacy consent and legal pages
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>
2026-07-12 12:18:54 +08:00

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;
}
},
},
});