<template>
	<view>
		<view class="header">
			<view class="cu-bar search bg-gray">
				<view class="search-form round text-center">
					<text class="cuIcon-search"></text>
					<input v-model="searchval" :adjust-position="false" type="text" placeholder="请输入关键字"
						confirm-type="search" @confirm="btnSearch()"></input>
				</view>
				<view class="action" v-if="searchval!==''">
					<button class="cu-btn bg-white shadow-blur round" @click="btnSearch()">搜索</button>
				</view>
			</view>
			<view class="screen">
				<image class="screen-icon" src="../../static/images/comJobs/screen.png"></image>
				<view class="">筛选</view>
			</view>
		</view>

		<view class="list">
			<view class="card" v-for="(item,index) in 3" :key="index">
				<view class="cardBox">
					<view class="cardBox-image"></view>
					<view class="cardBox-content">
						<view class="content-header">
							<view class="header-title">雨伞组装</view>
							<image class="header-icon" src="../../static/images/comJobs/apply.png" mode="widthFix"></image>
						</view>
						<view class="header-item red">1元/把</view>
						<view class="header-item">外包需求：10000把</view>
						<view class="header-item">晋江XXXX伞业制造有限公司</view>
					</view>
				</view>
			</view>

			<uni-load-more :status="pstatus"></uni-load-more>
		</view>
	</view>
</template>

<script>
	var _this;
	export default {
		data() {
			return {
				searchval: "",
				ppage: 1,
				psize: 20,
				plist: [],
				pstatus: 'more',
			}
		},
		onLoad() {
			_this = this;
			_this.getMore();
		},
		methods: {

			getMore() {
				_this.$req.ajax({
					path: "comjobs/listcomjobs",
					data: {
						ppage: _this.ppage,
						psize: _this.psize,
						rectype: 2
					}
				}).then((data) => {
					_this.pstatus = data.pstatus;
					_this.plist = _this.plist.concat(data.plist);
					_this.ppage += 1;
					console.log("列表数据", _this.plist)
					uni.stopPullDownRefresh();
				}).catch((err) => {
					uni.showModal({
						title: '信息提示',
						content: err,
						showCancel: false
					});
				});
			},
		}
	}
</script>

<style lang="scss">
	page {
		background-color: #f0f0f0;
	}

	.header {
		display: flex;
		align-items: center;
		justify-content: space-between;

		.search {
			flex: 1;
		}

		.screen {
			width: 150rpx;
			display: flex;
			align-items: center;
			justify-content: center;
			font-size: 28rpx;
			font-weight: 400;
			color: #191919;

			.screen-icon {
				margin-right: 10rpx;
				width: 28rpx;
				height: 28rpx;
			}
		}
	}

	.list {
		padding: 0 26rpx;

		.card {
			margin-bottom: 30rpx;
			background: #FFFFFF;
			border-radius: 12rpx;
			display: flex;
			overflow: hidden;
			
			.cardBox {
				width: 100%;
				padding: 22rpx 30rpx;
				font-size: 28rpx;
				color: #747474;
				display: flex;
				align-items: center;
				justify-content: flex-start;
				border-left: 5px solid #CA151C;
				
				.cardBox-image {
					width: 228rpx;
					height: 228rpx;
					background: #ff5500;
					border-radius: 8rpx;
				}
				
				.cardBox-content {
					margin-left: 30rpx;
					flex: 1;
					height: 228rpx;
					display: flex;
					flex-direction: column;
					justify-content: space-between;
					
					.content-header {
						display: flex;
						align-items: center;
						justify-content: space-between;
						
						.header-title {
							width: 70%;
							font-size: 40rpx;
							font-weight: 600;
							color: #383838;
							overflow: hidden;
							text-overflow: ellipsis;
							-webkit-line-clamp: 1;
							display: -webkit-box;
							-webkit-box-orient: vertical;
						}
						
						.header-icon {
							width: 144rpx;
						}
					}
					
					.red {
						color: #CA151C;
					}
					
					.header-item {
						overflow: hidden;
						text-overflow: ellipsis;
						-webkit-line-clamp: 1;
						display: -webkit-box;
						-webkit-box-orient: vertical;
					}
				}
			}
		}
	}
</style>