<template>
	<view class="container">
		<view class="box" @click="navTo('/pages/set/gongao')">
			<view class="box-left">
				<view class="img">
					<image src="../../static/user/set01.png" mode=""  ></image>
				</view>
				<view class="title">
					公告
				</view>
			</view>
			<view class="img-right">
				<image src="../../static/user/right01.png" mode=""></image>
			</view>
		</view>
		<view class="box" @click="navTo('/pages/user/about')">
			<view class="box-left">
				<view class="img">
					<image src="../../static/user/set02.png" mode=""></image>
				</view>
				<view class="title">
					关于我们
				</view>
			</view>
			<view class="img-right">
				<image src="../../static/user/right01.png" mode=""></image>
			</view>
		</view>
		<view class="box" @click="navTo('/pages/set/userinfo')">
			<view class="box-left">
				<view class="img">
					<image src="../../static/user/set02.png" mode=""></image>
				</view>
				<view class="title">
					个人信息
				</view>
			</view>
			<view class="img-right">
				<image src="../../static/user/right01.png" mode=""></image>
			</view>
		</view>
		<!-- <view class="box" 	@click="navTo('/pages/set/password')">
			<view class="box-left">
				<view class="img">
					<image src="../../static/user/set03.png" mode=""></image>
				</view>
				<view class="title">
					交易密码
				</view>
			</view>
			<view class="img-right">
				<image src="../../static/user/right01.png" mode=""></image>
			</view>
		</view> -->
		<view class="list-cell log-out-btn" @click="toLogout"><text class="cell-tit">退出登录</text></view>
	</view>
</template>

<script>
	import uniList from '@/components/uni-list/uni-list.vue';
	import uniListItem from '@/components/uni-list-item/uni-list-item.vue';
	import {
		logout
	} from '@/api/set.js';
	import {
		mapMutations
	} from 'vuex';
	export default {
		components: {
			uniList,
			uniListItem
		},
		data() {
			return {};
		},
		methods: {
			...mapMutations('user', ['logout']),
			navTo(url) {
				uni.navigateTo({
					url: url
				});
			},
			//退出登录
			toLogout() {
				let obj = this;
				uni.showModal({
					content: '确定要退出登录么',
					success: e => {
						if (e.confirm) {
							logout({})
								.then(e => {
									uni.navigateBack();
								})
								.catch(e => {
									console.log(e);
								});
							obj.logout();
						}
					}
				});
			},
			//switch切换触发方法
			switchChange(e) {
				console.log(e);
				let statusTip = e.value ? '打开' : '关闭';
				this.$api.msg(`${statusTip}消息推送`);
			}
		}
	};
</script>

<style lang="scss">
	page {
		background: #111111;
		width: 750rpx;
		height: 100%;
	}

	.box {
		border-radius: 25rpx;
		height: 85rpx;
		display: flex;
		justify-content: space-between;
		align-items: center;
		margin: 0 35rpx 30rpx 35rpx;
		padding: 0 35rpx;
		background: #222222;

		.box-left {
			display: flex;

			.img {
				width: 45rpx;
				height: 40rpx;

				image {
					width: 100%;
					height: 100%;
				}
			}

			.title {
				margin-left: 15rpx;
				font-size: 26rpx;
				font-weight: 500;
				color: #FFFFFF;
				line-height: 40rpx;
			}
		}

		.img-right {
			width: 14rpx;
			height: 24rpx;

			image {
				width: 100%;
				height: 100%;
			}
		}
	}

	.list-cell {
		display: flex;
		align-items: baseline;
		margin: 100rpx 30rpx 0 30rpx;
		line-height: 80rpx;
		height: 80rpx;
		position: relative;
		background: $bgBaseBg;
		border-radius: 10rpx;
		justify-content: center;

		&.log-out-btn {
			margin-top: 40rpx;

			.cell-tit {
				color: #fff;
				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(0.84);
		}
	}
</style>
