From 402de12fb749d17c320be849def6b1e8e6c7edfa Mon Sep 17 00:00:00 2001
From: "1054425342@qq.com" <1054425342@qq.com>
Date: Mon, 28 Jul 2025 11:30:18 +0800
Subject: [PATCH] =?UTF-8?q?feat=EF=BC=9A=E9=A6=96=E9=A1=B5=E9=9D=99?=
=?UTF-8?q?=E6=80=81?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
components/DynamicIsland.vue | 36 ++++++++++++++++++++++++-----------
components/ProductSection.vue | 11 ++++++++---
pages/index/index.vue | 12 +++---------
3 files changed, 36 insertions(+), 23 deletions(-)
diff --git a/components/DynamicIsland.vue b/components/DynamicIsland.vue
index 812b1dd..32f28c2 100644
--- a/components/DynamicIsland.vue
+++ b/components/DynamicIsland.vue
@@ -19,9 +19,7 @@
{{ title }}
-
-
-
+
@@ -70,7 +68,7 @@ export default {
},
title: {
type: String,
- default: "正在播放音乐",
+ default: "用户",
},
subtitle: {
type: String,
@@ -92,10 +90,11 @@ export default {
isScrolled: false,
scrollThreshold: 160, // 灵动岛大卡片高度(160rpx)
// 内部数据,减少对外部props的依赖
- currentTitle: "Hi!杰西卡酱,欢迎回来~",
+ currentTitle: "Hi!用户,欢迎回来~",
currentSubtitle: "2个权益 | 120时间银行",
currentAvatar: "https://picsum.photos/80/80",
currentAction: "激活你的Agent",
+ userInfo: {},
};
},
computed: {
@@ -143,6 +142,8 @@ export default {
this.setStatusBarHeight();
// 监听页面滚动
this.addScrollListener();
+ // 获取用户信息
+ this.getUserInfo();
},
beforeDestroy() {
// 清理滚动监听
@@ -199,9 +200,11 @@ export default {
}
},
getCompactName() {
- // 从标题中提取姓名
-
- return "杰西卡酱";
+ // 从用户信息中获取昵称
+ if (this.userInfo && this.userInfo.nickname) {
+ return this.userInfo.nickname;
+ }
+ return "用户";
},
getStatNumber(type) {
// 从副标题中解析统计数据
@@ -226,6 +229,19 @@ export default {
this.statusBarHeight = 0;
}
},
+ // 获取用户信息
+ getUserInfo() {
+ try {
+ this.userInfo = (uni.getStorageSync('userInfo') && JSON.parse(uni.getStorageSync('userInfo'))) || this.$store.state.user.userInfo || {};
+ // 更新标题显示用户昵称
+ if (this.userInfo && this.userInfo.nickname) {
+ this.currentTitle = `Hi!${this.userInfo.nickname},欢迎回来~`;
+ }
+ } catch (e) {
+ console.warn("获取用户信息失败:", e);
+ this.userInfo = {};
+ }
+ },
},
};
@@ -329,9 +345,7 @@ export default {
.qr-code {
width: 32rpx;
height: 32rpx;
- display: flex;
- align-items: center;
- justify-content: center;
+
}
.qr-icon {
diff --git a/components/ProductSection.vue b/components/ProductSection.vue
index 345519d..79ba098 100644
--- a/components/ProductSection.vue
+++ b/components/ProductSection.vue
@@ -23,7 +23,7 @@
mode="aspectFill"
>
-
+
@@ -41,7 +41,7 @@
{{ item.title }}
- ¥{{ item.price }}
+ {{ item.price }}