同步
This commit is contained in:
@@ -3,6 +3,7 @@
|
||||
* 登录后若仍为默认头像/昵称,在此修改;仅头像与昵称两项
|
||||
*/
|
||||
const app = getApp()
|
||||
const { trackClick } = require('../../utils/trackClick')
|
||||
|
||||
Page({
|
||||
data: {
|
||||
@@ -14,15 +15,21 @@ Page({
|
||||
nicknameInputFocus: false,
|
||||
/** 规则引擎传入:avatar | nickname,用于高亮对应区块 */
|
||||
uiFocus: '',
|
||||
fromNewUser: false,
|
||||
},
|
||||
|
||||
onLoad(options) {
|
||||
this.setData({ statusBarHeight: app.globalData.statusBarHeight || 44 })
|
||||
const fromNewUser = String(options.from || '').toLowerCase() === 'new_user'
|
||||
const focus = String(options.focus || '').toLowerCase()
|
||||
if (focus === 'avatar' || focus === 'nickname') {
|
||||
this.setData({ uiFocus: focus })
|
||||
}
|
||||
this.setData({ fromNewUser })
|
||||
this.loadFromUser()
|
||||
if (fromNewUser) {
|
||||
trackClick('avatar_nickname', 'page_view', '新注册引导页')
|
||||
}
|
||||
if (focus === 'nickname') {
|
||||
setTimeout(() => {
|
||||
if (typeof wx.requirePrivacyAuthorize === 'function') {
|
||||
@@ -92,6 +99,7 @@ Page({
|
||||
async onChooseAvatar(e) {
|
||||
const tempAvatarUrl = e.detail?.avatarUrl
|
||||
if (!tempAvatarUrl) return
|
||||
trackClick('avatar_nickname', 'btn_click', '选择头像')
|
||||
await this.uploadAndSaveAvatar(tempAvatarUrl)
|
||||
},
|
||||
|
||||
@@ -132,6 +140,9 @@ Page({
|
||||
}
|
||||
wx.hideLoading()
|
||||
wx.showToast({ title: '头像已更新', icon: 'success' })
|
||||
if (this.data.fromNewUser) {
|
||||
trackClick('avatar_nickname', 'form_step_done', '头像更新完成')
|
||||
}
|
||||
} catch (e) {
|
||||
wx.hideLoading()
|
||||
wx.showToast({ title: e.message || '上传失败', icon: 'none' })
|
||||
@@ -150,6 +161,7 @@ Page({
|
||||
wx.showToast({ title: '请输入昵称', icon: 'none' })
|
||||
return
|
||||
}
|
||||
trackClick('avatar_nickname', 'btn_click', '完成保存')
|
||||
this.setData({ saving: true })
|
||||
try {
|
||||
await app.request({
|
||||
@@ -162,6 +174,13 @@ Page({
|
||||
if (avatar) app.globalData.userInfo.avatar = avatar
|
||||
wx.setStorageSync('userInfo', app.globalData.userInfo)
|
||||
}
|
||||
if (this.data.fromNewUser) {
|
||||
wx.setStorageSync('new_user_guide_done_at', Date.now())
|
||||
trackClick('avatar_nickname', 'form_submit', '新注册引导完成', {
|
||||
hasAvatar: !!avatar,
|
||||
nicknameLen: nickname.length,
|
||||
})
|
||||
}
|
||||
wx.showToast({ title: '保存成功', icon: 'success' })
|
||||
setTimeout(() => getApp().goBackOrToHome(), 800)
|
||||
} catch (e) {
|
||||
@@ -171,6 +190,7 @@ Page({
|
||||
},
|
||||
|
||||
goToFullProfile() {
|
||||
trackClick('avatar_nickname', 'nav_click', '编辑完整档案')
|
||||
wx.navigateTo({ url: '/pages/profile-edit/profile-edit' })
|
||||
},
|
||||
})
|
||||
|
||||
@@ -10,10 +10,12 @@
|
||||
<view class="content">
|
||||
<view class="guide-card">
|
||||
<icon name="handshake" size="64" color="#00CED1" customClass="guide-icon"></icon>
|
||||
<text class="guide-title">设置对外展示信息</text>
|
||||
<text class="guide-title">{{fromNewUser ? '欢迎加入,先完成基础信息' : '设置对外展示信息'}}</text>
|
||||
<text class="guide-badge" wx:if="{{fromNewUser}}">新用户引导</text>
|
||||
<text class="guide-desc" wx:if="{{uiFocus === 'avatar'}}">请先换一张清晰头像,伙伴更容易认出你。</text>
|
||||
<text class="guide-desc" wx:elif="{{uiFocus === 'nickname'}}">请改一个真实好记的昵称,方便伙伴称呼你。</text>
|
||||
<text class="guide-desc" wx:else>头像与昵称会出现在名片与匹配卡片上,方便伙伴认出你。</text>
|
||||
<text class="guide-desc guide-desc-sub" wx:if="{{fromNewUser}}">完成后可继续编辑完整档案(手机号、行业、MBTI 等)。</text>
|
||||
</view>
|
||||
|
||||
<!-- 头像:点击直接弹出微信原生选择器;头像与文字水平对齐 -->
|
||||
|
||||
@@ -64,11 +64,25 @@
|
||||
color: #5EEAD4;
|
||||
margin-bottom: 12rpx;
|
||||
}
|
||||
.guide-badge {
|
||||
margin-bottom: 10rpx;
|
||||
padding: 6rpx 16rpx;
|
||||
font-size: 20rpx;
|
||||
color: #22d3ee;
|
||||
border-radius: 999rpx;
|
||||
border: 1rpx solid rgba(34, 211, 238, 0.4);
|
||||
background: rgba(34, 211, 238, 0.1);
|
||||
}
|
||||
.guide-desc {
|
||||
font-size: 26rpx;
|
||||
color: rgba(148, 163, 184, 0.95);
|
||||
line-height: 1.5;
|
||||
}
|
||||
.guide-desc-sub {
|
||||
margin-top: 8rpx;
|
||||
color: rgba(148, 163, 184, 0.85);
|
||||
font-size: 24rpx;
|
||||
}
|
||||
|
||||
.avatar-section {
|
||||
display: flex;
|
||||
|
||||
Reference in New Issue
Block a user