9 Commits

Author SHA1 Message Date
@fawn-nine
f0f8b758c8 Merge branch 'xie1023' 2023-11-08 13:30:10 +08:00
@fawn-nine
d41853aed7 打卡签到未购买不可参与打卡 2023-11-08 13:27:46 +08:00
@fawn-nine
14cc4a87f1 . 2023-11-08 11:50:25 +08:00
@fawn-nine
4cdf12da24 Merge branch 'xie_xuewei' 2023-11-07 17:14:55 +08:00
@fawn-nine
6b324701b3 Merge branch 'xie1023' 2023-11-02 13:14:17 +08:00
yanwenlong
52e17d42b2 被听书组件打断时,设置播放icon状态 2023-11-01 20:47:25 +08:00
@fawn-nine
8043abbd12 Merge branch 'xie1023' 2023-11-01 17:42:38 +08:00
@fawn-nine
66770de40b . 2023-11-01 10:27:37 +08:00
yanwenlong
6fc6dfcd1c 听书-音频播放器 2023-11-01 08:45:03 +08:00
11 changed files with 140 additions and 18 deletions

View File

@@ -12,8 +12,8 @@
"src" : "图片路径"
}
],
"versionName" : "1.2.10",
"versionCode" : 1210,
"versionName" : "1.2.12",
"versionCode" : 1212,
"app-plus" : {
"compatible" : {
"ignoreVersion" : true
@@ -113,7 +113,8 @@
"entitlements" : {
"com.apple.developer.associated-domains" : [ "applinks:verification.nuttyreading.com" ]
}
}
},
"idfa" : false
},
"icons" : {
"android" : {

View File

@@ -62,7 +62,7 @@
return {
playData: {},
searchValue: '',
oneCateList: [], // 一级分类标题1
oneCateList: [], // 一级分类标题
twoCateList: [], // 二级分类标题
titleList:[], // 穴位标题
curOneCateIndex:0, // 当前选中的一级分类

View File

@@ -1,5 +1,5 @@
<template>
<view :class="['container', currentDay == linshiDay && taskInfo.id && myword.length == 0 ? 'pb100':'']">
<view :class="['container', currentDay == linshiDay && taskInfo.id && myword.length == 0 && bookInfo.isBuy ? 'pb100':'']">
<z-nav-bar title="读书打卡"></z-nav-bar>
<!-- 仿钉钉打卡日历组件 -->
<view class=""
@@ -254,7 +254,7 @@
</view>
</u-popup>
<view class="leaveBtn" v-if="!addTextShow && currentDay == linshiDay && taskInfo.id && myword.length == 0">
<view class="leaveBtn" v-if="!addTextShow && currentDay == linshiDay && taskInfo.id && myword.length == 0 && bookInfo.isBuy">
<button style="height: 70rpx; font-size: 28rpx; line-height: 70rpx;" type="primary" plain="true"
@click="addTextShow = true">说点什么</button>
</view>
@@ -450,7 +450,11 @@
// 获取书籍信息
getBookInfo() {
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 => {
if (res.code == 0) {
console.log(res, 'res')
@@ -674,17 +678,30 @@
uni.hideLoading()
})
},
gotoBuy(){
let that = this
uni.showModal({
title: '提示',
content: '购买本书后方可参与打卡',
confirmText:'立即购买',
cancelText:'知道了',
success: function (res) {
if (res.confirm) {
console.log(that.bookInfo,'that.bookInfo');
uni.navigateTo({
url: '../bookShop/commodityDetail?id=' + that.bookInfo.productId
});
}
}
});
},
// 补卡
buSign(day) {
console.log('正在补卡', this.taskInfo, day)
// return false
// if (!this.taskInfo.id) {
// uni.showToast({
// title: '当天未发布打卡任务,不可补卡哦',
// icon: 'none'
// })
// return
// }
if(!this.bookInfo.isBuy){
this.gotoBuy()
return
}
let param = {
'bookId': this.bookid,
'userId': this.userInfo.id,
@@ -713,6 +730,10 @@
},
// 快捷签到
kuickSign() {
if(!this.bookInfo.isBuy){
this.gotoBuy()
return
}
if (!this.taskInfo.id) {
uni.showToast({
@@ -800,7 +821,7 @@
});
},
// 说点什么
goToSign() {
goToSign() {
// images数据处理
if (this.formData.images.length > 0) {
var imgs = []

View File

@@ -4,9 +4,24 @@
<view class="mainContent">
<view class="title">{{talkBookDetail.title}}</view>
<view class="voices" v-if="talkBookDetail.voices != '' && audioShow">
<audio style="text-align: left; overflow: hidden;" :src="talkBookDetail.voices" @play="audioPlay"
<!-- <audio style="text-align: left; overflow: hidden;" :src="talkBookDetail.voices" @play="audioPlay"
poster="../../static/icon/home_icon_0.png" :name="talkBookDetail.title"
:author="bookInfo.author.authorName" :action="audioAction" controls></audio>
:author="bookInfo.author.authorName" :action="audioAction" controls @timeupdate="updateTime"></audio> -->
<!-- 下面自己写了个播放器 -->
<view class="audiobox">
<view class="audioinfo">
<image class="audioimg" :src="bookInfo.images" mode="aspectFit"></image>
<image class="audioimgstart" v-if="!this.paused" mode="aspectFit" src="../../static/audiostart.png" @click="start"></image>
<image class="audioimgstart" v-else mode="aspectFit" src="../../static/audiostop.png" @click="start"></image>
<view>
<view class="audiotitle">{{talkBookDetail.title}}</view>
<view class="audioauthor">{{bookInfo.author.authorName}}</view>
<view class="audioauthor">{{currentTime+'/'+duration}}</view>
<slider class="audioslider" block-size="12" v-model="currentTime" :max="duration" @change="changeTime"></slider>
<!-- <view @click="start">点击播放/暂停</view> -->
</view>
</view>
</view>
</view>
<view class="content" v-if="talkBookDetail.content != ''" v-html="talkBookDetail.content"></view>
<view class="content" v-else></view>
@@ -68,6 +83,10 @@
}, // 书籍信息
talkBookDetail: {},
windowWidth: 0,
audio: null,
duration: 10,
currentTime: 0,
paused: false
}
},
onLoad(e) {
@@ -75,16 +94,55 @@
console.log(e, 'onLoad')
this.bookId = e.bookId
this.teachId = e.teachId
// 初始化播放器实例
this.audio = uni.createInnerAudioContext();
},
onShow() {
this.getBookInfo()
this.getTalkBookDetail()
},
onHide() {
// console.log('onHide----',this.paused)
this.audio.pause() // 暂停播放
this.paused = false
},
onUnload() {
// console.log('onUnload----',this.paused)
this.audio.destroy() // 销毁播放器
},
computed: {
...mapState(['userInfo'])
},
methods: {
...mapMutations(['setUserInfo']),
start(){
this.initAudio() // 开始播放
},
initAudio(){
this.audio.onTimeUpdate(()=>{
this.duration = this.audio.duration.toFixed()
this.currentTime = this.audio.currentTime.toFixed()
})
this.audio.onPause(()=>{ // 用于被听书组件打断时设置播放icon状态
this.paused = false
// console.log('onPause----------',this.paused)
})
this.paused = this.audio.paused
// console.log('paused',this.paused)
if(this.paused){
this.audio.play()
}else{
this.audio.pause()
}
},
updateTime(e){
this.currentTime = e.detail.currentTime.toFixed()
this.duration = e.detail.duration.toFixed()
},
changeTime(e){
this.audio.seek(e.detail.value) // 设置播放位置
},
audioPlay(){
console.log('播放讲书',this.$music)
this.$music.setCloseBgm() // 关闭听书音频
@@ -140,6 +198,11 @@
console.log(res, 'res')
this.talkBookDetail = res.bookTeach
this.audio.src = this.talkBookDetail.voices // 设置播放资源路径
this.audio.onCanplay((e)=>{
this.duration = this.audio.duration.toFixed() // 初始化进度条和音频秒数
})
// this.isBuy = res.book.isBuy
// this.freeChapterCount = res.book.freeChapterCount
} else {
@@ -239,6 +302,43 @@
border-radius: 5px;
}
}
// 自定义播放器样式
.audiobox{
border: 2rpx solid #d6d5d5;
border-radius: 8px;
.audioinfo{
display: flex;
.audioimg{
padding: 10rpx;
width: 180rpx;
height: 220rpx;
border-radius: 5px;
}
.audioimgstart{
position: absolute;
padding: 20rpx;
width: 180rpx;
height: 220rpx;
border-radius: 5px;
}
.audiotitle{
padding: 10rpx;
font-size: 28rpx;
text-align: left;
}
.audioauthor{
padding: 4rpx;
font-size: 24rpx;
text-align: left;
color: #999;
}
.audioslider{
width: 400rpx;
}
}
}
// .opbtn{font-size: 14rpx;}
</style>

BIN
static/audiostart.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.0 KiB

BIN
static/audiostop.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.5 KiB

BIN
static/bofang (1).png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.5 KiB

BIN
static/zanting (1).png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.2 KiB

BIN
static/播放 (1).png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.5 KiB

BIN
static/暂停 (1).png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.2 KiB

Binary file not shown.