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
a1d3a6a9
Commit
a1d3a6a9
authored
Jun 17, 2025
by
tao.huang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: 宝宝昵称前端缓存
parent
c2fe95b8
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
32 additions
and
4 deletions
+32
-4
my.js
mock/my.js
+2
-2
person.vue
pages/person/person.vue
+4
-1
user.js
stores/user.js
+25
-0
index.js
utils/index.js
+1
-1
No files found.
mock/my.js
View file @
a1d3a6a9
...
...
@@ -26,8 +26,8 @@ export const myObj = {
"title"
:
"奶娃宝典"
,
"desc"
:
"奶娃宝典"
,
"link"
:
{
"type"
:
3
,
"url"
:
"
https://mom.feihe.com/babyWikipedia
"
,
"type"
:
1
,
"url"
:
"
/pages/library/ContentLibrary
"
,
"extra"
:
{}
}
},
...
...
pages/person/person.vue
View file @
a1d3a6a9
...
...
@@ -367,7 +367,7 @@ const formItems = ref([
required
:
false
,
placeholder
:
"未选择"
,
type
:
"picker"
,
range
:
[
"
纯母乳"
,
"混合喂养"
,
"纯奶粉
"
],
range
:
[
"
奶粉喂养"
,
"母乳喂养"
,
"母乳奶粉混合喂养
"
],
mode
:
"custom"
,
},
{
...
...
@@ -566,6 +566,9 @@ const onSubmit = async (e) => {
hideLoading
();
if
(
res
.
success
)
{
data
?.
id
&&
userStore
.
setBabyNickCache
(
data
?.
id
,
formData
.
value
.
babyName
);
uni
.
showToast
({
title
:
"提交成功"
,
icon
:
"success"
,
...
...
stores/user.js
View file @
a1d3a6a9
...
...
@@ -20,6 +20,7 @@ export const useUserStore = defineStore("userInfo", {
userInfo
:
null
,
babyInfo
:
null
,
memberInfo
:
null
,
babyNickCache
:
[],
};
},
actions
:
{
...
...
@@ -103,6 +104,16 @@ export const useUserStore = defineStore("userInfo", {
}
},
setBabyNickCache
(
id
,
name
)
{
const
findIndex
=
this
.
babyNickCache
.
findIndex
((
item
)
=>
item
.
id
===
id
);
console
.
log
(
"this.babyNickCache"
,
findIndex
);
if
(
findIndex
>
-
1
)
{
this
.
babyNickCache
[
findIndex
].
name
=
name
;
}
else
{
this
.
babyNickCache
.
push
({
id
,
name
});
}
},
/**
* 获取宝宝信息
*/
...
...
@@ -111,6 +122,20 @@ export const useUserStore = defineStore("userInfo", {
console
.
log
(
"babyInfo"
,
data
);
if
(
data
?.
memberId
!==
"not_login"
)
{
this
.
babyInfo
=
data
;
console
.
log
(
"this.11111"
,
this
.
babyNickCache
,
data
?.
content
?.
id
);
const
findItem
=
this
.
babyNickCache
.
find
(
(
item
)
=>
item
.
id
==
data
?.
content
?.
id
);
if
(
data
?.
content
?.
id
&&
findItem
)
{
this
.
babyInfo
.
babyName
=
findItem
.
name
;
this
.
babyInfo
.
allBabyBaseInfo
.
forEach
((
item
)
=>
{
if
(
item
.
id
==
data
?.
content
?.
id
)
{
item
.
babyName
=
findItem
.
name
;
}
});
}
}
},
...
...
utils/index.js
View file @
a1d3a6a9
...
...
@@ -29,7 +29,7 @@ export function jump({ type, url, extra = {} }) {
appId
:
extra
.
appId
||
""
,
path
:
url
,
extraData
:
extra
.
extraData
||
{},
envVersion
:
extra
.
envVersion
||
"
trial
"
,
envVersion
:
extra
.
envVersion
||
"
release
"
,
success
:
extra
.
success
,
fail
:
extra
.
fail
,
};
...
...
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