Browse Source

添加抽奖的接口

songtongtong/feature-20250717104937-众筹
no99 4 weeks ago
parent
commit
a87d92a904
  1. 9
      src/api/API.js
  2. 50
      src/views/choujiang/hxl-cj/cj.vue
  3. 22
      vite.config.js.timestamp-1753077096347-78067037e45f7.mjs

9
src/api/API.js

@ -28,3 +28,12 @@ export const getGetPrizeUserListApi = function (params) {
data: params, data: params,
}); });
}; };
// 开始抽奖
export const startLotteryApi = function (params) {
return request({
url: `/Api/api/lottery/start`,
method: "POST",
data: params,
});
};

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

@ -150,6 +150,7 @@ import {
getPrizeListApi, getPrizeListApi,
getUserListApi, getUserListApi,
getGetPrizeUserListApi, getGetPrizeUserListApi,
startLotteryApi,
} from "../../../api/API"; } from "../../../api/API";
// //
@ -194,7 +195,7 @@ const prizes = ref([]);
let EACH_COUNT = []; let EACH_COUNT = [];
const users = ref([]); const users = ref([]);
const getPrizeUsers = ref([]);
// //
let isLotting = false; let isLotting = false;
const setLotteryStatus = (status = false) => { const setLotteryStatus = (status = false) => {
@ -249,7 +250,7 @@ const openGetPrize = async () => {
} }
}); });
let scroll = document.getElementById("prizeBar"); let scroll = document.getElementById("prizeBar");
scroll.style.height = "110px";
// scroll.style.height = "110px";
}; };
const closeGetPrize = () => { const closeGetPrize = () => {
@ -261,8 +262,8 @@ const closeGetPrize = () => {
box.style.display = "flex"; box.style.display = "flex";
} }
}); });
let scroll = document.getElementById("prizeBar");
scroll.style.height = "650px";
// let scroll = document.getElementById("prizeBar");
// scroll.style.height = "650px";
}; };
// //
@ -462,7 +463,7 @@ const initCards = () => {
renderer = new CSS3DRenderer(); renderer = new CSS3DRenderer();
renderer.setSize(window.innerWidth * 1, window.innerHeight * 0.9); renderer.setSize(window.innerWidth * 1, window.innerHeight * 0.9);
renderer.domElement.style.margin = "7% 0 0 0";
renderer.domElement.style.margin = "7% 0 0 1%";
// document.getElementById("container").appendChild(renderer.domElement); // document.getElementById("container").appendChild(renderer.domElement);
if (threeContainer.value) { if (threeContainer.value) {
@ -1069,8 +1070,25 @@ const lotteryBtn = () => {
return; return;
} }
getPrizeUsers.value = [];
let params = {
gradeName: currentPrize.value.gradeName,
prizeName: currentPrize.value.prizeName,
perWin: currentPrize.value.perWin,
};
// API
startLotteryApi(params)
.then((res) => {
// API
getPrizeUsers.value = res.data || [];
console.log("API返回结果:", res.data);
})
.catch((err) => {
console.error("API调用失败:", err);
getPrizeUsers.value = [];
});
setLotteryStatus(true); setLotteryStatus(true);
//
// //
changePrize(); changePrize();
resetCard().then((res) => { resetCard().then((res) => {
@ -1081,7 +1099,7 @@ const lotteryBtn = () => {
console.log("currentPrize", currentPrize.value); console.log("currentPrize", currentPrize.value);
const text = "正在抽取[" + currentPrize.value.prizeName + "],调整好姿势"; const text = "正在抽取[" + currentPrize.value.prizeName + "],调整好姿势";
// addQipao(text);
// addQipao(text);
}; };
/** /**
* 抽奖 * 抽奖
@ -1094,15 +1112,9 @@ const lottery = () => {
currentLuckys = []; currentLuckys = [];
selectedCardIndex = []; selectedCardIndex = [];
// , // ,
let perCount = EACH_COUNT[currentPrizeIndex]; //
console.log("perCount", perCount, "currentPrizeIndex", currentPrizeIndex);
for (let i = 0; i < perCount; i++) {
let user = ["洪锡林", "洪锡林", "洪锡林"];
let index = user[0] + i;
user[0] = index;
user[1] = index;
currentLuckys.push(user);
for (let i = 0; i < getPrizeUsers.value; i++) {
currentLuckys.push(getPrizeUsers.value[i]);
currentPrize.value.hasCount--; currentPrize.value.hasCount--;
// //
@ -1522,7 +1534,7 @@ a {
} }
#prizeBar { #prizeBar {
height: 650px;
max-height: 60vh;
width: 330px; width: 330px;
overflow-x: hidden; overflow-x: hidden;
@ -1597,14 +1609,14 @@ a {
.open { .open {
position: absolute; position: absolute;
top: -45px;
top: -42px;
animation: bounce1 2s ease-in-out infinite; animation: bounce1 2s ease-in-out infinite;
transform: rotate(180deg); transform: rotate(180deg);
} }
.close { .close {
position: absolute; position: absolute;
top: -40px;
top: -32px;
animation: bounce2 2s ease-in-out infinite; animation: bounce2 2s ease-in-out infinite;
cursor: pointer; cursor: pointer;
} }

22
vite.config.js.timestamp-1753077096347-78067037e45f7.mjs

@ -0,0 +1,22 @@
// vite.config.js
import { defineConfig } from "file:///E:/hxl/gitFile/activityLink/node_modules/vite/dist/node/index.js";
import vue from "file:///E:/hxl/gitFile/activityLink/node_modules/@vitejs/plugin-vue/dist/index.mjs";
var vite_config_default = defineConfig({
plugins: [
vue()
],
server: {
proxy: {
"/Api": {
target: "https://dbqb.nfdxy.net/devLotApi",
// target: 'http://localhost:8080',
changeOrigin: true,
rewrite: (path) => path.replace(/^\/Api/, "")
}
}
}
});
export {
vite_config_default as default
};
//# sourceMappingURL=data:application/json;base64,ewogICJ2ZXJzaW9uIjogMywKICAic291cmNlcyI6IFsidml0ZS5jb25maWcuanMiXSwKICAic291cmNlc0NvbnRlbnQiOiBbImNvbnN0IF9fdml0ZV9pbmplY3RlZF9vcmlnaW5hbF9kaXJuYW1lID0gXCJFOlxcXFxoeGxcXFxcZ2l0RmlsZVxcXFxhY3Rpdml0eUxpbmtcIjtjb25zdCBfX3ZpdGVfaW5qZWN0ZWRfb3JpZ2luYWxfZmlsZW5hbWUgPSBcIkU6XFxcXGh4bFxcXFxnaXRGaWxlXFxcXGFjdGl2aXR5TGlua1xcXFx2aXRlLmNvbmZpZy5qc1wiO2NvbnN0IF9fdml0ZV9pbmplY3RlZF9vcmlnaW5hbF9pbXBvcnRfbWV0YV91cmwgPSBcImZpbGU6Ly8vRTovaHhsL2dpdEZpbGUvYWN0aXZpdHlMaW5rL3ZpdGUuY29uZmlnLmpzXCI7aW1wb3J0IHsgZGVmaW5lQ29uZmlnIH0gZnJvbSAndml0ZSdcbmltcG9ydCB2dWUgZnJvbSAnQHZpdGVqcy9wbHVnaW4tdnVlJ1xuXG4vLyBodHRwczovL3ZpdGUuZGV2L2NvbmZpZy9cbi8vIGV4cG9ydCBkZWZhdWx0IGRlZmluZUNvbmZpZyh7XG4vLyAgIHBs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