完成Salon小程序合规整改
This commit is contained in:
@@ -0,0 +1,23 @@
|
||||
const authApi = require('../../api/auth')
|
||||
|
||||
Page({
|
||||
data: { loading: true, agreement: null },
|
||||
|
||||
onLoad(options) {
|
||||
this.load(options && options.type)
|
||||
},
|
||||
|
||||
async load(type) {
|
||||
const agreementType = type === 'PRIVACY_POLICY' ? 'PRIVACY_POLICY' : 'USER_TERMS'
|
||||
this.setData({ loading: true })
|
||||
try {
|
||||
const agreements = await authApi.getCurrentAgreements()
|
||||
const agreement = (Array.isArray(agreements) ? agreements : []).find(item => item.agreementType === agreementType)
|
||||
this.setData({ agreement: agreement || null })
|
||||
} catch (error) {
|
||||
wx.showToast({ title: error.message || '协议加载失败', icon: 'none' })
|
||||
} finally {
|
||||
this.setData({ loading: false })
|
||||
}
|
||||
}
|
||||
})
|
||||
Reference in New Issue
Block a user