<template>
	<view class="content">
		<!-- 头部 -->
		<headerIndex :isArea="false" :isLeft="false"></headerIndex>
		<!--  -->
		<view class="wxlist borderRadius">
			<view class="list" @click="navTo('/pages/me/manage')">
				<view class="item border-bottom">
					<view class="left">
						<view class="name">用户管理</view>
					</view>
					<view class="right">
						<uni-icons type="right"></uni-icons>
					</view>
				</view>
			</view>
			<!-- <view class="list" @click="navTo('/pages/card/card')">
				<view class="item border-bottom">
					<view class="left">
						<view class="name">卡片管理</view>
					</view>
					<view class="right">
						<uni-icons type="right"></uni-icons>
					</view>
				</view>
			</view> -->
			<view class="list" @click="navTo('/pages/score/history')">
				<view class="item border-bottom">
					<view class="left">
						<view class="name">估分历史</view>
					</view>
					<view class="right">
						<uni-icons type="right"></uni-icons>
					</view>
				</view>
			</view>
			<view class="list" @click="navTo('/pages/login/forgetPassword')">
				<view class="item border-bottom">
					<view class="left">
						<view class="name">重置密码</view>
					</view>
					<view class="right">
						<uni-icons type="right"></uni-icons>
					</view>
				</view>
			</view>
		</view>
		<view class="btn mb-15" v-if="token" @click="handleOutLogin">退出登录</view>
	</view>
</template>

<script>
	import headerIndex from "@/components/headerIndex.vue"
	export default {
		data() {
			return {
				token: ""
			}
		},
		components: {
			headerIndex
		},
		onLoad() {
			this.token = uni.getStorageSync('token')
		},
		methods: {
			handleOutLogin() {
				let that = this
				uni.showModal({
					title: '友情提示',
					content: '是否退出登录？',
					success: function(res) {
						if (res.confirm) {
							that.$model.getloginOut({}).then((res) => {
								if (res.code != 0) return
								console.log('确定退出', res)
								uni.clearStorageSync()
								uni.reLaunch({
									url: "/pages/login/login"
								})
							})
						} else if (res.cancel) {
							that.$tools.msg("您已取消操作！");
						}
					},
				})
			},
			navTo(url) {
				uni.navigateTo({
					url
				})
			},
		}
	}
</script>

<style scoped lang="scss">
	.wxlist {
		height: auto;
		overflow: hidden;
		position: relative;
		margin: 0 15px;
		background: #fff;
		border-radius: 10px;

		.item {
			width: auto;
			font-size: 14px;
			line-height: 45px;
			height: 45px;
			display: flex;
			justify-content: space-between;
			align-items: center;

			.left {
				display: flex;
				align-items: center;
			}
		}
	}

	.btn {
		width: auto;
		background: $btncolor;
		margin: 50px 15px 0 15px;
	}
</style>