瀏覽代碼

update 更新

wangxy 2 月之前
父節點
當前提交
d5480ed1b6
共有 5 個文件被更改,包括 210 次插入18 次删除
  1. 31 0
      components/MtaCard/listFour.vue
  2. 35 0
      components/MtaCard/listOne.vue
  3. 36 0
      components/MtaCard/listThree.vue
  4. 53 0
      components/MtaCard/listTwo.vue
  5. 55 18
      pages/index/index.vue

+ 31 - 0
components/MtaCard/listFour.vue

@@ -0,0 +1,31 @@
+<template>
+	<view class="data-content-item">
+		<view class="list-time-box">
+			<view class="time-data">{{ formatDate[1] }}</view>
+			<view class="time-year">{{ formatDate[0] }}</view>
+		</view>
+		<p v-html="data.title"></p>
+	</view>
+</template>
+
+<script setup>
+	import {
+		formatDateToYearMonthDay
+	} from "@/utils/common.js"
+	import {
+		computed
+	} from "vue"
+
+	const props = defineProps({
+		data: {
+			type: Object
+		}
+	})
+
+	const formatDate = computed(() => {
+		return formatDateToYearMonthDay(props.data.createTime)
+	})
+</script>
+
+<style>
+</style>

+ 35 - 0
components/MtaCard/listOne.vue

@@ -0,0 +1,35 @@
+<template>
+	<view class="video-item-box">
+		<el-image :src="data[imgKey]" :preview-src-list="[data[imgKey]]" />
+		<view class="video-mask-box">
+			<p>{{data.picDate}}</p>
+			<h5>{{data.title}}</h5>
+		</view>
+	</view>
+</template>
+
+<script setup>
+	import {
+		formatDateToYearMonthDay
+	} from "@/utils/common.js"
+	import {
+		computed
+	} from "vue"
+
+	const props = defineProps({
+		data: {
+			type: Object
+		},
+		isShowBtn: {
+			type: Boolean,
+			default: false,
+		},
+		imgKey: {
+			type: String,
+			default: 'cover'
+		}
+	})
+</script>
+
+<style>
+</style>

+ 36 - 0
components/MtaCard/listThree.vue

@@ -0,0 +1,36 @@
+<template>
+	<view class="video-item-box">
+		<img :src="data.cover" />
+		<view class="video-play-btn" v-if="isShowBtn"></view>
+		<view class="video-mask-box">
+			<p v-if="timerDate">[{{timerDate}}]</p>
+			<h5>{{data.title}}</h5>
+		</view>
+	</view>
+</template>
+
+<script setup>
+	import {
+		formatDateToYearMonthDay
+	} from "@/utils/common.js"
+	import {
+		computed
+	} from "vue"
+
+	const props = defineProps({
+		data: {
+			type: Object
+		},
+		isShowBtn: {
+			type: Boolean,
+			default: false,
+		}
+	})
+
+	const timerDate = computed(() => {
+		if (!props.data.picDate) {}
+	})
+</script>
+
+<style>
+</style>

+ 53 - 0
components/MtaCard/listTwo.vue

@@ -0,0 +1,53 @@
+<template>
+	<view class="list-item-box">
+		<img class="list-img" :src="data.cover||defaultImg">
+		<view class="list-time-box" :class="{'time-red-box': type == 1}">
+			<view class="time-data">{{ formatDate[1] }}</view>
+			<view class="time-year">{{formatDate[0]}}</view>
+		</view>
+		<view class="list-right-box">
+			<h1 class="list-name">{{ data.title }}</h1>
+			<view class="list-line"></view>
+			<view class="list-content" v-html="getStringByHtml3(data.content)">
+			</view>
+		</view>
+	</view>
+</template>
+
+<script setup>
+	import {
+		ref,
+		reactive,
+		computed
+	} from "vue";
+	import {
+		getStringByHtml3,
+		formatDateToYearMonthDay
+	} from "@/utils/common.js"
+
+	const props = defineProps({
+		data: {
+			type: Object
+		},
+		type: {
+			type: Number
+		}
+	})
+
+	const myData = reactive({
+		default1: '', // 默认图
+		default2: '' // 默认图2
+	})
+
+	const formatDate = computed(() => {
+		return formatDateToYearMonthDay(props.data.createTime)
+	})
+
+	const defaultImg = computed(() => {
+		return props.type == 1 ? myData.default1 : myData.default2
+	})
+</script>
+
+<style>
+
+</style>

+ 55 - 18
pages/index/index.vue

@@ -1,8 +1,8 @@
 <template>
 	<view class="lli-index-page">
-		
+
 		<MtaNavbar></MtaNavbar>
