no message

This commit is contained in:
kuaifan 2025-05-26 20:12:51 +08:00
parent b3abe8af9c
commit 1589d4df1c
8 changed files with 39 additions and 28 deletions

View File

@ -13,8 +13,6 @@
<link rel="stylesheet" type="text/css" href="./css/iview.css">
<link rel="stylesheet" type="text/css" href="./css/loading.css">
<script src="./js/loading-theme.js"></script>
<script src="./js/jsencrypt.min.js"></script>
<script src="./js/scroll-into-view.min.js"></script>
<script src="./config.js"></script>
</head>
<body>

View File

@ -7,5 +7,9 @@ if (themeName === 'dark') {
let style = document.createElement('style');
style.rel = 'stylesheet';
style.innerHTML = '.app-view-loading{background-color:#0D0D0D}'
document.head.appendChild(style);
if (document.head) {
document.head.appendChild(style);
} else {
document.body.appendChild(style);
}
}

View File

@ -92,6 +92,13 @@ export default {
directives: {TransferDom},
components: {MicroModal, UserSelect},
props: {
windowType: {
type: String,
default: 'embed',
},
},
data() {
return {
apps: [],
@ -212,6 +219,7 @@ export default {
baseUrl: $A.mainUrl(),
systemInfo: window.systemInfo,
windowType: this.windowType,
isEEUIApp: $A.isEEUIApp,
isElectron: $A.isElectron,
@ -311,11 +319,14 @@ export default {
if (!this.apps.find(item => item.name == name)) {
return name
}
name = `${config.id}_${await $A.getSHA256Hash(config.url, 8)}`
const additional = `${config.url}`
.replace(/^https?:\/\//, '')
.replace(/[^a-zA-Z0-9]/g, '_')
name = `${config.id}_${additional.substring(0, 8)}`
if (!this.apps.find(item => item.name == name)) {
return name
}
return `${config.id}_${await $A.getSHA256Hash(config.url)}`
return `${config.id}_${additional}`
},
/**
@ -365,7 +376,7 @@ export default {
transparent: true,
keep_alive: false,
};
if (windowConfig.url) {
if (windowConfig?.url) {
appConfig.url = windowConfig.url;
delete windowConfig.url;
}

View File

@ -904,7 +904,11 @@ const timezone = require("dayjs/plugin/timezone");
} else {
script.src = url
}
document.body.appendChild(script)
if (document.head) {
document.head.appendChild(script)
} else {
document.body.appendChild(script)
}
})
},
loadScriptS(urls) {
@ -1507,22 +1511,7 @@ const timezone = require("dayjs/plugin/timezone");
};
img.src = url;
})
},
/**
* 获取SHA256哈希值
* @param str
* @param length
* @returns {Promise<string>}
*/
async getSHA256Hash(str, length = 0) {
const encoder = new TextEncoder();
const data = encoder.encode(str);
const hashBuffer = await crypto.subtle.digest('SHA-256', data);
const hashArray = Array.from(new Uint8Array(hashBuffer));
const hash = hashArray.map(b => b.toString(16).padStart(2, '0')).join('');
return length > 0 ? hash.slice(0, length) : hash;
},
}
});
/**

View File

@ -1,5 +1,5 @@
<template>
<MicroApps ref="app"/>
<MicroApps ref="app" window-type="popout"/>
</template>
<script>

View File

@ -145,12 +145,19 @@ export default {
// 获取系统设置
dispatch("systemSetting")
// 加载语言包
// 载入静态资源
await $A.loadScriptS([
// 基础包
'js/jsencrypt.min.js',
'js/scroll-into-view.min.js',
// 加载语言包
`language/web/key.js`,
`language/web/${languageName}.js`,
`language/iview/${languageName}.js`,
])
// 初始化语言
initLanguage()
resolve(action)

View File

@ -7,5 +7,9 @@ if (themeName === 'dark') {
let style = document.createElement('style');
style.rel = 'stylesheet';
style.innerHTML = '.app-view-loading{background-color:#0D0D0D}'
document.head.appendChild(style);
if (document.head) {
document.head.appendChild(style);
} else {
document.body.appendChild(style);
}
}

View File

@ -17,8 +17,6 @@
<link rel="stylesheet" type="text/css" href="{{ asset_main('css/iview.css') }}?v={{ $version }}">
<link rel="stylesheet" type="text/css" href="{{ asset_main('css/loading.css') }}?v={{ $version }}">
<script src="{{ asset_main('js/loading-theme.js') }}?v={{ $version }}"></script>
<script src="{{ asset_main('js/jsencrypt.min.js') }}?v={{ $version }}"></script>
<script src="{{ asset_main('js/scroll-into-view.min.js') }}?v={{ $version }}"></script>
<script>
window.csrfToken = {
csrfToken: "{{ csrf_token() }}"