diff --git a/src/api/system/oss/index.ts b/src/api/system/oss/index.ts index 7fbad3b..8987300 100644 --- a/src/api/system/oss/index.ts +++ b/src/api/system/oss/index.ts @@ -276,4 +276,12 @@ export function delPerson(id: string | number | Array) { url: '/oss/person/' + id, method: 'delete' }); -} \ No newline at end of file +} + +export const getVolume = (query?: any): AxiosPromise => { + return request({ + url: '/resource/oss/volume', + method: 'get', + params: query + }); +}; \ No newline at end of file diff --git a/src/assets/styles/index.scss b/src/assets/styles/index.scss index debb6bf..73be2c1 100644 --- a/src/assets/styles/index.scss +++ b/src/assets/styles/index.scss @@ -217,3 +217,10 @@ aside { .w100 { width: 100%; } + +.text-ellipsis { + text-overflow: ellipsis; + overflow: hidden; + word-break: break-all; + white-space: nowrap +} \ No newline at end of file diff --git a/src/components/FileMd5Upload/index.vue b/src/components/FileMd5Upload/index.vue index 7c50c7f..7bb7dac 100644 --- a/src/components/FileMd5Upload/index.vue +++ b/src/components/FileMd5Upload/index.vue @@ -2,12 +2,14 @@
+ :on-progress="uploadVideoProcess" :on-success="handleUploadSuccess" :show-file-list="false" :headers="headers" + class="upload-file-uploader">
请将文件拖拽到此处上传 点击上传
+
支持上传 @@ -66,6 +68,20 @@ const showTip = computed(() => props.isShowTip && (props.fileType || props.fileS const fileUploadRef = ref(); +const loadProgress = ref(0) // 动态显示进度条 +const progressFlag = ref(false) // 关闭进度条 + +const uploadVideoProcess = (event, file, fileList) => { + progressFlag.value = true + loadProgress.value = parseInt(event.percent) // 动态获取文件上传进度 + if (loadProgress.value >= 100) { + loadProgress.value = 100 + // setTimeout(() => { + // progressFlag.value = false + // }, 1000); + } +} + watch( () => props.modelValue, async (val: any) => { @@ -187,6 +203,7 @@ const handleExceed = () => { // 上传失败 const handleUploadError = () => { proxy?.$modal.msgError('上传文件失败'); + progressFlag.value = false }; // 上传成功回调 @@ -205,6 +222,7 @@ const handleUploadSuccess = (res: any, file: UploadFile) => { fileUploadRef.value?.handleRemove(file); uploadedSuccessfully(); } + progressFlag.value = false }; // 删除文件 diff --git a/src/composables/useVolume.ts b/src/composables/useVolume.ts new file mode 100644 index 0000000..49ca20f --- /dev/null +++ b/src/composables/useVolume.ts @@ -0,0 +1,19 @@ +import { ref, onMounted } from 'vue' +import { getVolume } from '@/api/system/oss' + +export function useVolume(type: number) { + const volume = ref() + + const getVolumeData = async () => { + const res = await getVolume({ type }) + volume.value = res.data + } + + onMounted(() => { + getVolumeData() + }) + + return { + volume + } +} \ No newline at end of file diff --git a/src/layout/components/Navbar.vue b/src/layout/components/Navbar.vue index 704f58f..a29882a 100644 --- a/src/layout/components/Navbar.vue +++ b/src/layout/components/Navbar.vue @@ -79,6 +79,8 @@ const openSearchMenu = () => { const dynamicTenantEvent = async (tenantId: string) => { if (companyName.value != null && companyName.value !== '') { await dynamicTenant(tenantId); + userStore.setenantId(tenantId) + dynamic.value = true; proxy?.$tab.closeAllPage(); proxy?.$router.push('/'); @@ -116,7 +118,7 @@ const logout = async () => { type: 'warning' }); await userStore.logout(); - location.href = import.meta.env.VITE_APP_CONTEXT_PATH + 'index'; + location.href = import.meta.env.VITE_APP_CONTEXT_PATH + '/index'; }; const emits = defineEmits(['setLayout']); diff --git a/src/router/index.ts b/src/router/index.ts index 2786014..0da27ed 100644 --- a/src/router/index.ts +++ b/src/router/index.ts @@ -71,7 +71,7 @@ export const constantRoutes: RouteRecordRaw[] = [ path: '/index', component: () => import('@/views/index.vue'), name: 'Index', - meta: { title: '首页', icon: 'dashboard', affix: true} + meta: { title: '首页', icon: 'dashboard', affix: true, noCache: true } } ] }, diff --git a/src/store/modules/user.ts b/src/store/modules/user.ts index 4122294..38cf9c5 100644 --- a/src/store/modules/user.ts +++ b/src/store/modules/user.ts @@ -10,6 +10,7 @@ export const useUserStore = defineStore('user', () => { const name = ref(''); const nickname = ref(''); const userId = ref(''); + const tenantId = ref(''); const avatar = ref(''); const roles = ref>([]); // 用户角色编码集合 → 判断路由权限 const permissions = ref>([]); // 用户权限编码集合 → 判断按钮权限 @@ -67,7 +68,13 @@ export const useUserStore = defineStore('user', () => { avatar.value = value; }; + const setenantId = (value: any) => { + tenantId.value = value + } + return { + tenantId, + setenantId, userId, token, nickname, diff --git a/src/views/index.vue b/src/views/index.vue index 4fe85e9..8b8603e 100644 --- a/src/views/index.vue +++ b/src/views/index.vue @@ -176,6 +176,8 @@