<template>
	<view class="content">
		<view class="bg"></view>
		<view class="cont-box">
			<view class="user-cont">
				<view class="user-box" v-if="user!=null">
					<view class="left">
						<image src="../../static/images/default.png"></image>
						<view class="user" >
							<view class="username">{{user.nickName}}</view>
							<view class="account">{{user.deptName}}</view>
						</view>
					</view>
					<view class="right" @click="navTo('/pages/user/userInfo')">
						<image src="../../static/images/right_arrow.png"></image>
					</view>
				</view>
				<view class="company" v-if="user!=null">
					<image src="../../static/images/icon_comp.png"></image>
					<view class="name">{{user.deptName}}</view>
				</view>
			</view>
			
			<view class="menu-box">
				<view class="title-box">
					<image class="icon" src="../../static/images/office.png"></image>
					<view class="title">常用功能</view>
				</view>
				<view class="line"></view>
				<view class="menus">
					<view class="menu-item" @click="navTo('/pages/user/ai/index')">
						<image src="../../static/images/menu_info.png"></image>
						<view class="m-name">AI客服</view>
					</view>
					<view class="menu-item" @click="navTo('/pages/user/qwSop/sop')">
						<image src="../../static/images/menu_info.png"></image>
						<view class="m-name">群发SOP</view>
					</view>
					<!-- <view class="menu-item" @click="navTo('/pages/user/courseSop/sop')">
						<image src="../../static/images/menu_info.png"></image>
						<view class="m-name">课程群发SOP</view>
					</view> -->
					<view class="menu-item" @click="navTo('/pages/courseManage/index')">
						<image src="../../static/images/menu_info.png"></image>
						<view class="m-name">看课管理</view>
					</view>
				</view>
				
			</view>
			<view class="menu-box">
				<view class="title-box">
					<image class="icon" src="../../static/images/office.png"></image>
					<view class="title">客户管理</view>
				</view>
				<view class="line"></view>
				<view class="menus">
					<view class="menu-item" @click="navTo('/pages/user/crm/lineCustomer')">
						<image src="../../static/images/menu_info.png"></image>
						<view class="m-name">线索客户</view>
					</view>
					<view class="menu-item" @click="navTo('/pages/user/crm/myCustomer')">
						<image src="../../static/images/menu_info.png"></image>
						<view class="m-name">我的客户</view>
					</view>
					<view class="menu-item" @click="navTo('/pages/user/crm/importWxUser')">
						<image src="../../static/images/menu_info.png"></image>
						<view class="m-name">导入微信用户</view>
					</view>
				</view>
			</view>
			<!-- <view class="menu-box">
				<view class="title-box">
					<image class="icon" src="../../static/images/office.png"></image>
					<view class="title">常用工具</view>
				</view>
				<view class="line"></view>
				<view class="menus">
					<view class="menu-item"  >
						<image src="../../static/images/menu_info.png"></image>
						<view class="m-name">制单</view>
					</view>
					<view class="menu-item"  >
						<image src="../../static/images/menu_info.png"></image>
						<view class="m-name">微信收款</view>
					</view>
					<view class="menu-item"  >
						<image src="../../static/images/menu_info.png"></image>
						<view class="m-name">支付宝收款</view>
					</view>
					<view class="menu-item"  >
						<image src="../../static/images/menu_info.png"></image>
						<view class="m-name">订单管理</view>
					</view>
					<view class="menu-item"  >
						<image src="../../static/images/menu_info.png"></image>
						<view class="m-name">商品套餐包</view>
					</view>
					<view class="menu-item"  >
						<image src="../../static/images/menu_info.png"></image>
						<view class="m-name">优惠券</view>
					</view>
				</view>
			</view> -->
			<view class="menu-box">
				<view class="title-box">
					<image class="icon" src="../../static/images/office.png"></image>
					<view class="title">其它工具</view>
				</view>
				<view class="line"></view>
				<view class="menus">
					<view class="menu-item" @click="navTo('/pages/user/users/users')">
						<image src="../../static/images/menu_info.png"></image>
						<view class="m-name">通讯录</view>
					</view>
				</view>
			</view>
			<view class="menu-box1">
				<view class="menu-item" @click="navTo('/pages/user/about')">
					<view class="left">
						<image src="../../static/images/icon_about_us.png"></image>
						<view class="label">关于我们</view>
					</view>
					<view class="right">
						<image src="../../static/images/right_arrow.png"></image>
					</view>
				</view>
				<view class="menu-item" @click="navTo('/pages/user/editUser')">
					<view class="left">
						<image src="../../static/images/icon_set.png"></image>
						<view class="label">设置</view>
					</view>
					<view class="right">
						<image src="../../static/images/right_arrow.png"></image>
					</view>
				</view>
			</view>
			<view class="btn-box" >
				<view class="sub-btn" @click="showLogout()">退出登录</view>
			</view>
		</view>
		<u-modal :show="show" title="提示" :showCancelButton="true"  @cancel="hideLogout()" @confirm="logout()" content='确认退出吗?'></u-modal>
	</view>
</template>

