diff --git a/resources/assets/js/app.js b/resources/assets/js/app.js index 9968db02..b69d3c46 100644 --- a/resources/assets/js/app.js +++ b/resources/assets/js/app.js @@ -90,9 +90,16 @@ Vue.prototype.goBack = function (number) { }; Vue.prototype.$A = $A; -Vue.prototype.$Electron = !!__IS_ELECTRON ? require('electron') : null; -Vue.prototype.$isMainElectron = !!__IS_ELECTRON && window.navigator && window.navigator.userAgent && /\s+MainTaskWindow\//.test(window.navigator.userAgent); -Vue.prototype.$isSubElectron = !!__IS_ELECTRON && window.navigator && window.navigator.userAgent && /\s+SubTaskWindow\//.test(window.navigator.userAgent); +Vue.prototype.$Electron = null; +Vue.prototype.$Platform = "web"; +Vue.prototype.$isMainElectron = false; +Vue.prototype.$isSubElectron = false; +if (!!__IS_ELECTRON) { + Vue.prototype.$Electron = require('electron'); + Vue.prototype.$Platform = /macintosh|mac os x/i.test(navigator.userAgent) ? "mac" : "win"; + Vue.prototype.$isMainElectron = /\s+MainTaskWindow\//.test(window.navigator.userAgent); + Vue.prototype.$isSubElectron = /\s+SubTaskWindow\//.test(window.navigator.userAgent); +} Vue.config.productionTip = false; @@ -115,6 +122,7 @@ $A.store = app.$store; $A.L = app.$L; $A.Electron = app.$Electron; +$A.Platform = app.$Platform; $A.isMainElectron = app.$isMainElectron; $A.isSubElectron = app.$isSubElectron; $A.execMainDispatch = (action, data) => { diff --git a/resources/assets/js/store/actions.js b/resources/assets/js/store/actions.js index 7003460f..8457b062 100644 --- a/resources/assets/js/store/actions.js +++ b/resources/assets/js/store/actions.js @@ -17,6 +17,8 @@ export default { params.header['language'] = $A.getLanguage(); params.header['token'] = state.userToken; params.header['fd'] = $A.getStorageString("userWsFd"); + params.header['version'] = window.systemInfo.version || "0.0.1"; + params.header['platform'] = $A.Platform; // const cloneParams = $A.cloneJSON(params); return new Promise(function (resolve, reject) {