|
@@ -1,47 +1,257 @@
|
|
|
<template>
|
|
|
- <view class="profile-page">
|
|
|
- <view class="title">个人中心</view>
|
|
|
- <nut-empty description="正在开发中..." image="empty" />
|
|
|
+ <view class="profile-page">
|
|
|
+ <!-- 用户信息卡片 -->
|
|
|
+ <view class="user-card">
|
|
|
+ <view class="user-avatar">
|
|
|
+ <image :src="userStore.avatar || defaultAvatar" mode="aspectFill"></image>
|
|
|
+ </view>
|
|
|
+ <view class="user-info">
|
|
|
+ <view class="user-name">{{ userStore.nickname || '未登录' }}</view>
|
|
|
+ <view class="user-id">玩家ID: {{ userStore.openid ? userStore.openid.substring(0, 8) : '未登录' }}</view>
|
|
|
+ </view>
|
|
|
</view>
|
|
|
- <Tabbar></Tabbar>
|
|
|
- </template>
|
|
|
+
|
|
|
+ <!-- 数据统计 -->
|
|
|
+ <view class="stats-card">
|
|
|
+ <view class="stat-item">
|
|
|
+ <view class="stat-value">{{ userStore.gameCount }}</view>
|
|
|
+ <view class="stat-label">参与游戏</view>
|
|
|
+ </view>
|
|
|
+ <view class="stat-item">
|
|
|
+ <view class="stat-value">{{ userStore.roomCount }}</view>
|
|
|
+ <view class="stat-label">创建房间</view>
|
|
|
+ </view>
|
|
|
+ </view>
|
|
|
+
|
|
|
+ <!-- 积分与经验 -->
|
|
|
+ <view class="points-card">
|
|
|
+ <view class="points-header">
|
|
|
+ <view class="points-title">嘻元</view>
|
|
|
+ </view>
|
|
|
+
|
|
|
+ <view class="points-info">
|
|
|
+ <view class="points-row">
|
|
|
+ <view class="points-count">{{ userStore.points }}</view>
|
|
|
+ </view>
|
|
|
+
|
|
|
+ <view class="exp-bar">
|
|
|
+ <view class="exp-progress" :style="{ width: userStore.expPercentage + '%' }"></view>
|
|
|
+ </view>
|
|
|
+ <view class="level-tag">Lv.{{ userStore.level }}</view>
|
|
|
+ </view>
|
|
|
+ </view>
|
|
|
+
|
|
|
+ <!-- 底部版权信息 -->
|
|
|
+ <view class="footer">
|
|
|
+ <view class="app-version">LineJoy v1.0</view>
|
|
|
+ <view class="copyright">© 2025 灵嘻次元工作室</view>
|
|
|
+ </view>
|
|
|
+ </view>
|
|
|
|
|
|
- <script lang="ts">
|
|
|
- import Taro from '@tarojs/taro'
|
|
|
- import Tabbar from '@/components/Tabbar.vue'
|
|
|
+ <Tabbar></Tabbar>
|
|
|
+</template>
|
|
|
|
|
|
- export default {
|
|
|
- components: {
|
|
|
- Tabbar
|
|
|
- },
|
|
|
+<script lang="ts">
|
|
|
+import { ref, onMounted } from 'vue'
|
|
|
+import Taro from '@tarojs/taro'
|
|
|
+import { useUserStore } from '@/stores/user'
|
|
|
+import Tabbar from '@/components/Tabbar.vue'
|
|
|
+
|
|
|
+export default {
|
|
|
+ components: {
|
|
|
+ Tabbar
|
|
|
+ },
|
|
|
+
|
|
|
+ onShow() {
|
|
|
+ Taro.hideHomeButton()
|
|
|
+ },
|
|
|
+
|
|
|
+ setup() {
|
|
|
+ const userStore = useUserStore()
|
|
|
+ const defaultAvatar = 'https://upload-bbs.mihoyo.com/upload/2022/01/22/76b32c01af33a4b6c6d0926675df26f7_3499695120008689147.png'
|
|
|
|
|
|
- // 页面显示时的生命周期钩子
|
|
|
- onShow() {
|
|
|
- // 隐藏返回首页按钮
|
|
|
- Taro.hideHomeButton()
|
|
|
- console.log('已隐藏返回首页按钮')
|
|
|
- },
|
|
|
+ // 初始化
|
|
|
+ onMounted(() => {
|
|
|
+ // 确保用户数据已加载
|
|
|
+ if (!userStore.isRegistered) {
|
|
|
+ userStore.initUser()
|
|
|
+ }
|
|
|
+ })
|
|
|
|
|
|
- // setup函数用于Composition API
|
|
|
- setup() {
|
|
|
- // 这里可以添加其他响应式数据和方法
|
|
|
+ return {
|
|
|
+ userStore,
|
|
|
+ defaultAvatar
|
|
|
+ }
|
|
|
+ }
|
|
|
+}
|
|
|
+</script>
|
|
|
+
|
|
|
+<style lang="scss">
|
|
|
+.profile-page {
|
|
|
+ padding: $spacing-base;
|
|
|
+ background-color: $background-color-base;
|
|
|
+ min-height: 100vh;
|
|
|
+ padding-bottom: $spacing-large * 4; // 为底部tabbar留出空间
|
|
|
+
|
|
|
+ // 用户信息卡片
|
|
|
+ .user-card {
|
|
|
+ background-color: $background-color-light;
|
|
|
+ border-radius: $border-radius-small;
|
|
|
+ padding: $spacing-large;
|
|
|
+ margin-bottom: $spacing-large;
|
|
|
+ box-shadow: $shadow-light;
|
|
|
+ display: flex;
|
|
|
+ align-items: center;
|
|
|
+
|
|
|
+ .user-avatar {
|
|
|
+ width: 70px;
|
|
|
+ height: 70px;
|
|
|
+ border-radius: 50%;
|
|
|
+ overflow: hidden;
|
|
|
+ margin-right: $spacing-large;
|
|
|
+ border: 2px solid $primary-color;
|
|
|
+
|
|
|
+ image {
|
|
|
+ width: 100%;
|
|
|
+ height: 100%;
|
|
|
+ object-fit: cover;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ .user-info {
|
|
|
+ flex: 1;
|
|
|
+
|
|
|
+ .user-name {
|
|
|
+ font-size: $font-size-large;
|
|
|
+ color: $text-color-primary;
|
|
|
+ font-weight: $font-weight-bold;
|
|
|
+ margin-bottom: $spacing-mini;
|
|
|
+ }
|
|
|
|
|
|
- return {
|
|
|
- // 返回需要在模板中使用的数据和方法
|
|
|
+ .user-id {
|
|
|
+ font-size: $font-size-small;
|
|
|
+ color: $text-color-secondary;
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
- </script>
|
|
|
|
|
|
- <style lang="scss">
|
|
|
- .profile-page {
|
|
|
- padding: 20px;
|
|
|
-
|
|
|
- .title {
|
|
|
- font-size: 20px;
|
|
|
- font-weight: bold;
|
|
|
- margin-bottom: 20px;
|
|
|
+ // 数据统计卡片
|
|
|
+ .stats-card {
|
|
|
+ background-color: $background-color-light;
|
|
|
+ border-radius: $border-radius-small;
|
|
|
+ padding: $spacing-large;
|
|
|
+ margin-bottom: $spacing-large;
|
|
|
+ box-shadow: $shadow-light;
|
|
|
+ display: flex;
|
|
|
+
|
|
|
+ .stat-item {
|
|
|
+ flex: 1;
|
|
|
text-align: center;
|
|
|
+ padding: $spacing-base 0;
|
|
|
+
|
|
|
+ .stat-value {
|
|
|
+ font-size: 24px;
|
|
|
+ color: $primary-color;
|
|
|
+ font-weight: $font-weight-bold;
|
|
|
+ margin-bottom: $spacing-small;
|
|
|
+ }
|
|
|
+
|
|
|
+ .stat-label {
|
|
|
+ font-size: $font-size-small;
|
|
|
+ color: $text-color-secondary;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ // 积分卡片
|
|
|
+ .points-card {
|
|
|
+ background-color: $background-color-light;
|
|
|
+ border-radius: $border-radius-small;
|
|
|
+ padding: $spacing-large;
|
|
|
+ margin-bottom: $spacing-large;
|
|
|
+ box-shadow: $shadow-light;
|
|
|
+
|
|
|
+ .points-header {
|
|
|
+ margin-bottom: $spacing-large;
|
|
|
+
|
|
|
+ .points-title {
|
|
|
+ font-size: $font-size-medium;
|
|
|
+ color: $text-color-primary;
|
|
|
+ font-weight: $font-weight-medium;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ .points-info {
|
|
|
+ position: relative;
|
|
|
+
|
|
|
+ .points-row {
|
|
|
+ display: flex;
|
|
|
+ align-items: center;
|
|
|
+ margin-bottom: $spacing-large;
|
|
|
+
|
|
|
+ .points-label {
|
|
|
+ font-size: $font-size-medium;
|
|
|
+ color: $text-color-secondary;
|
|
|
+ margin-right: $spacing-base;
|
|
|
+ }
|
|
|
+
|
|
|
+ .points-count {
|
|
|
+ font-size: 24px;
|
|
|
+ color: $primary-color;
|
|
|
+ font-weight: $font-weight-bold;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ .exp-bar {
|
|
|
+ height: 8px;
|
|
|
+ background-color: $background-color-gray;
|
|
|
+ border-radius: 4px;
|
|
|
+ margin-bottom: $spacing-small;
|
|
|
+ overflow: hidden;
|
|
|
+
|
|
|
+ .exp-progress {
|
|
|
+ height: 100%;
|
|
|
+ background-color: $success-color;
|
|
|
+ border-radius: 4px;
|
|
|
+ transition: width 0.3s;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ .exp-info {
|
|
|
+ font-size: $font-size-small;
|
|
|
+ color: $text-color-secondary;
|
|
|
+ }
|
|
|
+
|
|
|
+ .level-tag {
|
|
|
+ position: absolute;
|
|
|
+ top: 0;
|
|
|
+ right: 0;
|
|
|
+ background-color: $warning-color;
|
|
|
+ color: white;
|
|
|
+ font-size: $font-size-small;
|
|
|
+ padding: $spacing-mini $spacing-base;
|
|
|
+ border-radius: $border-radius-small;
|
|
|
+ font-weight: $font-weight-medium;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ // 底部版权信息
|
|
|
+ .footer {
|
|
|
+ text-align: center;
|
|
|
+ padding: $spacing-large 0;
|
|
|
+ margin-top: auto;
|
|
|
+
|
|
|
+ .app-version {
|
|
|
+ font-size: $font-size-small;
|
|
|
+ color: $text-color-secondary;
|
|
|
+ margin-bottom: $spacing-small;
|
|
|
+ }
|
|
|
+
|
|
|
+ .copyright {
|
|
|
+ font-size: $font-size-small;
|
|
|
+ color: $text-color-secondary;
|
|
|
}
|
|
|
}
|
|
|
- </style>
|
|
|
+}
|
|
|
+</style>
|