feat 主页

This commit is contained in:
2026-02-12 18:43:10 +08:00
parent 045fd08139
commit 9f3089907c
3 changed files with 34 additions and 153 deletions

View File

@@ -3,7 +3,6 @@
<view class="header">
<view class="welcome">
<text class="welcome-title">趣味答题</text>
<text class="welcome-subtitle">海量题库,轻松学习</text>
</view>
<view v-if="!isNotLoggedIn" class="point-card">
<view class="point-info">
@@ -14,42 +13,10 @@
<text class="level-text">{{ pointLevel }}</text>
</view>
</view>
</view>
<view class="action-section">
<view class="action-card" @click="handleStartQuiz">
<view class="action-icon">🎯</view>
<text class="action-title">开始答题</text>
<text class="action-desc">选择一种答题模式</text>
</view>
<view class="feature-section">
<view class="feature-card" @click="handleRandomQuiz">
<view class="feature-icon">🎲</view>
<text class="feature-title">随机答题</text>
<text class="feature-desc">随机抽取题目</text>
</view>
<view class="feature-card" @click="handleCategoryQuiz">
<view class="feature-icon">📚</view>
<text class="feature-title">类目答题</text>
<text class="feature-desc">按分类答题</text>
</view>
<view class="feature-card" @click="handleQuickQuiz">
<view class="feature-icon">⚡</view>
<text class="feature-title">快速答题</text>
<text class="feature-desc">限时挑战</text>
</view>
</view>
</view>
<view class="tips-section">
<view class="tip-item">
<text class="tip-icon">💡</text>
<text class="tip-text">每日答题,提升学识分</text>
</view>
<view class="tip-item">
<text class="tip-icon">🏆</text>
<text class="tip-text">解锁更高等级,展示你的知识水平</text>
<view v-else class="login-card" @click="handleLogin">
<text class="login-icon">🔐</text>
<text class="login-title">登录即可累计与查看学识分</text>
<text class="login-subtitle">点击登录</text>
</view>
</view>
</view>
@@ -81,9 +48,10 @@ export default {
this.pointLoading = true
try {
const res = await api.getPointInfo()
if (res.data && res.data.point) {
if (res.data) {
this.point = parseInt(res.data.point) || 0
this.pointLevel = this.getPointLevel(this.point)
this.isNotLoggedIn = false
}
} catch (error) {
console.error('获取学识分失败:', error)
@@ -106,27 +74,9 @@ export default {
return '博士'
},
handleStartQuiz() {
handleLogin() {
uni.navigateTo({
url: '/pages/gameplay/gameplay'
})
},
handleRandomQuiz() {
uni.navigateTo({
url: '/pages/random/random'
})
},
handleCategoryQuiz() {
uni.navigateTo({
url: '/pages/category/category'
})
},
handleQuickQuiz() {
uni.navigateTo({
url: '/pages/quick/quick'
url: '/pages/login/login'
})
}
}
@@ -140,15 +90,22 @@ export default {
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
padding: 40rpx;
box-sizing: border-box;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
}
.header {
margin-bottom: 60rpx;
width: 100%;
display: flex;
flex-direction: column;
align-items: center;
}
.welcome {
text-align: center;
margin-bottom: 40rpx;
margin-bottom: 60rpx;
}
.welcome-title {
@@ -156,13 +113,6 @@ export default {
font-size: 48rpx;
font-weight: bold;
color: #ffffff;
margin-bottom: 20rpx;
}
.welcome-subtitle {
display: block;
font-size: 28rpx;
color: rgba(255, 255, 255, 0.9);
}
.point-card {
@@ -211,17 +161,13 @@ export default {
box-shadow: 0 4rpx 15rpx rgba(0, 0, 0, 0.15);
}
.action-section {
margin-bottom: 60rpx;
}
.action-card {
.login-card {
background: rgba(255, 255, 255, 0.2);
border-radius: 20rpx;
padding: 50rpx;
margin: 0 auto 40rpx;
padding: 40rpx;
margin: 0 auto;
width: 90%;
max-width: 500rpx;
max-width: 400rpx;
backdrop-filter: blur(10rpx);
border: 2rpx solid rgba(255, 255, 255, 0.3);
display: flex;
@@ -231,94 +177,29 @@ export default {
transition: all 0.3s;
}
.action-card:active {
.login-card:active {
transform: scale(0.98);
background: rgba(255, 255, 255, 0.3);
}
.action-icon {
.login-icon {
font-size: 80rpx;
margin-bottom: 10rpx;
}
.action-title {
font-size: 40rpx;
font-weight: bold;
color: #ffffff;
text-shadow: 0 4rpx 10rpx rgba(0, 0, 0, 0.2);
}
.action-desc {
.login-title {
font-size: 28rpx;
color: rgba(255, 255, 255, 0.9);
}
.feature-section {
display: flex;
flex-direction: column;
gap: 20rpx;
margin-top: 40rpx;
}
.feature-card {
background: rgba(255, 255, 255, 0.15);
border-radius: 16rpx;
padding: 30rpx;
backdrop-filter: blur(10rpx);
border: 2rpx solid rgba(255, 255, 255, 0.2);
display: flex;
align-items: center;
gap: 30rpx;
transition: all 0.3s;
}
.feature-card:active {
transform: scale(0.98);
background: rgba(255, 255, 255, 0.25);
}
.feature-icon {
font-size: 50rpx;
min-width: 60rpx;
}
.feature-title {
font-size: 32rpx;
font-weight: bold;
color: #ffffff;
flex: 1;
text-align: center;
line-height: 1.4;
}
.feature-desc {
.login-subtitle {
font-size: 24rpx;
color: rgba(255, 255, 255, 0.8);
}
.tips-section {
margin-top: 60rpx;
}
.tip-item {
background: rgba(255, 255, 255, 0.1);
border-radius: 16rpx;
padding: 24rpx;
margin-bottom: 20rpx;
display: flex;
align-items: center;
gap: 20rpx;
backdrop-filter: blur(10rpx);
border: 2rpx solid rgba(255, 255, 255, 0.15);
}
.tip-icon {
font-size: 36rpx;
min-width: 40rpx;
}
.tip-text {
font-size: 26rpx;
color: rgba(255, 255, 255, 0.9);
flex: 1;
line-height: 1.6;
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
padding: 10rpx 40rpx;
border-radius: 30rpx;
margin-top: 10rpx;
}
</style>