mirror of
https://github.com/kuaifan/dootask.git
synced 2025-12-11 02:12:53 +00:00
no message
This commit is contained in:
parent
aef3e869dc
commit
006bc6ceda
5
electron/electron.js
vendored
5
electron/electron.js
vendored
@ -313,7 +313,8 @@ function preCreateChildWindow() {
|
||||
|
||||
/**
|
||||
* 创建子窗口
|
||||
* @param args {path, hash, title, titleFixed, force, userAgent, config, webPreferences}
|
||||
* @param args {name, path, hash, force, userAgent, config, webPreferences}
|
||||
* - config: {title, titleFixed, ...BrowserWindowConstructorOptions}
|
||||
*/
|
||||
function createChildWindow(args) {
|
||||
if (!args) {
|
||||
@ -378,7 +379,7 @@ function createChildWindow(args) {
|
||||
}
|
||||
|
||||
browser.on('page-title-updated', (event, title) => {
|
||||
if (title == "index.html" || config.titleFixed === true) {
|
||||
if (title == "index.html" || options.titleFixed === true) {
|
||||
event.preventDefault()
|
||||
}
|
||||
})
|
||||
|
||||
@ -2067,3 +2067,4 @@ AI开启新会话失败
|
||||
按状态
|
||||
|
||||
应用加载失败
|
||||
应用不存在
|
||||
|
||||
@ -244,6 +244,37 @@ export default {
|
||||
}
|
||||
return 1000;
|
||||
},
|
||||
popoutWindow: async (config) => {
|
||||
let appConfig = {}
|
||||
if (config.url) {
|
||||
appConfig = {
|
||||
name: `url-${await $A.getSHA256Hash(config.url)}`,
|
||||
url: config.url,
|
||||
}
|
||||
delete config.url
|
||||
} else {
|
||||
const app = this.apps.find(item => item.name == name);
|
||||
if (!app) {
|
||||
$A.modalError("应用不存在");
|
||||
return
|
||||
}
|
||||
appConfig = Object.assign({}, app)
|
||||
}
|
||||
appConfig.transparent = true
|
||||
appConfig.keepAlive = false
|
||||
|
||||
const apps = (await $A.IDBArray("cacheMicroApps")).filter(item => item.name != appConfig.name);
|
||||
apps.length > 50 && apps.splice(0, 10)
|
||||
apps.push(appConfig)
|
||||
await $A.IDBSet("cacheMicroApps", apps);
|
||||
|
||||
await this.$store.dispatch('openChildWindow', {
|
||||
name: `single-apps-${$A.randomString(6)}`,
|
||||
path: `/single/apps/${appConfig.name}`,
|
||||
force: false,
|
||||
config
|
||||
});
|
||||
},
|
||||
openWindow: (params) => {
|
||||
if (!$A.isJson(params)) {
|
||||
params = {path: params}
|
||||
@ -353,7 +384,11 @@ export default {
|
||||
return new Promise(resolve => {
|
||||
microApp.forceSetData(name, {type: 'beforeClose'}, array => {
|
||||
if (!array?.find(item => item === true)) {
|
||||
resolve()
|
||||
if ($A.isSubElectron) {
|
||||
$A.Electron.sendMessage('windowDestroy');
|
||||
} else {
|
||||
resolve()
|
||||
}
|
||||
}
|
||||
})
|
||||
})
|
||||
|
||||
13
resources/assets/js/functions/common.js
vendored
13
resources/assets/js/functions/common.js
vendored
@ -1508,6 +1508,19 @@ const timezone = require("dayjs/plugin/timezone");
|
||||
img.src = url;
|
||||
})
|
||||
},
|
||||
|
||||
/**
|
||||
* 获取SHA256哈希值
|
||||
* @param str
|
||||
* @returns {Promise<string>}
|
||||
*/
|
||||
async getSHA256Hash(str) {
|
||||
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));
|
||||
return hashArray.map(b => b.toString(16).padStart(2, '0')).join('');
|
||||
},
|
||||
});
|
||||
|
||||
/**
|
||||
|
||||
@ -1,7 +1,5 @@
|
||||
<template>
|
||||
<div class="electron-single-micro-apps">
|
||||
<MicroApps :url="appUrl" :path="path" v-if="!loading && $route.name == 'single-apps'" />
|
||||
</div>
|
||||
<MicroApps ref="app"/>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
@ -9,34 +7,21 @@ import MicroApps from "../../components/MicroApps";
|
||||
|
||||
export default {
|
||||
components: { MicroApps },
|
||||
data() {
|
||||
return {
|
||||
loading: false,
|
||||
appUrl: '',
|
||||
path: '',
|
||||
}
|
||||
},
|
||||
|
||||
deactivated() {
|
||||
this.loading = true;
|
||||
},
|
||||
|
||||
watch: {
|
||||
'$route': {
|
||||
handler(to) {
|
||||
this.loading = true;
|
||||
if (to.name == 'single-apps') {
|
||||
this.$nextTick(() => {
|
||||
this.loading = false;
|
||||
this.appUrl = import.meta.env.VITE_OKR_WEB_URL || $A.mainUrl("apps/okr")
|
||||
this.path = this.$route.query.path || '';
|
||||
})
|
||||
}else{
|
||||
this.appUrl = '';
|
||||
}
|
||||
},
|
||||
immediate: true
|
||||
async mounted() {
|
||||
const name = this.$route.params.appName;
|
||||
if (!name) {
|
||||
$A.modalError("应用不存在");
|
||||
return
|
||||
}
|
||||
|
||||
const app = (await $A.IDBArray("cacheMicroApps")).reverse().find(item => item.name === name);
|
||||
if (!app) {
|
||||
$A.modalError("应用不存在");
|
||||
return
|
||||
}
|
||||
|
||||
this.$refs.app.openMicroApp(app)
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
2
resources/assets/js/routes.js
vendored
2
resources/assets/js/routes.js
vendored
@ -160,7 +160,7 @@ export default [
|
||||
},
|
||||
{
|
||||
name: 'single-apps',
|
||||
path: '/single/apps/*',
|
||||
path: '/single/apps/:appName',
|
||||
component: () => import('./pages/single/apps.vue')
|
||||
},
|
||||
{
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user