656 lines
14 KiB
Vue
656 lines
14 KiB
Vue
<template>
|
||
<view style="background-color: #fff;padding: 30rpx;">
|
||
<z-nav-bar title="书籍详情"></z-nav-bar>
|
||
<view class="book_neir flexbox">
|
||
<view class="bn_img">
|
||
<img :src="bookMessage.images" mode="scaleToFill">
|
||
|
||
</view>
|
||
<view class="bn_nes">
|
||
<view style="font-weight: bold;margin-bottom: 30rpx;">
|
||
{{bookMessage.name}}
|
||
</view>
|
||
<view style="color: #9b9b9b;font-size: 28rpx;margin:20rpx 0 0 0;max-width: 400rpx;line-height: 38rpx;">
|
||
<p @click="onAuCHJump(bookMessage.author.id,1)" style="margin-bottom: 20rpx;">
|
||
{{bookMessage.author.authorName}} [著] >
|
||
</p>
|
||
<!-- <p @click="onAuCHJump(item.id,2)" v-for="item in this.bookMessage.publisherNIList">
|
||
{{item.title}} >
|
||
</p> -->
|
||
</view>
|
||
<view class="tags">
|
||
<uni-tag class="tag" @click="toMore()" :inverted="true" text="书评" type="success"></uni-tag>
|
||
<uni-tag @click="gotoListen()" class="tag" v-if="bookMessage.canListen" :inverted="true" text="听书" type="primary"></uni-tag>
|
||
<!-- 1:打卡,2不打卡 -->
|
||
<uni-tag @click="gotoclock()" v-if="bookMessage.clockIn == 1" class="tag" :inverted="true" text="签到" type="warning"></uni-tag>
|
||
<uni-tag @click="goJiangShu()" v-if="bookMessage.teachIn == 1" class="tag" :inverted="true" text="讲书" type="error"></uni-tag>
|
||
</view>
|
||
<view class="buy" v-if="!bookMessage.isBuy">
|
||
<view class="btn" @click="goBuy">
|
||
立即购买
|
||
</view>
|
||
</view>
|
||
</view>
|
||
<br clear="both">
|
||
</view>
|
||
<view class="book_tab">
|
||
<view class="head_line">
|
||
<b></b>
|
||
<text>简介</text>
|
||
</view>
|
||
<view class="bt_cont">
|
||
<view class="bt_jian" v-if="bookMessage.description != ''">
|
||
<text>
|
||
{{bookMessage.description}}
|
||
</text>
|
||
</view>
|
||
<u-divider v-else text="暂无简介信息"></u-divider>
|
||
<view class="head_line" style="margin-bottom:30rpx;">
|
||
<b></b>
|
||
<text>精彩试听</text>
|
||
</view>
|
||
<view class="playList" v-if="libLIst.length > 0">
|
||
<view class="item" v-for="(item,index) in libLIst" :key="index" >
|
||
<view >
|
||
<view v-if="item.isFree == 1"
|
||
:class="[]" @click="listenOne(item, index)">
|
||
|
||
<span :class="[userInfo.playingInfo.bookId==item.bookId && userInfo.playingInfo.id == item.id ? 'playing' : '','graytitle']">{{item.chapter}}</span>
|
||
<uni-tag v-if="item.isFree == 1" class="tag" size="small" :inverted="true" text="试听" type="success" />
|
||
<!-- <image class="playingFig" src="/static/playingGif.gif" mode="aspectFill"></image> -->
|
||
</view>
|
||
</view>
|
||
</view>
|
||
<view class="" style="text-align: center;" @click="gotoListen">
|
||
<text style="font-size: 28rpx; color:#27b386">查看完整目录</text>
|
||
</view>
|
||
</view>
|
||
<u-divider v-else text="暂无试听数据"></u-divider>
|
||
|
||
<view class="head_line" style="margin-bottom:30rpx;">
|
||
<b></b>
|
||
<text>热门书评</text>
|
||
</view>
|
||
<view class="list shupingList" v-if="shupingList.length > 0">
|
||
<view class="item" @click.stop="toDetail(item)" v-for="item in shupingList" :key="item.id">
|
||
<h4>{{item.title}}</h4>
|
||
<view class="" v-if="item.content && item.content != '' ">
|
||
<view class="info" v-html="item.content">
|
||
</view>
|
||
</view>
|
||
<view class="more" @click.stop="toDetail(item)">立即查看</view>
|
||
</view>
|
||
<view class="moreBtn" @click="toMore(item)">
|
||
<text>查看更多</text>
|
||
</view>
|
||
</view>
|
||
<u-divider v-else text="暂无书评数据"></u-divider>
|
||
</view>
|
||
<view>
|
||
<u-back-top :scroll-top="scrollTop" bottom="60" :customStyle='bgiStyle' :iconStyle="iconStyle"></u-back-top>
|
||
</view>
|
||
|
||
</view>
|
||
<music-play :playData="playData"></music-play>
|
||
</view>
|
||
</template>
|
||
|
||
<script>
|
||
import musicPlay from '@/components/music.vue'
|
||
import $http from '@/config/requestConfig.js';
|
||
import {
|
||
mapState,mapMutations
|
||
} from 'vuex';
|
||
export default {
|
||
data() {
|
||
return {
|
||
|
||
playData:{},
|
||
youhuiShow:false,
|
||
youhuiIndex:'',
|
||
youhuiList:[], // 优惠券列表
|
||
couponMz: 0, // 优惠券钱数
|
||
useCouponAmount: '' , // 使用的优惠券金额
|
||
bookJiageA: 0,
|
||
youhuiContent: {
|
||
coupons:{
|
||
id:'0'
|
||
}
|
||
},
|
||
scrollTop: 0,
|
||
tab_list: [{
|
||
name: '简介',
|
||
}, {
|
||
name: '目录',
|
||
}],
|
||
userMes: {},
|
||
bokMesDet: {},
|
||
tab_muJian: 0,
|
||
bookId: '',
|
||
bookMessage: {
|
||
flag: false,
|
||
author:{authorName:''}
|
||
|
||
},
|
||
bookCatalogue: [],
|
||
bgiStyle: {
|
||
background: '#2ab58833'
|
||
},
|
||
iconStyle: {
|
||
fontSize: '40rpx',
|
||
fontWeight: 'bold',
|
||
color: '#54a966',
|
||
},
|
||
typeFen: 1,
|
||
buyShow: false,
|
||
buysignShow: false,
|
||
buysignContent: '',
|
||
libLIst:[],
|
||
freeChapterCount:0,
|
||
isBuy:false,
|
||
shupingList:[],
|
||
};
|
||
},
|
||
|
||
onPageScroll(e) {
|
||
this.scrollTop = e.scrollTop;
|
||
},
|
||
onHide() {
|
||
this.libLIst = []
|
||
},
|
||
//第一次加载
|
||
onLoad(e) {
|
||
this.bookId = e.Id
|
||
|
||
},
|
||
computed: {
|
||
...mapState(['userInfo'])
|
||
},
|
||
//页面显示
|
||
onShow() {
|
||
this.getData();
|
||
},
|
||
components: {
|
||
musicPlay
|
||
},
|
||
//方法
|
||
methods: {
|
||
...mapMutations(['setUserInfo']),
|
||
getData() {
|
||
// 获取电子书详情
|
||
this.$http
|
||
// .post('book/book/appinfo/' + this.bookId + '/' + this.userInfo.id)
|
||
.post('book/book/getBookInfo', {
|
||
'bookId': this.bookId,
|
||
'userId': this.userInfo.id
|
||
})
|
||
.then(res => {
|
||
console.log('书详细',res.book)
|
||
this.bookMessage = res.book
|
||
this.bokMesDet.bookId = res.book.id
|
||
this.bokMesDet.bookName = res.book.name,
|
||
this.bokMesDet.images = res.book.images
|
||
this.isBuy = res.book.isBuy
|
||
this.freeChapterCount = res.book.freeChapterCount
|
||
this.bokMesDet.userId = this.userInfo.id
|
||
|
||
// if (this.bookMessage.publisherName.indexOf(',') > 0) {
|
||
// this.bookMessage.publisherName = this.bookMessage.publisherName.split(',')
|
||
// this.bookMessage.publisherId = this.bookMessage.publisherId.split(',')
|
||
// this.bookMessage.publisherNIList = []
|
||
// for (let i in this.bookMessage.publisherName) {
|
||
// this.bookMessage.publisherNIList.push({
|
||
// title: this.bookMessage.publisherName[i]
|
||
// })
|
||
// }
|
||
// for (let j in this.bookMessage.publisherId) {
|
||
// this.bookMessage.publisherNIList[j].id = this.bookMessage.publisherId[j]
|
||
// }
|
||
// } else {
|
||
// this.bookMessage.publisherNIList = []
|
||
// this.bookMessage.publisherNIList.push({
|
||
// 'title': this.bookMessage.publisherName,
|
||
// 'id': this.bookMessage.publisherId
|
||
// })
|
||
// }
|
||
});
|
||
|
||
// 获取电子目录
|
||
this.getLibList()
|
||
// 获取
|
||
this.getComments()
|
||
|
||
},
|
||
// 去讲书
|
||
goJiangShu(){
|
||
uni.navigateTo({
|
||
url: '../talkBook/talkBookDetail?bookId='+ this.bookId
|
||
});
|
||
},
|
||
// 去听书
|
||
gotoListen(){
|
||
uni.navigateTo({
|
||
url: "../listen/listen?bookid="+ this.bookId
|
||
});
|
||
},
|
||
// 去打卡
|
||
gotoclock(){
|
||
this.onPageJump('../clock/clock?bookid='+ this.bookId)
|
||
},
|
||
// 查看本书更多书评
|
||
toMore(val){
|
||
console.log(val,'val')
|
||
uni.navigateTo({
|
||
url: '../comments/comments?bookid='+ this.bookId,
|
||
});
|
||
},
|
||
// 去购买
|
||
goBuy(){
|
||
uni.navigateTo({
|
||
url: '../bookShop/commodityDetail?id=' + this.bookMessage.productId
|
||
});
|
||
},
|
||
// 获取书评
|
||
getComments(){
|
||
let data = {
|
||
'page': 1,
|
||
'limit': 3,
|
||
'bookid' : this.bookId
|
||
}
|
||
this.$http
|
||
.post('forum/articles/descupdatelist', data)
|
||
.then(res => {
|
||
console.log(res.page.list,'评论获取成功')
|
||
this.shupingList = res.page.list
|
||
}).catch((e)=>{
|
||
console.log(e,'e')
|
||
})
|
||
},
|
||
// 播放单个音频
|
||
listenOne(item,index){
|
||
console.log('点击了',index)
|
||
if(this.libLIst.length > 0){
|
||
this.setUserInfo({'playIndex': index})
|
||
this.$music.setList(this.libLIst,'autoPlay',index)
|
||
this.setUserInfo({'playVisible': true})
|
||
uni.setStorage({
|
||
key: 'playVisible',
|
||
data: true,
|
||
success: function () {
|
||
console.log('success');
|
||
}
|
||
});
|
||
|
||
// 本地存储播放列表
|
||
uni.setStorage({
|
||
key: 'playData',
|
||
data: {'myList':this.libLIst},
|
||
success: function () {
|
||
console.log('success');
|
||
}
|
||
});
|
||
// 系统暂存
|
||
this.setUserInfo({'myList':this.libLIst})
|
||
}
|
||
},
|
||
// 获取章节列表
|
||
getLibList(){
|
||
this.$http
|
||
.post('book/book/getBookCatalogue', {
|
||
'userId': this.userInfo.id,
|
||
'bookId': this.bookId,
|
||
// 'id': this.playid
|
||
})
|
||
.then(res => {
|
||
if(res.code == 0){
|
||
console.log(res,999)
|
||
if(res.BookCatalogue.length > 0){
|
||
res.BookCatalogue.map( item => {
|
||
if(item.isFree == 1){
|
||
this.libLIst.push(item)
|
||
}
|
||
})
|
||
console.log('改变后的试听目录',this.libLIst)
|
||
//this.libLIst = res.BookCatalogue
|
||
// this.fengImg = res.images
|
||
}
|
||
}
|
||
}).catch((e)=>{
|
||
console.log(e.msg)
|
||
})
|
||
},
|
||
|
||
|
||
// 跳转
|
||
onPageJump(url) {
|
||
uni.navigateTo({
|
||
url: url
|
||
});
|
||
|
||
},
|
||
// 书评详情
|
||
toDetail(val){
|
||
console.log(val,'val')
|
||
uni.navigateTo({
|
||
url:'../comments/commentsDetail?bookid='+val.bookid+'&bfa_id='+val.id
|
||
})
|
||
},
|
||
// 信息介绍跳转
|
||
onAuCHJump(id, e) {
|
||
uni.navigateTo({
|
||
url: './bookMessage?Id=' + id + '&typ=' + e
|
||
});
|
||
},
|
||
|
||
|
||
|
||
|
||
|
||
|
||
},
|
||
};
|
||
</script>
|
||
<style lang="scss" scoped>
|
||
@import '@/style/mixin.scss';
|
||
.playing{color: #1daa5c !important;}
|
||
.graytitle{color: #666;}
|
||
.flexbox{display: flex;}
|
||
.tags{
|
||
.tag{
|
||
margin-left: 0; margin-right: 10rpx;
|
||
}
|
||
}
|
||
.moreBtn{text-align: center; margin-top: 20rpx;
|
||
text{padding: 6rpx 20rpx; border: 1px solid #27b386; color: #27b386; border-radius: 10rpx;}
|
||
}
|
||
.buy{ text-align: right;
|
||
.btn{display: inline-block; padding: 6rpx 8rpx; font-size: 36rpx; color: #d75f54; border: 1px solid #d75f54; border-radius: 10rpx;}
|
||
}
|
||
.shupingList{
|
||
h4{font-size: 36rpx;}
|
||
.item{padding: 30rpx 20rpx; padding-bottom: 60rpx; border-bottom: 20rpx solid #eee; border-radius: 46rpx;}
|
||
.more{display: inline-block; margin-top: 20rpx; padding: 3rpx 5rpx; color: #27b386; border: 1px solid #27b386; border-radius:8rpx;}
|
||
.info{line-height:40rpx ; font-size: 26rpx; margin-top: 20rpx; height: 80rpx; overflow: hidden; }
|
||
}
|
||
.playList{padding: 20rpx; color: #666; }
|
||
.playList .item{display: block;line-height:60rpx; white-space: nowrap;
|
||
overflow-x: hidden; font-size: 36rpx;
|
||
text-overflow: ellipsis;}
|
||
.tag{margin-left: 20rpx;}
|
||
.head_line {
|
||
margin: 50rpx 0 0 0;
|
||
|
||
|
||
b {
|
||
display: inline-block;
|
||
width: 12rpx;
|
||
height: 40rpx;
|
||
background-color: #54a966;
|
||
vertical-align: bottom;
|
||
margin: 0 20rpx 0 0;
|
||
}
|
||
|
||
text {
|
||
font-size: 32rpx;
|
||
font-weight: bold;
|
||
}
|
||
|
||
i {
|
||
float: right;
|
||
font-style: normal;
|
||
color: #8b8a91;
|
||
font-size: 24rpx;
|
||
margin: 5rpx 35rpx 0 0;
|
||
}
|
||
}
|
||
.yq_youhui {
|
||
.yqLeft {
|
||
display: inline-block;
|
||
margin-right: 10rpx;
|
||
}
|
||
|
||
.yqRight {
|
||
float: right;
|
||
}
|
||
|
||
.dagnqian {
|
||
float: right;
|
||
font-size: 22rpx;
|
||
background-color: #dd1919;
|
||
color: #fff;
|
||
border-radius: 20rpx;
|
||
padding: 5rpx 10rpx;
|
||
}
|
||
}
|
||
.yq_yunfei {
|
||
.yqLeft {
|
||
display: inline-block;
|
||
margin-right: 10rpx;
|
||
}
|
||
|
||
text {
|
||
float: right;
|
||
}
|
||
}
|
||
.book_neir {
|
||
margin: 20rpx 0 0 0;
|
||
position: relative;
|
||
|
||
|
||
.bn_img {
|
||
|
||
width: 250upx;
|
||
height: 320upx;
|
||
img{width: 250upx;
|
||
height: 320upx;}
|
||
}
|
||
|
||
.bn_nes {
|
||
width: 100%;
|
||
font-size: 36rpx;
|
||
margin-left: 40rpx;
|
||
|
||
view {
|
||
margin: 20rpx 0 0 0;
|
||
}
|
||
}
|
||
|
||
.leiXing {
|
||
display: block;
|
||
padding: 5rpx 10rpx;
|
||
border-radius: 10rpx;
|
||
text-align: center;
|
||
color: #fff;
|
||
font-weight: normal;
|
||
background: #27b386;
|
||
position: absolute;
|
||
left: -15upx;
|
||
top: 10upx;
|
||
font-size: 16rpx;
|
||
}
|
||
}
|
||
|
||
.book_dredge {
|
||
font-size: 26rpx;
|
||
color: #e4b58a;
|
||
margin: 40rpx 0 0 0;
|
||
padding: 20rpx 30rpx 25rpx 30rpx;
|
||
background-image: url('../../static/icon/mine_back.png');
|
||
background-size: 100% auto;
|
||
|
||
image {
|
||
width: 46rpx;
|
||
height: 40rpx;
|
||
display: inline-block;
|
||
vertical-align: text-bottom;
|
||
margin: 0 10rpx 0 0;
|
||
}
|
||
|
||
b {
|
||
float: right;
|
||
font-size: 35rpx;
|
||
font-weight: bold;
|
||
line-height: 40rpx;
|
||
}
|
||
}
|
||
|
||
.book_vip{
|
||
background: url('../../static/icon/mine_card.png') top center no-repeat;
|
||
color: #87510d;
|
||
font-weight: bold;
|
||
}
|
||
|
||
|
||
|
||
.book_tab {
|
||
margin: 20rpx 0 0 0;
|
||
|
||
.bt_cont {
|
||
font-size: 34rpx;
|
||
line-height: 60rpx;
|
||
color: #666;
|
||
padding: 0 10rpx;
|
||
|
||
.bt_jian {
|
||
padding-top: 30rpx;
|
||
margin-bottom: 15rpx;
|
||
}
|
||
|
||
.bt_nulu {
|
||
border-bottom: 1px solid #eee;
|
||
padding: 20rpx 0;
|
||
|
||
font {
|
||
color: #54a966;
|
||
float: right;
|
||
font-size: 20rpx;
|
||
}
|
||
|
||
}
|
||
}
|
||
}
|
||
|
||
.book_caozuo {
|
||
position: fixed;
|
||
bottom: 0;
|
||
left: 0;
|
||
right: 0;
|
||
background-color: #fff;
|
||
|
||
view {
|
||
display: inline-block;
|
||
width: 33.3%;
|
||
text-align: center;
|
||
padding: 28rpx 0;
|
||
font-size: 35rpx;
|
||
border-top: 1px solid #eee;
|
||
}
|
||
|
||
view:nth-child(3) {
|
||
background-color: #54a966;
|
||
color: #fff;
|
||
}
|
||
}
|
||
|
||
|
||
.tanchu {
|
||
padding: 30rpx 50rpx 60rpx 50rpx;
|
||
|
||
.by_title {
|
||
font-size: 32rpx;
|
||
margin: 0 0 80rpx 0;
|
||
text-align: center;
|
||
}
|
||
|
||
.by_package {
|
||
font-size: 28rpx;
|
||
|
||
.by_fen {
|
||
box-shadow: 0 0 20rpx 0 #0000001a;
|
||
padding: 20rpx 30rpx;
|
||
background-color: #fff;
|
||
border-radius: 20rpx;
|
||
margin-bottom: 10rpx;
|
||
|
||
.biao {
|
||
font-weight: bold;
|
||
font-size: 32rpx;
|
||
}
|
||
|
||
.wenz {
|
||
color: #b1b1b1;
|
||
margin-top: 20rpx;
|
||
|
||
text {
|
||
color: #fe6e09;
|
||
margin-left: 20rpx;
|
||
}
|
||
}
|
||
|
||
.benl {
|
||
margin-top: 20rpx;
|
||
color: #d75f54;
|
||
font-size: 31rpx;
|
||
|
||
text {
|
||
font-size: 30rpx;
|
||
text-decoration: line-through;
|
||
color: #c1c1c1;
|
||
margin-left: 20rpx;
|
||
}
|
||
}
|
||
|
||
}
|
||
|
||
.Tab_by {
|
||
box-shadow: 0 0 20rpx 0 #fe700bcc;
|
||
color: #7b4c0a;
|
||
|
||
}
|
||
|
||
|
||
}
|
||
|
||
.by_btn {
|
||
background-image: linear-gradient(90deg, #ed7161 0%, #efa574 100%);
|
||
color: #fff;
|
||
width: 100%;
|
||
margin: 50rpx auto 0 auto;
|
||
text-align: center;
|
||
font-size: 18px;
|
||
font-weight: bold;
|
||
padding: 20rpx 0;
|
||
border-radius: 50rpx;
|
||
}
|
||
|
||
.chongBtn {
|
||
background-color: #54a966;
|
||
color: #fff;
|
||
margin-left: 20rpx;
|
||
border-radius: 10rpx;
|
||
padding: 2rpx 10rpx;
|
||
font-size: 20rpx;
|
||
display: inline-block;
|
||
}
|
||
}
|
||
.youhuiItem {
|
||
border: 1px solid #d9d9d9;
|
||
border-radius: 10rpx;
|
||
width: 100%;
|
||
display: flex;
|
||
padding: 20rpx 10rpx;
|
||
margin: 25rpx 0 0 0;
|
||
align-items: center;
|
||
background-color: #fff;
|
||
font-size: 30rpx;
|
||
}
|
||
|
||
.youhuiItem>view {
|
||
float: left;
|
||
}
|
||
|
||
.youhuiItem.youItem_style {
|
||
border-color: #fd6004;
|
||
}
|
||
</style>
|