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; +}