template-project/pagesB/set-up/set-up.vue

128 lines
3.5 KiB
Vue

<template>
<view>
<status-nav navBarTitle="设置" returnColor="#c2c2c2"></status-nav>
<container-subgroup>
<view slot="content" style="margin: 0 -30rpx;" class="fon28">
<!-- #ifdef APP-PLUS -->
<view class="bacf pad30 disjbac bbot">
<view>开启语音提醒</view>
<view><evan-switch v-model="voiceStatus" @change="voiceEv" :size="18" inactive-color="#b3b3b3" active-color="#fd8956"></evan-switch></view>
</view>
<view class="bacf pad30 disjbac mar-x20">
<view>接受新消息通知</view>
<view><evan-switch v-model="newsStatus" @change="newsEv" :size="18" inactive-color="#b3b3b3" active-color="#fd8956"></evan-switch></view>
</view>
<!-- #endif -->
<view @tap="updatePassword" class="bacf pad30 disjbac bbot">
<view>修改登录密码</view>
<i class="icon icon-next col9" style="font-size: 26rpx;"></i>
</view>
<!-- #ifdef APP-PLUS -->
<view @tap="cleanEv" class="bacf pad30 disjbac">
<view>清除缓存</view>
<view class="col9">{{cacheSize}}</view>
</view>
<!-- #endif -->
<view class="bacf pad30 disjbac mar-s20 bbot" @tap="chooseEv(index)" v-for="(item,index) in dataList" :key="index">
<view>{{item.title}}</view>
<view class="disac col9">
<i class="icon icon-next col9 mar-z20" style="font-size: 26rpx;"></i>
</view>
</view>
<!-- #ifdef APP-PLUS -->
<view @tap="checkEdition" class="bacf pad30 disjbac">
<view>版本更新</view>
<view class="col9">当前版本 5.1.4</view>
</view>
<!-- #endif -->
</view>
</container-subgroup>
</view>
</template>
<script>
import evanSwitch from '@/components/evan-switch/evan-switch.vue';
export default {
components:{
evanSwitch
},
data() {
return {
voiceStatus:false,//是否开启语音提醒
newsStatus:false,//是否开启接受新消息通知
cacheSize:'754.72 KB',//缓存数据大小
dataList:[
{title:'ios/android的权限判断和提示'},
]
}
},
onLoad() {
// 调用获取缓存数据的大小
this.getStorageDataNum();
},
methods: {
// 获取缓存数据的大小
getStorageDataNum(){
// #ifdef APP-PLUS
var self = this;
plus.cache.calculate(function(size) { //size是多少个字节单位是b
//做下面相应的处理
if (size < 1024) {
self.cacheSize = size + ' B';
} else if (size / 1024 >= 1 && size / 1024 / 1024 < 1) {
self.cacheSize = Math.floor(size / 1024 * 100) / 100 + ' KB';
} else if (size / 1024 / 1024 >= 1) {
self.cacheSize = Math.floor(size / 1024 / 1024 * 100) / 100 + ' M';
}
});
// #endif
},
// 语音提醒事件
voiceEv(status){
console.log(status);
},
// 新消息通知事件
newsEv(status){
console.log(status);
},
// 修改登录密码
updatePassword(){
console.log('修改登录密码');
},
// 清除缓存事件
cleanEv(){
console.log('清除缓存事件');
// #ifdef APP-PLUS
var self = this;
//使用plus.cache.clear 清除应用中的缓存数据
plus.cache.clear(function() {
uni.showToast({
title: '清除成功!',
icon: 'none',
success() {
self.cacheSize = '0B'
}
})
});
// #endif
},
// 检测版本事件
checkEdition(){
console.log('检测版本事件');
},
chooseEv(index){
let arr = [
'/pagesB/permission/permission',
]
uni.navigateTo({
url:arr[index]
})
}
}
}
</script>
<style>
</style>