You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
zhishifufei_uniapp/pages/my/fileDownload.vue

114 lines
2.5 KiB

<template>
<BaseContainer class="file-download flex">
<NavBar title="文件下载" />
<view class="file-box">
<view class="file-list">
<view v-for="(item, index) in fileList" :key="index" class="file-item flex">
<image :src="item.image" mode="aspectFill"></image>
<view class="file-info flex">
<view class="info-top">{{ item.title }}</view>
<view class="info-bottom flex flex-center-x">
<text>{{ item.sales }}人已下载</text>
<text @click="toDownload(item.id)">去下载</text>
</view>
</view>
</view>
</view>
</view>
</BaseContainer>
</template>
<script>
import { getMaterialList2 } from "@/api/material";
export default {
data() {
return {
fileList: []
};
},
onLoad() {
this.getMaterialList();
},
methods: {
// 获取列表
async getMaterialList() {
uni.showLoading({ mask: true });
try {
const { data: materialList } = await getMaterialList2({
pid: '',
cate_id: '',
search: '',
page: 1,
limit: 10000,
});
uni.hideLoading();
this.fileList = [...materialList];
} catch (err) {
uni.hideLoading();
this.$util.showMsg(err.message);
}
},
toDownload(id) {
uni.navigateTo({
url: `/pages/special/data_details?id=${id}`,
});
},
},
};
</script>
<style lang="scss" scoped>
.file-download {
flex-direction: column;
.file-box {
flex: 1;
width: 690rpx;
margin: 0 auto ;
padding-top: 20rpx;
.file-list {
.file-item {
height: 180rpx;
background: #fff;
padding: 20rpx 16rpx 24rpx;
margin-bottom: 20rpx;
>image {
width: 210rpx;
height: 136rpx;
margin-right: 33rpx;
flex-shrink: 0;
}
.file-info {
flex: 1;
flex-direction: column;
justify-content: space-between;
.info-top {
font-size: 28rpx;
line-height: 35rpx;
height: 70rpx;
color: #333;
-webkit-line-clamp: 2;
text-overflow: ellipsis;
display: -webkit-box;
-webkit-box-orient: vertical;
}
.info-bottom {
color: #666;
font-size: 20rpx;
justify-content: space-between;
>text:last-child {
width: 110rpx;
height: 38rpx;
background: #0F74BB;
border-radius: 19rpx;
color: #fff;
display: flex;
justify-content: center;
align-items: center;
}
}
}
}
}
}
}
</style>