Bladeren bron

Merge branch 'v3' of http://94.191.59.107:3000/houwenfeng/cloudfile-ui into v3

liling 1 jaar geleden
bovenliggende
commit
289a37a5a5

+ 2 - 1
.env.development

@@ -5,4 +5,5 @@ VITE_APP_TITLE = 聚合智慧文档
 VITE_APP_ENV = 'development'
 
 # 聚合智慧文档/开发环境
-VITE_APP_BASE_API = '/dev-api'
+# VITE_APP_BASE_API = '/dev-api'
+VITE_APP_BASE_API = 'http://8.142.173.95:19527'

+ 490 - 463
src/layout/indexCommon.vue

@@ -91,7 +91,7 @@
               type="card"
               class="common-tabs"
             >
-              <el-tab-pane label="首页"> </el-tab-pane>
+              <!-- <el-tab-pane label="首页" @click="clickTab('/index')"> </el-tab-pane> -->
               <el-tab-pane
                 v-for="(item, index) in toRaw(editableTabs)"
                 :key="item.path"
@@ -103,6 +103,7 @@
                   <div class="tab_pane" @click="paneClick(item)">
                     <div class="tab_text">{{ item.label }}</div>
                     <img
+					v-if="item.label != '首页'"
                       src="@/assets/images/close.png"
                       @click="closeTab(item, index, $event)"
                       alt=""
@@ -124,7 +125,7 @@
               </el-tab-pane>
               <!-- 文件的iframe -->
               <div v-for="item in iFrameData" :key="item.id">
-                <el-tab-pane :label="item.name" v-if="item.src">
+                <el-tab-pane :label="item.name" :name="item.id" v-if="item.src">
                   <template #label>
                     <div class="tab_pane" @click="filePaneClick(item)">
                       <div class="tab_text">{{ item.name }}</div>
@@ -168,102 +169,127 @@
 </template>
 
 <script setup>
-	import {
-		nextTick,
-		onMounted,
-		provide,
-		ref,
-		watchEffect
-	} from "vue";
-	import {
-		ElMessageBox,
-		ElMessage
-	} from "element-plus";
-	import useAppStore from "@/store/modules/app";
-	import useUserStore from "@/store/modules/user";
-	import useSettingsStore from "@/store/modules/settings";
-	import Cookies from "js-cookie";
-	import chat from "@/assets/images/chat.png";
-	import bechat from "@/assets/images/bechat.png";
-	import zuijin from "@/assets/images/zuijin.png";
-	import bezuijin from "@/assets/images/bezuijin.png";
-	import colloect from "@/assets/images/colloect.png";
-	import becolloect from "@/assets/images/becolloect.png";
-	import system from "@/assets/images/system.png";
-	import issystem from "@/assets/images/issystem.png";
-	import my from "@/assets/images/my.png";
-	import bemy from "@/assets/images/bemy.png";
-	import bumen from "@/assets/images/bumen.png";
-	import bebumen from "@/assets/images/bebumen.png";
-	import common from "@/assets/images/common.png";
-	import becommon from "@/assets/images/becommon.png";
-	import chuanshu from "@/assets/images/chuanshu.png";
-	import bechuanshu from "@/assets/images/bechuanshu.png";
-	import highsearch from "@/assets/images/highsearch.png";
-	import behighsearch from "@/assets/images/behighsearch.png";
-	import manyBody from "@/assets/images/manyBody.png";
-	import manyBodyFalse from "@/assets/images/manyBodyFalse.png";
-	import {
-		AppMain,
-		Navbar,
-		Settings,
-		TagsView
-	} from "./components";
-	import {
-		flieSearch
-	} from "@/api/search/search.js";
-	import {
-		useRouter,
-		useRoute
-	} from "vue-router";
-	import useWebsoctStore from "@/store/modules/websocket";
-	import {
-		toRaw
-	} from "@vue/reactivity";
-	import iFrame from "@/components/iFrame/index.vue";
-	const websoctStore = useWebsoctStore();
-	const router = useRouter(); //注册路由
-	const route = useRoute();
-	const appStore = useAppStore();
-	const userStore = useUserStore();
-	const settingsStore = useSettingsStore();
-	const searchText = ref(""); //搜索ipt的值
-	const selectValue = ref(1); //文档空间类型
-	const wangzhi = import.meta.env.VITE_APP_BASE_API;
-	const isAlive = ref(true);
-	const toFileData = ref();
-	const uid = useUserStore().uid;
-	let hasNewMessage = ref(false)
-	const iFrameData = ref([{
-			id: 1,
-			// src: `${window.location.origin}/fileEdit?clickRowId=113`,
-			show: false,
-			name: "file1",
-		},
-		{
-			id: 2,
-			src: ``,
-			// src: `http://192.168.1.9:81/fileEdit?clickRowId=1198`,
-			show: false,
-			name: "file2",
-		},
-		{
-			id: 3,
-			src: ``,
-			show: false,
-			name: "",
-		},
-		{
-			id: 4,
-			src: ``,
-			show: false,
-			name: "",
-		},
-	]);
-	//--------tabs-----------------
-	let tabIndex = 2;
-	const editableTabsValue = ref("/index");
-	const editableTabs = ref([]);
+import { nextTick, onMounted, provide, ref,watchEffect } from "vue";
+import { ElMessageBox, ElMessage } from "element-plus";
+import useAppStore from "@/store/modules/app";
+import useUserStore from "@/store/modules/user";
+import useSettingsStore from "@/store/modules/settings";
+import Cookies from "js-cookie";
+import chat from "@/assets/images/chat.png";
+import bechat from "@/assets/images/bechat.png";
+import zuijin from "@/assets/images/zuijin.png";
+import bezuijin from "@/assets/images/bezuijin.png";
+import colloect from "@/assets/images/colloect.png";
+import becolloect from "@/assets/images/becolloect.png";
+import system from "@/assets/images/system.png";
+import issystem from "@/assets/images/issystem.png";
+import my from "@/assets/images/my.png";
+import bemy from "@/assets/images/bemy.png";
+import bumen from "@/assets/images/bumen.png";
+import bebumen from "@/assets/images/bebumen.png";
+import common from "@/assets/images/common.png";
+import becommon from "@/assets/images/becommon.png";
+import chuanshu from "@/assets/images/chuanshu.png";
+import bechuanshu from "@/assets/images/bechuanshu.png";
+import highsearch from "@/assets/images/highsearch.png";
+import behighsearch from "@/assets/images/behighsearch.png";
+import manyBody from "@/assets/images/manyBody.png";
+import manyBodyFalse from "@/assets/images/manyBodyFalse.png";
+import { AppMain, Navbar, Settings, TagsView } from "./components";
+import { flieSearch } from "@/api/search/search.js";
+import { useRouter, useRoute } from "vue-router";
+import useWebsoctStore from "@/store/modules/websocket";
+import { toRaw } from "@vue/reactivity";
+import iFrame from "@/components/iFrame/index.vue";
+const websoctStore = useWebsoctStore();
+const router = useRouter(); //注册路由
+const route = useRoute();
+const appStore = useAppStore();
+const userStore = useUserStore();
+const settingsStore = useSettingsStore();
+const searchText = ref(""); //搜索ipt的值
+const selectValue = ref(1); //文档空间类型
+const wangzhi = import.meta.env.VITE_APP_BASE_API;
+const isAlive = ref(true);
+const toFileData = ref();
+const uid = useUserStore().uid;
+const iFrameData = ref([
+  {
+    id: 1,
+    // src: `${window.location.origin}/fileEdit?clickRowId=113`,
+    show: false,
+    name: "file1",
+	docId:''
+  },
+  {
+    id: 2,
+    src: ``,
+    // src: `http://192.168.1.9:81/fileEdit?clickRowId=1198`,
+    show: false,
+    name: "file2",
+	docId:''
+  },
+  {
+    id: 3,
+    src: ``,
+    show: false,
+    name: "",
+	docId:''
+  },
+  {
+    id: 4,
+    src: ``,
+    show: false,
+    name: "",
+	docId:''
+  },
+  {
+    id: 5,
+    src: ``,
+    show: false,
+    name: "",
+	docId:''
+  },
+  {
+    id: 6,
+    src: ``,
+    show: false,
+    name: "",
+	docId:''
+  },
+  {
+    id: 7,
+    src: ``,
+    show: false,
+    name: "",
+	docId:''
+  },
+  {
+    id: 8,
+    src: ``,
+    show: false,
+    name: "",
+	docId:''
+  },
+  {
+    id: 9,
+    src: ``,
+    show: false,
+    name: "",
+	docId:''
+  },
+  {
+    id: 10,
+    src: ``,
+    show: false,
+    name: "",
+	docId:''
+  },
+]);
+//--------tabs-----------------
+let tabIndex = 2;
+const editableTabsValue = ref("/index");
+const editableTabs = ref([{label:'首页',path:'/reindex'}]);
 
 	// const removeTab = (targetName) => {
 	//   const tabs = editableTabs.value;
