Browse Source

奖品栏滑动, 增加滚动条

songtongtong/feature-20250717104937-众筹
pangluotong 4 weeks ago
parent
commit
2cfed1a5f5
  1. 71
      package-lock.json
  2. 1
      package.json
  3. 2
      src/main.js
  4. 7
      src/stores/auth.js
  5. 3
      src/views/choujiang/Login.vue
  6. 125
      src/views/choujiang/lottery/PrizePanel.vue

71
package-lock.json

@ -13,6 +13,7 @@
"axios": "^1.10.0", "axios": "^1.10.0",
"element-plus": "^2.10.3", "element-plus": "^2.10.3",
"pinia": "^3.0.3", "pinia": "^3.0.3",
"pinia-plugin-persistedstate": "^4.4.1",
"three": "^0.178.0", "three": "^0.178.0",
"vite": "^4.5.3", "vite": "^4.5.3",
"vue": "^3.5.17", "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": { "node_modules/delayed-stream": {
"version": "1.0.0", "version": "1.0.0",
"resolved": "https://registry.npmmirror.com/delayed-stream/-/delayed-stream-1.0.0.tgz", "resolved": "https://registry.npmmirror.com/delayed-stream/-/delayed-stream-1.0.0.tgz",
@ -889,6 +902,12 @@
"node": ">=0.4.0" "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": { "node_modules/dunder-proto": {
"version": "1.0.1", "version": "1.0.1",
"resolved": "https://registry.npmmirror.com/dunder-proto/-/dunder-proto-1.0.1.tgz", "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": { "node_modules/pinia/node_modules/@vue/devtools-api": {
"version": "7.7.7", "version": "7.7.7",
"resolved": "https://mirrors.huaweicloud.com/repository/npm/@vue/devtools-api/-/devtools-api-7.7.7.tgz", "resolved": "https://mirrors.huaweicloud.com/repository/npm/@vue/devtools-api/-/devtools-api-7.7.7.tgz",
@ -2465,11 +2511,26 @@
"ms": "^2.1.3" "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": { "delayed-stream": {
"version": "1.0.0", "version": "1.0.0",
"resolved": "https://registry.npmmirror.com/delayed-stream/-/delayed-stream-1.0.0.tgz", "resolved": "https://registry.npmmirror.com/delayed-stream/-/delayed-stream-1.0.0.tgz",
"integrity": "sha512-ZySD7Nf91aLB0RxL4KGrKHBXl7Eds1DAmEdcoVawXnLD7SDhpNgtuII2aAkg7a7QS41jxPSZ17p4VdGnMHk3MQ==" "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": { "dunder-proto": {
"version": "1.0.1", "version": "1.0.1",
"resolved": "https://registry.npmmirror.com/dunder-proto/-/dunder-proto-1.0.1.tgz", "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": { "pkg-types": {
"version": "2.2.0", "version": "2.2.0",
"resolved": "https://mirrors.huaweicloud.com/repository/npm/pkg-types/-/pkg-types-2.2.0.tgz", "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", "axios": "^1.10.0",
"element-plus": "^2.10.3", "element-plus": "^2.10.3",
"pinia": "^3.0.3", "pinia": "^3.0.3",
"pinia-plugin-persistedstate": "^4.4.1",
"three": "^0.178.0", "three": "^0.178.0",
"vite": "^4.5.3", "vite": "^4.5.3",
"vue": "^3.5.17", "vue": "^3.5.17",

2
src/main.js

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

7
src/stores/auth.js

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

3
src/views/choujiang/Login.vue

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

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

@ -64,30 +64,7 @@
> >
获奖名单 获奖名单
</button> </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> </div>
</div> </div>
</div> </div>
@ -95,7 +72,7 @@
<div v-else> <div v-else>
<div class="prize-panel-root"> <div class="prize-panel-root">
<div <div
class="prize-panel-list"
class="prize-panel-list1"
v-if="prizes && prizes.length && lastRevealedIdx >= 0" v-if="prizes && prizes.length && lastRevealedIdx >= 0"
> >
<div <div
@ -134,23 +111,9 @@
prizes[lastRevealedIdx].count prizes[lastRevealedIdx].count
}} }}
</span> </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-down" @click="toggleWinnerList"></div>
<!-- <div class="arrow-up " @click="openWinnerList"> </div>
<button
ref="winnerBtnRef"
class="winner-btn"
@click="toggleWinnerList"
>
获奖名单
</button> -->
<div
<div
v-if="showWinnerList" v-if="showWinnerList"
class="winner-modal-mask" class="winner-modal-mask"
@click="closeWinnerList" @click="closeWinnerList"
@ -196,8 +159,14 @@
</div> </div>
</div> </div>
</div> </div>
</div>
</div>
</div>
</div>
</div> </div>
</div> </div>
</div> </div>
</template> </template>
@ -272,6 +241,7 @@ function canRevealPrize(idx) {
// //
function handleReveal(idx) { function handleReveal(idx) {
// //
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; //
@ -331,15 +301,6 @@ async function openWinnerList() {
if (lastRevealedIdx.value >= 0) { if (lastRevealedIdx.value >= 0) {
showOne.value = false; 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() { function closeWinnerList() {
showWinnerList.value = false; showWinnerList.value = false;
@ -378,15 +339,6 @@ async function toggleWinnerList() {
showOne.value = false; showOne.value = false;
console.log("设置 showOne 为 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 { } else {
// showOnefalsetrue // showOnefalsetrue
if (!showOne.value) { if (!showOne.value) {
@ -423,6 +375,36 @@ function getProgressPercent(prize) {
display: flex; display: flex;
flex-direction: column; flex-direction: column;
gap: 18px; gap: 18px;
height: 400px;
overflow-x: hidden !important;
overflow-y: auto;
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 { .prize-panel-item {
background: #ffd283; background: #ffd283;
@ -521,20 +503,21 @@ function getProgressPercent(prize) {
font-weight: bold; font-weight: bold;
} }
.prize-panel-footer { .prize-panel-footer {
position: absolute;
left: 0;
bottom: -26px;
position: fixed;
right: 750px;
bottom: 435px;
width: 100%; width: 100%;
display: flex; display: flex;
flex-direction: column; flex-direction: column;
align-items: center; align-items: center;
z-index: 20; z-index: 20;
/* 移除 move-up 相关 */
padding: 10px 0;
border-radius: 0 0 6px 6px;
} }
.arrow-up { .arrow-up {
position: relative; position: relative;
width: 36px;
height: 24px;
width: 50px;
height: 30px;
margin-bottom: 4px; margin-bottom: 4px;
cursor: pointer; cursor: pointer;
background-image: url("../../../assets/展开.png"); background-image: url("../../../assets/展开.png");
@ -544,10 +527,10 @@ function getProgressPercent(prize) {
} }
.arrow-down { .arrow-down {
position: fixed; position: fixed;
top: 120px;
left: 181px;
width: 36px;
height: 38px;
top: 100px;
left: 150px;
width: 47px;
height: 28px;
margin-bottom: 4px; margin-bottom: 4px;
cursor: pointer; cursor: pointer;
background-image: url("../../../assets/展开.png"); background-image: url("../../../assets/展开.png");
@ -568,8 +551,8 @@ function getProgressPercent(prize) {
} }
.winner-modal-mask { .winner-modal-mask {
position: fixed; position: fixed;
top: 155px;
left:33px;
top: 142px;
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