From 6ef1b14f735acdc3ff77a50da1bb09a5bb983dcc Mon Sep 17 00:00:00 2001 From: tj <1378534974@qq.com> Date: 星期三, 28 五月 2025 17:37:06 +0800 Subject: [PATCH] location,userinfo --- sub-pages/mine/index.vue | 46 +++++++++++++++++++++++++++++++++++++++------- 1 files changed, 39 insertions(+), 7 deletions(-) diff --git a/sub-pages/mine/index.vue b/sub-pages/mine/index.vue index fd50fa0..6a80c45 100644 --- a/sub-pages/mine/index.vue +++ b/sub-pages/mine/index.vue @@ -12,16 +12,18 @@ <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> @@ -45,7 +47,7 @@ <view class="action-buttons"> <up-button text="编辑资料" size="mini" type="info" plain hairline :custom-style="{ backgroundColor: 'transparent', borderColor: '#B1ABA9' }" /> - <up-icon name="setting" size="40rpx" /> + <up-icon name="setting" size="40rpx" @click="gotoUrl('/sub-pages/mine/settings')" /> </view> </view> </view> @@ -84,8 +86,38 @@ </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() + + +const gotoUrl = (url: string) => { + navigateTo(url) +} + +watch( + () => userStore.userInfo, // 监听 userInfo 这个响应式属性 + (newVal, oldVal) => { + console.log('userInfo 发生变化:', newVal) + }, + { deep: true } // 如果 userInfo 是对象,需要深度监听其属性变化 +) + +onShow(() => { + console.log('我的') + getLocation() +}); + + // 当前 tab 索引 const current = ref(0); -- Gitblit v1.9.3