<template>
	<view>
		<view class="bg">
			<view class="user-info">
				<image src="../../static/def.jpg" mode=""></image>
				<view @tap="login()" v-if="!userInfo.name">未登录，去登录</view>
				<view v-else>欢迎您!{{userInfo.name}}</view>
			</view>
		</view>
		<view>
			<view class="list" @tap="editPsd()">
				<view class="left">
					<image class="xgmi" src="../../static/xg.png" mode=""></image>
					<view>修改密码</view>
				</view>
				<image class="next-icon"  src="../../static/next.png"></image>
			</view>
		</view>
		<view>
			<view class="list">
				<view class="left">
					<view>版本号</view>
				</view>
				<text>{{versionCode}}</text>
			</view>
		</view>
		<button class="logout" type="primary" v-if="userInfo.name" @tap="logout">退出登录</button>
	</view>
</template>

<script>
	import { mapGetters, mapMutations } from 'vuex';
	import {authSee} from "../../api/user.js"
	export default {
		computed: {
			...mapGetters(['userInfo', 'roleType'])
			
		},
		onShow() {
			
		},
		onLoad() {
			
		},
		data() {
			return {
				status:0,
				ifJump:0,
				versionNo:'',
				versionCode:'1.0.1'
			};
		},methods:{
			...mapMutations(['setToken', 'setUserInfo']),
			editPsd(){
				uni.navigateTo({
					url: '../editePsd/editePsd',
					success: res => {},
					fail: () => {},
					complete: () => {}
				});
			},
			login(){
				uni.navigateTo({
					url: '../login/login',
					success: res => {},
					fail: () => {},
					complete: () => {}
				});
			},
			
			logout(){
				this.$functions.confirm("是否确认退出登录").then(()=>{
					this.setToken("");
					this.setUserInfo({});
					uni.reLaunch({
						url:"../login/login"
					})
				})
			},
		}
	}
</script>

<style lang="scss">
@import "./index.scss"
</style>
