123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130 |
- <template>
- <auth-wrap class="file-info-container" ref="authWrap">
- <template slot="content">
- <u-toast ref="uToast"></u-toast>
- <view class="search-content">
- <u-search placeholder="请输入关键字" v-model="keyword" @custom="onSearch" @search="onSearch"></u-search>
- </view>
- <view class="u-page" style="padding: 0 20rpx;">
- <u-list
- v-if="indexList.length>0"
- @scrolltolower="scrolltolower"
- >
- <u-list-item
- v-for="(item, index) in indexList"
- :key="index"
- >
- <view class="file-info-item" @click="onItemClick(item)">
- <view class="file-info-item-img">
- <image :src="item.imgUrl" mode="aspectFill" />
- </view>
- <view class="file-info-item-content">
- <view class="file-info-item-title">{{ item.title }}</view>
- <view class="file-info-item-date">{{ item.date }}</view>
- </view>
- </view>
- </u-list-item>
- </u-list>
- <u-loadmore :status="loadStatus" />
- </view>
- </template>
- </auth-wrap>
- </template>
- <script>
- import { fetchContentInfo, fetchUsrMeetingInfo } from '@/common/api';
- import { CONTENT_TYPE, ICON_CFG, REVIEW_STATUS } from '@/common/EnumConst';
- import AuthWrap from '@/components/AuthComp/index.vue';
- import { fileIcon, getImageUrl } from '@/util';
- let page = 1;
- export default {
- name: 'content',
- props: {},
- components: {
- AuthWrap,
- },
- data() {
- return {
- ICON_CFG,
- keyword: '',
- indexList: [],
- loadStatus: 'loadmore', // loadmore,loading,nomore
- };
- },
- created() {
- },
- onLoad() {
- this.$refs.authWrap.reloadPage();
- page = 1;
- this.loadmore();
- },
- methods: {
- fileIcon,
- getImageUrl,
- onItemClick(item) {
- uni.navigateTo({
- url: `/pasb/pages/detail/index?id=${item.id}`,
- });
- },
- scrolltolower() {
- if (page > 1 && this.loadStatus === 'nomore') {
- return;
- }
- this.loadmore();
- },
- async loadmore() {
- this.loadStatus = 'loading';
- const { data } = await fetchUsrMeetingInfo();
- if (!data) {
- this.$refs.uToast.show({
- type: 'default',
- message: '您暂未报名,请先报名',
- complete() {
- },
- });
- return;
- }
- const {reviewState} = data
- if ([REVIEW_STATUS.wait.value,REVIEW_STATUS.noPass.value].includes(reviewState)){
- this.$refs.uToast.show({
- type: 'default',
- message: '审核未通过,请耐心等待',
- complete() {
- },
- });
- return;
- }
- fetchContentInfo({
- pageNum: page,
- pageSize: 10,
- contentType: CONTENT_TYPE.conferenceMaterials,
- title: this.keyword,
- }).then(res => {
- page += 1;
- if (res.rows.length > 0) {
- this.indexList = this.indexList.concat(res.rows.map(item => {
- return {
- id: item.id,
- title: item.fileName,
- date: item.createTime,
- imgUrl: getImageUrl(item.thumbnail),
- ...item,
- };
- }));
- }
- if (res.rows.length < 10) {
- this.loadStatus = 'nomore';
- }
- });
- },
- onSearch() {
- page = 1;
- this.indexList = [];
- this.loadmore();
- },
- },
- };
- </script>
- <style lang="scss" src="./index.scss" />
|