讲书:已购、推荐

This commit is contained in:
yanwenlong
2023-10-13 10:08:50 +08:00
parent 350f9d22d2
commit fcc84b91a0
2 changed files with 93 additions and 8 deletions

View File

@@ -11,9 +11,9 @@
</view>
</view>
</view>
<view class="tip">
<!-- <view class="tip">
<text>请选择要打卡的书籍</text>
</view>
</view> -->
<view class="listenList" v-if="bookList.length > 0">
<view class="wrap" >
<u-row gutter="16" justify="flex-start">

View File

@@ -4,9 +4,19 @@
<!-- 顶部导航栏 -->
<z-nav-bar title="讲书"></z-nav-bar>
</view>
<view class="tip">
<text>请选择要查看的书籍</text>
<view class="" style="padding:40rpx 20rpx;">
<view class="mytabs flexbox">
<view :class="['item','item1', contentShow == 1 ? 'active' :'']" @click="setData(1)">
已购图书
</view>
<view :class="['item','item2', contentShow == 2 ? 'active' :'']" @click="setData(2)">
推荐图书
</view>
</view>
</view>
<!-- <view class="tip">
<text>请选择要查看的书籍</text>
</view> -->
<view class="mainContainer">
<view class="item" v-if="bookList.length > 0">
<u-row gutter="16" justify="flex-start" >
@@ -62,6 +72,7 @@ import { data } from 'jquery';
status:3,
shupingList:[],
bfaid:null,
contentShow: 1,
}
},
onPullDownRefresh() {
@@ -93,11 +104,24 @@ import { data } from 'jquery';
...mapState(['userInfo']),
},
methods: {
setData(e) {
this.contentShow = e
this.getBooks()
},
getBooks(){
this.$http
.post('book/teach/getTeachBooks',{
'limit': 100,
'page': this.page
if(this.contentShow == 1){
$http.request({
url: "book/teach/getUserTeachBooks",
method: "POST", // POST、GET、PUT、DELETE具体说明查看官方文档
data: {
id: this.userInfo.id,
'limit': 100,
'page': this.page
},
header: { //默认 无 说明:请求头
'Content-Type': 'application/json'
},
})
.then(res => {
console.log(res,'讲书列表')
@@ -114,6 +138,42 @@ import { data } from 'jquery';
}).catch(e => {
console.log(e,'e')
});
}else{
$http.request({
url: "book/teach/getUserBestTeachBooks",
method: "POST", // POST、GET、PUT、DELETE具体说明查看官方文档
data: {
id: this.userInfo.id,
'limit': 100,
'page': this.page
},
header: { //默认 无 说明:请求头
'Content-Type': 'application/json'
},
})
// this.$http
// .post('book/teach/getUserBestTeachBooks',{
// id: this.userInfo.id,
// 'limit': 100,
// 'page': this.page
// })
.then(res => {
console.log(res,'讲书列表')
if(res.code == 0 && res.page.records.length > 0){
this.bookList = res.page.records
this.totalPage = res.page.pages
this.status = 3
console.log(this.bookList,'this.bookList')
}else{
this.bookList = []
this.totalPage = 0
}
}).catch(e => {
console.log(e,'e')
});
}
},
// 书评详情
toDetail(val){
@@ -133,6 +193,31 @@ import { data } from 'jquery';
</script>
<style lang="scss" scoped>
.mytabs {
// background: url('@/static/icon/bgtushu.png') no-repeat left top;
height: 80rpx;
// margin-bottom: 30rpx;
.item {
border-radius: 10rpx;
background-color: #c6ead0;
width: 48%;
// margin: 0 10rpx;
text-align: center;
color: #3c7f56;
font-size: 36rpx;
line-height: 80rpx;
}
.item.active {
background-color: #3c7f56;
color: #fff;
}
.item1 {
margin-right: 20rpx;
}
}
.tip{
padding: 20rpx; background-color: #fff;
text{ font-size: 36rpx;}