20261008
This commit is contained in:
@@ -0,0 +1,150 @@
|
||||
<template>
|
||||
<view class="wrap">
|
||||
<uititle title="金久信学堂"></uititle>
|
||||
<view class="bg-white p-10">
|
||||
<view class="group flex align-center m-top-30">
|
||||
<view class="lb need m-right-20">标题:</view>
|
||||
<view class="vl flex-1">
|
||||
<u--input
|
||||
placeholder="请输入标题"
|
||||
border="surround"
|
||||
v-model="formData.name"
|
||||
/>
|
||||
</view>
|
||||
</view>
|
||||
<view class="group flex align-center m-top-30">
|
||||
<view class="lb need m-right-20">分类:</view>
|
||||
<view class="vl flex-1" @click="showPicker = true">
|
||||
<u--input
|
||||
style="pointer-events:none"
|
||||
disabledColor="#fff"
|
||||
disabled
|
||||
placeholder="请选择分类"
|
||||
border="surround"
|
||||
v-model="cate"
|
||||
/>
|
||||
</view>
|
||||
</view>
|
||||
<view class="group m-top-20">
|
||||
<view class="lb m-right-20">附件:</view>
|
||||
<view class="m-top-30">
|
||||
<u-upload
|
||||
accept="file"
|
||||
:fileList="formData.files"
|
||||
@afterRead="afterRead"
|
||||
:maxCount="1"
|
||||
:previewImage="false"
|
||||
>
|
||||
<view class="w-100p">
|
||||
<view>
|
||||
<u-button size="mini" type="primary">点击上传</u-button>
|
||||
</view>
|
||||
<view class="mt-10 flex justify-between items-center w-100p" @click="delFiles(index)"
|
||||
v-for="(item, index) in fileNameList" :key="index">
|
||||
<text>{{ item }}</text>
|
||||
<u-icon name="trash"/>
|
||||
</view>
|
||||
</view>
|
||||
</u-upload>
|
||||
</view>
|
||||
</view>
|
||||
<view class="lb need m-right-20 mt-20 border-top">内容:</view>
|
||||
<piaoyiEditor :values="formData.content" :maxlength="99999" @changes="saveContents" :readOnly="false"/>
|
||||
<u-button class="m-top-30" type="primary" text="提交" @click="save"></u-button>
|
||||
</view>
|
||||
<u-picker :show="showPicker" :columns="[cateList]" keyName="name"
|
||||
@cancel="showPicker = false" @close="showPicker = false" closeOnClickOverlay
|
||||
@confirm="confirmCate"/>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import uititle from '@/components/common/title'
|
||||
import cmsearch from '@/components/common/search'
|
||||
import cmempty from '@/components/common/empty'
|
||||
import piaoyiEditor from '@/uni_modules/piaoyi-editor/components/piaoyi-editor/piaoyi-editor.vue';
|
||||
import dayjs from "dayjs";
|
||||
import md5 from "js-md5";
|
||||
|
||||
export default {
|
||||
components: {
|
||||
uititle,
|
||||
cmsearch,
|
||||
cmempty,
|
||||
piaoyiEditor,
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
editor: null,
|
||||
toolbarConfig: {},
|
||||
editorConfig: {placeholder: '请输入内容...'},
|
||||
mode: 'default',
|
||||
formData: {
|
||||
name: null,
|
||||
files: [],
|
||||
parentId: null,
|
||||
content: '',
|
||||
},
|
||||
cateList: [],
|
||||
fileNameList: [],
|
||||
showPicker: false,
|
||||
cate: ''
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
async getCateList() {
|
||||
const {rows} = await vk.callFunction({
|
||||
url: 'client/article/category/pub/getList'
|
||||
})
|
||||
this.cateList = rows
|
||||
},
|
||||
async save() {
|
||||
if (!this.formData.name) return vk.toast('标题不能为空')
|
||||
if (!this.formData.parentId) return vk.toast('分类不能为空')
|
||||
if (!this.formData.content) return vk.toast('内容不能为空')
|
||||
await vk.callFunction({
|
||||
url: 'client/article/list/kh/add',
|
||||
data: this.formData
|
||||
})
|
||||
vk.navigateBack()
|
||||
},
|
||||
saveContents({html}) {
|
||||
this.formData.content = html
|
||||
},
|
||||
afterRead({file}) {
|
||||
if (!file) return
|
||||
uniCloud.uploadFile({
|
||||
filePath: file.url,
|
||||
cloudPath: dayjs().format('YYYY/MM/DD') + '/' + md5(file.name + Date.now().toString()) + '.pdf',
|
||||
success: ({fileID}) => {
|
||||
uniCloud.getTempFileURL({
|
||||
fileList: [fileID]
|
||||
}).then(res => {
|
||||
this.formData.files.push(res.fileList[0].tempFileURL)
|
||||
this.fileNameList.push(file.name)
|
||||
})
|
||||
}
|
||||
})
|
||||
},
|
||||
confirmCate({value}) {
|
||||
this.formData.parentId = value[0]._id
|
||||
this.cate = value[0].name
|
||||
this.showPicker = false
|
||||
},
|
||||
delFiles(index){
|
||||
this.formData.files.splice(index, 1)
|
||||
this.fileNameList.splice(index, 1)
|
||||
}
|
||||
},
|
||||
onShow() {
|
||||
this.getCateList()
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss">
|
||||
page {
|
||||
background: #f7f7f7;
|
||||
}
|
||||
|
||||
</style>
|
||||
@@ -0,0 +1,200 @@
|
||||
<template>
|
||||
<view class=" bg-white">
|
||||
<u-sticky offset-top="0" customNavHeight="0">
|
||||
<uititle title="详情"></uititle>
|
||||
</u-sticky>
|
||||
<view class="p-30">
|
||||
<view class="mt-20 text-gray text-28 pb-20 border-bottom" v-if="userInfo && userInfo.userLevel === 0">
|
||||
<span>剩余</span>
|
||||
<span class="mx-15 text-main font-bold">{{ userInfo.remainArticleDownloadNum }}</span>
|
||||
<span>次下载次数</span>
|
||||
</view>
|
||||
<text class="text-50 font-bold">{{ info.name }}</text>
|
||||
<view class="mt-20 text-gray text-28 pb-20 border-bottom">{{ info._add_time_str }}</view>
|
||||
<view class="py-20 border-bottom flex justify-start flex-col items-start " v-if="info.files">
|
||||
<view class="form-title-wrap">
|
||||
<view class="goods-info-title">
|
||||
<view class="form-title">
|
||||
附件
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="flex justify-start items-start flex-wrap my-25">
|
||||
<view class="mt-15 mr-15" v-for="(item, index) in info.files" :key="index">
|
||||
<template v-if="['doc', 'docx'].includes(item.split('.').pop())">
|
||||
<file-word theme="outline" class="pointer" size="100" fill="#4a90e2" strokeLinecap="square"
|
||||
@click.native="openDownload(item)"/>
|
||||
</template>
|
||||
<template v-else-if="['xls', 'xlsx'].includes(item.split('.').pop())">
|
||||
<file-excel theme="outline" class="pointer" size="100" fill="#417505" strokeLinecap="square"
|
||||
@click.native="openDownload(item)"/>
|
||||
</template>
|
||||
<template v-else-if="['pdf'].includes(item.split('.').pop())">
|
||||
<file-pdf-one theme="outline" class="pointer" size="100" fill="#f5a623"
|
||||
strokeLinecap="square"
|
||||
@click.native="openDownload(item)"/>
|
||||
</template>
|
||||
<template v-else>
|
||||
<el-image :src="item" style="width: 100px; height: 100px" fit="cover"
|
||||
:preview-src-list="[item]"/>
|
||||
</template>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view v-html="info.content" class="mt-20"></view>
|
||||
</view>
|
||||
<el-dialog title="文件查看" :visible.sync="dialogVisible" width="90%" :top="10">
|
||||
<view style="width: 100%; height: 80vh">
|
||||
<pdf
|
||||
style="width: 100%; height: 100%"
|
||||
ref="pdf"
|
||||
:src="pdfUrl"
|
||||
/>
|
||||
</view>
|
||||
</el-dialog>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import uititle from "@/components/common/title.vue";
|
||||
import {FileExcel, FilePdfOne, FileWord, Star} from "@icon-park/vue";
|
||||
import pdf from "vue-pdf";
|
||||
|
||||
export default {
|
||||
name: "detail",
|
||||
components: {uititle, FileWord, FilePdfOne, FileExcel, Star, pdf},
|
||||
data() {
|
||||
return {
|
||||
info: {
|
||||
name: '',
|
||||
content: ''
|
||||
},
|
||||
hasCollect: false,
|
||||
dialogVisible: false,
|
||||
userInfo: null,
|
||||
pdfUrl: null,
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
async getInfo(id) {
|
||||
this.info = await vk.callFunction({
|
||||
url: `client/article/list/pub/getDetail`,
|
||||
data: {id}
|
||||
});
|
||||
this.$nextTick(() => {
|
||||
// 获取所有的img元素
|
||||
var imgElements = document.getElementsByTagName('img');
|
||||
|
||||
// 遍历img元素数组
|
||||
for (var i = 0; i < imgElements.length; i++) {
|
||||
// 添加style属性,并设置width为100%
|
||||
imgElements[i].style.width = '100%';
|
||||
}
|
||||
})
|
||||
await this.checkCollect()
|
||||
},
|
||||
addView(id) {
|
||||
vk.callFunction({
|
||||
url: `client/article/list/pub/addView`,
|
||||
data: {id}
|
||||
});
|
||||
},
|
||||
async openDownload(url) {
|
||||
await this.getUserInfo()
|
||||
if (this.userInfo.userLevel < 0) return this.$message.error('非会员,无法下载');
|
||||
else if (this.userInfo.userLevel === 0) {
|
||||
const {data} = await vk.callFunction({
|
||||
url: 'client/article/list/kh/check',
|
||||
data: {
|
||||
id: this.info._id,
|
||||
}
|
||||
})
|
||||
if (!data) {
|
||||
if (this.userInfo.remainArticleDownloadNum === 0) {
|
||||
return this.$confirm(`下载次数不足,是否购买次数?`, '提示', {
|
||||
cancelButtonText: '关闭',
|
||||
}).then(async () => {
|
||||
const {data} = await vk.callFunction({
|
||||
url: 'client/order/kh/addDownloadOrder',
|
||||
title: '请求中...',
|
||||
})
|
||||
vk.navigateTo({
|
||||
url: `/pages/shop/pay?id=${data}`
|
||||
})
|
||||
})
|
||||
} else {
|
||||
this.$confirm(`将消耗1次下载次数,是否继续?`, '提示', {
|
||||
cancelButtonText: '关闭',
|
||||
}).then(async () => {
|
||||
this.userInfo.remainArticleDownloadNum -= 1
|
||||
// await this.getUserInfo()
|
||||
vk.callFunction({
|
||||
url: 'client/article/list/pub/addDownload',
|
||||
data: {
|
||||
id: this.info._id,
|
||||
}
|
||||
})
|
||||
vk.callFunction({
|
||||
url: 'client/user/kh/reduceDownloadNum',
|
||||
})
|
||||
vk.callFunction({
|
||||
url: 'client/article/list/kh/addDownload',
|
||||
data: {
|
||||
id: this.info._id,
|
||||
}
|
||||
})
|
||||
window.location.href = url
|
||||
// this.pdfUrl = url
|
||||
// this.dialogVisible = true
|
||||
})
|
||||
}
|
||||
} else {
|
||||
window.location.href = url
|
||||
}
|
||||
} else {
|
||||
vk.callFunction({
|
||||
url: 'client/article/list/pub/addDownload',
|
||||
data: {
|
||||
id: this.info._id
|
||||
}
|
||||
})
|
||||
window.location.href = url
|
||||
// this.pdfUrl = url
|
||||
// this.dialogVisible = true
|
||||
}
|
||||
|
||||
},
|
||||
async checkCollect() {
|
||||
const {data} = await vk.callFunction({
|
||||
url: 'client/article/collect/kh/check',
|
||||
data: {
|
||||
articleId: this.info._id
|
||||
},
|
||||
});
|
||||
this.hasCollect = data
|
||||
},
|
||||
changeCollect() {
|
||||
this.hasCollect = !this.hasCollect
|
||||
vk.callFunction({
|
||||
url: 'client/article/collect/kh/changeCollect',
|
||||
data: {
|
||||
articleId: this.info._id
|
||||
},
|
||||
});
|
||||
},
|
||||
async getUserInfo() {
|
||||
const {userInfo} = await vk.callFunction({
|
||||
url: 'user/kh/getMyUserInfo'
|
||||
})
|
||||
this.userInfo = userInfo
|
||||
},
|
||||
},
|
||||
onLoad({id}) {
|
||||
this.getUserInfo(id)
|
||||
this.getInfo(id)
|
||||
this.addView(id)
|
||||
const userInfo = vk.getStorageSync('uni_id_user_info')
|
||||
if (userInfo) this.checkCollect()
|
||||
}
|
||||
}
|
||||
</script>
|
||||
@@ -0,0 +1,280 @@
|
||||
<template> <!-- 学堂 -->
|
||||
<view class="wrap">
|
||||
<!-- 吸顶 -->
|
||||
<u-sticky offset-top="0" customNavHeight="0">
|
||||
<!-- 顶部 -->
|
||||
<uititle title="金久信学堂"></uititle>
|
||||
<!-- 选项卡 -->
|
||||
<view class="layout layout-tab flex justify-between align-center">
|
||||
<view :class="['tab', {active: tabIndex == 0}]" @click="handTab(0)">我的上传</view>
|
||||
<view :class="['tab', {active: tabIndex == 1}]" @click="handTab(1)">我的收藏</view>
|
||||
<view :class="['tab', {active: tabIndex == 2}]" @click="handTab(2)">我的下载</view>
|
||||
</view>
|
||||
<!-- 统计数量和操作按钮 -->
|
||||
<view class="layout layout-total flex justify-start align-center bg-white">
|
||||
<template v-if="tabIndex == 0">
|
||||
<view class="text">累计上传
|
||||
<text class="red">{{ list.length }}</text>
|
||||
篇
|
||||
</view>
|
||||
<!-- <view class="upload m-left-20">我要上传</view>-->
|
||||
</template>
|
||||
<template v-else-if="tabIndex == 1">
|
||||
<view class="text">共计收藏
|
||||
<text class="red">{{ list.length }}</text>
|
||||
篇
|
||||
</view>
|
||||
</template>
|
||||
<template v-else>
|
||||
<view class="text">累计下载
|
||||
<text class="red">{{ list.length }}</text>
|
||||
篇
|
||||
</view>
|
||||
</template>
|
||||
</view>
|
||||
</u-sticky>
|
||||
<!-- 材料专业资料列表 -->
|
||||
<view class="layout layout-list">
|
||||
<view class="item flex" v-for="(item, index) in list" :key="index" @click="jump(item._id)">
|
||||
<view class="img" 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: 100px; height: 100px" fit="cover"
|
||||
:preview-src-list="[item.files]"/>
|
||||
</template>
|
||||
</view>
|
||||
<view class="info flex-1 p-left-30">
|
||||
<view class="flex justify-between">
|
||||
<view class="name flex-1">{{ item.name }}</view>
|
||||
<!-- <view class="operate flex justify-center">-->
|
||||
<!-- <u-button color="#A92924" size="mini" :plain="true" text="删除上传"></u-button>-->
|
||||
<!-- <u-button class="m-left-20" color="#A92924" size="mini" :plain="true"-->
|
||||
<!-- text="编辑修改"></u-button>-->
|
||||
<!-- </view>-->
|
||||
</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>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="issue" @click="toAdd">
|
||||
<u-icon name="plus" color="#fff" size="24"></u-icon>
|
||||
</view>
|
||||
<!-- 没有数据 u-empty是框架组件 cmempty是自己封装组件 -->
|
||||
<u-empty mode="list" text="暂无更多内容~" v-if="list.length === 0"></u-empty>
|
||||
<!-- <cmempty></cmempty> -->
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import uititle from '@/components/common/title'
|
||||
import cmsearch from '@/components/common/search'
|
||||
import cmempty from '@/components/common/empty'
|
||||
import {FileExcel, FilePdfOne, FileWord} from "@icon-park/vue";
|
||||
|
||||
export default {
|
||||
components: {
|
||||
uititle,
|
||||
cmsearch,
|
||||
cmempty,
|
||||
FilePdfOne, FileExcel, FileWord
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
tabIndex: 0,
|
||||
total: 0,
|
||||
pageSize: 500,
|
||||
activeIndex: 0,
|
||||
mode: 'list',
|
||||
list: [],
|
||||
cateList: [],
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
handTab(index) {
|
||||
this.tabIndex = index
|
||||
this.list = []
|
||||
this.mode = 'list'
|
||||
if (index === 0) this.getList()
|
||||
else if (index === 1) this.getCollectList()
|
||||
else if (index === 2) this.getDownloadList()
|
||||
},
|
||||
async getList(pageIndex = 1) {
|
||||
const {rows} = await vk.callFunction({
|
||||
url: 'client/article/list/kh/getUserList',
|
||||
pageIndex,
|
||||
pageSize: this.pageSize
|
||||
})
|
||||
this.list = rows
|
||||
},
|
||||
async getCollectList(pageIndex = 1) {
|
||||
const {rows} = await vk.callFunction({
|
||||
url: 'client/article/collect/kh/getList',
|
||||
pageIndex,
|
||||
pageSize: this.pageSize
|
||||
})
|
||||
this.list = rows.map(item => {
|
||||
if (item.article) {
|
||||
item._id = item.article._id
|
||||
item.name = item.article.name
|
||||
item._add_time_str = item.article._add_time_str
|
||||
item.viewNum = item.article.viewNum
|
||||
item.downloadNum = item.article.downloadNum
|
||||
}
|
||||
return item
|
||||
})
|
||||
},
|
||||
async getDownloadList(pageIndex = 1) {
|
||||
const {rows} = await vk.callFunction({
|
||||
url: 'client/article/list/kh/getDownloadList',
|
||||
pageIndex,
|
||||
pageSize: this.pageSize
|
||||
})
|
||||
this.list = rows.map(item => {
|
||||
if (item.article) {
|
||||
item._id = item.article._id
|
||||
item.name = item.article.name
|
||||
item._add_time_str = item.article._add_time_str
|
||||
item.viewNum = item.article.viewNum
|
||||
item.downloadNum = item.article.downloadNum
|
||||
}
|
||||
return item
|
||||
})
|
||||
},
|
||||
changePage(page) {
|
||||
if (this.activeIndex === 0) this.getList(page)
|
||||
else if (this.activeIndex === 1) this.getCollectList(page)
|
||||
else if (this.activeIndex === 2) this.getDownloadList(page)
|
||||
},
|
||||
changeActive(index) {
|
||||
this.list = []
|
||||
this.mode = 'list'
|
||||
this.activeIndex = index
|
||||
if (index === 0) this.getList()
|
||||
else if (index === 1) this.getCollectList()
|
||||
else if (index === 2) this.getDownloadList()
|
||||
},
|
||||
showAction() {
|
||||
this.mode = 'action'
|
||||
this.activeIndex = null
|
||||
},
|
||||
addSuccess() {
|
||||
this.mode = 'list'
|
||||
this.activeIndex = 0
|
||||
this.getList()
|
||||
},
|
||||
toAdd(){
|
||||
vk.navigateTo('/pages/school/add')
|
||||
},
|
||||
jump(id){
|
||||
vk.navigateTo(`/pages/school/detail?id=${id}`)
|
||||
}
|
||||
},
|
||||
onLoad() {
|
||||
this.getList()
|
||||
},
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss">
|
||||
.layout-tab {
|
||||
height: 100rpx;
|
||||
padding: 0 30rpx;
|
||||
background: #f1f1f1;
|
||||
|
||||
.tab {
|
||||
margin: 0 20rpx;
|
||||
padding: 10rpx 0rpx;
|
||||
font-size: 28rpx;
|
||||
line-height: 40rpx;
|
||||
color: #666666;
|
||||
}
|
||||
|
||||
.active {
|
||||
position: relative;
|
||||
color: #A92924;
|
||||
|
||||
&::after {
|
||||
position: absolute;
|
||||
left: 0;
|
||||
bottom: 0;
|
||||
z-index: 9;
|
||||
content: '';
|
||||
width: 100%;
|
||||
height: 1px;
|
||||
background: #A92924;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.layout-total {
|
||||
height: 60rpx;
|
||||
padding: 10rpx 30rpx;
|
||||
|
||||
.text {
|
||||
font-size: 26rpx;
|
||||
line-height: 40rpx;
|
||||
color: #333333;
|
||||
}
|
||||
|
||||
.upload {
|
||||
padding: 4rpx 16rpx;
|
||||
font-size: 24rpx;
|
||||
line-height: 40rpx;
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,339 @@
|
||||
<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>
|
||||
Reference in New Issue
Block a user