agilebuilder-ui 1.1.44 → 1.1.45

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.1.44",
3
+ "version": "1.1.45",
4
4
  "type": "module",
5
5
  "private": false,
6
6
  "main": "./lib/super-ui.js",
@@ -1,6 +1,5 @@
1
1
  import * as Vue from 'vue'
2
- import authApi from './auth-api'
3
- import { getToken, getLanguage, getAllLanguages, setAllLanguages, removeToken } from './auth'
2
+ import { getToken, getLanguage, getAllLanguages, setAllLanguages } from './auth'
4
3
  import { v4 as uuidv4 } from 'uuid'
5
4
  import { getCookieCache } from './auth'
6
5
  import i18nUtil from './i18n-util'
@@ -231,7 +230,11 @@ export function isPlateSys(systemCode) {
231
230
 
232
231
  export function getServerConfigUtil(http) {
233
232
  return new Promise((resolve, reject) => {
234
- http.get('./server-config.json').then((result) => {
233
+ let timestamp = '1'
234
+ if(__BUILD_TIME__) {
235
+ timestamp = __BUILD_TIME__
236
+ }
237
+ http.get('./server-config.json?t='+timestamp).then((result) => {
235
238
  const config = result
236
239
  for (const key in config) {
237
240
  window.$vueApp.config.globalProperties[key] = config[key]
@@ -245,10 +248,10 @@ export function getServerConfigUtil(http) {
245
248
  localStorage.setItem('_baseAPI_', window.$vueApp.config.globalProperties.baseAPI)
246
249
  localStorage.setItem('_amb_projectModel_', window.$vueApp.config.globalProperties.projectModel)
247
250
  if (config.fontIconAddress && window.insertCssFile) {
248
- window.insertCssFile(`${config.fontIconAddress}/iconfont.css`)
251
+ window.insertCssFile(`${config.fontIconAddress}/iconfont.css?t=${timestamp}`)
249
252
  }
250
253
  if (config.fontIconAddress && window.insertCssFile) {
251
- window.insertCssFile(`${config.fontIconAddress}-color/iconfont.css`)
254
+ window.insertCssFile(`${config.fontIconAddress}-color/iconfont.css?t=${timestamp}`)
252
255
  }
253
256
  resolve()
254
257
  })
@@ -557,27 +560,49 @@ async function handlePlateSysLang(currentLanguage) {
557
560
  }
558
561
  }
559
562
  }
563
+ // 缓存项目设值信息
564
+ export function cacheProjectSetting() {
565
+ return new Promise((resolve,reject)=>{
566
+ const projectSettingCache = localStorage.getItem('PROJECT_SETTINGS')
567
+ let projectSettings = null
568
+ if(projectSettingCache && projectSettingCache === '_EMPTY_VALUE') {
569
+ resolve(projectSettings)
570
+ } else if (projectSettingCache) {
571
+ projectSettings = JSON.parse(projectSettingCache)
572
+ setBrowserFavicon(projectSettings)
573
+ resolve(projectSettings)
574
+ } else {
575
+ window.$vueApp.config.globalProperties.$http.get(window.$vueApp.config.globalProperties.baseAPI + '/cfg/project-settings').then((data) => {
576
+ if(data){
577
+ localStorage.setItem('PROJECT_SETTINGS', JSON.stringify(data))
578
+ projectSettings = data
579
+ setBrowserFavicon(projectSettings)
580
+ } else {
581
+ localStorage.setItem('PROJECT_SETTINGS', '_EMPTY_VALUE')
582
+ }
583
+ resolve(projectSettings)
584
+ }).catch((error)=>{
585
+ reject(error)
586
+ })
587
+ }
588
+ })
589
+ }
560
590
 
561
- // export function setProjectSetting() {
562
- // const projectSettingCache = Cookies.get('PROJECT_SETTINGS')
563
- // let projectSettings = null
564
- // if (projectSettingCache) {
565
- // projectSettings = JSON.parse(projectSettingCache)
566
- // // TODO:工具方法中没有this,这个代码会报错,先注释该方法,没找到调用它的地方
567
- // this.setLogoUrl(projectSettings)
568
- // } else {
569
- // window.$vueApp.config.globalProperties.$http.get(window.$vueApp.config.globalProperties.baseAPI + '/cfg/project-settings').then((data) => {
570
- // Cookies.set('PROJECT_SETTINGS', JSON.stringify(data))
571
- // projectSettings = data
572
- // })
573
- // }
574
- // if (projectSettings.browserImageUuid) {
575
- // const linkElement = document.getElementById('ambBrowserIcon')
576
- // if (linkElement) {
577
- // linkElement.href = window.$vueApp.config.globalProperties.baseAPI + '/cfg/project/icon/browserIcon'
578
- // }
579
- // }
580
- // }
591
+ function setBrowserFavicon(projectSettings){
592
+ const linkElement = document.getElementById('ambBrowserIcon')
593
+ if(!linkElement){
594
+ return
595
+ }
596
+ if (projectSettings) {
597
+ const browserIconUrl = window.$vueApp.config.globalProperties.baseAPI + '/cfg/project/icon/browserIcon?t='+__BUILD_TIME__
598
+ if(projectSettings.browserImageUuid && (!linkElement.href || linkElement.href !== browserIconUrl) ){
599
+ linkElement.href = browserIconUrl
600
+ }
601
+ }
602
+ if(!linkElement.href) {
603
+ linkElement.href = 'favicon.svg?t='+__BUILD_TIME__
604
+ }
605
+ }
581
606
 
582
607
  // 动态加载css
583
608
  export function loadCSS() {