访问接口header加上version、platform

This commit is contained in:
kuaifan 2022-01-13 11:22:46 +08:00
parent cebcc26baf
commit dc1f1985e8
2 changed files with 13 additions and 3 deletions

View File

@ -90,9 +90,16 @@ Vue.prototype.goBack = function (number) {
}; };
Vue.prototype.$A = $A; Vue.prototype.$A = $A;
Vue.prototype.$Electron = !!__IS_ELECTRON ? require('electron') : null; Vue.prototype.$Electron = null;
Vue.prototype.$isMainElectron = !!__IS_ELECTRON && window.navigator && window.navigator.userAgent && /\s+MainTaskWindow\//.test(window.navigator.userAgent); Vue.prototype.$Platform = "web";
Vue.prototype.$isSubElectron = !!__IS_ELECTRON && window.navigator && window.navigator.userAgent && /\s+SubTaskWindow\//.test(window.navigator.userAgent); 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; Vue.config.productionTip = false;
@ -115,6 +122,7 @@ $A.store = app.$store;
$A.L = app.$L; $A.L = app.$L;
$A.Electron = app.$Electron; $A.Electron = app.$Electron;
$A.Platform = app.$Platform;
$A.isMainElectron = app.$isMainElectron; $A.isMainElectron = app.$isMainElectron;
$A.isSubElectron = app.$isSubElectron; $A.isSubElectron = app.$isSubElectron;
$A.execMainDispatch = (action, data) => { $A.execMainDispatch = (action, data) => {

View File

@ -17,6 +17,8 @@ export default {
params.header['language'] = $A.getLanguage(); params.header['language'] = $A.getLanguage();
params.header['token'] = state.userToken; params.header['token'] = state.userToken;
params.header['fd'] = $A.getStorageString("userWsFd"); 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); const cloneParams = $A.cloneJSON(params);
return new Promise(function (resolve, reject) { return new Promise(function (resolve, reject) {