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
+504
View File
@@ -0,0 +1,504 @@
<template>
<view class="content">
<view class="page-body">
<image src="https://aliyunoss.hn12301.net/learnlaw/gift_zt_bj.jpg" mode="scaleToFill" :style="{ width: '750rpx', height: bgHeight + 'px', position: 'absolute', top: 0, left: 0, zIndex: -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>
<view class="record-list" v-if="list.length > 0">
<view class="record-item" v-for="(item, i) in list" :key="i">
<view class="record-icon">
<text class="iconfont">🎁</text>
</view>
<view class="record-info">
<text class="record-prize">{{ item.title }}</text>
<text class="record-desc">{{ item.is_win_pc_desc }}</text>
<text class="record-status">{{ item.status_desc }}</text>
</view>
<view class="record-right">
<text class="record-time">{{ item.time }}</text>
<view class="btn-row">
<button class="winlist-btn" v-if="isEnded(item)" @tap="showWinList(item)">中奖名单</button>
<button class="redeem-btn" v-if="item.is_win_pc == 1" @tap="redeem(item)">兑奖</button>
</view>
</view>
</view>
</view>
<view class="empty-box" v-if="list.length === 0">
<text class="empty-icon">🏆</text>
<text class="empty-text">暂无中奖记录</text>
</view>
</template>
</view>
<view class="modal-mask" v-if="showWinModal" @tap="closeWinModal"></view>
<view class="modal win-modal" v-if="showWinModal">
<view class="modal-header">
<text class="modal-title">中奖名单</text>
<text class="modal-close" @tap="closeWinModal">✕</text>
</view>
<view class="win-list">
<view class="win-item" v-for="(w, wi) in winList" :key="wi">
<view class="win-level" :class="'win-level-' + w.win_level">
<text>{{ w.win_level_name }}</text>
</view>
<text class="win-name">{{ w.user_name }}</text>
<text class="win-phone">{{ w.user_phone }}</text>
</view>
<view class="win-empty" v-if="winList.length === 0">
<text>暂无中奖名单</text>
</view>
</view>
</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 {
bgHeight: 0,
tabbarList: [
{ pagePath: "/pages/index/index", iconPath: "/static/shouye.png", selectedIconPath: "/static/shouye_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: [],
showWinModal: false,
winList: []
}
},
onLoad() {
const sys = uni.getSystemInfoSync()
const tabbarHeight = sys.windowWidth / 750 * 120
this.bgHeight = sys.windowHeight - tabbarHeight
},
onShow() {
this.checkLogin()
},
methods: {
checkLogin() {
const userId = uni.getStorageSync('userIdGift')
if (userId) {
this.isLoggedIn = true
this.fetchList(userId)
} else {
this.isLoggedIn = false
}
},
goRegister() {
uni.navigateTo({ url: '/pages/register/register' })
},
fetchList(userId) {
this.$u.api.getChouJiangResult({
user_id: userId,
wenjuan_id: 1003
}).then(res => {
if (res.code === 0) {
const data = res.Data || {}
this.list = data.list || data.records || data || []
if (!Array.isArray(this.list)) this.list = []
} else {
uni.showToast({ title: res.msg || '加载失败', icon: 'none' })
}
}).catch(() => {
uni.showToast({ title: '网络异常', icon: 'none' })
})
},
isEnded(item) {
return String(item.status_desc || '').indexOf('已结束') > -1
},
showWinList(item) {
this.winList = []
this.showWinModal = true
this.$u.api.getWenjuanWinDetailList({
wenjuan_id: 1003,
period: item.index
}).then(res => {
if (res.code === 0) {
this.winList = Array.isArray(res.Data) ? res.Data : []
} else {
uni.showToast({ title: res.msg || '加载失败', icon: 'none' })
}
}).catch(() => {
uni.showToast({ title: '网络异常', icon: 'none' })
})
},
closeWinModal() {
this.showWinModal = false
},
redeem(item) {
const level = Number(item.is_win_level)
uni.navigateTo({
url: '/pages/redeem/redeem?level=' + level + '&period=' + item.index
})
}
}
}
</script>
<style lang="scss">
page {
background-color: #6EC5E3;
}
.content {
position: relative;
display: flex;
flex-direction: column;
}
.page-body {
position: relative;
z-index: 1;
flex: 1;
padding: 220rpx 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;
}
.record-list {
background: rgba(255,255,255,0.95);
border-radius: 20rpx;
overflow: hidden;
box-shadow: 0 4rpx 20rpx rgba(0,0,0,0.06);
}
.record-item {
display: flex;
align-items: center;
padding: 28rpx 24rpx;
border-bottom: 1rpx solid #f0f0f0;
}
.record-item:last-child {
border-bottom: none;
}
.record-icon {
width: 56rpx;
height: 56rpx;
display: flex;
align-items: center;
justify-content: center;
flex-shrink: 0;
margin-right: 16rpx;
background: #fff7e6;
border-radius: 50%;
}
.record-icon .iconfont {
font-size: 32rpx;
}
.record-info {
flex: 1;
min-width: 0;
}
.record-prize {
font-size: 28rpx;
color: #333;
font-weight: 500;
display: block;
}
.record-desc {
font-size: 22rpx;
color: #999;
margin-top: 4rpx;
display: block;
}
.record-status {
font-size: 22rpx;
color: #FD5401;
margin-top: 4rpx;
display: block;
}
.record-right {
display: flex;
flex-direction: column;
align-items: stretch;
flex-shrink: 0;
margin-left: 16rpx;
min-width: 260rpx;
}
.record-time {
font-size: 22rpx;
color: #bbb;
margin-bottom: 8rpx;
text-align: right;
width: 100%;
}
.btn-row {
display: flex;
align-items: center;
gap: 12rpx;
width: 100%;
}
.winlist-btn {
flex: 1;
height: 60rpx;
line-height: 60rpx;
background: linear-gradient(135deg, #E0B866, #F0D08A);
color: #fff;
font-size: 24rpx;
font-weight: 600;
border: none;
border-radius: 30rpx;
padding: 0 12rpx;
margin: 0;
letter-spacing: 0;
text-align: center;
}
.redeem-btn {
flex: 1;
height: 60rpx;
line-height: 60rpx;
background: linear-gradient(135deg, rgba(253,84,1,0.85), rgba(255,122,61,0.85));
color: #fff;
font-size: 24rpx;
font-weight: 600;
border: none;
border-radius: 30rpx;
box-shadow: 0 4rpx 12rpx rgba(253,84,1,0.3);
padding: 0 12rpx;
margin: 0;
letter-spacing: 0;
text-align: center;
}
.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);
}
.modal-mask {
position: fixed;
top: 0;
left: 0;
right: 0;
bottom: 0;
background: rgba(0,0,0,0.5);
z-index: 100;
}
.modal {
position: fixed;
left: 50%;
top: 50%;
transform: translate(-50%, -50%);
width: 600rpx;
background: #fff;
border-radius: 24rpx;
z-index: 101;
overflow: hidden;
}
.modal-header {
display: flex;
align-items: center;
justify-content: center;
padding: 30rpx 30rpx 20rpx;
position: relative;
}
.modal-title {
font-size: 32rpx;
font-weight: 700;
color: #333;
}
.modal-close {
position: absolute;
right: 30rpx;
top: 30rpx;
font-size: 28rpx;
color: #999;
padding: 8rpx;
}
.win-modal {
max-height: 80vh;
display: flex;
flex-direction: column;
}
.win-list {
flex: 1;
max-height: 60vh;
overflow-y: auto;
padding: 0 30rpx 30rpx;
}
.win-item {
display: flex;
align-items: center;
padding: 22rpx 0;
border-bottom: 1rpx solid #f0f0f0;
}
.win-item:last-child {
border-bottom: none;
}
.win-level {
width: 120rpx;
height: 44rpx;
line-height: 44rpx;
text-align: center;
border-radius: 22rpx;
font-size: 22rpx;
color: #fff;
flex-shrink: 0;
margin-right: 16rpx;
}
.win-level-1 {
background: linear-gradient(135deg, #E0B866, #F0D08A);
}
.win-level-2 {
background: linear-gradient(135deg, #B8B8B8, #D8D8D8);
}
.win-level-3 {
background: linear-gradient(135deg, #CD9B6A, #E0B88A);
}
.win-name {
flex: 1;
font-size: 28rpx;
color: #333;
font-weight: 500;
min-width: 0;
}
.win-phone {
font-size: 24rpx;
color: #999;
flex-shrink: 0;
margin-left: 16rpx;
}
.win-empty {
text-align: center;
font-size: 26rpx;
color: #999;
padding: 60rpx 0;
}
::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>