智慧教务系统
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

105 lines
2.3 KiB

<!--设置页-->
<template>
<view class="assemble">
<view style="height: 30rpx;"></view>
<view class="option" @click="update_pass()">修改密码</view>
<view class="option" @click="privacy_agreement(1)">用户协议</view>
<view class="option" @click="privacy_agreement(2)">隐私策略</view>
<view class="option" @click="clearCache()">清空缓存</view>
<view style="width:90%;margin: 60rpx auto;">
<fui-button background="#29d3b4" @click="loginOut()">退出账号</fui-button>
</view>
</view>
</template>
<script>
export default {
data() {
return {
}
},
methods: {
//退出登陆
loginOut(){
this.$util.loginOut()
},
privacy_agreement(type){
this.$navigateTo({
url: '/pages/common/privacy_agreement?type='+type
})
},
update_pass(){
this.$navigateTo({
url: '/pages/market/my/update_pass'
})
},
// 清空缓存
clearCache() {
uni.showModal({
title: '清空缓存',
content: '确定要清空所有字典缓存吗?',
success: (res) => {
if (res.confirm) {
this.performClearCache();
}
}
});
},
// 执行清空缓存操作
performClearCache() {
try {
// 获取本地存储的所有键
const storageInfo = uni.getStorageInfoSync();
const keys = storageInfo.keys;
// 筛选出dict_开头的键并删除
let clearCount = 0;
keys.forEach(key => {
if (key.startsWith('dict_')) {
uni.removeStorageSync(key);
clearCount++;
}
});
// 显示清理结果
uni.showToast({
title: `已清空${clearCount}个字典缓存`,
icon: 'success',
duration: 2000
});
console.log(`清空缓存完成,共清理${clearCount}个dict_开头的缓存项`);
} catch (error) {
console.error('清空缓存失败:', error);
uni.showToast({
title: '清空缓存失败',
icon: 'none',
duration: 2000
});
}
}
}
}
</script>
<style lang="less" scoped>
.assemble{
width: 100%;
height: 100vh;
background: #333333;
}
.option{
margin-bottom: 20rpx;
background: #404045;
width: 100%;
font-size: 28rpx;
color: #fff;
line-height: 56rpx;
padding: 20rpx 0 20rpx 100rpx;
}
</style>