initial commit: giftlaw ni xue fa wo you li - natural resources session

This commit is contained in:
lcj
2026-09-03 10:12:08 +08:00
commit dac4260d73
239 changed files with 48949 additions and 0 deletions
+391
View File
@@ -0,0 +1,391 @@
<template>
<view class="content">
<view class="page-body">
<image src="https://aliyunoss.hn12301.net/learnlaw/gift_zt_bj.jpg" mode="widthFix" style="width:750rpx;position:absolute;top:0;left:0;z-index:-1;"></image>
<view class="login-box" v-if="!isLoggedIn">
<text class="login-tip">注册后可查看排行榜</text>
<button class="login-btn" @tap="goRegister">立即注册</button>
</view>
<template v-if="isLoggedIn">
<view class="header">
<view class="header-icon"><text>🏆</text></view>
<text class="header-title">排行榜</text>
<view class="header-line"></view>
<view class="my-rank" v-if="myRank">
<text class="my-rank-label">我的排名</text>
<text class="my-rank-value">第 {{ myRank }} 名</text>
<text class="my-rank-stats">{{ myScore }}分 · {{ myTime }}s</text>
</view>
</view>
<view class="rank-list" v-if="list.length > 0">
<view class="rank-item" v-for="(item, i) in list" :key="i">
<view class="rank-index" :class="'rank-' + (item.index || i + 1)">
<text v-if="(item.index || i + 1) <= 3">
<image :src="'https://aliyunoss.hn12301.net/sd/rank' + (i + 1) + '.png'" mode="widthFix" style="width:36rpx;"></image>
</text>
<text v-else class="rank-num">{{ item.index }}</text>
</view>
<view class="rank-info">
<text class="rank-name">{{ item.user_name }}</text>
<text class="rank-phone">{{ item.user_phone }}</text>
</view>
<view class="rank-stats">
<text class="rank-time">{{ item.total_time }}s</text>
<text class="rank-score">{{ item.total_score }}分</text>
</view>
</view>
</view>
<view class="load-more" v-if="hasMore">
<u-loading mode="circle" size="28"></u-loading>
<text class="load-text">加载更多...</text>
</view>
<view class="no-more" v-if="!hasMore && list.length > 0">
<text class="no-more-text">— 没有更多了 —</text>
</view>
<view class="empty-box" v-if="list.length === 0">
<text class="empty-icon">🏆</text>
<text class="empty-text">暂无排行榜数据</text>
</view>
</template>
</view>
<u-tabbar
:list="tabbarList"
:hideTabBar="true"
activeColor="#FD5401"
inactiveColor="#5D533D"
:borderTop="false"
height="120rpx"
iconSize="48"
></u-tabbar>
</view>
</template>
<script>
export default {
data() {
return {
tabbarList: [
{ pagePath: "/pages/index/index", iconPath: "/static/shouye.png", selectedIconPath: "/static/shouye_select.png", text: "首页" },
{ pagePath: "/pages/ranking/ranking", iconPath: "/static/paihangbang.png", selectedIconPath: "/static/paihangbang_select.png", text: "排行榜" },
{ pagePath: "/pages/records/records", iconPath: "/static/zhongjiangjilu.png", selectedIconPath: "/static/zhongjiangjilu_select.png", text: "中将记录" },
{ pagePath: "/pages/profile/profile", iconPath: "/static/wode.png", selectedIconPath: "/static/wode_select.png", text: "我的" }
],
isLoggedIn: false,
list: [],
pageNum: 1,
pageSize: 10,
hasMore: true,
loading: false,
myRank: null,
myScore: 0,
myTime: 0
}
},
onLoad() {
this.checkLogin()
},
onShow() {
this.checkLogin()
},
methods: {
checkLogin() {
const userId = uni.getStorageSync('userIdGift')
if (userId) {
this.isLoggedIn = true
this.pageNum = 1
this.hasMore = true
this.fetchList()
} else {
this.isLoggedIn = false
}
},
goRegister() {
uni.navigateTo({ url: '/pages/register/register' })
},
fetchList() {
if (this.loading || !this.hasMore) return
this.loading = true
const userId = uni.getStorageSync('userIdGift')
this.$u.api.getWenjuanPhb({
user_id: userId,
wenjuan_id: 1003,
pageNum: this.pageNum,
pageSize: this.pageSize
}).then(res => {
if (res.code === 0) {
const data = res.Data
if (this.pageNum === 1) {
this.list = data.phb || []
this.myRank = data.pm
this.myScore = data.score || 0
this.myTime = data.time || 0
} else {
this.list = this.list.concat(data.phb || [])
}
this.hasMore = (data.phb || []).length >= this.pageSize
} else {
uni.showToast({ title: res.msg || '加载失败', icon: 'none' })
}
}).catch(() => {
uni.showToast({ title: '网络异常', icon: 'none' })
}).finally(() => {
this.loading = false
})
}
}
}
</script>
<style lang="scss">
page {
background-color: #B3E9F3;
}
.content {
position: relative;
display: flex;
flex-direction: column;
}
.page-body {
position: relative;
z-index: 1;
flex: 1;
padding: 80rpx 30rpx 20rpx;
box-sizing: border-box;
}
.login-box {
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
height: 100%;
}
.login-tip {
font-size: 28rpx;
color: rgba(255,255,255,0.85);
margin-bottom: 30rpx;
}
.login-btn {
width: 400rpx;
height: 80rpx;
line-height: 80rpx;
background: linear-gradient(135deg, #FD5401, #FF7A3D);
color: #fff;
font-size: 30rpx;
font-weight: 600;
border: none;
border-radius: 40rpx;
box-shadow: 0 4rpx 16rpx rgba(253,84,1,0.3);
}
.header {
display: flex;
flex-direction: column;
align-items: center;
margin-bottom: 30rpx;
}
.header-icon {
font-size: 52rpx;
margin-bottom: 10rpx;
}
.header-title {
font-size: 36rpx;
font-weight: 800;
color: #fff;
text-shadow: 0 2rpx 8rpx rgba(0,0,0,0.15);
letter-spacing: 4rpx;
}
.header-line {
width: 60rpx;
height: 4rpx;
background: rgba(255,255,255,0.5);
border-radius: 2rpx;
margin-top: 12rpx;
margin-bottom: 8rpx;
}
.my-rank {
display: flex;
align-items: center;
gap: 20rpx;
background: rgba(255,255,255,0.2);
border-radius: 16rpx;
padding: 16rpx 28rpx;
margin-top: 16rpx;
}
.my-rank-label {
font-size: 24rpx;
color: rgba(255,255,255,0.8);
}
.my-rank-value {
font-size: 28rpx;
font-weight: 700;
color: #fff;
}
.my-rank-stats {
font-size: 22rpx;
color: rgba(255,255,255,0.65);
margin-left: auto;
}
.rank-list {
background: rgba(255,255,255,0.95);
border-radius: 20rpx;
overflow: hidden;
box-shadow: 0 4rpx 20rpx rgba(0,0,0,0.06);
}
.rank-item {
display: flex;
align-items: center;
padding: 28rpx 24rpx;
border-bottom: 1rpx solid #f0f0f0;
}
.rank-item:last-child {
border-bottom: none;
}
.rank-index {
width: 56rpx;
height: 56rpx;
display: flex;
align-items: center;
justify-content: center;
flex-shrink: 0;
margin-right: 16rpx;
border-radius: 50%;
background: #f5f5f5;
}
.rank-index.rank-1 {
background: #fff7e6;
}
.rank-index.rank-2 {
background: #f0f0f0;
}
.rank-index.rank-3 {
background: #fef6e7;
}
.rank-num {
font-size: 24rpx;
font-weight: 700;
color: #999;
}
.rank-info {
flex: 1;
min-width: 0;
}
.rank-name {
font-size: 28rpx;
color: #333;
font-weight: 500;
display: block;
}
.rank-phone {
font-size: 22rpx;
color: #bbb;
margin-top: 4rpx;
display: block;
}
.rank-stats {
text-align: right;
flex-shrink: 0;
margin-left: 16rpx;
}
.rank-time {
font-size: 22rpx;
color: #999;
display: block;
}
.rank-score {
font-size: 30rpx;
font-weight: 700;
color: #FD5401;
display: block;
margin-top: 4rpx;
}
.load-more {
display: flex;
align-items: center;
justify-content: center;
padding: 30rpx 0;
gap: 10rpx;
}
.load-text {
font-size: 24rpx;
color: rgba(255,255,255,0.7);
}
.no-more {
text-align: center;
padding: 24rpx 0;
}
.no-more-text {
font-size: 22rpx;
color: rgba(255,255,255,0.5);
}
.empty-box {
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
padding: 80rpx 0;
}
.empty-icon {
font-size: 80rpx;
margin-bottom: 16rpx;
}
.empty-text {
font-size: 26rpx;
color: rgba(255,255,255,0.7);
}
::v-deep .u-tabbar__content {
background: linear-gradient(to bottom, #FAFFC7, #B2FFC9) !important;
}
::v-deep .u-tabbar__content__item {
background: linear-gradient(to bottom, #FAFFC7, #B2FFC9) !important;
}
::v-deep .u-tabbar {
.u-border-top {
border-top: none !important;
}
}
::v-deep .u-icon__img {
object-fit: contain !important;
}
::v-deep .u-tabbar__content__item {
padding: 16rpx 0 !important;
}
</style>