<template>
	<view class="content">
		<view class="list-box" v-for="(item,index) in list" :key="index" @click="goInfo(item)">
			<view class="list-item">
				<view class="left">
					<view class="title">{{item.name}}</view>
					<view class="desc">创建时间：{{ dayjs(item.createTime).format('YYYY-MM-DD') }}</view>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	import {listForm} from "@/api/survey";
  import dayjs from "dayjs";

  export default {
		data() {
			return {
				list: []
			}
		},
		methods: {
      dayjs,
			goInfo(item) {
				uni.navigateTo({
					url: '/servicePages/pages/surveyInfo?id=' + item.formId
				})
			},
      async getList() {
			  const {data} = await listForm()
        this.list = data
			}
		},
    onShow(){
      this.getList()
    }
	}
</script>

<style lang="scss" scoped>
	.content {
		padding: 20rpx;
		background-color: #f5f5f5;
		min-height: 100vh;
	}

	.list-box {
		background-color: #fff;
		border-radius: 10rpx;
		padding: 20rpx;
		margin-bottom: 20rpx;

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

			.left {
				.title {
					font-size: 30rpx;
					font-weight: bold;
					margin-bottom: 10rpx;
				}

				.desc {
					font-size: 26rpx;
					color: #999;
				}
			}

			.right {
				.tag {
					padding: 10rpx 20rpx;
					border-radius: 30rpx;
					background-color: #999;
					color: #fff;
					font-size: 24rpx;
				}

				.tag-ing {
					background-color: #007AFF;
				}
			}
		}
	}
</style>
