Merge branch 'xie0925'

This commit is contained in:
@fawn-nine
2023-09-27 18:17:48 +08:00
17 changed files with 430 additions and 425 deletions

View File

@@ -27,8 +27,8 @@ export default {
console.log(res,'playingInfo本地初始化') console.log(res,'playingInfo本地初始化')
store.commit('setUserInfo',{'playingInfo': res.data}) store.commit('setUserInfo',{'playingInfo': res.data})
store.commit('setUserInfo',{ store.commit('setUserInfo',{
'playTitle':res.data.chapterName, 'playTitle':res.data.chapter,
'fengImg':res.data.images 'fengImg':res.data.bookImage
}) })
console.log(store.state.userInfo,'初始化') console.log(store.state.userInfo,'初始化')
}, },
@@ -64,8 +64,7 @@ export default {
console.log('本地无数据'); console.log('本地无数据');
music.setList([]) music.setList([])
//store.commit('setUserInfo',{'playingInfo': {'bookid':0,'chapterId':0}}); //store.commit('setUserInfo',{'playingInfo': {'bookid':0,'chapterId':0}});
store.commit('setUserInfo',{'playVisible': false}) store.commit('setUserInfo',{'playVisible': false})
// music.setCoverImg('../../static/icon/x1.jpg')
store.commit('setUserInfo',{ store.commit('setUserInfo',{
'myList':[], 'myList':[],
'fengImg':'../../static/icon/fengziIcon.jpg' 'fengImg':'../../static/icon/fengziIcon.jpg'

View File

@@ -593,7 +593,7 @@
.fengmianBox:after{ .fengmianBox:after{
content: ''; display: inline-block; left:0; top:0; z-index: 0;width: 400rpx; height: 400rpx; position: absolute; border-radius: 400rpx; box-shadow: rgba(177, 235, 202, 0.8) 0px 0px 29px 0px; content: ''; display: inline-block; left:0; top:0; z-index: 0;width: 400rpx; height: 400rpx; position: absolute; border-radius: 400rpx; box-shadow: rgba(177, 235, 202, 0.8) 0px 0px 29px 0px;
} }
.fengmianBox.defaultBg{background-image: url('@/static/icon/x1.jpg');} .fengmianBox.defaultBg{background-image: url('@/static/icon/home_icon_0.png');}
page { page {
background-color: #F6F6F8; background-color: #F6F6F8;

View File

@@ -5,8 +5,9 @@
<view> <view>
<view class="audo-video"> <view class="audo-video">
<!-- 播放封面 --> <!-- 播放封面 -->
<view :class="['fengmianBox','defaultBg', userInfo.playFlag ? 'playAnimate' : '']" :style="{ backgroundImage: `url(${fengImg})` }"></view> <view :class="['fengmianBox','defaultBg', userInfo.playFlag ? 'playAnimate' : '']" :style="{ backgroundImage: `url(${fengImg})` }"></view>
<!-- <view v-else :class="['fengmianBox','defaultBg', userInfo.playFlag ? 'playAnimate' : '']" style="{ border:1px solid red;backgroundImage: url('@/static/icon/fengziIcon.jpg') }">显示我</view> -->
<!--音频播放按钮处--> <!--音频播放按钮处-->
<view class="audo-top"> <view class="audo-top">
@@ -57,7 +58,7 @@
<view class="item" v-for="(item,index) in libLIst" :key="index" > <view class="item" v-for="(item,index) in libLIst" :key="index" >
<view @click="listenOne(item)" :class="userInfo.playIndex == index ? 'playNow' : ''"> <view @click="listenOne(item)" :class="userInfo.playIndex == index ? 'playNow' : ''">
<view>{{item.chapterName}}</view> <view>{{item.chapter}}</view>
</view> </view>
</view> </view>
</scroll-view> </scroll-view>
@@ -122,12 +123,13 @@
audioMannager:null ,// 背景音乐 audioMannager:null ,// 背景音乐
saveInterVal:null, saveInterVal:null,
fengImg:'', fengImg:'',
nofengImg:'../../static/icon/fengziIcon.jpg'
} }
}, },
created() { created() {
this.libLIst = this.$bgm.musicList this.libLIst = this.$bgm.musicList
this.fengImg = this.userInfo.fengImg this.fengImg = this.userInfo.fengImg
console.log(this.userInfo.fengImg,'this.userInfo.fengImg++++++++++++++')
this.userInfo.playTimes ? this.setUserInfo({'currentTime': this.userInfo.playTimes}) : '' this.userInfo.playTimes ? this.setUserInfo({'currentTime': this.userInfo.playTimes}) : ''
}, },
@@ -261,7 +263,7 @@
.fengmianBox:after{ .fengmianBox:after{
content: ''; display: inline-block; left:0; top:0; z-index: 0;width: 400rpx; height: 400rpx; position: absolute; border-radius: 400rpx; box-shadow: rgba(177, 235, 202, 0.8) 0px 0px 29px 0px; content: ''; display: inline-block; left:0; top:0; z-index: 0;width: 400rpx; height: 400rpx; position: absolute; border-radius: 400rpx; box-shadow: rgba(177, 235, 202, 0.8) 0px 0px 29px 0px;
} }
.fengmianBox.defaultBg{background-image: url('@/static/icon/x1.jpg');} .fengmianBox.defaultBg{background-image: url('@/static/icon/home_icon_0.png');}
page { page {
background-color: #F6F6F8; background-color: #F6F6F8;

View File

@@ -6,8 +6,8 @@
<!--音频播放按钮处--> <!--音频播放按钮处-->
<view class="audo-top"> <view class="audo-top">
<!-- 播放封面 --> <!-- 播放封面 -->
<image v-if="userInfo.fengImg && userInfo.fengImg != ''" @click="changeShow" style="width: 120rpx; height: 120rpx; margin-top: 0;" :class="['fengImg','fengmianBox','defaultBg', userInfo.playFlag ? 'playAnimate' : '']" :src="userInfo.fengImg" mode="aspectFill"></image> <image @click="changeShow" style="width: 120rpx; height: 120rpx; margin-top: 0;" :class="['fengImg','fengmianBox','defaultBg', userInfo.playFlag ? 'playAnimate' : '']" :src="userInfo.fengImg" mode="aspectFill"></image>
<image v-else @click="changeShow" style="width: 120rpx; height: 120rpx; margin-top: 0;" :class="['fengImg','fengmianBox','defaultBg', userInfo.playFlag ? 'playAnimate' : '']" src="@/static/icon/fengziIcon.jpg" mode="aspectFill"></image> <!-- <image v-else @click="changeShow" style="width: 120rpx; height: 120rpx; margin-top: 0;" :class="['fengImg','fengmianBox','defaultBg', userInfo.playFlag ? 'playAnimate' : '']" src="@/static/icon/fengziIcon.jpg" mode="aspectFill"></image> -->
<!-- <u-icon name="arrow-right" color="#61e781" size="28" v-else @click="changeShow"></u-icon> --> <!-- <u-icon name="arrow-right" color="#61e781" size="28" v-else @click="changeShow"></u-icon> -->
<!--上一首切换按钮--> <!--上一首切换按钮-->
@@ -261,7 +261,7 @@
.fengmianBox .defaultBg{ margin: 0 auto;border-radius: 200rpx; margin: 0 auto; .fengmianBox .defaultBg{ margin: 0 auto;border-radius: 200rpx; margin: 0 auto;
margin-bottom: 20rpx; background-size: cover; margin-bottom: 20rpx; background-size: cover;
background-repeat: no-repeat; background-repeat: no-repeat;
background-image: url('@/static/icon/x1.jpg'); background-image: url('@/static/icon/home_icon_0.png');
} }
page { page {

View File

@@ -28,14 +28,14 @@
path: '', path: '',
navigationList: [{ navigationList: [{
pagePath: 'pages/peanut/home', pagePath: 'pages/peanut/home',
iconPath: 'static/tab/tab1.png', iconPath: 'static/tab/icon1_n.png',
selectedIconPath: 'static/tab/tab1-1.png', selectedIconPath: 'static/tab/icon1_y.png',
text: '首页' text: '首页'
}, },
{ {
"pagePath": "pages/library/library", "pagePath": "pages/library/library",
"iconPath": "static/tab/tab2.png", "iconPath": "static/tab/icon3_n.png",
"selectedIconPath": "static/tab/tab2-1.png", "selectedIconPath": "static/tab/icon3_y.png",
"text": "我的图书" "text": "我的图书"
}, },
// { // {
@@ -46,15 +46,15 @@
// }, // },
{ {
pagePath: 'pages/bookShop/orderList', pagePath: 'pages/bookShop/orderList',
iconPath: 'static/tab/tab3.png', iconPath: 'static/tab/icon2_n.png',
selectedIconPath: 'static/tab/tab3-1.png', selectedIconPath: 'static/tab/icon2_y.png',
text: '我的订单' text: '我的订单'
}, },
{ {
pagePath: 'pages/peanut/mine', pagePath: 'pages/peanut/mine',
iconPath: 'static/tab/tab4.png', iconPath: 'static/tab/icon4_n.png',
selectedIconPath: 'static/tab/tab4.png', selectedIconPath: 'static/tab/icon4_y.png',
text: '我的' text: '我的'
} }
], ],

View File

@@ -433,6 +433,33 @@
} }
} }
,{
"path" : "pages/talkBook/talkBook",
"style" :
{
"navigationBarTitleText": "讲书",
"enablePullDownRefresh": true
}
}
,{
"path" : "pages/talkBook/talkBookML",
"style" :
{
"navigationBarTitleText": "讲书书籍页面",
"enablePullDownRefresh": true
}
}
,{
"path" : "pages/talkBook/talkBookDetail",
"style" :
{
"navigationBarTitleText": "讲书详情",
"enablePullDownRefresh": false
}
}
], ],
"globalStyle": { "globalStyle": {
"navigationBarTextStyle": "black", "navigationBarTextStyle": "black",

View File

@@ -15,7 +15,7 @@
<view class="bookinfo"> <view class="bookinfo">
<view class="case"> <view class="case">
<view class="book flexbox"> <view class="book flexbox">
<image src="../../static/icon/x1.jpg" mode="aspectFill"></image> <image src="../../static/icon/home_icon_0.png" mode="aspectFill"></image>
<view class="clockInfo"> <view class="clockInfo">
<span>中医免疫学</span> <span>中医免疫学</span>
<h3>#第三课专业变现你的专业 = 超级杠杆 第一笔只是财富#</h3> <h3>#第三课专业变现你的专业 = 超级杠杆 第一笔只是财富#</h3>
@@ -51,7 +51,7 @@
<view class="case"> <view class="case">
<view class="book flexbox"> <view class="book flexbox">
<image src="../../static/icon/x1.jpg" mode="aspectFill"></image> <image src="../../static/icon/home_icon_0.png" mode="aspectFill"></image>
<view class="clockInfo"> <view class="clockInfo">
<span>中医免疫学</span> <span>中医免疫学</span>
<h3>#第三课专业变现你的专业 = 超级杠杆 第一笔只是财富#</h3> <h3>#第三课专业变现你的专业 = 超级杠杆 第一笔只是财富#</h3>
@@ -93,7 +93,7 @@
<view class="bookinfo"> <view class="bookinfo">
<view class="case"> <view class="case">
<view class="book flexbox"> <view class="book flexbox">
<image src="../../static/icon/x1.jpg" mode="aspectFill"></image> <image src="../../static/icon/home_icon_0.png" mode="aspectFill"></image>
<view class="clockInfo"> <view class="clockInfo">
<span>中医免疫学</span> <span>中医免疫学</span>
<h3>#第三课专业变现你的专业 = 超级杠杆 第一笔只是财富#</h3> <h3>#第三课专业变现你的专业 = 超级杠杆 第一笔只是财富#</h3>
@@ -129,7 +129,7 @@
<view class="case"> <view class="case">
<view class="book flexbox"> <view class="book flexbox">
<image src="../../static/icon/x1.jpg" mode="aspectFill"></image> <image src="../../static/icon/home_icon_0.png" mode="aspectFill"></image>
<view class="clockInfo"> <view class="clockInfo">
<span>中医免疫学</span> <span>中医免疫学</span>
<h3>#第三课专业变现你的专业 = 超级杠杆 第一笔只是财富#</h3> <h3>#第三课专业变现你的专业 = 超级杠杆 第一笔只是财富#</h3>

View File

@@ -29,7 +29,7 @@
<view class="bookinfo"> <view class="bookinfo">
<view class="case" v-for="(item, index) in recordList" :key="index"> <view class="case" v-for="(item, index) in recordList" :key="index">
<view class="book flexbox" > <view class="book flexbox" >
<!-- <image src="../../static/icon/x1.jpg" mode="aspectFill"></image> --> <!-- <image src="../../static/icon/home_icon_0.png" mode="aspectFill"></image> -->
<view class="clockInfo" > <view class="clockInfo" >
<!-- <span>中医免疫学</span> --> <!-- <span>中医免疫学</span> -->
<h3><span class="day"> <em>{{item.dayId}}</em> </span><br/>#{{item.TaskHeading}}#</h3> <h3><span class="day"> <em>{{item.dayId}}</em> </span><br/>#{{item.TaskHeading}}#</h3>

View File

@@ -10,8 +10,8 @@
{{bookMessage.name}} {{bookMessage.name}}
</view> </view>
<view style="color: #9b9b9b;font-size: 28rpx;margin:20rpx 0 0 0;max-width: 400rpx;line-height: 38rpx;"> <view style="color: #9b9b9b;font-size: 28rpx;margin:20rpx 0 0 0;max-width: 400rpx;line-height: 38rpx;">
<p @click="onAuCHJump(bookMessage.authorId,1)" style="margin-bottom: 20rpx;"> <p @click="onAuCHJump(bookMessage.author.id,1)" style="margin-bottom: 20rpx;">
{{bookMessage.authorName}} [] > {{bookMessage.author.authorName}} [] >
</p> </p>
<!-- <p @click="onAuCHJump(item.id,2)" v-for="item in this.bookMessage.publisherNIList"> <!-- <p @click="onAuCHJump(item.id,2)" v-for="item in this.bookMessage.publisherNIList">
{{item.title}} > {{item.title}} >
@@ -52,14 +52,17 @@
<view class="item" v-for="(item,index) in libLIst" :key="index" > <view class="item" v-for="(item,index) in libLIst" :key="index" >
<view > <view >
<view v-if="3 > index" <view v-if="3 > index"
:class="[freeChapterCount < index ? 'graytitle' : '', :class="[
userInfo.playingInfo.bookid==item.bookid && userInfo.playingInfo.chapterId == item.chapterId ? 'playing' : '']" @click="listenOne(item, index)"> userInfo.playingInfo.bookId==item.bookId && userInfo.playingInfo.id == item.id ? 'playing' : '']" @click="listenOne(item, index)">
<span :class="[freeChapterCount-1 < index ? 'graytitle' : '']">{{item.chapterName}}</span>&nbsp;&nbsp; <span :class="['graytitle']">{{item.chapter}}</span>&nbsp;&nbsp;
<uni-tag v-if="freeChapterCount-1 >= index" class="tag" size="small" :inverted="true" text="试听" type="success" /> <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> --> <!-- <image class="playingFig" src="/static/playingGif.gif" mode="aspectFill"></image> -->
</view> </view>
</view> </view>
</view> </view>
<view class="" style="text-align: center;" @click="gotoListen">
<text style="font-size: 28rpx; color:#27b386">查看完整目录</text>
</view>
</view> </view>
<u-divider v-else text="暂无试听数据"></u-divider> <u-divider v-else text="暂无试听数据"></u-divider>
@@ -124,7 +127,9 @@
tab_muJian: 0, tab_muJian: 0,
bookId: '', bookId: '',
bookMessage: { bookMessage: {
flag: false flag: false,
author:{authorName:''}
}, },
bookCatalogue: [], bookCatalogue: [],
bgiStyle: { bgiStyle: {
@@ -171,7 +176,11 @@
getData() { getData() {
// 获取电子书详情 // 获取电子书详情
this.$http this.$http
.post('book/book/appinfo/' + this.bookId + '/' + this.userInfo.id) // .post('book/book/appinfo/' + this.bookId + '/' + this.userInfo.id)
.post('book/book/getBookInfo', {
'bookId': this.bookId,
'userId': this.userInfo.id
})
.then(res => { .then(res => {
console.log('书详细',res.book) console.log('书详细',res.book)
this.bookMessage = res.book this.bookMessage = res.book
@@ -180,7 +189,6 @@
this.bokMesDet.images = res.book.images this.bokMesDet.images = res.book.images
this.isBuy = res.book.isBuy this.isBuy = res.book.isBuy
this.freeChapterCount = res.book.freeChapterCount this.freeChapterCount = res.book.freeChapterCount
this.bokMesDet.userId = this.userInfo.id this.bokMesDet.userId = this.userInfo.id
if (this.bookMessage.publisherName.indexOf(',') > 0) { if (this.bookMessage.publisherName.indexOf(',') > 0) {
@@ -230,7 +238,7 @@
// 去购买 // 去购买
goBuy(){ goBuy(){
uni.navigateTo({ uni.navigateTo({
url: '../bookShop/settlementBook?type=2&list=' + this.bookId url: '../bookShop/commodityDetail?id=' + this.bookMessage.productId
}); });
}, },
// 获取书评 // 获取书评
@@ -280,8 +288,8 @@
getLibList(){ getLibList(){
this.$http this.$http
.post('book/book/getBookCatalogue', { .post('book/book/getBookCatalogue', {
'userid': this.userInfo.id, 'userId': this.userInfo.id,
'bookid': this.bookId, 'bookId': this.bookId,
// 'id': this.playid // 'id': this.playid
}) })
.then(res => { .then(res => {
@@ -330,6 +338,7 @@
<style lang="scss" scoped> <style lang="scss" scoped>
@import '@/style/mixin.scss'; @import '@/style/mixin.scss';
.playing{color: #1daa5c;} .playing{color: #1daa5c;}
.graytitle{color: #666;}
.flexbox{display: flex;} .flexbox{display: flex;}
.tags{ .tags{
.tag{ .tag{

View File

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

View File

@@ -10,7 +10,9 @@
</view> --> </view> -->
<!-- 正在播放章节 --> <!-- 正在播放章节 -->
<view class="playTitle flexbox"> <view class="playTitle flexbox">
<text class="nowPlayTitle">正在播放:</text><text-scroll :myStyle="StyleSheet" :text="boardRemark" class="textScroll"></text-scroll> <text class="nowPlayTitle">正在播放:</text>
<text-scroll v-if="userInfo.playTitle && userInfo.playTitle != ''" :myStyle="StyleSheet" :text="userInfo.playTitle" class="textScroll"></text-scroll>
<text-scroll v-else :myStyle="StyleSheet" :text="noplayTitle" class="textScroll"></text-scroll>
</view> </view>
<!-- 播放器 --> <!-- 播放器 -->
@@ -52,7 +54,7 @@
export default { export default {
components: { components: {
cxAdudioPlay, cxAdudioPlay,
textScroll, textScroll,
// musicPlay // musicPlay
}, },
data() { data() {
@@ -60,7 +62,7 @@
playData:{}, playData:{},
stopPlay:false, // 关闭音频 stopPlay:false, // 关闭音频
jia:false, // 下一首 jia:false, // 下一首
noplayTitle:'未在播放',
current:0, current:0,
bookid:null, // 书籍id bookid:null, // 书籍id
playid:null, // 正在播放的章节id playid:null, // 正在播放的章节id
@@ -115,10 +117,10 @@
}, },
computed: { computed: {
...mapState(['userInfo']), ...mapState(['userInfo']),
boardRemark(){ // boardRemark(){
return this.userInfo.playTitle // //console.log(this.userInfo, 'this.userInfo')
// console.log(this.userInfo, 'this.userInfo') // return this.userInfo.playTitle
}, // },
}, },
methods: { methods: {

View File

@@ -23,8 +23,8 @@
{{bookInfo.name}} {{bookInfo.name}}
</view> </view>
<view style="color: #9b9b9b;font-size: 28rpx;margin:20rpx 0 0 0;max-width: 400rpx;line-height: 38rpx;"> <view style="color: #9b9b9b;font-size: 28rpx;margin:20rpx 0 0 0;max-width: 400rpx;line-height: 38rpx;">
<p @click="onAuCHJump(bookInfo.authorId,1)" style="margin-bottom: 20rpx;"> <p @click="onAuCHJump(bookInfo.author.id,1)" style="margin-bottom: 20rpx;">
{{bookInfo.authorName}} [] > {{bookInfo.author.authorName}} [] >
</p> </p>
<p @click="onAuCHJump(item.id,2)" v-for="item in this.bookInfo.publisherNIList"> <p @click="onAuCHJump(item.id,2)" v-for="item in this.bookInfo.publisherNIList">
{{item.title}} > {{item.title}} >
@@ -57,7 +57,7 @@
</view> </view>
<!-- 试听组 --> <!-- 试听组 -->
<view class="home_nar flexbox" v-else> <view class="home_nar flexbox" v-else>
<view class="hn_cl_tit shiting" @click="buyBook"> <view class="hn_cl_tit shiting" @click="buyBook" v-if="bookInfo.productId != null">
<image src="../../static/icon/goumai.png" mode="aspectFit"></image> <image src="../../static/icon/goumai.png" mode="aspectFit"></image>
<text>立即购买</text> <text>立即购买</text>
</view> </view>
@@ -76,12 +76,14 @@
--> -->
<view class="playList" v-if="libLIst.length > 0"> <view class="playList" v-if="libLIst.length > 0">
<view class="item" v-for="(item,index) in libLIst" :key="index" > <view class="item" v-for="(item,index) in libLIst" :key="index" >
<!-- {{userInfo.playingInfo.bookId}}-{{item.bookId}}
{{userInfo.playingInfo.id}} - {{item.id}} -->
<view > <view >
<view <view
:class="['flexbox',freeChapterCount < index && isBuy == false ? 'graytitle' : '', :class="['flexbox',
userInfo.playingInfo.bookid==item.bookid && userInfo.playingInfo.chapterId == item.chapterId ? 'playing' : '']" @click="listenOne(item, index)"> userInfo.playingInfo.bookId == item.bookId && userInfo.playingInfo.id == item.id ? 'playing' : '']" @click="listenOne(item, index)">
<span :class="[freeChapterCount-1 < index && isBuy == false ? 'graytitle' : '','muluspan']">{{item.chapterName}}</span>&nbsp;&nbsp; <span :class="['graytitle','muluspan']">{{item.chapter}}</span>&nbsp;&nbsp;
<view><uni-tag v-if="freeChapterCount-1 >= index && isBuy == false" class="tag" size="small" :inverted="true" text="试听" type="success" /></view> <view><uni-tag v-if="item.isFree == 1" class="tag" size="small" :inverted="true" text="试听" type="success" /></view>
<!-- <image class="playingFig" src="/static/playingGif.gif" mode="aspectFill"></image> --> <!-- <image class="playingFig" src="/static/playingGif.gif" mode="aspectFill"></image> -->
</view> </view>
</view> </view>
@@ -118,7 +120,9 @@
jia:false, // 下一I首 jia:false, // 下一I首
forceRefresh:true, forceRefresh:true,
current:0, current:0,
bookInfo:{}, // 书籍详情 bookInfo:{
author:{authorName:''}
}, // 书籍详情
bookid:null, // 书籍id bookid:null, // 书籍id
playid:null, // 正在播放的章节id playid:null, // 正在播放的章节id
playchapName:'', // 正在播放的章节名称 playchapName:'', // 正在播放的章节名称
@@ -162,6 +166,7 @@
boardRemark: '', boardRemark: '',
StyleSheet:'font-size:36rpx; text-align:center', StyleSheet:'font-size:36rpx; text-align:center',
jian:false, // 上一曲切换 jian:false, // 上一曲切换
productId:null,
} }
}, },
//第一次加载 //第一次加载
@@ -172,9 +177,6 @@
uni.hideTabBar(); uni.hideTabBar();
this.bookid = e.bookid this.bookid = e.bookid
//console.log(this.userInfo.playFlag,'this.userInfo.playFlag') //console.log(this.userInfo.playFlag,'this.userInfo.playFlag')
this.getLibList()
this.getBookInfo()
}, },
created() { created() {
@@ -184,13 +186,32 @@
if(this.userInfo.orderPlayBtn != undefined){ if(this.userInfo.orderPlayBtn != undefined){
this.orderPlayBtn = this.userInfo.orderPlayBtn this.orderPlayBtn = this.userInfo.orderPlayBtn
} }
console.log(this.userInfo.playingInfo,'userInfo.playingInfo------')
this.getLibList()
this.getBookInfo()
//this.getProductID()
}, },
computed: { computed: {
...mapState(['userInfo']) ...mapState(['userInfo'])
}, },
methods: { methods: {
...mapMutations(['setUserInfo']), ...mapMutations(['setUserInfo']),
// bookid查商品id
// getProductID(){
// $http.post('book/shopproduct/bookinfo/' + this.bookid)
// .then(res => {
// console.log(res,'查询到的商品id')
// if (res.code == 0 && res.shopProduct != null) {
// this.productId = res.shopProduct.productId
// }else{
// this.productId = null
// }
// }).catch(e => {
// console.log(e,'eid')
// });
// },
// 查看本书更多书评 // 查看本书更多书评
toMore(val){ toMore(val){
console.log(val,'val') console.log(val,'val')
@@ -206,8 +227,11 @@
}, },
getBookInfo(){ getBookInfo(){
// 获取书本基本信息 // 获取书本基本信息
this.$http this.$http
.post('book/book/appinfo/' + this.bookid + '/' + this.userInfo.id) .post('book/book/getBookInfo', {
'bookId': this.bookid,
'userId': this.userInfo.id
})
.then(res => { .then(res => {
if(res.code == 0){ if(res.code == 0){
console.log(res,'res') console.log(res,'res')
@@ -241,10 +265,11 @@
}, },
}).then(res => { }).then(res => {
console.log(res,'历史记录') console.log(res,'历史记录')
if(res.readRate != null){ if(res.readRate != null){
// 有听书进度时 // 有听书进度时
var item = res.readRate var item = res.readRate
if(this.$bgm._options.src != '' && res.readRate.chapterId == this.userInfo.playingInfo.chapterId && res.readRate.bookId == this.userInfo.playingInfo.bookid ){ if(this.$bgm._options.src != '' && res.readRate.chapterId == this.userInfo.playingInfo.id && res.readRate.bookId == this.userInfo.playingInfo.bookId ){
// console.log(this.$bgm) // console.log(this.$bgm)
if(this.$bgm.playing){ if(this.$bgm.playing){
console.log('线上存储进度是同一条数据,不做处理') console.log('线上存储进度是同一条数据,不做处理')
@@ -257,7 +282,7 @@
this.onlineH.playIndex = this.libLIst.findIndex(function(info){ this.onlineH.playIndex = this.libLIst.findIndex(function(info){
// console.log(info,'info') // console.log(info,'info')
if(item.chapterId == info.chapterId && item.bookId == info.bookid ){ if(item.chapterId == info.id && item.bookId == info.bookId ){
return info; return info;
} }
}) })
@@ -268,18 +293,23 @@
this.onlineH.time = 0 this.onlineH.time = 0
console.log('到这++') console.log('到这++')
} }
console.log('到这')
this.$music.setList(this.libLIst,'autoPlay',this.onlineH.playIndex, this.onlineH.time) this.$music.setList(this.libLIst,'autoPlay',this.onlineH.playIndex, this.onlineH.time)
}) })
}, },
addMusicList(){ addMusicList(){
if(this.libLIst.length == 0){
uni.showToast({
title:'没有音频可以播放哦~',
icon:'none'
})
return false
}
this.getListenRate() this.getListenRate()
// this.playData = { // this.playData = {
// 'myList' : this.libLIst, // 'myList' : this.libLIst,
// // 'fengImg' : this.fengImg, // // 'fengImg' : this.fengImg,
// } // }
// 显示播放组件 // 显示播放组件
this.setUserInfo({'playVisible':true}) this.setUserInfo({'playVisible':true})
uni.setStorage({ uni.setStorage({
@@ -299,14 +329,15 @@
if(this.libLIst.length > 0){ if(this.libLIst.length > 0){
this.setUserInfo({'playIndex': index}) this.setUserInfo({'playIndex': index})
this.$music.setList(this.libLIst,'autoPlay',index) this.$music.setList(this.libLIst,'autoPlay',index)
this.setUserInfo({'playVisible': true}) this.setUserInfo({'playVisible': true})
uni.setStorage({ uni.setStorage({
key: 'playVisible', key: 'playVisible',
data: true, data: true,
success: function () { success: function () {
console.log('success'); console.log('success');
} }
}); });
// this.fengImg = newVal.fengImg // this.fengImg = newVal.fengImg
// 本地存储播放列表 // 本地存储播放列表
@@ -332,8 +363,8 @@
// 购买 // 购买
buyBook(){ buyBook(){
uni.navigateTo({ uni.navigateTo({
url: '../bookShop/settlementBook?type=2&list=' + this.bookid url: '../bookShop/commodityDetail?id=' + this.bookInfo.productId
}); });
}, },
@@ -394,8 +425,8 @@
getLibList(){ getLibList(){
this.$http this.$http
.post('book/book/getBookCatalogue', { .post('book/book/getBookCatalogue', {
'userid': this.userInfo.id, 'userId': this.userInfo.id,
'bookid': this.bookid, 'bookId': this.bookid,
// 'id': this.playid // 'id': this.playid
}) })
.then(res => { .then(res => {
@@ -525,10 +556,12 @@
} }
} }
.charType{display: inline; width:20px !important;} .charType{display: inline; width:20px !important;}
.graytitle{color: #999;} .graytitle{color: #666;}
.yigoumai{background-color: #ffc773;} .yigoumai{background-color: #ffc773;}
.shiting{background-color:#f47983 ; } .shiting{background-color:#f47983 ; }
.playing{color: #1daa5c;} .playing{color: #1daa5c;
.graytitle{color: #1daa5c !important;}
}
.chaoshi{background-color:#1daa5c ; } .chaoshi{background-color:#1daa5c ; }
.home_nar{margin: 30rpx 0; justify-content: space-between;} .home_nar{margin: 30rpx 0; justify-content: space-between;}
.hn_cl_tit { .hn_cl_tit {

View File

@@ -380,9 +380,7 @@
// 获取推荐数据 // 获取推荐数据
this.getJtData() this.getJtData()
}, },
getJtData(){ getJtData(){
console.log('++++++++')
this.$http this.$http
.post('book/label/list',{ .post('book/label/list',{
'splId': this.tabsid, 'splId': this.tabsid,

View File

@@ -96,7 +96,7 @@ import { data } from 'jquery';
getBooks(){ getBooks(){
this.$http this.$http
.post('book/teach/getTeachBooks',{ .post('book/teach/getTeachBooks',{
'limit': 9, 'limit': 100,
'page': this.page 'page': this.page
}) })
.then(res => { .then(res => {

View File

@@ -5,14 +5,14 @@
<view class="title">{{talkBookDetail.title}}</view> <view class="title">{{talkBookDetail.title}}</view>
<view class="voices" v-if="talkBookDetail.voices != '' && audioShow"> <view class="voices" v-if="talkBookDetail.voices != '' && audioShow">
<audio style="text-align: left" :src="talkBookDetail.voices" poster="../../static/icon/fengziIcon.jpg" <audio style="text-align: left" :src="talkBookDetail.voices" poster="../../static/icon/fengziIcon.jpg"
:name="talkBookDetail.title" :author="bookInfo.authorName" :action="audioAction" controls></audio> :name="talkBookDetail.title" :author="bookInfo.author.authorName" :action="audioAction" controls></audio>
</view> </view>
<view class="content" v-if="talkBookDetail.content != ''" v-html="talkBookDetail.content"></view> <view class="content" v-if="talkBookDetail.content != ''" v-html="talkBookDetail.content"></view>
<view class="content" v-else></view> <view class="content" v-else></view>
<view class="time"> <view class="time">
<text>{{talkBookDetail.createTime}}</text> <text>{{talkBookDetail.createTime}}</text>
</view> </view>
<view class="tuijin" v-if="!isBuy"> <view class="tuijin" v-if="!isBuy && bookInfo.productId != null">
<p>觉得这本书还不错</p> <p>觉得这本书还不错</p>
<view class="flexbox" style="justify-content: space-between; border: 1px solid #55aa7f; padding: 10rpx; border-radius: 10rpx;"> <view class="flexbox" style="justify-content: space-between; border: 1px solid #55aa7f; padding: 10rpx; border-radius: 10rpx;">
<view class="flexbox"> <view class="flexbox">
@@ -22,7 +22,7 @@
</view> </view>
<view> <view>
<text style=" display: inline-block; margin-top: 40rpx;">{{bookInfo.name}}</text><br/> <text style=" display: inline-block; margin-top: 40rpx;">{{bookInfo.name}}</text><br/>
<text>作者{{bookInfo.authorName}}</text> <text>作者{{bookInfo.author.authorName}}</text>
</view> </view>
</view> </view>
<view class="btn" @click="gotoBuy()"> <view class="btn" @click="gotoBuy()">
@@ -57,7 +57,11 @@
playData: {}, playData: {},
teachId: null, // 讲书id teachId: null, // 讲书id
bookId: null, // 书籍id bookId: null, // 书籍id
bookInfo: {}, // 书籍信息 bookInfo: {
author:{
authorName:''
}
}, // 书籍信息
talkBookDetail: {}, talkBookDetail: {},
} }
}, },
@@ -78,13 +82,16 @@
// 购买 // 购买
gotoBuy(){ gotoBuy(){
uni.navigateTo({ uni.navigateTo({
url: '../bookShop/settlementBook?type=2&list=' + this.bookId url: '../bookShop/commodityDetail?id=' + this.bookInfo.productId
}); });
}, },
getBookInfo() { getBookInfo() {
// 获取书本基本信息 // 获取书本基本信息
this.$http this.$http
.post('book/book/appinfo/' + this.bookId + '/' + this.userInfo.id) .post('book/book/getBookInfo', {
'bookId': this.bookId,
'userId': this.userInfo.id
})
.then(res => { .then(res => {
if (res.code == 0) { if (res.code == 0) {
console.log(res, 'res') console.log(res, 'res')

View File

@@ -1,11 +1,11 @@
<template> <template>
<!--父组件--> <!--父组件-->
<view class="container"> <view class="container" style="padding-bottom: 10rpx;">
<!-- <view class="mini"></view> --> <!-- <view class="mini"></view> -->
<view> <view>
<z-nav-bar title="讲书目录"></z-nav-bar> <z-nav-bar title="讲书目录"></z-nav-bar>
<!-- 基本信息 --> <!-- 基本信息 -->
<view class="book_neir"> <view class="book_neir">
<view class="flexbox info"> <view class="flexbox info">
<view class="item"> <view class="item">
@@ -24,8 +24,8 @@
</view> </view>
<view <view
style="color: #9b9b9b;font-size: 28rpx;margin:20rpx 0 0 0;max-width: 400rpx;line-height: 38rpx;"> style="color: #9b9b9b;font-size: 28rpx;margin:20rpx 0 0 0;max-width: 400rpx;line-height: 38rpx;">
<p @click="onAuCHJump(bookInfo.authorId,1)" style="margin-bottom: 20rpx;"> <p @click="onAuCHJump(bookInfo.author.id,1)" style="margin-bottom: 20rpx;">
{{bookInfo.authorName}} [] > {{bookInfo.author.authorName}} [] >
</p> </p>
<p @click="onAuCHJump(item.id,2)" v-for="item in this.bookInfo.publisherNIList"> <p @click="onAuCHJump(item.id,2)" v-for="item in this.bookInfo.publisherNIList">
{{item.title}} > {{item.title}} >
@@ -58,6 +58,15 @@
</view> </view>
</view> </view>
</view> </view>
<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>
</view>
<view v-if="status==1">
<u-divider text="全部加载完成"></u-divider>
</view>
</view>
</view> </view>
<u-divider v-else text="暂无讲书目录"></u-divider> <u-divider v-else text="暂无讲书目录"></u-divider>
<music-play :playData="playData"></music-play> <music-play :playData="playData"></music-play>
@@ -84,81 +93,57 @@
data() { data() {
return { return {
isBuy: false, // true 已购买false 未购买 isBuy: false, // true 已购买false 未购买
playData: {}, playData: {},
stopPlay: false, // 关闭音频 bookInfo: {
jia: false, // 下一I首 author:{
forceRefresh: true, authorName:''
current: 0, }
bookInfo: {}, // 书籍详情 }, // 书籍详情
bookid: null, // 书籍id bookid: null, // 书籍id
playid: null, // 正在播放的章节id status:3,
playchapName: '', // 正在播放的章节名称 freeChapterCount: 0, // 免费章节数
playIndex: null, // 正在播放的序号值 libLIst: [], // 书籍目录
onlineH: { // 线上的历史听书 videoList: [], //音频文件
playIndex: null, // 存储的播放index page:1,
time: 0, // 存储的播放秒数 totalPage:0,
},
currentTime: {
time: 0,
flag: ''
},
freeChapterCount: 0, // 免费章节数
pageTab: [{
name: '正在播放'
},
{
name: '播放列表'
}
],
fengImg: '', // 播放封面
libLIst: [
// {
// name:"第二章",
// url: 'https://ehh-private-01.oss-cn-beijing.aliyuncs.com/2023/07/14/6c6d7f7b947c4dc18881e8682b4dc36a2ce742.mp3'
// },
], // 书籍目录
videoList: [], //音频文件
BsNav: [ //倍数-自定义
{
id: 1.0,
bs: '1.0'
}, {
id: 1.5,
bs: '1.5'
}, {
id: 2.0,
bs: '2.0'
}
],
orderPlayBtn: false, // 是否开启按顺序播放
LibVisible: false,
boardRemark: '',
StyleSheet: 'font-size:36rpx; text-align:center',
jian: false, // 上一曲切换
} }
}, },
onPullDownRefresh() {
console.log('下拉刷新了')
this.libLIst = []
this.page = 1
this.totalPage = 0
uni.stopPullDownRefresh();
},
onReachBottom() {
console.log('到底了')
if(this.page+1 <= this.totalPage){
this.page++
this.status = 0
this.getLibList()
}else{
this.status = 1
}
},
onHide() {
this.libLIst = []
this.page = 1
},
//第一次加载 //第一次加载
onLoad(e) { onLoad(e) {
console.log('------------------') console.log('------------------')
// 隐藏原生的tabbar // 隐藏原生的tabbar
console.log(e, 'e') console.log(e, 'e')
uni.hideTabBar(); uni.hideTabBar();
this.bookid = e.bookid this.bookid = e.bookid
//console.log(this.userInfo.playFlag,'this.userInfo.playFlag') },
onShow() {
// this.libLIst = []
// this.page = 1
// this.totalPage = 0
this.getLibList() this.getLibList()
this.getBookInfo() this.getBookInfo()
},
created() {
},
onShow() {
// console.log(this.userInfo.orderPlayBtn,'初始化')
if (this.userInfo.orderPlayBtn != undefined) {
this.orderPlayBtn = this.userInfo.orderPlayBtn
}
}, },
computed: { computed: {
...mapState(['userInfo']) ...mapState(['userInfo'])
@@ -181,8 +166,11 @@
}, },
getBookInfo() { getBookInfo() {
// 获取书本基本信息 // 获取书本基本信息
this.$http this.$http
.post('book/book/appinfo/' + this.bookid + '/' + this.userInfo.id) .post('book/book/getBookInfo', {
'bookId': this.bookid,
'userId': this.userInfo.id
})
.then(res => { .then(res => {
if (res.code == 0) { if (res.code == 0) {
console.log(res, 'res') console.log(res, 'res')
@@ -218,123 +206,30 @@
.post('book/teach/getBookTeachItems', { .post('book/teach/getBookTeachItems', {
'bookId': this.bookid, 'bookId': this.bookid,
'limit': 10, 'limit': 10,
'page': 1 'page': this.page
// 'userid': this.userInfo.id, // 'userid': this.userInfo.id,
// 'bookid': // 'bookid':
// 'id': this.playid // 'id': this.playid
}) })
.then(res => { .then(res => {
if (res.code == 0) { if (res.code == 0) {
console.log(res, 999) console.log(res, '章节目录')
if (res.page.records.length > 0) { if (res.page.records.length > 0) {
this.libLIst = res.page.records this.libLIst = this.libLIst.concat(res.page.records)
// this.fengImg = res.images this.status = 3
this.totalPage = res.page.pages
} else { } else {
this.libLIst = [] this.libLIst = []
// uni.showToast({ this.totalPage = 0
// title:'暂无可听章节哦~',
// icon:'none'
// })
// setTimeout(()=>{
// uni.navigateBack({ // 返回上一页
// delta: 1
// });
// },2000)
} }
} }
}).catch((e) => { }).catch((e) => {
console.log(e.msg) console.log(e.msg)
}) })
}, },
// 获取音频数据
listen(e, index) {
console.log(this.currentTime, 'this.currentTime')
// console.log(e,'playchapName')
this.playid = e.chapterId
this.playIndex = index
this.playchapName = e.chapterName
this.playIndex >= this.libLIst.length - 1 ? this.jia = true : this.jia = false
this.playIndex > 0 ? this.jian = true : this.jian = false
// console.log(this.jian,45454545)
this.forceRefresh = false
this.$http
.post('book/bookchaptercontent/appBooksChapterContent', {
'userId': this.userInfo.id,
'bookid': this.bookid,
'id': this.playid
})
.then(res => {
//this.tmpChapter.text = res.bookCatalogue
if (res.code == 0) {
// console.log(res)
if (res.bookCatalogue.voices[0] != null && res.bookCatalogue.voices[0].length > 15) {
// console.log('走这')
this.videoList = []
this.boardRemark = res.bookCatalogue.chapter[0]
this.fengImg = res.image
this.videoList.push({
'recorPath': res.bookCatalogue.voices[0]
})
console.log(res.bookCatalogue.voices[0], 'path')
this.forceRefresh = true
} else {
this.forceRefresh = true
uni.showToast({
title: '暂无可播放音频,加载下一章',
icon: 'none',
duration: 2000
})
setTimeout(() => {
if (this.playIndex + 1 >= this.libLIst.length) {
// this.stopPlay = true
uni.showToast({
title: '本书已全部播放完毕',
icon: 'none',
duration: 2000
})
} else {
this.listen(this.libLIst[this.playIndex], this.playIndex)
}
}, 2000)
}
}
}).catch((e) => {})
},
// 下一首
xiayishou() {
console.log('加载下一首')
if (this.playIndex + 1 <= this.libLIst.length - 1) {
this.playIndex += 1
this.saveRate(0)
this.currentTime.time = 0
this.currentTime.flag = ''
this.listen(this.libLIst[this.playIndex], this.playIndex)
} else {
this.jia = false
uni.showToast({
title: "音频已经播放完毕!",
icon: "none"
})
}
},
TabChange(e) {
// tab 切换
this.current = e.index
// console.log(e)
}
}, },
// watch:{
// list: {
// handler (newName, oldName) {
// console.log(newName)
// },
// immediate: true
// }
// }
} }
</script> </script>

View File

@@ -1,8 +1,8 @@
import store from '@/store/index.js' import store from '@/store/index.js'
import $http from '@/config/requestConfig.js'; import $http from '@/config/requestConfig.js';
const bgm = uni.getBackgroundAudioManager(); const bgm = uni.getBackgroundAudioManager();
// const bgm = {};
// const bgm = uni.createInnerAudioContext(); // const bgm = uni.createInnerAudioContext();
bgm.musicList = [] // 播放目录 bgm.musicList = [] // 播放目录
bgm.src = '' bgm.src = ''
bgm.htimes = 0 // 历史播放秒数 bgm.htimes = 0 // 历史播放秒数
@@ -47,7 +47,7 @@ var music = {
if(bgm.src == ''){ if(bgm.src == ''){
console.log(bgm.playIndex,'播放的索引',store.state.userInfo.playIndex,'播放的时长',store.state.userInfo.playTimes) console.log(bgm.playIndex,'播放的索引',store.state.userInfo.playIndex,'播放的时长',store.state.userInfo.playTimes)
store.commit('setUserInfo',{'playTitle': bgm.musicList[bgm.playIndex].chapterName}) store.commit('setUserInfo',{'playTitle': bgm.musicList[bgm.playIndex].chapterName})
store.commit('setUserInfo',{'fengImg': bgm.musicList[bgm.playIndex].images}) store.commit('setUserInfo',{'fengImg': bgm.musicList[bgm.playIndex].bookImage})
store.commit('setUserInfo',{'playingInfo': bgm.musicList[bgm.playIndex]}) store.commit('setUserInfo',{'playingInfo': bgm.musicList[bgm.playIndex]})
console.log(store.state.userInfo,'chapterName',bgm.playIndex) console.log(store.state.userInfo,'chapterName',bgm.playIndex)
store.state.userInfo.playTimes ? bgm.htimes = store.state.userInfo.playTimes : '' store.state.userInfo.playTimes ? bgm.htimes = store.state.userInfo.playTimes : ''
@@ -67,17 +67,20 @@ var music = {
store.commit('setUserInfo',{'playFlag': false}) store.commit('setUserInfo',{'playFlag': false})
}) })
bgm.onPlay(() => { bgm.onPlay(() => {
store.commit('setUserInfo',{'playFlag': true}) store.commit('setUserInfo',{'playFlag': true})
bgm.playing = true bgm.playing = true
console.log('开始播放音乐#######'); console.log('开始播放音乐#######');
store.commit('setUserInfo',{'playingInfo': bgm.musicList[bgm.playIndex]}) store.commit('setUserInfo',{'playingInfo': bgm.musicList[bgm.playIndex]})
console.log(store.state.userInfo.playingInfo,'chapterName2222') //console.log(store.state.userInfo.playingInfo,'chapterName2222')
uni.hideLoading() uni.hideLoading()
// 第一次存储
//this.saveIndex()
//this.saveRate(bgm.musicList[bgm.playIndex])
// end
bgm.interval = setInterval(()=>{ bgm.interval = setInterval(()=>{
console.log('存一次') console.log('存一次')
// this.saveIndex() this.saveIndex()
store.commit('setUserInfo',{'playTimes': bgm.currentTime}) // 本地存储 store.commit('setUserInfo',{'playTimes': bgm.currentTime}) // 本地存储
this.saveRate(bgm.musicList[bgm.playIndex]) // 线上存储 this.saveRate(bgm.musicList[bgm.playIndex]) // 线上存储
},180000) },180000)
@@ -113,10 +116,10 @@ var music = {
// 可以播放时 // 可以播放时
console.log('可以播放时') console.log('可以播放时')
uni.hideLoading() uni.hideLoading()
this.saveIndex() this.saveIndex()
this.saveRate(bgm.musicList[bgm.playIndex]) this.saveRate(bgm.musicList[bgm.playIndex])
// console.log('历史播放进度,秒数', bgm.htimes) // console.log('历史播放进度,秒数', bgm.htimes)
bgm.seek(bgm.htimes) bgm.seek(bgm.htimes)
// console.log(bgm,'bgm') // console.log(bgm,'bgm')
}) })
bgm.onEnded(() => { bgm.onEnded(() => {
@@ -128,13 +131,19 @@ var music = {
}) })
}, },
// 添加播放列表 // 添加播放列表
setList(list,op,playindex,time){ setList(list,op,playindex,time){
// console.log(time,'time',playindex,'playindex') if(bgm.interval){
console.log('存在定时器,清空')
clearInterval(bgm.interval)
bgm.interval = null
}
console.log(time,'time',playindex,'playindex')
bgm.musicList = list bgm.musicList = list
//console.log(bgm.musicList,'bgm.musicList')
bgm.oldIndex = bgm.playIndex // 暂存上一个播放得index bgm.oldIndex = bgm.playIndex // 暂存上一个播放得index
// console.log('地址异常报错前index:',bgm.oldIndex) // console.log('地址异常报错前index:',bgm.oldIndex)
// playindex ? bgm.playIndex = playindex : bgm.playIndex = 0 // playindex ? bgm.playIndex = playindex : bgm.playIndex = 0
store.commit('setUserInfo',{'playingInfo': {}}) store.commit('setUserInfo',{'playingInfo': {}})
if(playindex){ if(playindex){
bgm.playIndex = playindex bgm.playIndex = playindex
console.log(playindex,'传值了') console.log(playindex,'传值了')
@@ -205,42 +214,69 @@ var music = {
} }
} }
}) })
}, },
// 获取章节url // 获取章节url
getChartUrl(){ getChartUrl(){
// bgm.stop() // bgm.stop()
let data = { let data = {
'userId': store.state.userInfo.id, 'userId': store.state.userInfo.id,
'bookid': bgm.musicList[bgm.playIndex].bookid, 'bookId': bgm.musicList[bgm.playIndex].bookId,
'chapterid': bgm.musicList[bgm.playIndex].chapterId 'chapterId': bgm.musicList[bgm.playIndex].id
} }
console.log(data,'data') console.log(data,'data')
$http.post('book/bookchaptercontent/appBooksChapterContent', data) $http.post('book/bookchaptercontent/getBooksCatalogue', data)
// $http.post('book/bookchaptercontent/getCatal', data) // $http.post('book/bookchaptercontent/getCatal', data)
.then(res => { .then(res => {
console.log(res,'res') console.log(res,'鉴权结果')
if(res.code == 0){ if(res.code == 0){
if(res.jq==false ){
store.commit('setUserInfo',{'playFlag': false})
if(bgm.interval){
console.log('存在定时器,清空')
clearInterval(bgm.interval)
bgm.interval = null
}
// 鉴权失败
if(res.product == null){
uni.showModal({
title: '提示',
confirmText:'好的',
content: '您还未拥有此书哦~',
success: function (res) {
if (res.confirm) {
console.log('用户点击确定');
}
}
});
}else{
uni.showModal({
title: '提示',
cancelText: '暂不购买',
confirmText:'立即购买',
content: '抱歉!该章节需要购买后才可以听哦~',
success: function (res1) {
if (res1.confirm) {
console.log('用户点击确定',res.product);
uni.navigateTo({
url: '../bookShop/commodityDetail?id=' + res.product
});
}
}
});
}
}
// bgm.stop() // bgm.stop()
// 有听权限时 // 有听权限时
if(res.bookCatalogue[0].url){ // 空值url:null if(res.chapter.voices != null && res.chapter.voices != ''){ // 空值url:null
// 先清除定时器 // 先清除定时器
clearInterval(bgm.interval) clearInterval(bgm.interval)
bgm.interval = null bgm.interval = null
bgm.src = res.bookCatalogue[0].url bgm.src = res.chapter.voices
// bgm.title = res.bookCatalogue[0].name store.commit('setUserInfo',{'playIndex': bgm.playIndex})
// bgm.coverImgUrl = res.image store.commit('setUserInfo',{'playingInfo':bgm.musicList[bgm.playIndex] })
// store.commit('setUserInfo',{'playIndex': bgm.playIndex}) }else{
// store.commit('setUserInfo',{'playTitle': bgm.title})
// store.commit('setUserInfo',{'playingInfo':bgm.musicList[bgm.playIndex] })
// store.commit('setUserInfo',{'fengImg': bgm.coverImgUrl})
// bgm.pause()
// this.setCoverImg(bgm.musicList[bgm.playIndex].images)
}else{
// bgm.src = ''
// bgm.title = ''
// bgm.coverImgUrl = '../../static/icon/fengziIcon.jpg'
// this.setCoverImg('../../static/icon/x1.jpg')
// bgm.stop()
bgm.playIndex = bgm.oldIndex bgm.playIndex = bgm.oldIndex
console.log('地址异常报错后index:',bgm.playIndex) console.log('地址异常报错后index:',bgm.playIndex)
store.commit('setUserInfo',{'playIndex': bgm.playIndex}) store.commit('setUserInfo',{'playIndex': bgm.playIndex})
@@ -253,42 +289,29 @@ var music = {
// store.commit('setUserInfo',{'playFlag': false}) // store.commit('setUserInfo',{'playFlag': false})
} }
} }
console.log(res.bookCatalogue,'单章节信息')
}).catch((e)=>{ }).catch((e)=>{
console.log(e,'e') console.log(e,'e')
// bgm.pause() console.log('异常')
// bgm.pause()
bgm.playIndex = bgm.oldIndex bgm.playIndex = bgm.oldIndex
// bgm.stop() store.commit('setUserInfo',{'playFlag': false})
// store.commit('setUserInfo',{'playFlag': false}) if(bgm.interval){
if(e.errMsg.indexOf('未购买书籍') != -1){ console.log('存在定时器,清空')
uni.showModal({ clearInterval(bgm.interval)
title: '提示', bgm.interval = null
cancelText: '暂不购买',
confirmText:'立即购买',
content: '抱歉!当前书籍未购买!',
success: function (res) {
if (res.confirm) {
console.log('用户点击确定');
uni.navigateTo({
url: '../bookShop/settlementBook?type=2&list=' + data.bookid
});
}
}
});
} }
}) })
}, },
// 存储播放信息 // 本地存储播放信息
saveIndex(){ saveIndex(){
console.log(bgm.playIndex,'存储得index') console.log(bgm.playIndex,'存储得index')
store.commit('setUserInfo',{'playIndex': bgm.playIndex}) store.commit('setUserInfo',{'playIndex': bgm.playIndex})
store.commit('setUserInfo',{'duration':bgm.duration}) store.commit('setUserInfo',{'duration':bgm.duration})
store.commit('setUserInfo',{'playTitle': bgm.musicList[bgm.playIndex].chapterName}) store.commit('setUserInfo',{'playTitle': bgm.musicList[bgm.playIndex].chapter})
store.commit('setUserInfo',{'fengImg': bgm.musicList[bgm.playIndex].images}) store.commit('setUserInfo',{'fengImg': bgm.musicList[bgm.playIndex].bookImage})
store.commit('setUserInfo',{'playFlag': true})
// store.commit('setUserInfo',{'playFlag': true})
store.commit('setUserInfo',{'playingInfo': bgm.musicList[bgm.playIndex]}) store.commit('setUserInfo',{'playingInfo': bgm.musicList[bgm.playIndex]})
uni.setStorage({ uni.setStorage({
key: 'playingInfo', key: 'playingInfo',
@@ -304,20 +327,23 @@ var music = {
}, },
// 存储播放进度(线上) // 存储播放进度(线上)
saveRate(val){ saveRate(val){
console.log(val,'要存储的播放信息',) console.log(val,'要存储的线上播放信息',)
$http.post('book/listening/save', { $http.post('book/listening/save', {
'userId': store.state.userInfo.id, 'userId': store.state.userInfo.id,
'bookId': val.bookid, 'bookId': val.bookId,
'chapterId': val.chapterId, 'chapterId': val.id,
'chapterName': val.chapterName, 'chapterName': val.chapter,
'precent': Math.ceil(bgm.currentTime), 'precent': Math.ceil(bgm.currentTime),
'loadAnimate':'none', // 请求加载动画 'loadAnimate':'none', // 请求加载动画
}) })
.then(res => { .then(res => {
console.log(res,'线上存储进度')
if(res.code == 0){ if(res.code == 0){
console.log(res,'存储完成') console.log(res,'存储完成')
} }
}).catch((e)=>{}) }).catch((e)=>{
console.log(e,'e')
})
}, },
// 设置播放index // 设置播放index
setPlayIndex(opName){ // 切换音频 setPlayIndex(opName){ // 切换音频
@@ -376,10 +402,10 @@ var music = {
} }
}); });
bgm.htimes = 0 bgm.htimes = 0
bgm.oldIndex = bgm.playIndex bgm.oldIndex = bgm.playIndex
bgm.playIndex = bgm.musicList.findIndex(function(info){ bgm.playIndex = bgm.musicList.findIndex(function(info){
// console.log(info,'info') // console.log(info,'info')
if(item.chapterId == info.chapterId && item.bookid == info.bookid ){ if(item.id == info.id && item.bookId == info.bookId ){
return info; return info;
} }
}) })
@@ -390,6 +416,11 @@ var music = {
// 关闭音频 // 关闭音频
setCloseBgm(){ setCloseBgm(){
if(bgm.interval){
console.log('存在定时器,清空')
clearInterval(bgm.interval)
bgm.interval = null
}
bgm.stop() bgm.stop()
} }