版本号动态获取显示
This commit is contained in:
@@ -2,11 +2,18 @@ axios.defaults.baseURL = BASE_PATH;
|
||||
axios.defaults.headers.post['Content-Type'] = 'application/json';
|
||||
axios.defaults.timeout = 120000;
|
||||
|
||||
var localVersion = "1.1";
|
||||
document.addEventListener('plusready', function() {
|
||||
plus.runtime.getProperty(plus.runtime.appid, function(inf) {
|
||||
localVersion = inf.version;
|
||||
});
|
||||
}, false);
|
||||
|
||||
// 添加请求拦截器
|
||||
axios.interceptors.request.use(function (config) {
|
||||
var token = localStorage.getItem("user_token");
|
||||
config.headers.Authorization = token;
|
||||
config.headers.appVersion = "1.1";
|
||||
config.headers.appVersion = localVersion;
|
||||
return config;
|
||||
}, function (error) {
|
||||
return Promise.reject(error);
|
||||
|
||||
Reference in New Issue
Block a user