From 3fc27febccd04e2fcffbd2cdd16d2daafd0b3ca3 Mon Sep 17 00:00:00 2001
From: shuishen <1109946754@qq.com>
Date: Sat, 11 Oct 2025 17:23:27 +0800
Subject: [PATCH] feat:首页地图相关调整
---
src/pages/user/index.vue | 63 +++++++++++++++++--------------
1 files changed, 34 insertions(+), 29 deletions(-)
diff --git a/src/pages/user/index.vue b/src/pages/user/index.vue
index 5f1bce3..f3ad9db 100644
--- a/src/pages/user/index.vue
+++ b/src/pages/user/index.vue
@@ -1,63 +1,68 @@
<!-- 我的 -->
<template>
<view class="page-wrap">
- <u-navbar title="" placeholder left-icon="" right-icon="camera-fill" />
+ <u-navbar title="" placeholder left-icon="" right-icon="camera-fill"/>
<view class="flex items-center pb-30rpx pl-30rpx pr-20rpx">
<view class="mr-10rpx">
- <u-avatar src="/static/images/logo.png" size="70" />
+ <u-avatar src="/static/images/logo.png" size="70"/>
</view>
<view class="flex-1">
- <view class="pb-20rpx text-36rpx"> uni-app </view>
+ <view class="pb-20rpx text-36rpx">{{ userStore.$state?.userInfo?.nick_name }}</view>
<view class="u-tips-color text-28rpx" @click="toCopy">
- 微信号:uni-app
+ ID:{{ userStore.$state?.userInfo?.user_id }}
</view>
</view>
<view class="ml-10rpx p-10rpx">
- <u-icon name="scan" color="#969799" />
+ <u-icon name="scan" color="#969799"/>
</view>
<view class="ml-10rpx p-10rpx">
- <u-icon name="arrow-right" color="#969799" />
+ <u-icon name="arrow-right" color="#969799"/>
</view>
</view>
<view class="mt-20rpx">
<u-cell-group>
- <u-cell icon="rmb-circle" title="支付" is-link />
- </u-cell-group>
- </view>
-
- <view class="mt-20rpx">
- <u-cell-group>
- <u-cell icon="star" title="收藏" is-link />
- <u-cell icon="photo" title="相册" is-link />
- <u-cell icon="coupon" title="卡券" is-link />
- <u-cell icon="heart" title="关注" is-link />
- </u-cell-group>
- </view>
-
- <view class="mt-20rpx">
- <u-cell-group>
- <u-cell icon="setting" title="设置" is-link />
+ <u-cell icon="setting" title="退出登录" is-link @click="logOut"/>
</u-cell-group>
</view>
</view>
</template>
<script setup>
-import { useClipboard, usePermission } from "@/hooks";
+import {useClipboard} from "@/hooks";
+import {useUserStore} from "@/store/index.js";
+import {onShow} from "@dcloudio/uni-app";
+import {getDeviceRegionApi} from "@/api/map.js";
-const { setClipboardData, getClipboardData } = useClipboard();
-
+const {setClipboardData, getClipboardData} = useClipboard();
+const userStore = useUserStore();
// 复制
const toCopy = async () => {
- await setClipboardData({ data: "1234567890" });
+ await setClipboardData({data: "1234567890"});
const data = await getClipboardData();
- console.log("[ data ] >", data);
};
+
+function logOut() {
+ userStore.setUserInfo(null)
+ uni.redirectTo({
+ url: '/pages/login/index'
+ })
+}
+
+function getDeviceRegion() {
+ getDeviceRegionApi().then(res =>{
+ console.log(res.data.data,'用户设备')
+ })
+}
// 登录鉴权,微信小程序端点击tabbar的底层逻辑不触发uni.switchTab,需要在页面onShow生命周期中校验权限
onShow(async () => {
- const hasPermission = await usePermission();
- console.log(hasPermission ? "已登录" : "未登录,拦截跳转");
+ getDeviceRegion()
+ // window.addEventListener('message', (event) => {
+ // console.log('message')
+ // })
+ // setInterval(() => {
+ // sWebViewRef.value.evalJs(`x_sun('${test.value}')`)
+ // }, 2000)
});
</script>
--
Gitblit v1.9.3