版本号动态获取显示

This commit is contained in:
尹吉欢
2018-05-28 14:14:48 +08:00
parent aaa2a8274b
commit 79a82ac42e
3 changed files with 23 additions and 3 deletions
+8 -1
View File
@@ -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);