This commit is contained in:
Gdpao
2020-09-01 20:32:15 +08:00
parent 115400353f
commit c5b3505dcd
4 changed files with 124 additions and 6 deletions

View File

@@ -23,11 +23,15 @@
<text>骑手投诉</text>
<image src="/static/image/user/1.png"></image>
</view>
<view class="nav" @click="is_loginout = true">
<view class="nav" @click="clearCache">
<text>清除缓存</text>
<text>{{ fileSizeString }}</text>
</view>
<view class="nav" @click="isLoginOut = true">
<text>退出登录</text>
<image src="/static/image/user/1.png"></image>
</view>
<u-modal v-model="is_loginout" show-confirm-button show-cancel-button :content="content" @confirm="loginOut"></u-modal>
<u-modal v-model="isLoginOut" show-confirm-button show-cancel-button :content="content" @confirm="loginOut"></u-modal>
<u-toast ref="uToast" />
</view>
</template>
@@ -37,17 +41,72 @@ export default {
data() {
return {
info:{},
is_loginout: false,
isLoginOut: false,
content: "是否退出登录?",
num:0
num:0,
fileSizeString: "", // 缓存大小
}
},
watch: {
isLoginOut() {
// console.log(this.isLoginOut);
if (this.isLoginOut) {
uni.hideTabBar();
} else {
setTimeout(function() {
uni.showTabBar();
},200)
}
}
},
onLoad() {
this.getCache();
console.log(222);
},
onShow() {
this.getmyinfo()
},
methods: {
// 获取缓存
getCache() {
let _this = this;
// #ifdef APP-PLUS
plus.cache.calculate(function(size) {
console.log(size);
let sizeCache = size;
if (sizeCache == 0) {
_this.fileSizeString = "0B";
} else if (sizeCache < 1024) {
_this.fileSizeString = sizeCache + "B";
} else if (sizeCache < 1048576) {
_this.fileSizeString = (sizeCache / 1024).toFixed(2) + "KB";
} else if (sizeCache < 1073741824) {
_this.fileSizeString = (sizeCache / 1048576).toFixed(2) + "MB";
} else {
_this.fileSizeString = (sizeCache / 1073741824).toFixed(2) + "GB";
}
});
// #endif
},
// 清除缓存
clearCache() {
// #ifdef APP-PLUS
uni.showModal({
title: "确定要清理缓存吗?",
cancelColor: "#999",
confirmColor: "#f00",
success: (res) => {
// console.log(res);
if (res.confirm) {
plus.cache.clear(function(e) {
console.log(e);
})
}
this.getCache();
}
})
// #endif
},
// 退出登陆
loginOut(){
uni.clearStorage();