<template>
	<view>
		<uni-nav-bar id="nav-bar" status-bar="true" @clickLeft="onBack()" :title="title" color="#000000" fixed="true"
			:border="false">
			<view slot="left">
				<view class=" flex align-center margin-left">
					<image class="p-left-arrow" src="../../../static/p-left-arrow.png"></image>
				</view>
			</view>

		</uni-nav-bar>
		<view class="card-view settings-item" v-for="(item,index) in list" :key="index">
			<view class="content position-relative" @tap="onNavTo(item)">
				<text class="text-black text-regular text-16px margin-left-xl">{{item.gameName}}</text>
				<view v-if="index == 0" class="position-absolute-center">
					<view class="text-gray" style="text-align: end;margin-right: 88rpx; line-height: 100rpx;">
						{{setPasswordFirstTime?'未设置':'已设置'}}
					</view>
				</view>
				<view class="only-arrow"></view>
			</view>
		</view>
	</view>
</template>

<script>
	import reqUtil from "@/util/util-js/requstUtil.js"
	import config from "@/common/config.js"
	import {
		mapState
	} from 'vuex';
	export default {
		computed: mapState(['platform', 'gamePlatform', 'setPasswordFirstTime', 'phoneNumber', 'mailboxNumber']),
		data() {
			return {
				list: [{
					gameName: '设置密码',
					navType: 'password'
				}, {
					gameName: '新手指导',
					navType: 'guide'
				}, {
					gameName: '意见反馈',
					navType: 'feedback'
				}],
				title: "设置",
				type: '',
				page: 1,
				size: 10,
				bDontUpdate: false
			}
		},
		onLoad(option) {



		},
		methods: {

			onBack() {
				uni.navigateBack({
					delta: 1
				})
			},

			onNavTo(item) {
				// console.log(item);
				let url = '';
				switch (item.navType) {
					case 'password':
						if (this.phoneNumber == '' && this.mailboxNumber == '') {

							uni.showToast({
								icon: 'none',
								title: '  请先点击头像进绑定手机号或邮箱才可以设置密码!',
								duration: 3000,
								mask: true
							})
							return;
						}
						//todo 判断密码是否已经设置。如果没有，进入设置密码，如果已经设置了，进入修改密码；
						url = '/pages/login-page/pwd/pwd?bModify=' + !this.setPasswordFirstTime;
						break;
					case 'guide':
						url = '/pages/platform-page/guide/guide';
						break;
					case 'feedback':
						url = '/pages/login-page/feedback/feedback';
						break;
				}


				uni.navigateTo({
					url: url,
					success: res => {},
					fail: () => {},
					complete: () => {}
				});
			}
		}
	}
</script>

<style>
	.content {
		display: flex;
		flex-direction: row;
		align-items: center;
		height: 50px;
	}

	.settings-item {
		position: relative;
		background-color: #FFFFFF;
		border-radius: 10px;
	}
</style>
