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({
url:'/article/enterpriseNews'
url:'/article/enterpriseNews',
params
})
}
//首页企业新闻
export function indexInformation(){
export function indexInformation(params){
return request({
url:'/article/newsInformation'
url:'/article/newsInformation',
params
})
}
//首页新闻分类

View File

@ -25,7 +25,7 @@
<div class="content-left">
<h3>{{newscatagary[0]?.name}}</h3>
<h6>{{newscatagary[0]?.enName}}</h6>
<h5 style="margin-top:15px; color: #8e8e95;">{{newscatagary[0]?.describe}}</h5>
<div style="width: 50%;"></div>
</div>
@ -309,7 +309,10 @@ export default {
componyhonor().then((res)=>{
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.$nextTick(() => {
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
})
NewCategary().then((res)=>{
this.newscatagary=res.data
})
//
// this.observer = new IntersectionObserver(entries => {
// entries.forEach(entry => {
@ -364,20 +368,28 @@ export default {
next(){
if(this.textindex<this.hydata.length-1){
this.textindex=this.textindex+1
// if(this.textindex<this.hydata.length-1){
// this.textindex=this.textindex+1
// }else{
// this.textindex=0
// }
if(this.textindex>=this.indexinfo.length-1){
this.textindex = 0
}else{
this.textindex=0
this.textindex=this.textindex+1
}
},
back(){
if(this.textindex>0){
// if(this.textindex>0){
// this.textindex=this.textindex-1
// }else{
// this.textindex=this.hydata.length-1
// }
this.textindex=this.textindex-1
}else{
this.textindex=this.hydata.length-1
if(this.textindex<0){
this.textindex= this.indexinfo.length-1
}
},

View File

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

View File

@ -5,7 +5,8 @@
<div class="content">
<div class="page_nav">
<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>