2 Commits

  1. 71
      package-lock.json
  2. 1
      package.json
  3. 2
      src/main.js
  4. 7
      src/stores/auth.js
  5. 1
      src/views/choujiang/Login.vue
  6. 120
      src/views/choujiang/lottery/PrizePanel.vue

71
package-lock.json

@ -13,6 +13,7 @@
"axios": "^1.10.0",
"element-plus": "^2.10.3",
"pinia": "^3.0.3",
"pinia-plugin-persistedstate": "^4.4.1",
"three": "^0.178.0",
"vite": "^4.5.3",
"vue": "^3.5.17",
@ -881,6 +882,18 @@
}
}
},
"node_modules/deep-pick-omit": {
"version": "1.2.1",
"resolved": "https://registry.npmjs.org/deep-pick-omit/-/deep-pick-omit-1.2.1.tgz",
"integrity": "sha512-2J6Kc/m3irCeqVG42T+SaUMesaK7oGWaedGnQQK/+O0gYc+2SP5bKh/KKTE7d7SJ+GCA9UUE1GRzh6oDe0EnGw==",
"license": "MIT"
},
"node_modules/defu": {
"version": "6.1.4",
"resolved": "https://registry.npmjs.org/defu/-/defu-6.1.4.tgz",
"integrity": "sha512-mEQCMmwJu317oSz8CwdIOdwf3xMif1ttiM8LTufzc3g6kR+9Pe236twL8j3IYT1F7GfRgGcW6MWxzZjLIkuHIg==",
"license": "MIT"
},
"node_modules/delayed-stream": {
"version": "1.0.0",
"resolved": "https://registry.npmmirror.com/delayed-stream/-/delayed-stream-1.0.0.tgz",
@ -889,6 +902,12 @@
"node": ">=0.4.0"
}
},
"node_modules/destr": {
"version": "2.0.5",
"resolved": "https://registry.npmjs.org/destr/-/destr-2.0.5.tgz",
"integrity": "sha512-ugFTXCtDZunbzasqBxrK93Ik/DRYsO6S/fedkWEMKqt04xZ4csmnmwGDBAb07QWNaGMAmnTIemsYZCksjATwsA==",
"license": "MIT"
},
"node_modules/dunder-proto": {
"version": "1.0.1",
"resolved": "https://registry.npmmirror.com/dunder-proto/-/dunder-proto-1.0.1.tgz",
@ -1500,6 +1519,33 @@
}
}
},
"node_modules/pinia-plugin-persistedstate": {
"version": "4.4.1",
"resolved": "https://registry.npmjs.org/pinia-plugin-persistedstate/-/pinia-plugin-persistedstate-4.4.1.tgz",
"integrity": "sha512-lmuMPpXla2zJKjxEq34e1E9P9jxkWEhcVwwioCCE0izG45kkTOvQfCzvwhW3i38cvnaWC7T1eRdkd15Re59ldw==",
"license": "MIT",
"dependencies": {
"deep-pick-omit": "^1.2.1",
"defu": "^6.1.4",
"destr": "^2.0.5"
},
"peerDependencies": {
"@nuxt/kit": ">=3.0.0",
"@pinia/nuxt": ">=0.10.0",
"pinia": ">=3.0.0"
},
"peerDependenciesMeta": {
"@nuxt/kit": {
"optional": true
},
"@pinia/nuxt": {
"optional": true
},
"pinia": {
"optional": true
}
}
},
"node_modules/pinia/node_modules/@vue/devtools-api": {
"version": "7.7.7",
"resolved": "https://mirrors.huaweicloud.com/repository/npm/@vue/devtools-api/-/devtools-api-7.7.7.tgz",
@ -2465,11 +2511,26 @@
"ms": "^2.1.3"
}
},
"deep-pick-omit": {
"version": "1.2.1",
"resolved": "https://registry.npmjs.org/deep-pick-omit/-/deep-pick-omit-1.2.1.tgz",
"integrity": "sha512-2J6Kc/m3irCeqVG42T+SaUMesaK7oGWaedGnQQK/+O0gYc+2SP5bKh/KKTE7d7SJ+GCA9UUE1GRzh6oDe0EnGw=="
},
"defu": {
"version": "6.1.4",
"resolved": "https://registry.npmjs.org/defu/-/defu-6.1.4.tgz",
"integrity": "sha512-mEQCMmwJu317oSz8CwdIOdwf3xMif1ttiM8LTufzc3g6kR+9Pe236twL8j3IYT1F7GfRgGcW6MWxzZjLIkuHIg=="
},
"delayed-stream": {
"version": "1.0.0",
"resolved": "https://registry.npmmirror.com/delayed-stream/-/delayed-stream-1.0.0.tgz",
"integrity": "sha512-ZySD7Nf91aLB0RxL4KGrKHBXl7Eds1DAmEdcoVawXnLD7SDhpNgtuII2aAkg7a7QS41jxPSZ17p4VdGnMHk3MQ=="
},
"destr": {
"version": "2.0.5",
"resolved": "https://registry.npmjs.org/destr/-/destr-2.0.5.tgz",
"integrity": "sha512-ugFTXCtDZunbzasqBxrK93Ik/DRYsO6S/fedkWEMKqt04xZ4csmnmwGDBAb07QWNaGMAmnTIemsYZCksjATwsA=="
},
"dunder-proto": {
"version": "1.0.1",
"resolved": "https://registry.npmmirror.com/dunder-proto/-/dunder-proto-1.0.1.tgz",
@ -2894,6 +2955,16 @@
}
}
},
"pinia-plugin-persistedstate": {
"version": "4.4.1",
"resolved": "https://registry.npmjs.org/pinia-plugin-persistedstate/-/pinia-plugin-persistedstate-4.4.1.tgz",
"integrity": "sha512-lmuMPpXla2zJKjxEq34e1E9P9jxkWEhcVwwioCCE0izG45kkTOvQfCzvwhW3i38cvnaWC7T1eRdkd15Re59ldw==",
"requires": {
"deep-pick-omit": "^1.2.1",
"defu": "^6.1.4",
"destr": "^2.0.5"
}
},
"pkg-types": {
"version": "2.2.0",
"resolved": "https://mirrors.huaweicloud.com/repository/npm/pkg-types/-/pkg-types-2.2.0.tgz",

1
package.json

@ -14,6 +14,7 @@
"axios": "^1.10.0",
"element-plus": "^2.10.3",
"pinia": "^3.0.3",
"pinia-plugin-persistedstate": "^4.4.1",
"three": "^0.178.0",
"vite": "^4.5.3",
"vue": "^3.5.17",

2
src/main.js

@ -1,11 +1,13 @@
import { createApp } from "vue";
import { createPinia } from "pinia";
import piniaPluginPersistedstate from 'pinia-plugin-persistedstate';
import "./style.css";
import App from "./App.vue";
import router from "./router";
import ElementPlus from "element-plus";
const pinia = createPinia();
pinia.use(piniaPluginPersistedstate);
const app = createApp(App);

7
src/stores/auth.js

@ -16,5 +16,10 @@ export const useAuthStore = defineStore('auth', () => {
login,
logout
};
},{persist : false});
},{
persist: {
storage: sessionStorage, // 使用会话存储替代默认的localStorage
paths: ['isLoggedIn'] // 可选:指定需要持久化的状态字段
}
});
//开启持久化)

