接口改动

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

View File

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

View File

@@ -593,7 +593,7 @@
.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;
}
.fengmianBox.defaultBg{background-image: url('@/static/icon/x1.jpg');}
.fengmianBox.defaultBg{background-image: url('@/static/icon/home_icon_0.png');}
page {
background-color: #F6F6F8;

View File

@@ -5,8 +5,9 @@
<view>
<view class="audo-video">
<!-- 播放封面 -->
<!-- 播放封面 -->
<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">
@@ -57,7 +58,7 @@
<view class="item" v-for="(item,index) in libLIst" :key="index" >
<view @click="listenOne(item)" :class="userInfo.playIndex == index ? 'playNow' : ''">
<view>{{item.chapterName}}</view>
<view>{{item.chapter}}</view>
</view>
</view>
</scroll-view>
@@ -122,12 +123,13 @@
audioMannager:null ,// 背景音乐
saveInterVal:null,
fengImg:'',
nofengImg:'../../static/icon/fengziIcon.jpg'
}
},
created() {
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}) : ''
},
@@ -261,7 +263,7 @@
.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;
}
.fengmianBox.defaultBg{background-image: url('@/static/icon/x1.jpg');}
.fengmianBox.defaultBg{background-image: url('@/static/icon/home_icon_0.png');}
page {
background-color: #F6F6F8;

View File

@@ -6,8 +6,8 @@
<!--音频播放按钮处-->
<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 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 @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> -->
<!-- <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;
margin-bottom: 20rpx; background-size: cover;
background-repeat: no-repeat;
background-image: url('@/static/icon/x1.jpg');
background-image: url('@/static/icon/home_icon_0.png');
}
page {

View File

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

View File

@@ -15,7 +15,7 @@
<view class="bookinfo">
<view class="case">
<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">
<span>中医免疫学</span>
<h3>#第三课专业变现你的专业 = 超级杠杆 第一笔只是财富#</h3>
@@ -51,7 +51,7 @@
<view class="case">
<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">
<span>中医免疫学</span>
<h3>#第三课专业变现你的专业 = 超级杠杆 第一笔只是财富#</h3>
@@ -93,7 +93,7 @@
<view class="bookinfo">
<view class="case">
<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">
<span>中医免疫学</span>
<h3>#第三课专业变现你的专业 = 超级杠杆 第一笔只是财富#</h3>
@@ -129,7 +129,7 @@
<view class="case">
<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">
<span>中医免疫学</span>
<h3>#第三课专业变现你的专业 = 超级杠杆 第一笔只是财富#</h3>

View File

@@ -29,7 +29,7 @@
<view class="bookinfo">
<view class="case" v-for="(item, index) in recordList" :key="index">
<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" >
<!-- <span>中医免疫学</span> -->
<h3><span class="day"> <em>{{item.dayId}}</em> </span><br/>#{{item.TaskHeading}}#</h3>

View File

@@ -10,8 +10,8 @@
{{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.authorId,1)" style="margin-bottom: 20rpx;">
{{bookMessage.authorName}} [] >
<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}} >
@@ -52,14 +52,17 @@
<view class="item" v-for="(item,index) in libLIst" :key="index" >
<view >
<view v-if="3 > index"
:class="[freeChapterCount < index ? 'graytitle' : '',
userInfo.playingInfo.bookid==item.bookid && userInfo.playingInfo.chapterId == item.chapterId ? 'playing' : '']" @click="listenOne(item, index)">
<span :class="[freeChapterCount-1 < index ? 'graytitle' : '']">{{item.chapterName}}</span>&nbsp;&nbsp;
<uni-tag v-if="freeChapterCount-1 >= index" class="tag" size="small" :inverted="true" text="试听" type="success" />
:class="[
userInfo.playingInfo.bookId==item.bookId && userInfo.playingInfo.id == item.id ? 'playing' : '']" @click="listenOne(item, index)">
<span :class="['graytitle']">{{item.chapter}}</span>&nbsp;&nbsp;
<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>
<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>
@@ -124,7 +127,9 @@
tab_muJian: 0,
bookId: '',
bookMessage: {
flag: false
flag: false,
author:{authorName:''}
},
bookCatalogue: [],
bgiStyle: {
@@ -171,7 +176,11 @@
getData() {
// 获取电子书详情
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 => {
console.log('书详细',res.book)
this.bookMessage = res.book
@@ -180,7 +189,6 @@
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) {
@@ -230,7 +238,7 @@
// 去购买
goBuy(){
uni.navigateTo({
url: '../bookShop/settlementBook?type=2&list=' + this.bookId
url: '../bookShop/commodityDetail?id=' + this.bookMessage.productId
});
},
// 获取书评
@@ -280,8 +288,8 @@
getLibList(){
this.$http
.post('book/book/getBookCatalogue', {
'userid': this.userInfo.id,
'bookid': this.bookId,
'userId': this.userInfo.id,
'bookId': this.bookId,
// 'id': this.playid
})
.then(res => {
@@ -330,6 +338,7 @@
<style lang="scss" scoped>
@import '@/style/mixin.scss';
.playing{color: #1daa5c;}
.graytitle{color: #666;}
.flexbox{display: flex;}
.tags{
.tag{

View File

@@ -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;
}

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@@ -1,11 +1,11 @@
<template>
<!--父组件-->
<view class="container">
<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">
@@ -24,8 +24,8 @@
</view>
<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;">
{{bookInfo.authorName}} [] >
<p @click="onAuCHJump(bookInfo.author.id,1)" style="margin-bottom: 20rpx;">
{{bookInfo.author.authorName}} [] >
</p>
<p @click="onAuCHJump(item.id,2)" v-for="item in this.bookInfo.publisherNIList">
{{item.title}} >
@@ -58,6 +58,15 @@
</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>
<u-divider v-else text="暂无讲书目录"></u-divider>
<music-play :playData="playData"></music-play>
@@ -84,81 +93,57 @@
data() {
return {
isBuy: false, // true 已购买false 未购买
playData: {},
stopPlay: false, // 关闭音频
jia: false, // 下一I首
forceRefresh: true,
current: 0,
bookInfo: {}, // 书籍详情
playData: {},
bookInfo: {
author:{
authorName:''
}
}, // 书籍详情
bookid: null, // 书籍id
playid: null, // 正在播放的章节id
playchapName: '', // 正在播放的章节名称
playIndex: null, // 正在播放的序号值
onlineH: { // 线上的历史听书
playIndex: null, // 存储的播放index
time: 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, // 上一曲切换
status:3,
freeChapterCount: 0, // 免费章节数
libLIst: [], // 书籍目录
videoList: [], //音频文件
page:1,
totalPage:0,
}
},
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) {
console.log('------------------')
// 隐藏原生的tabbar
console.log(e, 'e')
uni.hideTabBar();
this.bookid = e.bookid
//console.log(this.userInfo.playFlag,'this.userInfo.playFlag')
this.bookid = e.bookid
},
onShow() {
// this.libLIst = []
// this.page = 1
// this.totalPage = 0
this.getLibList()
this.getBookInfo()
},
created() {
},
onShow() {
// console.log(this.userInfo.orderPlayBtn,'初始化')
if (this.userInfo.orderPlayBtn != undefined) {
this.orderPlayBtn = this.userInfo.orderPlayBtn
}
},
computed: {
...mapState(['userInfo'])
@@ -181,8 +166,11 @@
},
getBookInfo() {
// 获取书本基本信息
this.$http
.post('book/book/appinfo/' + this.bookid + '/' + this.userInfo.id)
this.$http
.post('book/book/getBookInfo', {
'bookId': this.bookid,
'userId': this.userInfo.id
})
.then(res => {
if (res.code == 0) {
console.log(res, 'res')
@@ -218,123 +206,30 @@
.post('book/teach/getBookTeachItems', {
'bookId': this.bookid,
'limit': 10,
'page': 1
'page': this.page
// 'userid': this.userInfo.id,
// 'bookid':
// 'id': this.playid
})
.then(res => {
if (res.code == 0) {
console.log(res, 999)
console.log(res, '章节目录')
if (res.page.records.length > 0) {
this.libLIst = res.page.records
// this.fengImg = res.images
this.libLIst = this.libLIst.concat(res.page.records)
this.status = 3
this.totalPage = res.page.pages
} else {
this.libLIst = []
// uni.showToast({
// title:'暂无可听章节哦~',
// icon:'none'
// })
// setTimeout(()=>{
// uni.navigateBack({ // 返回上一页
// delta: 1
// });
// },2000)
this.totalPage = 0
}
}
}).catch((e) => {
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>

View File

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