接口改动
This commit is contained in:
@@ -38,8 +38,9 @@
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="listenList" v-if="bookList.length > 0">
|
||||
<view class="wrap" v-if="contentShow == 1">
|
||||
<view class="listenList" >
|
||||
<view class="wrap" v-if="contentShow == 1">
|
||||
<view class="" v-if="bookList.length > 0">
|
||||
<u-row gutter="16" justify="flex-start">
|
||||
<u-col span="6" v-for="(item,index) in bookList" :key="index">
|
||||
<view >
|
||||
@@ -71,46 +72,60 @@
|
||||
<view class="bookName">{{item.bookName}}</view>
|
||||
</view>
|
||||
</u-col>
|
||||
</u-row>
|
||||
</u-row>
|
||||
<view>
|
||||
<view v-if="status==0" style="text-align: center;">
|
||||
<u-loading-icon style="display: inline-block;"></u-loading-icon>
|
||||
<font style='vertical-align: super;margin-left: 10px;font-size: 26rpx;color: #909399;'>努力加载中</font>
|
||||
</view>
|
||||
<view v-if="status==1">
|
||||
<u-divider text="全部加载完成"></u-divider>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<u-divider v-else text="暂无已购买图书~"></u-divider>
|
||||
</view>
|
||||
<view class="wrap" v-if="contentShow == 2">
|
||||
<u-row gutter="16" justify="flex-start">
|
||||
<view class="wrap" v-if="contentShow == 2">
|
||||
<view class="" v-if="tjBookLIst.length > 0">
|
||||
<u-row gutter="16" justify="flex-start" >
|
||||
<u-col span="6" v-for="(item,index) in tjBookLIst" :key="index">
|
||||
<view class="flexbox listenItem">
|
||||
<view class="info">
|
||||
<view class="videoBox demo-layout bg-purple" @click="goDetail(item.product)">
|
||||
<image :src="item.product.productImages" mode="scaleToFill" ></image>
|
||||
<view class="videoBox demo-layout bg-purple" @click="goDetail(item)">
|
||||
<image :src="item.images" mode="scaleToFill" ></image>
|
||||
</view>
|
||||
</view>
|
||||
<view class="btns">
|
||||
<view class="item flexbox" @click="goDetail(item.product)">
|
||||
<view class="item flexbox" @click="goDetail(item)">
|
||||
<image src="../../static/icon/tu1.png" mode="aspectFit"></image>
|
||||
<text>读 书</text>
|
||||
</view>
|
||||
<view class="item flexbox" @click="goToListen(item.product)">
|
||||
<view class="item flexbox" @click="goToListen(item)">
|
||||
<image src="../../static/icon/tu2.png" mode="aspectFit"></image>
|
||||
<text>听 书</text>
|
||||
</view>
|
||||
<view class="item flexbox" @click="wgGoPingshu(item.product)">
|
||||
<view class="item flexbox" @click="wgGoPingshu(item)">
|
||||
<image src="../../static/icon/tu3.png" mode="aspectFit"></image>
|
||||
<text>评 书</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="bookName">{{item.product.productName}}</view>
|
||||
<view class="bookName">{{item.name}}</view>
|
||||
</u-col>
|
||||
</u-row>
|
||||
</view>
|
||||
</view>
|
||||
<view>
|
||||
<view v-if="status==0" style="text-align: center;">
|
||||
<u-loading-icon style="display: inline-block;"></u-loading-icon>
|
||||
<font style='vertical-align: super;margin-left: 10px;font-size: 26rpx;color: #909399;'>努力加载中</font>
|
||||
</view>
|
||||
<view v-if="status==1">
|
||||
<u-divider text="全部加载完成"></u-divider>
|
||||
</view>
|
||||
</view>
|
||||
</u-row>
|
||||
<view>
|
||||
<view v-if="tjstatus==0" style="text-align: center;">
|
||||
<u-loading-icon style="display: inline-block;"></u-loading-icon>
|
||||
<font style='vertical-align: super;margin-left: 10px;font-size: 26rpx;color: #909399;'>努力加载中</font>
|
||||
</view>
|
||||
<view v-if="tjstatus==1">
|
||||
<u-divider text="全部加载完成"></u-divider>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<u-divider v-else text="暂无推荐图书~"></u-divider>
|
||||
</view>
|
||||
</view>
|
||||
<!-- <view class="shuwuLink">
|
||||
<image @click="" src="../../static/icon/shuwu.jpg" mode="aspectFit"></image>
|
||||
</view> -->
|
||||
@@ -141,6 +156,7 @@
|
||||
status: 3,
|
||||
ygtotalPage:1,
|
||||
tjPage:1,
|
||||
tjstatus:3,
|
||||
tjTotalPage:1,
|
||||
tjBookLIst:[],
|
||||
contentButtonList: [{
|
||||
@@ -153,54 +169,58 @@
|
||||
}
|
||||
},
|
||||
onLoad() {
|
||||
|
||||
},
|
||||
onHide() {
|
||||
// this.contentShow = 1
|
||||
this.page = 1
|
||||
this.tjPage = 1
|
||||
this.bookList = []
|
||||
this.tjBookLIst = []
|
||||
},
|
||||
onShow() {
|
||||
this.getListDate()
|
||||
this.getfreeBook()
|
||||
},
|
||||
onPullDownRefresh() {
|
||||
console.log('下拉刷新了')
|
||||
uni.stopPullDownRefresh();
|
||||
if(this.contentShow == 1){
|
||||
// this.page=1, // 页码
|
||||
this.bookList = []
|
||||
this.getfreeBook()
|
||||
}
|
||||
else if(this.contentShow == 2){
|
||||
// this.tjPage=1, // 页码
|
||||
this.tjBookLIst = []
|
||||
this.getListDate()
|
||||
}
|
||||
this.contentShow = 1
|
||||
this.page = 1
|
||||
this.tjPage = 1
|
||||
this.bookList = []
|
||||
this.getfreeBook()
|
||||
this.tjBookLIst = []
|
||||
this.getListDate()
|
||||
},
|
||||
onReachBottom() {
|
||||
this.loadingNow = true
|
||||
// this.loadingNow = true
|
||||
console.log('到底了')
|
||||
|
||||
// if(this.contentShow == 1){
|
||||
// //console.log(this.page , this.ygtotalPage)
|
||||
// if(this.page < this.ygtotalPage){
|
||||
// this.page++
|
||||
// console.log('加载',this.page)
|
||||
// this.status = 0
|
||||
// this.getfreeBook()
|
||||
if(this.contentShow == 1){
|
||||
//console.log(this.page , this.ygtotalPage)
|
||||
// if(this.page < this.ygtotalPage){
|
||||
// this.page++
|
||||
// console.log('加载',this.page)
|
||||
// this.status = 0
|
||||
// this.getfreeBook()
|
||||
|
||||
// }else{
|
||||
// this.status = 1
|
||||
// console.log('加载完成了',this.page)
|
||||
// return
|
||||
// }
|
||||
// }else{
|
||||
// this.status = 1
|
||||
// console.log('加载完成了',this.page)
|
||||
// return
|
||||
// }
|
||||
|
||||
// }else if(this.contentShow == 2){
|
||||
// if(this.tjPage < this.tjTotalPage){
|
||||
// this.tjPage++
|
||||
// console.log('加载',this.tjPage)
|
||||
// this.status = 0
|
||||
// this.getListDate()
|
||||
|
||||
// }else{
|
||||
// this.status = 1
|
||||
// console.log('加载完成了',this.tjPage)
|
||||
// return
|
||||
// }
|
||||
// }
|
||||
}else if(this.contentShow == 2){
|
||||
if(this.tjPage+1 < this.tjTotalPage){
|
||||
this.tjPage++
|
||||
// console.log('加载',this.tjPage)
|
||||
this.tjstatus = 0
|
||||
this.getListDate()
|
||||
}else{
|
||||
this.tjstatus = 1
|
||||
}
|
||||
}
|
||||
},
|
||||
components:{
|
||||
musicPlay
|
||||
@@ -216,7 +236,7 @@
|
||||
wgGoPingshu(item){
|
||||
console.log('未购买评书',item)
|
||||
uni.navigateTo({
|
||||
url: '../comments/comments?bookid='+item.bookId,
|
||||
url: '../comments/comments?bookid='+item.id,
|
||||
// url:'../bookShop/commodityDetail'
|
||||
|
||||
});
|
||||
@@ -233,8 +253,7 @@
|
||||
this.contentShow = e.index
|
||||
},
|
||||
// 获取已购买书籍
|
||||
getfreeBook(){
|
||||
console.log('获取已购买书籍')
|
||||
getfreeBook(){
|
||||
this.$http
|
||||
.post('book/userebookbuy/buylist', {
|
||||
// .post('book/buyorderdetail/querybuy', {
|
||||
@@ -247,28 +266,20 @@
|
||||
if(res.code == 0){
|
||||
// this.ygtotalPage = res.page.totalPage
|
||||
//var arr = res.page
|
||||
res.page.forEach(item => {
|
||||
if(item.canListen){
|
||||
this.bookList.push(item)
|
||||
}
|
||||
})
|
||||
// console.log(this.bookList,'arr')
|
||||
//this.bookList = arr
|
||||
// this.bookList = this.bookList.concat(res.page.list)
|
||||
console.log(res,'已购买')
|
||||
this.status = 3
|
||||
this.bookList = res.page
|
||||
console.log(res,'获取已购买书籍')
|
||||
// this.status = 3
|
||||
}
|
||||
|
||||
});
|
||||
},
|
||||
|
||||
// 获取推荐图书(未购买)
|
||||
getListDate(){
|
||||
console.log('获取推荐图书(未购买)')
|
||||
getListDate(){
|
||||
this.loadingNow = false
|
||||
// 获取书架列表
|
||||
this.$http
|
||||
.post('book/shopproduct/booklist', {
|
||||
.post('book/book/getBestBooks', {
|
||||
'userId': this.userInfo.id,
|
||||
'limit':10,
|
||||
'page':this.tjPage
|
||||
@@ -278,24 +289,15 @@
|
||||
if(res.code == 0){
|
||||
// this.tjTotalPage = res.pages.totalPage
|
||||
var arr = []
|
||||
if(res.pages.length > 0){
|
||||
// for (var i=0; i<res.pages.list.length; i++ ) {
|
||||
// var booidArr = []
|
||||
// if(res.pages.list[i].bookId != null){
|
||||
// booidArr = res.pages.list[i].bookId.split(',')
|
||||
// //res.pages.list[i].bookId = booidArr
|
||||
// res.pages.list[i].bookId = booidArr
|
||||
// }else{
|
||||
// res.pages.list[i].bookId = []
|
||||
// }
|
||||
// }
|
||||
//console.log(res.pages,'res.pages.list')
|
||||
// var arr = res.pages.list
|
||||
this.tjBookLIst = res.pages
|
||||
// this.tjBookLIst = this.tjBookLIst.concat(res.pages.list)
|
||||
// console.log(this.tjBookLIst[0])
|
||||
this.status = 3
|
||||
} }
|
||||
if(res.page.records.length > 0){
|
||||
this.tjBookLIst = this.tjBookLIst.concat(res.page.records)
|
||||
this.tjTotalPage = res.page.pages
|
||||
this.tjstatus = 3
|
||||
}else{
|
||||
this.tjBookLIst = []
|
||||
this.tjTotalPage = 1
|
||||
}
|
||||
}
|
||||
|
||||
});
|
||||
},
|
||||
@@ -304,14 +306,14 @@
|
||||
goDetail(item) {
|
||||
console.log(item,'goDetail-----')
|
||||
uni.navigateTo({
|
||||
url: '../bookShop/commodityDetail?id=' + item.productId
|
||||
url: '../eBook/bookContent?Id=' + item.id
|
||||
// url: '../bookShop/commodityDetail?id=' + item.id
|
||||
});
|
||||
},
|
||||
goToListen(item){
|
||||
console.log(item,'item')
|
||||
|
||||
console.log(item,'item')
|
||||
uni.navigateTo({
|
||||
url: "../listen/listen?bookid="+item.bookId
|
||||
url: "../listen/listen?bookid="+item.id
|
||||
});
|
||||
|
||||
},
|
||||
@@ -334,7 +336,7 @@
|
||||
|
||||
<style lang="scss" scoped>
|
||||
@import '@/style/mixin.scss';
|
||||
.hehan{width: 80%; margin: 0 auto;}
|
||||
.hehan{width: 50%; margin: 0 auto;}
|
||||
.home_lunbo {
|
||||
margin: 40rpx 30rpx 0 30rpx;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user