<template>
	<view class="userInfo-container">
		<u-cell-group>
			<u-cell-item title="头像" :arrow="false" center>
				<u-avatar src="" :size="70" slot="right-icon"></u-avatar>
			</u-cell-item>
			<u-cell-item title="手机号码" value="15709284545" :arrow="false"></u-cell-item>
			<u-cell-item title="收货地址" index="0" @click="toPage"></u-cell-item>
			<u-cell-item title="支付密码" index="1" @click="toPage"></u-cell-item>
		</u-cell-group>
		<!-- 退出 -->
		<view class="user-btn">
			<u-button type="success" :custom-style="quitButton" @click="quitSys" shape="circle">退出登录</u-button>
		</view>
	</view>
</template>

<script>
	import {logout} from '@/api/login.js'
	export default {
		data() {
			return {
				quitButton: {
					borderRadius:'100rpx',
					fontSize:'30rpx',
					background: '#01c9b2'
				}
			}
		},
		onShow() {
		},
		onLoad() {
		},
		methods:{
			// 打开对应的页面
			toPage(index){
				let pageUrl=[
					'/pages/toOrder/editAddress',
					'/pages/userCenter/userInfo/changePayPwd'
					// '/pages/userCenter/userInfo/smsVerification'
					]
				uni.navigateTo({ url: pageUrl[index] })
			},
			// 退出登录
			quitSys(){
				let _this = this
				uni.showModal({
				  title: '提示',
				  content: '您确定要退出登录吗?',
				  success(res) {
				    if (res.confirm) {
				      logout({}).then(res => {
				       getApp().globalData.token = ''
				       _this.$u.vuex('vuex_token','')
					   // 关闭socket
					   _this.$store.commit("$closeWebsocket")
				        uni.reLaunch({
				        	url: '/pages/index/index'
				        })
				      })
				    }
				  }
				})
			}
		}
	}
</script>

<style lang="less">
	.userInfo-container{
		width: 100%;
		.logout-btn{
			width: 60%;
			margin-top: 200rpx;
		}
		.user-btn{
			padding: 85rpx 200rpx;
		}
	}
</style>
