|
|
|
@ -1,31 +1,34 @@ |
|
|
|
|
<template> |
|
|
|
|
<view> |
|
|
|
|
<view class="filter"> |
|
|
|
|
<uni-search-bar class="search" radius="30" placeholder="请输入文章名称,标签" v-model="keyword" clearButton="auto" cancelButton="none" /> |
|
|
|
|
<view :class="['sort', sort]" @click="switchSort"></view> |
|
|
|
|
<uni-icons class="icon" custom-prefix="iconfont" type="icon-filter" size="22" color="#007eff" @click="popup = true"></uni-icons> |
|
|
|
|
<view class="search-wrap"> |
|
|
|
|
<image class="bg" src="@/static/image/info-bg.jpg"></image> |
|
|
|
|
<view class="info"> |
|
|
|
|
<view class="text">行业资讯与活动</view> |
|
|
|
|
<view class="text">速览</view> |
|
|
|
|
<uni-search-bar class="search" radius="30" placeholder="请输入文章名称,标签" v-model="keyword" clearButton="auto" cancelButton="none" bgColor="#fff" /> |
|
|
|
|
</view> |
|
|
|
|
</view> |
|
|
|
|
|
|
|
|
|
<view class="type"> |
|
|
|
|
<view v-for="(item, i) in classifications.slice(0, 4)" :key="i" :class="['item', {active: active == item.id}]" @click="classificationClick(item, 1)">{{ item.classificationName }}</view> |
|
|
|
|
<image class="unfold" src="@/static/image/unfold.png" mode="widthFix" @click="typeVisible = true"></image> |
|
|
|
|
</view> |
|
|
|
|
|
|
|
|
|
<template v-if="list.length"> |
|
|
|
|
<view class="list"> |
|
|
|
|
<view class="item" @click="toDetail(item)"> |
|
|
|
|
<image class="pic" src="@/static/image/logo.png"></image> |
|
|
|
|
<view class="right"> |
|
|
|
|
<view class="title">测试标题</view> |
|
|
|
|
<view class="labels"> |
|
|
|
|
<view class="label">大赛</view> |
|
|
|
|
<view class="label">大赛发动机可</view> |
|
|
|
|
</view> |
|
|
|
|
<view class="metas"> |
|
|
|
|
<view class="meta"> |
|
|
|
|
<uni-icons class="icon" type="eye" size="22" color="#007FFF"></uni-icons> |
|
|
|
|
123人学过 |
|
|
|
|
</view> |
|
|
|
|
<view class="meta"> |
|
|
|
|
<uni-icons class="icon" type="star" size="22" color="#007eff"></uni-icons> |
|
|
|
|
123 |
|
|
|
|
<view v-for="(item, i) in list" :key="i" class="item" @click="toDetail(item)"> |
|
|
|
|
<view class="title">{{ item.title }}</view> |
|
|
|
|
<view class="texts"> |
|
|
|
|
<view class="left"> |
|
|
|
|
<view class="des" v-html="item.mainBody"></view> |
|
|
|
|
<view class="metas"> |
|
|
|
|
<text class="date">{{ item.releaseTime }}</text> |
|
|
|
|
<view v-if="item.labelName" class="labels"> |
|
|
|
|
<view v-for="(label, j) in item.labelName" :key="j" class="label">{{ label }}</view> |
|
|
|
|
</view> |
|
|
|
|
</view> |
|
|
|
|
</view> |
|
|
|
|
<image class="pic" :src="item.bannerImg"></image> |
|
|
|
|
</view> |
|
|
|
|
</view> |
|
|
|
|
</view> |
|
|
|
@ -33,55 +36,42 @@ |
|
|
|
|
</template> |
|
|
|
|
<empty v-else></empty> |
|
|
|
|
|
|
|
|
|
<filter-popup :data="filterData" :form.sync="filterForm" v-model="popup" title="全部筛选" height="1104rpx" @finsh="subFinsh"></filter-popup> |
|
|
|
|
<view class="type-popup" v-show="typeVisible"> |
|
|
|
|
<uni-icons class="close" type="closeempty" size="20" color="#757575" @click="closeType"></uni-icons> |
|
|
|
|
<view class="title">所属分类</view> |
|
|
|
|
<view class="types"> |
|
|
|
|
<view v-for="(item, i) in classifications" :key="i" :class="['item', {active: active == item.id}]" @click="classificationClick(item)">{{ item.classificationName }}</view> |
|
|
|
|
</view> |
|
|
|
|
</view> |
|
|
|
|
</view> |
|
|
|
|
</template> |
|
|
|
|
|
|
|
|
|
<script> |
|
|
|
|
import { queryCustomer } from '@/apis/modules/client.js' |
|
|
|
|
import { list, del } from '@/apis/modules/order.js' |
|
|
|
|
import { partnerOperatingList, queryClassificationByType } from '@/apis/modules/article.js' |
|
|
|
|
export default { |
|
|
|
|
data() { |
|
|
|
|
return { |
|
|
|
|
popup: false, |
|
|
|
|
//筛选表单数据 |
|
|
|
|
filterData: [ |
|
|
|
|
classifications: [ |
|
|
|
|
{ |
|
|
|
|
children: false,//是否有子项 |
|
|
|
|
title: "所属类型", |
|
|
|
|
key: "classificationId", //键名 接收对象名字 |
|
|
|
|
keyValue: "value", //获取的值是哪个 |
|
|
|
|
isRadio: true, //是否单选 否则多选 |
|
|
|
|
data: [ |
|
|
|
|
{ |
|
|
|
|
title: "待发货", |
|
|
|
|
value: 0 |
|
|
|
|
}, |
|
|
|
|
{ |
|
|
|
|
title: "已完成", |
|
|
|
|
value: 1 |
|
|
|
|
}, |
|
|
|
|
], |
|
|
|
|
id: '', |
|
|
|
|
classificationName: '不限' |
|
|
|
|
} |
|
|
|
|
], |
|
|
|
|
filterForm: {}, |
|
|
|
|
active: '', |
|
|
|
|
typeVisible: false, |
|
|
|
|
reachBottom: 0, // 是否是上拉加载。0->否,1->是,-1->加载完所有数据 |
|
|
|
|
status: 'more', // 上拉加载状态 more|loading|noMore |
|
|
|
|
searchTimer: null, |
|
|
|
|
orderStatus: '', |
|
|
|
|
sort: 'desc', |
|
|
|
|
articleNameSort: 'desc', |
|
|
|
|
keyword: '', |
|
|
|
|
list: [ |
|
|
|
|
{ |
|
|
|
|
name: '1' |
|
|
|
|
} |
|
|
|
|
], |
|
|
|
|
list: [], |
|
|
|
|
page: 1, |
|
|
|
|
pageSize: 10, |
|
|
|
|
} |
|
|
|
|
}, |
|
|
|
|
watch: { |
|
|
|
|
keyword () { |
|
|
|
|
this.active = '' |
|
|
|
|
clearTimeout(this.searchTimer) |
|
|
|
|
this.searchTimer = setTimeout(() => { |
|
|
|
|
this.initList() |
|
|
|
@ -104,31 +94,36 @@ |
|
|
|
|
} |
|
|
|
|
}, |
|
|
|
|
onShow() { |
|
|
|
|
// this.initRole() |
|
|
|
|
this.initRole() |
|
|
|
|
}, |
|
|
|
|
methods: { |
|
|
|
|
// 初始化权限 |
|
|
|
|
initRole() { |
|
|
|
|
if (!uni.getStorageSync('auth').includes('资讯')) { |
|
|
|
|
this.per = false |
|
|
|
|
} |
|
|
|
|
this.initList() |
|
|
|
|
this.getClassification() |
|
|
|
|
}, |
|
|
|
|
getList() { |
|
|
|
|
const data = { |
|
|
|
|
keywords: this.keyword, |
|
|
|
|
keyWord: this.keyword, |
|
|
|
|
pageNum: this.page, |
|
|
|
|
pageSize: this.pageSize, |
|
|
|
|
sort: this.sort, |
|
|
|
|
orderStatus: this.orderStatus, |
|
|
|
|
type: this.curTab |
|
|
|
|
querySource: 4, |
|
|
|
|
typeId: 2, |
|
|
|
|
articleNameSort: this.articleNameSort, |
|
|
|
|
classificationId: this.active |
|
|
|
|
} |
|
|
|
|
uni.showLoading({ |
|
|
|
|
title: '加载中' |
|
|
|
|
}) |
|
|
|
|
list(data).then(({ data }) => { |
|
|
|
|
partnerOperatingList(data).then(({ data }) => { |
|
|
|
|
uni.hideLoading() |
|
|
|
|
// 未加载完所有数据,并且不是筛选,则拼接list,否则直接赋值 |
|
|
|
|
const list = data.records |
|
|
|
|
list.map(e => { |
|
|
|
|
e.toggle = e.orderContent.length < 14 // 超过了14个字才需要显示展开按钮 |
|
|
|
|
list.forEach(e => { |
|
|
|
|
if (e.labelName) e.labelName = e.labelName.split(',').slice(0, 2) // 只展示前两个标签 |
|
|
|
|
}) |
|
|
|
|
this.list = this.reachBottom > 0 ? [...this.list, ...list] : list |
|
|
|
|
this.page++ // 每次获取了数据后page+1 |
|
|
|
@ -144,80 +139,179 @@ |
|
|
|
|
this.reachBottom = 0 |
|
|
|
|
this.getList() |
|
|
|
|
}, |
|
|
|
|
// 获取所属分类 |
|
|
|
|
getClassification() { |
|
|
|
|
queryClassificationByType(2).then(({ data }) => { |
|
|
|
|
this.classifications.push(...data) |
|
|
|
|
}).catch(e => {}) |
|
|
|
|
}, |
|
|
|
|
// 所属分类点击回调 |
|
|
|
|
classificationClick(item, query) { |
|
|
|
|
this.active = item.id |
|
|
|
|
query && this.initList() |
|
|
|
|
}, |
|
|
|
|
// 关闭所属分类弹框 |
|
|
|
|
closeType() { |
|
|
|
|
this.typeVisible = false |
|
|
|
|
this.initList() |
|
|
|
|
}, |
|
|
|
|
// 展开 |
|
|
|
|
toggle(item) { |
|
|
|
|
item.toggle = !item.toggle |
|
|
|
|
}, |
|
|
|
|
// 筛选确定回调 |
|
|
|
|
subFinsh(val) { |
|
|
|
|
const { orderStatus } = val |
|
|
|
|
this.orderStatus = orderStatus.length ? orderStatus[0] : '' |
|
|
|
|
this.initList() |
|
|
|
|
}, |
|
|
|
|
// 排序 |
|
|
|
|
switchSort() { |
|
|
|
|
this.sort = this.sort === 'desc' ? 'asc' : 'desc' |
|
|
|
|
this.initList() |
|
|
|
|
}, |
|
|
|
|
// tab切换 |
|
|
|
|
tabChange(tab) { |
|
|
|
|
this.curTab = tab.id |
|
|
|
|
this.articleNameSort = this.articleNameSort === 'desc' ? 'asc' : 'desc' |
|
|
|
|
this.initList() |
|
|
|
|
}, |
|
|
|
|
// 跳转详情 |
|
|
|
|
toDetail(item) { |
|
|
|
|
this.$util.to(`/team/article/article`) |
|
|
|
|
this.$util.to(`/team/article/article?id=` + item.id) |
|
|
|
|
}, |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
</script> |
|
|
|
|
|
|
|
|
|
<style scoped lang="scss"> |
|
|
|
|
.search-wrap { |
|
|
|
|
position: relative; |
|
|
|
|
height: 300rpx; |
|
|
|
|
padding: 120rpx 10px 0; |
|
|
|
|
.bg { |
|
|
|
|
position: absolute; |
|
|
|
|
top: 0; |
|
|
|
|
left: 0; |
|
|
|
|
width: 100%; |
|
|
|
|
height: 100%; |
|
|
|
|
} |
|
|
|
|
.info { |
|
|
|
|
position: relative; |
|
|
|
|
} |
|
|
|
|
.text { |
|
|
|
|
margin: 0 10px 10rpx; |
|
|
|
|
font-size: 50rpx; |
|
|
|
|
color: #fff; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
.type { |
|
|
|
|
position: relative; |
|
|
|
|
display: flex; |
|
|
|
|
padding: 30rpx; |
|
|
|
|
background-color: #fff; |
|
|
|
|
.item { |
|
|
|
|
padding: 0 15rpx; |
|
|
|
|
line-height: 1.6; |
|
|
|
|
font-size: 28rpx; |
|
|
|
|
color: #333; |
|
|
|
|
white-space: nowrap; |
|
|
|
|
&.active { |
|
|
|
|
color: #007FFF; |
|
|
|
|
font-weight: 600; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
.unfold { |
|
|
|
|
position: absolute; |
|
|
|
|
right: 40rpx; |
|
|
|
|
width: 40rpx; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
.type-popup { |
|
|
|
|
z-index: 10; |
|
|
|
|
position: fixed; |
|
|
|
|
top: 0; |
|
|
|
|
left: 0; |
|
|
|
|
width: 100%; |
|
|
|
|
height: 100%; |
|
|
|
|
padding: 10rpx; |
|
|
|
|
background-color: #fff; |
|
|
|
|
.close { |
|
|
|
|
position: absolute; |
|
|
|
|
top: 50rpx; |
|
|
|
|
right: 50rpx; |
|
|
|
|
} |
|
|
|
|
.title { |
|
|
|
|
margin: 150rpx 20rpx 30rpx; |
|
|
|
|
font-size: 30rpx; |
|
|
|
|
color: #333; |
|
|
|
|
} |
|
|
|
|
.types { |
|
|
|
|
display: flex; |
|
|
|
|
flex-wrap: wrap; |
|
|
|
|
} |
|
|
|
|
.item { |
|
|
|
|
width: calc((100% - 80rpx) / 3); |
|
|
|
|
margin: 10rpx; |
|
|
|
|
font-size: 28rpx; |
|
|
|
|
line-height: 3; |
|
|
|
|
text-align: center; |
|
|
|
|
color: #1f1f1f; |
|
|
|
|
background-color: #dbebff; |
|
|
|
|
border-radius: 2px; |
|
|
|
|
&.active { |
|
|
|
|
color: #fff; |
|
|
|
|
background-color: #007EFF; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
.list { |
|
|
|
|
margin-top: 20rpx; |
|
|
|
|
background-color: #fff; |
|
|
|
|
.item { |
|
|
|
|
margin-bottom: 10rpx; |
|
|
|
|
padding: 20rpx 40rpx; |
|
|
|
|
border-bottom: 1px solid #f1f1f1; |
|
|
|
|
} |
|
|
|
|
.texts { |
|
|
|
|
display: flex; |
|
|
|
|
justify-content: space-between; |
|
|
|
|
align-items: center; |
|
|
|
|
margin-top: 10rpx; |
|
|
|
|
padding: 20rpx 40rpx; |
|
|
|
|
border-bottom: 1px solid #f1f1f1; |
|
|
|
|
} |
|
|
|
|
.pic { |
|
|
|
|
width: 200rpx; |
|
|
|
|
height: 140rpx; |
|
|
|
|
width: 260rpx; |
|
|
|
|
height: 180rpx; |
|
|
|
|
border-radius: 8px; |
|
|
|
|
} |
|
|
|
|
.right { |
|
|
|
|
width: calc(100% - 230rpx); |
|
|
|
|
.left { |
|
|
|
|
width: calc(100% - 280rpx); |
|
|
|
|
} |
|
|
|
|
.title { |
|
|
|
|
font-size: 32rpx; |
|
|
|
|
font-weight: 600; |
|
|
|
|
color: #333; |
|
|
|
|
} |
|
|
|
|
.des { |
|
|
|
|
display: -webkit-box; |
|
|
|
|
-webkit-box-orient: vertical; |
|
|
|
|
-webkit-line-clamp: 2; |
|
|
|
|
text-overflow: ellipsis; |
|
|
|
|
overflow: hidden; |
|
|
|
|
} |
|
|
|
|
.metas { |
|
|
|
|
display: flex; |
|
|
|
|
justify-content: space-between; |
|
|
|
|
align-items: center; |
|
|
|
|
} |
|
|
|
|
.date { |
|
|
|
|
font-size: 24rpx; |
|
|
|
|
color: #ccc; |
|
|
|
|
white-space: nowrap; |
|
|
|
|
} |
|
|
|
|
.labels { |
|
|
|
|
display: inline-flex; |
|
|
|
|
flex-wrap: wrap; |
|
|
|
|
align-items: center; |
|
|
|
|
margin: 15rpx 0; |
|
|
|
|
margin-top: 15rpx; |
|
|
|
|
} |
|
|
|
|
.label { |
|
|
|
|
width: 90rpx; |
|
|
|
|
padding: 2px 6px; |
|
|
|
|
margin-right: 20rpx; |
|
|
|
|
margin: 0 10rpx 15rpx 0; |
|
|
|
|
font-size: 24rpx; |
|
|
|
|
color: #fff; |
|
|
|
|
text-overflow: ellipsis; |
|
|
|
|
white-space: nowrap; |
|
|
|
|
overflow: hidden; |
|
|
|
|
background-color: #ccc; |
|
|
|
|
border-radius: 4px; |
|
|
|
|
} |
|
|
|
|
.metas { |
|
|
|
|
display: inline-flex; |
|
|
|
|
align-items: center; |
|
|
|
|
} |
|
|
|
|
.meta { |
|
|
|
|
display: inline-flex; |
|
|
|
|
align-items: center; |
|
|
|
|
margin-right: 20rpx; |
|
|
|
|
font-size: 24rpx; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
</style> |
|
|
|
|