Files
shoot-miniprograms/src/pages/user.vue

112 lines
2.6 KiB
Vue
Raw Normal View History

2025-05-01 16:17:51 +08:00
<script setup>
2025-05-01 16:36:24 +08:00
import AppBackground from "@/components/AppBackground.vue";
2025-05-01 21:38:35 +08:00
import Header from "@/components/Header.vue";
import UserHeader from "@/components/UserHeader.vue";
import UserItem from "@/components/UserItem.vue";
2025-05-28 15:00:31 +08:00
import Avatar from "@/components/Avatar.vue";
import useStore from "@/store";
import { storeToRefs } from "pinia";
const store = useStore();
2025-06-16 11:26:57 +08:00
const { user, device } = storeToRefs(store);
2025-06-13 16:36:18 +08:00
const { updateUser } = store;
2025-05-28 15:00:31 +08:00
const toOrderPage = () => {
uni.navigateTo({
url: "/pages/orders",
});
};
2025-05-28 16:03:08 +08:00
const toFristTryPage = () => {
2025-06-16 11:26:57 +08:00
if (!device.value.deviceId) {
return uni.showToast({
title: "请先绑定设备",
icon: "none",
});
}
2025-05-28 16:03:08 +08:00
uni.navigateTo({
url: "/pages/first-try",
});
};
const toBeVipPage = () => {
uni.navigateTo({
url: "/pages/be-vip",
});
};
const toMyGrowthPage = () => {
uni.navigateTo({
url: "/pages/my-growth",
});
};
const toGradeIntroPage = () => {
uni.navigateTo({
url: "/pages/grade-intro",
});
};
const toRankIntroPage = () => {
uni.navigateTo({
url: "/pages/rank-intro",
});
};
2025-06-13 16:36:18 +08:00
const logout = () => {
uni.removeStorageSync("token");
uni.navigateBack();
updateUser();
};
2025-05-01 16:17:51 +08:00
</script>
<template>
2025-05-01 21:38:35 +08:00
<view>
2025-05-01 16:36:24 +08:00
<AppBackground />
2025-05-01 21:38:35 +08:00
<Header title="用户信息" />
2025-05-28 15:00:31 +08:00
<UserHeader :user="user" />
2025-05-01 21:38:35 +08:00
<view class="container">
2025-05-28 15:00:31 +08:00
<UserItem title="用户名">{{ user.nickName }}</UserItem>
<UserItem title="头像">
<Avatar :src="user.avatarUrl" :size="35" />
</UserItem>
2025-05-01 21:38:35 +08:00
<UserItem
title="订单"
:customStyle="{
marginTop: '10px',
}"
2025-05-28 15:00:31 +08:00
:onClick="toOrderPage"
2025-05-01 21:38:35 +08:00
/>
2025-06-02 14:42:07 +08:00
<UserItem
title="新手试炼场"
:onClick="user.trio > 1 ? null : toFristTryPage"
>
2025-05-29 23:45:44 +08:00
<text v-if="user.trio > 1" :style="{ color: '#259249' }">已完成</text>
2025-05-28 16:03:08 +08:00
<text v-else :style="{ color: '#CC311F' }">未完成</text>
</UserItem>
<UserItem title="会员" :onClick="toBeVipPage"> 已赠送6个月会员 </UserItem>
<UserItem title="等级介绍" :onClick="toGradeIntroPage" />
2025-05-01 21:38:35 +08:00
<UserItem
title="段位介绍"
:customStyle="{
marginBottom: '10px',
}"
:onClick="toRankIntroPage"
2025-05-01 21:38:35 +08:00
/>
2025-05-28 16:03:08 +08:00
<view class="my-grow" @click="toMyGrowthPage">
2025-05-01 21:38:35 +08:00
<image src="../static/my-grow.png" mode="widthFix" />
2025-05-28 16:03:08 +08:00
</view>
2025-06-13 16:36:18 +08:00
<UserItem title="退出登录(仅用于测试)" :onClick="logout" />
2025-05-01 16:17:51 +08:00
</view>
</view>
</template>
<style scoped>
2025-05-01 21:38:35 +08:00
.container {
background-color: #e4e4e4;
height: calc(100vh - 161px);
margin-top: 20px;
padding-top: 10px;
2025-05-01 16:17:51 +08:00
}
2025-05-01 21:38:35 +08:00
.my-grow {
width: 100%;
}
.my-grow > image {
2025-05-01 16:17:51 +08:00
width: 100%;
}
2025-05-01 16:36:24 +08:00
</style>