liuQiang hace 1 año
padre
commit
8c0f112f9e
Se han modificado 3 ficheros con 61 adiciones y 18 borrados
  1. 11 5
      src/views/collect/index.vue
  2. 48 11
      src/views/search/index.vue
  3. 2 2
      vite.config.js

+ 11 - 5
src/views/collect/index.vue

@@ -232,6 +232,7 @@
     </el-collapse>
   </div>
   <!-- 右键唤出的菜单 -->
+  <!-- TODO 默认就是不搜索标签 -->
   <div
     class="right_menu"
     v-if="visible"
@@ -263,7 +264,7 @@ import {
 } from "@/api/biz/label.js";
 import { listFavorite, listFavoriteById } from "@/api/biz/favorite.js";
 const activeNames = ref(["folder", "file"]);
-const clickCollect = ref("first"); //当前标签
+const clickCollect = ref("second"); //当前标签
 const isAddCollect = ref(false); //是否在添加标签
 const tabName = ref(""); //新增的标签名
 const changeTabName = ref(""); //修改的标签名
@@ -490,10 +491,15 @@ const tabchange = async (labelId) => {
     labelId,
     isAsc: isAsc.value,
     orderByColumn: "createTime",
-  }; 
+  };
+  if (labelId === "second") {
+    const res = await listFavorite();
+    console.log("res", res);
+    return
+  }
   // 获取当前标签下的数据
   const res = await listFavoriteById(labelId);
-  // console.log("res", res);
+  // console.log("----res", res);
   folderArr.value = res.filter((item) => item.isFolder === "Y");
   fileArr.value = res.filter((item) => item.isFolder === "N");
   console.log("folderArr", folderArr.value);
@@ -534,12 +540,12 @@ const sortArr = (field) => {
   .statistics {
     width: 100%;
     height: 40px;
-    background-color: #D9E0F0;
+    background-color: #d9e0f0;
     padding-left: 16px;
     display: flex;
     justify-content: space-between;
     align-items: center;
-    color: #6F85B5;
+    color: #6f85b5;
     .left_box {
       display: flex;
       align-items: center;

+ 48 - 11
src/views/search/index.vue

@@ -78,7 +78,6 @@
           <el-table
             :data="tableData"
             style="width: 100%"
-            height="100%"
             :scrollbar-always-on="true"
           >
             <el-table-column fixed prop="fileName" label="名称" width="500">
@@ -94,7 +93,11 @@
                 </div>
               </template>
             </el-table-column>
-            <el-table-column prop="space.spaceName" label="所属空间" width="180" />
+            <el-table-column
+              prop="space.spaceName"
+              label="所属空间"
+              width="180"
+            />
             <el-table-column prop="createTime" label="时间" width="200" />
             <el-table-column prop="fileType" label="类型" width="80" />
             <el-table-column prop="fileSize" label="大小" width="160">
@@ -105,11 +108,17 @@
             <el-table-column prop="dir.dirPath" label="文件夹" width="180">
               <template #default="scope">
                 <div class="folder">
-                  {{ scope.row.dir?scope.row.dir.dirPath:'' }}
+                  {{ scope.row.dir ? scope.row.dir.dirPath : "" }}
                 </div>
               </template>
             </el-table-column>
           </el-table>
+          <Pagination
+            :total="total"
+            :page="page"
+            :limit="limit"
+            @pagination="pagination"
+          ></Pagination>
         </div>
         <div v-else>
           <!-- 平铺 -->
@@ -129,19 +138,25 @@
 import { onMounted, ref, toRaw, inject } from "vue";
 import { search } from "@/api/search/search.js";
 import { flieSearch } from "@/api/search/search.js";
-import { useRoute,useRouter } from "vue-router";
+import { useRoute, useRouter } from "vue-router";
+import Pagination from "@/components/Pagination/index.vue";
 const searchFor = ref("1"); //搜索范围
 const searchType = ref("doc"); //搜索对象
 const checkState = ref(false); //勾选框状态
 const activeNames = ref(["folder", "file"]);
 const isList = ref(true); //控制显示方式
 const isContent = ref(false); //内容搜索
-const total = ref(0); //数据总条数
+// const total = ref(0); //数据总条数
 const searchText = ref(""); //搜索ipt的值
 const baseData = ref(); //搜索出的原始数据
 const isAsc = ref("asc");
 const router = useRouter(); //注册路由
 
+//---------分页--------------
+const total = ref(0);
+const page = ref(1);
+const limit = ref(2); //pagesize
+//---------------------------
 
 const reload = inject("reload");
 onMounted(() => {
@@ -200,9 +215,31 @@ const fliterListData = (dataList) => {
   return dataList;
 };
 // 回退
-const goBack = ()=>{
-  router.back()
-}
+const goBack = () => {
+  router.back();
+};
+
+//分页
+const handleSizeChange = (val) => {
+  limit.value = val;
+};
+const handleCurrentChange = (val) => {
+  page.value = val;
+};
+const pagination = async (obj) => {
+  isAsc.value == "asc" ? (isAsc.value = "desc") : (isAsc.value = "asc");
+  const query = {
+    keyword: searchText.value,
+    isAsc: isAsc.value,
+    page: obj.page,
+    size: obj.limit,
+    orderByColumn: "createTime",
+  };
+  const res = await flieSearch(query);
+  baseData.value = res.rows;
+  tableData.value = res.rows;
+  changeSearchFor(searchFor.value);
+};
 // 设置图标
 const setIcon = (fileType) => {
   switch (fileType) {
@@ -246,7 +283,7 @@ const setIcon = (fileType) => {
 const setType = (fileType) => {
   switch (fileType) {
     case "doc":
-      return ['.txt',".ppd", ".pdf", ".docx", ".csv",".wps",'.xls'];
+      return [".txt", ".ppd", ".pdf", ".docx", ".csv", ".wps", ".xls"];
       break;
     case "img":
       return [".png", ".jpg", ".jpeg"];
@@ -258,10 +295,10 @@ const setType = (fileType) => {
       return [".mp4"];
       break;
     case "zip":
-      return [".zip",'rar','.7z'];
+      return [".zip", "rar", ".7z"];
       break;
     default:
-      return [''];
+      return [""];
       break;
   }
 };

+ 2 - 2
vite.config.js

@@ -39,8 +39,8 @@ export default defineConfig(({
 			proxy: {
 				// https://cn.vitejs.dev/config/#server-proxy
 				'/dev-api': {
-					// target: 'http://192.168.1.28:8080/',
-					target: 'http://8.142.173.95:19527/',
+					target: 'http://192.168.1.28:8080/',
+					// target: 'http://8.142.173.95:19527/',
 					// target:'http://192.168.1.28:8080/',
 					changeOrigin: true,
 					rewrite: (p) => p.replace(/^\/dev-api/, '')