340 lines
9.4 KiB
Vue
340 lines
9.4 KiB
Vue
<template> <!-- 学堂 -->
|
||
<view class="wrap">
|
||
<!-- 吸顶 -->
|
||
<u-sticky offset-top="0" customNavHeight="0">
|
||
<!-- 顶部 -->
|
||
<uiheader></uiheader>
|
||
<!-- 搜索栏 -->
|
||
<cmsearch></cmsearch>
|
||
<!-- 轮播图-传值:list="数组" -->
|
||
<cmswiper page="article" height="320rpx"></cmswiper>
|
||
<view class="layout-sch bg-white flex justify-between align-center">
|
||
<view class="select down" @click="handSelect">{{ pickText }}</view>
|
||
<view class="search flex justify-between align-center">
|
||
<input class="search-input p-left-20" type="text" placeholder="关键字搜索" v-model="keyword"/>
|
||
<view class="search-btn" @click="getContentList">搜索</view>
|
||
</view>
|
||
</view>
|
||
</u-sticky>
|
||
<!-- 材料专业资料列表 -->
|
||
<view class="layout layout-list" v-if="pickIndex == 0">
|
||
<view class="item flex" v-for="(item, index) in list" :key="index"
|
||
@click="$jump(`/pages/school/detail?id=${item._id}`)">
|
||
<view class="img">
|
||
<template v-if="item.files && item.files.length > 0">
|
||
<template v-if="['doc', 'docx'].includes(item.files[0].split('.').pop())">
|
||
<file-word theme="outline" class="pointer" size="60" fill="#4a90e2" strokeLinecap="square"/>
|
||
</template>
|
||
<template v-else-if="['xls', 'xlsx'].includes(item.files[0].split('.').pop())">
|
||
<file-excel theme="outline" class="pointer" size="60" fill="#417505" strokeLinecap="square"/>
|
||
</template>
|
||
<template v-else-if="['pdf'].includes(item.files[0].split('.').pop())">
|
||
<file-pdf-one theme="outline" class="pointer" size="60" fill="#f5a623" strokeLinecap="square"/>
|
||
</template>
|
||
<template v-else>
|
||
<el-image :src="item.files[0]" style="width: 100rpx; height: 100rpx" fit="cover"
|
||
:preview-src-list="[item.files]"/>
|
||
</template>
|
||
</template>
|
||
</view>
|
||
<view class="info flex-1 p-left-30">
|
||
<view class="name">{{ item.name }}</view>
|
||
<!-- <view class="text">直缝焊管</view>-->
|
||
<view class="other">
|
||
<text>{{ item._add_time_str }}</text>
|
||
<text class="line">|</text>
|
||
<text>{{ item.viewNum }}人浏览</text>
|
||
<text class="line">|</text>
|
||
<text>{{ item.downloadNum }}次下载</text>
|
||
<!-- <text class="line">|</text>-->
|
||
<!-- <text>免费下载</text>-->
|
||
<!-- <text class="line">|</text>-->
|
||
<!-- <text>贡献者:</text>-->
|
||
</view>
|
||
</view>
|
||
</view>
|
||
|
||
</view>
|
||
<!-- 乐帮团列表 -->
|
||
<!-- <view class="layout layout-list" v-if="pickIndex == 1">-->
|
||
<!-- <view class="lebt">-->
|
||
<!-- <view class="title">这是什么钢?材质怎么样</view>-->
|
||
<!-- <view class="img-box m-top-20">-->
|
||
<!-- <view class="total">共3张</view>-->
|
||
<!-- <view class="imgs flex justify-start">-->
|
||
<!-- <image class="img" src="/static/img/abc-1.png" mode=""></image>-->
|
||
<!-- <image class="img" src="/static/img/abc-2.png" mode=""></image>-->
|
||
<!-- <image class="img" src="/static/img/abc-1.png" mode=""></image>-->
|
||
<!-- </view>-->
|
||
<!-- </view>-->
|
||
<!-- <view class="bottom flex justify-between align-center m-top-20">-->
|
||
<!-- <u-icon name="account-fill" color="#AFAFAF"></u-icon>-->
|
||
<!-- <text class="m-left-10 m-right-10">别来无恙</text>-->
|
||
<!-- <u-icon name="chat-fill" color="#AFAFAF"></u-icon>-->
|
||
<!-- <text class="m-left-10">19条评论</text>-->
|
||
<!-- <view class="flex-1"></view>-->
|
||
<!-- <text>2023-10-23 16:00发布</text>-->
|
||
<!-- </view>-->
|
||
<!-- </view>-->
|
||
<!-- <view class="lebt">-->
|
||
<!-- <view class="title">这是什么钢?材质怎么样</view>-->
|
||
<!-- <view class="img-box m-top-20">-->
|
||
<!-- <view class="total">共3张</view>-->
|
||
<!-- <view class="imgs flex justify-start">-->
|
||
<!-- <image class="img" src="/static/img/abc-1.png" mode=""></image>-->
|
||
<!-- <image class="img" src="/static/img/abc-2.png" mode=""></image>-->
|
||
<!-- <image class="img" src="/static/img/abc-1.png" mode=""></image>-->
|
||
<!-- </view>-->
|
||
<!-- </view>-->
|
||
<!-- <view class="bottom flex justify-between align-center m-top-20">-->
|
||
<!-- <u-icon name="account-fill" color="#AFAFAF"></u-icon>-->
|
||
<!-- <text class="m-left-10 m-right-10">别来无恙</text>-->
|
||
<!-- <u-icon name="chat-fill" color="#AFAFAF"></u-icon>-->
|
||
<!-- <text class="m-left-10">19条评论</text>-->
|
||
<!-- <view class="flex-1"></view>-->
|
||
<!-- <text>2023-10-23 16:00发布</text>-->
|
||
<!-- </view>-->
|
||
<!-- </view>-->
|
||
<!-- </view>-->
|
||
<!-- 没有数据 u-empty是框架组件 cmempty是自己封装组件 -->
|
||
<u-empty mode="list" text="暂无更多内容~" v-if="list.length === 0"></u-empty>
|
||
<!-- <cmempty></cmempty> -->
|
||
<!-- 圆形按钮 -->
|
||
<view class="issue" @click="toList">
|
||
<u-icon name="plus" color="#fff" size="24"></u-icon>
|
||
</view>
|
||
<!-- 选择器 -->
|
||
<u-picker :show="isPick" :columns="[cateList]" keyName="name" @cancel="isPick=false"
|
||
@confirm="handConfirm"></u-picker>
|
||
</view>
|
||
</template>
|
||
|
||
<script>
|
||
import uiheader from '@/components/index/header'
|
||
import cmsearch from '@/components/common/search'
|
||
import cmempty from '@/components/common/empty'
|
||
import cmswiper from '@/components/common/swiper'
|
||
import {FilePdfOne, FileExcel, FileWord} from '@icon-park/vue'
|
||
|
||
export default {
|
||
components: {
|
||
uiheader,
|
||
cmsearch,
|
||
cmempty,
|
||
cmswiper,
|
||
FilePdfOne,
|
||
FileExcel,
|
||
FileWord
|
||
},
|
||
data() {
|
||
return {
|
||
isPick: false,
|
||
pickIndex: 0,
|
||
pickText: '',
|
||
pickList: [
|
||
[
|
||
{id: 0, label: ''},
|
||
{id: 1, label: ''},
|
||
]
|
||
],
|
||
cateList: [],
|
||
activeCateIndex: 0,
|
||
list: [],
|
||
keyword: null
|
||
}
|
||
},
|
||
methods: {
|
||
handSelect() {
|
||
this.isPick = true
|
||
},
|
||
handConfirm({indexs}) {
|
||
this.isPick = false
|
||
this.activeCateIndex = indexs[0]
|
||
this.pickText = this.cateList[indexs[0]].name
|
||
this.getContentList()
|
||
},
|
||
async getCateList() {
|
||
const {rows} = await vk.callFunction({
|
||
url: 'client/article/category/pub/getList'
|
||
})
|
||
this.cateList = rows
|
||
this.pickText = this.cateList[0].name
|
||
await this.getContentList()
|
||
},
|
||
selectCate(index) {
|
||
this.activeCateIndex = index
|
||
this.getContentList()
|
||
},
|
||
async getContentList() {
|
||
const {rows} = await vk.callFunction({
|
||
url: 'client/article/list/pub/getList',
|
||
data: {
|
||
parentId: this.cateList[this.activeCateIndex]._id,
|
||
keyword: this.keyword
|
||
}
|
||
})
|
||
this.list = rows
|
||
},
|
||
toList() {
|
||
vk.navigateTo('/pages/school/list')
|
||
},
|
||
},
|
||
async onLoad() {
|
||
await this.getCateList()
|
||
await this.getContentList()
|
||
},
|
||
}
|
||
</script>
|
||
|
||
<style lang="scss">
|
||
.layout-sch {
|
||
padding: 30rpx 30rpx;
|
||
|
||
.select {
|
||
position: relative;
|
||
flex: 0 0 275rpx;
|
||
margin-right: 10rpx;
|
||
//width: 200rpx;
|
||
height: 40rpx;
|
||
font-size: 28rpx;
|
||
line-height: 40rpx;
|
||
color: #333;
|
||
padding: 10rpx 30rpx 10rpx 20rpx;
|
||
border: 1px solid #f2f2f2;
|
||
overflow: hidden;
|
||
}
|
||
|
||
.down::after {
|
||
position: absolute;
|
||
right: 20rpx;
|
||
top: 50%;
|
||
z-index: 9;
|
||
content: '';
|
||
margin-top: -6rpx;
|
||
width: 0;
|
||
height: 0;
|
||
border-left: 10rpx solid transparent;
|
||
border-right: 10rpx solid transparent;
|
||
border-top: 12rpx solid #999999;
|
||
}
|
||
|
||
.search {
|
||
flex: 1;
|
||
//margin-left: 10rpx;
|
||
//width: 400rpx;
|
||
height: 60rpx;
|
||
border: 1px solid #A92924;
|
||
|
||
.search-input {
|
||
display: block;
|
||
//width: 250rpx;
|
||
height: 40rpx;
|
||
font-size: 28rpx;
|
||
line-height: 40rpx;
|
||
color: #666666;
|
||
}
|
||
|
||
.search-btn {
|
||
width: 120rpx;
|
||
height: 60rpx;
|
||
font-size: 28rpx;
|
||
line-height: 60rpx;
|
||
text-align: center;
|
||
color: #ffffff;
|
||
background: #A92924;
|
||
}
|
||
}
|
||
}
|
||
|
||
.layout-list {
|
||
margin: 20rpx 30rpx;
|
||
|
||
.item {
|
||
padding: 30rpx 20rpx;
|
||
border-bottom: 1px solid #f2f2f2;
|
||
background: #ffffff;
|
||
|
||
.img {
|
||
width: 130rpx;
|
||
height: 130rpx;
|
||
}
|
||
|
||
.name {
|
||
font-size: 32rpx;
|
||
font-weight: 500;
|
||
line-height: 44rpx;
|
||
color: #111111;
|
||
}
|
||
|
||
.text {
|
||
padding: 6rpx 0;
|
||
font-size: 26rpx;
|
||
line-height: 40rpx;
|
||
color: #666666;
|
||
}
|
||
|
||
.other {
|
||
font-size: 24rpx;
|
||
line-height: 32rpx;
|
||
color: #999999;
|
||
}
|
||
|
||
.line {
|
||
margin: 0 8rpx;
|
||
}
|
||
}
|
||
}
|
||
|
||
.lebt {
|
||
padding: 20rpx 20rpx;
|
||
border-bottom: 1px solid #f2f2f2;
|
||
background: #ffffff;
|
||
|
||
.title {
|
||
font-size: 28rpx;
|
||
font-weight: 500;
|
||
line-height: 40rpx;
|
||
color: #777777;
|
||
}
|
||
|
||
.bottom {
|
||
font-size: 24rpx;
|
||
line-height: 40rpx;
|
||
color: #AFAFAF;
|
||
}
|
||
|
||
.img-box {
|
||
position: relative;
|
||
width: 100%;
|
||
height: 160rpx;
|
||
|
||
.imgs {
|
||
width: 100%;
|
||
height: 160rpx;
|
||
overflow: hidden;
|
||
}
|
||
|
||
.img {
|
||
width: 200rpx;
|
||
height: 160rpx;
|
||
}
|
||
|
||
.img:nth-child(2) {
|
||
margin: 0 20rpx;
|
||
}
|
||
|
||
.total {
|
||
position: absolute;
|
||
left: 0;
|
||
top: 0;
|
||
z-index: 9;
|
||
padding: 0 10rpx;
|
||
font-size: 22rpx;
|
||
line-height: 36rpx;
|
||
color: #ffffff;
|
||
background-color: rgba(0, 0, 0, 0.33);
|
||
}
|
||
}
|
||
}
|
||
</style>
|