This commit is contained in:
徐哼唧L
2024-01-08 13:50:53 +08:00
parent c3f3918c9b
commit 50da1d7e38
14 changed files with 2610 additions and 347 deletions

View File

@@ -1,11 +1,11 @@
<template>
<!--父组件-->
<view class="container" style="padding-bottom: 10rpx;">
<!-- <view class="mini"></view> -->
<view>
<z-nav-bar title="讲书目录"></z-nav-bar>
<!-- 基本信息 -->
<!-- 基本信息 -->
<view class="book_neir">
<view class="flexbox info">
<view class="item">
@@ -31,13 +31,20 @@
{{item.title}} >
</p>
</view>
<view class="tags">
<view class="tags" v-if="bookInfo.bookType==0">
<uni-tag class="tag" @click="toMore()" :inverted="true" text="书评"
type="success"></uni-tag>
<!-- 1:打卡2不打卡 -->
<uni-tag @click="gotoclock()" v-if="bookInfo.clockIn == 1" class="tag" :inverted="true"
text="签到" type="warning"></uni-tag>
</view>
<view class="tags" v-if="bookInfo.bookType==1||bookInfo.bookType==2">
<uni-tag class="tag" @click="onPageJump('../comments/comments?bookid=' + bookid)" :inverted="true" text="书评"
type="success"></uni-tag>
<!-- 1:打卡2不打卡 -->
<uni-tag @click="onPageJump('../clock/clock?bookid='+ bookid)" v-if="bookInfo.clockIn == 1" class="tag" :inverted="true"
text="签到" type="warning"></uni-tag>
</view>
</view>
</view>
</view>
@@ -49,11 +56,17 @@
<view>
<view @click="toDetail(item)" class="flexbox muluitem">
<span>{{item.title}}</span>&nbsp;&nbsp;
<view >
<uni-tag v-if="item.voices != ''" class="tag" size="small" :inverted="true" text="音频"
type="success" /></view>
<view ><uni-tag v-if="item.content != ''" class="tag" size="small" :inverted="true" text="文字"
type="primary" /></view>
<view>
<uni-tag v-if="item.voices != ''" class="tag" size="small" :inverted="true" text="音频"
type="success" />
<uni-tag v-if="item.images != ''" class="tag" size="small" :inverted="true" text="图片"
type="error" />
<uni-tag v-if="item.video != ''" class="tag" size="small" :inverted="true" text="视频"
type="warning" />
<uni-tag v-if="item.content != ''" class="tag" size="small" :inverted="true" text="文字"
type="primary" />
</view>
<!-- <image class="playingFig" src="/static/playingGif.gif" mode="aspectFill"></image> -->
</view>
</view>
@@ -61,17 +74,18 @@
<view style="width: 100%;">
<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>
<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>
</view>
<u-divider v-else text="暂无讲书目录"></u-divider>
<music-play :playData="playData"></music-play>
<!-- 公共组件-每个页面必须引入 -->
<public-module></public-module>
<public-module></public-module>
<!-- <z-navigation></z-navigation> -->
</view>
</view>
@@ -98,19 +112,19 @@
data() {
return {
isBuy: false, // true 已购买false 未购买
playData: {},
playData: {},
bookInfo: {
author:{
authorName:''
author: {
authorName: ''
}
}, // 书籍详情
bookid: null, // 书籍id
status:3,
status: 3,
freeChapterCount: 0, // 免费章节数
libLIst: [], // 书籍目录
videoList: [], //音频文件
page:1,
totalPage:0,
page: 1,
totalPage: 0,
}
},
onPullDownRefresh() {
@@ -123,12 +137,12 @@
},
onReachBottom() {
// console.log('到底了',this.page+1 , this.totalPage)
if(this.page+1 <= this.totalPage){
if (this.page + 1 <= this.totalPage) {
this.page++
this.status = 0
this.getLibList()
}else{
} else {
this.status = 1
}
},
@@ -142,15 +156,15 @@
// 隐藏原生的tabbar
console.log(e, 'e')
uni.hideTabBar();
this.bookid = e.bookid
},
this.bookid = e.bookid
},
onShow() {
// this.libLIst = []
// this.page = 1
// this.totalPage = 0
this.getLibList()
this.getBookInfo()
},
computed: {
...mapState(['userInfo'])
@@ -165,20 +179,20 @@
'userId': this.userInfo.id,
'bookId': this.bookid
}
checkBookRight(data,res=>{
checkBookRight(data, res => {
console.log(res)
if(res.success){
if (res.success) {
uni.navigateTo({
url: '../comments/comments?bookid=' + this.bookid,
});
}else{
} else {
uni.showToast({
title:'购买本书后方可查看此内容!',
icon:'none'
title: '购买本书后方可查看此内容!',
icon: 'none'
})
}
})
},
// 去打卡
gotoclock() {
@@ -188,7 +202,7 @@
},
getBookInfo() {
// 获取书本基本信息
this.$http
this.$http
.post('book/book/getBookInfo', {
'bookId': this.bookid,
'userId': this.userInfo.id
@@ -212,7 +226,7 @@
toDetail(item) {
console.log('点击了', item)
uni.navigateTo({
url: './talkBookDetail?teachId=' + item.teachId +"&bookId="+item.bookId
url: './talkBookDetail?teachId=' + item.teachId + "&bookId=" + item.bookId
});
},
@@ -228,18 +242,18 @@
.post('book/teach/getBookTeachItems', {
'bookId': this.bookid,
'limit': 20,
'page': this.page
'page': this.page
})
.then(res => {
if (res.code == 0) {
console.log( '章节目录',res)
console.log('章节目录', res)
if (res.page.records.length > 0) {
this.libLIst = this.libLIst.concat(res.page.records)
this.status = 3
this.totalPage = res.page.pages
if(this.totalPage == res.page.current){
this.totalPage = res.page.pages
if (this.totalPage == res.page.current) {
this.status = 1
}
}
} else {
this.libLIst = []
this.totalPage = 0
@@ -250,18 +264,29 @@
})
},
// 跳转
onPageJump(url) {
uni.navigateTo({
url: url
});
},
},
}
</script>
<style lang="less">
.muluitem{
span{
.muluitem {
span {
white-space: nowrap;
overflow-x: hidden;
text-overflow: ellipsis;
}
}
.playingFig {
width: 100rpx;
height: 100rpx;