<template>
	<view class="dljt-page-box">
		<MtaNavbar></MtaNavbar>
		<view class="dljt-container-box">
			<view class="dljt-page-title">机构设置</view>
			<view class="dljt-page-content-box">
				<!-- 导航 -->
				<view class="dljt-breadcrumb-box">
					<view class="breadcrumb-text" @click="handleGo('shouye')">首页</view>
					<icon class="breadcrumb-jt"></icon>
					<view class="breadcrumb-text">招生就业</view>
					<icon class="breadcrumb-jt"></icon>
					<view class="breadcrumb-active">升学</view>
				</view>
				<view class="dljt-detail-box">
					<view class="dljt-editor-box">
						<view v-for="item in data.list" :key="item.title" @click="handleSelect(item)">{{item.title}}</view>
						<!-- 富文本 -->
						<MtaMpHtml class="dljt-editor-box" :content="data.activeData.content" ></MtaMpHtml>
						
						<!-- 链接 -->
						<view>
							<view v-for="cItem in data.activeData.link">
								<a :href="cItem.url">{{cItem.name}}{{cItem.url}}</a>
							</view>
						</view>
						<!-- table -->
						<view>
							<view>
								<view>序号</view>
								<view>资料名称</view>
								<view>下载</view>
							</view>
							<view v-for="(ccIte,index) in data.activeData.ziliao">
								<view>{{index+1}}</view>
								<view>{{ccIte.name}}</view>
								<view @click="handleDownFile(ccIte)">文件下载</view>
							</view>
						</view>
					</view>
				</view>
			</view>
		</view>
		<!-- 底部导航 -->
		<MtaFooter></MtaFooter>
	</view>
</template>

<script setup>
	import {
		ref,
		reactive
	} from "vue";
	import {
		onLoad
	} from "@dcloudio/uni-app"
	import * as httpApi from "@/api/common.js"
	import MtaFooter from "@/components/MtaFooter.vue"
	import MtaMpHtml from "@/components/MTAMpHtml/MtaMpHtml.vue"

	const data = reactive({
		list: null,
		activeId: null,
		activeData: null
	})

	onLoad(() => {
		pageInit();
	})

	function handleGo(code) {
		if (code == 'shouye') {
			uni.navigateTo({
				url: '/pages/index/index'
			})
		}
	}

	function handleSelect(item) {
		data.activeId = item.id;
	}
	
	function handleDownFile(ccite) {
		window.location.href = ccite.url;
	}

	
	function pageInit() {
		httpApi.getCommonZSJYShengxueList({page:data.page,size:data.size}).then(res => {
			data.list = res.data.data;
			data.total = res.data.total;
			data.activeId = data.list[0].id;
			httpApi.getCommonZSJYZhuanyeInfo({id: data.activeId}).then(res => {
				data.activeData = res.data;
			})
		})
	}
</script>

<style>

</style>