@@ -284,376 +310,377 @@
 	// };
 	//-------------------------
 
-	function reload() {
-		isAlive.value = false;
-		console.log(11);
-		nextTick(() => {
-			isAlive.value = true;
-		});
-	}
+function reload() {
+  isAlive.value = false;
+  console.log(11);
+  nextTick(() => {
+    isAlive.value = true;
+  });
+}
 
-	provide("reload", reload);
+provide("reload", reload);
 
-	function toggleSideBar() {
-		appStore.toggleSideBar();
-	}
-	const logingName = ref("");
-	onMounted(() => {
-		logingName.value = Cookies.get("username");
-		// console.log('router',router)
-	});
-
-	watchEffect(async() => {
-		console.log("===============有新消息了:",websoctStore.messOne)
-		
-		if(websoctStore.noReadList!=null)hasNewMessage.value = true
-		else hasNewMessage.value = false
-		console.log("===============websoctStore.noReadList:",websoctStore.noReadList,'===========',hasNewMessage.value)
-	});
-
-	function handleCommand(command) {
-		switch (command) {
-			case "setLayout":
-				setLayout();
-				break;
-			case "logout":
-				logout();
-				break;
-			default:
-				break;
-		}
-	}
+function toggleSideBar() {
+  appStore.toggleSideBar();
+}
+const logingName = ref("");
+onMounted(() => {
+  logingName.value = Cookies.get("username");
+  // console.log('router',router)
+});
+watchEffect(async() => {
+	console.log("===============有新消息了:",websoctStore.messOne)
+	
+	if(websoctStore.noReadList!=null)hasNewMessage.value = true
+	else hasNewMessage.value = false
+	console.log("===============websoctStore.noReadList:",websoctStore.noReadList,'===========',hasNewMessage.value)
+});
+
+function handleCommand(command) {
+  switch (command) {
+    case "setLayout":
+      setLayout();
+      break;
+    case "logout":
+      logout();
+      break;
+    default:
+      break;
+  }
+}
 
-	function logout() {
-		ElMessageBox.confirm("确定注销并退出系统吗?", "提示", {
-				confirmButtonText: "确定",
-				cancelButtonText: "取消",
-				type: "warning",
-			})
-			.then(() => {
-				userStore.logOut().then(() => {
-					location.href = "/index";
-				});
-			})
-			.catch(() => {});
-	}
+function logout() {
+  ElMessageBox.confirm("确定注销并退出系统吗?", "提示", {
+    confirmButtonText: "确定",
+    cancelButtonText: "取消",
+    type: "warning",
+  })
+    .then(() => {
+      userStore.logOut().then(() => {
+        location.href = "/index";
+      });
+    })
+    .catch(() => {});
+}
+
+// 跳转到全文搜索
+const toSearch = async () => {
+  if (!searchText.value) return;
+  // console.log('searchText = ',searchText.value);
+  const query = {
+    keyword: searchText.value,
+    isAsc: "asc",
+    orderByColumn: "createTime",
+    pageSize: 3,
+    pageNum: 1,
+  };
+  const res = await flieSearch(query);
+  // console.log("res", res);
+  if (res) {
+    // console.log("res", res);
+    // console.log("router", route.path);
+    if (route.path != "/search") {
+      router.push({
+        path: "/search",
+        query: {
+          searchData: JSON.stringify(res),
+          searchText: searchText.value,
+        },
+      });
+    } else {
+      router.replace({
+        path: "/allback",
+        query: {
+          searchData: JSON.stringify(res),
+          searchText: searchText.value,
+        },
+      });
+    }
+  }
+};
+const emits = defineEmits(["setLayout"]);
 
