update:更新靶纸,新增约战次数

This commit is contained in:
2026-06-24 17:09:34 +08:00
parent caa6ed4284
commit 4bea563109
7 changed files with 161 additions and 33 deletions

View File

@@ -41,6 +41,10 @@ const props = defineProps({
type: Boolean,
default: true,
},
titleStyle: {
type: [String, Object, Array],
default: () => ({}),
},
showBottom: {
type: Boolean,
default: true,
@@ -155,6 +159,7 @@ const goCalibration = async () => {
:title="title"
:onBack="onBack"
:whiteBackArrow="whiteBackArrow"
:titleStyle="titleStyle"
/>
<BackToGame v-if="showBackToGame" />
<scroll-view

View File

@@ -26,6 +26,10 @@ const props = defineProps({
type: Boolean,
default: true,
},
titleStyle: {
type: [String, Object, Array],
default: () => ({}),
},
});
const onClick = () => {
@@ -118,7 +122,9 @@ onBeforeUnmount(() => {
mode="widthFix"
/>
</view>
<view :style="{ color: whiteBackArrow ? '#fff' : '#000' }">
<view
:style="[{ color: whiteBackArrow ? '#fff' : '#000' }, titleStyle]"
>
<view
v-if="currentPage === 'pages/point-book'"
class="user-header"

View File

@@ -168,6 +168,9 @@ onLoad(async (options) => {
</view>
</view>
<view>
<view class="pp-text">
<!-- 今日约战次数2/2 -->
</view>
<SButton width="80%" :rounded="30" :onClick="() => $clickSound(onCreateRoom)">
创建约战房
</SButton>
@@ -268,7 +271,7 @@ onLoad(async (options) => {
}
.create-room>view:nth-child(3) {
margin: 12vw auto;
margin: 12vw auto 5vw auto;
position: relative;
display: flex;
align-items: center;
@@ -304,6 +307,13 @@ onLoad(async (options) => {
margin-right: 2px;
}
.pp-text{
color: #fff;
text-align: center;
font-size: 22rpx;
margin-bottom: 20rpx;
}
.warnning {
width: 100%;
height: 100%;

View File

@@ -1,31 +1,66 @@
<script setup>
import { computed } from "vue";
import Container from "@/components/Container.vue";
import useStore from "@/store";
import { storeToRefs } from "pinia";
const store = useStore();
const { user } = storeToRefs(store);
const MAX_LEVEL = 100;
const LEVEL_NODE_WIDTH_RPX = 72;
const TRACK_PADDING_RPX = 20;
const windowWidth = uni.getSystemInfoSync().windowWidth;
const rpxToPx = (value) => (value * windowWidth) / 750;
const levels = Array.from({ length: MAX_LEVEL }, (_, index) => index + 1);
const currentLevel = computed(() => {
const level = Number(user.value?.lvl) || 1;
return Math.min(Math.max(level, 1), MAX_LEVEL);
});
const currentLevelScrollLeft = computed(() => {
const nodeWidth = rpxToPx(LEVEL_NODE_WIDTH_RPX);
const trackPadding = rpxToPx(TRACK_PADDING_RPX);
const contentWidth = rpxToPx(
TRACK_PADDING_RPX * 2 + MAX_LEVEL * LEVEL_NODE_WIDTH_RPX
);
const currentCenter =
trackPadding + (currentLevel.value - 1) * nodeWidth + nodeWidth / 2;
const targetLeft = currentCenter - windowWidth / 2;
const maxScrollLeft = Math.max(contentWidth - windowWidth, 0);
return Math.min(Math.max(targetLeft, 0), maxScrollLeft);
});
</script>
<template>
<Container title="等级介绍">
<view class="container">
<!-- 等级进度条 -->
<view class="level-progress">
<view v-for="(_, index) in 10" :key="index" class="progress-dot">
<scroll-view
class="level-progress"
scroll-x
:show-scrollbar="false"
:scroll-left="currentLevelScrollLeft"
scroll-with-animation
>
<view class="level-track">
<view
:style="{
backgroundColor:
index + 1 < user.lvl
? '#fff9'
: index + 1 === user.lvl
? '#fed847'
: 'transparent',
borderColor: index + 1 === user.lvl ? '#fed847' : '#fff9',
}"
/>
<view />
v-for="level in levels"
:id="`level-${level}`"
:key="level"
:class="[
'level-node',
level < currentLevel ? 'level-node--done' : '',
level === currentLevel ? 'level-node--current' : '',
]"
>
<view class="level-node__top">
<view class="level-node__dot" />
<view v-if="level < MAX_LEVEL" class="level-node__line" />
</view>
<text class="level-node__label">{{ level }}</text>
</view>
</view>
</view>
</scroll-view>
<!-- 说明文本 -->
<view class="body">
@@ -65,28 +100,80 @@ const { user } = storeToRefs(store);
.level-progress {
width: 100%;
height: 32rpx;
display: flex;
justify-content: center;
padding-top: 20rpx;
padding-bottom: 40rpx;
white-space: nowrap;
padding: 24rpx 0 34rpx;
box-sizing: border-box;
}
.progress-dot {
.level-track {
display: inline-flex;
align-items: flex-start;
padding-left: 20rpx;
padding-right: 20rpx;
}
.level-node {
display: flex;
flex-direction: column;
align-items: flex-start;
width: 72rpx;
flex: 0 0 72rpx;
}
.level-node__top {
display: flex;
align-items: center;
width: 100%;
}
.progress-dot > view:first-child {
width: 3.8vw;
height: 3.8vw;
.level-node__dot {
width: 28rpx;
height: 28rpx;
border-radius: 50%;
border: 1px solid #fff9;
border: 3rpx solid rgba(255, 255, 255, 0.45);
box-sizing: border-box;
}
.progress-dot > view:last-child {
width: 3.8vw;
height: 1px;
margin: 0 2px;
background-color: #fff9;
.level-node__line {
flex: 1;
height: 2rpx;
background-color: rgba(255, 255, 255, 0.45);
}
.level-node__label {
width: 28rpx;
margin-top: 14rpx;
color: rgba(255, 255, 255, 0.45);
font-size: 24rpx;
line-height: 28rpx;
text-align: center;
}
.level-node--done .level-node__dot {
background-color: #ffffff;
border-color: #ffffff;
}
.level-node--done .level-node__line {
background-color: rgba(255, 255, 255, 0.8);
}
.level-node--done .level-node__label {
color: rgba(255, 255, 255, 0.72);
}
.level-node--current .level-node__dot {
background-color: #fed847;
border-color: #fed847;
}
.level-node--current .level-node__line {
background-color: rgba(255, 255, 255, 0.45);
}
.level-node--current .level-node__label {
color: #fed847;
font-weight: 700;
}
.body {

View File

@@ -282,8 +282,13 @@ onShow(async () => {
</script>
<template>
<Container title="排位赛" :showBackToGame="true" :bgType="6">
<Container
:title="'排位赛'"
:showBackToGame="true"
:bgType="6"
>
<view class="battle-types-box">
<!-- :title="'今日排位次数2/2'" :titleStyle="{ fontSize: '24rpx', fontWeight: 'normal' }" -->
<view class="battle-types">
<view class="first">
<image src="../static/rank/battle-choose.png" mode="widthFix" />
@@ -926,4 +931,19 @@ onShow(async () => {
font-size: 10px !important;
margin-bottom: 7px;
}
.flex-box{
display: flex;
justify-content: space-between;
align-items: center;
margin-bottom: 20rpx;
padding: 0 10rpx;
}
.lf-text{
font-size: 22rpx;
color: #bf985e;
}
.rg-text{
font-size: 24rpx;
color: #fff;
}
</style>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 30 KiB

After

Width:  |  Height:  |  Size: 25 KiB

View File

@@ -1,5 +1,5 @@
export const formatTimestamp = (timestamp) => {
const date = new Date(timestamp * 1000);
const date = new Date(timestamp);
const year = date.getFullYear();
const month = date.getMonth() + 1;
const day = date.getDate();