diff --git a/.eslintrc.cjs b/.eslintrc.cjs
index cc9f617..de2af04 100644
--- a/.eslintrc.cjs
+++ b/.eslintrc.cjs
@@ -7,13 +7,13 @@ module.exports = {
'plugin:vue/vue3-essential',
'eslint:recommended',
'@vue/eslint-config-typescript',
- '@vue/eslint-config-prettier/skip-formatting'
+ '@vue/eslint-config-prettier/skip-formatting',
],
parserOptions: {
- ecmaVersion: 'latest'
+ ecmaVersion: 'latest',
},
rules: {
'vue/no-unused-vars': 'warn',
- 'vue/multi-word-component-names': 'off'
- }
+ 'vue/multi-word-component-names': 'off',
+ },
};
diff --git a/components.d.ts b/components.d.ts
index bd6bcfb..15a86db 100644
--- a/components.d.ts
+++ b/components.d.ts
@@ -23,18 +23,25 @@ declare module 'vue' {
ElMain: typeof import('element-plus/es')['ElMain']
ElMenu: typeof import('element-plus/es')['ElMenu']
ElMenuItem: typeof import('element-plus/es')['ElMenuItem']
+ ElMenuItemGroup: typeof import('element-plus/es')['ElMenuItemGroup']
ElPopover: typeof import('element-plus/es')['ElPopover']
+ ElSpinner: typeof import('element-plus/es')['ElSpinner']
+ ElSubMenu: typeof import('element-plus/es')['ElSubMenu']
ElTabPane: typeof import('element-plus/es')['ElTabPane']
ElTabs: typeof import('element-plus/es')['ElTabs']
+ ElText: typeof import('element-plus/es')['ElText']
+ FestivalMenuItem: typeof import('./src/components/FestivalMenuItem.vue')['default']
Game2048: typeof import('./src/components/Game2048.vue')['default']
Game2048Button: typeof import('./src/components/Game2048Button.vue')['default']
Game2048Score: typeof import('./src/components/Game2048Score.vue')['default']
+ IconCsClub: typeof import('~icons/cs/club')['default']
IconCsLoading: typeof import('~icons/cs/loading')['default']
IconCsLock: typeof import('~icons/cs/lock')['default']
IconCsUser: typeof import('~icons/cs/user')['default']
IconCsValidate: typeof import('~icons/cs/validate')['default']
IconEpLoading: typeof import('~icons/ep/loading')['default']
IconEpUserFilled: typeof import('~icons/ep/user-filled')['default']
+ LoginRegisterDialog: typeof import('./src/components/LoginRegisterDialog.vue')['default']
RouterLink: typeof import('vue-router')['RouterLink']
RouterView: typeof import('vue-router')['RouterView']
VerifyInput: typeof import('./src/components/VerifyInput.vue')['default']
diff --git a/src/assets/2048.png b/public/2048.png
similarity index 100%
rename from src/assets/2048.png
rename to public/2048.png
diff --git a/src/assets/avatar1.jpg b/public/avatar1.jpg
similarity index 100%
rename from src/assets/avatar1.jpg
rename to public/avatar1.jpg
diff --git a/src/assets/banner.jpg b/public/banner.jpg
similarity index 100%
rename from src/assets/banner.jpg
rename to public/banner.jpg
diff --git a/src/assets/bg1.jpg b/public/bg1.jpg
similarity index 100%
rename from src/assets/bg1.jpg
rename to public/bg1.jpg
diff --git a/src/assets/bg2.jpg b/public/bg2.jpg
similarity index 100%
rename from src/assets/bg2.jpg
rename to public/bg2.jpg
diff --git a/src/assets/bg3.jpg b/public/bg3.jpg
similarity index 100%
rename from src/assets/bg3.jpg
rename to public/bg3.jpg
diff --git a/src/assets/bg4.png b/public/bg4.png
similarity index 100%
rename from src/assets/bg4.png
rename to public/bg4.png
diff --git a/src/assets/bg5.jpg b/public/bg5.jpg
similarity index 100%
rename from src/assets/bg5.jpg
rename to public/bg5.jpg
diff --git a/src/App.vue b/src/App.vue
index 3fee752..014d300 100644
--- a/src/App.vue
+++ b/src/App.vue
@@ -6,7 +6,7 @@
-
+
-
userStore.isInitializing,
+ () => userStore.initializing,
(value) => {
console.log(1);
if (!value && userStore.token === null) {
@@ -384,7 +384,7 @@ let loginFormData = reactive({
const loginFormRules = reactive>({
username: [
{ required: true, message: '请输入用户名' },
- { min: 6, message: '用户名长度不能小于6位' },
+ { min: 3, message: '用户名长度不能小于3位' },
],
password: [
{ required: true, message: '请输入密码' },
@@ -544,4 +544,7 @@ async function logout() {
userStore.token = null;
await userStore.updateSelfUserInfo(true);
}
+onMounted(() => {
+ console.log(userStore.token);
+});
diff --git a/src/App2.vue b/src/App2.vue
new file mode 100644
index 0000000..4c9a895
--- /dev/null
+++ b/src/App2.vue
@@ -0,0 +1,150 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/api/index.ts b/src/api/index.ts
index 460bdf5..d2ca959 100644
--- a/src/api/index.ts
+++ b/src/api/index.ts
@@ -1,7 +1,7 @@
-import { useUserStore } from '@/stores';
+import { useUserStore } from '@/stores/user';
import axios from 'axios';
-const baseURL = 'https://wzpmc.cn:18080/';
+const baseURL = 'http://172.16.114.84:58080/';
const axiosInstance = axios.create({
baseURL,
});
diff --git a/src/assets/global.scss b/src/assets/global.scss
index 6c729f7..721bb71 100644
--- a/src/assets/global.scss
+++ b/src/assets/global.scss
@@ -4,10 +4,6 @@
box-sizing: border-box;
}
-:root {
- --page-content-width: 980px;
-}
-
body {
background-color: rgb(244, 246, 249);
}
@@ -16,3 +12,22 @@ body {
width: 100vw;
height: 100vh;
}
+.flex {
+ display: flex !important;
+}
+.align-center {
+ align-items: center;
+}
+.justify-start {
+ justify-content: flex-start;
+}
+.justify-center {
+ justify-content: center;
+}
+.justify-end {
+ justify-content: flex-end;
+}
+.center {
+ @extend .justify-center;
+ @extend .align-center;
+}
diff --git a/src/assets/icons/Club.svg b/src/assets/icons/Club.svg
new file mode 100644
index 0000000..abdf8bf
--- /dev/null
+++ b/src/assets/icons/Club.svg
@@ -0,0 +1,26 @@
+
+
diff --git a/src/assets/ws-icon.jfif b/src/assets/ws-icon.jfif
deleted file mode 100644
index 402ebe3..0000000
Binary files a/src/assets/ws-icon.jfif and /dev/null differ
diff --git a/src/components/BackgroundComp.vue b/src/components/BackgroundComp.vue
index fd19b3e..5e451d7 100644
--- a/src/components/BackgroundComp.vue
+++ b/src/components/BackgroundComp.vue
@@ -42,7 +42,7 @@ import {
type BackgroundURL,
CancelledError,
useBackgroundStore,
-} from '@/stores';
+} from '@/stores/background';
import 'element-plus/theme-chalk/index.css';
import { onMounted, onUnmounted, ref } from 'vue';
diff --git a/src/components/FestivalMenuItem.vue b/src/components/FestivalMenuItem.vue
new file mode 100644
index 0000000..d5ca9ba
--- /dev/null
+++ b/src/components/FestivalMenuItem.vue
@@ -0,0 +1,24 @@
+
+
+
+
+
diff --git a/src/components/Game2048.vue b/src/components/Game2048.vue
index 1f36012..0e013b4 100644
--- a/src/components/Game2048.vue
+++ b/src/components/Game2048.vue
@@ -187,7 +187,7 @@
}
+
diff --git a/src/main.ts b/src/main.ts
index 6316eef..7afce32 100644
--- a/src/main.ts
+++ b/src/main.ts
@@ -1,7 +1,7 @@
import '@/assets/global.scss';
import 'element-plus/theme-chalk/index.css';
import 'element-plus/theme-chalk/display.css';
-import App from '@/App.vue';
+import App from '@/App2.vue';
import router from '@/router';
import { createPinia } from 'pinia';
import { createApp } from 'vue';
diff --git a/src/router/index.ts b/src/router/index.ts
index c8143be..a550b9f 100644
--- a/src/router/index.ts
+++ b/src/router/index.ts
@@ -1,4 +1,4 @@
-import { useUserStore } from '@/stores';
+import { useUserStore } from '@/stores/user';
import { usePageStore } from '@/stores/page';
import { PageErrorType, type PageErrorReason } from '@/views/ErrorPage.vue';
import { createRouter, createWebHistory, type RouteRecordRaw } from 'vue-router';
@@ -46,15 +46,6 @@ const routes: RouteRecordRaw[] = [
} satisfies PageErrorReason,
},
];
-// (function processRoutes(routes: RouteRecordRaw[], idPool: IdPool) {
-// for (const route of routes) {
-// if (route.name === undefined) {
-// route.name = `AnonymousPage${idPool.newId()}`;
-// processRoutes(route.children ?? [], idPool);
-// }
-// }
-// })(routes, new IdPool(1));
-
const router = createRouter({
history: createWebHistory(),
routes: routes,
@@ -80,8 +71,6 @@ router.beforeEach(async (to) => {
);
}
}
- console.log(userStore.permissions);
-
if (permissionId) {
if (userStore.hasPermission(permissionId)) {
return true;
@@ -93,24 +82,6 @@ router.beforeEach(async (to) => {
pageStore.removeRouteId(to);
}
});
-// router.afterEach(
-// useThrottleFn(
-// async (to) => {
-// const userStore = useUserStore();
-// const pageStore = usePageStore();
-// if (['initialized', 'failed'].includes(userStore.userInfoStatus)) {
-// await waitRef(toRef(userStore, 'userInfoStatus'), 'initialized');
-// }
-// await userStore.updateSelfUserInfo(false, true);
-// const { permissionId } = to.meta;
-// if (permissionId !== undefined && !userStore.hasPermission(permissionId)) {
-// router.push(pageStore.createTempErrorRoute({ type: 'noPermission' }));
-// }
-// },
-// 10000,
-// true
-// )
-// );
router.afterEach((to) => {
const pageStore = usePageStore();
pageStore.removeRouteId(to);
diff --git a/src/stores/background.ts b/src/stores/background.ts
index b707501..a60436f 100644
--- a/src/stores/background.ts
+++ b/src/stores/background.ts
@@ -1,6 +1,6 @@
import { DoubleQueue } from '@/utils/double-queue';
import { defineStore } from 'pinia';
-import { reactive, readonly, ref } from 'vue';
+import { markRaw, reactive, readonly, ref } from 'vue';
export type BackgroundURL = string | undefined;
export type BackgroundOptions = {
diff --git a/src/stores/index.ts b/src/stores/index.ts
deleted file mode 100644
index 9fb1013..0000000
--- a/src/stores/index.ts
+++ /dev/null
@@ -1,3 +0,0 @@
-export * from './background';
-export * from './2048';
-export * from './user';
diff --git a/src/stores/page.ts b/src/stores/page.ts
index e8d2313..5fdf547 100644
--- a/src/stores/page.ts
+++ b/src/stores/page.ts
@@ -50,7 +50,6 @@ export const usePageStore = defineStore('page-store', () => {
}
return {
- routeIds,
pageLoadingCount,
setNewRouteId,
removeRouteId,
diff --git a/src/stores/user.ts b/src/stores/user.ts
index e904502..675f954 100644
--- a/src/stores/user.ts
+++ b/src/stores/user.ts
@@ -1,7 +1,8 @@
import axiosInstance, { type RawResp } from '@/api';
+import router from '@/router';
import type { UserInfo } from '@/schemas';
import { type idAndNameSchema, userInfoResponseSchema } from '@/schemas';
-import { errorMessage } from '@/utils';
+import { errorMessage, timeout } from '@/utils';
import { StorageSerializers, useLocalStorage } from '@vueuse/core';
import { AxiosError } from 'axios';
import { ElMessage } from 'element-plus';
@@ -18,16 +19,17 @@ export const useUserStore = defineStore('user', () => {
serializer: StorageSerializers.object,
});
const permissions = computed(() => userInfo.value?.auth.permissions ?? []);
- const isInitializing = ref(false);
+ const initializing = ref(false);
watch(
userInfo,
(info) => {
- isInitializing.value = !!info;
+ initializing.value = !!info;
+ router.push({ path: router.currentRoute.value.fullPath, force: true });
},
{ flush: 'sync' },
);
async function updateSelfUserInfo(showErrorMessage: boolean): Promise {
- isInitializing.value = true;
+ initializing.value = true;
try {
const raw = await axiosInstance
.get('/api/user/info')
@@ -46,7 +48,7 @@ export const useUserStore = defineStore('user', () => {
userInfo.value = resp.data;
return true;
} finally {
- isInitializing.value = false;
+ initializing.value = false;
}
}
function hasPermission(permissionId: number) {
@@ -57,7 +59,7 @@ export const useUserStore = defineStore('user', () => {
token,
userInfo,
permissions,
- isInitializing,
+ initializing,
updateSelfUserInfo,
hasPermission,
};
diff --git a/src/views/ErrorPage.vue b/src/views/ErrorPage.vue
index 0587967..3a08209 100644
--- a/src/views/ErrorPage.vue
+++ b/src/views/ErrorPage.vue
@@ -31,6 +31,8 @@ export enum PageErrorType {
}