|
@ -14,9 +14,21 @@ import screenshotPlugin from "./plugins/screenshotPlugin"; |
|
|
import qtPlugin from "./plugins/qtPlugin"; |
|
|
import qtPlugin from "./plugins/qtPlugin"; |
|
|
import workerpool from "workerpool"; |
|
|
import workerpool from "workerpool"; |
|
|
import { registerApps } from "./utils/scriptsLoader/index"; |
|
|
import { registerApps } from "./utils/scriptsLoader/index"; |
|
|
import { getRecvMsg, updateRecvMsg, activeTime, getOMesplug, setManageMode } from "../api/api"; |
|
|
|
|
|
import { formatDBToMsg, formatMsgToDB, formatSysTime, currentOS } from "./utils/util"; |
|
|
|
|
|
|
|
|
import { |
|
|
|
|
|
getRecvMsg, |
|
|
|
|
|
updateRecvMsg, |
|
|
|
|
|
activeTime, |
|
|
|
|
|
getOMesplug, |
|
|
|
|
|
setManageMode |
|
|
|
|
|
} from "../api/api"; |
|
|
|
|
|
import { |
|
|
|
|
|
formatDBToMsg, |
|
|
|
|
|
formatMsgToDB, |
|
|
|
|
|
formatSysTime, |
|
|
|
|
|
currentOS |
|
|
|
|
|
} from "./utils/util"; |
|
|
import router from "./router/index"; |
|
|
import router from "./router/index"; |
|
|
|
|
|
import { createBus } from "./utils/bus"; |
|
|
|
|
|
|
|
|
const devLib = process.env.VUE_APP_DEVLIB === "dev"; |
|
|
const devLib = process.env.VUE_APP_DEVLIB === "dev"; |
|
|
const devMode = process.env.NODE_ENV === "development" || devLib; |
|
|
const devMode = process.env.NODE_ENV === "development" || devLib; |
|
@ -29,57 +41,56 @@ const APPS_SLEEPING_LEN = 5; |
|
|
// Vue.use(ElementUI);
|
|
|
// Vue.use(ElementUI);
|
|
|
Vue.config.productionTip = false; |
|
|
Vue.config.productionTip = false; |
|
|
Vue.prototype.$Notifition = Notifition; //可以在任意地方调用,
|
|
|
Vue.prototype.$Notifition = Notifition; //可以在任意地方调用,
|
|
|
Vue.prototype.$EsDataMsg = function() { |
|
|
|
|
|
}; |
|
|
|
|
|
|
|
|
Vue.prototype.$EsDataMsg = function() {}; |
|
|
const bus = new Vue({ |
|
|
const bus = new Vue({ |
|
|
data: { |
|
|
data: { |
|
|
devMode: devMode, //当前运行环境是什么
|
|
|
devMode: devMode, //当前运行环境是什么
|
|
|
schema: "", //当前运行项目是什么项目
|
|
|
schema: "", //当前运行项目是什么项目
|
|
|
alias: {},//避免硬编码id,可配置
|
|
|
|
|
|
userInfo: {},//用户信息
|
|
|
|
|
|
openByKt: false,//是否从kt打开
|
|
|
|
|
|
resource: {},//组件静态资源
|
|
|
|
|
|
allComponents: [],//所有的组件
|
|
|
|
|
|
|
|
|
alias: {}, //避免硬编码id,可配置
|
|
|
|
|
|
userInfo: {}, //用户信息
|
|
|
|
|
|
openByKt: false, //是否从kt打开
|
|
|
|
|
|
resource: {}, //组件静态资源
|
|
|
|
|
|
allComponents: [], //所有的组件
|
|
|
whitelist: [], // 白名单应用id
|
|
|
whitelist: [], // 白名单应用id
|
|
|
globalState: {}, // 全局变量
|
|
|
globalState: {}, // 全局变量
|
|
|
appsSleeping: [], // 休眠应用队列 最长暂时为5
|
|
|
appsSleeping: [], // 休眠应用队列 最长暂时为5
|
|
|
apps: [], // 界面显示的所有应用
|
|
|
apps: [], // 界面显示的所有应用
|
|
|
widgets: [], // 界面显示的所有浮窗
|
|
|
widgets: [], // 界面显示的所有浮窗
|
|
|
allApps: [],//所有应用
|
|
|
|
|
|
allWidgets: [],//所有浮窗
|
|
|
|
|
|
location: {},//设置经纬度
|
|
|
|
|
|
|
|
|
allApps: [], //所有应用
|
|
|
|
|
|
allWidgets: [], //所有浮窗
|
|
|
|
|
|
location: {}, //设置经纬度
|
|
|
deviceType: currentOS() || "pc", |
|
|
deviceType: currentOS() || "pc", |
|
|
visibleWidgetPanel: false, // 选择浮窗的视图
|
|
|
visibleWidgetPanel: false, // 选择浮窗的视图
|
|
|
visibleAppsPanel: false, // 选择浮窗的视图
|
|
|
visibleAppsPanel: false, // 选择浮窗的视图
|
|
|
widgetListViewVisible: false, // 展示所有浮窗的列表视图
|
|
|
widgetListViewVisible: false, // 展示所有浮窗的列表视图
|
|
|
visibleWidgetSysSetting: false,// 展示设置浮窗
|
|
|
|
|
|
|
|
|
visibleWidgetSysSetting: false, // 展示设置浮窗
|
|
|
controlPanelPadVisible: false, |
|
|
controlPanelPadVisible: false, |
|
|
visibleWidgetLogin: false,//登录窗口
|
|
|
|
|
|
|
|
|
visibleWidgetLogin: false, //登录窗口
|
|
|
visibleHistoricalNews: false, //是否显示历史消息
|
|
|
visibleHistoricalNews: false, //是否显示历史消息
|
|
|
visibleNotificationWhole: false, //是否显示右侧全部消息
|
|
|
visibleNotificationWhole: false, //是否显示右侧全部消息
|
|
|
visibleSearchBox: false, // 搜索框
|
|
|
visibleSearchBox: false, // 搜索框
|
|
|
visibleDialogBox: false, |
|
|
visibleDialogBox: false, |
|
|
visibleLookAtMsgBox: false, |
|
|
visibleLookAtMsgBox: false, |
|
|
visibleVoiceBox: false, |
|
|
visibleVoiceBox: false, |
|
|
msgBoxText: "",//查看窗口的文本内容
|
|
|
|
|
|
|
|
|
msgBoxText: "", //查看窗口的文本内容
|
|
|
isFullScreen: false, |
|
|
isFullScreen: false, |
|
|
messageItem: {}, // 消息面板的信息逻辑
|
|
|
messageItem: {}, // 消息面板的信息逻辑
|
|
|
messageBoxList: [], // 收件箱数据面板数据存储,初始化时请求接口,
|
|
|
messageBoxList: [], // 收件箱数据面板数据存储,初始化时请求接口,
|
|
|
warAndAstrTime: { |
|
|
warAndAstrTime: { |
|
|
astrTime: "----/--/-- --:--:--",//天文时间
|
|
|
|
|
|
warTime: "----/--/-- --:--:--"//作战时间
|
|
|
|
|
|
|
|
|
astrTime: "----/--/-- --:--:--", //天文时间
|
|
|
|
|
|
warTime: "----/--/-- --:--:--" //作战时间
|
|
|
}, |
|
|
}, |
|
|
footerTimer: null, |
|
|
footerTimer: null, |
|
|
showFooter: true, |
|
|
showFooter: true, |
|
|
alertSettingPageVisible: false, |
|
|
alertSettingPageVisible: false, |
|
|
locationArtificial: false,// 人工定位弹框
|
|
|
|
|
|
visibleMessageBox: false,//消息
|
|
|
|
|
|
visibleToListMail: false,//通知校时
|
|
|
|
|
|
visiblediwd: false,//事件通知
|
|
|
|
|
|
|
|
|
locationArtificial: false, // 人工定位弹框
|
|
|
|
|
|
visibleMessageBox: false, //消息
|
|
|
|
|
|
visibleToListMail: false, //通知校时
|
|
|
|
|
|
visiblediwd: false, //事件通知
|
|
|
headerVisible: true, |
|
|
headerVisible: true, |
|
|
theme: document.documentElement.getAttribute("data-theme") || "default", |
|
|
theme: document.documentElement.getAttribute("data-theme") || "default", |
|
|
showMoreContent: false, //底部点击展示更多
|
|
|
|
|
|
menuVisible: false, // 菜单编辑弹框
|
|
|
|
|
|
|
|
|
showMoreContent: false, //底部点击展示更多
|
|
|
|
|
|
menuVisible: false, // 菜单编辑弹框
|
|
|
// pad 应用界面
|
|
|
// pad 应用界面
|
|
|
applicationInterface: { |
|
|
applicationInterface: { |
|
|
visible: false, |
|
|
visible: false, |
|
@ -90,16 +101,17 @@ const bus = new Vue({ |
|
|
searchBoxPadVisible: false, // pad搜索组件
|
|
|
searchBoxPadVisible: false, // pad搜索组件
|
|
|
SettingSysPadVisible: false, // pad消息设置
|
|
|
SettingSysPadVisible: false, // pad消息设置
|
|
|
messageCenterVisible: false, // pad消息中心
|
|
|
messageCenterVisible: false, // pad消息中心
|
|
|
txlVisiable: false,//pad通讯录
|
|
|
|
|
|
|
|
|
txlVisiable: false, //pad通讯录
|
|
|
registerVisible: {}, |
|
|
registerVisible: {}, |
|
|
notificationConfig: { //消息设置
|
|
|
|
|
|
|
|
|
notificationConfig: { |
|
|
|
|
|
//消息设置
|
|
|
voiceHint: "无", |
|
|
voiceHint: "无", |
|
|
precise: "模糊", |
|
|
precise: "模糊", |
|
|
rightHint: true, |
|
|
rightHint: true, |
|
|
disturb: false, |
|
|
disturb: false, |
|
|
startTime: "", |
|
|
startTime: "", |
|
|
endTime: "" |
|
|
endTime: "" |
|
|
},//消息通知的设置
|
|
|
|
|
|
|
|
|
}, //消息通知的设置
|
|
|
// 消息中心数据
|
|
|
// 消息中心数据
|
|
|
unReadMessageList: [ |
|
|
unReadMessageList: [ |
|
|
{ |
|
|
{ |
|
@ -112,7 +124,7 @@ const bus = new Vue({ |
|
|
time: 1619827200, |
|
|
time: 1619827200, |
|
|
title: "态势感知", |
|
|
title: "态势感知", |
|
|
|
|
|
|
|
|
reply: 0 // 是否有回复按钮
|
|
|
|
|
|
|
|
|
reply: 0 // 是否有回复按钮
|
|
|
}, |
|
|
}, |
|
|
{ |
|
|
{ |
|
|
id: 1, |
|
|
id: 1, |
|
@ -123,7 +135,7 @@ const bus = new Vue({ |
|
|
compnent: 1, |
|
|
compnent: 1, |
|
|
time: 1622505600000, |
|
|
time: 1622505600000, |
|
|
title: "态势感知", |
|
|
title: "态势感知", |
|
|
reply: 1 // 是否有回复按钮
|
|
|
|
|
|
|
|
|
reply: 1 // 是否有回复按钮
|
|
|
}, |
|
|
}, |
|
|
{ |
|
|
{ |
|
|
id: 11, |
|
|
id: 11, |
|
@ -134,7 +146,7 @@ const bus = new Vue({ |
|
|
compnent: 1, |
|
|
compnent: 1, |
|
|
time: 1622505600000, |
|
|
time: 1622505600000, |
|
|
title: "态势感知", |
|
|
title: "态势感知", |
|
|
reply: 1 // 是否有回复按钮
|
|
|
|
|
|
|
|
|
reply: 1 // 是否有回复按钮
|
|
|
}, |
|
|
}, |
|
|
{ |
|
|
{ |
|
|
id: 12, |
|
|
id: 12, |
|
@ -145,7 +157,7 @@ const bus = new Vue({ |
|
|
compnent: 1, |
|
|
compnent: 1, |
|
|
time: 1622505600000, |
|
|
time: 1622505600000, |
|
|
title: "态势感知", |
|
|
title: "态势感知", |
|
|
reply: 1 // 是否有回复按钮
|
|
|
|
|
|
|
|
|
reply: 1 // 是否有回复按钮
|
|
|
}, |
|
|
}, |
|
|
{ |
|
|
{ |
|
|
id: 13, |
|
|
id: 13, |
|
@ -156,7 +168,7 @@ const bus = new Vue({ |
|
|
compnent: 1, |
|
|
compnent: 1, |
|
|
time: 1622505600000, |
|
|
time: 1622505600000, |
|
|
title: "态势感知", |
|
|
title: "态势感知", |
|
|
reply: 1 // 是否有回复按钮
|
|
|
|
|
|
|
|
|
reply: 1 // 是否有回复按钮
|
|
|
}, |
|
|
}, |
|
|
{ |
|
|
{ |
|
|
id: 14, |
|
|
id: 14, |
|
@ -167,7 +179,7 @@ const bus = new Vue({ |
|
|
compnent: 1, |
|
|
compnent: 1, |
|
|
time: 1622505600000, |
|
|
time: 1622505600000, |
|
|
title: "态势感知", |
|
|
title: "态势感知", |
|
|
reply: 1 // 是否有回复按钮
|
|
|
|
|
|
|
|
|
reply: 1 // 是否有回复按钮
|
|
|
}, |
|
|
}, |
|
|
{ |
|
|
{ |
|
|
id: 2, |
|
|
id: 2, |
|
@ -213,7 +225,7 @@ const bus = new Vue({ |
|
|
appName: "taishiganzhi", |
|
|
appName: "taishiganzhi", |
|
|
text: "态势感知态势感知态势感知态势感知态势感感", |
|
|
text: "态势感知态势感知态势感知态势感知态势感感", |
|
|
type: "态势感知", |
|
|
type: "态势感知", |
|
|
level: 3,// 3警报,2告警 1生化
|
|
|
|
|
|
|
|
|
level: 3, // 3警报,2告警 1生化
|
|
|
compnent: 1, |
|
|
compnent: 1, |
|
|
time: "10分钟", |
|
|
time: "10分钟", |
|
|
title: "态势感知", |
|
|
title: "态势感知", |
|
@ -224,7 +236,7 @@ const bus = new Vue({ |
|
|
appName: "taishiganzhi", |
|
|
appName: "taishiganzhi", |
|
|
text: "态势感知态势感知态势感知态势感知态势感感", |
|
|
text: "态势感知态势感知态势感知态势感知态势感感", |
|
|
type: "态势感知", |
|
|
type: "态势感知", |
|
|
level: 3,// 3警报,2告警 1生化
|
|
|
|
|
|
|
|
|
level: 3, // 3警报,2告警 1生化
|
|
|
compnent: 1, |
|
|
compnent: 1, |
|
|
time: "10分钟", |
|
|
time: "10分钟", |
|
|
title: "态势感知", |
|
|
title: "态势感知", |
|
@ -235,7 +247,7 @@ const bus = new Vue({ |
|
|
appName: "taishiganzhi", |
|
|
appName: "taishiganzhi", |
|
|
text: "态势感知态势感知态势感知态势感知态势感感", |
|
|
text: "态势感知态势感知态势感知态势感知态势感感", |
|
|
type: "态势感知", |
|
|
type: "态势感知", |
|
|
level: 3,// 3警报,2告警 1生化
|
|
|
|
|
|
|
|
|
level: 3, // 3警报,2告警 1生化
|
|
|
compnent: 1, |
|
|
compnent: 1, |
|
|
time: "10分钟", |
|
|
time: "10分钟", |
|
|
title: "态势感知", |
|
|
title: "态势感知", |
|
@ -318,30 +330,36 @@ async function getApp(appId) { |
|
|
async function loadApp(app) { |
|
|
async function loadApp(app) { |
|
|
const onMessage = { ref: null }; |
|
|
const onMessage = { ref: null }; |
|
|
const onMenu = { ref: null }; |
|
|
const onMenu = { ref: null }; |
|
|
const instance = loadMicroApp({ |
|
|
|
|
|
name: app.id, |
|
|
|
|
|
container: "#" + app.containerId, |
|
|
|
|
|
entry: app.entry, |
|
|
|
|
|
// activeRule:"/app_demo",
|
|
|
|
|
|
props: { |
|
|
|
|
|
tis: { |
|
|
|
|
|
...tis, |
|
|
|
|
|
...createEventBus(app.id), |
|
|
|
|
|
appId: app.id, |
|
|
|
|
|
entry: app.entry, |
|
|
|
|
|
components: app.components, |
|
|
|
|
|
asserts: app.asserts, |
|
|
|
|
|
}, |
|
|
|
|
|
onMessage, |
|
|
|
|
|
onMenu |
|
|
|
|
|
} |
|
|
|
|
|
}, { |
|
|
|
|
|
sandbox: { |
|
|
|
|
|
strictStyleIsolation: false, |
|
|
|
|
|
experimentalStyleIsolation: true |
|
|
|
|
|
|
|
|
const bus = createBus(app.id); |
|
|
|
|
|
|
|
|
|
|
|
const instance = loadMicroApp( |
|
|
|
|
|
{ |
|
|
|
|
|
name: app.id, |
|
|
|
|
|
container: "#" + app.containerId, |
|
|
|
|
|
entry: app.entry, |
|
|
|
|
|
// activeRule:"/app_demo",
|
|
|
|
|
|
props: { |
|
|
|
|
|
tis: { |
|
|
|
|
|
...tis, |
|
|
|
|
|
...createEventBus(app.id), |
|
|
|
|
|
appId: app.id, |
|
|
|
|
|
entry: app.entry, |
|
|
|
|
|
components: app.components, |
|
|
|
|
|
asserts: app.asserts |
|
|
|
|
|
}, |
|
|
|
|
|
bus, |
|
|
|
|
|
onMessage, |
|
|
|
|
|
onMenu |
|
|
|
|
|
} |
|
|
|
|
|
}, |
|
|
|
|
|
{ |
|
|
|
|
|
sandbox: { |
|
|
|
|
|
strictStyleIsolation: false, |
|
|
|
|
|
experimentalStyleIsolation: true |
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
}); |
|
|
|
|
|
await instance.bootstrapPromise.catch((err) => { |
|
|
|
|
|
|
|
|
); |
|
|
|
|
|
await instance.bootstrapPromise.catch(err => { |
|
|
console.error(`boostrap: [${app.name} ${app.id}] 出错`, err); |
|
|
console.error(`boostrap: [${app.name} ${app.id}] 出错`, err); |
|
|
throw err; |
|
|
throw err; |
|
|
}); |
|
|
}); |
|
@ -419,7 +437,10 @@ const tis = { |
|
|
return new Promise((resolve, reject) => { |
|
|
return new Promise((resolve, reject) => { |
|
|
el.onload = el.onreadystatechange = function() { |
|
|
el.onload = el.onreadystatechange = function() { |
|
|
let readyState = el.readyState; |
|
|
let readyState = el.readyState; |
|
|
if (typeof readyState === "undefined" || /^(loaded|complete)$/.test(readyState)) { |
|
|
|
|
|
|
|
|
if ( |
|
|
|
|
|
typeof readyState === "undefined" || |
|
|
|
|
|
/^(loaded|complete)$/.test(readyState) |
|
|
|
|
|
) { |
|
|
resolve(); |
|
|
resolve(); |
|
|
// 卸载事件和断开dom引用,避免内存泄漏
|
|
|
// 卸载事件和断开dom引用,避免内存泄漏
|
|
|
el.onload = el.onerror = el.onreadystatechange = null; |
|
|
el.onload = el.onerror = el.onreadystatechange = null; |
|
@ -427,7 +448,10 @@ const tis = { |
|
|
}; |
|
|
}; |
|
|
el.onerror = function() { |
|
|
el.onerror = function() { |
|
|
let readyState = el.readyState; |
|
|
let readyState = el.readyState; |
|
|
if (typeof readyState === "undefined" || /^(loaded|complete)$/.test(readyState)) { |
|
|
|
|
|
|
|
|
if ( |
|
|
|
|
|
typeof readyState === "undefined" || |
|
|
|
|
|
/^(loaded|complete)$/.test(readyState) |
|
|
|
|
|
) { |
|
|
console.log("load js resources failed"); |
|
|
console.log("load js resources failed"); |
|
|
reject({ error: "load js resources failed" }); |
|
|
reject({ error: "load js resources failed" }); |
|
|
// 卸载事件和断开dom引用,避免内存泄漏
|
|
|
// 卸载事件和断开dom引用,避免内存泄漏
|
|
@ -439,23 +463,28 @@ const tis = { |
|
|
// 加载第三方耗时js eg:地图
|
|
|
// 加载第三方耗时js eg:地图
|
|
|
loadTimeConsumingResources() { |
|
|
loadTimeConsumingResources() { |
|
|
this.onLoaded(document).then(() => { |
|
|
this.onLoaded(document).then(() => { |
|
|
console.log("<<<<=========基础资源加载完毕,第三方资源加载ing===========>>>>>"); |
|
|
|
|
|
|
|
|
console.log( |
|
|
|
|
|
"<<<<=========基础资源加载完毕,第三方资源加载ing===========>>>>>" |
|
|
|
|
|
); |
|
|
// 白名单列表中的launcher不加载地图等耗时资源
|
|
|
// 白名单列表中的launcher不加载地图等耗时资源
|
|
|
const whiteList = ["manager", "appStore", "monitor"]; |
|
|
const whiteList = ["manager", "appStore", "monitor"]; |
|
|
axios.get(`${baseURL}manifest/library.json`) |
|
|
|
|
|
.then(async res => { |
|
|
|
|
|
//是否需要再度延迟,防止用户操作登录下拉框时发生卡顿?可以先观察,未来再处理
|
|
|
|
|
|
const data = res.data; |
|
|
|
|
|
const resources = Object.keys(data).filter(d => new RegExp(bus.deviceType, "gi") |
|
|
|
|
|
.test(data[d].target) && !whiteList.includes(window.currentLauncher)); |
|
|
|
|
|
//按照顺序加载
|
|
|
|
|
|
for (let i = 0; i < resources.length; i++) { |
|
|
|
|
|
let rs = resources[i]; |
|
|
|
|
|
await registerApps(data[rs], baseURL) |
|
|
|
|
|
.then(() => console.log(`<<<<=========${rs}资源加载完毕===========>>>>>`)); |
|
|
|
|
|
} |
|
|
|
|
|
console.log("<<<<=========第三方资源加载完毕===========>>>>>"); |
|
|
|
|
|
}); |
|
|
|
|
|
|
|
|
axios.get(`${baseURL}manifest/library.json`).then(async res => { |
|
|
|
|
|
//是否需要再度延迟,防止用户操作登录下拉框时发生卡顿?可以先观察,未来再处理
|
|
|
|
|
|
const data = res.data; |
|
|
|
|
|
const resources = Object.keys(data).filter( |
|
|
|
|
|
d => |
|
|
|
|
|
new RegExp(bus.deviceType, "gi").test(data[d].target) && |
|
|
|
|
|
!whiteList.includes(window.currentLauncher) |
|
|
|
|
|
); |
|
|
|
|
|
//按照顺序加载
|
|
|
|
|
|
for (let i = 0; i < resources.length; i++) { |
|
|
|
|
|
let rs = resources[i]; |
|
|
|
|
|
await registerApps(data[rs], baseURL).then(() => |
|
|
|
|
|
console.log(`<<<<=========${rs}资源加载完毕===========>>>>>`) |
|
|
|
|
|
); |
|
|
|
|
|
} |
|
|
|
|
|
console.log("<<<<=========第三方资源加载完毕===========>>>>>"); |
|
|
|
|
|
}); |
|
|
}); |
|
|
}); |
|
|
}, |
|
|
}, |
|
|
//获取天文、作战时间
|
|
|
//获取天文、作战时间
|
|
@ -475,21 +504,21 @@ const tis = { |
|
|
}, |
|
|
}, |
|
|
//登出框架,清空用户信息, 清空界面信息
|
|
|
//登出框架,清空用户信息, 清空界面信息
|
|
|
loginOut() { |
|
|
loginOut() { |
|
|
bus.userInfo = {};//用户信息
|
|
|
|
|
|
bus.openByKt = false;//是否从kt打开
|
|
|
|
|
|
|
|
|
bus.userInfo = {}; //用户信息
|
|
|
|
|
|
bus.openByKt = false; //是否从kt打开
|
|
|
bus.whitelist = []; // 白名单应用id
|
|
|
bus.whitelist = []; // 白名单应用id
|
|
|
bus.globalState = {}; // 全局变量
|
|
|
bus.globalState = {}; // 全局变量
|
|
|
bus.appsSleeping = []; // 休眠应用队列 最长暂时为5
|
|
|
bus.appsSleeping = []; // 休眠应用队列 最长暂时为5
|
|
|
bus.apps = [];// 界面显示的所有应用
|
|
|
|
|
|
|
|
|
bus.apps = []; // 界面显示的所有应用
|
|
|
bus.widgets = []; // 界面显示的所有浮窗
|
|
|
bus.widgets = []; // 界面显示的所有浮窗
|
|
|
bus.visibleWidgetPanel = false;// 选择浮窗的视图
|
|
|
|
|
|
|
|
|
bus.visibleWidgetPanel = false; // 选择浮窗的视图
|
|
|
bus.visibleAppsPanel = false; // 选择浮窗的视图
|
|
|
bus.visibleAppsPanel = false; // 选择浮窗的视图
|
|
|
bus.widgetListViewVisible = false; // 展示所有浮窗的列表视图
|
|
|
bus.widgetListViewVisible = false; // 展示所有浮窗的列表视图
|
|
|
bus.visibleWidgetSysSetting = false;// 展示设置浮窗
|
|
|
|
|
|
bus.visibleWidgetLogin = false;//登录窗口
|
|
|
|
|
|
|
|
|
bus.visibleWidgetSysSetting = false; // 展示设置浮窗
|
|
|
|
|
|
bus.visibleWidgetLogin = false; //登录窗口
|
|
|
bus.visibleHistoricalNews = false; //是否显示历史消息
|
|
|
bus.visibleHistoricalNews = false; //是否显示历史消息
|
|
|
bus.visibleNotificationWhole = false; //是否显示右侧全部消息
|
|
|
bus.visibleNotificationWhole = false; //是否显示右侧全部消息
|
|
|
bus.visibleSearchBox = false;// 搜索框
|
|
|
|
|
|
|
|
|
bus.visibleSearchBox = false; // 搜索框
|
|
|
bus.visibleDialogBox = false; |
|
|
bus.visibleDialogBox = false; |
|
|
bus.visibleLookAtMsgBox = false; |
|
|
bus.visibleLookAtMsgBox = false; |
|
|
bus.messageItem = {}; // 消息面板的信息逻辑
|
|
|
bus.messageItem = {}; // 消息面板的信息逻辑
|
|
@ -500,8 +529,7 @@ const tis = { |
|
|
localStorage.removeItem("USER_INFO"); |
|
|
localStorage.removeItem("USER_INFO"); |
|
|
localStorage.removeItem("SYS_MODE"); |
|
|
localStorage.removeItem("SYS_MODE"); |
|
|
this.openWidgetLoginPanel(); |
|
|
this.openWidgetLoginPanel(); |
|
|
setManageMode({ mode: "0" }).then(res => { |
|
|
|
|
|
}); |
|
|
|
|
|
|
|
|
setManageMode({ mode: "0" }).then(() => {}); |
|
|
}, |
|
|
}, |
|
|
// 底部栏显示隐藏
|
|
|
// 底部栏显示隐藏
|
|
|
setFooterShow() { |
|
|
setFooterShow() { |
|
@ -514,7 +542,10 @@ const tis = { |
|
|
setNotificationConfig(config) { |
|
|
setNotificationConfig(config) { |
|
|
bus.notificationConfig = config; |
|
|
bus.notificationConfig = config; |
|
|
//存入localStorage
|
|
|
//存入localStorage
|
|
|
window.localStorage.setItem("MESSAGE_CONFIG", JSON.stringify(bus.notificationConfig)); |
|
|
|
|
|
|
|
|
window.localStorage.setItem( |
|
|
|
|
|
"MESSAGE_CONFIG", |
|
|
|
|
|
JSON.stringify(bus.notificationConfig) |
|
|
|
|
|
); |
|
|
}, |
|
|
}, |
|
|
// 获取消息通知配置
|
|
|
// 获取消息通知配置
|
|
|
getNotificationConfig() { |
|
|
getNotificationConfig() { |
|
@ -546,9 +577,9 @@ const tis = { |
|
|
// return {};
|
|
|
// return {};
|
|
|
// }
|
|
|
// }
|
|
|
return bus.userInfo; |
|
|
return bus.userInfo; |
|
|
|
|
|
|
|
|
}, |
|
|
}, |
|
|
//控制平板菜单开关
|
|
|
//控制平板菜单开关
|
|
|
|
|
|
// eslint-disable-next-line no-unused-vars
|
|
|
showControlPanel(name) { |
|
|
showControlPanel(name) { |
|
|
bus.registerVisible.alarmMainWineowVisible = false; |
|
|
bus.registerVisible.alarmMainWineowVisible = false; |
|
|
bus.alarmMainWineowVisible = false; |
|
|
bus.alarmMainWineowVisible = false; |
|
@ -557,17 +588,13 @@ const tis = { |
|
|
// name: name
|
|
|
// name: name
|
|
|
// };
|
|
|
// };
|
|
|
|
|
|
|
|
|
bus.controlPanelPadVisible = !bus |
|
|
|
|
|
.controlPanelPadVisible; |
|
|
|
|
|
bus.registerVisible.controlPanelPadVisible = !bus |
|
|
|
|
|
.controlPanelPadVisible; |
|
|
|
|
|
|
|
|
bus.controlPanelPadVisible = !bus.controlPanelPadVisible; |
|
|
|
|
|
bus.registerVisible.controlPanelPadVisible = !bus.controlPanelPadVisible; |
|
|
}, |
|
|
}, |
|
|
switchControlPadVisible() { |
|
|
switchControlPadVisible() { |
|
|
//关闭菜单
|
|
|
//关闭菜单
|
|
|
bus.controlPanelPadVisible = !bus |
|
|
|
|
|
.controlPanelPadVisible; |
|
|
|
|
|
bus.registerVisible.controlPanelPadVisible = !bus |
|
|
|
|
|
.controlPanelPadVisible; |
|
|
|
|
|
|
|
|
bus.controlPanelPadVisible = !bus.controlPanelPadVisible; |
|
|
|
|
|
bus.registerVisible.controlPanelPadVisible = !bus.controlPanelPadVisible; |
|
|
}, |
|
|
}, |
|
|
//获取是否需要登录的标识
|
|
|
//获取是否需要登录的标识
|
|
|
openFullScreenAppId() { |
|
|
openFullScreenAppId() { |
|
@ -598,7 +625,7 @@ const tis = { |
|
|
containerId: "app_" + app.id, |
|
|
containerId: "app_" + app.id, |
|
|
opened: false, |
|
|
opened: false, |
|
|
asserts: bus.resource, |
|
|
asserts: bus.resource, |
|
|
privateBus: {}//私有bus
|
|
|
|
|
|
|
|
|
privateBus: {} //私有bus
|
|
|
}; |
|
|
}; |
|
|
}); |
|
|
}); |
|
|
bus.apps = [...bus.apps, ...newApss]; |
|
|
bus.apps = [...bus.apps, ...newApss]; |
|
@ -620,7 +647,7 @@ const tis = { |
|
|
// return found || defaultApp || apps[0]
|
|
|
// return found || defaultApp || apps[0]
|
|
|
}, |
|
|
}, |
|
|
getRunningApps() { |
|
|
getRunningApps() { |
|
|
return bus.apps.filter((a) => { |
|
|
|
|
|
|
|
|
return bus.apps.filter(a => { |
|
|
return a.instance && a.instance.getStatus() === "MOUNTED"; |
|
|
return a.instance && a.instance.getStatus() === "MOUNTED"; |
|
|
}); |
|
|
}); |
|
|
}, |
|
|
}, |
|
@ -674,9 +701,13 @@ const tis = { |
|
|
if (a !== app && a.opened && a.instance) { |
|
|
if (a !== app && a.opened && a.instance) { |
|
|
a.opened = false; |
|
|
a.opened = false; |
|
|
// 休眠队列和白名单里的进行隐藏不卸载
|
|
|
// 休眠队列和白名单里的进行隐藏不卸载
|
|
|
if (bus.whitelist.includes(a.id) || bus.appsSleeping.indexOf(a.id) !== -1) { |
|
|
|
|
|
|
|
|
if ( |
|
|
|
|
|
bus.whitelist.includes(a.id) || |
|
|
|
|
|
bus.appsSleeping.indexOf(a.id) !== -1 |
|
|
|
|
|
) { |
|
|
a.instance.hide(); |
|
|
a.instance.hide(); |
|
|
} else { // 非白名单的进行卸载
|
|
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
// 非白名单的进行卸载
|
|
|
a.instance.unmount(); |
|
|
a.instance.unmount(); |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
@ -708,7 +739,10 @@ const tis = { |
|
|
console.log("process.env.VUE_APP_DEVLIB", process.env.VUE_APP_DEVLIB); |
|
|
console.log("process.env.VUE_APP_DEVLIB", process.env.VUE_APP_DEVLIB); |
|
|
const domain = devLib ? "http://localhost:9902/" : ""; |
|
|
const domain = devLib ? "http://localhost:9902/" : ""; |
|
|
const base = devMode ? "/" : "/TIS_LIB/"; |
|
|
const base = devMode ? "/" : "/TIS_LIB/"; |
|
|
styleLink.setAttribute("href", `${domain}${base}tis-ui/theme-chalk/index${dir}.css`); |
|
|
|
|
|
|
|
|
styleLink.setAttribute( |
|
|
|
|
|
"href", |
|
|
|
|
|
`${domain}${base}tis-ui/theme-chalk/index${dir}.css` |
|
|
|
|
|
); |
|
|
// 设置localstorage
|
|
|
// 设置localstorage
|
|
|
localStorage.setItem("TIS_DESIGN_THEME", theme); |
|
|
localStorage.setItem("TIS_DESIGN_THEME", theme); |
|
|
}, |
|
|
}, |
|
@ -731,7 +765,8 @@ const tis = { |
|
|
// 休眠队列和白名单里的进行隐藏不卸载
|
|
|
// 休眠队列和白名单里的进行隐藏不卸载
|
|
|
if (bus.whitelist.includes(a.id) || bus.appsSleeping.indexOf(a.id) !== -1) { |
|
|
if (bus.whitelist.includes(a.id) || bus.appsSleeping.indexOf(a.id) !== -1) { |
|
|
a.instance.hide(); |
|
|
a.instance.hide(); |
|
|
} else { // 非白名单的进行卸载
|
|
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
// 非白名单的进行卸载
|
|
|
a.instance.unmount(); |
|
|
a.instance.unmount(); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
@ -844,7 +879,6 @@ const tis = { |
|
|
bus.visiblediwd = false; |
|
|
bus.visiblediwd = false; |
|
|
}, |
|
|
}, |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//人工定位弹框
|
|
|
//人工定位弹框
|
|
|
isVisiblelocationArtificial() { |
|
|
isVisiblelocationArtificial() { |
|
|
return bus.locationArtificial; |
|
|
return bus.locationArtificial; |
|
@ -938,11 +972,14 @@ const tis = { |
|
|
}, |
|
|
}, |
|
|
delMessage(id) { |
|
|
delMessage(id) { |
|
|
//将此消息状态更新为已读,只有存在15位uuid的才执行数据库的更新
|
|
|
//将此消息状态更新为已读,只有存在15位uuid的才执行数据库的更新
|
|
|
const readedMsg = bus.unReadMessageList.filter(v => v.id == id && id.length > 15).map(m => { |
|
|
|
|
|
m.isRead = "1"; |
|
|
|
|
|
return formatMsgToDB(m); |
|
|
|
|
|
}); |
|
|
|
|
|
if (readedMsg.length > 0) updateRecvMsg({ Content: readedMsg }).catch(err => console.error(err)); |
|
|
|
|
|
|
|
|
const readedMsg = bus.unReadMessageList |
|
|
|
|
|
.filter(v => v.id == id && id.length > 15) |
|
|
|
|
|
.map(m => { |
|
|
|
|
|
m.isRead = "1"; |
|
|
|
|
|
return formatMsgToDB(m); |
|
|
|
|
|
}); |
|
|
|
|
|
if (readedMsg.length > 0) |
|
|
|
|
|
updateRecvMsg({ Content: readedMsg }).catch(err => console.error(err)); |
|
|
bus.unReadMessageList = bus.unReadMessageList.filter(v => v.id !== id); |
|
|
bus.unReadMessageList = bus.unReadMessageList.filter(v => v.id !== id); |
|
|
}, |
|
|
}, |
|
|
// 清空消息
|
|
|
// 清空消息
|
|
@ -954,14 +991,13 @@ const tis = { |
|
|
//展现右上角的逻辑。
|
|
|
//展现右上角的逻辑。
|
|
|
}, |
|
|
}, |
|
|
addWidgets(widgets) { |
|
|
addWidgets(widgets) { |
|
|
const newWidgets = widgets.map((w) => { |
|
|
|
|
|
|
|
|
const newWidgets = widgets.map(w => { |
|
|
return { |
|
|
return { |
|
|
...w, |
|
|
...w, |
|
|
containerId: "widget_" + w.id, |
|
|
containerId: "widget_" + w.id, |
|
|
opened: false, |
|
|
opened: false, |
|
|
asserts: bus.resource |
|
|
asserts: bus.resource |
|
|
} |
|
|
|
|
|
; |
|
|
|
|
|
|
|
|
}; |
|
|
}); |
|
|
}); |
|
|
bus.widgets = [...bus.widgets, ...newWidgets]; |
|
|
bus.widgets = [...bus.widgets, ...newWidgets]; |
|
|
}, |
|
|
}, |
|
@ -975,9 +1011,12 @@ const tis = { |
|
|
}, |
|
|
}, |
|
|
//增加所有组件
|
|
|
//增加所有组件
|
|
|
addComponents(components) { |
|
|
addComponents(components) { |
|
|
bus.allComponents = [...bus.allComponents, ...components.map(c => { |
|
|
|
|
|
return { ...c, loaded: false }; |
|
|
|
|
|
})]; |
|
|
|
|
|
|
|
|
bus.allComponents = [ |
|
|
|
|
|
...bus.allComponents, |
|
|
|
|
|
...components.map(c => { |
|
|
|
|
|
return { ...c, loaded: false }; |
|
|
|
|
|
}) |
|
|
|
|
|
]; |
|
|
}, |
|
|
}, |
|
|
getAllComponents() { |
|
|
getAllComponents() { |
|
|
return bus.allComponents; |
|
|
return bus.allComponents; |
|
@ -1012,15 +1051,18 @@ const tis = { |
|
|
return bus.widgets.length; |
|
|
return bus.widgets.length; |
|
|
}, |
|
|
}, |
|
|
getOpenedWidgetIds() { |
|
|
getOpenedWidgetIds() { |
|
|
return bus.widgets.filter(w => w.opened).map((w) => w.id); |
|
|
|
|
|
|
|
|
return bus.widgets.filter(w => w.opened).map(w => w.id); |
|
|
}, |
|
|
}, |
|
|
_saveOpenedWidgets() { |
|
|
_saveOpenedWidgets() { |
|
|
sessionStorage.setItem("openedWidgets", JSON.stringify(this.getOpenedWidgetIds())); |
|
|
|
|
|
|
|
|
sessionStorage.setItem( |
|
|
|
|
|
"openedWidgets", |
|
|
|
|
|
JSON.stringify(this.getOpenedWidgetIds()) |
|
|
|
|
|
); |
|
|
}, |
|
|
}, |
|
|
restoreWidgetsFromSession() { |
|
|
restoreWidgetsFromSession() { |
|
|
try { |
|
|
try { |
|
|
const ids = sessionStorage.getItem("openedWidgets") || JSON.stringify([]); |
|
|
const ids = sessionStorage.getItem("openedWidgets") || JSON.stringify([]); |
|
|
JSON.parse(ids).forEach((widgetId) => { |
|
|
|
|
|
|
|
|
JSON.parse(ids).forEach(widgetId => { |
|
|
this.openWidget(widgetId); |
|
|
this.openWidget(widgetId); |
|
|
}); |
|
|
}); |
|
|
} catch (_) { |
|
|
} catch (_) { |
|
@ -1074,9 +1116,11 @@ const tis = { |
|
|
} |
|
|
} |
|
|
}); |
|
|
}); |
|
|
//应用自定义配置的compoonents也得返给应用,不能全部依赖管理员配置
|
|
|
//应用自定义配置的compoonents也得返给应用,不能全部依赖管理员配置
|
|
|
app.components = defaultApp && defaultApp.components ? [...appComps, ...defaultApp.components] : appComps; |
|
|
|
|
|
|
|
|
app.components = |
|
|
|
|
|
defaultApp && defaultApp.components |
|
|
|
|
|
? [...appComps, ...defaultApp.components] |
|
|
|
|
|
: appComps; |
|
|
//返回给应用所有的htmlresource资源目录,后端暂时无法配置组件。这个以后可以再改。
|
|
|
//返回给应用所有的htmlresource资源目录,后端暂时无法配置组件。这个以后可以再改。
|
|
|
|
|
|
|
|
|
}); |
|
|
}); |
|
|
custom_widgets = widgets.map(widget => { |
|
|
custom_widgets = widgets.map(widget => { |
|
|
let widgetComps = []; |
|
|
let widgetComps = []; |
|
@ -1091,12 +1135,14 @@ const tis = { |
|
|
} |
|
|
} |
|
|
}); |
|
|
}); |
|
|
//合并默认组件配置和管理员的配置
|
|
|
//合并默认组件配置和管理员的配置
|
|
|
widget.components = defaultwg && defaultwg.components ? [...defaultwg.components, ...widgetComps] : widgetComps; |
|
|
|
|
|
|
|
|
widget.components = |
|
|
|
|
|
defaultwg && defaultwg.components |
|
|
|
|
|
? [...defaultwg.components, ...widgetComps] |
|
|
|
|
|
: widgetComps; |
|
|
//返回给应用所有的htmlresource资源目录,后端暂时无法配置组件。这个以后可以再改。
|
|
|
//返回给应用所有的htmlresource资源目录,后端暂时无法配置组件。这个以后可以再改。
|
|
|
return { ...widget, ...defaultwg }; |
|
|
return { ...widget, ...defaultwg }; |
|
|
}); |
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (!test) { |
|
|
if (!test) { |
|
|
//过滤掉kt,兼容
|
|
|
//过滤掉kt,兼容
|
|
|
this.addApps(apps.filter(a => a.id !== "TIS_RJJHJCKJ_WEB")); |
|
|
this.addApps(apps.filter(a => a.id !== "TIS_RJJHJCKJ_WEB")); |
|
@ -1104,11 +1150,9 @@ const tis = { |
|
|
//TODO 打开
|
|
|
//TODO 打开
|
|
|
this.openDefaultApp(); |
|
|
this.openDefaultApp(); |
|
|
this.restoreWidgetsFromSession(); |
|
|
this.restoreWidgetsFromSession(); |
|
|
this._initUnReadMessageList();//初始化未读消息
|
|
|
|
|
|
|
|
|
this._initUnReadMessageList(); //初始化未读消息
|
|
|
this.initConfig(); |
|
|
this.initConfig(); |
|
|
|
|
|
|
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
}, |
|
|
}, |
|
|
getSchema() { |
|
|
getSchema() { |
|
|
return bus.schema; |
|
|
return bus.schema; |
|
@ -1117,12 +1161,14 @@ const tis = { |
|
|
initOMFrameView(mode = 0) { |
|
|
initOMFrameView(mode = 0) { |
|
|
// 清空apps再操作
|
|
|
// 清空apps再操作
|
|
|
bus.apps = []; |
|
|
bus.apps = []; |
|
|
getOMesplug(mode).then(r => { |
|
|
|
|
|
const { apps = [] } = r; |
|
|
|
|
|
this.addApps(apps); |
|
|
|
|
|
this.initConfig(); |
|
|
|
|
|
this.openDefaultApp(); |
|
|
|
|
|
}).catch(e => console.error(e)); |
|
|
|
|
|
|
|
|
getOMesplug(mode) |
|
|
|
|
|
.then(r => { |
|
|
|
|
|
const { apps = [] } = r; |
|
|
|
|
|
this.addApps(apps); |
|
|
|
|
|
this.initConfig(); |
|
|
|
|
|
this.openDefaultApp(); |
|
|
|
|
|
}) |
|
|
|
|
|
.catch(e => console.error(e)); |
|
|
}, |
|
|
}, |
|
|
//默认的初始化框架界面函数
|
|
|
//默认的初始化框架界面函数
|
|
|
initFrameViewByDefault(options = {}) { |
|
|
initFrameViewByDefault(options = {}) { |
|
@ -1149,13 +1195,13 @@ const tis = { |
|
|
//初始化config配置
|
|
|
//初始化config配置
|
|
|
initConfig() { |
|
|
initConfig() { |
|
|
const msg_conf = window.localStorage.getItem("MESSAGE_CONFIG"); |
|
|
const msg_conf = window.localStorage.getItem("MESSAGE_CONFIG"); |
|
|
msg_conf ? bus.notificationConfig = JSON.parse(msg_conf) : ""; |
|
|
|
|
|
|
|
|
msg_conf ? (bus.notificationConfig = JSON.parse(msg_conf)) : ""; |
|
|
}, |
|
|
}, |
|
|
//初始化框架内apps widgets components 等全集
|
|
|
//初始化框架内apps widgets components 等全集
|
|
|
initAlldata(config = {}) { |
|
|
initAlldata(config = {}) { |
|
|
const { apps = [], widgets = [], components = [] } = config; |
|
|
const { apps = [], widgets = [], components = [] } = config; |
|
|
this.addAllApps(apps);//app的全集,用户登录后拿到其中的某几个app构成的子集
|
|
|
|
|
|
this.addAllWidgets(widgets);//widgets,用户登录后拿到其中的某几个widgets构成的子集
|
|
|
|
|
|
|
|
|
this.addAllApps(apps); //app的全集,用户登录后拿到其中的某几个app构成的子集
|
|
|
|
|
|
this.addAllWidgets(widgets); //widgets,用户登录后拿到其中的某几个widgets构成的子集
|
|
|
this.addComponents(components); |
|
|
this.addComponents(components); |
|
|
this.openAppByIdImmediately(); |
|
|
this.openAppByIdImmediately(); |
|
|
}, |
|
|
}, |
|
@ -1205,10 +1251,11 @@ const tis = { |
|
|
getRecvMsg(params).then(d => { |
|
|
getRecvMsg(params).then(d => { |
|
|
const { Content = [], TotalNum = 0 } = d; |
|
|
const { Content = [], TotalNum = 0 } = d; |
|
|
if (TotalNum > 0) { |
|
|
if (TotalNum > 0) { |
|
|
const unReadMsgs = Content.filter(c => c.isRead == 0).map(c => formatDBToMsg(c)); |
|
|
|
|
|
|
|
|
const unReadMsgs = Content.filter(c => c.isRead == 0).map(c => |
|
|
|
|
|
formatDBToMsg(c) |
|
|
|
|
|
); |
|
|
unReadMsgs.forEach(ur => this.addMessageData(ur)); |
|
|
unReadMsgs.forEach(ur => this.addMessageData(ur)); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
}); |
|
|
}); |
|
|
}, |
|
|
}, |
|
|
//获取alias中别名对应的真名
|
|
|
//获取alias中别名对应的真名
|
|
@ -1217,8 +1264,12 @@ const tis = { |
|
|
}, |
|
|
}, |
|
|
// 加载组件的函数,目前应用的加载组件函数是否需要封装到tis中?
|
|
|
// 加载组件的函数,目前应用的加载组件函数是否需要封装到tis中?
|
|
|
async _loadComponent(component) { |
|
|
async _loadComponent(component) { |
|
|
let curBaseUrl = process.env.NODE_ENV === "development" ? `http://${document.domain}:8080` : `http://${document.domain}:3806`; |
|
|
|
|
|
const comp = bus.allComponents.find(arg => arg.component === component) || {}; |
|
|
|
|
|
|
|
|
let curBaseUrl = |
|
|
|
|
|
process.env.NODE_ENV === "development" |
|
|
|
|
|
? `http://${document.domain}:8080` |
|
|
|
|
|
: `http://${document.domain}:3806`; |
|
|
|
|
|
const comp = |
|
|
|
|
|
bus.allComponents.find(arg => arg.component === component) || {}; |
|
|
let assets = null; |
|
|
let assets = null; |
|
|
let dependencies = []; |
|
|
let dependencies = []; |
|
|
try { |
|
|
try { |
|
@ -1230,9 +1281,13 @@ const tis = { |
|
|
} |
|
|
} |
|
|
console.log( |
|
|
console.log( |
|
|
`框架开始加载${component}组件资源...`, |
|
|
`框架开始加载${component}组件资源...`, |
|
|
`所有组件信息`, bus.allComponents, |
|
|
|
|
|
`匹配到的组件信息`, comp, |
|
|
|
|
|
"该组件静态资源", assets); |
|
|
|
|
|
|
|
|
`所有组件信息`, |
|
|
|
|
|
bus.allComponents, |
|
|
|
|
|
`匹配到的组件信息`, |
|
|
|
|
|
comp, |
|
|
|
|
|
"该组件静态资源", |
|
|
|
|
|
assets |
|
|
|
|
|
); |
|
|
//等待依赖下载完毕
|
|
|
//等待依赖下载完毕
|
|
|
for (const refer of dependencies) { |
|
|
for (const refer of dependencies) { |
|
|
let reference = bus.resource[refer] || null; |
|
|
let reference = bus.resource[refer] || null; |
|
@ -1241,33 +1296,36 @@ const tis = { |
|
|
return new Promise((resolve, reject) => { |
|
|
return new Promise((resolve, reject) => { |
|
|
//加载组件资源
|
|
|
//加载组件资源
|
|
|
console.log("开始加载组件", "组件:" + component, assets); |
|
|
console.log("开始加载组件", "组件:" + component, assets); |
|
|
registerApps(assets, curBaseUrl).then(() => { |
|
|
|
|
|
let startTime = new Date().getTime(); |
|
|
|
|
|
const looper = setInterval(() => { |
|
|
|
|
|
if (Vue.component(`${component}`)) { |
|
|
|
|
|
resolve(comp); |
|
|
|
|
|
clearInterval(looper); |
|
|
|
|
|
} else { |
|
|
|
|
|
let nowTime = new Date().getTime(); |
|
|
|
|
|
if (nowTime - startTime > 2000) { |
|
|
|
|
|
if (!assets) { |
|
|
|
|
|
reject(`[loading error:${component}]:组件资源加载失败`); |
|
|
|
|
|
} else { |
|
|
|
|
|
reject(`[loading error:${component}]:loading component timed out`); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
registerApps(assets, curBaseUrl) |
|
|
|
|
|
.then(() => { |
|
|
|
|
|
let startTime = new Date().getTime(); |
|
|
|
|
|
const looper = setInterval(() => { |
|
|
|
|
|
if (Vue.component(`${component}`)) { |
|
|
|
|
|
resolve(comp); |
|
|
clearInterval(looper); |
|
|
clearInterval(looper); |
|
|
|
|
|
} else { |
|
|
|
|
|
let nowTime = new Date().getTime(); |
|
|
|
|
|
if (nowTime - startTime > 2000) { |
|
|
|
|
|
if (!assets) { |
|
|
|
|
|
reject(`[loading error:${component}]:组件资源加载失败`); |
|
|
|
|
|
} else { |
|
|
|
|
|
reject( |
|
|
|
|
|
`[loading error:${component}]:loading component timed out` |
|
|
|
|
|
); |
|
|
|
|
|
} |
|
|
|
|
|
clearInterval(looper); |
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
}, 300); |
|
|
|
|
|
}) |
|
|
|
|
|
.catch(err => { |
|
|
|
|
|
if (!assets) { |
|
|
|
|
|
reject(`[loading error:${component}]:组件资源加载失败`); |
|
|
|
|
|
} else { |
|
|
|
|
|
reject(`[loading error:${component}]:${err}`); |
|
|
} |
|
|
} |
|
|
}, 300); |
|
|
|
|
|
}).catch(err => { |
|
|
|
|
|
if (!assets) { |
|
|
|
|
|
reject(`[loading error:${component}]:组件资源加载失败`); |
|
|
|
|
|
} else { |
|
|
|
|
|
reject(`[loading error:${component}]:${err}`); |
|
|
|
|
|
} |
|
|
|
|
|
}); |
|
|
|
|
|
|
|
|
}); |
|
|
}); |
|
|
}); |
|
|
|
|
|
|
|
|
}, |
|
|
}, |
|
|
|
|
|
|
|
|
worker, |
|
|
worker, |
|
@ -1281,30 +1339,42 @@ const tis = { |
|
|
} |
|
|
} |
|
|
}, |
|
|
}, |
|
|
hiddenAllVisible() { |
|
|
hiddenAllVisible() { |
|
|
Object.keys(bus.registerVisible).map((key) => { |
|
|
|
|
|
|
|
|
Object.keys(bus.registerVisible).map(key => { |
|
|
bus[key] = false; |
|
|
bus[key] = false; |
|
|
}); |
|
|
}); |
|
|
bus.applicationInterface.visible = false; |
|
|
bus.applicationInterface.visible = false; |
|
|
}, |
|
|
}, |
|
|
|
|
|
|
|
|
initAppBusById(bus,AppId){ |
|
|
|
|
|
let app = this.getApps().find(app=>app.id === AppId ); |
|
|
|
|
|
|
|
|
initAppBusById(bus, AppId) { |
|
|
|
|
|
let app = this.getApps().find(app => app.id === AppId); |
|
|
app.privateBus = bus; |
|
|
app.privateBus = bus; |
|
|
}, |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
}; |
|
|
}; |
|
|
hotkeysPlugin(tis); |
|
|
hotkeysPlugin(tis); |
|
|
voicePlugin(tis); |
|
|
voicePlugin(tis); |
|
|
qtPlugin(tis); |
|
|
qtPlugin(tis); |
|
|
screenshotPlugin(tis); |
|
|
screenshotPlugin(tis); |
|
|
Vue.prototype.$tis = new Proxy({ loadApp }, { |
|
|
|
|
|
get: function(o, k) { |
|
|
|
|
|
return o[k] || tis[k]; |
|
|
|
|
|
|
|
|
Vue.prototype.$tis = new Proxy( |
|
|
|
|
|
{ loadApp }, |
|
|
|
|
|
{ |
|
|
|
|
|
get: function(o, k) { |
|
|
|
|
|
return o[k] || tis[k]; |
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
}); |
|
|
|
|
|
|
|
|
); |
|
|
|
|
|
|
|
|
export function setup(options = {}) { |
|
|
export function setup(options = {}) { |
|
|
const { layouts = {}, whitelist = [], schema, wsUrl, apps = [], components = [], hotkeys, alias = {}, theme = "default" } = options; |
|
|
|
|
|
|
|
|
const { |
|
|
|
|
|
layouts = {}, |
|
|
|
|
|
whitelist = [], |
|
|
|
|
|
schema, |
|
|
|
|
|
wsUrl, |
|
|
|
|
|
apps = [], |
|
|
|
|
|
components = [], |
|
|
|
|
|
hotkeys, |
|
|
|
|
|
alias = {}, |
|
|
|
|
|
theme = "default" |
|
|
|
|
|
} = options; |
|
|
tis.layouts = layouts; |
|
|
tis.layouts = layouts; |
|
|
bus.whitelist = [...whitelist]; |
|
|
bus.whitelist = [...whitelist]; |
|
|
bus.alias = alias; |
|
|
bus.alias = alias; |
|
@ -1340,30 +1410,32 @@ export function setup(options = {}) { |
|
|
tis.bindPlatformHotkeys(hotkeys); |
|
|
tis.bindPlatformHotkeys(hotkeys); |
|
|
|
|
|
|
|
|
//挂载Vue、tis
|
|
|
//挂载Vue、tis
|
|
|
window.esapp = Object.assign(!window.esapp ? window.esapp = {} : window.esapp, { |
|
|
|
|
|
Vue: Vue, |
|
|
|
|
|
vue: new Vue({ |
|
|
|
|
|
store, |
|
|
|
|
|
router, |
|
|
|
|
|
render: h => h(App) |
|
|
|
|
|
}).$mount("#app"), |
|
|
|
|
|
add_path: function(route, name, obj) { |
|
|
|
|
|
store.registerModule(name, obj); |
|
|
|
|
|
}, |
|
|
|
|
|
add_store: function(module, data) { |
|
|
|
|
|
store.commit(module, data); |
|
|
|
|
|
}, |
|
|
|
|
|
Vuex: Vuex, |
|
|
|
|
|
VueRouter: {}, |
|
|
|
|
|
registerAppAsync: function(source) { |
|
|
|
|
|
return source; |
|
|
|
|
|
}, |
|
|
|
|
|
tis: tis, //新框架核心对象,
|
|
|
|
|
|
flag: tis //
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
window.esapp = Object.assign( |
|
|
|
|
|
!window.esapp ? (window.esapp = {}) : window.esapp, |
|
|
|
|
|
{ |
|
|
|
|
|
Vue: Vue, |
|
|
|
|
|
vue: new Vue({ |
|
|
|
|
|
store, |
|
|
|
|
|
router, |
|
|
|
|
|
render: h => h(App) |
|
|
|
|
|
}).$mount("#app"), |
|
|
|
|
|
add_path: function(route, name, obj) { |
|
|
|
|
|
store.registerModule(name, obj); |
|
|
|
|
|
}, |
|
|
|
|
|
add_store: function(module, data) { |
|
|
|
|
|
store.commit(module, data); |
|
|
|
|
|
}, |
|
|
|
|
|
Vuex: Vuex, |
|
|
|
|
|
VueRouter: {}, |
|
|
|
|
|
registerAppAsync: function(source) { |
|
|
|
|
|
return source; |
|
|
|
|
|
}, |
|
|
|
|
|
tis: tis, //新框架核心对象,
|
|
|
|
|
|
flag: tis //
|
|
|
|
|
|
} |
|
|
|
|
|
); |
|
|
|
|
|
|
|
|
return tis; |
|
|
return tis; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
export default tis; |
|
|
|
|
|
|
|
|
export default tis; |