<template>
	<view class="container">
		<uni-list>
		    <uni-list-item :title="$t('safe.f6')" clickable showArrow  @click="navTo('/pages/user/set/userinfo')" ></uni-list-item>
			<uni-list-item :title="$t('safe.f7')" clickable showArrow  @click="navTo('/pages/user/set/password')" ></uni-list-item>
			<uni-list-item :title="$t('safe.d1')" clickable showArrow  @click="navTo('/pages/user/set/transaction')" ></uni-list-item>
		</uni-list>
		<view class="list-cell log-out-btn" @click="toLogout">
			<text class="cell-tit">{{$t('accountSettings.a9')}}</text>
		</view>
	</view>
</template>

<script>
	import { logout } from '@/api/set.js';
	import {  
	    mapMutations  
	} from 'vuex';
	export default {
		data() {
			return {
				
			};
		},
		methods:{
			...mapMutations('user',['logout']),
			navTo(url){
				uni.navigateTo({
					url:url,
					fail(red) {
						console.log(red);
					}
				})
			},
			//退出登录
			toLogout(){
				let obj = this;
				uni.showModal({
				    content: this.$t('login.b7'),
				    success: (e)=>{
				    	if(e.confirm){
							logout({}).then((e) => {
								uni.navigateBack();
							}).catch((e) => {
								console.log(e);
							})
				    		obj.logout();
				    	}
				    }
				});
			},
		}
	}
</script>

<style lang='scss'>
	page{
		background: #f3f3f3;
	}
	.list-cell{
		display:flex;
		align-items:baseline;
		padding: 20rpx $page-row-spacing;
		line-height:60rpx;
		position:relative;
		background: #fff;
		justify-content: center;
		&.log-out-btn{
			margin-top: 40rpx;
			.cell-tit{
				text-align: center;
				margin-right: 0;
			}
		}
		.cell-tit{
			flex: 1;
			font-size: $font-base + 2rpx;
			color: $font-color-dark;
			margin-right:10rpx;
		}
		.cell-tip{
			font-size: $font-base;
			color: $font-color-light;
		}
		switch{
			transform: translateX(16rpx) scale(.84);
		}
	}
</style>
