浏览代码

切换用户之后动态菜单出现 404以及优化视频库等

pansl 1 年之前
父节点
当前提交
dab40d1c8e

+ 15 - 3
src/components/Upload/VideoUploader.vue

@@ -62,6 +62,7 @@ const headers = ref({})
 const progress = ref(0)
 const uploading = ref(false)
 const video = inject('video')
+const loadingInstance = ref({})
 // 校验上传文件格式
 const getType = (acceptType: string) => {
   let val = "";
@@ -139,7 +140,14 @@ const beforeUpload = (file: File) => {
   extraParams.value = {
     key: `${fname}`, token: token.value, 'x:video_id': video.value.id
   }
-  return checkFileName(file)
+  if (checkFileName(file, false)) {
+    loadingInstance.value = ElLoading.service({
+      text: "正在上传视频",
+      background: "rgba(0,0,0,.2)",
+    });
+  } else {
+    return checkFileName(file)
+  }
 
 }
 
@@ -158,6 +166,7 @@ const handleRemove: UploadProps['onRemove'] = (file, uploadFiles) => {
 const onSuccess = (response: any) => {
   uploading.value = false
   ElMessage.success('上传成功')
+  loadingInstance.value.close();
   emits('success', response)
   console.log(props.public_video_url);
   props.fileList.push({ name: response.fname, url: props.public_video_url, ...response })
@@ -170,6 +179,7 @@ const onError = (error: any) => {
 }
 
 const upload = (file: File) => {
+
   const key = `${Date.now()}_${file.name}`
   extraParams.value = {
     key, token: token.value
@@ -191,11 +201,13 @@ const upload = (file: File) => {
 
 }
 
-const checkFileName = (file: File) => {
+const checkFileName = (file: File, isShowTips = true) => {
   const fileName = file.name
   if (fileNameList.value.includes(fileName)) {
     console.log(fileName);
-    ElMessageBox.alert(`上传失败,《${fileName}》文件名已存在,请修改后重新上传`)
+    if (isShowTips) {
+      ElMessageBox.alert(`上传失败,《${fileName}》文件名已存在,请修改后重新上传`)
+    }
     return false
   } else {
     fileNameList.value.push(fileName)

+ 5 - 9
src/components/Upload/myUpload.vue

@@ -4,16 +4,11 @@
       <div class="el-upload-list el-upload-list--picture-card" v-if="listType == 'picture-card' || listType == 'picture'">
         <div class="el-upload-list__item is-success" v-for="( item, index ) in  waitFileList " :key="index">
           <el-image style="width:148px;height:148px;" :src="item.url" fit="fill" :lazy="true"></el-image>
-          <div v-if="!props.isDisableUpload" class="el-upload-list__item-actions">
-            <el-icon class="cursor-pointer el-upload-list__item-delete" @click="removeFile(item)">
+          <div v-if="!props.isDisableUpload" class="el-upload-list__item-actions el-upload-list__item-delete">
+            <el-icon class="cursor-pointer" @click="removeFile(item)">
               <DeleteFilled />
             </el-icon>
           </div>
-          <span v-if="isDownLoad" style="paddingleft: 5px">
-            <el-icon @click="handleDownLoad(item)">
-              <Download />
-            </el-icon>
-          </span>
         </div>
       </div>
       <div class="template_list" v-if="listType == 'text'">
@@ -53,7 +48,7 @@
       </div>
       <template #tip v-if="!props.isDisableUpload && isShowTips">
         <div class="el-upload__tip">
-          <span>支持{{ acceptTypeDesc }};</span> <span v-if="isLimitSize">文件大小不能超过{{
+          <span>支持{{ acceptType.replace(",", "/") }};</span> <span v-if="isLimitSize">文件大小不能超过{{
             props.maxFileSize }}M</span>
         </div>
       </template>
@@ -140,7 +135,7 @@ const handleChange = async (file: any, fileList: any[]) => {
   }
   // 防止多次执行change
   const rawFile = file.raw;
-  const list = props.acceptTypeDesc.split("/");
+  const list = props.acceptType.split(",");
   let acceptTypeList = list.map((its: string) => {
     return getType(its)
   })
@@ -150,6 +145,7 @@ const handleChange = async (file: any, fileList: any[]) => {
   })
   // 用于校验是否符合上传条件
   const type = props.acceptTypeDesc.replace("/", ", ");
+  console.log(props.acceptTypeDesc, 66666666, props.acceptType, '55555555555', type);
   if (ars.length < 1) {
     ElMessage.error(`仅支持格式为${type}的图片`);
     return false;

+ 2 - 1
src/router/guard/index.ts

@@ -42,7 +42,8 @@ const guard = (router: Router) => {
               const permissionStore = usePermissionsStore();
               // 动态路由挂载
               const asyncRoutes = permissionStore.getAsyncMenusFrom(
-                toRaw(userStore.getPermissions)
+                toRaw(userStore.getPermissions),
+                true
               );
               asyncRoutes.forEach((route: Menu) => {
                 router.addRoute(route as unknown as RouteRecordRaw);

+ 1 - 1
src/views/user/caster/create.vue

@@ -52,7 +52,7 @@ const props = defineProps({
   primary: String | Number,
 });
 const applet = ref([])
-const formData = ref({ status: 2, miniProgramIds: [] })
+const formData = ref({ status: 1, miniProgramIds: [] })
 //自定义校验规则
 const validatePasswordConfirmation = (
   rule: any,

+ 2 - 2
src/views/videoManage/form/create.vue

@@ -56,8 +56,8 @@
           </el-radio-group>
         </el-form-item>
         <el-form-item label="封面" prop="cover_image">
-          <my-upload :isMultiple="true" @fileRemove="fileRemove" @fileSuccess="fileSuccess" :fileList="formData.fileList"
-            action="/qiniu/upload/image"></my-upload>
+          <my-upload acceptType=".png,.jpeg" :isMultiple="true" @fileRemove="fileRemove" @fileSuccess="fileSuccess"
+            :fileList="formData.fileList" action="/qiniu/upload/image"></my-upload>
         </el-form-item>
       </div>
     </div>

+ 1 - 1
src/views/videoManage/form/videoDL.vue

@@ -8,7 +8,7 @@
     <div class="video-wrapper">
       <div class="flex items-center justify-between h-10">
         <div class="text-base font-medium">剧名: <span class="ml-2 text-lg font-bold text-dark-600">{{
-          props.primary.name }}</span></div>
+          props.primary.name }}</span> <span v-if="current.series_name">(当前播放{{ current.series_name }})</span></div>
         <el-tooltip placement="top">
           <template #content> 如需批量下载,则多选目标集数,点击下载按钮即可<br /> </template>
           <download v-if="videoChoose.length > 0" :urls="videoChooseUrls" :fileName="props.primary.name"></download>

+ 0 - 1
src/views/videoManage/index.vue

@@ -185,7 +185,6 @@ const resetQuery = () => {
 }
 const openType = (type: string, data: object) => {
   current.value = data;
-  provide('video', current.value)
   switch (type) {
     case 'videoDLVisible':
       videoDLVisible.value = true