304 lines
7.0 KiB
Vue
Executable File
304 lines
7.0 KiB
Vue
Executable File
<template>
|
|
<view class="page">
|
|
<view class="title">系统设置</view>
|
|
<view class="title-switch"><text>设为默认账号</text><switch/></view>
|
|
<view class="title-switch"><text>直接登录</text><switch/></view>
|
|
<view class="title-switch"><text>退出清除信息</text><switch/></view>
|
|
<view class="title">声音管理</view>
|
|
<view class="title-switch"><text>暂无</text></view>
|
|
|
|
<view class="title">网络设定</view>
|
|
<view class="title-switch"><text>{{requestUrl}}</text></view>
|
|
|
|
<view class="bottom-button">
|
|
<view class="bot-btn" @tap="clickClearCache"> 切换账号</view>
|
|
<!-- #ifdef APP-PLUS -->
|
|
<view class="bot-btn-quit" @tap="Quit">
|
|
<navigator target="miniProgram">退出系统</navigator>
|
|
</view>
|
|
<!-- #endif -->
|
|
|
|
</view>
|
|
</view>
|
|
</template>
|
|
|
|
<script>
|
|
import uniCollapse from '@/components/uni-collapse/uni-collapse.vue'
|
|
import uniCollapseItem from '@/components/uni-collapse-item/uni-collapse-item.vue'
|
|
import uniList from '@/components/uni-list/uni-list.vue'
|
|
import uniListItem from '@/components/uni-list-item/uni-list-item.vue'
|
|
import errorUtil from '@/common/errorutil.js'
|
|
import {
|
|
mapState,
|
|
mapMutations
|
|
} from 'vuex';
|
|
|
|
export default {
|
|
data() {
|
|
return {
|
|
requestUrl: '',
|
|
ip:'',
|
|
post:'',
|
|
virtualPath:''
|
|
}
|
|
},
|
|
components: {
|
|
uniCollapse,
|
|
uniCollapseItem,
|
|
uniList,
|
|
uniListItem
|
|
},
|
|
computed: {
|
|
...mapState(['hasLogin','userInfo'])
|
|
},
|
|
onShow() {
|
|
this.requestUrl = this.$global.globalData.requestUrl
|
|
|
|
},
|
|
methods: {
|
|
...mapMutations(['logout','clearCache']),
|
|
Quit() {
|
|
//只在安卓应用中有用 退出当前应用,改方法只在App中生效
|
|
plus.runtime.quit();
|
|
},
|
|
clearServerCache: function(count){
|
|
console.log("----clearServerCache----"+this.userInfo);
|
|
// let requestParams = {
|
|
// "id": this.userInfo.UserID,
|
|
// "sysYN":1,
|
|
// "billYN":1,
|
|
// "deptYN":1,
|
|
// "suppYN":1,
|
|
// "custYN":1,
|
|
// "stockYN":1,
|
|
// // "tokenpara": this.userInfo.dbAlise + "," + this.userInfo.UserID
|
|
// // + "," + this.userInfo.UserName
|
|
// };
|
|
if(count) {
|
|
count = count + 1;
|
|
if(count>4){
|
|
return;
|
|
}
|
|
}else {
|
|
count = 1;
|
|
}
|
|
let requestParams;
|
|
let tokenpara = uni.getStorageSync('tokenpara');
|
|
if(count > 1) {
|
|
requestParams = {
|
|
"id": this.userInfo.UserID,
|
|
"sysYN":1,
|
|
"billYN":1,
|
|
"deptYN":1,
|
|
"suppYN":1,
|
|
"custYN":1,
|
|
"stockYN":1,
|
|
"tokenpara": tokenpara
|
|
};
|
|
}else {
|
|
requestParams = {
|
|
"id": this.userInfo.UserID,
|
|
"sysYN":1,
|
|
"billYN":1,
|
|
"deptYN":1,
|
|
"suppYN":1,
|
|
"custYN":1,
|
|
"stockYN":1,
|
|
};
|
|
}
|
|
|
|
|
|
this.$request.post({
|
|
data: {
|
|
action: 'ArrangeCache',
|
|
params: requestParams
|
|
}
|
|
}).then(res => {
|
|
let data = JSON.parse(res);
|
|
console.log("----clearServerCache success----");
|
|
}).catch(err => {
|
|
uni.hideLoading();
|
|
if(err.state ==400){
|
|
this.clearServerCache(count);
|
|
if(count > 4) {
|
|
errorUtil.handle(err);
|
|
return;
|
|
}
|
|
}else{
|
|
errorUtil.handle(err);
|
|
}
|
|
});
|
|
},
|
|
|
|
logOut(count){
|
|
if(count) {
|
|
count = count + 1;
|
|
if(count>4){
|
|
return;
|
|
}
|
|
}else {
|
|
count = 1;
|
|
}
|
|
let requestParams;
|
|
let tokenpara = uni.getStorageSync('tokenpara');
|
|
if(count > 1) {
|
|
requestParams = {
|
|
"id": this.userInfo.token,
|
|
"tokenpara": tokenpara
|
|
};
|
|
}else {
|
|
requestParams = {
|
|
"id": this.userInfo.token,
|
|
};
|
|
}
|
|
|
|
|
|
this.$request.post({
|
|
data: {
|
|
action: 'Logout',
|
|
params: requestParams
|
|
}
|
|
}).then(res => {
|
|
// let data = JSON.parse(res);
|
|
}).catch(err => {
|
|
uni.hideLoading();
|
|
if(err.state ==400){
|
|
this.Logout(count);
|
|
if(count > 4) {
|
|
errorUtil.handle(err);
|
|
return;
|
|
}
|
|
}else{
|
|
errorUtil.handle(err);
|
|
}
|
|
});
|
|
},
|
|
|
|
clickClearCache: function() {
|
|
//方便测试后续删除
|
|
let requestUrl = this.$global.globalData.requestUrl;
|
|
this.post = uni.getStorageSync('requestPort');
|
|
this.ip = uni.getStorageSync('requestIp');
|
|
this.virtualPath = uni.getStorageSync('requestPath');
|
|
uni.showModal({
|
|
title: '提示',
|
|
content: '确认退出该系统',
|
|
showCancel: true,
|
|
cancelText: '否',
|
|
confirmText: '是',
|
|
confirmColor: '#3860F3',
|
|
success: res => {
|
|
if (res.confirm) {
|
|
// this.logOut('');
|
|
//清除服务器缓存
|
|
// this.clearServerCache();
|
|
//清除本地缓存
|
|
// this.clearCache();
|
|
//移除头像
|
|
uni.removeStorage({
|
|
key: 'Avatar'
|
|
});
|
|
//缓存账套配置
|
|
this.$global.setGlobalObj({
|
|
requestUrl: requestUrl
|
|
});
|
|
uni.setStorage({
|
|
key:"requestPort",
|
|
data:this.post
|
|
});
|
|
|
|
uni.setStorage({
|
|
key:"requestIp",
|
|
data:this.ip
|
|
});
|
|
uni.setStorage({
|
|
key:"requestPath",
|
|
data:this.virtualPath
|
|
});
|
|
|
|
uni.setStorageSync("ifLogin", false);
|
|
|
|
uni.reLaunch({url: '../../myinfo/login/login'});
|
|
}
|
|
},
|
|
fail: () => {},
|
|
complete: () => {}
|
|
});
|
|
},
|
|
|
|
}
|
|
}
|
|
</script>
|
|
|
|
<style>
|
|
page {
|
|
width: 100%;
|
|
height: 100%;
|
|
background: #F2F2F2;
|
|
}
|
|
.title{
|
|
height: 90.57upx;
|
|
line-height: 90.57upx;
|
|
font-size: 28.98upx;
|
|
font-family: PingFangSC-Regular, PingFang SC;
|
|
font-weight: 400;
|
|
color: #686868;
|
|
margin-left: 43.47upx;
|
|
}
|
|
.title-switch{
|
|
display: flex;
|
|
width: 100%;
|
|
flex-direction: row;
|
|
background: #FFFFFF;
|
|
margin-top: 3.62upx;
|
|
align-items: center;
|
|
}
|
|
.title-switch text{
|
|
width: 100%;
|
|
height: 108.69upx;
|
|
line-height: 108.69upx;
|
|
font-size: 32.6upx;
|
|
font-family: PingFangSC-Regular, PingFang SC;
|
|
font-weight: 400;
|
|
color: #232323;
|
|
margin-left: 43.47upx;
|
|
}
|
|
switch{
|
|
width: 79.71upx;
|
|
transform: scale(0.7);
|
|
margin-right: 43.47upx;
|
|
}
|
|
.bot-btn{
|
|
height: 86.95upx;
|
|
line-height: 86.95upx;
|
|
background: #FFFFFF;
|
|
box-shadow: 0px 5px 10px 0px rgba(0, 0, 0, 0.05);
|
|
border-radius: 43.47upx;
|
|
text-align: center;
|
|
|
|
font-size: 32.6upx;
|
|
font-family: PingFangSC-Regular, PingFang SC;
|
|
font-weight: 400;
|
|
color: #4688FD;
|
|
margin-top: 65.21upx;
|
|
margin-left: 43.47upx;
|
|
margin-right: 43.47upx;
|
|
}
|
|
.bot-btn-quit{
|
|
height: 86.95upx;
|
|
line-height: 86.95upx;
|
|
background: #FFFFFF;
|
|
box-shadow: 0px 5px 10px 0px rgba(0, 0, 0, 0.05);
|
|
border-radius: 43.47upx;
|
|
text-align: center;
|
|
|
|
font-size: 32.6upx;
|
|
font-family: PingFangSC-Regular, PingFang SC;
|
|
font-weight: 400;
|
|
color: #4688FD;
|
|
margin-top: 30rpx;
|
|
margin-left: 43.47upx;
|
|
margin-right: 43.47upx;
|
|
}
|
|
</style>
|