删除过时的部署管理端触发词文档,并更新相关索引以反映新的触发词约定,确保文档一致性和准确性。
This commit is contained in:
79
miniprogram/components/login-modal/login-modal.js
Normal file
79
miniprogram/components/login-modal/login-modal.js
Normal file
@@ -0,0 +1,79 @@
|
||||
/**
|
||||
* Soul 创业派对 - 公用登录弹窗
|
||||
* 手机号一键登录 + 隐私协议
|
||||
*/
|
||||
Component({
|
||||
properties: {
|
||||
show: { type: Boolean, value: false },
|
||||
desc: { type: String, value: '登录后可购买章节、解锁更多内容' },
|
||||
showPrivacyModal: { type: Boolean, value: false },
|
||||
showCancel: { type: Boolean, value: false }
|
||||
},
|
||||
data: {
|
||||
agreeProtocol: false,
|
||||
isLoggingIn: false
|
||||
},
|
||||
observers: {
|
||||
show(v) {
|
||||
if (!v) this.setData({ agreeProtocol: false, isLoggingIn: false })
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
stopPropagation() {},
|
||||
onClose() {
|
||||
this.triggerEvent('close')
|
||||
},
|
||||
onToggleAgree() {
|
||||
this.setData({ agreeProtocol: !this.data.agreeProtocol })
|
||||
},
|
||||
onOpenUserProtocol() {
|
||||
wx.navigateTo({ url: '/pages/agreement/agreement' })
|
||||
},
|
||||
onOpenPrivacy() {
|
||||
wx.navigateTo({ url: '/pages/privacy/privacy' })
|
||||
},
|
||||
onAgreePrivacy() {
|
||||
const app = getApp()
|
||||
if (app._privacyResolve) {
|
||||
app._privacyResolve({ buttonId: 'agree-privacy-btn', event: 'agree' })
|
||||
app._privacyResolve = null
|
||||
}
|
||||
this.triggerEvent('privacyagree')
|
||||
},
|
||||
async onPhoneLogin(e) {
|
||||
if (!e.detail.code) {
|
||||
return this._fallbackWechatLogin()
|
||||
}
|
||||
const app = getApp()
|
||||
this.setData({ isLoggingIn: true })
|
||||
try {
|
||||
const result = await app.loginWithPhone(e.detail.code)
|
||||
this.setData({ isLoggingIn: false })
|
||||
if (result) {
|
||||
this.triggerEvent('success')
|
||||
} else {
|
||||
wx.showToast({ title: '登录失败,请重试', icon: 'none' })
|
||||
}
|
||||
} catch (err) {
|
||||
this.setData({ isLoggingIn: false })
|
||||
wx.showToast({ title: '登录失败,请重试', icon: 'none' })
|
||||
}
|
||||
},
|
||||
async _fallbackWechatLogin() {
|
||||
const app = getApp()
|
||||
this.setData({ isLoggingIn: true })
|
||||
try {
|
||||
const result = await app.login()
|
||||
this.setData({ isLoggingIn: false })
|
||||
if (result) {
|
||||
this.triggerEvent('success')
|
||||
} else {
|
||||
wx.showToast({ title: '登录失败,请重试', icon: 'none' })
|
||||
}
|
||||
} catch (err) {
|
||||
this.setData({ isLoggingIn: false })
|
||||
wx.showToast({ title: '登录失败,请重试', icon: 'none' })
|
||||
}
|
||||
}
|
||||
}
|
||||
})
|
||||
Reference in New Issue
Block a user