-		
+
 		<view class="uni-margin-wrap">
 			<swiper class="swiper" circular :indicator-dots="true" :autoplay="true" :interval="5000">
 				<swiper-item v-for="item in banners" :key="item.id" @click="handleBannerSelect(item)">
@@ -11,16 +11,41 @@
 			</swiper>
 		</view>
 		<view>
-			新闻:{{data.xinwen}}
+			<listTwoVue v-for="item in data.xinwen" :key="item.id" :data="item" @click.native="handleClickXinwen(item)"
+				class=index-xinwen-box></listTwoVue>
+			<view v-if="data.xinwenTotal>3" @click="handleXinwenGengDuo">更多</view>
 		</view>
 		<br />
 		<view>
-			公告: {{data.gonggao}}
+			<view>通知公告</view>
+			<view v-for="item in data.gonggao" :key="item.id" @click="handleClickGonggao(item)">
+				{{item}}
+			</view>
+			<view v-if="data.xiaowuTotal>5" @click="getXinwenGengduo">更多</view>
 		</view>
 		<br />
 		<view>
 			校务: {{data.xiaowu}}
+			<view>校务公开</view>
+			<view v-for="item in data.xiaowu" :key="item.id" @click="handleClickXiaowu(item)(item)">
+				{{item}}
+			</view>
+			<view v-if="data.xiaowuTotal>5" @click="getXiaowuGengduo">更多</view>
+		</view>
+
+		<!-- 招生就业 -->
+		<view class="website-zsjy-title">
+			<p>招生就业</p>
+		</view>
+		<view class="zsjy-box">
+			<view class="wnlqfs-box" @click="goFun('wnlqfs')">
+				<p>往年录取分数</p>
+			</view>
+			<view class="xqhz-box" @click="goFun('xwhz')">
+				<p>校企合作</p>
+			</view>
 		</view>
+
 	</view>
 </template>
 
@@ -34,8 +59,9 @@
 	} from "@dcloudio/uni-app"
 	import * as httpApi from "@/api/common.js"
 	import MtaNavbar from "@/components/MtaNavbar/MtaNavbar.vue";
-	
-	
+	import listTwoVue from "@/components/MtaCard/listTwo.vue";
+
+
 	const banners = ref('');
 	const data = reactive({
 		xinwen: [],
@@ -43,8 +69,8 @@
 		gonggao: [],
 		gonggaoTotal: 0,
 		xiaowu: [],
-		xiaowuTotal:0,
-		
+		xiaowuTotal: 0,
+
 		isGonggao: true,
 	})
 
@@ -52,12 +78,20 @@
 		pageInit();
 	})
 
+	function getXiaowuGengduo() {}
+
+	function handleClickXiaowu() {}
+
+	function getXinwenGengduo() {}
+
+	function handleXinwenGengDuo() {}
+
 	function handleBannerSelect(item) {
 		if (item.url) {
 			window.location.href = item.url;
 		}
 	}
-	
+
 	function changeGonggao() {
 		if (this.isGonggao) {
 			return true
@@ -65,7 +99,7 @@
 		data.isGonggao = true;
 		getGonggao()
 	}
-	
+
 	function changeXiaowu() {
 		if (!this.isGonggao) {
 			return true
@@ -73,21 +107,21 @@
 		data.isGonggao = false;
 		getXiaowu()
 	}
-	
+
 	function getGonggao() {
 		httpApi.getCommonXinwenTongzhiList().then(res => {
 			data.gonggao = res.data.data;
 			data.gonggaoTotal = res.data.total;
 		})
 	}
-	
+
 	function getXiaowu() {
 		httpApi.getCommonXinwenXiaowuList().then(res => {
 			data.xiaowu = res.data.data;
 			data.xiaowuTotal = res.data.total;
 		})
 	}
-	
+
 
 	function pageInit() {
 		Promise.all([
@@ -102,16 +136,19 @@
 				page: 1,
 				size: 5
 			}),
-			httpApi.getCommonXinwenXiaowuList({page:1,size: 5})
-		]).then(([res1, res2, res3,res4]) => {
+			httpApi.getCommonXinwenXiaowuList({
+				page: 1,
+				size: 5
+			})
+		]).then(([res1, res2, res3, res4]) => {
 			banners.value = res1.data.data;
-			
+
 			data.xinwen = res2.data.data;
 			data.xinwenTotal = res2.data.total;
-			
+
 			data.gonggao = res3.data.data;
 			data.gonggaoTotal = res3.data.total;
-			
+
 			data.xiaowu = res4.data.data;
 			data.xiaowuTotal = res4.data.total;
 		})