<template>
	<view class="wrap">
		<view class="user-box">
			<view class="avatar-wrap">
				<u-avatar :src="vuex_user.avatar||pic" size="123"></u-avatar>
			</view>
			<view class="u-flex-1">
				<view class="user-name">{{vuex_user.officerName}}</view>
				<view class="user-post">工号:{{vuex_user.officerNo}}</view>
			</view>
		</view>
		<view class="feature-list">
			<view class="feature-item" @click="openPage('pages/center/reportList/reportList')">
				<view class="feature-left">
					<image src="../../static/img/icon-center-report.png" mode="widthFix"></image>
					异常记录
				</view>
				<view class="feature-right">
					<u-icon name="arrow-right"></u-icon>
				</view>
			</view>
			<view class="feature-item" @click="openPage('pages/center/resetPass/resetPass')">
				<view class="feature-left">
					<image src="../../static/img/icon-center-mima.png" mode="widthFix"></image>
					修改密码
				</view>
				<view class="feature-right">
					<u-icon name="arrow-right"></u-icon>
				</view>
			</view>
			<view class="feature-item" @click="loginOut">
				<view class="feature-left">
					<image src="../../static/img/icon-center-tuichu.png" mode="widthFix"></image>
					退出登录
				</view>
				<view class="feature-right">
					<u-icon name="arrow-right"></u-icon>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				pic:'/static/img/default-avatar.png',
				orderStatis:{},
			}
		},
		onLoad() {
			// this.getOrderStatis();
		},
		methods: {
			openPage(path,param) {
			  this.$u.route({
			    url: path,
				params:{
					param:param
				}
			  })
			},
			loginOut(){
				this.$u.api.getLoginOut().then(res=>{
					if(res.code==200){
						console.log('getLoginOut',res);
						this.$u.vuex('vuex_user', '');
						// localStorage.setItem('backUrl', '');
						uni.navigateTo({
							url: '../login/login'
						});
					}else{
						uni.showToast({
							icon:'none',
							title:res.msg
						})
					}
					console.log('res',res);
				}).catch(err=>{
					console.log('err',err);
				})
			},
			getOrderStatis(){
				this.$u.api.getOrderStatis().then(res=>{
					if(res.code==200){
						console.log('getOrderStatis',res);
						this.orderStatis = res.data;
					}else{
						uni.showToast({
							icon:'none',
							title:res.msg
						})
					}
					console.log('res',res);
				}).catch(err=>{
					console.log('err',err);
				})
			}

		}
	}
</script>

<style lang="scss" scoped>
	page{background-color: #fff;}
	@import  './center.scss'
</style>
