Sfoglia il codice sorgente

右键菜单动态显示

liuQiang 2 anni fa
parent
commit
0df08e1bb3

+ 16 - 1
src/components/IdentifyFont/IdentifyFont.vue

@@ -1,5 +1,4 @@
 <template>
-<!-- TODO 从我的文件过来默认进入第二形态loading,传参实现 -->
   <!-- <el-dialog v-model="isOpen" title="文字识别" width="55%"> -->
   <div class="container">
     <div v-if="thisStep === 'start'" class="up_box">
@@ -103,6 +102,7 @@ import Clipboard from "clipboard";
 import PicTree from "@/components/PicTree/PicTree.vue"; //选择文件发送的列表
 import { picTree } from "@/api/search/search.js";
 import { ocrRemark, preview } from "@/api/common/common.js";
+import { useRoute } from "vue-router";
 const textData = ref(""); //解析出来的文字
 const showImg = ref(); //上传的图片
 const isOpen = ref(props.openFile);
@@ -123,6 +123,21 @@ watch(
     isOpen.value = newValue;
   }
 );
+onMounted(async () => {
+  let route = useRoute();
+  let fileId = route.query.fileId;
+  let fileType = route.query.fileType;
+  console.log("fileId", fileId);
+  console.log("fileType", fileType);
+  if (fileType === ".png" || fileType === ".jpg") {
+    const imgRes = await preview(fileId);
+    thisStep.value = "loading";
+    showImg.value = URL.createObjectURL(imgRes);
+    const res = await ocrRemark(fileId);
+    thisStep.value = "end";
+    textData.value = res.msg;
+  }
+});
 const handleAvatarSuccess = (msg, file) => {
   // console.log("re", msg);
   const flieData = toRaw(file);

+ 2 - 2
src/views/collect/index.vue

@@ -354,8 +354,8 @@ const delTabs = async () => {
 };
 //获取收藏数据
 const getCollectList = async () => {
-  const res = await listFavorite();
-  //   console.log("collectres = ", res);
+  const res = await listFavorite({page:2});
+    console.log("collectres = ", res);
   if (res.code === 200 && res.rows.length > 0) {
     tableData.value = res.rows;
   }

+ 37 - 11
src/views/myfile/MyFile.vue

@@ -192,12 +192,12 @@
 
                                 </el-table>
                                 <div class="setCli" v-if="cliCC">
-                                    <template v-for="(item, index) in mouseCli">
+                                    <template v-for="(item, index) in filterMouseCli()">
                                         <p @click="chooseSet(item, index)" class="chooseSet">
                                             <img :src="item.img" alt="">
                                             {{ item.name }}
                                             <span v-if="item.name == '在线编辑' || item.name == '协作' ? true : false"
-                                                style="color: #7084B4;float: right;position: relative;">></span>
+                                                style="color: #7084B4;float: right;position: relative;" class="arrow">></span>
                                         </p>
                                     </template>
                                     <div class="setCli1" v-if="anyP">
@@ -563,6 +563,10 @@ export default {
         ])
         let mouseCli = ref([
             {
+                img: ImgFile.previewIcon,
+                name: "预览"
+            },
+            {
                 img: ImgFile.addolder,
                 name: "移动",
             },
@@ -611,10 +615,6 @@ export default {
                 name: "历史版本"
             },
             {
-                img: ImgFile.previewIcon,
-                name: "预览"
-            },
-            {
                 img: ImgFile.trash,
                 name: "删除"
             }
@@ -846,7 +846,11 @@ export default {
             }
             if (row.name === '文字识别') {
                 router.push({
-                    path: '/identifyFont'
+                    path: '/identifyFont',
+                    query:{
+                        fileId:copyFileId.value,
+                        fileType:copyFileType.value
+                    }
                 })
             }
             if (row.name === '预览') {
@@ -1192,8 +1196,20 @@ export default {
             fileTrees.value = data
 
         }
+        //对mouseCli数组进行筛选,实现菜单的区分显示
+        const filterMouseCli = ()=>{
+            const typeArr = ['.png','.jpg','.jpeg','.JPG','.mp3','.mp4']
+            let arr = []
+            if(!typeArr.includes(copyFileType.value)){
+                arr = mouseCli.value.filter(item=>item.name !== "预览")
+            }else{
+                arr = mouseCli.value.filter(item=>item.name !== "在线编辑" && item.name !== "协作" && item.name !== "历史版本")
+            }
+            return arr
+        }
         onMounted(() => {
             getAllTop()
+            getAllCollect()
             getAllUser()
         })
         return {
@@ -1312,7 +1328,8 @@ export default {
             copyOrMove,
             impDirId,
             impNum,
-            impSpaceId
+            impSpaceId,
+            filterMouseCli
         }
 
     },
@@ -1328,7 +1345,7 @@ export default {
 
 </script>
 
-<style scoped>
+<style lang="scss" scoped>
 p {
     margin: 0;
     padding: 0;
@@ -1484,14 +1501,15 @@ p {
 
 .setCli {
     width: 156px;
-    height: 380px;
+    max-height: 380px;
     position: absolute;
     top: -70px;
     left: 300px;
+    flex-wrap: 400;
     background-color: white;
     border: 1px solid gray;
     border-radius: 4px;
-    z-index: 2;
+    z-index: 10;
     overflow-y: auto;
 }
 
@@ -1513,6 +1531,14 @@ p {
     height: 30px;
     line-height: 30px;
     margin: 5px auto;
+
+    // display: flex;
+    // align-items: center;
+    // position: relative;
+    img{
+        margin-right: 4px;
+        vertical-align: middle;
+    }
 }
 
 .chooseSet:hover {