|
@@ -3,12 +3,12 @@
|
|
|
<div class="slider">
|
|
|
<!-- 标题部分 -->
|
|
|
<div class="scienceTitle">
|
|
|
- <h5>三农科教</h5>
|
|
|
- <p class="title">
|
|
|
+ <h5>{{ navigation1[16]?.alias }}</h5>
|
|
|
+ <!-- <p class="title">
|
|
|
<span v-for="(item, index) in scienceTitleList" :key="index" @mousemove="changeUl(index)">
|
|
|
<a href="#">{{ item.title }}</a>
|
|
|
</span>
|
|
|
- </p>
|
|
|
+ </p> -->
|
|
|
|
|
|
</div>
|
|
|
<!-- 标题下内容列表 -->
|
|
@@ -16,13 +16,12 @@
|
|
|
<transition name="fade">
|
|
|
<div class="scienceListBox">
|
|
|
<ul class="scienceList">
|
|
|
- <li v-for="item in 6">
|
|
|
- <img src="../../static/images/sgbhsihfgisdfaasda45632113_A_Chinese_farmer_carrying_a_hoe_is_h_a23e4b96-a6d7-49e1-a283-68c395f277f9.png"
|
|
|
- alt="">
|
|
|
- <p>市农业农村局关于印发连云港市市级…</p>
|
|
|
+ <li v-for="item in boxData1">
|
|
|
+ <img :src="item.imgurl">
|
|
|
+ <p>{{ item.title }}</p>
|
|
|
</li>
|
|
|
</ul>
|
|
|
- <ul class="scienceList">
|
|
|
+ <!-- <ul class="scienceList">
|
|
|
<li v-for="item in 6">
|
|
|
<img src="../../static/images/sgbhsihfgisdfaasda45632113_A_Chinese_farmer_carrying_a_hoe_is_h_1ba32eee-c498-4dd7-9cd9-013568c09db7.png"
|
|
|
alt="">
|
|
@@ -42,7 +41,7 @@
|
|
|
alt="">
|
|
|
<p>市农业农村局关于印发连云港市市级…</p>
|
|
|
</li>
|
|
|
- </ul>
|
|
|
+ </ul> -->
|
|
|
</div>
|
|
|
</transition>
|
|
|
</div>
|
|
@@ -52,6 +51,39 @@
|
|
|
|
|
|
<script setup>
|
|
|
|
|
|
+const nuxtApp = useNuxtApp();
|
|
|
+const axios = nuxtApp.$axios;
|
|
|
+
|
|
|
+const radio1 = ref('1')
|
|
|
+
|
|
|
+//获取导航一的栏目
|
|
|
+const navigation1 = ref("");
|
|
|
+const navigateList = async () => {
|
|
|
+ try {
|
|
|
+ const response = await axios.get(`/web/getWebsiteModelCategory?placeid=${1}&pid=${0}&num=${24}`);
|
|
|
+ console.log('一级导航', response.data);
|
|
|
+ navigation1.value = response.data;
|
|
|
+ } catch (error) {
|
|
|
+ console.error(error);
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+const boxData1 = ref("");
|
|
|
+const getWebsiteModelArticles = async () => {
|
|
|
+ try {
|
|
|
+ const response = await axios.get(`/web/getWebsiteModelArticles?catid=${16}&level=${1}&pagesize=${6}`);
|
|
|
+ console.log('一级导航', response.data);
|
|
|
+ boxData1.value = response.data;
|
|
|
+ } catch (error) {
|
|
|
+ console.error(error);
|
|
|
+ }
|
|
|
+}
|
|
|
+onMounted(() => {
|
|
|
+ // 一级导航
|
|
|
+ navigateList()
|
|
|
+ getWebsiteModelArticles()
|
|
|
+})
|
|
|
+
|
|
|
|
|
|
let scienceTitleList = [
|
|
|
{
|
|
@@ -74,26 +106,26 @@ let scienceTitleList = [
|
|
|
|
|
|
|
|
|
//鼠标移入标题时,下方内容会发生变化
|
|
|
-let changeUl = (index) => {
|
|
|
- // console.log(index);
|
|
|
- if (process.browser) {
|
|
|
- let scienceListBox = document.querySelector('.scienceListBox');
|
|
|
- let titleList = document.querySelectorAll('.title>span>a')
|
|
|
- for (let i = 0; i < titleList.length; i++) {
|
|
|
- titleList[i].className = ''
|
|
|
- }
|
|
|
- titleList[index].setAttribute('class', 'current')
|
|
|
- if (index == 0) {
|
|
|
- scienceListBox.style.left = 0
|
|
|
- } else if (index == 1) {
|
|
|
- scienceListBox.style.left = "-790px"
|
|
|
- } else if (index == 2) {
|
|
|
- scienceListBox.style.left = "-1580px"
|
|
|
- } else if (index == 3) {
|
|
|
- scienceListBox.style.left = "-2370px"
|
|
|
- }
|
|
|
- }
|
|
|
-}
|
|
|
+// let changeUl = (index) => {
|
|
|
+// // console.log(index);
|
|
|
+// if (process.browser) {
|
|
|
+// let scienceListBox = document.querySelector('.scienceListBox');
|
|
|
+// let titleList = document.querySelectorAll('.title>span>a')
|
|
|
+// for (let i = 0; i < titleList.length; i++) {
|
|
|
+// titleList[i].className = ''
|
|
|
+// }
|
|
|
+// titleList[index].setAttribute('class', 'current')
|
|
|
+// if (index == 0) {
|
|
|
+// scienceListBox.style.left = 0
|
|
|
+// } else if (index == 1) {
|
|
|
+// scienceListBox.style.left = "-790px"
|
|
|
+// } else if (index == 2) {
|
|
|
+// scienceListBox.style.left = "-1580px"
|
|
|
+// } else if (index == 3) {
|
|
|
+// scienceListBox.style.left = "-2370px"
|
|
|
+// }
|
|
|
+// }
|
|
|
+// }
|
|
|
|
|
|
</script>
|
|
|
|
|
@@ -169,7 +201,8 @@ let changeUl = (index) => {
|
|
|
position: relative;
|
|
|
overflow: hidden;
|
|
|
}
|
|
|
-.fade-in{
|
|
|
+
|
|
|
+.fade-in {
|
|
|
animation: fadeIn 1s ease-in-out;
|
|
|
}
|
|
|
|
|
@@ -218,8 +251,15 @@ let changeUl = (index) => {
|
|
|
}
|
|
|
|
|
|
>p {
|
|
|
- height: 56px;
|
|
|
- width: 248px;
|
|
|
+ width: 254px;
|
|
|
+ display: -webkit-box;
|
|
|
+ -webkit-box-orient: vertical;
|
|
|
+ -webkit-line-clamp: 2;
|
|
|
+ overflow: hidden;
|
|
|
+ text-overflow: ellipsis;
|
|
|
+ word-break: break-all;
|
|
|
+ height: 48px;
|
|
|
+ overflow: hidden;
|
|
|
font-family: PingFang SC, PingFang SC;
|
|
|
font-weight: 600;
|
|
|
font-size: 18px;
|
|
@@ -228,6 +268,7 @@ let changeUl = (index) => {
|
|
|
text-align: left;
|
|
|
font-style: normal;
|
|
|
text-transform: none;
|
|
|
+
|
|
|
}
|
|
|
|
|
|
>p:hover {
|