列表
This commit is contained in:
@@ -45,7 +45,6 @@ export default {
|
||||
categoryType: '1',
|
||||
}
|
||||
}).then((res)=>{
|
||||
console.log(res);
|
||||
this.list = res.data.records
|
||||
})
|
||||
},
|
||||
|
||||
@@ -1,15 +1,15 @@
|
||||
<template>
|
||||
<div class="newList">
|
||||
<div class="header">
|
||||
<div class="header" v-if="tabList.length">
|
||||
<div class="header-tab">
|
||||
<img src="https://cdn.cunwuyun.cn/dvcp/live/dh.png" alt="" class="more-icon" @click="toSelect()">
|
||||
<u-tabs :list="tabList" :current="currIndex" @change="changeTab" style="width:650rpx" :font-size="26"></u-tabs>
|
||||
<!-- <div v-for="(item, index) in tabList" :key="index" @click="changeTab(index)" v-if="index < 5" :class="currIndex == index ? 'tab-item active-item' : 'tab-item'">{{item}}<span class="active-line" v-if="currIndex == index"></span></div> -->
|
||||
<!-- <div v-for="(item, index) in tabList" :key="index" @click="changeTab(item.id)" v-if="index < 5" :class="currId == item.id ? 'tab-item active-item' : 'tab-item'">{{item.name}}<span class="active-line" v-if="currId == item.id"></span></div> -->
|
||||
</div>
|
||||
</div>
|
||||
<div class="news-list">
|
||||
<div class="item" hover-class="bg-hover" v-for="(item, index) in newsList" :key="index" @click="toDetail(item)">
|
||||
<div class="item-wrapper solid" :style="{display: type === '1' ? 'block' : 'flex'}">
|
||||
<div class="news-list" v-if="newsList.length">
|
||||
<!-- <div class="item" hover-class="bg-hover" v-for="(item, index) in newsList" :key="index" @click="toDetail(item)">
|
||||
<div class="item-wrapper solid" style="display: flex">
|
||||
<div class="item-left flex1">
|
||||
<h2 :style="{marginBottom: item.type === '1' ? '16rpx' : '30rpx'}" v-if="item.type != '1'">{{ item.title }}</h2>
|
||||
<div class="item-video" v-if="item.type === '1'">
|
||||
@@ -26,10 +26,19 @@
|
||||
</div>
|
||||
<image v-if="item.type === '0'" :src="item.coverFile" mode="aspectFill" />
|
||||
</div>
|
||||
</div> -->
|
||||
|
||||
<div class="item" v-for="(item,index) in newsList" :key="index">
|
||||
<div class="left">
|
||||
<h2>{{ item.title }}</h2>
|
||||
<p><span>通知公告</span>{{ item.createTime }}</p>
|
||||
</div>
|
||||
<div class="right">
|
||||
<img :src="item.pictureUrl" alt="">
|
||||
</div>
|
||||
</div>
|
||||
<AiEmpty v-if="!newsList.length && isShowEmpty"/>
|
||||
<div class="noMore" v-if="isMore && current !== 0">没有更多了噢!</div>
|
||||
</div>
|
||||
<AiEmpty v-if="!newsList.length && isShowEmpty"/>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
@@ -38,17 +47,17 @@
|
||||
name: 'newList',
|
||||
data () {
|
||||
return {
|
||||
currIndex: 0,
|
||||
currIndex: '0',
|
||||
title: '',
|
||||
isLoading: false,
|
||||
newsList: [],
|
||||
isShowEmpty: false,
|
||||
isMore: false,
|
||||
current: 0,
|
||||
current: 1,
|
||||
areaId: '',
|
||||
tabList: [],
|
||||
parentId: '',
|
||||
parentName: ''
|
||||
parentName: '',
|
||||
}
|
||||
},
|
||||
|
||||
@@ -63,6 +72,9 @@
|
||||
this.currIndex = uni.getStorageSync('newTypeIndex')
|
||||
this.getListInit()
|
||||
}
|
||||
// uni.$on('update',()=>{
|
||||
// this.getListInit()
|
||||
// })
|
||||
document.title = this.parentName
|
||||
this.getList()
|
||||
this.getListInit()
|
||||
@@ -75,12 +87,13 @@
|
||||
},
|
||||
changeTab(index) {
|
||||
this.currIndex = index
|
||||
// this.newsList = []
|
||||
this.getListInit()
|
||||
},
|
||||
|
||||
onConfirm () {
|
||||
this.isMore = false
|
||||
this.current = 0
|
||||
this.current = 1
|
||||
|
||||
this.$nextTick(() => {
|
||||
this.getNewsList(this.areaId)
|
||||
@@ -95,34 +108,43 @@
|
||||
categoryType: '2',
|
||||
}
|
||||
}).then((res)=>{
|
||||
// console.log(res,'新闻分类');
|
||||
var array = []
|
||||
res.data.records.map(item=>{
|
||||
array.push({ name: item.categoryName })
|
||||
array.push({
|
||||
name: item.categoryName,
|
||||
id: item.id,
|
||||
parentId: item.parentId,
|
||||
})
|
||||
})
|
||||
this.tabList = array
|
||||
console.log(this.tabList[this.currIndex].parentId,'parentId');
|
||||
})
|
||||
},
|
||||
|
||||
// toNewList() {
|
||||
// uni.navigateTo({url: `./newList?parentName=${this.parentName}`})
|
||||
// },
|
||||
|
||||
getListInit() {
|
||||
this.isMore = false
|
||||
this.current = 0
|
||||
this.current = 1
|
||||
this.newsList = []
|
||||
this.getNewsList()
|
||||
},
|
||||
// 获取新闻列表
|
||||
getNewsList() {
|
||||
if (this.isMore || this.isLoading) return
|
||||
var type = this.currIndex
|
||||
if(this.currIndex == 0) {
|
||||
type = ''
|
||||
}
|
||||
this.isLoading = true
|
||||
this.$http.post(`/app/appnewscenterinfo/listForWxNew?current=${this.current + 1}&type=${type}&size=10&title=${this.title}&areaId=${this.areaId}`, null, {
|
||||
withoutToken: 1
|
||||
// if (this.isMore || this.isLoading) return
|
||||
// var type = this.currIndex
|
||||
// if(this.currIndex == 0) {
|
||||
// type = ''
|
||||
// }
|
||||
// this.isLoading = true
|
||||
|
||||
this.$http.post(`/app/apppublicityinfo/list?`, null, {
|
||||
params: {
|
||||
current: this.current,
|
||||
moduleId: this.tabList[this.currIndex].parentId,
|
||||
categoryId: this.tabList[this.currIndex].id,
|
||||
}
|
||||
}).then(res => {
|
||||
console.log(res);
|
||||
if (res.code === 0) {
|
||||
this.isShowEmpty = true
|
||||
|
||||
@@ -142,7 +164,7 @@
|
||||
|
||||
const data = res.data.records
|
||||
this.newsList.push(...data)
|
||||
this.current = this.current + 1
|
||||
this.current = this.current
|
||||
this.isLoading = false
|
||||
|
||||
this.$nextTick(() => {
|
||||
@@ -181,18 +203,69 @@
|
||||
right: 32rpx;
|
||||
top: 20rpx;
|
||||
}
|
||||
div {
|
||||
height: 80px;
|
||||
line-height: 80px;
|
||||
font-size: 26px;
|
||||
transition-duration: 1s;
|
||||
padding: 0px 30px;
|
||||
}
|
||||
.tab-item{
|
||||
color: #666;
|
||||
position: relative;
|
||||
}
|
||||
.active-item{
|
||||
color: #3376FD;
|
||||
font-weight: 600;
|
||||
|
||||
}
|
||||
.active-line{
|
||||
width: 48px;
|
||||
height: 4px;
|
||||
background: #FFF;
|
||||
position: absolute;
|
||||
bottom: 14px;
|
||||
left: 50%;
|
||||
margin-left: -24px;
|
||||
background-color: #3376FD;
|
||||
}
|
||||
}
|
||||
.news-list{
|
||||
padding-top: 20rpx;
|
||||
background: #FFF;
|
||||
padding-top: 90px;
|
||||
box-sizing: border-box;
|
||||
.item {
|
||||
padding: 30px 30px 20px 30px;
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
border-bottom: 1px solid #DDDDDD;
|
||||
.left {
|
||||
h2 {
|
||||
font-size: 30px;
|
||||
color: #333333;
|
||||
font-weight: 600;
|
||||
overflow:hidden;
|
||||
text-overflow:ellipsis;
|
||||
display:-webkit-box;
|
||||
-webkit-box-orient:vertical;
|
||||
-webkit-line-clamp:2;
|
||||
}
|
||||
p {
|
||||
margin-top: 30px;
|
||||
font-size: 22px;
|
||||
color: #999999;
|
||||
}
|
||||
|
||||
}
|
||||
.right {
|
||||
width: 224px;
|
||||
height: 140px;
|
||||
img {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
.news {
|
||||
min-height: 100vh;
|
||||
|
||||
@@ -24,12 +24,12 @@
|
||||
},
|
||||
|
||||
methods: {
|
||||
tabClick(index) {
|
||||
this.tabIndex = index
|
||||
uni.setStorageSync('newTypeIndex', index)
|
||||
uni.navigateBack({delta: 1})
|
||||
},
|
||||
getList() {
|
||||
tabClick(index) {
|
||||
this.tabIndex = index
|
||||
uni.setStorageSync('newTypeIndex', index)
|
||||
uni.navigateBack({delta: 1})
|
||||
},
|
||||
getList() {
|
||||
this.$http.post('/app/apppublicitycategory/list',null,{
|
||||
params: {
|
||||
parentId: this.parentId,
|
||||
|
||||
Reference in New Issue
Block a user