Browse Source

Merge branch 'liuqiang' into v3

liuQiang 1 year ago
parent
commit
eca3305681
3 changed files with 30 additions and 84 deletions
  1. 29 9
      src/layout/indexCommon.vue
  2. 1 1
      src/router/index.js
  3. 0 74
      vite.config.js

+ 29 - 9
src/layout/indexCommon.vue

@@ -712,7 +712,7 @@ const closeFileTab = (item, index, e) => {
   e.stopPropagation();
   const data = toRaw(item);
   console.log("closeFileTab", data);
-  const arr = iFrameData.value.map((par) => {
+  let arr = iFrameData.value.map((par) => {
     if (par.id === data.id) {
       par.src = "";
       par.show = false;
@@ -721,27 +721,47 @@ const closeFileTab = (item, index, e) => {
     }
     return toRaw(par);
   });
-  iFrameData.value = arr;
   if(data.id == editableTabsValue.value){
-    isAlive.value = true;
+    console.log('data.id',data.id);
+    let isLeft = true
+    //如果不是第一个就左移
+    for (let thisId = data.id; thisId>0; thisId--) {
+      console.log(arr[thisId - 1].id,arr[thisId - 1].src);
+      if(arr[thisId - 1].src){
+        arr[thisId -1].show = true
+        isLeft = false
+        editableTabsValue.value = arr[thisId - 1].id
+        return
+      }
+      
+    }
+    // 如果是第一个就跳到文件夹标签右一
+    if(isLeft){
+      const num = toRaw(editableTabs.value).length - 1
+      const nextTab = editableTabs.value[num]
+       paneClick(toRaw(nextTab));
+      console.log('left',nextTab);
+    }
+    // isAlive.value = true;
   }
+    iFrameData.value = arr;
   // console.log("index", index);
   console.log("iFrameData", iFrameData.value);
 };
 const setTabLocal = (data)=>{
-  console.log('setTabLocal',data);
+  // console.log('setTabLocal',data);
   sessionStorage.setItem('tabData', JSON.stringify(data))
 }
 const setFileTabLocal = (data)=>{
-  console.log('setFileTabLocal',data);
+  // console.log('setFileTabLocal',data);
   sessionStorage.setItem('fileTabData', JSON.stringify(data))
 }
 const setEditableTabsValue = (data)=>{
-  console.log('setEditableTabsValue',data);
+  // console.log('setEditableTabsValue',data);
   sessionStorage.setItem('editableTabsValue', JSON.stringify(data))
 }
 watch(() => iFrameData.value, (newValue, oldValue) => {
-    console.log('iFrameData 发生改变了', newValue, oldValue);
+    // console.log('iFrameData 发生改变了', newValue, oldValue);
     setFileTabLocal(toRaw(toRaw(newValue)))
     
 }, {
@@ -749,14 +769,14 @@ watch(() => iFrameData.value, (newValue, oldValue) => {
     deep: true
 });
 watch(() => editableTabs.value, (newValue, oldValue) => {
-    console.log('editableTabs 发生改变了', newValue, oldValue);
+    // console.log('editableTabs 发生改变了', newValue, oldValue);
     setTabLocal(toRaw(newValue))
 }, {
     immediate: true,
     deep: true
 });
 watch(() => editableTabsValue.value, (newValue, oldValue) => {
-    console.log('editableTabsValue 发生改变了', newValue, oldValue);
+    // console.log('editableTabsValue 发生改变了', newValue, oldValue);
     setEditableTabsValue(toRaw(newValue))
     let regExp = new RegExp(/^\//);
     if(!regExp.test(editableTabsValue.value)){

+ 1 - 1
src/router/index.js

@@ -118,7 +118,7 @@ export const constantRoutes = [{
 				},
 			},
 			{
-				path: 'search',
+				path: '/search',
 				component: () => import('@/views/search/index.vue'),
 				name: 'search',
 				meta: {

+ 0 - 74
vite.config.js

@@ -1,74 +0,0 @@
-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://8.142.173.95:19527/',
-					// target:'http://192.168.1.28:8080/',
-					changeOrigin: true,
-					rewrite: (p) => p.replace(/^\/dev-api/, '')
-				},
-				//websocket代理
-				'/websocket': {
-					target:'ws://8.142.173.95:19527/websocket',
-					// target:'ws://192.168.1.28:8080/websocket',
-					// target:'ws://192.168.1.11:8080/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();
-							}
-						}
-					}
-				}]
-			}
-		}
-	}
-})