Files
tra-app/src/pages/pointsAndRank/points.vue
T

287 lines
6.4 KiB
Vue
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<template>
<z-paging
ref="pagingRef"
v-model="data_list"
@query="queryList"
class="scroll_div"
empty-view-text="暂无积分记录"
paging-class="z-paging-class"
>
<template #top>
<view class="top-main-div">
<view class="content">
<view class="body-title">
<view class="back_div" @click="common.navigateBack()">
<view class="back-icon"></view>
</view>
<view>积分明细</view>
</view>
<view class="fl1"></view>
<view class="my-points">
<view class="msg">我的积分</view>
<view class="score">
<uv-count-to
:startVal="startVal"
:endVal="endVal"
:useEasing="true"
ref="countToRef"
></uv-count-to>
</view>
</view>
</view>
</view>
</template>
<view class="scroll-Y">
<view class="item_th">
<view class="title">事项明细</view>
<view class="time">时间</view>
<view class="value">积分变化</view>
</view>
<view class="item" v-for="(item, index) in data_list">
<view class="title">
{{ item.mattrDesc}}
</view>
<view class="time">
{{ item.ctTime.substr(0, 16) }}
</view>
<view class="value" :class="Number(item.changeValue) >= 0 ? 'up' : 'down'">
{{ item.changeValue }}
</view>
</view>
</view>
</z-paging>
</template>
<script setup>
// 竞赛列表
import { ref, reactive, watch, onMounted } from 'vue';
import { onLoad, onUnload } from '@dcloudio/uni-app';
import useZpaging from '@/composables/useZpaging.js';
import common from '@/common/common';
import {getExtraHeight} from '@/common/common';
const extra_height = ref(getExtraHeight());
import { queryPointsDetail, queryCurrentStatus } from '@/api/pointsAndRank.js';
const startVal = ref(0);
const endVal = ref(0);
const countToRef = ref(null);
const points_data = ref({});
const fetchFunction = (params) => {
queryCurrentStatus().then(({ body }) => {
const { currentPoints } = body;
if (currentPoints !== endVal.value) {
endVal.value = currentPoints;
points_data.value = {
badgeNum: body['badgeNum'], // 徽章数
currentPoints: body['currentPoints'], // 当前积分
currentRankAddr: body['ossAddr'], // 当前段位图片
currentRankName: body['currentRankName'] // 当前段位名称
};
common.setValue('points_data', points_data.value);
countToRef.value.start();
}
});
return queryPointsDetail({ ...params });
};
const { pagingRef, queryList, data_list, search } = useZpaging({
fetchFunction
});
onLoad(() => {
points_data.value = common.getValue('points_data');
if (points_data.value) {
startVal.value = points_data.value.currentPoints; // 徽章数
endVal.value = points_data.value.currentPoints; // 徽章数
}
uni.$emit('update_me_data', true);
});
onUnload(() => {});
</script>
<style lang="scss" scoped>
.z-paging-class {
background-color: #e0e3ef;
::v-deep .zp-view-super {
background-color: #ffffff;
margin: 0 24rpx;
height: 100%;
border-radius: 30rpx 30rpx 0 0;
}
}
.top-main-div {
/* 宽度占满父容器 */
width: 100%;
/* 隐藏超出容器的背景图部分 */
overflow: hidden;
/* 使用 padding-top 实现 78:35 的宽高比(计算公式:35/78*100% ≈ 44.87% */
padding-top: 44.87%;
/* 背景图设置,确保图片覆盖且不重复 */
background-image: url('@/static/images/pointsAndRank/bg.png');
background-size: cover;
background-repeat: no-repeat;
background-position: center;
/* 若盒子内有内容,需用相对定位让内容脱离文档流 */
position: relative;
margin-bottom: -44rpx;
.content {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
display: flex;
flex-direction: column;
}
.my-points {
padding-bottom: 84rpx;
padding-left: 46rpx;
display: flex;
align-items: flex-end;
.msg {
font-weight: 400;
font-size: 26rpx;
color: #ffffff;
text-align: center;
padding-bottom: 4rpx;
}
.score {
margin-left: 16rpx;
width: 112px;
::v-deep .uv-count-num {
font-family: DINAlternate, DINAlternate !important;
font-weight: bold !important;
font-size: 77rpx !important;
color: #ffffff !important;
line-height: 77rpx !important;
}
}
}
}
.item_th {
display: flex;
align-items: center;
justify-content: space-between;
border-bottom: 4rpx solid #efefef;
font-family: PingFangSC, PingFang SC;
font-weight: 400;
font-size: 26rpx;
color: #999999;
text-align: left;
padding: 32rpx 38rpx 32rpx 26rpx;
.title {
flex: 1;
}
.time {
width: 254rpx;
white-space: nowrap;
}
.value {
text-align: right;
width: 128rpx;
flex-shrink: 1;
}
}
.item {
background: #ffffff;
border-bottom: 2rpx solid #efefef;
overflow: hidden;
background-color: #fff;
display: flex;
align-items: center;
justify-content: space-between;
padding: 40rpx 38rpx 40rpx 26rpx;
.title {
margin-right: 10rpx;
font-weight: 700;
font-size: 30rpx;
color: #333333;
flex: 1;
text-align: left;
white-space: wrap;
}
.time {
font-family: ArialMT;
font-size: 30rpx;
color: #000000;
text-align: left;
width: 254rpx;
white-space: nowrap;
}
.value {
font-family: Arial, Arial;
font-weight: normal;
font-size: 30rpx;
flex-shrink: 1;
text-align: right;
font-weight: 600;
width: 128rpx;
// min-width: max(80rpx, 20%);
}
.up {
color: #ff8a2d;
}
.down {
color: #48ae80;
}
}
.scroll-Y {
overflow: hidden;
}
.body-title {
width: 100%;
height: 70rpx;
font-size: 33rpx;
font-weight: 500;
color: #ffffff;
position: relative;
text-align: center;
margin-top: calc(var(--status-bar-height) + v-bind(extra_height));
.delete_div {
position: absolute;
right: 20rpx;
top: 17rpx;
width: 50rpx;
height: 50rpx;
.img {
width: 34rpx;
height: 34rpx;
}
}
.back_div {
position: absolute;
left: 26rpx;
top: 17rpx;
.back-icon {
position: relative;
width: 50rpx;
height: 50rpx;
cursor: pointer;
display: flex;
align-items: center;
}
.back-icon::before,
.back-icon::after {
content: '';
position: absolute;
transition: all 0.3s ease;
}
.back-icon::after {
top: 25%;
left: 25%;
width: 40%;
height: 40%;
border-top: 4rpx solid #ffffff;
border-left: 4rpx solid #ffffff;
transform: rotate(-45deg);
}
}
}
</style>