<template>
	<view class="main-container">
		<view class="container-main">
			<view class="list">
				<view class="list-item"  @click="getInfo()">
					<view class="item-title">123</view>
					<view class="data-row">
						<view class="data-lable">标准名称:</view>
						<view class="data-value">23</view>
					</view>
					<view class="data-row">
						<view class="data-lable">标准编号:</view>
						<view class="data-value">12</view>
					</view>

				</view>
				<u-loadmore :status="status" :load-text="loadText" />
			</view>
		</view>
		<fixedButton title="新增" v-show="queryParams.code" @click="addHanld" />
	</view>
</template>

<script>
	import {
		getList
	} from '@/api/shianliaoning/publicity.js'
	export default {
		data() {
			return {
				status: "nomore",
				loadText: {
					loading: "努力加载中",
					nomore: "已经到底了~",
				},
				list: [],
				total: 0,
				queryParams: {
					code: undefined,
					pageNum: 1,
					pageSize: 10
				}
			};
		},
		onLoad(option) {
			if (option.code) this.queryParams.code = option.code
		},
		onShow() {
			this.reset()
		},
		onReachBottom() {
			if (this.queryParams.pageNum < this.total) {
				if (this.status == 'loading') return
				this.queryParams.pageNum = this.queryParams.pageNum + 1;
			}
		},
		methods: {
			reset() {
				this.total = 0;
				this.queryParams.pageNum = 1;
				this.queryParams.pageSize = 10;
				this.list = [];

			},
			// add
			addHanld() {
				uni.navigateTo({
					url: `/sub-interaction/publicity/form?code=${this.queryParams.code}`
				})
			},
			//info
			getInfo(id) {
				uni.navigateTo({
					url: `/sub-interaction/publicity/info?id=${id}&code=${this.queryParams.code}`
				})
			},
			//list
			getlist() {
				this.status = 'loading'
					this.list = [];
					this.total =  1;
					this.status = 'nomore'
			}
		},
	}
</script>

<style lang="scss" scoped>
	.container-main {
		box-sizing: border-box;
		padding-bottom: 100rpx;
	}

	.list {
		box-sizing: border-box;
		padding: 20rpx;

		&>.list-item {
			min-height: 20rpx;
			background: #FFFFFF;
			border-radius: 16rpx;
			margin-bottom: 20rpx;
			box-sizing: border-box;
			padding: 20rpx;

			.item-title {
				font-size: 30rpx;
				font-weight: 550;
			}

			.data-row {
				margin-top: 20rpx;
				display: flex;
				align-items: center;

				.data-lable {
					width: 130rpx;
					font-size: 28rpx;
					font-weight: 400;
					color: #9DA2AB;
				}

				.data-value {
					flex: 1;
					font-size: 28rpx;
					font-weight: 400;
					color: #34373B;
					box-sizing: border-box;
					padding-left: 20rpx;
					overflow: hidden;
					white-space: nowrap;
					text-overflow: ellipsis;
				}
			}
		}

		.list-item:active {
			background-color: rgba(196, 204, 216, 0.2);
		}
	}
</style>