|
|
@@ -68,6 +68,16 @@
|
|
|
</template>
|
|
|
</view>
|
|
|
|
|
|
+ <!-- 退出登录 -->
|
|
|
+ <view
|
|
|
+ class="logout-card pressable"
|
|
|
+ hover-class="pressed"
|
|
|
+ hover-stay-time="80"
|
|
|
+ @click="logout"
|
|
|
+ >
|
|
|
+ <view class="fs-28">退出登录</view>
|
|
|
+ </view>
|
|
|
+
|
|
|
<view style="height: 40rpx"></view>
|
|
|
</view>
|
|
|
</block>
|
|
|
@@ -90,6 +100,7 @@
|
|
|
|
|
|
<script setup lang="ts">
|
|
|
import { fetchContact } from "@/api";
|
|
|
+import { clearToken } from "@/api/auth";
|
|
|
import { fetchProfile } from "@/api/user";
|
|
|
import { isAuthenticated, requireAuth } from "@/utils/auth";
|
|
|
import { onLoad, onShow } from "@dcloudio/uni-app";
|
|
|
@@ -118,11 +129,12 @@ const menu = ref([
|
|
|
path: "/pages-user/collect/collect",
|
|
|
icon: "/static/images/user/2.png",
|
|
|
},
|
|
|
- {
|
|
|
- title: "个人信息",
|
|
|
- path: "/pages-user/profile/profile",
|
|
|
- icon: "/static/images/user/3.png",
|
|
|
- },
|
|
|
+ // 个人信息入口暂时隐藏(保留数据便于恢复)
|
|
|
+ // {
|
|
|
+ // title: "个人信息",
|
|
|
+ // path: "/pages-user/profile/profile",
|
|
|
+ // icon: "/static/images/user/3.png",
|
|
|
+ // },
|
|
|
{
|
|
|
title: "联系我们",
|
|
|
desc: "工作时间 7:00-24:00",
|
|
|
@@ -141,16 +153,35 @@ const menu = ref([
|
|
|
},
|
|
|
]);
|
|
|
// 菜单分组渲染:资产/订单 + 服务;索引与 menu 对应(toPage/鉴权依赖原索引)
|
|
|
+// 注:原 index 4 为个人信息入口,隐藏后索引 4=联系我们
|
|
|
const menuGroups = computed(() => [
|
|
|
[0, 1, menu.value.length - 1],
|
|
|
- [2, 3, 4, 5, 6],
|
|
|
+ [2, 3, 4, 5],
|
|
|
]);
|
|
|
-const AUTH_REQUIRED_INDICES = [0, 1, 2, 3, 4];
|
|
|
+const AUTH_REQUIRED_INDICES = [0, 1, 2, 3];
|
|
|
|
|
|
const goToLogin = () => {
|
|
|
requireAuth("/pages/user/user");
|
|
|
};
|
|
|
|
|
|
+/** 退出登录:清除本地登录态并刷新到未登录视图 */
|
|
|
+const logout = () => {
|
|
|
+ uni.showModal({
|
|
|
+ title: "退出登录",
|
|
|
+ content: "确定退出当前账号吗?",
|
|
|
+ confirmText: "退出",
|
|
|
+ confirmColor: "#f43636",
|
|
|
+ success: (res) => {
|
|
|
+ if (res.confirm) {
|
|
|
+ clearToken();
|
|
|
+ getApp<any>().globalData.user = undefined;
|
|
|
+ user.value = {};
|
|
|
+ uni.reLaunch({ url: "/pages/user/user" });
|
|
|
+ }
|
|
|
+ },
|
|
|
+ });
|
|
|
+};
|
|
|
+
|
|
|
const toPage = (index: number) => {
|
|
|
if (index < 0) {
|
|
|
if (!requireAuth("/pages-user/wallet/wallet")) return;
|
|
|
@@ -329,6 +360,20 @@ page {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+.logout-card {
|
|
|
+ margin-top: 20rpx;
|
|
|
+ background: #ffffff;
|
|
|
+ border-radius: 20rpx;
|
|
|
+ height: 104rpx;
|
|
|
+ display: flex;
|
|
|
+ align-items: center;
|
|
|
+ justify-content: center;
|
|
|
+
|
|
|
+ view {
|
|
|
+ color: #f43636;
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
.guest {
|
|
|
padding-top: 200rpx;
|
|
|
}
|