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
d781fa83
Commit
d781fa83
authored
Nov 05, 2025
by
王炽
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
66666
parent
5639f6e0
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
137 additions
and
24 deletions
+137
-24
user.js
api/user.js
+8
-1
saveBabyExtra.json
mock/saveBabyExtra.json
+8
-0
My.vue
views/My.vue
+121
-23
No files found.
api/user.js
View file @
d781fa83
...
...
@@ -74,3 +74,10 @@ export const getExchangeList = (params = {}) => api.get('/c/user/exchange/list',
* @returns
*/
export
const
getOrderDetail
=
(
data
)
=>
api
.
get
(
'/c/order/detail'
,
data
);
/**
* 保存宝宝额外信息
* @param {Object} data - 宝宝额外信息
* @returns {Promise} 接口响应
*/
export
const
saveBabyExtra
=
(
data
)
=>
api
.
post
(
'/c/user/saveBabyExtra'
,
data
);
\ No newline at end of file
mock/saveBabyExtra.json
0 → 100644
View file @
d781fa83
{
"code"
:
"aliqua dolor"
,
"message"
:
"ullamco veniam sunt nostrud aute"
,
"ok"
:
true
,
"success"
:
false
,
"data"
:
"dolor ipsum elit"
}
views/My.vue
View file @
d781fa83
...
...
@@ -24,15 +24,33 @@
<view
class=
"user-info"
:style=
"
{ 'min-height': cfgStatus.showDetail ? '343rpx' : '168rpx' }">
<view
class=
"user-header"
>
<view
class=
"avatar-container"
>
<button
class=
"avatar-wrapper"
:data-log=
"
{
<button
v-if=
"canChooseAvatar"
class=
"avatar-wrapper"
:data-log=
"
{
xcxClick: '我的页面点击',
pageName: '我的页面',
buttonName: '个人信息修改',
}" open-type="chooseAvatar" @chooseavatar="onChooseAvatar">
}"
open-type="chooseAvatar"
@chooseavatar="onChooseAvatar">
<image
class=
"avatar"
:src=
"localAvatarUrl || babyInfo?.content?.babyAvatar ||
$baseUrl + 'common/default_avatar.png'
"
mode=
"widthFix"
/>
</button>
<view
v-else
class=
"avatar-wrapper"
:data-log=
"
{
xcxClick: '我的页面点击',
pageName: '我的页面',
buttonName: '个人信息修改',
}"
@click="handleAvatarClick">
<image
class=
"avatar"
:src=
"localAvatarUrl || babyInfo?.content?.babyAvatar ||
$baseUrl + 'common/default_avatar.png'
"
mode=
"widthFix"
/>
</view>
</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"
/>
...
...
@@ -287,6 +305,8 @@ import md from "../md.js";
import
{
onShow
}
from
'@dcloudio/uni-app'
;
import
{
useIntegralStore
}
from
"../stores/integral.js"
;
import
{
useGlobalStore
}
from
"../stores/global.js"
;
import
{
uploadImage
}
from
"../api/common.js"
;
import
{
saveBabyExtra
}
from
"../api/user.js"
;
const
{
proxy
}
=
getCurrentInstance
();
const
$baseUrl
=
proxy
.
$baseUrl
;
...
...
@@ -307,6 +327,13 @@ const toolList = computed(() => pageCfgStore?.toolList || []);
const
babyInfo
=
computed
(()
=>
userStore
?.
babyInfo
||
{});
// 判断是否可以使用选择头像功能
const
canChooseAvatar
=
computed
(()
=>
{
return
cfgStatus
.
value
.
isRegister
&&
userStore
.
babyInfo
?.
allBabyBaseInfo
&&
userStore
.
babyInfo
?.
allBabyBaseInfo
?.
length
>
0
;
});
const
showRegisterLayer
=
ref
(
false
);
const
showBabySwitcher
=
ref
(
false
);
...
...
@@ -532,9 +559,7 @@ const handleToolClick = async (item) => {
const
handleEditProfile
=
(
e
)
=>
{
if
(
!
cfgStatus
.
value
.
isRegister
||
!
userStore
.
userInfo
||
if
(
!
userStore
.
userInfo
||
JSON
.
stringify
(
userStore
.
userInfo
)
===
"{}"
)
{
return
;
...
...
@@ -548,6 +573,21 @@ const handleEditProfile = (e) => {
componentContent
:
"资料编辑"
})
// 检查登录状态
if
(
!
cfgStatus
.
value
.
isRegister
)
{
// 未登录,跳转到登录注册页面
jump
({
type
:
JumpType
.
INNER
,
url
:
"/pages/activity/register"
,
});
return
;
}
if
(
!
userStore
.
babyInfo
?.
allBabyBaseInfo
||
userStore
.
babyInfo
?.
allBabyBaseInfo
?.
length
===
0
)
{
navigateTo
(
"/pages/person/person?type=add"
);
return
;
}
const
type
=
userStore
.
babyInfo
?.
allBabyBaseInfo
?.
length
==
0
?
"add"
:
"edit"
;
babyId
.
value
=
userStore
.
babyInfo
?.
allBabyBaseInfo
?.
find
(
(
item
)
=>
item
.
selected
...
...
@@ -564,8 +604,35 @@ const handleEditProfile = (e) => {
};
// 头像点击事件(当不满足选择头像条件时)
const
handleAvatarClick
=
(
e
)
=>
{
md
.
sensorLog
(
e
);
md
.
sensorComponentLogTake
({
xcxComponentClick
:
"true"
,
pageName
:
"我的页面"
,
componentName
:
"资料编辑"
,
componentContent
:
"资料编辑"
})
// 检查登录状态
if
(
!
cfgStatus
.
value
.
isRegister
)
{
// 未登录,跳转到登录注册页面
jump
({
type
:
JumpType
.
INNER
,
url
:
"/pages/activity/register"
,
});
return
;
}
if
(
!
userStore
.
babyInfo
?.
allBabyBaseInfo
||
userStore
.
babyInfo
?.
allBabyBaseInfo
?.
length
===
0
)
{
navigateTo
(
"/pages/person/person?type=add"
);
return
;
}
};
// 选择头像
const
onChooseAvatar
=
async
(
e
)
=>
{
showLoading
(
'上传中...'
);
md
.
sensorLog
(
e
);
md
.
sensorComponentLogTake
({
...
...
@@ -575,6 +642,8 @@ const onChooseAvatar = async (e) => {
componentContent
:
"资料编辑"
})
try
{
const
fs
=
uni
.
getFileSystemManager
();
const
base64
=
...
...
@@ -590,13 +659,23 @@ const onChooseAvatar = async (e) => {
(
item
)
=>
item
.
selected
);
console
.
log
(
"selectedBaby-==="
,
selectedBaby
);
if
(
selectedBaby
)
{
// const updateData = {
// id: selectedBaby.id,
// babyAvatar: res.data.url,
// };
// const updateRes = await updateBabyInfo(updateData);
console
.
log
(
"userStore.babyInfo?.content?.id===="
,
userStore
.
babyInfo
?.
content
);
const
updateData
=
{
id
:
selectedBaby
.
id
,
babyAvatar
:
res
.
data
.
url
,
}
;
id
:
userStore
.
babyInfo
?.
content
?
.
id
,
babyAvatar
:
res
.
data
.
url
}
const
updateRes
=
await
updateBabyInfo
(
updateData
);
const
updateRes
=
await
saveBabyExtra
(
updateData
);
if
(
updateRes
.
success
)
{
// 刷新用户信息
...
...
@@ -953,11 +1032,6 @@ const handleOpenClick = () => {
// 上传背景图片
const
handleUploadBackground
=
async
(
e
)
=>
{
// 检查登录状态
if
(
!
cfgStatus
.
value
.
isRegister
)
{
return
;
}
md
.
sensorLog
(
e
);
...
...
@@ -968,6 +1042,22 @@ const handleUploadBackground = async (e) => {
componentContent
:
"资料编辑"
})
// 检查登录状态
if
(
!
cfgStatus
.
value
.
isRegister
)
{
// 未登录,跳转到登录注册页面
jump
({
type
:
JumpType
.
INNER
,
url
:
"/pages/activity/register"
,
});
return
;
}
if
(
!
userStore
.
babyInfo
?.
allBabyBaseInfo
||
userStore
.
babyInfo
?.
allBabyBaseInfo
?.
length
===
0
)
{
navigateTo
(
"/pages/person/person?type=add"
);
return
;
}
// 唤起图片选择器
uni
.
chooseImage
({
count
:
1
,
...
...
@@ -993,12 +1083,19 @@ const handleUploadBackground = async (e) => {
);
if
(
selectedBaby
)
{
// const updateData = {
// id: selectedBaby.id,
// backgroundImg: uploadRes.data.url,
// };
// const updateRes = await updateBabyInfo(updateData);
console
.
log
(
"userStore.babyInfo?.content?.id===="
,
userStore
.
babyInfo
);
const
updateData
=
{
id
:
selectedBaby
.
id
,
backgroundImg
:
uploadRes
.
data
.
url
,
}
;
id
:
userStore
.
babyInfo
?.
content
?
.
id
,
backgroundImg
:
res
.
data
.
url
}
const
updateRes
=
await
updateBabyInfo
(
updateData
);
const
updateRes
=
await
saveBabyExtra
(
updateData
);
if
(
updateRes
.
success
)
{
// 刷新用户信息
...
...
@@ -1252,6 +1349,7 @@ defineExpose({});
background: transparent;
width: 100%;
height: 100%;
cursor: pointer;
}
.avatar {
...
...
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