<template>
	<view class="container">
		<view class="topBox">
			<u-navbar title="个人中心" :autoBack="false" leftIcon="" titleStyle="color:#ffffff">
			</u-navbar>
			<view class="userInfo">
				<image :src="userInfo.user.avatar||'/static/profile.jpg'" mode=""></image>
				<view>{{userInfo.user.nickName}}</view>
			</view>
		</view>
		<view class="list">
			<view class="item">
				<view class="item_l">
					<view class="item_l_icon" style="background: #AD5825;">
						<image src="/static/img/dept.png" mode=""></image>
					</view>
					<view class="item_l_title">所属部门</view>
				</view>
				<view class="item_r">{{userInfo.user.dept.deptName}} / {{userInfo.roleGroup}}</view>
			</view>
			<view class="item">
				<view class="item_l">
					<view class="item_l_icon" style="background: #FF9D34;">
						<image src="/static/img/phone.png" mode=""></image>
					</view>
					<view class="item_l_title">手机号</view>
				</view>
				<view class="item_r">{{userInfo.user.phonenumber}}</view>
			</view>
			<view class="item" @click="goDetail('pages/personalCenter/myFavorite')">
				<view class="item_l">
					<view class="item_l_icon" style="background: #E67B00;">
						<image src="/static/img/collect.png" mode=""></image>
					</view>
					<view class="item_l_title">我的收藏</view>
				</view>
				<view class="item_r"></view>
			</view>
			<view class="item" @click="goDetail('pages/personalCenter/trail')">
				<view class="item_l">
					<view class="item_l_icon" style="background: #E67300;">
						<image src="/static/img/browse.png" mode=""></image>
					</view>
					<view class="item_l_title">浏览记录</view>
				</view>
				<view class="item_r"></view>
			</view>

		</view>
	</view>
</template>

<script>
	import {
		userInfo
	} from "@/api/index.js"
	export default {
		data() {
			return {
				userInfo:{
					user:{
						dept:{}
					}
				}
			}
		},
		onShow(){
			this.getUserInfo()
		},
		methods: {
			goDetail(path) {
				uni.$u.route(path)
			},
			getUserInfo(){
				userInfo().then(res=>{
					this.userInfo=res.data
				})
			}
		}

	}
</script>

<style lang="scss">
	.topBox {
		width: 100vw;
		height: 430rpx;
		background: linear-gradient(103deg, #e83a27, #a42517 86%);

		.userInfo {
			text-align: center;
			color: #FFFFFF;
			margin-top: 110rpx;

			image {
				width: 126rpx;
				height: 126rpx;
				border-radius: 50%;
			}
		}
	}

	/deep/ .u-navbar__content {
		background: transparent !important;
	}

	.list {
		min-height: 50vh;
		background: url('../../static/img/myBg.png');
		background-size: cover;
		position: relative;
		top: -50rpx;
		padding: 100rpx 60rpx 0;

		.item {
			display: flex;
			justify-content: space-between;
			align-items: center;
			padding: 20rpx 0;
			border-bottom: 1rpx solid rgba(230, 230, 230, 0.6);

			.item_l {
				display: flex;
				align-items: center;
				font-size: 28rpx;
				color: #1A1A1A;

				.item_l_icon {
					width: 57rpx;
					height: 57rpx;
					border-radius: 50%;
					text-align: center;
					line-height: 70rpx;
					margin-right: 25rpx;

					image {
						width: 36rpx;
						height: 36rpx;
					}
				}

				.item_l_title {}
			}

			.item_r {
				font-size: 28rpx;
				color: #808080;
			}
		}
	}
</style>