From 9544981b868e010ebdac17446f4a8dc4dfc241a7 Mon Sep 17 00:00:00 2001 From: cloudroam <cloudroam> Date: 星期一, 09 六月 2025 11:00:47 +0800 Subject: [PATCH] 1 --- sub-pages/mine/index.vue | 55 +++++++++++++++++++++++++++++++++++++++++++------------ 1 files changed, 43 insertions(+), 12 deletions(-) diff --git a/sub-pages/mine/index.vue b/sub-pages/mine/index.vue index fd50fa0..cb9b46d 100644 --- a/sub-pages/mine/index.vue +++ b/sub-pages/mine/index.vue @@ -12,20 +12,22 @@ <view class="profile-content"> <view class="profile-header"> <view class="avatar-container"> - <image class="avatar" src="https://ai-public.mastergo.com/ai/img_res/e8ae645c666c247b895b488e60b048f5.jpg" - mode="aspectFill" /> + <image v-if="userStore?.userInfo?.customerDTO?.cover" class="avatar" + :src="userStore?.userInfo?.customerDTO?.cover" mode="aspectFill" /> + <image v-else class="avatar" + src="https://ai-public.mastergo.com/ai/img_res/e8ae645c666c247b895b488e60b048f5.jpg" mode="aspectFill" /> <view class="add-icon"> <up-icon name="plus" size="20rpx" color="#333" /> </view> </view> <view class="user-info"> - <view class="username">小红薯 6786F040</view> - <view class="user-id">小红书号:95619601810</view> - <view class="location">IP 属地:江苏</view> + <view class="username">影途 {{ userStore?.userInfo?.customerDTO?.name }}</view> + <view class="user-id">影途号:{{ userStore?.userInfo?.customerDTO?.id }}</view> + <view class="location">IP 属地:{{ userStore.address?.ad_info?.province }}</view> </view> </view> - <view class="edit-profile">点击这里,填写简介</view> + <view class="edit-profile" >点击这里,填写简介</view> <view class="stats"> <view class="stat-row"> @@ -43,9 +45,9 @@ </view> </view> <view class="action-buttons"> - <up-button text="编辑资料" size="mini" type="info" plain hairline + <up-button text="编辑资料" size="mini" type="info" plain hairline @click="navigateTo('/sub-pages/mine/profile-edit')" :custom-style="{ backgroundColor: 'transparent', borderColor: '#B1ABA9' }" /> - <up-icon name="setting" size="40rpx" /> + <up-icon name="setting" size="40rpx" @click="navigateTo('/sub-pages/mine/settings')" /> </view> </view> </view> @@ -84,8 +86,32 @@ </template> <script setup lang="ts"> -import { ref, computed } from 'vue'; +import { ref, computed, watch } from 'vue'; +import { onShow } from '@dcloudio/uni-app' import SettingPopup from '@/components/setting/setting-popup.vue'; +import { usePlatformLoginType } from '@/composables/usePlatformLoginType' +import { useUserStore } from '@/store/user' +import { useLocation } from '@/composables/useLocation' +import { useNavigator } from '@/composables/useNavigator' + +const { apitype } = usePlatformLoginType() +const userStore = useUserStore() +const { navigateTo } = useNavigator() +const {getLocation,province } = useLocation() + + +watch( + () => userStore.userInfo, // 监听 userInfo 这个响应式属性 + (newVal, oldVal) => { + console.log('userInfo 发生变化:', newVal) + }, + { deep: true } // 如果 userInfo 是对象,需要深度监听其属性变化 +) + +onShow(() => { + getLocation() +}); + // 当前 tab 索引 const current = ref(0); @@ -119,17 +145,22 @@ }); // 方法定义 -function onSettingClick() { +const onSettingClick= ()=> { settingShow.value = true; } -function onTabChange(item: { index: number }) { +const onTabChange=(item: { index: number })=> { current.value = item.index; } -function onSwiperChange(e: any) { +const onSwiperChange=(e: any) => { current.value = e.detail.current; } + + +const goToProfile= ()=> { + navigateTo('/sub-pages/mine/edit-profile'); +} </script> -- Gitblit v1.9.3