imatrix-ui 0.2.46-up → 0.2.49-up

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "imatrix-ui",
3
- "version": "0.2.46-up",
3
+ "version": "0.2.49-up",
4
4
  "type": "module",
5
5
  "private": false,
6
6
  "main": "./lib/super-ui.js",
package/src/permission.js CHANGED
@@ -17,7 +17,9 @@ const whiteList = [
17
17
  ] // 不重定向白名单
18
18
 
19
19
  let devpJWTKey = '_devpJWT'
20
+ let runDevpJWTKey = '_runDevpJWT'
20
21
  let currentRoleKey = '_CURRENT_ROLE'
22
+ let runCurrentRoleKey = '_RUN_CURRENT_ROLE'
21
23
  router.beforeEach((to, from, next) => {
22
24
  NProgress.start()
23
25
  console.log('router.beforeEach-to=', to)
@@ -25,14 +27,14 @@ router.beforeEach((to, from, next) => {
25
27
  // console.log('router.beforeEach-to.path=', to.path)
26
28
  if (to.query && to.query[devpJWTKey]) {
27
29
  setToken(to.query[devpJWTKey])
28
- authApi.setSessionCache(devpJWTKey, to.query[devpJWTKey])
30
+ authApi.setSessionCache(runDevpJWTKey, to.query[devpJWTKey])
29
31
  }
30
32
  if (to.query && to.query[currentRoleKey]) {
31
- authApi.setSessionCache(currentRoleKey, to.query[currentRoleKey])
33
+ authApi.setSessionCache(runCurrentRoleKey, to.query[currentRoleKey])
32
34
  }
33
35
  // 是否是开发环境功能
34
36
  let isDevp = false
35
- if(authApi.getSessionCache(devpJWTKey)) {
37
+ if(authApi.getSessionCache(runDevpJWTKey)) {
36
38
  isDevp = true
37
39
  }
38
40
  let token = getToken()
@@ -101,7 +103,7 @@ router.beforeEach((to, from, next) => {
101
103
  .dispatch('getCurrentUser')
102
104
  .then((user) => {
103
105
  console.log('router.beforeEach-getCurrentUser')
104
- const devpRoleCodes = authApi.getSessionCache(currentRoleKey)
106
+ const devpRoleCodes = authApi.getSessionCache(runCurrentRoleKey)
105
107
  if(isDevp && devpRoleCodes){
106
108
  // 表示是开发环境JWT
107
109
  return store.dispatch(
@@ -1,6 +1,6 @@
1
1
  <template>
2
2
  <div class="menu-wrapper">
3
- <template v-if="!item.children || item.children.lenght === 0">
3
+ <template v-if="!item.children || item.children.length === 0">
4
4
  <app-link :to="toPath(item)" @click="clickMenu(toPath(item))">
5
5
  <el-menu-item
6
6
  :index="item.fullPath + '~~' + item.i18nValue"
@@ -76,6 +76,8 @@ export default {
76
76
  let currentRoleKey = '_CURRENT_ROLE'
77
77
  return {
78
78
  onlyOneChild: null,
79
+ devpJWTKey,
80
+ currentRoleKey,
79
81
  platFrontUrl: authApi.getSessionCache(frontendUrlKey),
80
82
  platBackendUrl: authApi.getSessionCache(backendUrlKey),
81
83
  devpJWT: authApi.getSessionCache(devpJWTKey),
@@ -105,44 +107,41 @@ export default {
105
107
  toPath(menu) {
106
108
  const toPathObj = {};
107
109
  let routePath = menu.fullPath;
110
+ if(!routePath) {
111
+ routePath = ''
112
+ }
108
113
  toPathObj.openWay = menu.openWay;
109
114
  if (this.isExternalLink(menu.pageType)) {
110
- if (this.platFrontUrl) {
111
- if (routePath && routePath.indexOf("?") > 0) {
112
- routePath += "&"
113
- } else {
114
- routePath += "?"
115
- }
116
- routePath = routePath + this.platFrontUrl;
117
- }
118
- if (this.platBackendUrl) {
119
- if (routePath && routePath.indexOf("?") > 0) {
120
- routePath += "&"
121
- } else {
122
- routePath += "?"
115
+ if((routePath.indexOf('http:') < 0 && routePath.indexOf('https:') < 0) && this.platFrontUrl) {
116
+ // 说明不是全路径,需要拼接运行平台前端访问路径
117
+ if(this.platFrontUrl.lastIndex('/') === this.platFrontUrl.length - 1) {
118
+ // 去掉最后一个/
119
+ this.platFrontUrl = this.platFrontUrl.substring(0,this.platFrontUrl.length - 1)
123
120
  }
124
- routePath = routePath + this.platBackendUrl;
121
+ routePath =this.platFrontUrl + routePath
125
122
  }
126
123
  if (this.devpJWT) {
127
- if (routePath && routePath.indexOf("?") > 0) {
124
+ // 开发平台中访问运行平台的菜单需要的参数
125
+ if (routePath.indexOf("?") > 0) {
128
126
  routePath += "&"
129
127
  } else {
130
128
  routePath += "?"
131
129
  }
132
- routePath = routePath + this.devpJWT
130
+ routePath = routePath + this.devpJWTKey + ' = ' + this.devpJWT
133
131
  }
134
132
  if (this.currentRole) {
135
- if (routePath && routePath.indexOf("?") > 0) {
133
+ // 开发平台中访问运行平台的菜单需要的参数
134
+ if (routePath.indexOf("?") > 0) {
136
135
  routePath += "&"
137
136
  } else {
138
137
  routePath += "?"
139
138
  }
140
- routePath = routePath + this.currentRole
139
+ routePath = routePath + this.currentRoleKey + '=' + this.currentRole
141
140
  }
142
- toPathObj.path = "/tab-content-iframe-index"
143
- toPathObj.tabPath = "/iframe-page/page"
141
+ toPathObj.path = "/tab-content-index"
142
+ toPathObj.tabPath = routePath
144
143
  toPathObj.query = {};
145
- toPathObj.query.src = routePath;
144
+ // toPathObj.query.src = routePath;
146
145
  toPathObj.isExternal = true;
147
146
  // 如果路径中没有拼系统编码,才需要把系统编码放到参数中
148
147
  toPathObj.query.customSystem = getSystemCode();
@@ -165,7 +164,6 @@ export default {
165
164
  return false;
166
165
  },
167
166
  clickMenu(toPathObj) {
168
- // console.log('clickMenu----toPathObj=', toPathObj)
169
167
  if (
170
168
  toPathObj.openWay &&
171
169
  toPathObj.openWay === "NEW_PAGE_OPEN" &&
@@ -105,7 +105,7 @@ export default {
105
105
  }
106
106
  },
107
107
  getFullPath(tag) {
108
- let path
108
+ let path = ''
109
109
  if (tag.routePath === '/iframe-page/page') {
110
110
  // 表示是iframe页面
111
111
  let src
@@ -127,7 +127,14 @@ export default {
127
127
  }
128
128
  } else {
129
129
  // 表示页面跳转
130
- path = '#' + tag.routePath + '?'
130
+ if(tag.routePath.indexOf('http:') < 0 && tag.routePath.indexOf('https:') < 0 ) {
131
+ path = '#'
132
+ }
133
+ if(tag.routePath.indexOf('?') >= 0) {
134
+ path = path + tag.routePath + '&'
135
+ } else {
136
+ path = path + tag.routePath + '?'
137
+ }
131
138
  if (tag.routeQuery) {
132
139
  for (const key in tag.routeQuery) {
133
140
  path += key + '=' + tag.routeQuery[key] + '&'