<template>
	<view>
		<MtaScrollViewVue :refreshFn="getList">
			<template v-slot="{ list }">
				<div v-for="item in list" :key="item.id" @click="handleClick(item)">
					<image :src="item.cover"></image>
					<br>
					{{formatDateToYearMonthDay(item.createTime)}}
					<br>
					{{item.title}}
				</div>
			</template>
		</MtaScrollViewVue>
	</view>
</template>

<script setup>
	import {
		ref,
		reactive
	} from "vue";
	import {
		onLoad
	} from "@dcloudio/uni-app"
	import * as httpApi from "@/api/common.js"
	import MtaScrollViewVue from "@/components/MtaScrollView/MtaScrollView.vue";
	import {formatDateToYearMonthDay}from"@/utils/common.js"
	
	const data = reactive({
		list: '',
		total: '',
		page: 1,
		size: 5
	})
	
	onLoad(() => {
	})
	
	function handleClick(data) {
		console.log('data',data);
		uni.navigateTo({
			url: `/pages/dqgzDangjiangongzuoInfo/dqgzDangjiangongzuoInfo?id=${data.id}`
		})
	}
	
	function getList(data) {
		return httpApi.getDangjianGongzuoList(data)
	}
	
	function pageInit() {
		httpApi.getDangjianGongzuoList({page: data.page,size:data.size}).then(res => {
			data.list = res.data.data;
			data.total = res.data.total;
		})
	}
</script>

<style>

</style>
