Browse Source

Merge branch 'milestone-20250722-抽奖' into pangluotong/feature-20250712103401-抽奖

songtongtong/feature-20250717104937-众筹
pangluotong 4 weeks ago
parent
commit
909cc2fab0
  1. 2
      .env.development
  2. 2
      .env.production
  3. 64
      src/views/choujiang/hxl-cj/cj.vue
  4. 57
      src/views/choujiang/lottery/PrizePanel.vue

2
.env.development

@ -2,7 +2,7 @@
VITE_ENV = 'development' VITE_ENV = 'development'
VITE_OUTPUT_DIR = 'dev' VITE_OUTPUT_DIR = 'dev'
# public path # public path
VITE_PUBLIC_PATH = /
VITE_PUBLIC_PATH = /test
#新数据接口 #新数据接口
VITE_APP_API_BASE_URL = "https://dbqb.nfdxy.net/devLotApi" VITE_APP_API_BASE_URL = "https://dbqb.nfdxy.net/devLotApi"

2
.env.production

@ -2,7 +2,7 @@
VITE_ENV = 'production' VITE_ENV = 'production'
VITE_OUTPUT_DIR = 'dist' VITE_OUTPUT_DIR = 'dist'
# public path # public path
VITE_PUBLIC_PATH = /aixiaocaishen
VITE_PUBLIC_PATH = /
# VITE_PUBLIC_PATH = / # VITE_PUBLIC_PATH = /
# Whether to open mock # Whether to open mock

64
src/views/choujiang/hxl-cj/cj.vue

