deming/pageE/setting/Index.vue

183 lines
4.8 KiB
Vue
Raw Normal View History

2020-06-08 07:23:23 +00:00
<template>
<view class="setting">
2020-08-15 09:16:11 +00:00
<!-- <view class="list-item">
2020-06-08 07:23:23 +00:00
<view>消息提醒</view>
<view>
<u-switch v-model="checked" active-color="#FF770F" inactive-color="#A9A7A7" size="35"></u-switch>
</view>
2020-08-15 09:16:11 +00:00
</view> -->
2020-06-08 07:23:23 +00:00
<view v-for="(item, index) in settingList" :key="index" class="list-item" @click="toNextPage(item.link)">
<view>{{ item.title }}</view>
<image src="../static/mine/21.png"></image>
</view>
2020-08-26 12:31:30 +00:00
<view class="list-item" @click="clearCache">
<view>清除缓存</view>
<view class="left-text">{{ fileSizeString }}</view>
</view>
2020-06-08 07:23:23 +00:00
<view class="list-item" @click="sheetStatus=true">
<view>退出登录</view>
<image src="../static/mine/21.png"></image>
</view>
2020-07-29 07:04:57 +00:00
<u-action-sheet v-model="sheetStatus" :list="list" :tips="tips" :border-radius="20" @click="choiceOption">
2020-06-08 07:23:23 +00:00
</u-action-sheet>
2020-07-31 00:45:30 +00:00
<u-modal v-model="show" show-confirm-button show-cancel-button :content="content" @confirm="loginOut"></u-modal>
2020-06-08 07:23:23 +00:00
</view>
</template>
<script>
2020-07-29 07:04:57 +00:00
import {
mapMutations
} from 'vuex';
2020-08-18 02:43:15 +00:00
import IMService from '@/static/imservice.js'
2020-07-29 07:04:57 +00:00
export default {
data() {
return {
checked: false,
tips: {
text: '您可选择以下操作',
color: '#999999',
fontSize: 24
2020-06-08 07:23:23 +00:00
},
2020-07-29 07:04:57 +00:00
sheetStatus: false,
2020-08-09 11:08:12 +00:00
list: [
// {
// text: '换个账号登录',
// color: '#FF780F',
// fontSize: 28
// },
2020-07-29 07:04:57 +00:00
{
text: '退出登录',
color: '#FF780F',
fontSize: 28
}
],
settingList: [{
title: '个人信息',
link: '../mine/MineInfo'
},
{
title: '收货地址',
link: '../more/Address'
},
{
title: '证件中心',
link: '../mine/ArticleDetails?type=1'
},
2020-08-27 01:36:12 +00:00
{
title: '第三方绑定',
link: './binding'
},
2020-07-29 07:04:57 +00:00
{
title: '屏蔽用户',
link: './ShieldUsers'
},
{
title: '关于我们',
2020-08-18 09:42:26 +00:00
link: '/pageE/setting/version'
2020-07-29 07:04:57 +00:00
},
{
title: '帮助与反馈',
link: './feedback'
},
2020-07-31 00:45:30 +00:00
],
content: "是否退出登录!",
2020-08-26 12:31:30 +00:00
show: false,
fileSizeString: "", // 缓存大小
2020-07-29 07:04:57 +00:00
}
},
2020-08-26 12:31:30 +00:00
onLoad() {
this.getCache();
},
2020-07-29 07:04:57 +00:00
methods: {
...mapMutations(['logout']),
// 退出登录选择 0切换账号 | 1退出登录
choiceOption(index) {
console.log(index);
2020-08-09 11:08:12 +00:00
if (index == 0) {
2020-07-31 00:45:30 +00:00
this.show = true;
2020-06-08 07:23:23 +00:00
}
2020-07-29 07:04:57 +00:00
},
2020-08-26 12:31:30 +00:00
// 获取缓存
getCache() {
let _this = this;
// #ifdef APP-PLUS
plus.cache.calculate(function(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);
})
2020-09-19 12:01:07 +00:00
this.getCache();
2020-08-26 12:31:30 +00:00
}
}
})
// #endif
},
2020-07-29 07:04:57 +00:00
toNextPage(url, ...params) {
uni.navigateTo({
url: url
});
2020-07-31 00:45:30 +00:00
},
2020-08-18 02:43:15 +00:00
async loginOut() {
// 显示新人领取优惠券
this.$store.commit('updateShowCoupons', true);
2020-08-18 02:43:15 +00:00
let im = this.imService
2020-07-31 00:45:30 +00:00
this.logout();
uni.redirectTo({
url: "../../pageA/login/login",
})
2020-07-29 07:04:57 +00:00
}
2020-06-08 07:23:23 +00:00
},
2020-07-29 07:04:57 +00:00
};
2020-06-08 07:23:23 +00:00
</script>
<style lang="scss" scoped>
2020-07-29 07:04:57 +00:00
.setting {
min-height: calc(100vh - var(--window-top));
background-color: #ECECEC;
.list-item {
display: flex;
align-items: center;
justify-content: space-between;
height: 98rpx;
border-top: 2rpx solid #EBEBEB;
background-color: #ffffff;
padding: 0 30rpx;
font-size: 30rpx;
color: rgba(51, 51, 51, 1);
>image {
width: 14rpx;
height: 24rpx;
}
2020-08-26 12:31:30 +00:00
.left-text {
margin-left: auto;
font-size: 28rpx;
}
2020-06-08 07:23:23 +00:00
}
}
2020-07-29 07:04:57 +00:00
</style>