<template>
	<view class="job-table">
		<view @click="goUnsubmittedJob(item)" v-for="(item,index) in list" :key='index' class="job-table-item">
			<view class="job-table-item-title">
				<view class="job-table-item-title-left">
					{{item.assignment_title}}
				</view>
				<view class="job-table-item-title-right">
					<!-- <view :style="`background-color: ${item.color};`" class="job-table-item-title-right-color">

					</view> -->
					<view :style="`  background-color:${color(item.assignment_status)}`" class="job-table-item-title-right-text">
						{{item.assignment_status_txt}}
					</view>
				</view>
			</view>
			<view class="job-table-item-content">
				<view class="job-table-item-img">
					<!-- 	<uni-file-picker readonly :value="item.imgs" :imageStyles="imageStyles" file-mediatype="image">
  		</uni-file-picker> -->
					<view @click="BlowUpImg(item,index1)" v-for="(item1,index1) in item.media_url" :key="index1"
						class="job-table-item-img-item">
						<image style="width: 100%;height: 100%;border-radius: 10rpx;" :src="item1" mode=""></image>
					</view>
				</view>

				<view class="job-table-item-date">
					<view style="display: flex;" class="job-table-item-date-left">
						<view style="width: 120rpx;margin-right: 10rpx;" class="">
							发布日期
						</view>
						<view class="">
							{{item.start_time}}
						</view>

					</view>
					<view style="display: flex;" class="job-table-item-date-right">
						<view style="width: 120rpx;margin-right: 10rpx;" class="">
							截止日期
						</view>
						<view class="">
							{{item.end_time}}
						</view>

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

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

<script>
	export default {
		name: "jobTable",
		props: {
			list: {
				type: Array,
				default: () => []
			}
		},
		data() {
			return {
				imageStyles: {
					width: 103,
					height: 103,
					border: {
						radius: 5
					}
				},

			};
		},
		methods: {
			color(val){
				 if(val == -1){
					  return '#FE6B6B'
				 }else if(val == 0) {
					  return '#43B3FF'
				 }else if(val == 1) {
					  return '#05CCA1'
				 }
			},
			BlowUpImg(item, index) {
				let arr = []
				item.media_url.forEach(item => {
					arr.push(item)
				})
				uni.previewImage({
					current: index,
					urls: arr
				})
			},
			goUnsubmittedJob(item) {
				this.$emit('click',item)
				
			}
		}
	}
</script>

<style lang="scss" scoped>
	.job-table {
		width: 100%;
		padding-bottom: 32rpx;

		.job-table-item {
			width: 100%;

			box-sizing: border-box;

			.job-table-item-content {
				background-color: #fff;
				padding: 32rpx;
				border-radius: 5.33px;
				box-shadow: 0px 0px 6.67px 0px rgba(147, 147, 147, 0.20);
				box-sizing: border-box;
				margin-bottom: 32rpx;
				box-sizing: border-box;
			}

			.job-table-item-img {
				margin-bottom: 32rpx;
			}

			.job-table-item-title {
				display: flex;
                justify-content: space-between;
				margin-bottom: 32rpx;
			}

			.job-table-item-title-left {
				font-size: 32rpx;
			}

			.job-table-item-title-right {
				display: flex;
				align-items: center;

				.job-table-item-title-right-text {
					color: #fff;
					padding: 0 10rpx;
					font-size: 24rpx;
					border-radius: 8rpx;
					margin-left: 20rpx;
				}

				.job-table-item-title-right-color {
					width: 16rpx;
					height: 16rpx;
					border-radius: 50%;
					margin-right: 20rpx;
				}
			}
		}

		.job-table-item-date {
			display: flex;
			justify-content: space-between;
			align-items: center;
			font-size: 24rpx;
			color: #999;

		}
	}

	.job-table-item-img {
		display: flex;
		flex-wrap: wrap;

		.job-table-item-img-item {
			width: 196rpx;
			height: 196rpx;
			border-radius: 10rpx;
			margin-right: 20rpx;
			margin-bottom: 20rpx;
		}

		.job-table-item-img-item:nth-child(3n) {
			margin-right: 0;
		}
	}
</style>