<template>
	<view class="pad-x120">
		<!-- 头部 -->
		<status-nav navBarTitle="评定记录"></status-nav>
		<view class="content" :style="{'padding-top':statusHeight+50+'px'}">
			<!-- 概况 -->
			<view class="evaluate-record bg-white">
				<view class="item font26">
					<view class="info enter-info">
						<text>工地：{{evaluateInfo.worksite_name}}</text>
						<text>姓名：{{evaluateInfo.real_name}}</text>
					</view>
					<view class="new-star">
						<text class="font24 color-blue">最新评定：</text>
						<image src="/static/icon//icon-star-active.png" mode="widthFix" v-for="(item,index) in parseInt(evaluateInfo.star)" :key="index"></image>
						<image src="/static/icon/icon-star.png" mode="widthFix" v-for="(item,index) in 5-parseInt(evaluateInfo.star)" :key="index"></image>
					</view>
				</view>
			</view>
			<!-- 列表 -->
			<view class="evaluate-list bg-white">
				<view class="list" v-for="(item,index) in evaluateList" :key="index">
					<view class="title font26">{{index}}评定列表</view>
					<view class="item" v-for="(item1,index1) in item" :key="index">
						<text class="font24">{{item1.year}}年{{item1.month}}月</text>
						<view class="star">
							<image src="/static/icon//icon-star-active.png" mode="widthFix" v-for="(item2,index2) in parseInt(item1.star)" :key="index1"></image>
							<image src="/static/icon/icon-star.png" mode="widthFix" v-for="(item2,index2) in 5-parseInt(item1.star)" :key="index1"></image>
						</view>
					</view>
				</view>
			</view>
		</view>
		<!-- 尾部 -->
		<tabbar :userType="userType" current="2"></tabbar>
	</view>
</template>
<script>
	import tabbar from '@/components/tabbar/tabbar';
	export default {
		components:{
			tabbar
		},
		data() {
			return {
				statusHeight:uni.getSystemInfoSync().statusBarHeight, //状态栏高度
				userType:'director', //账户类型 工人：worker 负责人：director
				evaluateInfo:{}, //评定概况
				evaluateList:[], //评定记录
				worker_id:0, //工人id
			}
		},
		onLoad(op) {
			if(op.id){
				this.worker_id = op.id;
			}
			// 获取评级列表
			this.getEvaluateList();
		},
		onShow() {
			
		},
		methods: {
			// 获取评级列表
			getEvaluateList(){
				let params = {
					worksite_id:uni.getStorageSync('baseWorksiteId'),
					account_id:this.worker_id
				}
				this.$requst.get('/api/v1/user/star-list',params).then(res=>{
					if(res.code==0){
						console.log(res,'评级列表');
						this.evaluateInfo = res.data.info;
						this.evaluateList = res.data.list;
					}
				})
			},
		}
	}
</script>
<style scoped>
	
</style>