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
e07eccec
Commit
e07eccec
authored
Sep 08, 2025
by
spc
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
master
parent
27e1aa78
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
155 additions
and
99 deletions
+155
-99
XingmaLabDetailPage.vue
pages/XingmaLabDetailPage/XingmaLabDetailPage.vue
+24
-8
xingmaLab.vue
pages/xingmaLab/xingmaLab.vue
+100
-91
user.js
stores/user.js
+31
-0
No files found.
pages/XingmaLabDetailPage/XingmaLabDetailPage.vue
View file @
e07eccec
...
...
@@ -52,7 +52,9 @@
<button
open-type=
"getPhoneNumber"
@
getphonenumber=
"(e) => onGetPhoneNumber(e, 'like')"
class=
"auth-like-btn phone-auth-btn-cover"
></button>
<!-- 分享按钮授权覆盖 - 移除这个,让分享按钮正常工作 -->
<!-- 分享按钮授权覆盖 -->
<button
open-type=
"getPhoneNumber"
@
getphonenumber=
"(e) => onGetPhoneNumber(e, 'share')"
class=
"auth-share-btn phone-auth-btn-cover"
></button>
</div>
</div>
</view>
...
...
@@ -72,7 +74,7 @@ defineOptions({
})
// 响应式数据
const
collectionNumber
=
ref
(
'
123456789
'
)
const
collectionNumber
=
ref
(
''
)
const
recordId
=
ref
(
''
)
// 添加记录ID的响应式变量
const
detailData
=
ref
({
content
:
''
,
...
...
@@ -267,8 +269,8 @@ const handleGoBack = () => {
}
}
//
生命周期
onMounted
(
async
(
options
)
=>
{
//
页面初始化逻辑
const
initPage
=
async
(
)
=>
{
md
.
sensorComponentLogTake
({
xcxComponentExposure
:
"true"
,
...
...
@@ -284,7 +286,6 @@ onMounted(async (options) => {
componentContent
:
"分享"
});
// 调用 home 接口获取登录状态
await
homeStore
.
loadHomeInfo
()
...
...
@@ -297,7 +298,6 @@ onMounted(async (options) => {
recordId
.
value
=
id
// 立即保存ID,确保分享时能获取到
await
fetchDetailData
(
id
)
md
.
sensorComponentLogTake
({
xcxComponentExposure
:
"true"
,
pageName
:
"星妈lab-藏品详情页"
,
...
...
@@ -305,7 +305,7 @@ onMounted(async (options) => {
componentContent
:
"藏品详情页+"
+
detailData
.
value
.
content
});
}
else
{
console
.
warn
(
'⚠️ 未获取到页面参数 id'
,
options
,
currentPage
.
options
)
console
.
warn
(
'⚠️ 未获取到页面参数 id'
,
currentPage
.
options
)
// uni.showToast({
// title: '参数错误',
// icon: 'none'
...
...
@@ -323,6 +323,22 @@ onMounted(async (options) => {
withShareTicket
:
true
,
menus
:
[
'shareAppMessage'
]
})
}
// 生命周期
onMounted
(
async
(
options
)
=>
{
console
.
log
(
'星妈lab详情页面已加载'
)
// 先进行自动登录获取基础信息,登录成功后执行页面初始化
try
{
console
.
log
(
'开始执行 normalAutoLogin...'
)
await
userStore
.
normalAutoLogin
(
initPage
)
console
.
log
(
'normalAutoLogin 完成'
)
}
catch
(
error
)
{
console
.
error
(
'normalAutoLogin 失败:'
,
error
)
// 即使登录失败也执行页面初始化
await
initPage
()
}
})
// 定义分享函数
...
...
pages/xingmaLab/xingmaLab.vue
View file @
e07eccec
...
...
@@ -29,8 +29,11 @@
<view
class=
"item_cangguan_img1"
:style=
"`background-image: url($
{item.imgUrl}); background-size: 707rpx auto; background-repeat: no-repeat;`"
mode="widthFix">
<image
class=
"item_cangguan_img"
:src=
"`$
{item.imgUrl}`" mode="widthFix" @load="(e) => handleImageLoad(e, item, index)">
</image>
<image
class=
"item_cangguan_img_up"
:src=
"`$
{item.imgUrl}`" mode="aspectFill" :style="`width: ${item.targetWidth - 30}rpx; height: ${item.targetHeight - 120}rpx;`">
</image>
<image
class=
"item_cangguan_img"
:src=
"`$
{item.imgUrl}`" mode="widthFix"
@load="(e) => handleImageLoad(e, item, index)">
</image>
<image
class=
"item_cangguan_img_up"
:src=
"`$
{item.imgUrl}`" mode="aspectFill"
:style="`width: ${item.targetWidth - 30}rpx; height: ${item.targetHeight - 120}rpx;`">
</image>
</view>
<view
class=
"item_cangguan_bottom"
>
...
...
@@ -357,19 +360,19 @@ onShow(async () => {
console
.
log
(
'currentPage='
,
currentPage
);
// console.log('onshow')
//1收藏,-1取消收藏,不存在刷新页面
if
(
!
isFavorite
)
{
if
(
!
isFavorite
)
{
await
xingmaLabStore
.
loadXingmaInfo
();
await
reloadCangguanList
();
await
reloadCangpinList
();
await
reloadShoucangList
();
}
else
{
if
(
isFavorite
==
1
)
{
}
else
{
if
(
isFavorite
==
1
)
{
currentItem
.
value
.
collection
=
true
;
}
else
{
if
(
currentItemType
.
value
==
'cangguan'
)
{
}
else
{
if
(
currentItemType
.
value
==
'cangguan'
)
{
currentItem
.
value
.
collection
=
false
;
}
else
{
}
else
{
shoucangList
.
value
.
splice
(
currentItem
.
value
,
1
)
}
}
...
...
@@ -477,9 +480,15 @@ const convertDobuleList = (list) => {
// 方法
const
handleBack
=
()
=>
{
if
(
getCurrentPages
().
length
>
1
)
{
uni
.
navigateBack
({
delta
:
1
})
}
else
{
uni
.
redirectTo
({
url
:
'/pages/index/index?pageType=my'
})
}
}
const
switchTab
=
(
tab
)
=>
{
...
...
@@ -491,8 +500,8 @@ const switchTab = (tab) => {
//我的藏品/我的收藏tab
const
switchSubTab
=
async
(
subTab
)
=>
{
if
(
subTab
==
'collections'
)
{
if
(
currentFrontNavType
!=
'collections'
)
{
if
(
subTab
==
'collections'
)
{
if
(
currentFrontNavType
!=
'collections'
)
{
currentFrontNavType
=
'collections'
md
.
sensorComponentLogTake
({
...
...
@@ -506,8 +515,8 @@ const switchSubTab = async (subTab) => {
}
}
else
if
(
subTab
==
'favorites'
)
{
if
(
currentFrontNavType
!=
'favorites'
)
{
}
else
if
(
subTab
==
'favorites'
)
{
if
(
currentFrontNavType
!=
'favorites'
)
{
md
.
sensorComponentLogTake
({
xcxComponentClick
:
"true"
,
pageName
:
"星妈lab首页"
,
...
...
@@ -570,7 +579,7 @@ const handleBottomNavClick = async (navType) => {
// 点击"星妈会藏馆"时,切换到藏馆tab,展示单列列表
activeTab
.
value
=
'cangguan'
if
(
currentButtomNavType
!=
'cangguan'
)
{
if
(
currentButtomNavType
!=
'cangguan'
)
{
md
.
sensorComponentLogTake
({
xcxComponentExposure
:
"true"
,
pageName
:
"星妈lab首页"
,
...
...
@@ -600,10 +609,10 @@ const handleBottomNavClick = async (navType) => {
// 点击"我的藏品"时,切换到我的藏馆tab,默认展示我的藏品
activeTab
.
value
=
'wodecangguan'
if
(
currentButtomNavType
!=
'wodecangguan'
)
{
if
(
currentButtomNavType
!=
'wodecangguan'
)
{
currentButtomNavType
=
'wodecangguan'
;
if
(
currentFrontNavType
==
''
)
{
if
(
!
(
cangpinList
.
value
&&
cangpinList
.
value
.
length
>
0
))
{
if
(
currentFrontNavType
==
''
)
{
if
(
!
(
cangpinList
.
value
&&
cangpinList
.
value
.
length
>
0
))
{
md
.
sensorComponentLogTake
({
xcxComponentExposure
:
"true"
,
pageName
:
"星妈lab-我的藏品页"
,
...
...
@@ -625,10 +634,10 @@ const handleBottomNavClick = async (navType) => {
currentFrontNavType
=
'collections'
// await reloadCangpinList();
}
else
{
}
else
{
currentFrontNavType
=
activeSubTab
.
value
;
if
(
activeSubTab
.
value
==
'collections'
)
{
if
(
!
(
cangpinList
.
value
&&
cangpinList
.
value
.
length
>
0
))
{
if
(
activeSubTab
.
value
==
'collections'
)
{
if
(
!
(
cangpinList
.
value
&&
cangpinList
.
value
.
length
>
0
))
{
md
.
sensorComponentLogTake
({
xcxComponentExposure
:
"true"
,
...
...
@@ -648,7 +657,7 @@ const handleBottomNavClick = async (navType) => {
// }
// await reloadCangpinList();
//走onshow刷新,因为去发布按钮埋点
}
else
{
}
else
{
// md.sensorComponentLogTake({
// xcxComponentExposure: "true",
// pageName: "星妈lab-我的藏品页",
...
...
@@ -729,12 +738,12 @@ const handlePublish = () => {
const
handleNoTimeButtonClick
=
()
=>
{
showNoTimePopup
.
value
=
false
// // 显示更详细的发布次数信息
// const { currentMonthPublishCount, maxPublishCount, remainingPublishCount } = xingmaLabStore.xingmaInfo
// uni.showToast({
// title: `本月已发布${currentMonthPublishCount}次,剩余${remainingPublishCount}次`,
// icon: 'none',
// duration: 3000
// // 显示更详细的发布次数信息
// const { currentMonthPublishCount, maxPublishCount, remainingPublishCount } = xingmaLabStore.xingmaInfo
// uni.showToast({
// title: `本月已发布${currentMonthPublishCount}次,剩余${remainingPublishCount}次`,
// icon: 'none',
// duration: 3000
// })
}
</
script
>
...
...
stores/user.js
View file @
e07eccec
...
...
@@ -306,6 +306,37 @@ export const useUserStore = defineStore("userInfo", {
});
},
/**
*
* @param {sy使用}
* @returns
*/
async
normalAutoLogin
(
cb
=
null
)
{
uni
.
login
({
provider
:
"weixin"
,
success
:
async
(
res
)
=>
{
console
.
log
(
"normalAutoLogin"
,
res
);
if
(
res
.
errMsg
===
"login:ok"
)
{
const
{
data
}
=
await
autoLoginByCode
(
res
.
code
);
console
.
log
(
"normalAutoLogin"
,
data
);
// 如果登录成功,获取用户信息和宝宝信息,更新到state中,方便全局使用
if
(
data
&&
data
.
cuk
)
{
globalStore
.
setCuk
(
data
.
cuk
,
data
.
openId
,
data
.
unionId
);
cb
&&
cb
();
}
}
else
{
uni
.
showToast
({
title
:
res
.
errMsg
,
icon
:
"error"
,
});
}
md
.
sensors
.
init
();
},
});
},
async
createBabyInfo
(
babyInfo
)
{
console
.
log
(
"createBabyInfo:"
,
babyInfo
);
const
res
=
await
updateBabyInfo
(
babyInfo
);
...
...
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