版本号动态获取显示

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);
+10 -1
View File
@@ -64,7 +64,7 @@
</ul>
</div>
<div class="content-block">
<p style="text-align:center;margin-top:5rem;">V1.1<br>上海估家网络科技有限公司</p>
<p style="text-align:center;margin-top:5rem;"><span id="versionInfo">V1.1</span><br>上海估家网络科技有限公司</p>
<p style="text-align:center;"></p>
</div>
</div>
@@ -85,5 +85,14 @@ $.config = {router: false}
<script type="text/javascript" src="../../js/cn.js" charset="utf-8"></script>
<script type="text/javascript" src="../../js/mui.min.js" charset="utf-8"></script>
<script type="text/javascript" src="../../js/common.js"></script>
<script>
document.addEventListener('plusready', function() {
plus.runtime.getProperty(plus.runtime.appid, function(inf) {
var localVersion = inf.version;
document.getElementById("versionInfo").innerHTML = "V"+localVersion;
});
}, false);
</script>
</body>
</html>
+5 -1
View File
@@ -50,7 +50,7 @@
<div class="item-inner">
<div class="item-title-row">
<div class="item-title">关于我们</div>
<div class="item-after">V1.1</div>
<div class="item-after" id="versionInfo">V1.1</div>
</div>
</div>
</a>
@@ -150,6 +150,10 @@ function download(imgUrl) {
mui.plusReady(function() {
plus.runtime.getProperty(plus.runtime.appid, function(inf) {
var localVersion = inf.version;
document.getElementById("versionInfo").innerHTML = "V"+localVersion;
});
axios.get("/rest/ad/position",{params:{position : 7}}).then(function (response) {
var data = response.data.data;
if (data) {