agilebuilder-ui 1.0.71-tmp1 → 1.0.71-tmp2

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": "agilebuilder-ui",
3
- "version": "1.0.71tmp1",
3
+ "version": "1.0.71tmp2",
4
4
  "type": "module",
5
5
  "private": false,
6
6
  "main": "./lib/super-ui.js",
package/src/index.js CHANGED
@@ -34,6 +34,7 @@ import { openPage } from './utils/jump-page-utils'
34
34
  // import SecretInfo from '../packages/secret-info'
35
35
  import plugins from '../packages/plugins/index'
36
36
  import permission from './directives/permission'
37
+ import LoadScript from 'vue-plugin-load-script'
37
38
 
38
39
  // 定义 install 方法,接收 Vue 作为参数。如果使用 use 注册插件,则所有的组件都将被注册
39
40
  const install = function (Vue) {
@@ -41,6 +42,7 @@ const install = function (Vue) {
41
42
  permission.install(Vue)
42
43
  window.$vueApp.use(customPlugin)
43
44
  window.$vueApp.use(plugins)
45
+ window.$vueApp.use(LoadScript)
44
46
  if (install.installed) return
45
47
  // components.map(component => Vue.component(component.name, component))
46
48
  // components.forEach(component => {
@@ -89,5 +91,5 @@ if (typeof window !== 'undefined' && window.Vue) {
89
91
 
90
92
  export default {
91
93
  // 导出的对象必须具有 install,才能被 Vue.use() 方法安装
92
- install,
94
+ install
93
95
  }
package/src/permission.js CHANGED
@@ -77,10 +77,15 @@ router.beforeEach((to, from, next) => {
77
77
  setToken(token)
78
78
  }
79
79
  }
80
- if (to.query && to.query._systemName_) {
81
- // 表示需要设置浏览器页签名
82
- window.top.document.title = to.query._systemName_
83
- }
80
+ // if (to.query) {
81
+ // if (to.query._systemName_) {
82
+ // window.top.document.title = to.query._systemName_
83
+ // }
84
+ // if (to.query.customSystem) {
85
+ // window.$vueApp.config.globalProperties.currentSystem = to.query.customSystem
86
+ // }
87
+ // // 表示需要设置浏览器页签名
88
+ // }
84
89
  // console.log('router.beforeEach-getToken()=', token)
85
90
  // 表示需要显示菜单。为了控制是否需要走获得有权限的菜单集合的接口。单点登录跳转到表单页面时不需要请求菜单,提高页面显示速度。
86
91
  let isNeedMenu
@@ -104,6 +109,15 @@ router.beforeEach((to, from, next) => {
104
109
  } else {
105
110
  console.log('router.beforeEach-to.path!=login')
106
111
  if (store.getters.name === '') {
112
+ if (to.query) {
113
+ if (to.query._systemName_) {
114
+ window.top.document.title = to.query._systemName_
115
+ }
116
+ if (to.query.customSystem) {
117
+ window.$vueApp.config.globalProperties.currentSystem = to.query.customSystem
118
+ }
119
+ // 表示需要设置浏览器页签名
120
+ }
107
121
  // 表示刷新了页面(例如点击了一级菜单)后,会重新走该方法
108
122
  console.log('router.beforeEach-store.getters.name === ""')
109
123
  store
@@ -3,7 +3,7 @@ import authApi from './auth-api'
3
3
  import { getToken, getLanguage, getAllLanguages, setAllLanguages } from './auth'
4
4
  import { v4 as uuidv4 } from 'uuid'
5
5
  import { getCookieCache } from './auth'
6
- import LoadScript from 'vue-plugin-load-script'
6
+
7
7
  /**
8
8
  * 获得相对地址
9
9
  */
@@ -362,11 +362,8 @@ export function cacheAllLanguagesUtil(http) {
362
362
  setAllLanguages(cookieCacheLangs)
363
363
  resolve()
364
364
  } else {
365
- // http.get(window.$vueApp.config.globalProperties.baseAPI + '/component/all-languages').then((langList) => {
366
- http.get(window.$vueApp.config.globalProperties.baseAPI + '/component/i18n/languages').then((langInfo) => {
367
- debugger
365
+ http.get(window.$vueApp.config.globalProperties.baseAPI + '/component/all-languages').then((langList) => {
368
366
  const langResult = {}
369
- const langList = langInfo.languages
370
367
  if (langList) {
371
368
  langList.forEach((item) => {
372
369
  // 例如:zh_CN、en_US
@@ -385,9 +382,6 @@ export function cacheAllLanguagesUtil(http) {
385
382
  })
386
383
  }
387
384
  cacheLangs(langResult)
388
- if (langInfo.i18nFileUrls && langInfo.i18nFileUrls[window.$locale]) {
389
- LoadScript(langInfo.i18nFileUrls[window.$locale])
390
- }
391
385
  resolve()
392
386
  })
393
387
  }
@@ -441,16 +435,33 @@ export function windowOpenUrl(url, projectModel) {
441
435
 
442
436
  // 首次加载业务系统时,缓存当前用户语言
443
437
  export function cacheCurrentLanguageUtil(http) {
438
+ const that = this
444
439
  return new Promise((resolve, reject) => {
445
440
  const token = getToken()
446
441
  if (token) {
447
442
  const currentLanguage = getLanguage()
448
- if (currentLanguage && currentLanguage !== 'undefined') {
443
+ debugger
444
+ if (
445
+ currentLanguage &&
446
+ currentLanguage !== 'undefined' &&
447
+ getLangFileUrl(window.$vueApp.config.globalProperties.currentSystem, currentLanguage)
448
+ ) {
449
449
  resolve(currentLanguage)
450
450
  } else {
451
- http.get(window.$vueApp.config.globalProperties.baseAPI + '/acs/user-languages').then((currentLanguage) => {
452
- resolve(currentLanguage)
453
- })
451
+ // http.get(window.$vueApp.config.globalProperties.baseAPI + '/acs/user-languages').then((currentLanguage) => {
452
+ http
453
+ .get(
454
+ window.$vueApp.config.globalProperties.baseAPI +
455
+ '/acs/user/i18n-languages?systemCode=' +
456
+ window.$vueApp.config.globalProperties.currentSystem
457
+ )
458
+ .then((langInfo) => {
459
+ debugger
460
+ if (langInfo.i18nFileUrls && langInfo.i18nFileUrls[langInfo.language]) {
461
+ that.$loadScript(langInfo.i18nFileUrls[langInfo.language])
462
+ }
463
+ resolve(langInfo.language)
464
+ })
454
465
  }
455
466
  } else {
456
467
  // 默认是中文
@@ -573,3 +584,10 @@ export function formatFileName(fileName) {
573
584
  }
574
585
  return fileName
575
586
  }
587
+ export function setLangFileUrl(systemCode, lang, url) {
588
+ window.sessionStorage.setItem('langFileUrl_' + systemCode + '_' + lang, url)
589
+ }
590
+
591
+ export function getLangFileUrl(systemCode, lang) {
592
+ return window.sessionStorage.getItem('langFileUrl_' + systemCode + '_' + lang)
593
+ }