-	// 跳转到全文搜索
-	const toSearch = async () => {
-		if (!searchText.value) return;
-		// console.log('searchText = ',searchText.value);
-		const query = {
-			keyword: searchText.value,
-			isAsc: "asc",
-			orderByColumn: "createTime",
-			pageSize: 3,
-			pageNum: 1,
-		};
-		const res = await flieSearch(query);
-		// console.log("res", res);
-		if (res) {
-			// console.log("res", res);
-			// console.log("router", route.path);
-			if (route.path != "/search") {
-				router.push({
-					path: "/search",
-					query: {
-						searchData: JSON.stringify(res),
-						searchText: searchText.value,
-					},
-				});
-			} else {
-				router.replace({
-					path: "/allback",
-					query: {
-						searchData: JSON.stringify(res),
-						searchText: searchText.value,
-					},
-				});
-			}
-		}
-	};
-	const emits = defineEmits(["setLayout"]);
-
-	function setLayout() {
-		emits("setLayout");
+function setLayout() {
+  emits("setLayout");
+}
+const clickId = ref("");
+const menuList = reactive({
+  data: [
+    {
+      label: "会话消息",
+      path: "/index",
+      imgs: chat,
+      beimgs: bechat,
+    },
+    // {
+    //   label: "接口",
+    //   path: "/swagger",
+    //   imgs: chat,
+    //   beimgs: bechat,
+    //   disabled:true
+    // },
+    {
+      label: "最近文件",
+      path: "/recent",
+      imgs: zuijin,
+      beimgs: bezuijin,
+    },
+    {
+      label: "收藏文件",
+      path: "/collect",
+      imgs: colloect,
+      beimgs: becolloect,
+    },
+    {
+      label: "我的文件",
+      path: "/myfile",
+      imgs: my,
+      beimgs: bemy,
+    },
+    {
+      label: "部门文件",
+      path: "/department",
+      imgs: bumen,
+      beimgs: bebumen,
+    },
+    {
+      label: "公共文件",
+      path: "/publicment",
+      imgs: common,
+      beimgs: becommon,
+    },
+    {
+      label: "高级搜索",
+      path: "/highsearch",
+      imgs: highsearch,
+      beimgs: behighsearch,
+    },
+    // {
+    // 	label: "传输列表",
+    // 	path: "/transFile",
+    // 	imgs: chuanshu,
+    // 	beimgs: bechuanshu,
+    // },
+    // {
+    // 	label: "系统管理",
+    // 	path: "/admin",
+    // 	imgs: system,
+    // 	beimgs: issystem,
+    // },
+    {
+      label: "我的协作",
+      path: "/myjoin",
+      imgs: manyBody,
+      beimgs: manyBodyFalse,
+    },
+  ],
+});
+const clickPath = (index, items) => {
+  items = toRaw(items);
+  // toFileData.value = null
+  console.log("clickPathitems", items);
+  // editableTabs.value = arr;
+  const arr = toRaw(editableTabs.value);
+  if (!arr.some((item) => item.label == items.label)) {
+    editableTabs.value.push({
+      label: items.label,
+      path: items.path,
+    });
+    //需要jSON去转 否则页面无变化 离谱得很
+    editableTabs.value = JSON.parse(JSON.stringify(editableTabs.value));
+  } else {
+    toFileData.value = null;
+    clickTab(items.path);
+  }
+  editableTabsValue.value = items.path;
+  isAlive.value = true;
+  // console.log("editableTabs", editableTabs.value);
+};
+const clickTab = (item) => {
+  console.log("item", toRaw(item));
+  setTimeout(() => {
+    console.log("toFileData.value", toFileData.value);
+    if (toFileData.value) {
+      console.log(
+        "tofolder",
+        JSON.stringify(toRaw(toFileData.value.clickRowId))
+      );
+      router.push({
+        path: toFileData.value.path,
+        query: {
+        //   row: JSON.stringify(toRaw(toFileData.value.clickRowId)),
+        },
+      });
+      // router.push({
+      //   path: toFileData.value.path,
+      //   query: {
+      //     row: toFileData.value.row,
+      //   },
+      // });
+      return;
+    }
+    let regExp = new RegExp(/^\//);
+    if (!regExp.test(toRaw(item))) {
+      const data = JSON.parse(toRaw(item));
+      console.log("data", data);
+      router.push({
+        // path: "/fileEdit" + data.docId,
+        path: "/fileEdit",
+        query: {
+          clickRowId: data.docId,
+          // row:JSON.stringify(toFileData.value)
+          // copyRow: JSON.stringify(data),
+        },
+      });
+    } else {
+      router.push({
+        path: item,
+      });
+    }
+  }, 0);
+};
+const paneClick = (item) => {
+  // 可以拿到当前的标签对象
+  isAlive.value = true;
+  console.log("paneItem", item);
+  if (item.clickRowId) {
+    // 判断是菜单还是目录
+    toFileData.value = item;
+  } else {
+    toFileData.value = null;
+  }
+  clickTab(item.path);
+  //   console.log("isAlive", isAlive.value);
+};
+// 点击文件标签
+const filePaneClick = (item) => {
+  console.log("filePaneClickitem", item);
+  const row = toRaw(item);
+  const arr = iFrameData.value.map((par) => {
+    if (par.id === row.id) {
+		// editableTabsValue.value = row.id
+      par.show = true;
+      // document.getElementById('iframe'+par.id).window.document.iframe[0]
+      const outIframe = document.getElementById("iframe" + par.id);
+      const inIframe =
+        outIframe.contentDocument.getElementsByTagName("iframe")[0];
+      setTimeout(() => {
+        console.error(outIframe.parentElement);
+        inIframe.style.height = outIframe.style.height =
+          outIframe.parentElement.offsetHeight + "px";
+        inIframe.style.width = outIframe.style.width =
+          outIframe.parentElement.offsetWidth + "px";
+
+        // console.log('dom',outIframe.parentElement.offsetWidth);
+        // console.log('inIframe',inIframe);
+      }, 500);
+    } else {
+      par.show = false;
+    }
+    return toRaw(par);
+  });
+  iFrameData.value = arr;
+  // console.log("Clicknewfilearr", iFrameData.value);
+  isAlive.value = false;
+//   console.log("editableTabsValue", editableTabsValue.value);
+};
+// 创建文件的标签
+const addFileTab = (data) => {
+  console.log("fileTabdata", data);
+  console.log();
+  const thisData = JSON.parse(JSON.stringify(toRaw(data)));
+  const oldIFrameData = iFrameData.value;
+  const canAdd = oldIFrameData.some((par) => par.src == ""); //是否达到上限
+  if (!canAdd) return ElMessage.error("已到最大数量,请先关闭其他文件!"); 
+  const hasThis = oldIFrameData.some((par) => par.docId == data.docId);//是否已存在
+  if (hasThis) return
+  const arr = oldIFrameData.map((par) => {
+    if (!par.src) {
+      if (thisData.docId) {
+        // par.src = `${window.location.origin}/fileEdit?clickRowId=${thisData.docId}`;
+        par.src = `${window.location.origin}/fileEdit?clickRowId=${thisData.docId}`;
+        par.name = data.fileName;
+		par.docId = data.docId
+		par.show = true
+        thisData.docId = "";
+      }
+    }else{
+		par.show = false
 	}
-	const clickId = ref("");
-	const menuList = reactive({
-		data: [{
-				label: "会话消息",
-				path: "/index",
-				imgs: chat,
-				beimgs: bechat,
-			},
-			// {
-			//   label: "接口",
-			//   path: "/swagger",
-			//   imgs: chat,
-			//   beimgs: bechat,
-			//   disabled:true
-			// },
-			{
-				label: "最近文件",
-				path: "/recent",
-				imgs: zuijin,
-				beimgs: bezuijin,
-			},
-			{
-				label: "收藏文件",
-				path: "/collect",
-				imgs: colloect,
-				beimgs: becolloect,
-			},
-			{
-				label: "我的文件",
-				path: "/myfile",
-				imgs: my,
-				beimgs: bemy,
-			},
-			{
-				label: "部门文件",
-				path: "/department",
-				imgs: bumen,
-				beimgs: bebumen,
-			},
-			{
-				label: "公共文件",
-				path: "/publicment",
-				imgs: common,
-				beimgs: becommon,
-			},
-			{
-				label: "高级搜索",
-				path: "/highsearch",
-				imgs: highsearch,
-				beimgs: behighsearch,
-			},
-			{
-				label: "传输列表",
-				path: "/transFile",
-				imgs: chuanshu,
-				beimgs: bechuanshu,
-			},
-			{
-				label: "系统管理",
-				path: "/admin",
-				imgs: system,
-				beimgs: issystem,
-			},
-			{
-				label: "我的协作",
-				path: "/myjoin",
-				imgs: manyBody,
-				beimgs: manyBodyFalse,
-			},
-		],
-	});
-	const clickPath = (index, items) => {
-		items = toRaw(items);
-		// toFileData.value = null
-		console.log("clickPathitems", items);
-		// editableTabs.value = arr;
-		const arr = toRaw(editableTabs.value);
-		if (!arr.some((item) => item.label == items.label)) {
-			editableTabs.value.push({
-				label: items.label,
-				path: items.path
-			});
-			//需要jSON去转 否则页面无变化 离谱得很
-			editableTabs.value = JSON.parse(JSON.stringify(editableTabs.value));
-		} else {
-			toFileData.value = null;
-			clickTab(items.path);
-		}
-		editableTabsValue.value = items.path;
-		if(items.path=='/index' && websoctStore.noReadList!=null){
-			hasNewMessage.value = true
-		}else{
-			hasNewMessage.value = false
-		}
-		// console.log("editableTabs", editableTabs.value);
-	};
-	const clickTab = (item) => {
-		const path = toRaw(item)
-		console.log("item", path);
-		if(path=='/index' && websoctStore.noReadList!=null){
-			hasNewMessage.value = true
-		}else{
-			hasNewMessage.value = false
-		}
-		setTimeout(() => {
-			console.log("toFileData.value", toFileData.value);
-			if (toFileData.value) {
-				console.log(
-					"tofolder",
-					JSON.stringify(toRaw(toFileData.value.clickRowId))
-				);
-				router.push({
-					path: toFileData.value.path,
-					query: {
-						row: JSON.stringify(toRaw(toFileData.value.clickRowId)),
-					},
-				});
-				// router.push({
-				//   path: toFileData.value.path,
-				//   query: {
-				//     row: toFileData.value.row,
-				//   },
-				// });
-				return;
-			}
-			let regExp = new RegExp(/^\//);
-			let regFile = new RegExp(/^tofile/);
-			if (!regExp.test(path)) {
-				const data = JSON.parse(path);
-				console.log("data", data);
-				router.push({
-					// path: "/fileEdit" + data.docId,
-					path: "/fileEdit",
-					query: {
-						clickRowId: data.docId,
-						// row:JSON.stringify(toFileData.value)
-						// copyRow: JSON.stringify(data),
-					},
-				});
-			} else {
-				router.push({
-					path: item,
-				});
-			}
-		}, 0);
-	};
-	const paneClick = (item) => {
-		// 可以拿到当前的标签对象
-		isAlive.value = true;
-		console.log("paneItem", item);
-		if (item.clickRowId) {
-			// 判断是菜单还是目录
-			toFileData.value = item;
-		} else {
-			toFileData.value = null;
-		}
-		clickTab(item.path);
-		console.log("isAlive", isAlive.value);
-	};
-	// 点击文件标签
-	const filePaneClick = (item) => {
-		console.log("filePaneClickitem", item);
-		const row = toRaw(item);
-		const arr = iFrameData.value.map((par) => {
-			if (par.id === row.id) {
-				par.show = true;
-				// document.getElementById('iframe'+par.id).window.document.iframe[0]
-				const outIframe = document.getElementById("iframe" + par.id);
-				const inIframe =
-					outIframe.contentDocument.getElementsByTagName("iframe")[0];
-				setTimeout(() => {
-					console.error(outIframe.parentElement);
-					inIframe.style.height = outIframe.style.height =
-						outIframe.parentElement.offsetHeight + "px";
-					inIframe.style.width = outIframe.style.width =
-						outIframe.parentElement.offsetWidth + "px";
-
-					// console.log('dom',outIframe.parentElement.offsetWidth);
-					// console.log('inIframe',inIframe);
-				}, 500);
-			} else {
-				par.show = false;
-			}
-			return toRaw(par);
-		});
-		iFrameData.value = arr;
-		// console.log("Clicknewfilearr", iFrameData.value);
-		isAlive.value = false;
-		// console.log("isAlive", isAlive.value);
-	};
-	// 创建文件的标签
-	const addFileTab = (data) => {
-		console.log("fileTabdata", data);
-		const thisData = toRaw(data);
-		const oldIFrameData = iFrameData.value;
-		const canAdd = oldIFrameData.some((par) => par.src == "");
-		if (!canAdd) return ElMessage.error("已到最大数量,请先关闭其他文件!");
-		const arr = oldIFrameData.map((par) => {
-			if (!par.src) {
-				if (thisData.docId) {
-					par.src = `${window.location.origin}/fileEdit?clickRowId=${thisData.docId}`;
-					par.name = data.fileName;
-					thisData.docId = "";
-				}
-			}
-			return toRaw(par);
-		});
-		iFrameData.value = arr;
-		console.log("addFileTab", arr);
-	};
-	//创建tab标签事件
-	const addTab = (data) => {
-		console.log("addTab", data);
-		const arr = toRaw(editableTabs.value);
-		if (!arr.some((item) => item.label == data.fileName)) {
-			// editableTabs.value.push({
-			//   label: data.fileName,
-			//   path: JSON.stringify(data),
-			// });
-			editableTabs.value.push({
-				label: data.fileName,
-				path: JSON.stringify(data),
-			});
-			//需要jSON去转 否则页面无变化 离谱得很
-			editableTabs.value = JSON.parse(JSON.stringify(editableTabs.value));
-			// editableTabsValue.value = data.path;
-		}
-	};
-	const addFolderAdd = (data) => {
-		console.log("data", data);
-		const arr = toRaw(editableTabs.value);
-		if (!arr.some((item) => item.label == data.row.dirName)) {
-			editableTabs.value.push({
-				label: data.name,
-				path: data.path,
-				clickRowId: data.row,
-			});
-			//需要jSON去转 否则页面无变化 离谱得很
-			editableTabs.value = JSON.parse(JSON.stringify(editableTabs.value));
-		}
-		console.log("editableTabs", toRaw(editableTabs.value));
-	};
-	provide("addTab", addTab);
-	provide("addFolderAdd", addFolderAdd);
-	provide("addFileTab", addFileTab);
-	// TODO 删除tab事件
-	const closeTab = (item, index, e) => {
-		e.preventDefault();
-		e.stopPropagation();
-		editableTabs.value.splice(index, 1);
-		editableTabs.value = JSON.parse(JSON.stringify(editableTabs.value));
-		const nextTab =
-			editableTabs.value[index + 1] || editableTabs.value[index - 1];
-		clickTab(nextTab.path);
-		// console.log("item", item);
-		// console.log("index", index);
-		// console.log("e", e);
-	};
-	// TODO 删除tab事件
-	const closeFileTab = (item, index, e) => {
-		e.preventDefault();
-		e.stopPropagation();
-		const data = toRaw(item);
-		console.log("closeFileTab", data);
-		const arr = iFrameData.value.map((par) => {
-			if (par.id === data.id) {
-				par.src = "";
-				par.show = false;
-				par.name = "";
-			}
-			return toRaw(par);
-		});
-		iFrameData.value = arr;
-		// console.log("index", index);
-		// console.log("e", e);
-	};
+    return toRaw(par);
+  });
+  iFrameData.value = arr;
+  isAlive.value = false;
+  console.log("addFileTab", arr);
+};
+//创建tab标签事件
+const addTab = (data) => {
+  console.log("addTab", data);
+  const arr = toRaw(editableTabs.value);
+  if (!arr.some((item) => item.label == data.fileName)) {
+    // editableTabs.value.push({
+    //   label: data.fileName,
+    //   path: JSON.stringify(data),
+    // });
+    editableTabs.value.push({
+      label: data.fileName,
+      path: JSON.stringify(data),
+    });
+    //需要jSON去转 否则页面无变化 离谱得很
+    editableTabs.value = JSON.parse(JSON.stringify(editableTabs.value));
+    // editableTabsValue.value = data.path;
+  }
+};
+const addFolderAdd = (data) => {
+  console.log("data", data);
+  const arr = toRaw(editableTabs.value);
+  if (!arr.some((item) => item.label == data.row.dirName)) {
+    editableTabs.value.push({
+      label: data.name,
+      path: data.path,
+      clickRowId: data.row,
+    });
+    //需要jSON去转 否则页面无变化 离谱得很
+    editableTabs.value = JSON.parse(JSON.stringify(editableTabs.value));
+  }
+  console.log("editableTabs", toRaw(editableTabs.value));
+};
+provide("addTab", addTab);
+provide("addFolderAdd", addFolderAdd);
+provide("addFileTab", addFileTab);
+// TODO 删除tab事件
+const closeTab = (item, index, e) => {
+  e.preventDefault();
+  e.stopPropagation();
+  editableTabs.value.splice(index, 1);
+  editableTabs.value = JSON.parse(JSON.stringify(editableTabs.value));
+  const nextTab =
+    editableTabs.value[index + 1] || editableTabs.value[index - 1];
+  clickTab(nextTab.path);
+  // console.log("item", item);
+  // console.log("index", index);
+  // console.log("e", e);
+};
+// TODO 删除tab事件
+const closeFileTab = (item, index, e) => {
+  e.preventDefault();
+  e.stopPropagation();
+  const data = toRaw(item);
+  console.log("closeFileTab", data);
+  const arr = iFrameData.value.map((par) => {
+    if (par.id === data.id) {
+      par.src = "";
+      par.show = false;
+      par.name = "";
+	  par.docId = ''
+    }
+    return toRaw(par);
+  });
+  iFrameData.value = arr;
+  isAlive.value = true;
+  // console.log("index", index);
+  console.log("iFrameData", iFrameData.value);
+};
 </script>
 
 <style lang="scss" scoped>

+ 49 - 3
src/router/index.js

@@ -85,7 +85,17 @@ export const constantRoutes = [{
 					title: '返回',
 					icon: 'dashboard',
 					affix: true
-				}
+				},
+			},
+			{
+				path: 'reindex',
+				component: () => import('@/views/liveChat/index.vue'),
+				name: 'reindex',
+				meta: {
+					title: '返回',
+					icon: 'dashboard',
+					affix: true
+				},
 			},
 			{
 				path: 'swagger',
@@ -152,6 +162,15 @@ export const constantRoutes = [{
 					icon: "myjoin"
 				}
 			},
+			// {
+			// 	path: "/department",
+			// 	component: () => import("@/views/department/MyFile"),
+			// 	name: "department",
+			// 	meta: {
+			// 		title: "部门文件",
+			// 		icon: "department"
+			// 	}
+			// },
 			{
 				path: "/department",
 				component: () => import("@/views/department/MyFile"),
@@ -159,8 +178,26 @@ export const constantRoutes = [{
 				meta: {
 					title: "部门文件",
 					icon: "department"
-				}
+				},
+				children: [{
+					path: '/department:dirId(\\d+)',
+					component: () => import('@/views/department/MyFile'),
+					name: 'department',
+					meta: {
+						title: '部门文件',
+						activeMenu:'/department'
+					}
+				}]
 			},
+			// {
+			// 	path: "/publicment",
+			// 	component: () => import("@/views/publicment/MyFile"),
+			// 	name: "publicment",
+			// 	meta: {
+			// 		title: "公共文件",
+			// 		icon: "becommon"
+			// 	}
+			// },
 			{
 				path: "/publicment",
 				component: () => import("@/views/publicment/MyFile"),
@@ -168,7 +205,16 @@ export const constantRoutes = [{
 				meta: {
 					title: "公共文件",
 					icon: "becommon"
-				}
+				},
+				children: [{
+					path: '/publicment:dirId(\\d+)',
+					component: () => import('@/views/publicment/MyFile'),
+					name: 'publicment',
+					meta: {
+						title: '公共文件',
+						activeMenu:'/publicment'
+					}
+				}]
 			},
 			{
 				path: "/collect",

+ 55 - 17
src/views/department/MyFile.vue

@@ -398,7 +398,7 @@ import historyList from "@/components/historyList/index.vue"; //选择文件发
 import inputPassword from "./components/inputPassword.vue"; //选择文件发送的列表,历史版本
 import { listVersion } from "@/api/biz/version";
 import useUserStore from "@/store/modules/user";
-import { useRouter, useRoute } from "vue-router";
+import { useRouter, useRoute,onBeforeRouteUpdate } from "vue-router";
 import { canPreviewFile,rightMenuRole,publicRightMenuRole } from "@/utils/index.js"
 import fileSpace from '../../api/filespace/fileSpace';
 import { getLeveldetail } from '../../api/level/level';
@@ -601,6 +601,7 @@ export default {
         const noMenuItem = ref(false)
         const addTab = inject("addTab");
         const addFileTab = inject("addFileTab");
+        const addFolderAdd = inject("addFolderAdd");
         // 获取文件夹,中栏,文件
         function getAllTop() {
             documents.getTop(2).then(res => {
@@ -649,8 +650,15 @@ export default {
             })
         }
         function changeFile(row, num) {
+          const addData = {
+                path:'/department'+row.dirId,
+                name:row.dirName,
+                row:toRaw(row)
+            }
+            addFolderAdd(addData)
             thisFolder.value = row
             console.log('row2',row);
+            topPath.value = row.dirPath
             if(row.isEncrypt === "Y"){
                 getLeveldetailFn(row.encryptLevel)
             }else{
@@ -787,7 +795,7 @@ export default {
                             type: "success",
                             message: "删除成功"
                         })
-                        getAllTop()
+                        refreshFile()
                     }
                 })
             }
@@ -901,7 +909,7 @@ export default {
                                 message: "上传文件成功",
                                 type: "success"
                             })
-                            getAllTop()
+                            refreshFile()
                             uploadModal.value = false
                             fileArr.value = []
                         }
@@ -997,7 +1005,7 @@ export default {
                                 message: "删除成功",
                                 type: "success"
                             })
-                            getAllTop()
+                            refreshFile()
                         } else {
                             ElMessage({
                                 message: "删除失败,目录应不为空",
@@ -1013,7 +1021,7 @@ export default {
                                 message: "删除成功",
                                 type: "success"
                             })
-                            getAllTop()
+                            refreshFile()
                         }
                     })
                 }