@ -376,7 +376,7 @@ const initAll = async () => {
prizes.value.forEach((item, index) => { prizes.value.forEach((item, index) => {
item.type = index; item.type = index;
item.count = item.amount; item.count = item.amount;
item.leftCount = item.amount; //
item.leftCount = item.remainNum; //
item.hasCount = item.amount; // item.hasCount = item.amount; //
item.isLook = false; // item.isLook = false; //
EACH_COUNT.push(item.perWin); EACH_COUNT.push(item.perWin);
@ -917,7 +917,7 @@ function switchPage(direction) {
const object = threeDCards[cardIndex]; const object = threeDCards[cardIndex];
const cardPage = Math.floor(index / cardsPerPage); const cardPage = Math.floor(index / cardsPerPage);
const isVisible = cardPage === newPage; const isVisible = cardPage === newPage;
const wasVisible = cardPage === pageIndex.value;
// //
const pageNowIndex = index % cardsPerPage; const pageNowIndex = index % cardsPerPage;
const pageLocate = pageLocates[cardPage][pageNowIndex]; const pageLocate = pageLocates[cardPage][pageNowIndex];
@ -930,11 +930,53 @@ function switchPage(direction) {
// "pageLocate", // "pageLocate",
// pageLocate // pageLocate
// ); // );
//
let targetY;
if (isVisible) {
//
if (direction === "next") {
//
targetY = pageLocate.y;
} else {
//
targetY = pageLocate.y;
}
} else {
//
if (direction === "next") {
//
targetY = pageLocate.y + 1000;
} else {
//
targetY = pageLocate.y - 1000;
}
}
//
let startY;
if (wasVisible) {
//
startY = object.position.y;
} else {
//
if (direction === "next") {
//
startY = pageLocate.y - 1000;
} else {
//
startY = pageLocate.y + 1000;
}
}
//
object.position.y = startY;
new TWEEN.Tween(object.position) new TWEEN.Tween(object.position)
.to( .to(
{ {
x: pageLocate.x, x: pageLocate.x,
y: isVisible ? pageLocate.y : pageLocate.y + 1000,
y: targetY,
z: 2100, z: 2100,
}, },
duration duration
@ -1073,16 +1115,17 @@ const lotteryBtn = () => {
getPrizeUsers.value = []; getPrizeUsers.value = [];
let params = { let params = {
gradeName: currentPrize.value.gradeName,
prizeName: currentPrize.value.prizeName,
gradeId: currentPrize.value.gradeId,
prizeId: currentPrize.value.prizeId,
perWin: currentPrize.value.perWin, perWin: currentPrize.value.perWin,
remainNum: currentPrize.value.leftCount,
}; };
// API // API
startLotteryApi(params) startLotteryApi(params)
.then((res) => { .then((res) => {
// API // API
getPrizeUsers.value = res.data || [];
console.log("API返回结果:", res.data);
getPrizeUsers.value = res.data.data || [];
console.log("API返回结果:", res.data.data);
}) })
.catch((err) => { .catch((err) => {
console.error("API调用失败:", err); console.error("API调用失败:", err);
@ -1114,7 +1157,8 @@ const lottery = () => {
selectedCardIndex = []; selectedCardIndex = [];
// , // ,
for (let i = 0; i < getPrizeUsers.value; i++) {
for (let i = 0; i < getPrizeUsers.value.length; i++) {
console.log("111", getPrizeUsers.value[i]);
currentLuckys.push(getPrizeUsers.value[i]); currentLuckys.push(getPrizeUsers.value[i]);
currentPrize.value.hasCount--; currentPrize.value.hasCount--;
@ -1164,7 +1208,7 @@ function random(num) {
*/ */
function changeCard(cardIndex, user) { function changeCard(cardIndex, user) {
let card = threeDCards[cardIndex].element; let card = threeDCards[cardIndex].element;
// console.log("user", user);
card.innerHTML = `<div class="name">${user.jwcode}</div>`; card.innerHTML = `<div class="name">${user.jwcode}</div>`;
} }
@ -1176,7 +1220,7 @@ function changeSelectedCard(cardIndex, user) {
let card = threeDCards[cardIndex].element; let card = threeDCards[cardIndex].element;
card.innerHTML = `<div class="name">${user[1]}</div>`;
card.innerHTML = `<div class="name">${user.jwcode}</div>`;
} }
/** /**
* 切换名牌背景 * 切换名牌背景

57
src/views/choujiang/lottery/PrizePanel.vue

@ -36,9 +36,6 @@
<span class="progress-bar-text"> <span class="progress-bar-text">
{{ getLeftCount(prize) }}/{{ prize.count }} {{ getLeftCount(prize) }}/{{ prize.count }}
</span> </span>
</div> </div>
</div> </div>
</div> </div>
@ -55,6 +52,7 @@
<div></div> <div></div>
<div></div> <div></div>
<div></div> <div></div>
</div>
<div class="prize-panel-footer"> <div class="prize-panel-footer">
<div class="arrow-up" @click="openWinnerList"></div> <div class="arrow-up" @click="openWinnerList"></div>
<button <button
@ -67,7 +65,6 @@
</div> </div>
</div> </div>
</div> </div>
</div>
<div v-else> <div v-else>
<div class="prize-panel-root"> <div class="prize-panel-root">
@ -111,7 +108,8 @@
prizes[lastRevealedIdx].count prizes[lastRevealedIdx].count
}} }}
</span> </span>
</div> <div class="prize-panel-footer">
</div>
<div class="prize-panel-footer">
<div class="arrow-down" @click="toggleWinnerList"></div> <div class="arrow-down" @click="toggleWinnerList"></div>
<div <div
v-if="showWinnerList" v-if="showWinnerList"
@ -163,10 +161,8 @@
</div> </div>
</div> </div>
</div> </div>
</div> </div>
</div> </div>
</div> </div>
</template> </template>
@ -175,7 +171,6 @@ import { ref, computed, nextTick, watch, onMounted } from "vue";
import { useLotteryStore } from "../../../store/lottery"; import { useLotteryStore } from "../../../store/lottery";
import { useDataManager } from "../lottery/dataManager"; import { useDataManager } from "../lottery/dataManager";
const props = defineProps({ const props = defineProps({
prizes: Array, prizes: Array,
}); });
@ -242,7 +237,10 @@ function canRevealPrize(idx) {
// //
function handleReveal(idx) { function handleReveal(idx) {
// //
if (idx !== nextRevealIdx.value ) {alert("请按顺序揭秘奖品!"); return;}
if (idx !== nextRevealIdx.value) {
alert("请按顺序揭秘奖品!");
return;
}
if (idx === nextRevealIdx.value && canRevealPrize(idx)) { if (idx === nextRevealIdx.value && canRevealPrize(idx)) {
revealedCount.value++; revealedCount.value++;
lastRevealedIdx.value = idx; // lastRevealedIdx.value = idx; //
@ -279,7 +277,9 @@ console.log("fakeWinners", fakeWinners.value);
import { getGetPrizeUserListApi } from "../../../api/API"; import { getGetPrizeUserListApi } from "../../../api/API";
const updateWinners = async () => { const updateWinners = async () => {
try { try {
const response = await getGetPrizeUserListApi({})
const response = await getGetPrizeUserListApi({
});
console.log("updatePrizeList response", response); console.log("updatePrizeList response", response);
fakeWinners.value = response.data.list; fakeWinners.value = response.data.list;
console.log("updateWinners fakeWinners", fakeWinners.value); console.log("updateWinners fakeWinners", fakeWinners.value);
@ -288,7 +288,6 @@ const updateWinners = async () => {
} }
}; };
async function openWinnerList() { async function openWinnerList() {
// showWinnerList.value = true; // showWinnerList.value = true;
if (!showWinnerList.value) { if (!showWinnerList.value) {
if (revealedCount.value === 0) { if (revealedCount.value === 0) {
@ -361,23 +360,20 @@ function getProgressPercent(prize) {
// onMounted(() => { // onMounted(() => {
// updateWinners(); // updateWinners();
// }); // });
</script> </script>
<style scoped> <style scoped>
.prize-panel-list { .prize-panel-list {
position: absolute;
top: 20px;
left: 20px;
position: relative;
background: none; background: none;
z-index: 10; z-index: 10;
min-width: 320px;
min-width: 300px;
max-width: 342px; max-width: 342px;
text-align: left; text-align: left;
display: flex; display: flex;
flex-direction: column; flex-direction: column;
gap: 18px; gap: 18px;
height: 400px;
height: 700px;
overflow-x: hidden !important; overflow-x: hidden !important;
overflow-y: auto; overflow-y: auto;
padding-right: 10px; padding-right: 10px;
@ -385,15 +381,14 @@ function getProgressPercent(prize) {
scrollbar-color: #ffd283 rgba(255, 210, 131, 0.3); /* Firefox */ scrollbar-color: #ffd283 rgba(255, 210, 131, 0.3); /* Firefox */
} }
.prize-panel-list1 { .prize-panel-list1 {
position: absolute;
top: 20px;
left: 20px;
position: relative;
background: none; background: none;
z-index: 10; z-index: 10;
min-width: 320px; min-width: 320px;
max-width: 342px; max-width: 342px;
text-align: left; text-align: left;
display: flex;}
display: flex;
}
.prize-panel-list::-webkit-scrollbar { .prize-panel-list::-webkit-scrollbar {
width: 6px; width: 6px;
@ -503,10 +498,20 @@ function getProgressPercent(prize) {
font-size: 20px; font-size: 20px;
font-weight: bold; font-weight: bold;
} }
.prize-panel-root {
position: absolute;
top: 20px;
left: 20px;
background: none;
z-index: 10;
min-width: 320px;
max-width: 342px;
display: flex;
flex-direction: column;
}
.prize-panel-footer { .prize-panel-footer {
position: fixed;
right: 750px;
bottom: 435px;
position: relative;
width: 100%; width: 100%;
display: flex; display: flex;
flex-direction: column; flex-direction: column;
@ -514,6 +519,7 @@ function getProgressPercent(prize) {
z-index: 20; z-index: 20;
padding: 10px 0; padding: 10px 0;
border-radius: 0 0 6px 6px; border-radius: 0 0 6px 6px;
margin-top: 10px;
} }
.arrow-up { .arrow-up {
position: relative; position: relative;
@ -537,7 +543,6 @@ function getProgressPercent(prize) {
background-image: url("../../../assets/展开.png"); background-image: url("../../../assets/展开.png");
background-size: cover; background-size: cover;
background-position: center; background-position: center;
} }
.winner-btn { .winner-btn {
background: rgba(255, 210, 131, 0.8); background: rgba(255, 210, 131, 0.8);
@ -553,7 +558,7 @@ function getProgressPercent(prize) {
.winner-modal-mask { .winner-modal-mask {
position: fixed; position: fixed;
top: 142px; top: 142px;
left:-4px;
left: -4px;
width: 100vw; width: 100vw;
height: 100vh; height: 100vh;
background: rgba(0, 0, 0, 0.01); background: rgba(0, 0, 0, 0.01);

Loading…
Cancel
Save