<template>
	<view class="container">
		<view class="setting-box" >
			<view class="setting-item" v-for="item in settingList" :key="item.title"  @click="navTo(item.path)">
				<view class="item-l">
					<image :src="item.imgUrl"></image>
					<text>{{item.title}}</text>
				</view>
				<text class="right cuIcon-right"></text>
			</view>
		</view>
		<button @click="loginOut">退出登录</button>
		
	</view>
</template>

<script>
	export default {
		data() {
			return {
				settingList: [
					{
						imgUrl: '../../../static/img/my/bangding.png',
						title: '绑定支付宝',
						path: '/pages/my/zhifubao'
					},
					{
						imgUrl: '../../../static/img/my/zhiwen.png',
						title: '隐私政策',
						path: '/pagesB/pages/member/mimi'
					},
					{
						imgUrl: '../../../static/img/my/xieyi.png',
						title: '用户协议',
						path: '/pagesB/pages/member/xieyi'
					},
					{
						imgUrl: '../../../static/img/my/yijian.png',
						title: '意见反馈',
						path: '/pagesB/pages/member/feedback'
					}
				]
			};
		},
		onShow() {

		},
		methods: {
			navTo(url) {
				console.log(url)
				let token = this.$queue.getData("token");
				if (token) {
					uni.navigateTo({
						url: url
					});
				} else {
					uni.navigateTo({
						url: '/pages/public/login'
					});
				}
			},
			//退出登录
			loginOut() {
				let that = this;
				uni.showModal({
					title: '退出提醒',
					content: '确定要退出登录么',
					success: e => {
						if (e.confirm) {
							that.$queue.logout();
							that.userId = '';
							that.avatar = '/static/img/logo.png';
							that.nickName = '';
							that.invitationCode = '';
							that.sumMoney = 0;
							that.money = 0;
							that.cashMoney = 0;
							that.oneUserCount = 0;
						}
					}
				});
			},
		}
	}
</script>

<style lang='scss'>
	page {
		background: #F6F6F6;
	}
	
	.setting-box{
		width: 698rpx;
		border-radius: 12rpx;
		background: #fff;
		margin: 30rpx auto 0;
		.setting-item{
			width: 100%;
			height: 72rpx;
			display: flex;
			align-items: center;
			justify-content: space-between;
			font-size: 28rpx;
			color: #000;
			border-bottom: 2rpx solid #EFEFEF;
			padding: 0 24rpx;
			.item-l{
				display: flex;
				align-items: center;
			}
			image{
				width: 32rpx;
				height: 32rpx;
				margin-right: 20rpx;
			}
		}
		.arrow-box{
			image{
				width: 32rpx;
				height: 32rpx;
			}
		}
	}
	button {
		width: 306rpx;
		height: 64rpx;
		line-height: 64rpx;
		background: linear-gradient(141deg, #FF4848 0%, #FF2929 100%);
		border-radius: 32rpx;
		font-size: 28rpx;
		color: #FFFFFF;
		margin-top: 70rpx;
	}
</style>
