<template>
	<div style="overflow-y: auto">
		<a-layout>
			<Header @onChangeCurrent="onChangeCurrent" />
			<div style="width: 71%; margin-left: 10%">
				<myResources pageType="economize" />
				<!-- <ResourceDetails v-if="indexType == 'resourceDetails'" ref="ResourceDetailsRef" /> -->
			</div>
		</a-layout>
		<Footer />
	</div>
</template>

<script setup>
	import Header from '@/views/portal/components/Header.vue'
	import Footer from '@/views/portal/components/Footer.vue'
	import myResources from '../myResources.vue'
	import { useRoute, useRouter } from 'vue-router'
	import { addViewCount, detail, add, queryList } from '@/api/portal'
	const router = useRouter()

	const indexType = ref('resourceCenter')
	const itemData = ref({})
	const VideoDetailsRef = ref(null)
	const route = useRoute()
	//     {
	//     "fileName": "Kettle文档",
	//     "courseType": "0",
	//     "courseTypeName": "必修",
	//     "collegeAllId": "1938796923484962817,1938796975385280513,1938797957397676033",
	//     "suffix": "doc",
	//     "collegeTwoId": "1938796975385280513",
	//     "verifyStatus": "2",
	//     "collegeThreeIdName": "维修部",
	//     "collegeThreeId": "1938797957397676033",
	//     "collegeId": "1938796923484962817",
	//     "resourceCreaterUserName": "超管",
	//     "coverImage": "",
	//     "coverImagePath": "",
	//     "fileUrl": "upload/20250626/a37672e03659d06fa618842c9c443910.doc",
	//     "courseIdName": "胸口碎大石2",
	//     "id": "1938857816211292161",
	//     "viewCount": 100,
	//     "courseId": "1937326992873689091",
	//     "collegeAllIdName": "汽车工程学院,汽车部门,维修部",
	//     "FILESIZE": 1105920,
	//     "majorId": "1",
	//     "uploadTime": "2025-06-26 18:32:18",
	//     "verifyStatusName": "已发布",
	//     "resourceDesc": "大东北，是我的家乡，唢呐吹出了美美滴模样",
	//     "collegeIdName": "汽车工程学院",
	//     "majorIdName": "草台班子",
	//     "collegeTwoIdName": "汽车部门",
	//     "fileId": "1938183534250917888"
	// }
	const handlerItemSidebar = (item) => {
		// emit('handlerItemSidebar', item)
	}
	const onChangeCurrent = (current) => {
		indexType.value = current

		router.push({
			path: '/' + current
		})
	}

	const setData = (item) => {
		// emit('handlerItemSidebar', item)

		getData(item)
	}
	const getData = (item) => {
		detail({ id: item.id })
			.then((res) => {
				if (res.code == 200) {
					itemData.value = res.data

					// VideoDetailsRef.value.setData(res.data)
				}
			})
			.catch((err) => {})
	}

	onMounted(() => {
		const id = route.query.id
		if (id != undefined && id != '') {
			addViewCount({ id: id })
			getData({ id: id })
		}
	})
	defineExpose({
		setData
	})
</script>

<style scoped>
	.content {
		border: 1px solid #00000011; /* 灰色细边框 */
	}
	.scroll-container {
		height: 100vh;
		overflow-y: auto;
	}
</style>
