From f34e850ff03cd99e7a3c59a1c0bfcffddbb087fc Mon Sep 17 00:00:00 2001 From: "ex_zhangwenlei@exiot.cmcc" <15196725410@139.com> Date: Tue, 9 Jan 2024 01:03:42 +0800 Subject: [PATCH] feat(for): for --- .eslintrc.cjs | 2 +- package.json | 3 + pnpm-lock.yaml | 26 ++ src/App.vue | 33 ++- src/components.d.ts | 1 + src/components/ImageSync/index.vue | 4 +- src/components/PlayMusic/index.vue | 1 + src/components/ToTop/index.vue | 13 + src/hooks/useElement.ts | 21 +- src/icons/totop.svg | 1 + src/layout/index.vue | 15 +- src/store/data.ts | 5 + src/store/globalConfig.ts | 10 + src/store/personConfig.ts | 27 +- src/store/prizeConfig.ts | 8 +- src/types/personConfig.ts | 5 +- src/types/prizeConfig.ts | 1 + src/utils/index.ts | 12 + src/views/Config/Global/FaceConfig.vue | 14 +- src/views/Config/Person/PersonAll.vue | 6 +- src/views/Config/Person/PersonAlready.vue | 28 +- src/views/Config/Prize/PrizeConfig.vue | 91 ++++--- src/views/Config/index.vue | 8 +- src/views/Home/LuckyThree.vue | 225 --------------- src/views/Home/PrizeList.vue | 27 +- src/views/Home/index.vue | 317 ++++++++++++++++------ 26 files changed, 500 insertions(+), 404 deletions(-) create mode 100644 src/components/ToTop/index.vue create mode 100644 src/icons/totop.svg delete mode 100644 src/views/Home/LuckyThree.vue diff --git a/.eslintrc.cjs b/.eslintrc.cjs index da484da..0fba0f6 100644 --- a/.eslintrc.cjs +++ b/.eslintrc.cjs @@ -38,7 +38,7 @@ module.exports = { ], "no-console": "warn", "no-debugger": "warn", - complexity: ["warn", { max: 5 }], + // complexity: ["warn", { max: 5 }], // 禁止使用多个空格 "no-multi-spaces": "error", // 最大连续空行数 diff --git a/package.json b/package.json index 481fea3..c613d68 100644 --- a/package.json +++ b/package.json @@ -21,6 +21,7 @@ "@tsparticles/vue3": "^3.0.0", "@vueuse/core": "^10.6.1", "axios": "^1.6.1", + "canvas-confetti": "^1.9.2", "localforage": "^1.10.0", "particles.vue3": "^2.12.0", "pinia": "^2.1.7", @@ -36,6 +37,7 @@ "vue": "^3.3.8", "vue-accessible-color-picker": "^5.0.1", "vue-router": "^4.2.5", + "vue-toast-notification": "^3", "vue3-colorpicker": "^2.2.3", "xlsx": "^0.18.5", "zod": "^3.22.4" @@ -45,6 +47,7 @@ "@iconify-json/fluent": "^1.1.40", "@tailwindcss/typography": "^0.5.10", "@testing-library/vue": "^8.0.0", + "@types/canvas-confetti": "^1.6.4", "@types/node": "^20.9.0", "@types/three": "^0.160.0", "@typescript-eslint/eslint-plugin": "^6.11.0", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 2ba8dd1..aa39f42 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -29,6 +29,9 @@ dependencies: axios: specifier: ^1.6.1 version: 1.6.1 + canvas-confetti: + specifier: ^1.9.2 + version: 1.9.2 localforage: specifier: ^1.10.0 version: 1.10.0 @@ -74,6 +77,9 @@ dependencies: vue-router: specifier: ^4.2.5 version: 4.2.5(vue@3.3.8) + vue-toast-notification: + specifier: ^3 + version: 3.1.2(vue@3.3.8) vue3-colorpicker: specifier: ^2.2.3 version: 2.2.3(@aesoper/normal-utils@0.1.5)(@popperjs/core@2.11.8)(@vueuse/core@10.6.1)(gradient-parser@1.0.2)(lodash-es@4.17.21)(tinycolor2@1.6.0)(vue-types@4.2.1)(vue@3.3.8) @@ -97,6 +103,9 @@ devDependencies: '@testing-library/vue': specifier: ^8.0.0 version: 8.0.0(@vue/compiler-sfc@3.4.5)(vue@3.3.8) + '@types/canvas-confetti': + specifier: ^1.6.4 + version: 1.6.4 '@types/node': specifier: ^20.9.0 version: 20.9.0 @@ -1098,6 +1107,10 @@ packages: resolution: {integrity: sha512-rfT93uj5s0PRL7EzccGMs3brplhcrghnDoV26NqKhCAS1hVo+WdNsPvE/yb6ilfr5hi2MEk6d5EWJTKdxg8jVw==} dev: true + /@types/canvas-confetti@1.6.4: + resolution: {integrity: sha512-fNyZ/Fdw/Y92X0vv7B+BD6ysHL4xVU5dJcgzgxLdGbn8O3PezZNIJpml44lKM0nsGur+o/6+NZbZeNTt00U1uA==} + dev: true + /@types/chai-subset@1.3.5: resolution: {integrity: sha512-c2mPnw+xHtXDoHmdtcCXGwyLMiauiAyxWMzhGpqHC4nqI/Y5G2XhTampslK2rb59kpcuHon03UH8W6iYUzw88A==} dependencies: @@ -2161,6 +2174,10 @@ packages: resolution: {integrity: sha512-kfte3Hym//51EdX4239i+Rmp20EsLIYGdPkERegTgU19hQWCRhsRFGKHTliUlsry53tv17K7n077Kqa0WJU4ng==} dev: true + /canvas-confetti@1.9.2: + resolution: {integrity: sha512-6Xi7aHHzKwxZsem4mCKoqP6YwUG3HamaHHAlz1hTNQPCqXhARFpSXnkC9TWlahHY5CG6hSL5XexNjxK8irVErg==} + dev: false + /cfb@1.2.2: resolution: {integrity: sha512-KfdUZsSOw19/ObEWasvBP/Ac4reZvAGauZhs6S/gqNhXhI7cKwvlH7ulj+dOEYnca4bm4SGo8C1bTAQvnTjgQA==} engines: {node: '>=0.8'} @@ -6191,6 +6208,15 @@ packages: he: 1.2.0 dev: true + /vue-toast-notification@3.1.2(vue@3.3.8): + resolution: {integrity: sha512-oNRL/W9aaHoeScp+iTIW7k09vM16/+8aptp2maa+7qTB43JuxmAgKdXKFYtf+uvSNOYYq2BIWgLCeJ61pwom/A==} + engines: {node: '>=12.15.0'} + peerDependencies: + vue: ^3.0 + dependencies: + vue: 3.3.8(typescript@5.2.2) + dev: false + /vue-tsc@1.8.22(typescript@5.2.2): resolution: {integrity: sha512-j9P4kHtW6eEE08aS5McFZE/ivmipXy0JzrnTgbomfABMaVKx37kNBw//irL3+LlE3kOo63XpnRigyPC3w7+z+A==} hasBin: true diff --git a/src/App.vue b/src/App.vue index 23caa76..f530b1e 100644 --- a/src/App.vue +++ b/src/App.vue @@ -1,24 +1,43 @@ - + diff --git a/src/components.d.ts b/src/components.d.ts index fd2c6cb..2947135 100644 --- a/src/components.d.ts +++ b/src/components.d.ts @@ -16,5 +16,6 @@ declare module 'vue' { StarsBackground: typeof import('./components/StarsBackground/index.vue')['default'] SvgIcon: typeof import('./components/SvgIcon/index.vue')['default'] Table: typeof import('./components/Table/index.vue')['default'] + ToTop: typeof import('./components/ToTop/index.vue')['default'] } } diff --git a/src/components/ImageSync/index.vue b/src/components/ImageSync/index.vue index 800e3af..39b81d8 100644 --- a/src/components/ImageSync/index.vue +++ b/src/components/ImageSync/index.vue @@ -14,9 +14,9 @@ const imageDbStore = localforage.createInstance({ const imgUrl=ref('') -const getImageStoreItem=async (item:any)=>{ +const getImageStoreItem=async (item:any):Promise=>{ const key=item.id; - const image=await imageDbStore.getItem(key) + const image=await imageDbStore.getItem(key) as string return image } diff --git a/src/components/PlayMusic/index.vue b/src/components/PlayMusic/index.vue index 86f8a87..804c710 100644 --- a/src/components/PlayMusic/index.vue +++ b/src/components/PlayMusic/index.vue @@ -67,6 +67,7 @@ const enterHome = () => { onMounted(() => { currentMusic.value = localMusicListValue.value[0] onPlayEnd() + // 不使用空格控制audio }) onUnmounted(() => { audio.value.removeEventListener('ended', nextPlay) diff --git a/src/components/ToTop/index.vue b/src/components/ToTop/index.vue new file mode 100644 index 0000000..31d1773 --- /dev/null +++ b/src/components/ToTop/index.vue @@ -0,0 +1,13 @@ + + + + + diff --git a/src/hooks/useElement.ts b/src/hooks/useElement.ts index bea7122..ae2547e 100644 --- a/src/hooks/useElement.ts +++ b/src/hooks/useElement.ts @@ -33,6 +33,23 @@ export const useElementStyle=(element:any,cardColor:string,cardSize:{width:numbe return element } -export const useElementPosition=(element:any,count:number,cardSize:{width:number,height:number},containerSize:{width:number,height:number})=>{ - +export const useElementPosition=(element:any,count:number,cardSize:{width:number,height:number},windowSize:{width:number,height:number},cardIndex:number)=>{ + const rowCount=Math.floor(windowSize.width/(cardSize.width+100)) + const colCount=Math.ceil(count/rowCount) + const centerPosition={ + x:0, + y:windowSize.height/2-cardSize.height/2 + } + const index =cardIndex%5 + if(index==0){ + element.position.x=centerPosition.x + element.position.y=centerPosition.y-Math.floor(cardIndex/5)*(cardSize.height+60) + } + else{ + element.position.x=index%2===0?Math.ceil(index/2)*(cardSize.width+100):-Math.ceil(index/2)*(cardSize.width+100) + element.position.y=centerPosition.y-Math.floor(cardIndex/5)*(cardSize.height+60) + } + + + return element } diff --git a/src/icons/totop.svg b/src/icons/totop.svg new file mode 100644 index 0000000..ae8c274 --- /dev/null +++ b/src/icons/totop.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/layout/index.vue b/src/layout/index.vue index a8e0ead..f1c2593 100644 --- a/src/layout/index.vue +++ b/src/layout/index.vue @@ -1,6 +1,17 @@ + diff --git a/src/views/Config/index.vue b/src/views/Config/index.vue index c5b8ec0..77a5fd5 100644 --- a/src/views/Config/index.vue +++ b/src/views/Config/index.vue @@ -71,11 +71,9 @@ const skip = (path: string) => {