mirror of
				https://gitee.com/hhyykk/ipms-sjy.git
				synced 2025-10-31 10:18:42 +08:00 
			
		
		
		
	fix: bugs
This commit is contained in:
		| @@ -8,7 +8,7 @@ const props = defineProps({ | |||||||
|     required: true |     required: true | ||||||
|   }, |   }, | ||||||
|   value: { |   value: { | ||||||
|     type: [String, Number] as PropType<string | number>, |     type: [String, Number, Boolean] as PropType<string | number | boolean>, | ||||||
|     required: true |     required: true | ||||||
|   } |   } | ||||||
| }) | }) | ||||||
|   | |||||||
| @@ -11,6 +11,7 @@ import { useDictStoreWithOut } from '@/store/modules/dict' | |||||||
| import { useUserStoreWithOut } from '@/store/modules/user' | import { useUserStoreWithOut } from '@/store/modules/user' | ||||||
| import { listSimpleDictDataApi } from '@/api/system/dict/dict.data' | import { listSimpleDictDataApi } from '@/api/system/dict/dict.data' | ||||||
| import { isRelogin } from '@/config/axios' | import { isRelogin } from '@/config/axios' | ||||||
|  | import { getInfoApi } from '@/api/login' | ||||||
|  |  | ||||||
| const { start, done } = useNProgress() | const { start, done } = useNProgress() | ||||||
|  |  | ||||||
| @@ -52,6 +53,8 @@ router.beforeEach(async (to, from, next) => { | |||||||
|       } |       } | ||||||
|       if (userStore.getRoles.length === 0) { |       if (userStore.getRoles.length === 0) { | ||||||
|         isRelogin.show = true |         isRelogin.show = true | ||||||
|  |         const res = await getInfoApi() | ||||||
|  |         await userStore.setUserInfoAction(res) | ||||||
|         isRelogin.show = false |         isRelogin.show = false | ||||||
|         // 后端过滤菜单 |         // 后端过滤菜单 | ||||||
|         await permissionStore.generateRoutes() |         await permissionStore.generateRoutes() | ||||||
|   | |||||||
| @@ -27,9 +27,6 @@ export const useUserStore = defineStore({ | |||||||
|       nickname: '' |       nickname: '' | ||||||
|     } |     } | ||||||
|   }), |   }), | ||||||
|   persist: { |  | ||||||
|     enabled: true |  | ||||||
|   }, |  | ||||||
|   getters: { |   getters: { | ||||||
|     getPermissions(): string[] { |     getPermissions(): string[] { | ||||||
|       return this.permissions |       return this.permissions | ||||||
|   | |||||||
| @@ -21,19 +21,17 @@ import { | |||||||
|   getPassword, |   getPassword, | ||||||
|   getTenantName |   getTenantName | ||||||
| } from '@/utils/auth' | } from '@/utils/auth' | ||||||
| import { useUserStore } from '@/store/modules/user' |  | ||||||
| import { usePermissionStore } from '@/store/modules/permission' | import { usePermissionStore } from '@/store/modules/permission' | ||||||
| import { useRouter } from 'vue-router' | import { useRouter } from 'vue-router' | ||||||
| import { useI18n } from '@/hooks/web/useI18n' | import { useI18n } from '@/hooks/web/useI18n' | ||||||
| import { required } from '@/utils/formRules' | import { required } from '@/utils/formRules' | ||||||
| import { Icon } from '@/components/Icon' | import { Icon } from '@/components/Icon' | ||||||
| import { LoginStateEnum, useLoginState, useFormValid } from './useLogin' | import { LoginStateEnum, useLoginState, useFormValid } from './useLogin' | ||||||
| import type { RouteLocationNormalizedLoaded, RouteRecordRaw } from 'vue-router' | import type { RouteLocationNormalizedLoaded } from 'vue-router' | ||||||
| import { Verify } from '@/components/Verifition' | import { Verify } from '@/components/Verifition' | ||||||
|  |  | ||||||
| const { currentRoute, addRoute, push } = useRouter() | const { currentRoute, push } = useRouter() | ||||||
| const permissionStore = usePermissionStore() | const permissionStore = usePermissionStore() | ||||||
| const userStore = useUserStore() |  | ||||||
| const formLogin = ref() | const formLogin = ref() | ||||||
| const { validForm } = useFormValid(formLogin) | const { validForm } = useFormValid(formLogin) | ||||||
| const { setLoginState, getLoginState } = useLoginState() | const { setLoginState, getLoginState } = useLoginState() | ||||||
| @@ -111,23 +109,11 @@ const handleLogin = async (params) => { | |||||||
|   loginData.loginForm.captchaVerification = params.captchaVerification |   loginData.loginForm.captchaVerification = params.captchaVerification | ||||||
|   const res = await LoginApi.loginApi(loginData.loginForm) |   const res = await LoginApi.loginApi(loginData.loginForm) | ||||||
|   setToken(res) |   setToken(res) | ||||||
|   const userInfo = await LoginApi.getInfoApi() |  | ||||||
|   await userStore.setUserInfoAction(userInfo) |  | ||||||
|   await getRoutes() |  | ||||||
|   loginLoading.value = false |  | ||||||
| } |  | ||||||
|  |  | ||||||
| // 获取路由 |  | ||||||
| const getRoutes = async () => { |  | ||||||
|   // 后端过滤菜单 |  | ||||||
|   await permissionStore.generateRoutes() |  | ||||||
|   permissionStore.getAddRouters.forEach((route) => { |  | ||||||
|     addRoute(route as RouteRecordRaw) // 动态添加可访问路由表 |  | ||||||
|   }) |  | ||||||
|   if (!redirect.value) { |   if (!redirect.value) { | ||||||
|     redirect.value = '/' |     redirect.value = '/' | ||||||
|   } |   } | ||||||
|   push({ path: redirect.value || permissionStore.addRouters[0].path }) |   push({ path: redirect.value || permissionStore.addRouters[0].path }) | ||||||
|  |   loginLoading.value = false | ||||||
| } | } | ||||||
|  |  | ||||||
| // 社交登录 | // 社交登录 | ||||||
|   | |||||||
| @@ -5,13 +5,12 @@ import LoginFormTitle from './LoginFormTitle.vue' | |||||||
| import { ElForm, ElFormItem, ElInput, ElRow, ElCol, ElMessage } from 'element-plus' | import { ElForm, ElFormItem, ElInput, ElRow, ElCol, ElMessage } from 'element-plus' | ||||||
| import { useI18n } from '@/hooks/web/useI18n' | import { useI18n } from '@/hooks/web/useI18n' | ||||||
| import { required } from '@/utils/formRules' | import { required } from '@/utils/formRules' | ||||||
| import { getTenantIdByNameApi, sendSmsCodeApi, smsLoginApi, getInfoApi } from '@/api/login' | import { getTenantIdByNameApi, sendSmsCodeApi, smsLoginApi } from '@/api/login' | ||||||
| import { useCache } from '@/hooks/web/useCache' | import { useCache } from '@/hooks/web/useCache' | ||||||
| import { usePermissionStore } from '@/store/modules/permission' | import { usePermissionStore } from '@/store/modules/permission' | ||||||
| import { useRouter } from 'vue-router' | import { useRouter } from 'vue-router' | ||||||
| import { setToken } from '@/utils/auth' | import { setToken } from '@/utils/auth' | ||||||
| import { useUserStore } from '@/store/modules/user' | import type { RouteLocationNormalizedLoaded } from 'vue-router' | ||||||
| import type { RouteLocationNormalizedLoaded, RouteRecordRaw } from 'vue-router' |  | ||||||
| import { useLoginState, LoginStateEnum, useFormValid } from './useLogin' | import { useLoginState, LoginStateEnum, useFormValid } from './useLogin' | ||||||
| const formSmsLogin = ref() | const formSmsLogin = ref() | ||||||
| const { validForm } = useFormValid(formSmsLogin) | const { validForm } = useFormValid(formSmsLogin) | ||||||
| @@ -21,9 +20,8 @@ const iconHouse = useIcon({ icon: 'ep:house' }) | |||||||
| const iconCellphone = useIcon({ icon: 'ep:cellphone' }) | const iconCellphone = useIcon({ icon: 'ep:cellphone' }) | ||||||
| const iconCircleCheck = useIcon({ icon: 'ep:circle-check' }) | const iconCircleCheck = useIcon({ icon: 'ep:circle-check' }) | ||||||
| const { wsCache } = useCache() | const { wsCache } = useCache() | ||||||
| const userStore = useUserStore() |  | ||||||
| const permissionStore = usePermissionStore() | const permissionStore = usePermissionStore() | ||||||
| const { currentRoute, addRoute, push } = useRouter() | const { currentRoute, push } = useRouter() | ||||||
| const loginLoading = ref(false) | const loginLoading = ref(false) | ||||||
| const { t } = useI18n() | const { t } = useI18n() | ||||||
|  |  | ||||||
| @@ -102,24 +100,16 @@ const signIn = async () => { | |||||||
|   await smsLoginApi(smsVO.loginSms) |   await smsLoginApi(smsVO.loginSms) | ||||||
|     .then(async (res) => { |     .then(async (res) => { | ||||||
|       setToken(res?.token) |       setToken(res?.token) | ||||||
|       const userInfo = await getInfoApi() |       if (!redirect.value) { | ||||||
|       await userStore.setUserInfoAction(userInfo) |         redirect.value = '/' | ||||||
|       getRoutes() |       } | ||||||
|  |       push({ path: redirect.value || permissionStore.addRouters[0].path }) | ||||||
|     }) |     }) | ||||||
|     .catch(() => {}) |     .catch(() => {}) | ||||||
|     .finally(() => { |     .finally(() => { | ||||||
|       loginLoading.value = false |       loginLoading.value = false | ||||||
|     }) |     }) | ||||||
| } | } | ||||||
| // 获取路由 |  | ||||||
| const getRoutes = async () => { |  | ||||||
|   // 后端过滤菜单 |  | ||||||
|   await permissionStore.generateRoutes() |  | ||||||
|   permissionStore.getAddRouters.forEach((route) => { |  | ||||||
|     addRoute(route as RouteRecordRaw) // 动态添加可访问路由表 |  | ||||||
|   }) |  | ||||||
|   push({ path: redirect.value || permissionStore.addRouters[0].path }) |  | ||||||
| } |  | ||||||
| </script> | </script> | ||||||
| <template> | <template> | ||||||
|   <el-form |   <el-form | ||||||
|   | |||||||
| @@ -135,7 +135,7 @@ defineExpose({ | |||||||
|             :name="item.filePath" |             :name="item.filePath" | ||||||
|             :key="item.filePath" |             :key="item.filePath" | ||||||
|           > |           > | ||||||
|             <el-button text style="float: right" @click="copy(item.code)"> |             <el-button link style="float: right" @click="copy(item.code)"> | ||||||
|               {{ t('common.copy') }} |               {{ t('common.copy') }} | ||||||
|             </el-button> |             </el-button> | ||||||
|             <pre>{{ item.code }}</pre> |             <pre>{{ item.code }}</pre> | ||||||
|   | |||||||
| @@ -1,5 +1,5 @@ | |||||||
| <script setup lang="ts"> | <script setup lang="ts"> | ||||||
| import { ref } from 'vue' | import { ref, unref } from 'vue' | ||||||
| import dayjs from 'dayjs' | import dayjs from 'dayjs' | ||||||
| import { ElMessage, ElUpload, UploadInstance, UploadRawFile, ElImage } from 'element-plus' | import { ElMessage, ElUpload, UploadInstance, UploadRawFile, ElImage } from 'element-plus' | ||||||
| import { useTable } from '@/hooks/web/useTable' | import { useTable } from '@/hooks/web/useTable' | ||||||
| @@ -8,6 +8,7 @@ import type { FileVO } from '@/api/infra/fileList/types' | |||||||
| import { allSchemas } from './fileList.data' | import { allSchemas } from './fileList.data' | ||||||
| import * as FileApi from '@/api/infra/fileList' | import * as FileApi from '@/api/infra/fileList' | ||||||
| import { getAccessToken, getTenantId } from '@/utils/auth' | import { getAccessToken, getTenantId } from '@/utils/auth' | ||||||
|  | import { useClipboard } from '@vueuse/core' | ||||||
|  |  | ||||||
| const { t } = useI18n() // 国际化 | const { t } = useI18n() // 国际化 | ||||||
|  |  | ||||||
| @@ -76,6 +77,18 @@ const handleDetail = (row: FileVO) => { | |||||||
|   dialogTitle.value = t('action.detail') |   dialogTitle.value = t('action.detail') | ||||||
|   dialogVisible.value = true |   dialogVisible.value = true | ||||||
| } | } | ||||||
|  | // ========== 复制相关 ========== | ||||||
|  | const handleCopy = async (text: string) => { | ||||||
|  |   const { copy, copied, isSupported } = useClipboard({ source: text }) | ||||||
|  |   if (!isSupported) { | ||||||
|  |     ElMessage.error(t('common.copyError')) | ||||||
|  |   } else { | ||||||
|  |     await copy() | ||||||
|  |     if (unref(copied)) { | ||||||
|  |       ElMessage.success(t('common.copySuccess')) | ||||||
|  |     } | ||||||
|  |   } | ||||||
|  | } | ||||||
| // ========== 初始化 ========== | // ========== 初始化 ========== | ||||||
| getList() | getList() | ||||||
| </script> | </script> | ||||||
| @@ -117,6 +130,9 @@ getList() | |||||||
|         <span>{{ dayjs(row.createTime).format('YYYY-MM-DD HH:mm:ss') }}</span> |         <span>{{ dayjs(row.createTime).format('YYYY-MM-DD HH:mm:ss') }}</span> | ||||||
|       </template> |       </template> | ||||||
|       <template #action="{ row }"> |       <template #action="{ row }"> | ||||||
|  |         <el-button link type="primary" @click="handleCopy(row.url)"> | ||||||
|  |           <Icon icon="ep:copy-document" class="mr-1px" /> {{ t('common.copy') }} | ||||||
|  |         </el-button> | ||||||
|         <el-button link type="primary" @click="handleDetail(row)"> |         <el-button link type="primary" @click="handleDetail(row)"> | ||||||
|           <Icon icon="ep:view" class="mr-1px" /> {{ t('action.detail') }} |           <Icon icon="ep:view" class="mr-1px" /> {{ t('action.detail') }} | ||||||
|         </el-button> |         </el-button> | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user
	 xingyu
					xingyu