<template>
	<view>
		<view class="list">
			<view class="item" v-for="(item,index) in list" :key="index">
				<view class="title">{{item.title}}</view>
				<view class="box">
					<view class="box_item"
					:style="{backgroundImage:'url('+ item_2.picture +')'}"
					v-for="(item_2,index_2) in item.special_list" :key="index_2" @click="go_h5(item_2.id,item_2.name)">
						<view class="time">有效时间：{{item_2.start_time}}——{{item_2.end_time}}</view>
						<view class="inner"> 
							<view class="left">
								{{item_2.name}}
							</view>
							<view class="right" @click.stop="go_ranking(item_2.id)">
								<image src="./icon/rank.png" mode="aspectFill"></image>
							</view>
						</view>
						<view class="bottom">
							<view class="line">
								<view class="line_box" :style="{width: + item_2.percent_complete + '%'}"></view>
							</view>
							<view class="num">{{item_2.percent_complete.toFixed(2)}}%</view>
						</view>
					</view>
				</view>
			</view>
		</view>
	</view>
</template>
<script>
	export default {
		name: "t-o-news-tab-3",
		data() {
			return {
				list: [],
			};
		},
		created() {
			this.get_jigsawPuzzle_specialList()
		},
		methods: {
			get_jigsawPuzzle_specialList() {
				this.$api.jigsawPuzzle_specialList({
					staff_num:uni.getStorageSync('user').staff_num
				}).then((res) => {
					console.log(res.data.data)

					const data = res.data.data

					// data.forEach((item, index) => {
					// 	this.list = this.list.concat(item.special_list)
					// })
					this.list = res.data.data
					// console.log(this.list)
				})
			},
			go_h5(id,name) {
				// uni.navigateTo({
				// 	url: "../../origanization/news/tab_3/h5/h5?id="+id
				// })
				
				uni.navigateTo({
					url: "../../origanization/news/tab_3/pin_tu/picture_list/picture_list?id="+id+"&title="+name
				})
			},
			go_ranking(id){
				uni.navigateTo({
					url:"../../origanization/news/tab_3/ranking/ranking?id="+id
				})
			}
		}
	}
</script>

<style lang="scss">
	.list {
		box-sizing: border-box;
		padding: 0 25rpx;

		.item {
			width: 700rpx;
			margin-bottom: 20rpx;

			box-sizing: border-box;
			padding: 20rpx;
			

			background: #FFFFFF;
			border-radius: 20rpx;

			.title{
				line-height: 80rpx;
				font-size: 42rpx;
				font-weight: 700;
				color: #00A0E8;
			}
			.box{
				margin-top: 10rpx;
				.box_item{
					margin-bottom: 20rpx;
					// background-image: url(./icon/bg.png);
					background-size: 100% 100%;
					background-repeat: no-repeat;
					border-radius: 20rpx;
					
					box-sizing: border-box;
					padding: 20rpx 30rpx;
					
					.time{
						color: #FFFFFF;
						font-size: 28rpx;
					}
					.inner{
						margin-top: 20rpx;
						display: flex;
						justify-content: space-between;
						align-items: center;
						.left{
							color: #FFFFFF;
						}
						.right{
							margin-left: 20rpx;
							image{
								width: 58rpx;
								height: 64rpx;
								display: block;
							}
						}
					}
					.bottom {
						margin-top: 20rpx;
						display: flex;
						align-items: center;
					
						.line {
							width:520rpx;
							height: 6rpx;
							background-color: #FFFFFF33;
							border-radius: 10rpx;
					
							.line_box {
								width: 36%;
								height: 6rpx;
								background-color: #FFFFFF;
								border-radius: 10rpx;
							}
						}
					
						.num {
							margin-left: 10rpx;
							font-size: 24rpx;
							color: #FFFFFF;
						}
					}
				}
			}
		}
	}
</style>
