Merge branch 'feat-vip' into test

This commit is contained in:
2026-06-18 16:24:47 +08:00
70 changed files with 3253 additions and 410 deletions

View File

@@ -57,6 +57,12 @@ const props = defineProps({
src="https://static.shelingxingqiu.com/shootmini/static/rank/rank-bg.png"
mode="widthFix"
/>
<image
class="bg-image"
v-if="type === 10"
src="https://static.shelingxingqiu.com/shootmini/static/vip/vip-bg.png"
mode="widthFix"
/>
<view class="bg-overlay" v-if="type === 0"></view>
</view>
</template>

View File

@@ -8,7 +8,7 @@ const tabs = [
function handleTabClick(index) {
if (index === 0) {
uni.navigateTo({
url: "/pages/be-vip",
url: "/pages/member/be-vip",
});
}
if (index === 1) {

View File

@@ -18,12 +18,14 @@ const props = defineProps({
},
});
const loading = ref(false);
const navigating = ref(false);
/** 统一获取当前环境 token用于守卫无有效 token 时不发起接口请求 */
const getToken = () =>
uni.getStorageSync(`${uni.getAccountInfoSync().miniProgram.envVersion}_token`);
onShow(async () => {
navigating.value = false;
if (user.value.id && getToken()) {
setTimeout(async () => {
const state = await getUserGameState();
@@ -45,28 +47,35 @@ watch(
}
);
const navigateOnce = (url) =>
new Promise((resolve, reject) => {
navigating.value = true;
uni.navigateTo({
url,
success: resolve,
fail: (error) => {
navigating.value = false;
reject(error);
},
});
});
const onClick = debounce(async () => {
if (loading.value) return;
if (loading.value || navigating.value) return;
try {
loading.value = true;
const result = await getBattleAPI();
if (result && result.matchId) {
await uni.$checkAudio();
if (result.mode <= 3) {
uni.navigateTo({
url: `/pages/team-battle/index?battleId=${result.matchId}`,
});
await navigateOnce(`/pages/team-battle/index?battleId=${result.matchId}`);
} else {
uni.navigateTo({
url: `/pages/melee-battle?battleId=${result.matchId}`,
});
await navigateOnce(`/pages/melee-battle?battleId=${result.matchId}`);
}
return;
}
if (game.value.roomID) {
uni.navigateTo({
url: "/pages/battle-room?roomNumber=" + game.value.roomID,
});
await navigateOnce("/pages/battle-room?roomNumber=" + game.value.roomID);
} else {
updateGame(false, "");
}

View File

@@ -27,6 +27,14 @@ defineProps({
default: true,
},
});
const getMemberNicknameClass = (player = {}) => [
"member-nickname",
player.vip === true && player.sVip !== true ? "member-nickname--vip" : "",
player.sVip === true ? "member-nickname--svip" : "",
];
const isMember = (player = {}) => player.vip === true || player.sVip === true;
</script>
<template>
@@ -51,7 +59,16 @@ defineProps({
}"
>
<Avatar :src="player.avatar" :rankLvl="player.rankLvl" :size="40" />
<text class="player-name">{{ player.name }}</text>
<view
v-if="isMember(player)"
:class="['player-name', ...getMemberNicknameClass(player)]"
>
<text class="member-nickname__text">{{ player.name }}</text>
<text v-if="player.sVip === true" class="member-nickname__shine">
{{ player.name }}
</text>
</view>
<text v-else class="player-name">{{ player.name }}</text>
</view>
<image
v-if="winner === 1"
@@ -70,7 +87,16 @@ defineProps({
}"
>
<Avatar :src="player.avatar" :rankLvl="player.rankLvl" :size="40" />
<text class="player-name">{{ player.name }}</text>
<view
v-if="isMember(player)"
:class="['player-name', ...getMemberNicknameClass(player)]"
>
<text class="member-nickname__text">{{ player.name }}</text>
<text v-if="player.sVip === true" class="member-nickname__shine">
{{ player.name }}
</text>
</view>
<text v-else class="player-name">{{ player.name }}</text>
</view>
<image
v-if="winner === 2"
@@ -105,7 +131,16 @@ defineProps({
:size="40"
:rank="showRank ? index + 1 : 0"
/>
<text class="player-name">{{ player.name }}</text>
<view
v-if="isMember(player)"
:class="['player-name', ...getMemberNicknameClass(player)]"
>
<text class="member-nickname__text">{{ player.name }}</text>
<text v-if="player.sVip === true" class="member-nickname__shine">
{{ player.name }}
</text>
</view>
<text v-else class="player-name">{{ player.name }}</text>
</view>
</view>
</scroll-view>
@@ -183,6 +218,13 @@ defineProps({
text-overflow: ellipsis;
text-align: center;
}
view.player-name {
justify-content: center;
}
.player-name .member-nickname__text,
.player-name .member-nickname__shine {
font-size: 12px;
}
.left-winner-badge {
position: absolute;
width: 50px;

View File

@@ -1,4 +1,5 @@
<script setup>
import { computed } from "vue";
import AppBackground from "@/components/AppBackground.vue";
import Avatar from "@/components/Avatar.vue";
import BowTarget from "@/components/BowTarget.vue";
@@ -8,6 +9,9 @@ import { storeToRefs } from "pinia";
const store = useStore();
const { user } = storeToRefs(store);
const isSVip = computed(() => user.value.sVip === true);
const isVip = computed(() => user.value.vip === true && user.value.sVip !== true);
const props = defineProps({
show: {
type: Boolean,
@@ -35,7 +39,21 @@ const props = defineProps({
<view>
<Avatar :src="user.avatar" :rankLvl="user.rankLvl" :size="45" />
<view>
<text>{{ user.nickName }}</text>
<view
v-if="isVip || isSVip"
:class="[
'bow-data-user-name',
'member-nickname',
isVip ? 'member-nickname--vip' : '',
isSVip ? 'member-nickname--svip' : '',
]"
>
<text class="member-nickname__text">{{ user.nickName }}</text>
<text v-if="isSVip" class="member-nickname__shine">
{{ user.nickName }}
</text>
</view>
<text v-else>{{ user.nickName }}</text>
<text>{{ user.lvlName }}</text>
</view>
</view>
@@ -44,7 +62,7 @@ const props = defineProps({
</view>
</view>
<view :style="{ width: '100%', marginBottom: '20px' }">
<BowTarget :scores="arrows" />
<BowTarget :scores="arrows" :isSvip="isSVip" />
</view>
<view class="desc">
<text>{{ arrows.length }}</text>
@@ -95,6 +113,13 @@ const props = defineProps({
margin-left: 10px;
color: #fff;
}
.bow-data-user-name {
max-width: 300rpx;
}
.bow-data-user-name .member-nickname__text,
.bow-data-user-name .member-nickname__shine {
max-width: 300rpx;
}
.header > view:first-child > view:last-child > text:last-child {
font-size: 10px;
background-color: #5f51ff;

View File

@@ -0,0 +1,387 @@
<script setup>
import { computed, onBeforeUnmount, ref, watch } from "vue";
const props = defineProps({
shot: {
type: Object,
default: null,
},
playKey: {
type: [String, Number],
default: "",
},
targetRadius: {
type: Number,
default: 20,
},
targetWidth: {
type: Number,
default: 0,
},
targetHeight: {
type: Number,
default: 0,
},
hitOffsetPx: {
type: Number,
default: 0,
},
});
const emit = defineEmits(["complete", "impact"]);
const phase = ref("idle");
const activePlayKey = ref("");
const animationKey = ref("");
const impactEmitted = ref(false);
let timers = [];
const isActive = computed(() => phase.value !== "idle");
const ARROW_IMPACT_MS = 340;
const COMPLETE_FALLBACK_MS = 980;
const safeTargetRadius = computed(() => {
const radius = Number(props.targetRadius);
return Number.isFinite(radius) && radius > 0 ? radius : 20;
});
const safeTargetSize = computed(() => {
const width = Number(props.targetWidth);
const height = Number(props.targetHeight);
return {
width: Number.isFinite(width) && width > 0 ? width : 0,
height: Number.isFinite(height) && height > 0 ? height : 0,
};
});
const shotPoint = computed(() => {
const x = Number(props.shot?.x);
const y = Number(props.shot?.y);
return {
x: Number.isFinite(x) ? x : 0,
y: Number.isFinite(y) ? y : 0,
};
});
const pointDirection = computed(() => {
const point = shotPoint.value;
const distance = Math.sqrt(point.x * point.x + point.y * point.y);
if (distance === 0) return null;
return {
x: point.x / distance,
y: point.y / distance,
};
});
const hitOffset = computed(() => {
const offset = Number(props.hitOffsetPx);
const safeOffset = Number.isFinite(offset) && offset > 0 ? offset : 0;
const direction = pointDirection.value;
return {
x: direction ? direction.x * safeOffset : 0,
y: direction ? -direction.y * safeOffset : 0,
};
});
const hitPercent = computed(() => {
const point = shotPoint.value;
const radius = safeTargetRadius.value;
const diameter = radius * 2;
return {
left: ((point.x + radius) / diameter) * 100,
top: ((radius - point.y) / diameter) * 100,
};
});
const arrowAngle = computed(() => {
const size = safeTargetSize.value;
if (!size.width || !size.height) {
const dx = hitPercent.value.left - 50;
const dy = 114 - hitPercent.value.top;
const fallbackAngle = Math.atan2(dx, dy || 1) * (180 / Math.PI);
return Math.max(-18, Math.min(18, fallbackAngle));
}
const startX = size.width * 0.5;
const startY = size.height * 1.14;
const endX = size.width * (hitPercent.value.left / 100) + hitOffset.value.x;
const endY = size.height * (hitPercent.value.top / 100) + hitOffset.value.y;
const dx = endX - startX;
const dy = startY - endY;
const angle = Math.atan2(dx, dy || 1) * (180 / Math.PI);
return Math.max(-18, Math.min(18, angle));
});
function formatPxOffset(value) {
if (!value) return "";
const operator = value > 0 ? "+" : "-";
return ` ${operator} ${Math.abs(value)}px`;
}
function formatTargetPosition(percent, offset) {
const pxOffset = formatPxOffset(offset);
return pxOffset ? `calc(${percent}%${pxOffset})` : `${percent}%`;
}
const crackStyle = computed(() => ({
left: formatTargetPosition(hitPercent.value.left, hitOffset.value.x),
top: formatTargetPosition(hitPercent.value.top, hitOffset.value.y),
}));
function getTargetTranslate(percent) {
const absPercent = Math.abs(percent);
const operator = percent >= 0 ? "-" : "+";
return `calc(${percent}vw ${operator} ${absPercent * 0.5}px)`;
}
const arrowMoveStyle = computed(() => {
const size = safeTargetSize.value;
let x = getTargetTranslate(hitPercent.value.left - 50);
let y = getTargetTranslate(hitPercent.value.top - 114);
if (size.width && size.height) {
const startX = size.width * 0.5;
const startY = size.height * 1.14;
const endX = size.width * (hitPercent.value.left / 100) + hitOffset.value.x;
const endY = size.height * (hitPercent.value.top / 100) + hitOffset.value.y;
x = `${endX - startX}px`;
y = `${endY - startY}px`;
}
return {
"--shot-tx": x,
"--shot-ty": y,
"--shot-angle": `${arrowAngle.value}deg`,
};
});
function clearTimers() {
timers.forEach((timer) => clearTimeout(timer));
timers = [];
}
function queueTimer(callback, delay) {
const timer = setTimeout(callback, delay);
timers.push(timer);
}
function emitImpactOnce(playKey) {
if (phase.value === "idle" || activePlayKey.value !== playKey || impactEmitted.value) return;
impactEmitted.value = true;
emit("impact");
}
function finish(playKey) {
if (phase.value === "idle" || activePlayKey.value !== playKey) return;
clearTimers();
phase.value = "idle";
activePlayKey.value = "";
emit("complete", playKey);
}
function play() {
if (!props.playKey || !props.shot || !props.shot.ring) return;
clearTimers();
activePlayKey.value = props.playKey;
animationKey.value = `${props.playKey}`;
impactEmitted.value = false;
phase.value = "playing";
queueTimer(() => {
emitImpactOnce(activePlayKey.value);
}, ARROW_IMPACT_MS);
queueTimer(() => {
finish(activePlayKey.value);
}, COMPLETE_FALLBACK_MS);
}
function handleArrowAnimationEnd() {
emitImpactOnce(activePlayKey.value);
}
function handleCrackAnimationEnd() {
finish(activePlayKey.value);
}
watch(
() => props.playKey,
() => {
play();
},
{ immediate: true }
);
onBeforeUnmount(() => {
clearTimers();
});
</script>
<template>
<view
v-show="isActive"
:class="['shot-effect', `shot-effect--${phase}`]"
:style="arrowMoveStyle"
>
<view
:key="`arrow-${animationKey}`"
class="shot-arrow-track"
@animationend="handleArrowAnimationEnd"
>
<image
class="shot-arrow"
src="../static/vip/svip-jian.png"
mode="heightFix"
/>
</view>
<view
:key="`flash-${animationKey}`"
class="shot-flash"
:style="crackStyle"
></view>
<view
:key="`crack-anchor-${animationKey}`"
class="shot-crack-anchor"
:style="crackStyle"
>
<image
:key="`crack-${animationKey}`"
class="shot-crack"
src="../static/vip/svip-lie.png"
mode="aspectFit"
@animationend="handleCrackAnimationEnd"
/>
</view>
</view>
</template>
<style scoped lang="scss">
.shot-effect {
position: absolute;
top: 0;
right: 0;
bottom: 0;
left: 0;
z-index: 9999;
pointer-events: none;
overflow: visible;
transform: translateZ(0);
}
.shot-arrow-track {
position: absolute;
left: 50%;
top: 114%;
width: 0;
height: 0;
opacity: 0;
transform: translate3d(0, 0, 0);
animation: none;
backface-visibility: hidden;
will-change: transform, opacity;
}
.shot-arrow {
position: absolute;
width: 248rpx;
height: 1186rpx;
left: 0;
top: 0;
opacity: 1;
transform-origin: 44.35% 3.04%;
transform: translate(-44.35%, -3.04%) rotate(var(--shot-angle));
backface-visibility: hidden;
will-change: transform;
}
.shot-effect--playing .shot-arrow-track {
animation: shot-arrow-fly 0.38s cubic-bezier(0.68, 0, 0.9, 0.62) forwards;
}
.shot-flash,
.shot-crack-anchor {
position: absolute;
transform: translate(-50%, -50%);
backface-visibility: hidden;
will-change: transform, opacity;
}
.shot-flash {
width: 86rpx;
height: 86rpx;
border-radius: 50%;
border: 3rpx solid rgba(255, 236, 166, 0.9);
opacity: 0;
animation: none;
}
.shot-crack-anchor {
width: 750rpx;
height: 750rpx;
}
.shot-crack {
width: 100%;
height: 100%;
opacity: 0;
transform-origin: center center;
animation: none;
will-change: transform, opacity;
}
.shot-effect--playing .shot-flash {
animation: shot-flash 0.42s ease-out 0.32s forwards;
}
.shot-effect--playing .shot-crack {
animation: shot-crack-hit 0.52s ease-out 0.34s forwards;
}
@keyframes shot-arrow-fly {
0% {
opacity: 1;
transform: translate3d(0, 0, 0);
}
86% {
opacity: 1;
transform: translate3d(var(--shot-tx), var(--shot-ty), 0);
}
100% {
opacity: 0;
transform: translate3d(var(--shot-tx), var(--shot-ty), 0);
}
}
@keyframes shot-flash {
0% {
opacity: 0.95;
transform: translate(-50%, -50%) scale(0.2);
}
100% {
opacity: 0;
transform: translate(-50%, -50%) scale(1.9);
}
}
@keyframes shot-crack-hit {
0% {
opacity: 0;
transform: scale(0.55);
}
28% {
opacity: 1;
transform: scale(1.08);
}
56% {
opacity: 1;
transform: scale(1);
}
100% {
opacity: 0;
transform: scale(1.18);
}
}
</style>

View File

@@ -1,6 +1,7 @@
<script setup>
import { ref, watch, onMounted, onBeforeUnmount, computed } from "vue";
import { ref, watch, onMounted, onBeforeUnmount, computed, nextTick } from "vue";
import PointSwitcher from "@/components/PointSwitcher.vue";
import BowShotEffect from "@/components/BowShotEffect.vue";
import { MESSAGETYPES, MESSAGETYPESV2 } from "@/constants";
import { simulShootAPI } from "@/apis";
@@ -26,6 +27,10 @@ const props = defineProps({
type: Array,
default: () => [],
},
isSvip: {
type: Boolean,
default: false,
},
mode: {
type: String,
default: "solo", // solo 单排team 双排
@@ -57,18 +62,120 @@ const timer = ref(null);
const dirTimer = ref(null);
const angle = ref(null);
const circleColor = ref("");
const shotEffect = ref(null);
const hiddenRedLatestKey = ref("");
const hiddenBlueLatestKey = ref("");
const targetShaking = ref(false);
const shakeTimer = ref(null);
const ROUND_TIP_OFFSET_Y = -32;
const EXPERIENCE_TIP_OFFSET_Y = -68;
function buildShotEffectKey(team, shot, index) {
return [
team,
index,
shot?.playerId ?? "",
shot?.x ?? "",
shot?.y ?? "",
shot?.ring ?? "",
shot?.ringX ? 1 : 0,
].join("-");
}
function shouldPlayShotEffect(shot) {
return props.isSvip && !!shot && Number(shot.ring) > 0;
}
function clearTipTimer() {
if (timer.value) {
clearTimeout(timer.value);
timer.value = null;
}
}
function showShotTip(team, shot) {
clearTipTimer();
if (team === "red") {
latestOne.value = shot;
timer.value = setTimeout(() => {
latestOne.value = null;
timer.value = null;
}, 1000);
return;
}
bluelatestOne.value = shot;
timer.value = setTimeout(() => {
bluelatestOne.value = null;
timer.value = null;
}, 1000);
}
function triggerShotEffect(team, shot, index) {
const key = buildShotEffectKey(team, shot, index);
if (shotEffect.value?.team === "red") hiddenRedLatestKey.value = "";
if (shotEffect.value?.team === "blue") hiddenBlueLatestKey.value = "";
if (team === "red") {
latestOne.value = null;
hiddenRedLatestKey.value = key;
} else {
bluelatestOne.value = null;
hiddenBlueLatestKey.value = key;
}
shotEffect.value = { key, team, shot };
}
function completeShotEffect(key) {
if (!shotEffect.value || shotEffect.value.key !== key) return;
const { team, shot } = shotEffect.value;
if (team === "red") hiddenRedLatestKey.value = "";
if (team === "blue") hiddenBlueLatestKey.value = "";
shotEffect.value = null;
showShotTip(team, shot);
}
function shakeTarget() {
targetShaking.value = false;
if (shakeTimer.value) {
clearTimeout(shakeTimer.value);
shakeTimer.value = null;
}
nextTick(() => {
targetShaking.value = true;
shakeTimer.value = setTimeout(() => {
targetShaking.value = false;
shakeTimer.value = null;
}, 260);
});
}
function shouldHideRedHit(index) {
return !!hiddenRedLatestKey.value && index === props.scores.length - 1;
}
function shouldHideBlueHit(index) {
return !!hiddenBlueLatestKey.value && index === props.blueScores.length - 1;
}
watch(
() => props.scores,
(newVal) => {
if (newVal.length - prevScores.value.length === 1) {
latestOne.value = newVal[newVal.length - 1];
if (timer.value) clearTimeout(timer.value);
timer.value = setTimeout(() => {
latestOne.value = null;
}, 1000);
const latestShot = newVal[newVal.length - 1];
if (shouldPlayShotEffect(latestShot)) {
triggerShotEffect("red", latestShot, newVal.length - 1);
} else {
showShotTip("red", latestShot);
}
} else if (newVal.length <= prevScores.value.length) {
latestOne.value = null;
hiddenRedLatestKey.value = "";
if (shotEffect.value?.team === "red") shotEffect.value = null;
}
prevScores.value = [...newVal];
},
@@ -81,11 +188,16 @@ watch(
() => props.blueScores,
(newVal) => {
if (newVal.length - prevBlueScores.value.length === 1) {
bluelatestOne.value = newVal[newVal.length - 1];
if (timer.value) clearTimeout(timer.value);
timer.value = setTimeout(() => {
bluelatestOne.value = null;
}, 1000);
const latestShot = newVal[newVal.length - 1];
if (shouldPlayShotEffect(latestShot)) {
triggerShotEffect("blue", latestShot, newVal.length - 1);
} else {
showShotTip("blue", latestShot);
}
} else if (newVal.length <= prevBlueScores.value.length) {
bluelatestOne.value = null;
hiddenBlueLatestKey.value = "";
if (shotEffect.value?.team === "blue") shotEffect.value = null;
}
prevBlueScores.value = [...newVal];
},
@@ -164,6 +276,15 @@ function getHitStyle(shot) {
};
}
function getSvipHitBgStyle(shot) {
const radius = currentHitRadiusPx.value;
const point = getShotPoint(shot);
return {
...getTargetPositionStyle(point, radius),
};
}
function getRoundTipStyle(shot) {
const point = getShotPoint(shot, true);
return getTargetPositionStyle(
@@ -239,12 +360,16 @@ onBeforeUnmount(() => {
clearTimeout(dirTimer.value);
dirTimer.value = null;
}
if (shakeTimer.value) {
clearTimeout(shakeTimer.value);
shakeTimer.value = null;
}
uni.$off("socket-inbox", onReceiveMessage);
});
</script>
<template>
<view class="container">
<view :class="['container', { 'container--effecting': shotEffect }]">
<view class="header" v-if="totalRound > 0">
<text v-if="totalRound > 0" class="round-count">{{
(currentRound > totalRound ? totalRound : currentRound) +
@@ -252,7 +377,7 @@ onBeforeUnmount(() => {
totalRound
}}</text>
</view>
<view class="target">
<view :class="['target', { 'target--shake': targetShaking }]">
<view v-if="angle !== null" class="arrow-dir" :style="arrowStyle">
<view :style="{ background: circleColor }">
<image src="../static/dot-circle.png" mode="widthFix" />
@@ -292,8 +417,15 @@ onBeforeUnmount(() => {
}}<text v-if="bluelatestOne.ring">环</text></view
>
<block v-for="(bow, index) in scores" :key="index">
<image
v-if="pMode && isSvip && bow.ring > 0 && !shouldHideRedHit(index)"
class="svip-hit-bg"
src="../static/vip/svip-xuan.png"
:style="getSvipHitBgStyle(bow)"
mode="aspectFit"
/>
<view
v-if="bow.ring > 0"
v-if="bow.ring > 0 && !shouldHideRedHit(index)"
:class="`hit ${pMode ? 'b' : 's'}-point ${
index === scores.length - 1 && latestOne ? 'pump-in' : ''
}`"
@@ -305,8 +437,15 @@ onBeforeUnmount(() => {
>
</block>
<block v-for="(bow, index) in blueScores" :key="index">
<image
v-if="pMode && isSvip && bow.ring > 0 && !shouldHideBlueHit(index)"
class="svip-hit-bg"
src="../static/vip/svip-xuan.png"
:style="getSvipHitBgStyle(bow)"
mode="aspectFit"
/>
<view
v-if="bow.ring > 0"
v-if="bow.ring > 0 && !shouldHideBlueHit(index)"
:class="`hit ${pMode ? 'b' : 's'}-point ${
index === blueScores.length - 1 && bluelatestOne ? 'pump-in' : ''
}`"
@@ -318,6 +457,13 @@ onBeforeUnmount(() => {
<text v-if="pMode">{{ index + 1 }}</text>
</view>
</block>
<BowShotEffect
:shot="shotEffect && shotEffect.shot"
:playKey="shotEffect ? shotEffect.key : ''"
:targetRadius="safeTargetRadius"
@impact="shakeTarget"
@complete="completeShotEffect"
/>
<image src="../static/bow-target.png" mode="widthFix" />
</view>
<view class="footer">
@@ -339,13 +485,22 @@ onBeforeUnmount(() => {
height: calc(100vw - 30px);
padding: 0px 15px;
position: relative;
z-index: 3;
}
.container--effecting {
z-index: 10000;
}
.target {
position: relative;
margin: 10px;
width: calc(100% - 20px);
height: calc(100% - 20px);
z-index: -1;
z-index: 1;
pointer-events: none;
transform-origin: center center;
}
.target--shake {
animation: target-shake 0.26s ease-out;
}
.e-value {
position: absolute;
@@ -400,17 +555,26 @@ onBeforeUnmount(() => {
width: 100%;
height: 100%;
}
.svip-hit-bg {
position: absolute;
width: 48rpx;
height: 48rpx;
z-index: 1;
pointer-events: none;
transform-origin: center center;
animation: svip-hit-xuan 1.2s linear infinite;
}
.hit {
position: absolute;
border-radius: 50%;
z-index: 1;
z-index: 2;
color: #fff;
transition: all 0.3s ease;
transition: transform 0.2s ease, opacity 0.2s ease;
box-sizing: border-box;
}
.b-point {
border: 1px solid #fff;
z-index: 1;
z-index: 2;
display: flex;
justify-content: center;
align-items: center;
@@ -426,6 +590,20 @@ onBeforeUnmount(() => {
transform: translate(-50%, -50%);*/
margin-top: 2rpx;
}
@keyframes svip-hit-xuan {
0% {
opacity: 0.9;
transform: translate(-50%, -50%) rotate(0deg) scale(0.92);
}
50% {
opacity: 1;
transform: translate(-50%, -50%) rotate(180deg) scale(1.08);
}
100% {
opacity: 0.9;
transform: translate(-50%, -50%) rotate(360deg) scale(0.92);
}
}
@keyframes target-pump-in {
from {
transform: translate(-50%, -50%) scale(2);
@@ -435,6 +613,29 @@ onBeforeUnmount(() => {
transform: translate(-50%, -50%) scale(1);
}
}
@keyframes target-shake {
0% {
transform: translate(0, 0);
}
14% {
transform: translate(-20rpx, 8rpx);
}
28% {
transform: translate(16rpx, -8rpx);
}
44% {
transform: translate(-12rpx, 6rpx);
}
64% {
transform: translate(8rpx, -4rpx);
}
82% {
transform: translate(-4rpx, 2rpx);
}
100% {
transform: translate(0, 0);
}
}
.hit.pump-in {
animation: target-pump-in 0.3s ease-out forwards;
transform-origin: center center;

View File

@@ -55,6 +55,9 @@ const signin = () => {
}
};
const isSVip = computed(() => user.value.sVip === true);
const isVip = computed(() => user.value.vip === true && user.value.sVip !== true);
const loading = ref(false);
const pointBook = ref(null);
const heat = ref(0);
@@ -128,7 +131,21 @@ onBeforeUnmount(() => {
:size="40"
borderColor="#333"
/>
<text class="truncate">{{ user.nickName }}</text>
<view
v-if="isVip || isSVip"
:class="[
'point-book-user-name',
'member-nickname',
isVip ? 'member-nickname--vip' : '',
isSVip ? 'member-nickname--svip' : '',
]"
>
<text class="member-nickname__text">{{ user.nickName }}</text>
<text v-if="isSVip" class="member-nickname__shine">
{{ user.nickName }}
</text>
</view>
<text v-else class="truncate">{{ user.nickName }}</text>
<image
v-if="heat"
:src="`../static/hot${heat}.png`"
@@ -285,7 +302,8 @@ onBeforeUnmount(() => {
width: 36rpx;
height: 36rpx;
}
.user-header > text:nth-child(2) {
.user-header > text:nth-child(2),
.user-header > .point-book-user-name {
font-weight: 500;
font-size: 30rpx;
color: #333333;
@@ -316,7 +334,7 @@ onBeforeUnmount(() => {
width: 156rpx;
height: 28rpx;
font-weight: 400;
font-size: 20rpx;
font-size: 24rpx;
color: #ffffff;
text-align: center;
line-height: 28rpx;

View File

@@ -0,0 +1,234 @@
<script setup>
const props = defineProps({
show: {
type: Boolean,
default: false,
},
title: {
type: String,
default: "",
},
content: {
type: String,
default: "",
},
cancelText: {
type: String,
default: "取消",
},
confirmText: {
type: String,
default: "确定",
},
showCancel: {
type: Boolean,
default: true,
},
showConfirm: {
type: Boolean,
default: true,
},
onCancel: {
type: Function,
default: null,
},
onConfirm: {
type: Function,
default: null,
},
});
const handleCancel = () => {
props.onCancel?.();
};
const handleConfirm = () => {
props.onConfirm?.();
};
</script>
<template>
<view class="modal-mask" :style="{ display: show ? 'flex' : 'none' }">
<view class="modal-wrap scale-in">
<image
class="dialog-light"
src="../static/common/dialog-light.png"
mode="widthFix"
/>
<image
class="dialog-icon"
src="../static/common/dialog-icon.png"
mode="widthFix"
/>
<view class="dialog-panel">
<image
class="dialog-bg"
src="../static/common/dialog-bg.png"
mode="scaleToFill"
/>
<view class="dialog-content">
<slot>
<text v-if="title" class="dialog-title">{{ title }}</text>
<text v-if="content" class="dialog-text">{{ content }}</text>
</slot>
</view>
<view
v-if="showCancel || showConfirm"
class="dialog-actions"
:class="{ single: !(showCancel && showConfirm) }"
>
<view
v-if="showCancel"
class="dialog-button cancel"
@click="handleCancel"
>
<text>{{ cancelText }}</text>
</view>
<view
v-if="showConfirm"
class="dialog-button confirm"
@click="handleConfirm"
>
<text>{{ confirmText }}</text>
</view>
</view>
</view>
</view>
</view>
</template>
<style scoped lang="scss">
.modal-mask {
width: 100vw;
height: 100vh;
position: fixed;
top: 0;
left: 0;
background-color: rgba(0, 0, 0, 0.62);
justify-content: center;
align-items: center;
z-index: 999;
}
.modal-wrap {
position: relative;
display: flex;
width: 549rpx;
min-height: 318rpx;;
padding-top: 168rpx;
justify-content: flex-start;
align-items: center;
}
.dialog-light {
position: absolute;
top: 0;
left: 50%;
width: 520rpx;
z-index: 1;
transform-origin: center center;
animation: rotateLight 8s linear infinite;
}
.dialog-icon {
position: absolute;
top: 70rpx;
left: 50%;
width: 250rpx;
z-index: 5;
transform: translateX(-50%);
}
.dialog-panel {
position: relative;
width: 100%;
min-height: 318rpx;
padding: 98rpx 36rpx 40rpx 36rpx;
box-sizing: border-box;
z-index: 3;
border-radius: 24rpx;
border: 2rpx solid rgba(249, 213, 161, 0.5);
overflow: hidden;
}
.dialog-bg {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
border-radius: 24rpx;
}
.dialog-content {
position: relative;
z-index: 1;
display: flex;
flex-direction: column;
align-items: center;
color: #fff;
text-align: center;
}
.dialog-title {
font-size: 28rpx;
font-weight: 700;
line-height: 40rpx;
}
.dialog-text {
margin-top: 10rpx;
font-size: 26rpx;
line-height: 36rpx;
white-space: pre-wrap;
}
.dialog-actions {
position: relative;
z-index: 1;
display: flex;
margin-top: 50rpx;
justify-content: space-between;
align-items: center;
gap: 20rpx;
}
.dialog-actions.single {
justify-content: center;
}
.dialog-button {
display: flex;
width: 232rpx;
height: 70rpx;
line-height: 70rpx;
border-radius: 44rpx;
justify-content: center;
align-items: center;
font-size: 26rpx;
font-weight: 500;
}
.dialog-button.cancel {
color: #fff;
background-color: rgba(255,255,255,0.2);
}
.dialog-button.confirm {
color: #000000;
background-color: #ffda3f;
}
@keyframes rotateLight {
from {
transform: translateX(-50%) rotate(0deg);
}
to {
transform: translateX(-50%) rotate(360deg);
}
}
</style>

View File

@@ -21,6 +21,13 @@ const getRingText = (arrow) => {
if (arrow.ringX && arrow.ring) return "X环";
return arrow.ring ? `${arrow.ring}` : "-";
};
const isMember = (player = {}) => player.vip === true || player.sVip === true;
const getMemberNicknameClass = (player = {}) => [
"member-nickname",
player.vip === true && player.sVip !== true ? "member-nickname--vip" : "",
player.sVip === true ? "member-nickname--svip" : "",
];
</script>
<template>
@@ -37,7 +44,16 @@ const getRingText = (arrow) => {
mode="widthFix"
/>
<image :src="player.avatar || '../static/user-icon.png'" mode="widthFix" />
<text>{{ player.name }}</text>
<view
v-if="isMember(player)"
:class="['player-score-name', ...getMemberNicknameClass(player)]"
>
<text class="member-nickname__text">{{ player.name }}</text>
<text v-if="player.sVip === true" class="member-nickname__shine">
{{ player.name }}
</text>
</view>
<text v-else>{{ player.name }}</text>
<view>
<view>
<view v-for="(_, index) in rowCount" :key="index">
@@ -98,6 +114,13 @@ const getRingText = (arrow) => {
text-overflow: ellipsis;
width: 20%;
}
.player-score-name {
width: 20%;
}
.player-score-name .member-nickname__text,
.player-score-name .member-nickname__shine {
font-size: 14px;
}
.container > view:nth-child(4) {
display: flex;
flex-direction: column;

View File

@@ -22,6 +22,15 @@ const props = defineProps({
const like = ref(props.data.ifLike);
const likeCount = ref(props.data.likeTotal || 0);
const isMember = (data = {}) => data.vip === true || data.sVip === true;
const getMemberNicknameClass = (data = {}) => [
"point-rank-name",
"member-nickname",
data.vip === true && data.sVip !== true ? "member-nickname--vip" : "",
data.sVip === true ? "member-nickname--svip" : "",
];
watch(
() => props.data,
(newVal) => {
@@ -53,7 +62,13 @@ const onClick = async () => {
<view>
<Avatar :src="data.avatar || '../static/user-icon.png'" :size="36" />
<view>
<text class="truncate">{{ data.name }}</text>
<view v-if="isMember(data)" :class="getMemberNicknameClass(data)">
<text class="member-nickname__text">{{ data.name }}</text>
<text v-if="data.sVip === true" class="member-nickname__shine">
{{ data.name }}
</text>
</view>
<text v-else class="truncate">{{ data.name }}</text>
<view>
<text>{{ data.totalDay }}</text>
<view />
@@ -118,6 +133,14 @@ const onClick = async () => {
color: #333333;
margin-bottom: 5rpx;
}
.rank-item > view:nth-child(2) > view:last-child > .point-rank-name {
width: 200rpx;
margin-bottom: 5rpx;
}
.point-rank-name .member-nickname__text,
.point-rank-name .member-nickname__shine {
font-size: 28rpx;
}
.rank-item > view:nth-child(2) > view:last-child > view {
display: flex;
align-items: center;

View File

@@ -1,5 +1,5 @@
<script setup>
import { ref } from "vue";
import { ref, watch } from "vue";
import { onShow } from "@dcloudio/uni-app";
import SModal from "@/components/SModal.vue";
import Avatar from "@/components/Avatar.vue";
@@ -60,6 +60,21 @@ function onNicknameChange(e) {
nickName.value = e.detail.value;
}
const resetForm = () => {
loading.value = false;
agree.value = false;
phone.value = "";
avatarUrl.value = "";
nickName.value = "";
};
watch(
() => props.show,
(show) => {
if (show) resetForm();
}
);
const handleLogin = async () => {
if (loading.value) return;
if (!phone.value) {
@@ -139,11 +154,7 @@ const openPrivacyLink = () => {
};
onShow(() => {
loading.value = false;
agree.value = false;
phone.value = "";
avatarUrl.value = "";
nickName.value = "";
resetForm();
});
</script>
@@ -189,10 +200,11 @@ onShow(() => {
<text :style="{ color: noBg ? '#666' : '#fff' }">昵称:</text>
<input
type="nickname"
:value="nickName"
placeholder="请输入昵称"
:placeholder-style="`color: ${noBg ? '#666' : '#fff9'} `"
@input="onNicknameChange"
@change="onNicknameChange"
@blur="onNicknameBlur"
:style="{ color: noBg ? '#333' : '#fff' }"
/>
</view>

View File

@@ -19,6 +19,8 @@ const nextLvlPoints = ref(0);
const containerWidth = computed(() =>
props.showRank ? "72%" : "calc(100% - 15px)"
);
const isSVip = computed(() => user.value.sVip === true);
const isVip = computed(() => user.value.vip === true && !isSVip.value);
const toUserPage = () => {
// 获取当前页面路径
const pages = getCurrentPages();
@@ -69,7 +71,18 @@ watch(
/>
<view class="user-details" @click="toUserPage">
<view class="user-name">
<text>{{ user.nickName }}</text>
<view
:class="[
'member-nickname',
isVip ? 'member-nickname--vip' : '',
isSVip ? 'member-nickname--svip' : '',
]"
>
<text class="member-nickname__text">{{ user.nickName }}</text>
<text v-if="isSVip" class="member-nickname__shine">{{
user.nickName
}}</text>
</view>
<image
class="user-name-image"
src="../static/vip1.png"
@@ -148,12 +161,13 @@ watch(
margin-bottom: 5px;
}
.user-name > text:first-child {
font-size: 13px;
.user-name .member-nickname {
max-width: 180rpx;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
.user-name .member-nickname__text,
.user-name .member-nickname__shine {
font-size: 13px;
}
.user-name-image {