@@ -76,6 +91,7 @@ import { ossLogin } from "@/api/system/ossLogin";
import { Navbar, Sidebar, AppMain } from "./components";
import ResizeMixin from "./mixin/ResizeHandler";
import worker from "./components/worker/index.vue";
+import axios from "axios";
export default {
name: "Layout",
components: {
@@ -88,7 +104,9 @@ export default {
data() {
return {
active: 0,
- bookUrl:process.env.VUE_APP_OUT_Book
+ bookUrl: process.env.VUE_APP_OUT_Book,
+ gdzcUrl: `${process.env.VUE_APP_OUT_GDZC}?id=${this.$store.state.user.userId}&username=${this.$store.state.user.username}`,
+ oldUrl: ``,
};
},
computed: {
@@ -130,20 +148,34 @@ export default {
"$route.path": {
handler: function (url) {
if (url === "/bookmanage") {
- this.$nextTick(() => {
- setTimeout(() => {
- this.$refs["bookIframe"].contentWindow.postMessage(
- {
- key: "login",
- data: {
- id:this.$store.state.user.userId,
- username:this.$store.state.user.username
- },
+ setTimeout(() => {
+ this.$refs["bookIframe"].contentWindow.postMessage(
+ {
+ key: "login",
+ data: {
+ id: this.$store.state.user.userId,
+ username: this.$store.state.user.username,
},
- "*"
- );
- },500)
+ },
+ "*"
+ );
});
+ return;
+ }
+ if (url === "/old") {
+ axios
+ .get('/old', {
+ url:'/index.php',
+ params: {
+ s: "/login/oss_login",
+ id: this.$store.state.user.userId,
+ username: this.$store.state.user.username,
+ },
+ })
+ .then((res) => {
+ this.oldUrl = `${process.env.VUE_APP_OUT_OLD}${res.data.data}`
+ this.$refs['oldIframe'].src = this.oldUrl
+ });
}
},
immediate: true,
@@ -316,4 +348,9 @@ export default {
}
}
}
+iframe {
+ width: calc(100% + 12px);
+ height: 100%;
+ border: none;
+}
diff --git a/src/store/modules/permission.js b/src/store/modules/permission.js
index cfb2bd8..ad16aab 100644
--- a/src/store/modules/permission.js
+++ b/src/store/modules/permission.js
@@ -64,6 +64,23 @@ const state = {
*/
export function generaMenu(routes, data) {
data.forEach(item => {
+ let params = {};
+ if(item.path?.includes('?')){
+ let flag = item.path.split('?')
+ item.path = flag[0]
+ if(flag[1]){
+ let list = flag[1].split('&')
+ list.forEach(item => {
+ let kv = item.split('=')
+ Object.defineProperty(params,kv[0],{
+ value:kv[1],
+ writable:true,
+ enumerable:true,
+ configurable:false
+ })
+ })
+ }
+ }
if (item.url === "/") {
routes.push({
path: '/',
@@ -75,7 +92,8 @@ export function generaMenu(routes, data) {
component: () => import('@/views/dashboard/index'),
meta: {
title: '系统首页',
- icon: 'dashboard'
+ icon: 'dashboard',
+ params
}
}]
})
@@ -95,7 +113,7 @@ export function generaMenu(routes, data) {
title: item.name,
id: item.id,
roles: ['admin'],
-
+ params,
icon: item.icon
}
}
diff --git a/vue.config.js b/vue.config.js
index eb5aa39..be0156d 100644
--- a/vue.config.js
+++ b/vue.config.js
@@ -59,6 +59,13 @@ module.exports = {
pathRewrite: {
['^' + process.env.VUE_APP_DOMIAN]: process.env.VUE_APP_DOMIAN
}
+ },
+ '^/old':{
+ target: process.env.VUE_APP_OUT_OLD,
+ changeOrigin: true, //配置跨域
+ pathRewrite: {
+ ['^' + process.env.VUE_APP_OUT_OLD]: process.env.VUE_APP_OUT_OLD
+ }
}
}
},