<template>
	<view class="dl-components">
		<view v-for="(item,index) in dataList" class="dl-notice-box" @click="goDetail(item)">
			<view class="dl-is-urgent" v-if="'1'==item.isUrgent">急招</view>
			<view class="dl-is-platform" v-if="'1'==item.isPlatformFree && '1'!=item.isUrgent">平台结算</view>
			<view class="dl-is-platform-2" v-if="'1'==item.isPlatformFree  && '1'==item.isUrgent">平台结算</view>
			<view class="dl-notice-title">
				<image class="dl-image" :src="'/static/platform/'+item.platformCode+'.png'" mode="aspectFit">
				</image>
				<view class="dl-text">{{item.title}}</view>
			</view>
			<view class="dl-notice-content">
				<view class="left-text">
					<view class="text-item">
						<image class="dl-icon" src="@/static/index/money.png" mode="aspectFit"></image>
						<view class="dl-content">奖励：¥{{item.feeDown}}-{{item.feeUp==null?'无上限':item.feeUp}}</view>
					</view>
					<view class="text-item">
						<image class="dl-icon" src="@/static/index/my.png" mode="aspectFit"></image>
						<view class="dl-content">
							粉丝：{{formatNumberWithUnits(item.fansDown)}}-{{formatNumberWithUnits(item.fansUp)}}</view>
					</view>
					<view class="text-item" style="border-bottom: 1rpx solid #F4F4F4;padding-bottom: 10rpx;">
						<image class="dl-icon" src="@/static/index/xing.png" mode="aspectFit"></image>
						<view class="dl-content">类型：{{item.bloggerTypesText||'无限制'}}</view>
					</view>
					<view class="text-item" style="padding-top: 16rpx;">
						<view class="item-box" style="flex: 1;">
							<image class="dl-icon2" :src="imageUrl+item.avatar" mode="scaleToFill"></image>
							<view class="dl-item-right">{{item.userNickName}}</view>
						</view>
						<!-- 			<view class="item-box" style="width: 28%;">
							<image class="dl-icon3" src="@/static/index/person.png" mode="aspectFit"></image>
							<view class="dl-item-right dl-number">{{item.reportNum}}</view>
						</view> -->
						<view class="item-box" style="width: 35%;">
							<image class="dl-icon3" src="@/static/index/eye.png" mode="aspectFit"></image>
							<view class="dl-item-right dl-number">{{item.viewNum}}</view>
						</view>
						<!-- <view class="item-box" style="width: 25%;">

							<view>
								{{item.isPlatformFree==1?'平台结算':''}}
							</view>
						</view> -->
					</view>
				</view>
				<image class="right-image" :src="imageUrl+item.mainImage" mode="aspectFit"></image>
			</view>
		</view>
		<!-- 单个数据 -->
		<view v-if="null!=dataObj" class="dl-notice-box no-bg" @click="goDetail(item)">
			<view class="dl-notice-title">
				<image class="dl-image" :src="'/static/platform/'+dataObj.platformCode+'.png'" mode="aspectFit"></image>
				<view class="dl-text">{{dataObj.title}}</view>
			</view>
			<view class="dl-notice-content">
				<view class="left-text">
					<view class="text-item">
						<image class="dl-icon" src="@/static/index/money.png" mode="aspectFit"></image>

						<view class="dl-content">奖励：¥{{dataObj.feeDown}}-{{dataObj.feeUp==null?'无上限':dataObj.feeUp}}
						</view>
					</view>
					<view class="text-item">
						<image class="dl-icon" src="@/static/index/my.png" mode="aspectFit"></image>
						<view class="dl-content">
							粉丝：{{formatNumberWithUnits(dataObj.fansDown)}}-{{formatNumberWithUnits(dataObj.fansUp)}}
						</view>
					</view>
					<view class="text-item" style="border-bottom: 1rpx solid #F4F4F4;padding-bottom: 10rpx;">
						<image class="dl-icon" src="@/static/index/xing.png" mode="aspectFit"></image>
						<view class="dl-content">类型：{{dataObj.bloggerTypesText||'无限制'}}</view>
					</view>
					<view class="text-item" style="padding-top: 10rpx;">
						<view class="item-box">
							<image class="dl-icon2" :src="imageUrl+dataObj.avatar" mode="aspectFit"></image>
							<view class="dl-item-right">{{dataObj.userNickName}}</view>
						</view>
						<!-- 				<view class="item-box" style="width: 25%;">
							<image class="dl-icon3" src="@/static/index/person.png" mode="aspectFit"></image>
							<view class="dl-item-right dl-number">{{dataObj.reportNum}}</view>
						</view> -->
						<view class="item-box" style="width: 25%;">
							<image class="dl-icon3" src="@/static/index/eye.png" mode="aspectFit"></image>
							<view class="dl-item-right dl-number">{{dataObj.viewNum}}</view>
						</view>


					</view>
				</view>
				<image class="right-image" :src="imageUrl+dataObj.mainImage" mode="aspectFit"></image>
			</view>
		</view>
	</view>
