bug修复

This commit is contained in:
Hokin 2024-07-27 17:51:14 +08:00
parent a47b1c5ee1
commit 2f8199108c
4 changed files with 74 additions and 52 deletions

View File

@ -133,15 +133,17 @@ export function componyhonor(){
}) })
} }
//首页企业新闻 //首页企业新闻
export function indexNews(){ export function indexNews(params){
return request({ return request({
url:'/article/enterpriseNews' url:'/article/enterpriseNews',
params
}) })
} }
//首页企业新闻 //首页企业新闻
export function indexInformation(){ export function indexInformation(params){
return request({ return request({
url:'/article/newsInformation' url:'/article/newsInformation',
params
}) })
} }
//首页新闻分类 //首页新闻分类

View File

@ -25,7 +25,7 @@
<div class="content-left"> <div class="content-left">
<h3>{{newscatagary[0]?.name}}</h3> <h3>{{newscatagary[0]?.name}}</h3>
<h6>{{newscatagary[0]?.enName}}</h6> <h6>{{newscatagary[0]?.enName}}</h6>
<h5 style="margin-top:15px; color: #8e8e95;">{{newscatagary[0]?.describe}}</h5>
<div style="width: 50%;"></div> <div style="width: 50%;"></div>
</div> </div>
@ -81,7 +81,7 @@
<div class="content-right"> <div class="content-right">
<div class="swiper-container swiper6"> <div class="swiper-container swiper6">
<div class="swiper-wrapper" > <div class="swiper-wrapper" >
<div class="swiper-slide yanshi" v-for="item in indexinfo" :key="item.id"><img :src="item.pic" <div class="swiper-slide yanshi" v-for="item in indexinfo" :key="item.id"><img :src="item.pic"
style="width: 851px;height:320px;cursor: pointer;" @click="routerTo(item.id)"></div> style="width: 851px;height:320px;cursor: pointer;" @click="routerTo(item.id)"></div>
@ -309,7 +309,10 @@ export default {
componyhonor().then((res)=>{ componyhonor().then((res)=>{
this.componydata=res.data this.componydata=res.data
}) })
indexInformation().then((res)=>{ NewCategary().then((res)=>{
this.newscatagary=res.data
indexInformation({articleType:res.data[1]?.name}).then((res)=>{
this.indexinfo=res.data this.indexinfo=res.data
this.$nextTick(() => { this.$nextTick(() => {
new Swiper('.swiper6', { new Swiper('.swiper6', {
@ -330,12 +333,13 @@ export default {
}) })
}) })
}) })
indexNews().then((res)=>{ indexNews({articleType:res.data[0]?.name}).then((res)=>{
console.log(1111)
this.indexNew=res.data this.indexNew=res.data
}) })
NewCategary().then((res)=>{
this.newscatagary=res.data
}) })
// //
// this.observer = new IntersectionObserver(entries => { // this.observer = new IntersectionObserver(entries => {
// entries.forEach(entry => { // entries.forEach(entry => {
@ -364,22 +368,30 @@ export default {
next(){ next(){
if(this.textindex<this.hydata.length-1){ // if(this.textindex<this.hydata.length-1){
this.textindex=this.textindex+1 // this.textindex=this.textindex+1
// }else{
// this.textindex=0
// }
if(this.textindex>=this.indexinfo.length-1){
this.textindex = 0
}else{ }else{
this.textindex=0 this.textindex=this.textindex+1
} }
}, },
back(){ back(){
if(this.textindex>0){ // if(this.textindex>0){
this.textindex=this.textindex-1 // this.textindex=this.textindex-1
}else{ // }else{
this.textindex=this.hydata.length-1 // this.textindex=this.hydata.length-1
} // }
this.textindex=this.textindex-1
if(this.textindex<0){
this.textindex= this.indexinfo.length-1
}
}, },
switchto() { switchto() {
this.$router.push({ this.$router.push({

View File

@ -9,8 +9,8 @@
</div> </div>
<div class="list" style="bottom:-15px"> <div class="list" style="bottom:-15px">
<el-tabs v-model="activeName" @tab-click="handleClick"> <el-tabs v-model="activeName" @tab-click="handleClick">
<el-tab-pane label="企业新闻" name="企业新闻"></el-tab-pane> <el-tab-pane :label="newscatagary[0]?.name" :name="newscatagary[0]?.name"></el-tab-pane>
<el-tab-pane label="新闻资讯" name="新闻资讯"></el-tab-pane> <el-tab-pane :label="newscatagary[1]?.name" :name="newscatagary[1]?.name"></el-tab-pane>
</el-tabs> </el-tabs>
@ -74,7 +74,7 @@
</template> </template>
<script> <script>
import '@/assets/images/news1.png' import '@/assets/images/news1.png'
import { getnews,getmsg} from '@/api'; import { getnews,getmsg,NewCategary} from '@/api';
import { Loading } from 'element-ui'; import { Loading } from 'element-ui';
export default{ export default{
data(){ data(){
@ -83,14 +83,18 @@ export default{
newshow:[], newshow:[],
rest:[], rest:[],
newslist:[], newslist:[],
newscatagary:[],
page:0, page:0,
content:'' content:''
} }
}, },
mounted(){ mounted(){
let loadingInstance = Loading.service('loading');
getnews({'page':0}).then((res)=>{ let loadingInstance = Loading.service('loading');
NewCategary().then((res)=>{
this.newscatagary=res.data
})
getnews({'page':0,'articleType':this.activeName}).then((res)=>{
@ -109,12 +113,14 @@ export default{
}) })
}, },
methods:{ methods:{
handleClick(){ handleClick(){
console.log(1111)
this.rest=[] this.rest=[]
let loadingInstance = Loading.service('loading'); let loadingInstance = Loading.service('loading');
if(this.activeName=='新闻资讯'){ // if(this.activeName==''){
getmsg({'page':0}).then((res)=>{ getmsg({'page':0,'articleType':this.activeName}).then((res)=>{
// richText // richText
res.data.content.forEach(item => { res.data.content.forEach(item => {
@ -127,27 +133,28 @@ export default{
this.newshow=arr this.newshow=arr
loadingInstance.close(); loadingInstance.close();
}) })
}else if(this.activeName=='企业新闻'){ // }else if(this.activeName==''){
getnews({'page':0}).then((res)=>{ // getnews({'page':0,'articleType':activeName}).then((res)=>{
res.data.content.forEach(item => { // res.data.content.forEach(item => {
item.content = item.content?.replace(/<[^>]+>/g, '').trim(); // item.content = item.content?.replace(/<[^>]+>/g, '').trim();
}); // });
this.newslist=res.data.content // this.newslist=res.data.content
let arr=this.newslist.slice(0,3) // let arr=this.newslist.slice(0,3)
this.newshow=arr // this.newshow=arr
loadingInstance.close(); // loadingInstance.close();
}) // })
} // }
}, },
addnews(){ addnews(){
this.page=this.page+1 this.page=this.page+1
if(this.activeName=='新闻资讯'){ // if(this.activeName==''){
getmsg({'page':this.page}).then((res)=>{ getmsg({'page':this.page}).then((res)=>{
// console.log(res) // console.log(res)
for(let i=0;i<res.data.content.length;i++){ for(let i=0;i<res.data.content.length;i++){
@ -159,19 +166,19 @@ loadingInstance.close();
} }
}) })
}else if(this.activeName=='企业新闻'){ // }else if(this.activeName==''){
getnews({'page':this.page}).then((res)=>{ // getnews({'page':this.page}).then((res)=>{
// console.log(res) // // console.log(res)
for(let i=0;i<res.data.content.length;i++){ // for(let i=0;i<res.data.content.length;i++){
res.data.content[i].content= res.data.content[i].content?.replace(/<[^>]+>/g, '').trim(); // res.data.content[i].content= res.data.content[i].content?.replace(/<[^>]+>/g, '').trim();
res.data.content[i].day=res.data.content[i].releaseTime.slice(-2) // res.data.content[i].day=res.data.content[i].releaseTime.slice(-2)
res.data.content[i].year=res.data.content[i].releaseTime.slice(0,7) // res.data.content[i].year=res.data.content[i].releaseTime.slice(0,7)
this.rest.push(res.data.content[i]) // this.rest.push(res.data.content[i])
} // }
}) // })
} // }
}, },
changeto(id){ changeto(id){

View File

@ -5,7 +5,8 @@
<div class="content"> <div class="content">
<div class="page_nav"> <div class="page_nav">
<div class="name"> <div class="name">
<a style="padding: 0;" href="">工程展示</a> <a href="javascript:;">工程展示</a> <a style="padding: 0;" href="">工程展示</a>
<!-- <a href="javascript:;">工程展示</a> -->
</div> </div>
</div> </div>