From a47b1c5ee1609093571d2f4fa1463fa351b7823d Mon Sep 17 00:00:00 2001 From: dzj <1140318653@qq.com> Date: Sat, 27 Jul 2024 00:23:18 +0800 Subject: [PATCH] =?UTF-8?q?=E9=A6=96=E9=A1=B5=E6=96=B0=E9=97=BB=E8=B5=84?= =?UTF-8?q?=E8=AE=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/index.js | 24 ++++++- src/views/HomeView.vue | 144 ++++++++++++++++++++++------------------- 2 files changed, 100 insertions(+), 68 deletions(-) diff --git a/src/api/index.js b/src/api/index.js index 48ef5dc..7ee89e6 100644 --- a/src/api/index.js +++ b/src/api/index.js @@ -9,7 +9,7 @@ export function getproject(params){ //获取新闻内容 export function getnews(params){ return request({ - url:'article/list', + url:'article/enterpriseNewsList', params }) } @@ -103,14 +103,14 @@ export function compony(){ //新闻资讯 export function getmsg(params){ return request({ - url:'/articleMsg/list', + url:'/article/newsInformationList', params }) } //新闻详情 export function msgdetail(params){ return request({ - url:'/articleMsg/articleDetails', + url:'/article/articleDetails', params }) } @@ -131,4 +131,22 @@ export function componyhonor(){ return request({ url:'/honorTitle/list ' }) +} +//首页企业新闻 +export function indexNews(){ + return request({ + url:'/article/enterpriseNews' + }) +} +//首页企业新闻 +export function indexInformation(){ + return request({ + url:'/article/newsInformation' + }) +} +//首页新闻分类 +export function NewCategary(){ + return request({ + url:'/articleType/list' + }) } \ No newline at end of file diff --git a/src/views/HomeView.vue b/src/views/HomeView.vue index bb3873d..9e2e4b3 100644 --- a/src/views/HomeView.vue +++ b/src/views/HomeView.vue @@ -23,34 +23,19 @@
-

企业新闻

-
CORPORATE NEWS
- - +

{{newscatagary[0]?.name}}

+
{{newscatagary[0]?.enName}}
+
- +
-
+

{{ newsitem?.name||'' }}

- + line-height: 30px;">{{indexNew[0]?.subTitle||'' }} +
+ text-align: justify;" v-html=" indexNew[0]?.subContent||''">
@@ -83,48 +68,32 @@
-
-
-
-
-

行业动态

-
INDUSTRY TRENDS
-
- -
- {{ hydata[textindex]?.name||'' }} -
-
- -
- +
+
+
+

{{newscatagary[1]?.name}}

+
{{newscatagary[1]?.enName}}
+

{{ indexinfo[textindex]?.subTitle }}

+
{{ indexinfo[textindex]?.subContent }}
+
+
-
-
+
+ +
- +
-
-
+ +
- - -
-
+
@@ -218,7 +187,7 @@ import Swiper from 'swiper' import 'swiper/css/swiper.min.css' -import { achievementPic, hyDtai, swiperimg, getnews, backgroundText, smallPicture,honor,componyhonor } from '@/api' +import { achievementPic,NewCategary, hyDtai, swiperimg, backgroundText, smallPicture,honor,componyhonor,indexNews,indexInformation } from '@/api' export default { data() { return { @@ -232,6 +201,9 @@ export default { swipe:null, textindex:0, componydata:[], + newscatagary:[], + indexNew:[], + indexinfo:[] } }, @@ -323,12 +295,12 @@ export default { }) }) //新闻展示 - getnews({ 'page': 0 }).then((res) => { - res.data.content[0].content= res.data.content[0].content.replace(/<[^>]+>/g, '').trim(); - this.newsitem = res.data.content[0] + // getnews({ 'page': 0 }).then((res) => { + // res.data.content[0].content= res.data.content[0].content.replace(/<[^>]+>/g, '').trim(); + // this.newsitem = res.data.content[0] - console.log(this.newsitem) - }) + // console.log(this.newsitem) + // }) //图文展示 backgroundText().then((res) => { this.bgtextitem = res.data[0] @@ -337,7 +309,33 @@ export default { componyhonor().then((res)=>{ this.componydata=res.data }) + indexInformation().then((res)=>{ + this.indexinfo=res.data + this.$nextTick(() => { + new Swiper('.swiper6', { + loop: true, + observer: true, + observeParents: true, + pagination: { + el: '.swiper-pagination', + }, + navigation: { + nextEl: '.swiper-button-next', + prevEl: '.swiper-button-prev', + }, + pagination: { + el: '.swiper-pagination2' + } + }) + }) + }) + indexNews().then((res)=>{ + this.indexNew=res.data + }) + NewCategary().then((res)=>{ + this.newscatagary=res.data + }) // 创建交叉观察器实例 // this.observer = new IntersectionObserver(entries => { // entries.forEach(entry => { @@ -365,17 +363,17 @@ export default { next(){ - this.swipe.slideNext() + if(this.textindex0){ this.textindex=this.textindex-1 }else{ @@ -402,6 +400,19 @@ export default { }) } + }, + routerTo(id){ + if (id) { + +this.$router.push({ + path: '/detail?type=1&id=' + id +}) +} else { +console.log(id) +this.$router.push({ + path: '/news' +}) +} }, honorto(id){ this.$router.push({ @@ -642,4 +653,7 @@ h6 { .a::after{ background-color: unset; } +.yanshi::after{ + width: 0px !important; +}