<template>
	<view class="container-main">
		<view class="list">
			<view class="list-item">
				<view class="item-state" :class="'state0'">
            "未知"
				</view>
				<view class="item-data">
					<view class="data-main">
						<view class="data-title">123</view>
						<view class="data-lable-value">
							<view class="row-item">
								<view class="item-lable">
									<view class="lable-icon">
										<image :src="baseImgUrl + 'liao-ning/icon_faburen.png'" mode=""></image>
									</view>
									<view class="lable-text">发布人:</view>
								</view>
								<view class="item-value">213</view>
							</view>
							<view class="row-item">
								<view class="item-lable">
									<view class="lable-icon">
										<image :src="baseImgUrl + 'liao-ning/icon_shijian.png'" mode=""></image>
									</view>
									<view class="lable-text">发布时间:</view>
								</view>
								<view class="item-value">123</view>
							</view>
							<view class="row-item">
								<view class="item-lable">
									<view class="lable-icon">
										<image :src="baseImgUrl + 'liao-ning/icon_danwei.png'" mode=""></image>
									</view>
									<view class="lable-text">简介:</view>
								</view>
								<view class="item-value textover">123123</view>
							</view>
						</view>
					</view>
					<view class="data-btn"  @click="goForm()">
						我要填写
					</view>
				</view>
			</view>
			<u-loadmore :status="status" :load-text="loadText" />
		</view>
	</view>
</template>

<script>

	export default {
		data() {
			return {
				baseImgUrl: getApp().globalData.config.iamgeBaseUrl,
				globalConfig: getApp().globalData.config,
				status: "nomore",
				loadText: {
					loading: "努力加载中",
					nomore: "已经到底了~",
				},
				loading: false,
				list: [],
				queryParams: {
					surveyType: null, //问卷所属模块 0为满意度调查单 1为企业调查单
					current: 1,
					pageSize: 10,
					userId: null,
					uniscid: "",
					identityCard: "",
				},
				total: 0,
				type: null, // 0:h5,1:wx
			};
		},
		onReachBottom(e) {
			if (this.queryParams.current < this.total) {
				if (this.loading == true) {
					this.status = "nomore";
					return;
				}
				this.queryParams.current = this.queryParams.current + 1;
				this.getList();
			}
		},
		onNavigationBarButtonTap(e) {
			console.log(e, 'aaa')
		},
		onShow() {
			this.reset()
			this.getList();
		},
		onLoad(option) {
			uni.setNavigationBarTitle({
				title: option.name,
			});
			let data = uni.getStorageSync('USER_DATA')
			if (data) {
				//#ifdef H5
				this.type = 0;
				//#endif
				// #ifdef MP-WEIXIN
				this.type = 1;
				// #endif
				if (option.name == "企业调查单") {
					this.queryParams.surveyType = 1;
					this.queryParams.uniscid = option.code;
				} else {
					this.queryParams.userId = data.userId;
					this.queryParams.surveyType = 0;
					this.queryParams.identityCard = data.userDto.identity;
				}
			}
		},
		methods: {
			//重置
			reset() {
				this.loading = false;
				this.list = [];
				this.queryParams.current = 1;
				this.queryParams.pageSize = 10;
				// this.queryParams.identityCard = 1111
				this.total = 0;
			},
			getList() {
				this.loading = true;
				this.status = "loading";
				let query = this.queryParams
				
			},
			goForm() {
				uni.navigateTo({
					url: `/sub-public/survey-form/survey-form`,
				});
			},
		},
	};
</script>

<style lang="scss" scoped>
	uni-page-body,
	page {
		background: rgba(245, 247, 250, 1);
	}

	.list {
		padding: 30rpx 20rpx;

		.list-item {
			margin-bottom: 100rpx;
			position: relative;
		}

		.item-state {
			position: absolute;
			top: 0;
			left: 0;
			width: 100%;
			height: 66rpx;
			line-height: 66rpx;
			box-sizing: border-box;
			padding-left: 30rpx;
			border-radius: 16rpx 16rpx 0 0;
			font-size: 28rpx;
			font-family: "PingFang SC-中黑体";
			font-weight: 500;
		}

		.state0 {
			background: linear-gradient(180deg,
					rgba(255, 168, 162, 0.4) 0%,
					rgba(247, 99, 89, 0) 100%);
			color: #f76359;
		}

		.state1 {
			background: linear-gradient(180deg,
					#c4f7ed 0%,
					rgba(196, 247, 237, 0) 100%);
			color: #02d1a6;
		}

		.item-data {
			position: relative;
			left: 0;
			top: 60rpx;
			z-index: 10;
			width: 100%;
			min-height: 100rpx;
			background: #fff;
			border-radius: 16rpx;

			.data-main {
				box-sizing: border-box;
				padding: 30rpx 37rpx;

				.data-title {
					font-size: 34rpx;
					font-weight: 600;
					color: #34373b;
					margin-bottom: 30rpx;
				}
			}

			.row-item {
				margin-bottom: 20rpx;
				display: flex;
				align-items: center;

				.item-lable {
					display: flex;
					align-items: center;
					min-width: 170rpx;

					.lable-icon {
						height: 26rpx;
						width: 26rpx;

						image {
							height: 100%;
							width: 100%;
							display: block;
						}
					}

					.lable-text {
						margin-left: 10rpx;
						font-size: 28rpx;
						font-weight: 400;
						color: #9da2ab;
					}
				}

				.item-value {
					flex: 1;
					font-size: 28rpx;
					font-weight: 400;
					color: #34373b;
				}
			}

			.data-lable-value {
				&>view:last-child {
					margin: 0;
				}
			}
		}

		.data-btn {
			border-top: 1px solid rgba(220, 227, 236, 1);
			height: 80rpx;
			display: flex;
			align-items: center;
			justify-content: center;
			font-size: 28rpx;
			font-weight: 500;
			color: #3976f1;
		}
	}

	.textover {
		overflow: hidden;
		text-overflow: ellipsis;
		white-space: nowrap;
	}
</style>