<script>
	
	import { getCompanyUser } from '@/api/user.js'
 
	export default {
		data() {
			return {
				show:false,
				user:null,
			}
		},
		onShow() {
			this.getCompanyUser()
		
		},
		methods: {
			
			showLogout(){
				this.show=true;
			},
			hideLogout(){
				this.show=false;	
			},
			logout(){
				this.utils.logout();
				uni.$emit('closeWebSocket');
				uni.reLaunch({
					url: '/pages/auth/login',
					animationType: 'pop-in',
					animationDuration: 100
				})
			},
			navTo(url){
				console.log(url)
				uni.navigateTo({
					url
				})
			},
			getCompanyUser(){
				var data = {
				};
				getCompanyUser(data).then(res => {
					if(res.code==200){
						this.user=res.data;
					}else{
						
					}
				});
			},
		}
	}
</script>

<style lang="scss">
	page{
		height: 100%;
		background: #f6f6f6;
	}
</style>
<style scoped lang="scss">
	.content{
		position: relative;
		height: 100%;
		width: 100%;
		.bg{
			width: 100%;
			height: 200upx;
			position: absolute;
			top: 0;
			left: 0;
			z-index: 1;
			background: linear-gradient(to bottom,#115296, #b4d8ff);
			// border-radius: 0rpx 0rpx 60rpx 60rpx;
		}
		.cont-box{
			position: relative;
			z-index: 2;
			padding: 30rpx 30rpx 200rpx;
			.user-cont{
				box-shadow: 0px 0px 5px 2px rgba(0,0,0,0.05);
				padding: 30rpx;
				background-color: #fff;
				border-radius: 15rpx;
				.user-box{
					width: 100%;
					display: flex;
					align-items: center;
					justify-content: flex-start;
					.left{
						flex:1;
						display: flex;
						align-items: center;
						justify-content: flex-start;
						image{
							border-radius: 50%;
							width:120rpx;
							height:120rpx;
						}
						.user{
							margin-left: 20rpx;
							width: calc(100% - 140rpx);
							display: flex;
							flex-direction: column;
							align-items: flex-start;
							justify-content: flex-start;
							.username{
								font-size: 38rpx;
								font-family: PingFang SC;
								color: #111;
								font-weight: bold;
							}
							.account{
								padding: 5rpx 20rpx;
								border-radius: 30rpx;
								background-color: #115296;
								margin-top: 20rpx;
								font-size: 24rpx;
								font-family: PingFang SC;
								color: #fff;
							}
						}
					}
					.right{
						image{
							width: 15rpx;
							height:30rpx;
						}
						
					}
					
				}
				.company{
					margin-top: 30rpx;
					display: flex;
					align-items: center;
					justify-content: flex-start;
					image{
						width:40rpx;
						height:40rpx;
					}
					.name{
						margin-left: 15rpx;
						font-size: 28rpx;
						color: #111;
					}
				}
			}
			
			.menu-box{
				box-shadow: 0px 0px 5px 2px rgba(0,0,0,0.05);
				width: 100%;
				margin-top: 30rpx;
				padding: 30rpx;
				background-color: #fff;
				border-radius: 15rpx;
				.title-box{
					display: flex;
					align-items: center;
					justify-content: flex-start;
					.icon{
						width: 30rpx;
						height:30rpx;
					}
					.title{
						margin-left: 10rpx;
						font-size: 28rpx;
						font-family: PingFang SC;
						color: #111;
					}
				}
				.line{
					margin-top: 15rpx;
					height: 0.5rpx;
					width: 100%;
					background-color: #efefef;
				}
				.menus{
					margin-top: 30rpx;
					display: flex;
					align-items: center;
					justify-content: flex-start;
					flex-wrap: wrap;
				}
				.menu-item{
					display: flex;
					flex-direction: column;
					align-items: center;
					justify-content: center;
					width: 25%;
					margin-bottom: 20rpx;
					image{
						width:60rpx;
						height:60rpx;
					}
					.m-name{
						margin-top: 10rpx;
						font-size: 24rpx;
						font-family: PingFang SC;
						color: #111;
					}
				}
				
			}
			.menu-box1{
				width: 100%;
				margin-top: 30rpx;
				padding: 0rpx 30rpx;
				background-color: #fff;
				border-radius: 15rpx;
				.menu-item{
					width: 100%;
					display: flex;
					align-items: center;
					justify-content: flex-start;
					line-height: 100rpx;
					.left{
						flex:1;
						display: flex;
						align-items: center;
						justify-content: flex-start;
						image{
							width: 30rpx;
							height:30rpx;
						}
						.label{
							margin-left: 10rpx;
						}
					}
					.right{
						image{
							width: 10rpx;
							height:15rpx;
						}
						
					}
				}
			}
		}
	}
	.btn-box{
		margin: 60rpx 0rpx 30rpx;
		display: flex;
		align-items: center;
		justify-content: center;
		.sub-btn{
			// box-shadow: 0px 0px 5px 2px rgba(0,0,0,0.05);
			border: 1rpx solid #f8f8f8;
			background: #FFFFFF;
			width: 100%;
			height: 88upx;
			line-height: 88upx;
			text-align: center;
			font-size: 30upx;
			font-family: PingFang SC;
			color: #111;
		}
	}
</style>