1
src/views/choujiang/Login.vue

@ -31,7 +31,6 @@ const handleLogin = () => {
return;
}
if (password.value === CORRECT_PASSWORD) {
alert('登录成功,即将跳转到抽奖页面');
//
authStore.login(); // 使Pinia
router.push('/choujiang');

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

@ -64,29 +64,6 @@
>
获奖名单
</button>
<!-- <div
v-if="showWinnerList"
class="winner-modal-mask"
@click="closeWinnerList"
>
<div
class="winner-modal"
:style="{
position: 'absolute',
left: modalLeft + 'px',
top: modalTop + 'px',
}"
@click.stop
>
<div class="winner-modal-title">Homily ID</div>
<ul class="winner-list">
<li v-for="(user, idx) in fakeWinners" :key="idx">
<span>{{ user.id }}</span>
<span>{{ user.prize }}</span>
</li>
</ul>
</div> -->
<!-- </div> -->
</div>
</div>
</div>
@ -95,7 +72,7 @@
<div v-else>
<div class="prize-panel-root">
<div
class="prize-panel-list"
class="prize-panel-list1"
v-if="prizes && prizes.length && lastRevealedIdx >= 0"
>
<div
@ -134,22 +111,8 @@
prizes[lastRevealedIdx].count
}}
</span>
</div>
</div>
</div>
</div>
</div>
<div class="prize-panel-footer">
</div> <div class="prize-panel-footer">
<div class="arrow-down" @click="toggleWinnerList"></div>
<!-- <div class="arrow-up " @click="openWinnerList"> </div>
<button
ref="winnerBtnRef"
class="winner-btn"
@click="toggleWinnerList"
>
获奖名单
</button> -->
<div
v-if="showWinnerList"
class="winner-modal-mask"
@ -199,6 +162,12 @@
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</template>
<script setup>
@ -273,6 +242,7 @@ function canRevealPrize(idx) {
//
function handleReveal(idx) {
//
if (idx !== nextRevealIdx.value ) {alert("请按顺序揭秘奖品!"); return;}
if (idx === nextRevealIdx.value && canRevealPrize(idx)) {
revealedCount.value++;
lastRevealedIdx.value = idx; //
@ -333,15 +303,6 @@ async function openWinnerList() {
if (lastRevealedIdx.value >= 0) {
showOne.value = false;
}
//
// nextTick(() => {
// const btn = winnerBtnRef.value;
// if (btn) {
// const rect = btn.getBoundingClientRect();
// modalLeft.value = rect.left - 23;
// modalTop.value = rect.bottom + 18; // 4px
// }
// });
}
function closeWinnerList() {
showWinnerList.value = false;
@ -380,15 +341,6 @@ async function toggleWinnerList() {
showOne.value = false;
console.log("设置 showOne 为 false");
}
//
// nextTick(() => {
// const btn = winnerBtnRef.value;
// if (btn) {
// const rect = btn.getBoundingClientRect();
// modalLeft.value = rect.left - 23;
// modalTop.value = rect.bottom + 18; // 4px
// }
// });
} else {
// showOnefalsetrue
if (!showOne.value) {
@ -425,9 +377,36 @@ function getProgressPercent(prize) {
display: flex;
flex-direction: column;
gap: 18px;
height: 400px;
overflow-x: hidden !important;
overflow-y: auto;
max-height: 700px;
padding-right: 10px;
scrollbar-width: thin;
scrollbar-color: #ffd283 rgba(255, 210, 131, 0.3); /* Firefox */
}
.prize-panel-list1 {
position: absolute;
top: 20px;
left: 20px;
background: none;
z-index: 10;
min-width: 320px;
max-width: 342px;
text-align: left;
display: flex;}
.prize-panel-list::-webkit-scrollbar {
width: 6px;
}
.prize-panel-list::-webkit-scrollbar-track {
background: rgba(255, 210, 131, 0.3);
border-radius: 3px;
}
.prize-panel-list::-webkit-scrollbar-thumb {
background-color: #ffd283;
border-radius: 3px;
}
.prize-panel-item {
background: #ffd283;
@ -525,20 +504,21 @@ function getProgressPercent(prize) {
font-weight: bold;
}
.prize-panel-footer {
position: absolute;
left: 0;
bottom: -26px;
position: fixed;
right: 750px;
bottom: 435px;
width: 100%;
display: flex;
flex-direction: column;
align-items: center;
z-index: 20;
/* 移除 move-up 相关 */
padding: 10px 0;
border-radius: 0 0 6px 6px;
}
.arrow-up {
position: relative;
width: 36px;
height: 24px;
width: 50px;
height: 30px;
margin-bottom: 4px;
cursor: pointer;
background-image: url("../../../assets/展开.png");
@ -548,10 +528,10 @@ function getProgressPercent(prize) {
}
.arrow-down {
position: fixed;
top: 120px;
left: 181px;
width: 36px;
height: 38px;
top: 100px;
left: 150px;
width: 47px;
height: 28px;
margin-bottom: 4px;
cursor: pointer;
background-image: url("../../../assets/展开.png");
@ -572,8 +552,8 @@ function getProgressPercent(prize) {
}
.winner-modal-mask {
position: fixed;
top: 155px;
left:33px;
top: 142px;
left:-4px;
width: 100vw;
height: 100vh;
background: rgba(0, 0, 0, 0.01);

Loading…
Cancel
Save