<template>
	<view>
		<Headers></Headers>
		<view class="project">
			<view style="width: 1200px;margin: auto;">在线考试系统</view>
		</view>
		
		<view class="project-content ddflex">
			<!-- 成绩区域 -->
			<view class="test-box">
				<view class="test-title">{{content.title}}</view>
				<view class="test-time">
					<text style="color: #999999;margin-right: 10px;">发布日期</text>
					<text>{{content.time}}</text>
				</view>
				<mp-html :content="content.text" :lazy-load="true" @imgtap="choose"></mp-html>
				
			</view>
			<!-- 答题卡区域 -->
			<view class="test-info ddflex">
				<view class="note-box">
					<view class="note-title ddflex">
						<image class="note-title-icon" src="/static/images/ksgg.png"></image>
						<view>考试公告</view>
					</view>
					<view>
						<view class="note-item ddflex" v-for="item,index in otherInfo" :key="index" @click="jumpUrl('/pages/contentDetail/contentDetail?id='+item.id)">
							<view class="note-item-content">{{item.title}}</view>
						</view>
					</view>
				</view>
				<!-- 注意事项 -->
				<view class="note-box">
					<view class="note-title ddflex">
						<image class="note-title-icon" src="/static/images/zysx.png"></image>
						<view>注意事项</view>
					</view>
					<view>
						<view class="note-item ddflex" v-for="item,index in noteInfo" :key="index+'zy'" @click="jumpUrl('/pages/contentDetail/contentDetail?id='+item.id)">
							<view class="note-item-content">{{item.title}}</view>
						</view>
					</view>
				</view>
			</view>
		</view>
		
		<Foot></Foot>
	</view>
</template>

<script>
	const app = getApp();
	const req = require('../../utils/request.js');
	import mpHtml from "../../components/mp-html/mp-html.vue";
	export default {
		data() {
			return {
				id:null,
				content:'',
				otherInfo:[],
				noteInfo:[]
			}
		},
		onReady() {},
		onLoad(options) {
			this.id = options.id
			this.getDetail()
			this.getTextOtherInfo()
			this.getTextNoteInfo()
		},
		methods: {
			jumpUrl(url){
				uni.navigateTo({
					url:url
				})
			},
			getDetail(){
				req.getRequest('/api/content/detail',{id:this.id},res=>{
					this.content = res
				})
			},
			// 考试公告
			getTextOtherInfo(){
				let form={
					code:req.public.ksggCode,
					page:1,
					limit:3
				}
				req.getRequest('/api/content/list',form,res=>{
					this.otherInfo = res
				})
			},
			// 注意事项
			getTextNoteInfo(){
				let form={
					code:req.public.zysxCode,
					page:1,
					limit:3
				}
				req.getRequest('/api/content/list',form,res=>{
					this.noteInfo = res
				})
			},
		}
	}

</script>

<style>
	@import url('./contentDetail.css');
</style>