mirror of
https://github.com/kuaifan/dootask.git
synced 2025-12-13 20:12:48 +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) {
|
function createChildWindow(args) {
|
||||||
if (!args) {
|
if (!args) {
|
||||||
@ -378,7 +379,7 @@ function createChildWindow(args) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
browser.on('page-title-updated', (event, title) => {
|
browser.on('page-title-updated', (event, title) => {
|
||||||
if (title == "index.html" || config.titleFixed === true) {
|
if (title == "index.html" || options.titleFixed === true) {
|
||||||
event.preventDefault()
|
event.preventDefault()
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|||||||
@ -2067,3 +2067,4 @@ AI开启新会话失败
|
|||||||
按状态
|
按状态
|
||||||
|
|
||||||
应用加载失败
|
应用加载失败
|
||||||
|
应用不存在
|
||||||
|
|||||||
@ -244,6 +244,37 @@ export default {
|
|||||||
}
|
}
|
||||||
return 1000;
|
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) => {
|
openWindow: (params) => {
|
||||||
if (!$A.isJson(params)) {
|
if (!$A.isJson(params)) {
|
||||||
params = {path: params}
|
params = {path: params}
|
||||||
@ -353,7 +384,11 @@ export default {
|
|||||||
return new Promise(resolve => {
|
return new Promise(resolve => {
|
||||||
microApp.forceSetData(name, {type: 'beforeClose'}, array => {
|
microApp.forceSetData(name, {type: 'beforeClose'}, array => {
|
||||||
if (!array?.find(item => item === true)) {
|
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;
|
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>
|
<template>
|
||||||
<div class="electron-single-micro-apps">
|
<MicroApps ref="app"/>
|
||||||
<MicroApps :url="appUrl" :path="path" v-if="!loading && $route.name == 'single-apps'" />
|
|
||||||
</div>
|
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
@ -9,34 +7,21 @@ import MicroApps from "../../components/MicroApps";
|
|||||||
|
|
||||||
export default {
|
export default {
|
||||||
components: { MicroApps },
|
components: { MicroApps },
|
||||||
data() {
|
|
||||||
return {
|
|
||||||
loading: false,
|
|
||||||
appUrl: '',
|
|
||||||
path: '',
|
|
||||||
}
|
|
||||||
},
|
|
||||||
|
|
||||||
deactivated() {
|
async mounted() {
|
||||||
this.loading = true;
|
const name = this.$route.params.appName;
|
||||||
},
|
if (!name) {
|
||||||
|
$A.modalError("应用不存在");
|
||||||
watch: {
|
return
|
||||||
'$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
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const app = (await $A.IDBArray("cacheMicroApps")).reverse().find(item => item.name === name);
|
||||||
|
if (!app) {
|
||||||
|
$A.modalError("应用不存在");
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
this.$refs.app.openMicroApp(app)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
2
resources/assets/js/routes.js
vendored
2
resources/assets/js/routes.js
vendored
@ -160,7 +160,7 @@ export default [
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'single-apps',
|
name: 'single-apps',
|
||||||
path: '/single/apps/*',
|
path: '/single/apps/:appName',
|
||||||
component: () => import('./pages/single/apps.vue')
|
component: () => import('./pages/single/apps.vue')
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user