@@ -1055,7 +1063,7 @@ export default {
                 thisFolderRole.value = {}
             }
             thisRole.value = row.dirRole?row.dirRole.split(','):[]
-            console.log('row1', toRaw(row));
+            // console.log('row1', toRaw(row));
             topPath.value = row.dirPath
             // console.log('topPath',toRaw(topPath.value));
             newDirId.value = row.dirId
@@ -1099,7 +1107,7 @@ export default {
                         type: "success"
                     })
                     fileNameChange.value = false
-                    getAllTop()
+                    refreshFile()
                 }
             })
         }
@@ -1121,6 +1129,7 @@ export default {
         }
         function getChildren(data) {
             fileTrees.value = data
+            refreshFile()
         }
         function getCback(data) {
             thanks.value = data
@@ -1333,7 +1342,7 @@ export default {
         //点击收藏后刷新文件
         const refreshFile = ()=>{
             // console.log('ref',toRaw(thisFolder.value));
-            if(toRaw(thisFolder.value).isFavorite){//如果点开了文件夹
+            if(toRaw(thisFolder.value).dirId){//如果点开了文件夹
             // console.log(111);
                folderClick()
             }else{
@@ -1343,7 +1352,7 @@ export default {
         }
         //star收藏事件
         const collectByStar = (row,isfolder)=>{
-            console.log('row',row);
+            // console.log('row',row);
             if(isfolder){
                 let thisRow = toRaw(row)
                 isFolder.value = 'Y'
@@ -1479,15 +1488,43 @@ export default {
             window.addEventListener("click", mouseClick, true);
         })
          onActivated(()=>{
-            // console.log('route.query',route.query);
-            if(route.query.row){
-            const newRow = JSON.parse(route.query.row)
-            console.log('newRow',newRow);
-            thisFolder.value = newRow
-            refreshFile()
-            }
+            // console.log('onActivated.query',route.query);
+            loadingPreview.value = true
+            setTimeout(()=>{
+                if(route.query.row){
+                    const newRow = JSON.parse(route.query.row)
+                    console.log('newRow',newRow);
+                    thisFolder.value = newRow
+                    refreshFile()
+                }
+                    loadingPreview.value = false
+            },500)
 
         })
+            // 监听路由变化
+        onBeforeRouteUpdate((to,from)=>{
+        console.log('to',to);
+        console.log('from',from);
+        if(to.name == 'department'){
+            loadingPreview.value = true
+            const thisdirId = to.params.dirId
+            console.log('thisdirId',thisdirId);
+            setTimeout(()=>{
+                if(thisdirId){
+                    myfile.getDir(thisdirId).then(res=>{
+                        console.log('tores',res);
+                        thisFolder.value = res.data
+                        refreshFile()
+                    })
+                }
+                loadingPreview.value = false
+            },500)
+        }
+        // docId = to.query.clickRowId
+        // console.log(docId, "doc");
+        // console.log(copyRow, "row");
+        // edit();
+        })
         return {
             getSpaceList,
             folderList,//文件夹的数据
@@ -1653,7 +1690,8 @@ export default {
             noMenuItem,
             downLoadfile,
             addTab,
-            addFileTab
+            addFileTab,
+            addFolderAdd
         }
     },
     watch: {

+ 2 - 2
src/views/login.vue

@@ -120,7 +120,7 @@
     </div>
     <el-dialog
       v-model="showEdit"
-      title="新建文件夹"
+      title="修改密码"
       width="30%"
       @close="closeRepass"
     >
@@ -197,7 +197,7 @@ const newPassRule = (rule, value, callback) => {
   if (value === "") {
     callback(new Error("请输入密码"));
   } else if (!pPattern.test(value)) {
-    callback(new Error("密码长度最少为8位,包含大小写字、数字、特殊字符"));
+    callback(new Error("密码长度最少为8位,包含大小写字、数字、特殊字符"));
   } else {
     callback();
   }

+ 7 - 7
src/views/myfile/MyFile.vue

@@ -829,8 +829,8 @@ export default {
                     // console.log('needc');
                 }
             }
-            console.log('chooseSetrow',row);
-            console.log('chooseSetnum',num);
+            // console.log('chooseSetrow',row);
+            // console.log('chooseSetnum',num);
             if (row.name == '在线编辑' || row.name == '协作') {
                 cliCC.value = true
             }
@@ -951,7 +951,7 @@ export default {
                 // previewData.value = URL.createObjectURL(res)
             } else if (row.name === "历史版本") {
                 const resHistory = await listVersion({ docId: clickRowId.value })
-                console.log('resHistory',resHistory);
+                // console.log('resHistory',resHistory);
                 historyTotal.value = resHistory.total
                 fileUserTreeData.data = resHistory.rows;
                 openForwardFile.value = true
@@ -1151,7 +1151,7 @@ export default {
             }else{
                 thisFolderRole.value = null
             }
-            console.log('row1', toRaw(row));
+            // console.log('row1', toRaw(row));
             topPath.value = row.dirPath
             // console.log('topPath',toRaw(topPath.value));
             newDirId.value = row.dirId
@@ -1195,7 +1195,7 @@ export default {
                         type: "success"
                     })
                     fileNameChange.value = false
-                    getAllTop()
+                    refreshFile()
                 }
             })
         }
@@ -1429,7 +1429,7 @@ export default {
         }
         //star收藏事件
         const collectByStar = (row,isfolder)=>{
-            console.log('row',row);
+            // console.log('row',row);
             if(isfolder){
                 let thisRow = toRaw(row)
                 isFolder.value = 'Y'
@@ -1562,7 +1562,7 @@ export default {
                 getAllTop()
             // }
             getSpaceList()
-            console.log('!thisFolder.value',thisFolder.value);
+            // console.log('!thisFolder.value',thisFolder.value);
                 // refreshFile()
             // 添加监听,点击其他地方关闭文件夹右键菜单
             window.addEventListener("click", closeRMenu, true);

+ 2 - 0
src/views/myfile/components/FileEdit.vue

@@ -77,6 +77,7 @@ export default {
           option.value.url = `${window.location.origin}${
             import.meta.env.VITE_APP_BASE_API
           }/api/access/${obj.docId}?uid=${uid}`;
+          // option.value.url = `http://8.142.173.95:19527/api/access/${obj.docId}?uid=${uid}`;
           //  console.log('option.value.url',option.value.url);
           option.value.title = obj.fileName;
           option.value.key = obj.fileId;
@@ -94,6 +95,7 @@ export default {
         option.value.url = `${window.location.origin}${
           import.meta.env.VITE_APP_BASE_API
         }/api/access/${props.historycopyRow.docId}?uid=${uid}`;
+        //  option.value.url = `http://8.142.173.95:19527/api/access/${props.historycopyRow.docId}?uid=${uid}`;
         //  console.log('option.value.url2',option.value.url);
         option.value.title = props.copyRow.fileName;
         option.value.key = props.historycopyRow.fileId;

+ 78 - 36
src/views/publicment/MyFile.vue

@@ -398,7 +398,7 @@ import historyList from "@/components/historyList/index.vue"; //选择文件发
 import inputPassword from "./components/inputPassword.vue"; //选择文件发送的列表,历史版本
 import { listVersion } from "@/api/biz/version";
 import useUserStore from "@/store/modules/user";
-import { useRouter, useRoute } from "vue-router";
+import { useRouter, useRoute,onBeforeRouteUpdate } from "vue-router";
 import { canPreviewFile,rightMenuRole,publicRightMenuRole } from "@/utils/index.js"
 import fileSpace from '../../api/filespace/fileSpace';
 import { getLeveldetail } from '../../api/level/level';
@@ -599,6 +599,9 @@ export default {
         const chooseNum = ref()
         const loadingPreview = ref(false)
         const noMenuItem = ref(false)
+        const addTab = inject("addTab");
+        const addFileTab = inject("addFileTab");
+        const addFolderAdd = inject("addFolderAdd");
         // 获取文件夹,中栏,文件
         function getAllTop() {
             documents.getTop(1).then(res => {
@@ -651,8 +654,15 @@ export default {
             })
         }
         function changeFile(row, num) {
+             const addData = {
+                path:'/publicment'+row.dirId,
+                name:row.dirName,
+                row:toRaw(row)
+            }
+            addFolderAdd(addData)
             thisFolder.value = row
-            console.log('row2',row);
+            // console.log('row2',row);
+             topPath.value = row.dirPath
             if(row.isEncrypt === "Y"){
                 getLeveldetailFn(row.encryptLevel)
             }else{
@@ -761,8 +771,8 @@ export default {
                     // console.log('needc');
                 }
             }
-            console.log('chooseSetrow',row);
-            console.log('chooseSetnum',num);
+            // console.log('chooseSetrow',row);
+            // console.log('chooseSetnum',num);
             if (row.name == '在线编辑' || row.name == '协作') {
                 cliCC.value = true
             }
@@ -789,7 +799,7 @@ export default {
                             type: "success",
                             message: "删除成功"
                         })
-                        getAllTop()
+                        refreshFile()
                     }
                 })
             }
@@ -812,26 +822,26 @@ export default {
                 collects.value = true
             }
             if (row.name === '在线编辑') {
-                editOnline.value = false
-                cliCC.value = false
-                const newItem = {
-                    name: copyFileName.value,
-                    choose: copyFileId.value,
-                    dirIds: copyDirId.value,
-                    spaceIds: copySpaceId.value
-                };
-                // 检查 newItem 是否已存在于 menuList 中
-                const isItemExist = menuList.value.some(item => item.choose === newItem.choose);
-                // 如果不存在,则添加它
-                if (!isItemExist) {
-                    menuList.value.push(newItem);
-                }
-                selectedIndex.value = selectedIndex.value + 1
+                loadingPreview.value = true
+                // const filePreview = canPreviewFile(copyFileType.value)
+                // if (filePreview) {
+                     loadingPreview.value = false
+                    addFileTab(clickRow.value);
+                    onlyView.value = false
+                    // editOnline.value = false
+                    cliCC.value = false
+                // } else {
+                //     const res = await preview(copyRow.value.docId)
+                //     showPreview.value = true
+                //     previewData.value = URL.createObjectURL(res)
+                // }
+                loadingPreview.value = false
             }
             if (row.name === '文字识别') {
                 router.push({
                     path: '/identifyFont',
                     query: {
+                        docId: copyRow.value.docId,
                         fileId: copyFileId.value,
                         fileType: copyFileType.value
                     }
@@ -841,8 +851,9 @@ export default {
                 loadingPreview.value = true
                 const filePreview = canPreviewFile(copyFileType.value)
                 if (filePreview) {
+                   loadingPreview.value = false
+                    addFileTab(clickRow.value);
                     onlyView.value = true
-                    editOnline.value = false
                     cliCC.value = false
                 } else {
                     const res = await preview(copyRow.value.docId)
@@ -858,7 +869,7 @@ export default {
                 // previewData.value = URL.createObjectURL(res)
             } else if (row.name === "历史版本") {
                 const resHistory = await listVersion({ docId: clickRowId.value })
-                console.log('resHistory',resHistory);
+                // console.log('resHistory',resHistory);
                 historyTotal.value = resHistory.total
                 fileUserTreeData.data = resHistory.rows;
                 openForwardFile.value = true
@@ -900,12 +911,12 @@ export default {
                                 message: "上传文件成功",
                                 type: "success"
                             })
-                            getAllTop()
+                             refreshFile()
                             uploadModal.value = false
                             fileArr.value = []
                         }
                     }).catch(err=>{
-                        console.log('UPerr',err);
+                        // console.log('UPerr',err);
                     })
                 }
             }
@@ -996,7 +1007,7 @@ export default {
                                 message: "删除成功",
                                 type: "success"
                             })
-                            getAllTop()
+                            refreshFile()
                         } else {
                             ElMessage({
                                 message: "删除失败,目录应不为空",
@@ -1012,7 +1023,7 @@ export default {
                                 message: "删除成功",
                                 type: "success"
                             })
-                            getAllTop()
+                             refreshFile()
                         }
                     })
                 }
@@ -1331,7 +1342,7 @@ export default {
         //点击收藏后刷新文件
         const refreshFile = ()=>{
             // console.log('ref',toRaw(thisFolder.value));
-            if(toRaw(thisFolder.value).isFavorite){//如果点开了文件夹
+            if(toRaw(thisFolder.value).dirId){//如果点开了文件夹
             // console.log(111);
                folderClick()
             }else{
@@ -1477,16 +1488,44 @@ export default {
             window.addEventListener("click", closeRMenu, true);
             window.addEventListener("click", mouseClick, true);
         })
-         onActivated(()=>{
-            // console.log('route.query',route.query);
-            if(route.query.row){
-            const newRow = JSON.parse(route.query.row)
-            console.log('newRow',newRow);
-            thisFolder.value = newRow
-            refreshFile()
-            }
+        // 组件显示
+        onActivated(()=>{
+            console.log('onActivated.query',route.query);
+            loadingPreview.value = true
+            setTimeout(()=>{
+                if(route.query.row){
+                    const newRow = JSON.parse(route.query.row)
+                    console.log('newRow',newRow);
+                    thisFolder.value = newRow
+                    refreshFile()
+                }
+                    loadingPreview.value = false
+            },500)
 
         })
+        onBeforeRouteUpdate((to,from)=>{
+        console.log('to',to);
+        console.log('from',from);
+        if(to.name == 'publicment'){
+            loadingPreview.value = true
+            const thisdirId = to.params.dirId
+            console.log('thisdirId',thisdirId);
+            setTimeout(()=>{
+                if(thisdirId){
+                    myfile.getDir(thisdirId).then(res=>{
+                        console.log('tores',res);
+                        thisFolder.value = res.data
+                        refreshFile()
+                    })
+                }
+                loadingPreview.value = false
+            },500)
+        }
+        // docId = to.query.clickRowId
+        // console.log(docId, "doc");
+        // console.log(copyRow, "row");
+        // edit();
+        })
         return {
             getSpaceList,
             folderList,//文件夹的数据
@@ -1650,7 +1689,10 @@ export default {
             loadingPreview,
             thisRole,
             noMenuItem,
-            downLoadfile
+            downLoadfile,
+            addFolderAdd,
+            addFileTab,
+            addTab
         }
     },
     watch: {

+ 77 - 0
vite.config.js

@@ -0,0 +1,77 @@
+import {
+	defineConfig,
+	loadEnv
+} from 'vite'
+import path from 'path'
+import createVitePlugins from './vite/plugins'
+
+// https://vitejs.dev/config/
+export default defineConfig(({
+								 mode,
+								 command
+							 }) => {
+	const env = loadEnv(mode, process.cwd())
+	const {
+		VITE_APP_ENV
+	} = env
+	return {
+		// 部署生产环境和开发环境下的URL。
+		// 默认情况下,vite 会假设你的应用是被部署在一个域名的根路径上
+		// 例如 https://www.ruoyi.vip/。如果应用被部署在一个子路径上,你就需要用这个选项指定这个子路径。例如,如果你的应用被部署在 https://www.ruoyi.vip/admin/,则设置 baseUrl 为 /admin/。
+		base: VITE_APP_ENV === 'production' ? '/' : '/',
+		plugins: createVitePlugins(env, command === 'build'),
+		resolve: {
+			// https://cn.vitejs.dev/config/#resolve-alias
+			alias: {
+				// 设置路径
+				'~': path.resolve(__dirname, './'),
+				// 设置别名
+				'@': path.resolve(__dirname, './src')
+			},
+			// https://cn.vitejs.dev/config/#resolve-extensions
+			extensions: ['.mjs', '.js', '.ts', '.jsx', '.tsx', '.json', '.vue']
+		},
+		// vite 相关配置
+		server: {
+			port: 80,
+			host: true,
+			open: true,
+			proxy: {
+				// https://cn.vitejs.dev/config/#server-proxy
+				'/dev-api': {
+					// target: 'http://192.168.1.28:8080/',
+					// target: 'http://192.168.1.11:8080/',
+					// target: 'http://localhost:8080/',
+					// target:'http://192.168.1.28:8080/',
+					target:'http://8.142.173.95:19527',
+					changeOrigin: true,
+					rewrite: (p) => p.replace(/^\/dev-api/, '')
+				},
+				//websocket代理
+				'/websocket': {
+					// target:'ws://localhost:8080/websocket',
+					// target:'ws://192.168.1.28:8080/websocket',
+					// target:'ws://192.168.1.11:8080/websocket',
+					target:'ws://8.142.173.95:19527/websocket',
+					changeOrigin: true,
+					rewrite: (p) => p.replace(/^\/websocket/, '')
+				}
+			}
+		},
+		//fix:error:stdin>:7356:1: warning: "@charset" must be the first rule in the file
+		css: {
+			postcss: {
+				plugins: [{
+					postcssPlugin: 'internal:charset-removal',
+					AtRule: {
+						charset: (atRule) => {
+							if (atRule.name === 'charset') {
+								atRule.remove();
+							}
+						}
+					}
+				}]
+			}
+		}
+	}
+})