feat: MBTI头像与用户规则链路升级,三端页面与接口同步
Made-with: Cursor
This commit is contained in:
@@ -46,6 +46,8 @@ Page({
|
||||
|
||||
// 绑定用户列表
|
||||
showBindingList: true,
|
||||
showShareSection: false,
|
||||
showEarningsDetails: false,
|
||||
activeTab: 'active',
|
||||
activeBindings: [],
|
||||
convertedBindings: [],
|
||||
@@ -63,10 +65,13 @@ Page({
|
||||
posterReferralLink: '',
|
||||
posterNickname: '',
|
||||
posterNicknameInitial: '',
|
||||
/** 推广海报推荐人头像:优先微信头像,否则按 MBTI 用后台映射 */
|
||||
posterDisplayAvatar: '',
|
||||
posterCaseCount: 62
|
||||
},
|
||||
|
||||
onLoad() {
|
||||
onLoad(options) {
|
||||
this._focusTarget = (options && options.focus) || ""
|
||||
this.setData({ statusBarHeight: app.globalData.statusBarHeight })
|
||||
this.initData()
|
||||
// 启用分享到朋友圈(需同时有 onShareAppMessage 和 onShareTimeline;menus 在 Android 支持,iOS 为 Beta)
|
||||
@@ -207,12 +212,37 @@ Page({
|
||||
|
||||
// 隐藏加载提示
|
||||
wx.hideLoading()
|
||||
this._applyFocusTarget()
|
||||
} else {
|
||||
// 未登录时也隐藏loading
|
||||
this.setData({ isLoading: false })
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
toggleShareSection() {
|
||||
this.setData({ showShareSection: !this.data.showShareSection })
|
||||
},
|
||||
|
||||
toggleEarningsDetails() {
|
||||
this.setData({ showEarningsDetails: !this.data.showEarningsDetails })
|
||||
},
|
||||
|
||||
_applyFocusTarget() {
|
||||
const t = this._focusTarget || ''
|
||||
if (!t) return
|
||||
if (t === 'bindings') {
|
||||
this.setData({ showBindingList: true, activeTab: 'active', currentBindings: this.data.activeBindings })
|
||||
setTimeout(() => wx.pageScrollTo({ selector: '#binding-card', duration: 220 }), 80)
|
||||
this._focusTarget = ''
|
||||
return
|
||||
}
|
||||
if (t === 'earnings') {
|
||||
setTimeout(() => wx.pageScrollTo({ selector: '#earnings-card', duration: 220 }), 80)
|
||||
this._focusTarget = ''
|
||||
return
|
||||
}
|
||||
},
|
||||
// 切换Tab
|
||||
switchTab(e) {
|
||||
const tab = e.currentTarget.dataset.tab
|
||||
@@ -342,11 +372,20 @@ Page({
|
||||
|
||||
console.log('[Poster] 小程序码已保存到本地:', filePath)
|
||||
|
||||
try {
|
||||
if (app.loadMbtiAvatarsMap) await app.loadMbtiAvatarsMap()
|
||||
} catch (_) {}
|
||||
const u = this.data.userInfo || app.globalData.userInfo || {}
|
||||
const posterDisplayAvatar = app.resolveAvatarWithMbti
|
||||
? app.resolveAvatarWithMbti(u.avatar, u.mbti)
|
||||
: ''
|
||||
|
||||
this.setData({
|
||||
posterQrSrc: filePath,
|
||||
posterReferralLink: '', // 小程序版本不再使用 H5 链接
|
||||
posterNickname: nickname,
|
||||
posterNicknameInitial: (nickname || '用').charAt(0),
|
||||
posterDisplayAvatar,
|
||||
isGeneratingPoster: false
|
||||
})
|
||||
wx.hideLoading()
|
||||
@@ -354,7 +393,7 @@ Page({
|
||||
console.error('[Poster] 生成二维码失败:', e)
|
||||
wx.hideLoading()
|
||||
wx.showToast({ title: '生成失败', icon: 'none' })
|
||||
this.setData({ showPosterModal: false, isGeneratingPoster: false, posterQrSrc: '', posterReferralLink: '' })
|
||||
this.setData({ showPosterModal: false, isGeneratingPoster: false, posterQrSrc: '', posterReferralLink: '', posterDisplayAvatar: '' })
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
Reference in New Issue
Block a user