Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
飞
飞鹤小程序
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
FH
飞鹤小程序
Commits
e7541c01
Commit
e7541c01
authored
Nov 04, 2025
by
spc
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fixed
parent
106f09c1
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
133 additions
and
195 deletions
+133
-195
My.vue
views/My.vue
+133
-195
No files found.
views/My.vue
View file @
e7541c01
...
...
@@ -6,17 +6,12 @@
:iconSelected=
"$baseUrl + 'my/track/icon_stage_sel.png'"
@
update:selectedIndex=
"(val) => (wheelSelectedIndex = val)"
@
change=
"handleWheelChange"
/>
</view>
<view
v-if=
"cfgStatus.isRegister"
class=
"bg-container"
:data-log=
"
{
<view
class=
"bg-container"
:data-log=
"
{
xcxClick: '我的页面点击',
pageName: '我的页面',
buttonName: '上传背景',
}"
@click="handleUploadBackground"
>
<image
class=
"bg-img"
:src=
"localBackgroundImg || babyInfo?.content?.backgroundImg || $baseUrl + 'my/default_bg.png'
buttonName: '个人信息修改',
}" @click="handleEditProfile">
<image
class=
"bg-img"
:src=
"babyInfo?.content?.backgroundImg || $baseUrl + 'my/default_bg.png'
"
mode=
"widthFix"
lazy-load=
"false"
binderror=
""
bindload=
""
/>
<image
class=
"banner_cover"
:src=
"$baseUrl + 'my/cover_white.png'"
mode=
"aspectFill"
/>
</view>
...
...
@@ -26,16 +21,14 @@
<!-- 用户信息区域 -->
<view
class=
"user-info"
:style=
"
{ 'min-height': cfgStatus.showDetail ? '343rpx' : '168rpx' }">
<view
class=
"user-header"
>
<view
class=
"avatar-container"
:data-log=
"
{
<view
class=
"avatar-container"
@
click=
"handleEditProfile"
:data-log=
"
{
xcxClick: '我的页面点击',
pageName: '我的页面',
buttonName: '个人信息修改',
}">
<button
class=
"avatar-wrapper"
open-type=
"chooseAvatar"
@
chooseavatar=
"onChooseAvatar"
>
<image
class=
"avatar"
:src=
"localAvatarUrl || babyInfo?.content?.babyAvatar ||
<image
class=
"avatar"
:src=
"babyInfo?.content?.babyAvatar ||
$baseUrl + 'common/default_avatar.png'
"
mode=
"widthFix"
/>
</button>
</view>
<button
v-if=
"!cfgStatus.isRegister"
type=
"primary"
class=
"avatar-container"
@
click=
"clickRegisterShield"
/>
<image
class=
"avatar-modify"
:src=
"$baseUrl + 'my/icon_modify.png'"
mode=
"aspectFit"
lazy-load=
"false"
/>
...
...
@@ -45,7 +38,7 @@
xcxClick: '我的页面点击',
pageName: '我的页面',
buttonName: '宝宝信息切换',
}"
>
}">
<text
class=
"nickname"
@
click=
"handleEditProfile"
>
{{
babyInfo
?.
babyStage
===
0
?
"备孕"
...
...
@@ -113,7 +106,7 @@
<!-- 完成任务模块 -->
<view
class=
"task-module"
v-if=
"
!cfgStatus.isRegister ||
(babyInfo?.allBabyBaseInfo && babyInfo.allBabyBaseInfo.length > 0)"
>
v-if=
"
cfgStatus.isRegister &&
(babyInfo?.allBabyBaseInfo && babyInfo.allBabyBaseInfo.length > 0)"
>
<image
class=
"task-guide-bg"
:src=
"$baseUrl + 'homepage/Q3Res/my_taskGuideBg.png'"
></image>
<image
class=
"task-do-btn"
:src=
"$baseUrl + 'homepage/Q3Res/my_taskDoBtn.png'"
@
tap=
"handleTaskClick"
></image>
</view>
...
...
@@ -285,8 +278,6 @@ import { useUserStore } from "@/stores/user";
import
{
usePageCfgStore
}
from
"@/stores/pageCfg"
;
import
{
jump
,
JumpType
}
from
"@/utils"
;
import
{
getHealthField
}
from
"@/api/common"
;
import
{
uploadImage
}
from
"@/api/common"
;
import
{
updateBabyInfo
}
from
"@/api/user"
;
import
{
hideLoading
,
showLoading
}
from
"../utils"
;
import
md
from
"../md.js"
;
import
{
onShow
}
from
'@dcloudio/uni-app'
;
...
...
@@ -319,13 +310,15 @@ const points = ref(0);
const
babyId
=
ref
(
0
);
// 本地头像 URL,用于临时显示上传后的头像
const
localAvatarUrl
=
ref
(
''
);
// 本地背景图片 URL,用于临时显示上传后的背景图
const
localBackgroundImg
=
ref
(
''
);
const
handleTaskClick
=
async
()
=>
{
// 添加点击埋点
md
.
sensorComponentLogTake
({
xcxComponentClick
:
"true"
,
pageName
:
"我的页面"
,
componentName
:
"做任务赚更多积分"
,
componentContent
:
"去做任务"
});
// 检查登录状态
if
(
!
cfgStatus
.
value
.
isRegister
)
{
// 未登录,跳转到登录注册页面
...
...
@@ -387,6 +380,14 @@ const navigateToCoupon = () => {
// 需要登录的优惠券页面跳转
const
navigateToCouponWithLogin
=
()
=>
{
// 添加点击埋点
md
.
sensorComponentLogTake
({
xcxComponentClick
:
"true"
,
pageName
:
"我的页面"
,
componentName
:
"拓展工具"
,
componentContent
:
"我的优惠券"
});
// 检查登录状态
if
(
!
cfgStatus
.
value
.
isRegister
)
{
// 未登录,跳转到登录注册页面
...
...
@@ -419,6 +420,26 @@ const navigateTo = (url) => {
const
navigateToWithLogin
=
(
url
)
=>
{
console
.
warn
(
'navigateToWithLogin'
,
url
);
console
.
warn
(
'cfgStatus.value.isRegister'
,
cfgStatus
.
value
.
isRegister
);
// 添加点击埋点 - 根据 URL 判断是哪个菜单项
let
componentContent
=
''
;
if
(
url
.
includes
(
'/v3/orderList/orderList'
))
{
componentContent
=
'我的订单'
;
}
else
if
(
url
.
includes
(
'/v3/addressList/addressList'
))
{
componentContent
=
'收货地址管理'
;
}
else
if
(
url
.
includes
(
'/v3/more/index'
))
{
componentContent
=
'更多'
;
}
if
(
componentContent
)
{
md
.
sensorComponentLogTake
({
xcxComponentClick
:
"true"
,
pageName
:
"我的页面"
,
componentName
:
"拓展工具"
,
componentContent
:
componentContent
});
}
// 检查登录状态
if
(
!
cfgStatus
.
value
.
isRegister
)
{
// 未登录,跳转到登录注册页面
...
...
@@ -532,72 +553,6 @@ const handleEditProfile = (e) => {
}
};
// 选择头像
const
onChooseAvatar
=
async
(
e
)
=>
{
showLoading
(
'上传中...'
);
try
{
const
fs
=
uni
.
getFileSystemManager
();
const
base64
=
"data:image/jpeg;base64,"
+
fs
.
readFileSync
(
e
.
detail
.
avatarUrl
,
"base64"
);
const
res
=
await
uploadImage
(
base64
);
if
(
res
.
success
)
{
// 立即更新本地显示的头像
localAvatarUrl
.
value
=
res
.
data
.
url
;
// 获取当前选中的宝宝信息并更新到服务器
const
selectedBaby
=
userStore
.
babyInfo
?.
allBabyBaseInfo
?.
find
(
(
item
)
=>
item
.
selected
);
if
(
selectedBaby
)
{
const
updateData
=
{
id
:
selectedBaby
.
id
,
babyAvatar
:
res
.
data
.
url
,
};
const
updateRes
=
await
updateBabyInfo
(
updateData
);
if
(
updateRes
.
success
)
{
// 刷新用户信息
await
userStore
.
loadBabyInfo
();
// 清空本地临时头像,使用更新后的 babyInfo
localAvatarUrl
.
value
=
''
;
uni
.
showToast
({
title
:
"头像更新成功"
,
icon
:
"success"
,
});
}
else
{
uni
.
showToast
({
title
:
updateRes
.
message
||
"更新失败"
,
icon
:
"none"
,
});
}
}
else
{
uni
.
showToast
({
title
:
"未找到宝宝信息"
,
icon
:
"none"
,
});
}
}
else
{
uni
.
showToast
({
title
:
res
.
message
,
icon
:
"none"
,
});
}
}
catch
(
error
)
{
console
.
error
(
"头像选择失败:"
,
error
);
uni
.
showToast
({
title
:
"头像选择失败"
,
icon
:
"none"
,
});
}
finally
{
hideLoading
();
}
};
const
onRegisterConfirm
=
async
()
=>
{
await
pageCfgStore
.
fetchCfg
();
// 只调用一次initData,loadMemberInfo已在initData内部处理
...
...
@@ -621,6 +576,27 @@ const handleWheelChange = (val) => {
const
initExposure
=
()
=>
{
// 添加宝宝信息引导模块曝光埋点
if
(
cfgStatus
.
value
.
isRegister
&&
(
!
babyInfo
.
value
?.
allBabyBaseInfo
||
babyInfo
.
value
?.
allBabyBaseInfo
?.
length
===
0
))
{
md
.
sensorComponentLogTake
({
xcxComponentExposure
:
"true"
,
pageName
:
"我的页面"
,
componentName
:
"添加宝宝信息引导"
,
componentContent
:
"添加宝宝信息引导"
});
}
// 添加做任务赚更多积分模块曝光埋点
if
(
!
cfgStatus
.
value
.
isRegister
||
(
babyInfo
.
value
?.
allBabyBaseInfo
&&
babyInfo
.
value
?.
allBabyBaseInfo
?.
length
>
0
))
{
md
.
sensorComponentLogTake
({
xcxComponentExposure
:
"true"
,
pageName
:
"我的页面"
,
componentName
:
"做任务赚更多积分"
,
componentContent
:
"去做任务"
});
}
md
.
sensorComponentLogTake
({
xcxComponentExposure
:
"true"
,
pageName
:
"我的页面"
,
...
...
@@ -666,6 +642,32 @@ const initExposure = () => {
componentContent
:
babyInfo
.
value
.
babyStage
==
2
?
"月龄滑动切换"
:
"孕周滑动切换"
});
// 添加拓展工具菜单曝光埋点
md
.
sensorComponentLogTake
({
xcxComponentExposure
:
"true"
,
pageName
:
"我的页面"
,
componentName
:
"拓展工具"
,
componentContent
:
"我的订单"
});
md
.
sensorComponentLogTake
({
xcxComponentExposure
:
"true"
,
pageName
:
"我的页面"
,
componentName
:
"拓展工具"
,
componentContent
:
"收货地址管理"
});
md
.
sensorComponentLogTake
({
xcxComponentExposure
:
"true"
,
pageName
:
"我的页面"
,
componentName
:
"拓展工具"
,
componentContent
:
"我的优惠券"
});
md
.
sensorComponentLogTake
({
xcxComponentExposure
:
"true"
,
pageName
:
"我的页面"
,
componentName
:
"拓展工具"
,
componentContent
:
"更多"
});
...
...
@@ -676,6 +678,35 @@ onShow(async () => {
await
userStore
.
loadMemberInfo
();
points
.
value
=
userStore
.
memberInfo
?.
points
;
console
.
log
(
'userStore.memberInfo='
,
userStore
.
memberInfo
)
// 添加拓展工具菜单曝光埋点
md
.
sensorComponentLogTake
({
xcxComponentExposure
:
"true"
,
pageName
:
"我的页面"
,
componentName
:
"拓展工具"
,
componentContent
:
"我的订单"
});
md
.
sensorComponentLogTake
({
xcxComponentExposure
:
"true"
,
pageName
:
"我的页面"
,
componentName
:
"拓展工具"
,
componentContent
:
"收货地址管理"
});
md
.
sensorComponentLogTake
({
xcxComponentExposure
:
"true"
,
pageName
:
"我的页面"
,
componentName
:
"拓展工具"
,
componentContent
:
"我的优惠券"
});
md
.
sensorComponentLogTake
({
xcxComponentExposure
:
"true"
,
pageName
:
"我的页面"
,
componentName
:
"拓展工具"
,
componentContent
:
"更多"
});
console
.
warn
(
"AAAAAAAA"
)
})
// 获取用户信息
...
...
@@ -798,6 +829,13 @@ async function onSelectBaby(baby) {
}
function
handleAddBabyInfoClick
()
{
// 添加点击埋点
md
.
sensorComponentLogTake
({
xcxComponentClick
:
"true"
,
pageName
:
"我的页面"
,
componentName
:
"添加宝宝信息引导"
,
componentContent
:
"添加宝宝信息引导"
});
// 显示RegisterLayer弹窗
showRegisterLayer
.
value
=
true
;
}
...
...
@@ -829,95 +867,6 @@ const handleOpenClick = () => {
cfgStatus
.
value
.
openBabyCardDesc
=
!
cfgStatus
.
value
.
openBabyCardDesc
;
};
// 上传背景图片
const
handleUploadBackground
=
async
(
e
)
=>
{
// 检查登录状态
if
(
!
cfgStatus
.
value
.
isRegister
)
{
return
;
}
md
.
sensorLog
(
e
);
// 唤起图片选择器
uni
.
chooseImage
({
count
:
1
,
sizeType
:
[
"original"
,
"compressed"
],
sourceType
:
[
"album"
,
"camera"
],
success
:
async
(
res
)
=>
{
showLoading
(
'上传中...'
);
try
{
const
tempFilePath
=
res
.
tempFilePaths
[
0
];
const
fs
=
uni
.
getFileSystemManager
();
const
base64
=
"data:image/jpeg;base64,"
+
fs
.
readFileSync
(
tempFilePath
,
"base64"
);
const
uploadRes
=
await
uploadImage
(
base64
);
if
(
uploadRes
.
success
)
{
// 立即更新本地显示的背景图
localBackgroundImg
.
value
=
uploadRes
.
data
.
url
;
// 获取当前选中的宝宝信息并更新到服务器
const
selectedBaby
=
userStore
.
babyInfo
?.
allBabyBaseInfo
?.
find
(
(
item
)
=>
item
.
selected
);
if
(
selectedBaby
)
{
const
updateData
=
{
id
:
selectedBaby
.
id
,
backgroundImg
:
uploadRes
.
data
.
url
,
};
const
updateRes
=
await
updateBabyInfo
(
updateData
);
if
(
updateRes
.
success
)
{
// 刷新用户信息
await
userStore
.
loadBabyInfo
();
// 清空本地临时背景图,使用更新后的 babyInfo
localBackgroundImg
.
value
=
''
;
uni
.
showToast
({
title
:
"背景更新成功"
,
icon
:
"success"
,
});
}
else
{
uni
.
showToast
({
title
:
updateRes
.
message
||
"更新失败"
,
icon
:
"none"
,
});
}
}
else
{
uni
.
showToast
({
title
:
"未找到宝宝信息"
,
icon
:
"none"
,
});
}
}
else
{
uni
.
showToast
({
title
:
uploadRes
.
message
||
"上传失败"
,
icon
:
"none"
,
});
}
}
catch
(
error
)
{
console
.
error
(
"背景图片上传失败:"
,
error
);
uni
.
showToast
({
title
:
"背景图片上传失败"
,
icon
:
"none"
,
});
}
finally
{
hideLoading
();
}
},
fail
:
(
err
)
=>
{
console
.
error
(
"选择图片失败:"
,
err
);
uni
.
showToast
({
title
:
"选择图片失败"
,
icon
:
"none"
,
});
}
});
};
// 页面加载
onMounted
(
async
()
=>
{
md
.
sensorLogTake
({
...
...
@@ -1113,17 +1062,6 @@ defineExpose({});
top: 32rpx;
z-index: 1;
.avatar-wrapper {
display: flex;
align-items: center;
justify-content: center;
padding: 0;
border: none;
background: transparent;
width: 100%;
height: 100%;
}
.avatar {
width: 100%;
height: 100%;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment