Skip to content

Commit

Permalink
feat: 去掉缓存机制和loading
Browse files Browse the repository at this point in the history
# Reviewed, transaction id: 13259
  • Loading branch information
hyunfa authored and wyyalt committed Jul 26, 2024
1 parent cb12e2f commit 107d77d
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 13 deletions.
2 changes: 1 addition & 1 deletion frontend/index-dev.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<link rel="icon" href="/static/images/favicon.png" type="image/x-icon" />
<link rel="shortcut icon" href="/static/images/favicon.png" type="image/x-icon" />
<meta charset="utf-8">
<title>loading...</title>
<title> 蓝鲸节点管理 </title>
<script>
window.PROJECT_CONFIG = (function () {
const SITE_URL = '/'
Expand Down
2 changes: 1 addition & 1 deletion frontend/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
<meta http-equiv="Pragma" content="no-cache">
<meta http-equiv="Cache-control" content="no-cache">
<meta http-equiv="Cache" content="no-cache">
<title>loading...</title>
<title> {{ WEB_TITLE }} </title>
<script>
window.PROJECT_CONFIG = (function () {
const SITE_URL = '{{ SITE_URL }}'
Expand Down
5 changes: 1 addition & 4 deletions frontend/src/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -80,10 +80,7 @@ export default class App extends Vue {
}
private async created() {
const localConfig = JSON.parse(localStorage.getItem('config') as string);
if (localConfig) {
PlatformConfigStore.updatePlatformConfig(localConfig)
}
// 先不做缓存机制,等后续定方案
// 获取平台配置信息
await PlatformConfigStore.getConfig();
// 设置网页标题
Expand Down
16 changes: 9 additions & 7 deletions frontend/src/store/modules/platform-config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,7 @@ export default class PlatformConfigStore extends VuexModule {

@Action
public async getConfig() {
const url = `${window.PROJECT_CONFIG?.BKPAAS_SHARED_RES_URL}/bk_nodeman/base.js`
const config = await getPlatformConfig(url, {
const defaults = {
name: '蓝鲸节点管理',
nameEn: 'NodeMan',
appLogo: logoSrc,
Expand All @@ -61,11 +60,14 @@ export default class PlatformConfigStore extends VuexModule {
helperLink: window.PROJECT_CONFIG.BKAPP_NAV_HELPER_URL,
helperText: window.i18n.t('联系BK助手'),
version: window.PROJECT_CONFIG.VERSION,
});
// 判断version
if (JSON.parse(localStorage.getItem('config') as string)?.version !== config.version ) {
this.context.commit('updatePlatformConfig', config);
localStorage.setItem('config',JSON.stringify(config));
};
let config;
if (window.PROJECT_CONFIG?.BKPAAS_SHARED_RES_URL) {
const url = `${window.PROJECT_CONFIG?.BKPAAS_SHARED_RES_URL}/bk_nodeman/base.js`;
config = await getPlatformConfig(url, defaults);
} else {
config = await getPlatformConfig(defaults);
}
this.context.commit('updatePlatformConfig', config);
}
}

0 comments on commit 107d77d

Please sign in to comment.