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.
163 lines
3.5 KiB
163 lines
3.5 KiB
<template>
|
|
<view class="container-main">
|
|
<view class="list-item" v-for="item in list" :key="item.id" @click="getInfo(item.id)">
|
|
<view class="item-title">
|
|
{{ item.title }}
|
|
</view>
|
|
<view class="item-main">
|
|
{{ item.content }}
|
|
</view>
|
|
<view class="item-img-list" v-show="item.images.length > 0">
|
|
<view class="img-list" v-for="(img, index) in item.images" :key="index" v-show="index < 3">
|
|
<u-image width="95%" height="100%" :src="baseUrl + '/common/download/downloadmino?filename=' + img"
|
|
mode="aspectFill" :lazy-load="true"></u-image>
|
|
</view>
|
|
<view class="img-list" v-show="item.images.length == 2"></view>
|
|
</view>
|
|
<view class="item-time">
|
|
<view class="time-value">发布时间: {{ item.releasetime }}</view>
|
|
</view>
|
|
</view>
|
|
<u-loadmore :status="status" :load-text="loadText" />
|
|
</view>
|
|
</template>
|
|
|
|
<script>
|
|
import {
|
|
getEssayList,
|
|
getinfo
|
|
} from "@/api/shianliaoning/essay.js";
|
|
import config from "@/config.js";
|
|
export default {
|
|
data() {
|
|
return {
|
|
status: 'nomore',
|
|
loadText: {
|
|
loading: '努力加载中',
|
|
nomore: '已经到底了~'
|
|
},
|
|
baseUrl: config.baseUrl,
|
|
list: [],
|
|
total: 0,
|
|
loading: false,
|
|
queryParams: {
|
|
litiletype: undefined,
|
|
type: undefined,
|
|
pageNum: 1,
|
|
pageSize: 10,
|
|
},
|
|
};
|
|
},
|
|
onLoad(option) {
|
|
uni.setNavigationBarTitle({
|
|
title: option.title,
|
|
success: () => {
|
|
this.queryParams.type = option.type;
|
|
this.queryParams.litiletype = option.litiletype;
|
|
},
|
|
});
|
|
|
|
this.getList();
|
|
},
|
|
onReachBottom(e) {
|
|
if (this.queryParams.pageNum < this.total) {
|
|
if (this.loading == true) {
|
|
this.status = 'nomore'
|
|
return
|
|
};
|
|
this.queryParams.pageNum = this.queryParams.pageNum + 1;
|
|
this.getList();
|
|
}
|
|
},
|
|
methods: {
|
|
getList() {
|
|
this.loading = true;
|
|
this.status = 'loading'
|
|
getEssayList(this.queryParams).then((response) => {
|
|
if (response.rows.length > 0) {
|
|
response.rows.forEach((item) => {
|
|
let str = item.text;
|
|
const regex = /<img.*?src="(.*?)".*?>/g;
|
|
const matches = str.match(regex);
|
|
if (matches == null) {
|
|
item.images = [];
|
|
return;
|
|
}
|
|
item.images = matches.map((match) => match.match(/src="(.*?)"/)[1]);
|
|
});
|
|
}
|
|
this.list = [...this.list, ...response.rows];
|
|
this.total = Math.ceil(response.total / this.queryParams.pageSize) || 1;
|
|
this.status = 'nomore'
|
|
this.loading = false;
|
|
});
|
|
},
|
|
getInfo(id) {
|
|
uni.navigateTo({
|
|
url: `/sub-public/oldman-teach/info?id=${id}`,
|
|
});
|
|
},
|
|
},
|
|
};
|
|
</script>
|
|
|
|
<style lang="scss" scoped>
|
|
.container-main {
|
|
box-sizing: border-box;
|
|
padding: 20rpx;
|
|
padding-bottom: 128rpx;
|
|
|
|
.list-item {
|
|
box-sizing: border-box;
|
|
padding: 30rpx 40rpx;
|
|
border-radius: 16rpx;
|
|
background-color: #fff;
|
|
min-height: 200rpx;
|
|
margin-bottom: 20rpx;
|
|
}
|
|
|
|
.item-title {
|
|
font-size: 36rpx;
|
|
font-weight: normal;
|
|
color: #34373b;
|
|
}
|
|
|
|
.item-main {
|
|
font-size: 28rpx;
|
|
font-weight: normal;
|
|
color: #9da2ab;
|
|
margin: 25rpx 0;
|
|
}
|
|
|
|
.item-img-list {
|
|
display: flex;
|
|
align-items: center;
|
|
justify-content: space-between;
|
|
margin-bottom: 25rpx;
|
|
|
|
.img-list {
|
|
width: 33.3%;
|
|
height: 150rpx;
|
|
|
|
}
|
|
}
|
|
|
|
.item-time {
|
|
display: flex;
|
|
align-items: center;
|
|
|
|
.time-icon {
|
|
width: 26rpx;
|
|
height: 23rpx;
|
|
margin-right: 20rpx;
|
|
}
|
|
|
|
.time-value {
|
|
font-size: 24rpx;
|
|
font-weight: normal;
|
|
color: #9da2ab;
|
|
}
|
|
}
|
|
}
|
|
</style>
|