<template>
	<view>
		<uni-list>
			<uni-list-item :show-extra-icon="true" showArrow :extra-icon="phoneIcon" title="手机号" :rightText="info.phone" clickable @click="toPage('../phone/phone')" />
			<uni-list-item :show-extra-icon="true" showArrow :extra-icon="mailIcon" title="邮箱" :rightText="info.email" clickable @click="toPage('../email/email')" />
			<uni-list-item :show-extra-icon="true" showArrow :extra-icon="accountIcon" title="账号" :rightText="info.account" clickable @click="toPage('../account/account')" />
			<uni-list-item :show-extra-icon="true" showArrow :extra-icon="pwdIcon" title="密码" rightText="******" clickable @click="toPage('../password/password')" />
		</uni-list>
		
		<view class="logout" @click="logout">退出登录</view>
	</view>
</template>

<script>
	import { my } from '@/apis/modules/parner.js'
	export default {
		data() {
			return {
				phoneIcon: {
					color: '#007eff',
					size: '22',
					type: 'phone'
				},
				mailIcon: {
					color: '#007eff',
					size: '22',
					type: 'email'
				},
				accountIcon: {
					color: '#007eff',
					size: '22',
					type: 'person'
				},
				pwdIcon: {
					color: '#007eff',
					size: '22',
					type: 'locked'
				},
				info: {
					account: '',
					phone: '',
					email: ''
				},
			}
		},
		onShow() {
			this.getInfo()
		},
		methods: {
			// 获取个人信息
			getInfo() {
				const { partnerId, teamId } = uni.getStorageSync('team')
				my({
					partnerId,
					teamId
				}).then(({ my }) => {
					this.info = my.info
				}).catch(e => {})
			},
			toPage(path) {
				this.$util.to(path)
			},
			// 退出登录
			logout() {
				const that = this
				uni.showModal({
					title: '提示',
					content: '确定要退出账号吗？',
					success(res) {
						if (res.confirm) {
							uni.clearStorageSync()
							that.$util.to('/pages/login/login')
						}
					}
				})
			}
		}
	}
</script>

<style scoped lang="scss">
.logout {
	padding: 30rpx 0;
	margin-top: 30rpx;
	font-size: 28rpx;
	color: #333;
	text-align: center;
	background-color: #fff;
}
</style>
