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 }}