</template>

<script>
	import {
		formatNumberWithUnits
	} from '@/utils/common.js'
	import config from '@/config'
	export default {
		props: {
			dataList: {
				type: Array,
				default: []
			},
			dataObj: {
				type: Object,
				default: null
			}
		},
		data() {
			return {
				imageUrl: ''
			}
		},
		methods: {
			/**
			 * 数值单位转换
			 * @param {Object} number
			 */
			formatNumberWithUnits(number) {
				return formatNumberWithUnits(number)
			},
			/**
			 * 查看通告详情
			 * @param {Object} item
			 */
			goDetail(item) {
				this.$emit("goDetail", item)
			}
		}
	}
</script>

<style lang="scss">
	.dl-components {
		.dl-notice-box:first-child {
			margin-top: 20rpx;
		}

		.no-bg {
			background: none !important;
			margin-bottom: 0 !important;
			padding-top: 0 !important;
		}

		.dl-notice-box {
			font-size: 29rpx;
			width: 100%;
			padding: 38rpx 18rpx 10rpx 18rpx;
			background-color: white;
			border-radius: 25rpx;
			margin-bottom: 20rpx;
			position: relative;

			.dl-is-urgent {
				position: absolute;
				color: white;
				background-color: #FC1F3E;
				padding: 5rpx 25rpx;
				font-size: 24rpx;
				border-radius: 0 25rpx 0 25rpx;
				top: 0;
				right: 0;
			}

			.dl-is-platform {
				position: absolute;
				color: white;
				background-color: #FC1F3E;
				padding: 5rpx 25rpx;
				font-size: 24rpx;
				border-radius: 0 25rpx 0 25rpx;
				top: 0;
				right: 0;
			}

			.dl-is-platform-2 {
				position: absolute;
				color: white;
				background-color: #FC1F3E;
				padding: 5rpx 25rpx;
				font-size: 24rpx;
				border-radius: 0 0 25rpx 25rpx;
				top: 0;
				right: 120rpx;
			}

			.dl-notice-title {
				display: flex;
				width: 100%;
				padding-bottom: 3rpx;
				align-items: center;
				justify-content: center;

				.dl-image {
					flex: none;
					width: 50rpx;
					height: 50rpx;
				}

				.dl-text {
					font-size: 30rpx;
					margin-left: 10rpx;
					flex: 1;
					overflow: hidden;
					text-overflow: ellipsis;
					white-space: nowrap;
					width: 100%;
					font-weight: bold;

				}
			}

			.dl-notice-content {
				font-size: 27rpx;
				display: flex;
				color: #363636;
				width: 100%;
				align-items: center;
				justify-content: center;

				.left-text {
					flex: 1;
					min-width: 0;
					margin-right: 10rpx;

					.text-item {
						display: flex;
						padding: 5rpx;
						width: 100%;
						align-items: center;
						justify-content: center;

						.dl-icon {
							flex: none;
							width: 25rpx;
							height: 30rpx;
						}

						.dl-content {
							font-size: 24rpx;
							flex: 1;
							overflow: hidden;
							text-overflow: ellipsis;
							white-space: nowrap;
							width: 100%;
							padding-left: 15rpx;
						}

						.item-box {
							flex: 1;
							display: flex;
							align-items: center;
							justify-content: center;

							.dl-icon2 {
								flex: none;
								width: 40rpx;
								height: 40rpx;
								border-radius: 50%;
							}

							.dl-icon3 {
								flex: none;
								width: 30rpx;
								height: 29rpx;
								margin-left: 6rpx;
							}

							.dl-item-right {
								font-size: 26rpx;
								flex: 1;
								padding-left: 10rpx;
								min-width: 100rpx;
								overflow: hidden;
								text-overflow: ellipsis;
								white-space: nowrap;
								width: 100%;
							}

							.dl-number {
								color: #929292;
								font-size: 24rpx;
								margin-right: 5rpx;
							}
						}
					}
				}

				.right-image {
					flex: none;
					width: 180rpx;
					height: 180rpx;
					border-radius: 20rpx;
				}
			}
		}
	}
</style>