|
@@ -13,13 +13,14 @@
|
|
|
<view class="book-card">
|
|
|
<uni-grid :column="3" :showBorder="false" :square="false">
|
|
|
<uni-grid-item v-for="(item, index) in pageList" :key="index">
|
|
|
- <view class="book-box" @click="linkBook(item.book_id)">
|
|
|
- <image :src="item.book_picture_url"></image>
|
|
|
+ <view class="book-box" @click="linkBook(item.id)">
|
|
|
+ <image :src="item.picture_url"></image>
|
|
|
</view>
|
|
|
- <text class="text" @click="linkBook(item.book_id)">{{item.book_name}}</text>
|
|
|
+ <text class="text" @click="linkBook(item.id)">{{item.name}}</text>
|
|
|
</uni-grid-item>
|
|
|
</uni-grid>
|
|
|
</view>
|
|
|
+ <uni-load-more :status="status" :icon-size="14" :content-text="contentText" v-if="pageList.length > 0" />
|
|
|
</view>
|
|
|
<view style="height:120rpx;"></view>
|
|
|
</view>
|
|
@@ -27,7 +28,7 @@
|
|
|
|
|
|
<script>
|
|
|
import {
|
|
|
- GetMyBookList_JoinCourse_Student,
|
|
|
+ PageQueryBookList,
|
|
|
} from '@/api/exercise.js';
|
|
|
import {
|
|
|
GetMyUserInfo,
|
|
@@ -39,6 +40,21 @@
|
|
|
user_head_img: '', // 用户头像
|
|
|
default_head_img: '../../../static/head.png', // 默认头像
|
|
|
user_name: '用户名',
|
|
|
+ contentText: {
|
|
|
+ contentdown: '下拉加载更多',
|
|
|
+ contentrefresh: '加载中',
|
|
|
+ contentnomore: '加载完毕'
|
|
|
+ },
|
|
|
+ pageQueryData: {
|
|
|
+ page_capacity: 20, // 每页容量,最大不能超过 50
|
|
|
+ cur_page: 1, // 当前查询第几页,页码序号从 1 开始
|
|
|
+ publish_status: 1,
|
|
|
+ sys_version_type: -1,
|
|
|
+ is_control_publish_scope: "true",
|
|
|
+ is_enable_book_org_free_license_query: "true",
|
|
|
+ order_column_list: ["name"]
|
|
|
+ },
|
|
|
+ total: 0, //数据总条数
|
|
|
pageList: [],
|
|
|
}
|
|
|
},
|
|
@@ -46,6 +62,21 @@
|
|
|
this.getMyUserInfo();
|
|
|
this.loadMoreData();
|
|
|
},
|
|
|
+ // 监听触底
|
|
|
+ onReachBottom() {
|
|
|
+ let that = this;
|
|
|
+ if (that.total <= that.pageList.length) {
|
|
|
+ uni.showToast({
|
|
|
+ title: '已加载全部数据',
|
|
|
+ icon: "none"
|
|
|
+ });
|
|
|
+ that.status = 'noMore';
|
|
|
+ } else {
|
|
|
+ that.status = 'loading';
|
|
|
+ that.pageQueryData.cur_page++;
|
|
|
+ that.loadMoreData();
|
|
|
+ }
|
|
|
+ },
|
|
|
methods: {
|
|
|
getMyUserInfo() {
|
|
|
GetMyUserInfo().then((res) => {
|
|
@@ -57,9 +88,18 @@
|
|
|
},
|
|
|
//加载数据
|
|
|
loadMoreData() {
|
|
|
- GetMyBookList_JoinCourse_Student().then((res) => {
|
|
|
+ PageQueryBookList(this.pageQueryData).then((res) => {
|
|
|
if (res.status) {
|
|
|
- this.pageList = res.book_list;
|
|
|
+ this.total = res.total_count;
|
|
|
+ if (res.total_count > 0) {
|
|
|
+ const dataMap = res.book_list;
|
|
|
+ this.pageList = this.reload ? dataMap : this.pageList.concat(dataMap);
|
|
|
+ this.reload = false;
|
|
|
+ }
|
|
|
+ if (this.total === this.pageList.length) {
|
|
|
+ this.reload = false;
|
|
|
+ this.status = 'noMore'
|
|
|
+ }
|
|
|
}
|
|
|
})
|
|
|
},
|