首次提交

This commit is contained in:
zeronline
2026-06-25 08:39:47 +08:00
parent 20a93c703a
commit c5cccd346b
169 changed files with 24720 additions and 0 deletions
+28
View File
@@ -0,0 +1,28 @@
const api = require('../../../services/api')
const app = getApp()
Page({
data: { user: null },
onShow() {
if (!app.globalData.token) { wx.reLaunch({ url: '/pages/login/index' }); return }
this.loadProfile()
},
async loadProfile() {
try {
const user = await api.get('/api/users/profile')
app.globalData.user = user
this.setData({ user })
} catch(e) {}
},
goEdit() { wx.navigateTo({ url: '/pages/profile/edit/index' }) },
goAchievements() { wx.navigateTo({ url: '/pages/achievements/index' }) },
onLogout() {
wx.showModal({ title: '确认退出', content: '确定要退出登录吗?', success: (res) => {
if (res.confirm) {
app.globalData.token = ''; app.globalData.user = null
wx.removeStorageSync('token'); wx.removeStorageSync('user')
wx.reLaunch({ url: '/pages/login/index' })
}
}})
},
})
+1
View File
@@ -0,0 +1 @@
{ "navigationBarTitleText": "我的", "usingComponents": {} }
+16
View File
@@ -0,0 +1,16 @@
<view class="profile-card" wx:if="{{user}}">
<view class="profile-avatar">{{(user.nickname?.[0]) || (user.phone?.slice(-4)) || '?'}}</view>
<text class="profile-name">{{user.nickname || '未设置昵称'}}</text>
<text class="profile-bio">{{user.bio || '还没有个性签名'}}</text>
</view>
<view class="stats-card">
<view class="stat-item"><text class="stat-value">{{user?.points || 0}}</text><text class="stat-label">积分</text></view>
<view class="stat-item"><text class="stat-value">--</text><text class="stat-label">连续</text></view>
<view class="stat-item"><text class="stat-value">--</text><text class="stat-label">徽章</text></view>
</view>
<view class="menu-card">
<view class="menu-item" bindtap="goAchievements"><text>成就徽章</text><text class="menu-arrow">→</text></view>
<view class="menu-item" bindtap="onLogout" style="color:#FF3B30"><text>退出登录</text><text class="menu-arrow">→</text></view>
</view>
+12
View File
@@ -0,0 +1,12 @@
.profile-card { background: white; border-radius: 12px; margin: 12px 16px; padding: 32px 16px; text-align: center; box-shadow: 0 1px 3px rgba(0,0,0,0.04); }
.profile-avatar { width: 72px; height: 72px; border-radius: 36px; background: linear-gradient(135deg,#FF6B35,#FF4D6D); display: flex; align-items: center; justify-content: center; font-size: 28px; color: white; font-weight: 600; margin: 0 auto 12px; }
.profile-name { font-size: 22px; font-weight: 700; display: block; }
.profile-bio { font-size: 14px; color: #86868B; margin-top: 4px; display: block; }
.stats-card { background: white; border-radius: 12px; margin: 8px 16px; padding: 16px; display: flex; justify-content: space-around; box-shadow: 0 1px 3px rgba(0,0,0,0.04); }
.stat-item { text-align: center; }
.stat-value { font-size: 24px; font-weight: 700; color: #FF6B35; display: block; }
.stat-label { font-size: 13px; color: #86868B; }
.menu-card { background: white; border-radius: 12px; margin: 8px 16px; overflow: hidden; box-shadow: 0 1px 3px rgba(0,0,0,0.04); }
.menu-item { display: flex; justify-content: space-between; align-items: center; padding: 14px 16px; border-bottom: 0.5px solid #E5E5EA; font-size: 15px; }
.menu-item:last-child { border-bottom: none; }
.menu-arrow { font-size: 15px; color: #86868B; }