添加检查版本开关选项

This commit is contained in:
Next 2019-12-16 00:54:24 +08:00
parent b6caa797c7
commit 0eb78550f6
2 changed files with 27 additions and 3 deletions

View File

@ -175,6 +175,16 @@
</el-switch>
</el-col>
</el-row>
<el-row style="margin:5px 0;">
<el-col :span="12" style="text-align:left;padding-top:7px;padding-left:5px;">
检查版本
</el-col>
<el-col :span="12">
<el-switch style="margin: 5px;" v-model="isCheckVersion" @change="handleChangeCheckVersion"
active-color="#0099ff" inactive-color="gray">
</el-switch>
</el-col>
</el-row>
<el-row style="margin:5px 0;">
<el-col :span="12" style="text-align:left;padding-top:7px;padding-left:5px;">
源码

View File

@ -8,6 +8,7 @@ let app = new Vue({
isShowCache: false,
isAutoRefreshTree: true,
isDarkTheme: false,
isCheckVersion: false,
filterText: '',
splitLeft: 0.7,
splitRight: 0.5,
@ -314,7 +315,7 @@ let app = new Vue({
}, false, true);
}
let top = document.getElementById('top')
let top = document.getElementById('top');
top.appendChild(document.getElementsByClassName('toolbar')[0]);
document.getElementById('game_panel').appendChild(document.getElementById('content'));
let scene = cc.director.getScene();
@ -386,6 +387,14 @@ let app = new Vue({
}
},
handleChangeCheckVersion(isCheckVersion) {
if (isCheckVersion) {
localStorage.setItem('isCheckVersion', '1');
this.checkVersion();
} else {
localStorage.setItem('isCheckVersion', '0');
}
},
handleChangeTheme(isDark) {
isDark ? this.addDarkTheme() : this.removeDarkTheme();
},
@ -543,7 +552,6 @@ let app = new Vue({
}
},
created: function () {
this.checkVersion();
document.body.insertBefore(document.getElementById('app'), document.body.firstChild);
let onCCInit = () => {
@ -563,7 +571,13 @@ let app = new Vue({
} else {
this.$data.isDarkTheme = false;
}
this.$data.isShorProfile = localStorage.getItem('isShorProfile') === '1';
if (localStorage.getItem('isCheckVersion') === '1') {
this.$data.isCheckVersion = true;
this.checkVersion();
} else {
this.$data.isCheckVersion = false;
}
this.$data.isShowProfile = localStorage.getItem('isShowProfile') === '1';
setTimeout(() => {
this.handleChangeStats();
}, 0);