{extend name="main"}
{block name="style"}
<style type="text/css">
.w-600px{width: 400px;}
.lable-title{font-size: .8rem;padding: .5rem;}
.hover-box-shadow:hover{box-shadow: 0 2px 4px rgba(0, 0, 0, .12), 0 0 6px rgba(0, 0, 0, .04) }
.bg-light{background-color: #F5F7FB !important;height: 80px;}
.hover-border-light{border:solid 1px #F5F7FB;}
.hover-border-light:hover{border-color: #e7efff;}
.el-divider__text, .el-link{font-weight: normal;}
.bg-light-primary{background-color: #f0f7fe;}
.hover-border-light-primary{border:solid 1px #f0f7fe;}
.hover-border-light-primary:hover{border-color: #b0c9e2;}
.bg-light-success{background-color: #e2f9e7;}
.hover-border-light-success{border:solid 1px #e2f9e7;}
.hover-border-light-success:hover{border-color: #b8e2c1;}
.bg-light-danger{background-color: #ffe8ea;}
.hover-border-light-danger{border:solid 1px #ffe8ea;}
.hover-border-light-danger:hover{border-color: #eebabf;}
.h3{color: #6c757d;}
.w-300px{width: 300px;}
.w-260px{width: 260px;}
.el-tabs .el-tabs__header .el-tabs__item{height: 40px;line-height: 40px;}
.style-FFCC7F{border: solid 1px #FFCC7F;border-top-width: 6px;}
.style-FFA8A7{border: solid 1px #FFA8A7;border-top-width: 6px;}
.style-96C5F7{border: solid 1px #96C5F7;border-top-width: 6px;}
.style-8EA9F2{border-left: solid 6px #8EA9F2;}
</style>
{/block}
{block name="body"}
<div class="flex">
<div class="flex-1 pr-3">
	<div class="flex pb-3">
		<div class="flex-1 pr-3">
			<div class="bg-white hover-box-shadow mb-3">
				<div class="lable-title text-secondary flex flex-center border-bottom">
					<img src="__TEMPLATE_STATIC__/img/icon-4.png">
					<div class="flex-1 pl-2">今日企业数据</div>
				</div>
				<div class="row px-4 py-3">
					<div class="col-sm px-2 py-3">
						<div class="bg-light rounded p-3 pointer hover-border-light flex flex-center"
						@click="window.open('/user')">
							<img src="__TEMPLATE_STATIC__/img/icon-home-1.png">
							<div class="flex-1 pl-3">
								<div class="text-truncate text-secondary">新增会员</div>
								<div class="h4 mb-0">{{statistics.company_new_user}}</div>
							</div>
						</div>
					</div>
					<div class="col-sm px-2 py-3">
						<div class="bg-light rounded p-3 pointer hover-border-light flex flex-center"
						@click="window.open('/jobs')">
							<img src="__TEMPLATE_STATIC__/img/icon-home-3.png">
							<div class="flex-1 pl-3">
								<div class="text-truncate text-secondary">发布职位</div>
								<div class="h4 mb-0">{{statistics.company_jobs_sum}}</div>
							</div>
						</div>
					</div>
					<div class="col-sm px-2 py-3">
						<div class="bg-light rounded p-3 pointer hover-border-light flex flex-center"
						@click="window.open('/jobs')">
							<img src="__TEMPLATE_STATIC__/img/icon-home-4.png">
							<div class="flex-1 pl-3">
								<div class="text-truncate text-secondary">职位刷新</div>
								<div class="h4 mb-0">{{statistics.company_jobs_refresh}}</div>
							</div>
						</div>
					</div>
					<div class="col-sm px-2 py-3">
						<div class="bg-light rounded p-3 pointer hover-border-light flex flex-center"
						@click="window.open('/resume/resume-downloaded')">
							<img src="__TEMPLATE_STATIC__/img/icon-home-6.png">
							<div class="flex-1 pl-3">
								<div class="text-truncate text-secondary">简历下载</div>
								<div class="h4 mb-0">{{statistics.company_download_resume}}</div>
							</div>
						</div>
					</div>
					<div class="col-sm px-2 py-3">
						<div class="bg-light rounded p-3 pointer hover-border-light flex flex-center"
						@click="window.open('/orders')">
							<img src="__TEMPLATE_STATIC__/img/icon-home-5.png">
							<div class="flex-1 pl-3">
								<div class="text-truncate text-secondary">完成订单</div>
								<div class="h4 mb-0">{{statistics.company_order}}</div>
							</div>
						</div>
					</div>
				</div>
			</div>
			<div class="bg-white hover-box-shadow">
				<div class="lable-title text-secondary flex flex-center border-bottom">
					<img src="__TEMPLATE_STATIC__/img/icon-5.png">
					<div class="flex-1 pl-2">今日个人数据</div>
				</div>
				<div class="row px-4 py-3">
					<div class="col-sm px-2 py-3">
						<div class="bg-light rounded p-3 pointer hover-border-light flex flex-center"
						@click="window.open('/user')">
							<img src="__TEMPLATE_STATIC__/img/icon-home-1.png">
							<div class="flex-1 pl-3">
								<div class="text-truncate text-secondary">新增会员</div>
								<div class="h4 mb-0">{{statistics.personal_new_user}}</div>
							</div>
						</div>
					</div>
					<div class="col-sm px-2 py-3">
						<div class="bg-light rounded p-3 pointer hover-border-light flex flex-center"
						@click="window.open('/resume')">
							<img src="__TEMPLATE_STATIC__/img/icon-home-7.png">
							<div class="flex-1 pl-3">
								<div class="text-truncate text-secondary">新增简历</div>
								<div class="h4 mb-0">{{statistics.personal_resume}}</div>
							</div>
						</div>
					</div>
					<div class="col-sm px-2 py-3">
						<div class="bg-light rounded p-3 pointer hover-border-light flex flex-center"
						@click="window.open('/resume')">
							<img src="__TEMPLATE_STATIC__/img/icon-home-4.png">
							<div class="flex-1 pl-3">
								<div class="text-truncate text-secondary">简历刷新</div>
								<div class="h4 mb-0">{{statistics.personal_refresh}}</div>
							</div>
						</div>
					</div>
					<div class="col-sm px-2 py-3">
						<div class="bg-light rounded p-3 pointer hover-border-light flex flex-center"
						@click="window.open('/jobs/delivery_resume')">
							<img src="__TEMPLATE_STATIC__/img/icon-home-2.png">
							<div class="flex-1 pl-3">
								<div class="text-truncate text-secondary">投递简历</div>
								<div class="h4 mb-0">{{statistics.personal_delivery_resume}}</div>
							</div>
						</div>
					</div>
					<div class="col-sm px-2 py-3">
						<div class="bg-light rounded p-3 pointer hover-border-light flex flex-center"
						@click="window.open('/orders')">
							<img src="__TEMPLATE_STATIC__/img/icon-home-5.png">
							<div class="flex-1 pl-3">
								<div class="text-truncate text-secondary">完成订单</div>
								<div class="h4 mb-0">{{statistics.personal_order}}</div>
							</div>
						</div>
					</div>
				</div>
			</div>
		</div>
		<div class="w-260px bg-white wrap hover-box-shadow">
			<div class="lable-title text-secondary flex flex-center border-bottom">
				<img src="__TEMPLATE_STATIC__/img/icon-1.png">
				<div class="flex1 pl-2">今日收益情况</div>
			</div>
			<div class="p-3 flex1 wrap">
				<div class="text-center style-FFCC7F mb-3 flex1 flex flex-center">
					<div class="flex-1">
						<div class="h4 mb-0">￥{{statistics.company_order_price+statistics.personal_order_price}}</div>
						<div class="text-truncate text-secondary">总收益</div>
					</div>
				</div>
				<div class="text-center style-FFA8A7 mb-3 flex1 flex flex-center">
					<div class="flex-1">
						<div class="h4 mb-0">￥{{statistics.company_order_price}}</div>
						<div class="text-truncate text-secondary">企业收益</div>
					</div>
				</div>
				<div class="text-center style-96C5F7 flex1 flex flex-center">
					<div class="flex-1">
						<div class="h4 mb-0">￥{{statistics.personal_order_price}}</div>
						<div class="text-truncate text-secondary">个人收益</div>
					</div>
				</div>
			</div>
		</div>
	</div>
	<div class="p-3 bg-white hover-box-shadow mb-3">
		<el-tabs v-model="ChartsSeriesAlias">
		    <el-tab-pane label="注册数" name="user"></el-tab-pane>
		    <el-tab-pane label="投递数" name="delivery"></el-tab-pane>
		    <el-tab-pane label="订单数" name="order"></el-tab-pane>
		</el-tabs>
		<div class="mt-4 overflow-hidden" id="charts"></div>
	</div>
	<div class="bg-white hover-box-shadow">
		<div class="lable-title text-secondary flex flex-center border-bottom">
			<img src="__TEMPLATE_STATIC__/img/icon-2.png">
			<div class="flex1 pl-2">系统信息</div>
		</div>
		<div class="row px-4">
			<div class="col-2 p-2">
				<div class="rounded p-3">
					<div class="small text-truncate">服务器系统</div>
					<div class="h5">{$System.sys}</div>
				</div>
			</div>
			<div class="col-4 p-2">
				<div class="rounded p-3">
					<div class="small text-truncate">系统版本</div>
					<div class="h5">{$System.sys_r}</div>
				</div>
			</div>
			<div class="col-2 p-2">
				<div class="rounded p-3">
					<div class="small text-truncate">WEB服务</div>
					<div class="h5">{$System.software}</div>
				</div>
			</div>
			<div class="col-2 p-2">
				<div class="rounded p-3">
					<div class="small text-truncate">MySql</div>
					<div class="h5">{$System.mysql_version}</div>
				</div>
			</div>
			<div class="col-2 p-2">
				<div class="rounded p-3">
					<div class="small text-truncate">PHP</div>
					<div class="h5">{$System.php_version}</div>
				</div>
			</div>
		</div>
	</div>
</div>
<div class="w-600px">
	<div class="bg-white mb-3 hover-box-shadow">
		<div class="lable-title text-secondary flex flex-center border-bottom">
			<img src="__TEMPLATE_STATIC__/img/icon-timer.png">
			<div class="flex1 pl-2">今日待办</div>
		</div>
		<div class="px-4">
			<div class="row text-center py-2">
				<div class="col-6 p-2">
					<div class="style-8EA9F2 rounded p-3 pointer shadow"
					@click="window.open('/company/attestation?status=0')">
						<div class="h4">{{todo_statistics.company_attestation}}</div>
						<div class="text-truncate text-secondary">待认证企业</div>
					</div>
				</div>
				<div class="col-6 p-2">
					<div class="style-8EA9F2 rounded p-3 pointer shadow"
					@click="window.open('/jobs?examine=0')">
						<div class="h4">{{todo_statistics.company_jobs_examine}}</div>
						<div class="text-truncate text-secondary">待审核职位</div>
					</div>
				</div>
				<div class="col-6 p-2">
					<div class="style-8EA9F2 rounded p-3 pointer shadow"
					@click="window.open('/company/demeanor?status=0')">
						<div class="h4">{{todo_statistics.company_demeanor}}</div>
						<div class="text-truncate text-secondary">待审核企业风采</div>
					</div>
				</div>
				<div class="col-6 p-2">
					<div class="style-8EA9F2 rounded p-3 pointer shadow">
						<div class="h4">{{todo_statistics.written_off}}</div>
						<div class="text-truncate text-secondary">注销账号申请</div>
					</div>
				</div>
				<div class="col-6 p-2">
					<div class="style-8EA9F2 rounded p-3 pointer shadow"
					@click="window.open('/resume?examine=0')">
						<div class="h4">{{todo_statistics.resume_examine}}</div>
						<div class="text-truncate text-secondary">待审核简历</div>
					</div>
				</div>
				<div class="col-6 p-2">
					<div class="style-8EA9F2 rounded p-3 pointer shadow"
					@click="window.open('/resume/works?status=0')">
						<div class="h4">{{todo_statistics.resume_works}}</div>
						<div class="text-truncate text-secondary">待审核作品</div>
					</div>
				</div>
				<div class="col-6 p-2">
					<div class="style-8EA9F2 rounded p-3 pointer shadow"
					@click="window.open('/user/real_name?status=0')">
						<div class="h4">{{todo_statistics.real_name}}</div>
						<div class="text-truncate text-secondary">待认证用户</div>
					</div>
				</div>
				<div class="col-6 p-2">
					<div class="style-8EA9F2 rounded p-3 pointer shadow"
					@click="window.open('/feedback?status=0')">
						<div class="h4">{{todo_statistics.feedback}}</div>
						<div class="text-truncate text-secondary">待处理反馈</div>
					</div>
				</div>
			</div>
		</div>
	</div>
	<div class="bg-white mb-3 hover-box-shadow" v-if="xycmsArticleList.length>0">
		<div class="lable-title text-secondary flex flex-center border-bottom">
			<img src="__TEMPLATE_STATIC__/img/icon-3.png">
			<div class="flex1 pl-2">最新动态</div>
			<el-link 
			type="primary"
			href="https://www.xycms.com/article/classify/official"
			:underline="false"
			target="_blank">查看更多</el-link>
		</div>
		<div class="p-3">
			<div v-for="(v,index) in xycmsArticleList" class="flex flex-center py-1">
				<a :href="'https://www.xycms.com/article/content/'+v.id+'.html'" target="_blank" class="flex-1">{{v.title}}</a>
				<div class="text-secondary">{{XYBase.Date.date('Y-m-d',v.create_time*1000)}}</div>
			</div>
		</div>
	</div>
	<div class="bg-white mb-3 hover-box-shadow">
		<div class="lable-title text-secondary flex flex-center border-bottom">
			<img src="__TEMPLATE_STATIC__/img/icon-2.png">
			<div class="flex1 pl-2">版权信息</div>
			<el-link type="primary" :underline='false' :loading="true" @click="updateSystemVersion()">
			<el-badge is-dot :hidden="!SystemInfo.update">{{SystemInfo.update?'立即更新':'检查更新'}}</el-badge>
			</el-link>
		</div>
		<div class="p-3">
			<table class="table table-borderless table-sm">
				<tr>
					<td width="100" class="text-right text-secondary small">当前版本</td>
					<td class="text-primary small">{{SystemInfo.version_name}}</td>
				</tr>
				<tr v-if="SystemInfo.update">
					<td width="100" class="text-right text-secondary small">新版本</td>
					<td class="text-primary small">{{SystemInfo.new_version_name}}
					<a :href="SystemInfo.website+'/packages/version/'+SystemInfo.new_version_code" target="_blank" class="ml-2">查看</a>
					</td>
				</tr>
				<tr>
					<td class="text-right text-secondary small">授权版本</td>
					<td class="text-primary small">{{SystemInfo.authorization_type}}</td>
				</tr>
				<tr v-if="SystemInfo.new_authorization_type">
					<td class="text-right text-secondary small">新授权版本</td>
					<td class="text-primary small">{{SystemInfo.new_authorization_type}}</td>
				</tr>
				<tr>
					<td class="text-right text-secondary small">授权对象</td>
					<td class="text-primary small">{{SystemInfo.authorization_object}}</td>
				</tr>
				<tr>
					<td class="text-right text-secondary small">授权IP</td>
					<td class="text-primary small">{{SystemInfo.authorization_ip}}</td>
				</tr>
				<tr>
					<td class="text-right text-secondary small">上次检查时间</td>
					<td class="text-secondary small">{{SystemInfo.time}}</td>
				</tr>
			</table>
			<div class="small text-secondary">
				<div class="font-weight-bold">本系统版权归柳州新云网络科技有限公司所有。</div>
				<div>未获商业授权之前，您不得将本软件用于任何用途。购买商业授权请联系
				<a :href="SystemInfo.website" target="_blank">{{SystemInfo.website}}</a>。</div>
			</div>
		</div>
	</div>
</div>
</div>
{/block}
{block name="script"}
{js href="__PLUGIN_SRC__/Echarts/echarts.min.js"}
<script type="text/javascript">
var chart=null,chartDom=null;
var vm=new Vue({
el:'#app',
data:{
	view:XYBase.view,
	ChartsSeriesAlias:'user',
	SystemInfo:{empty name="SystemInfo"}{}{else/}{$SystemInfo|raw}{/empty},
	statistics:{
		company_new_user:'--',
		company_jobs_sum:'--',
		company_jobs_refresh:'--',
		company_download_resume:'--',
		company_order:'--',
		company_order_price:'--',
		personal_new_user:'--',
		personal_resume:'--',
		personal_refresh:'--',
		personal_delivery_resume:'--',
		personal_order:'--',
		personal_order_price:'--',
	},
	todo_statistics:{
		company_attestation:'--',
		company_jobs_examine:'--',
		company_demeanor:'--',
		written_off:'--',
		resume_examine:'--',
		resume_works:'--',
		real_name:'--',
		feedback:'--',
	},
	xycmsArticleList:[]
},
watch:{
    view:XYBase.viewWatch,
    ChartsSeriesAlias(val,oldVal){
    	if(chart){
    		chart.setOption({
			    legend:{
				    selected:{
				    		'注册用户':false,
				    		'个人用户':false,
				    		'企业用户':false,
				    		'投递简历':false,
				    		'面试邀请':false,
				    		'订单数量':false,
				    		'订单金额':false
				    	}
				    }
			})
    		switch(val){
    			case 'user':
		    		chart.setOption({
					    legend:{
						    selected:{
						    		'注册用户':true,
						    		'个人用户':true,
						    		'企业用户':true
						    	}
						    }
					})
    			break;
    			case 'delivery':
		    		chart.setOption({
					    legend:{
						    selected:{
						    		'投递简历':true,
						    		'面试邀请':true
						    	}
						    }
					})
    			break;
    			case 'order':
		    		chart.setOption({
					    legend:{
						    selected:{
						    		'订单数量':true,
						    		'订单金额':true
						    	}
						    }
					})
    			break;
    		}
    	}
    }
},
created(){
	XYBase.created(this);
	this.initStatistics();
	setInterval(function(){
		vm.initStatistics();
	},10000);
	this.initTodoStatistics();
	setInterval(function(){
		vm.initTodoStatistics();
	},5000);
	if (this.SystemInfo.time){
		var lastTime=Date.parse(this.SystemInfo.time)/1000;
		var time=new Date();
		if(time.getTime()/1000-lastTime>3600*24){
			setTimeout(()=>{
				this.inspectSystemVersion();
			},500)
		}else if(this.SystemInfo.update){
			this.showUpdateNotify();
		}
	}else if(!this.SystemInfo.time){
		setTimeout(()=>{
			this.inspectSystemVersion();
		},500)
	}else if(this.SystemInfo.update){
		this.showUpdateNotify();
	}
	this.getOfficialArticle();
},
methods:{
	getOfficialArticle(){
		var _this=this;
		$.getJSON('//www.xycms.com/article/classify/official?json=1',function(ret){
			if(ret){
				if(ret.code===0){
					_this.xycmsArticleList=ret.data.data;
				}
			}
		})
	},
	initStatistics(){
		var _this=this;
		$.getJSON('/ajax/statistics',function(ret){
			if(ret){
				if(ret.code===0){
					_this.statistics=ret.data;
				}
			}
		})
	},
	initTodoStatistics(){
		var _this=this;
		$.getJSON('/ajax/todo_statistics',function(ret){
			if(ret){
				if(ret.code===0){
					_this.todo_statistics=ret.data;
				}
			}
		})
	},
	updateSystemVersion(){
		if(this.SystemInfo.update){
	        this.$confirm('是否立即更新？', '提示', {
	          title:'更新提示',
	          confirmButtonText: '立即更新',
	          cancelButtonText: '取消',
	          type: 'warning'
	        }).then(() => {
				XYBase.updateSystemVersion();
	        }).catch(() => {
				XYBase.msg('已取消');
	        });
		}else{
			this.inspectSystemVersion();
		}
	},
	inspectSystemVersion(){
		var _this=this;
		XYBase.inspectSystemVersion(this,function(ret) {
			if(ret){
				if(ret.code===600){
					_this.SystemInfo=ret.data;
					_this.showUpdateNotify();
				}else if(ret.code===0){
					XYBase.success(ret.msg)
				}else{
					XYBase.msg(ret.msg)
				}
			}else{
				XYBase.error(XYBase.config.system_network_error);
			}
		});
	},
	showUpdateNotify(){
		this.$notify({
          title: '更新提示',
          message: '有新版是否更新？点击立即更新',
          position: 'bottom-right',
          iconClass:'el-icon-upload',
          showClose:false,
          duration:3000,
          onClick:()=>{
          	this.updateSystemVersion();
          }
        });
	}
}
});
$(function(){
$(window).resize(function(){
	bodyResizeChange();
});
initCharts();
initChartsStatistics();
});
function initChartsStatistics(){
	$.getJSON('/ajax/charts_statistics',function(ret){
		if(ret){
			if(ret.code===0){
				setChartsOption(ret.data)
			}
		}
	})
}
function bodyResizeChange(){
chartDom.style.height=parseInt($(window).height()*0.4)+'px';
chart&&chart.resize();
}
function initCharts() {
chartDom=document.getElementById('charts');
chartDom.style.height=parseInt($(window).height()*0.4)+'px';
chart = echarts.init(chartDom);
}
function setChartsOption(data) {
chart.setOption({
	yAxis: {
		title: {
			text: ''
		}
	},
	xAxis: {
        type: 'category',
        boundaryGap: false,
        data: data.time
    },
    legend: {
    	selected:{
    		'投递简历':false,
    		'面试邀请':false,
    		'订单数量':false,
    		'订单金额':false
    	},
        data: data.legend
    },
    series: data.series,
    tooltip: {
        trigger: 'axis'
    },
    grid: {
        left: '3%',
        right: '4%',
        bottom: '3%',
        containLabel: true
    },
});
}
</script>
{/block}