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

View File

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

View File

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

View File

@@ -1,31 +1,66 @@
<script setup> <script setup>
import { computed } from "vue";
import Container from "@/components/Container.vue"; import Container from "@/components/Container.vue";
import useStore from "@/store"; import useStore from "@/store";
import { storeToRefs } from "pinia"; import { storeToRefs } from "pinia";
const store = useStore(); const store = useStore();
const { user } = storeToRefs(store); 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> </script>
<template> <template>
<Container title="等级介绍"> <Container title="等级介绍">
<view class="container"> <view class="container">
<!-- 等级进度条 --> <!-- 等级进度条 -->
<view class="level-progress"> <scroll-view
<view v-for="(_, index) in 10" :key="index" class="progress-dot"> class="level-progress"
scroll-x
:show-scrollbar="false"
:scroll-left="currentLevelScrollLeft"
scroll-with-animation
>
<view class="level-track">
<view <view
:style="{ v-for="level in levels"
backgroundColor: :id="`level-${level}`"
index + 1 < user.lvl :key="level"
? '#fff9' :class="[
: index + 1 === user.lvl 'level-node',
? '#fed847' level < currentLevel ? 'level-node--done' : '',
: 'transparent', level === currentLevel ? 'level-node--current' : '',
borderColor: index + 1 === user.lvl ? '#fed847' : '#fff9', ]"
}" >
/> <view class="level-node__top">
<view /> <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> </view>
</scroll-view>
<!-- 说明文本 --> <!-- 说明文本 -->
<view class="body"> <view class="body">
@@ -65,28 +100,80 @@ const { user } = storeToRefs(store);
.level-progress { .level-progress {
width: 100%; width: 100%;
height: 32rpx; white-space: nowrap;
display: flex; padding: 24rpx 0 34rpx;
justify-content: center; box-sizing: border-box;
padding-top: 20rpx;
padding-bottom: 40rpx;
} }
.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; display: flex;
align-items: center; align-items: center;
width: 100%;
} }
.progress-dot > view:first-child {
width: 3.8vw; .level-node__dot {
height: 3.8vw; width: 28rpx;
height: 28rpx;
border-radius: 50%; 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; .level-node__line {
height: 1px; flex: 1;
margin: 0 2px; height: 2rpx;
background-color: #fff9; 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 { .body {

View File

@@ -282,8 +282,13 @@ onShow(async () => {
</script> </script>
<template> <template>
<Container title="排位赛" :showBackToGame="true" :bgType="6"> <Container
:title="'排位赛'"
:showBackToGame="true"
:bgType="6"
>
<view class="battle-types-box"> <view class="battle-types-box">
<!-- :title="'今日排位次数2/2'" :titleStyle="{ fontSize: '24rpx', fontWeight: 'normal' }" -->
<view class="battle-types"> <view class="battle-types">
<view class="first"> <view class="first">
<image src="../static/rank/battle-choose.png" mode="widthFix" /> <image src="../static/rank/battle-choose.png" mode="widthFix" />
@@ -926,4 +931,19 @@ onShow(async () => {
font-size: 10px !important; font-size: 10px !important;
margin-bottom: 7px; 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> </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) => { export const formatTimestamp = (timestamp) => {
const date = new Date(timestamp * 1000); const date = new Date(timestamp);
const year = date.getFullYear(); const year = date.getFullYear();
const month = date.getMonth() + 1; const month = date.getMonth() + 1;
const day = date.getDate(); const day = date.getDate();