2023.09.01
This commit is contained in:
4
App.vue
4
App.vue
@@ -23,7 +23,7 @@ export default {
|
|||||||
// 取出播放列表
|
// 取出播放列表
|
||||||
uni.getStorage({
|
uni.getStorage({
|
||||||
key: 'playData',
|
key: 'playData',
|
||||||
success: function (res) {
|
success: function (res) { // 本地有播放数据就用本地的
|
||||||
console.log(res.data,'取出的本地数据');
|
console.log(res.data,'取出的本地数据');
|
||||||
if(res.data.myList.length<=0){
|
if(res.data.myList.length<=0){
|
||||||
store.commit('setUserInfo',{'playVisible': false})
|
store.commit('setUserInfo',{'playVisible': false})
|
||||||
@@ -36,7 +36,7 @@ export default {
|
|||||||
store.commit('setUserInfo',{'currentTime': 0});
|
store.commit('setUserInfo',{'currentTime': 0});
|
||||||
|
|
||||||
},
|
},
|
||||||
fail:function(e){
|
fail:function(e){ // 如果没有,就查询一下线上的播放记录
|
||||||
console.log('本地无数据');
|
console.log('本地无数据');
|
||||||
music.setList([])
|
music.setList([])
|
||||||
store.commit('setUserInfo',{'playingInfo': {'bookid':0,'chapterId':0}});
|
store.commit('setUserInfo',{'playingInfo': {'bookid':0,'chapterId':0}});
|
||||||
|
|||||||
@@ -121,13 +121,19 @@
|
|||||||
loading: true, //锁 加载
|
loading: true, //锁 加载
|
||||||
audioMannager:null ,// 背景音乐
|
audioMannager:null ,// 背景音乐
|
||||||
saveInterVal:null,
|
saveInterVal:null,
|
||||||
fengImg:''
|
fengImg:'',
|
||||||
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
created() {
|
created() {
|
||||||
this.libLIst = this.$bgm.musicList
|
this.libLIst = this.$bgm.musicList
|
||||||
this.fengImg = this.userInfo.fengImg
|
this.fengImg = this.userInfo.fengImg
|
||||||
|
this.userInfo.playTimes ? this.setUserInfo({'currentTime': this.userInfo.playTimes}) : ''
|
||||||
|
|
||||||
|
console.log(this.userInfo.currentTime,'组件读到的历史记录')
|
||||||
|
|
||||||
},
|
},
|
||||||
|
|
||||||
computed: {
|
computed: {
|
||||||
...mapState(['userInfo']),
|
...mapState(['userInfo']),
|
||||||
timer() {
|
timer() {
|
||||||
@@ -195,33 +201,6 @@
|
|||||||
},
|
},
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// 存储听书进度
|
|
||||||
saveListenRate(){
|
|
||||||
console.log('存储听书进度')
|
|
||||||
this.$emit('saveRate',this.currentTime)
|
|
||||||
},
|
|
||||||
// 顺序播放
|
|
||||||
orderPlay(val){
|
|
||||||
// console.log(val)
|
|
||||||
if(val){
|
|
||||||
uni.showToast({
|
|
||||||
title:'开启顺序播放',
|
|
||||||
icon:'none'
|
|
||||||
})
|
|
||||||
this.orderPlayBtn = true
|
|
||||||
}else{
|
|
||||||
uni.showToast({
|
|
||||||
title:'关闭顺序播放',
|
|
||||||
icon:'none'
|
|
||||||
})
|
|
||||||
this.orderPlayBtn = false
|
|
||||||
}
|
|
||||||
},
|
|
||||||
// 显示播放列表
|
// 显示播放列表
|
||||||
showLib(){
|
showLib(){
|
||||||
this.LibVisible = true
|
this.LibVisible = true
|
||||||
@@ -237,17 +216,6 @@
|
|||||||
this.$bgm.play()
|
this.$bgm.play()
|
||||||
}
|
}
|
||||||
console.log('拖动')
|
console.log('拖动')
|
||||||
//此处滑动进度条--开始播放
|
|
||||||
// if (this.slideYes && !this.succes) {
|
|
||||||
// //#ifdef H5
|
|
||||||
// this.videoContext.play()
|
|
||||||
// //#endif
|
|
||||||
// //#ifndef H5
|
|
||||||
// this.videoContext.play()
|
|
||||||
// //#endif
|
|
||||||
// this.succes = true
|
|
||||||
// }
|
|
||||||
|
|
||||||
this.$bgm.seek(data.detail.value) //获取秒数
|
this.$bgm.seek(data.detail.value) //获取秒数
|
||||||
|
|
||||||
},
|
},
|
||||||
|
|||||||
18
pages.json
18
pages.json
@@ -406,6 +406,24 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
,{
|
||||||
|
"path" : "pages/clock/index",
|
||||||
|
"style" :
|
||||||
|
{
|
||||||
|
"navigationBarTitleText": "读书打卡列表",
|
||||||
|
"enablePullDownRefresh": false
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
,{
|
||||||
|
"path" : "pages/clock/clockList",
|
||||||
|
"style" :
|
||||||
|
{
|
||||||
|
"navigationBarTitleText": "打卡记录1",
|
||||||
|
"enablePullDownRefresh": false
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
],
|
],
|
||||||
"globalStyle": {
|
"globalStyle": {
|
||||||
"navigationBarTextStyle": "black",
|
"navigationBarTextStyle": "black",
|
||||||
|
|||||||
@@ -137,7 +137,7 @@
|
|||||||
this.$http
|
this.$http
|
||||||
.post('book/shopcategory/getOneLevel')
|
.post('book/shopcategory/getOneLevel')
|
||||||
.then(res => {
|
.then(res => {
|
||||||
console.log(res,'一级分类')
|
//console.log(res,'一级分类')
|
||||||
this.oneLevel = res.list
|
this.oneLevel = res.list
|
||||||
// this.current = e.type
|
// this.current = e.type
|
||||||
this.getTowLevel(this.oneLevel[0])
|
this.getTowLevel(this.oneLevel[0])
|
||||||
@@ -151,7 +151,7 @@
|
|||||||
this.$http
|
this.$http
|
||||||
.post(`book/shopcategory/getTwoLevel?catId=${e.catId}`)
|
.post(`book/shopcategory/getTwoLevel?catId=${e.catId}`)
|
||||||
.then(res => {
|
.then(res => {
|
||||||
console.log(res,'二级分类')
|
//console.log(res,'二级分类')
|
||||||
this.towLevel = res.list
|
this.towLevel = res.list
|
||||||
if (this.towLevel == '') {
|
if (this.towLevel == '') {
|
||||||
this.commodityList = []
|
this.commodityList = []
|
||||||
@@ -182,7 +182,7 @@
|
|||||||
'catId': e.catId
|
'catId': e.catId
|
||||||
})
|
})
|
||||||
.then(res => {
|
.then(res => {
|
||||||
console.log(res,'二级分类')
|
// console.log(res,'二级分类')
|
||||||
this.commodityList = res.list
|
this.commodityList = res.list
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -27,12 +27,12 @@
|
|||||||
</view>
|
</view>
|
||||||
<!-- 详情 + 评价1 -->
|
<!-- 详情 + 评价1 -->
|
||||||
<view v-if="contentShow == 0">
|
<view v-if="contentShow == 0">
|
||||||
<!-- <view class="tingshuList">
|
<view class="tingshuList" v-if="listenList.length > 0">
|
||||||
<h4>赠送内容:</h4>
|
<h4>赠送听书权益</h4>
|
||||||
<view class="item flexbox">
|
<view class="item flexbox" v-for="item in listenList" :key="item.id" @click="goToListen(item.id)">
|
||||||
<text>中医免疫学</text><u-icon name="volume" color="#71d5a1" size="24">立即试听</u-icon>
|
<text>{{item.name}}</text><u-icon name="volume" color="#71d5a1" size="24">立即试听</u-icon>
|
||||||
</view>
|
</view>
|
||||||
</view> -->
|
</view>
|
||||||
<view class="bookInfo" >
|
<view class="bookInfo" >
|
||||||
<u-row customStyle="margin-bottom: 10px">
|
<u-row customStyle="margin-bottom: 10px">
|
||||||
<u-col ><span>书名:{{productInfo.productName}}</span></u-col>
|
<u-col ><span>书名:{{productInfo.productName}}</span></u-col>
|
||||||
@@ -156,6 +156,7 @@
|
|||||||
cartList: [], // 购物车列表
|
cartList: [], // 购物车列表
|
||||||
commentsList:[], // 评论列表
|
commentsList:[], // 评论列表
|
||||||
productId:null, // 商品评论
|
productId:null, // 商品评论
|
||||||
|
listenList:[] // 关联得听书
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
onLoad(e) {
|
onLoad(e) {
|
||||||
@@ -171,6 +172,12 @@
|
|||||||
musicPlay
|
musicPlay
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
goToListen(id){
|
||||||
|
// 跳转到听书
|
||||||
|
uni.navigateTo({
|
||||||
|
url: "../listen/listen?bookid="+ id
|
||||||
|
});
|
||||||
|
},
|
||||||
// 放大图片
|
// 放大图片
|
||||||
previewImage(url){
|
previewImage(url){
|
||||||
console.log(url)
|
console.log(url)
|
||||||
@@ -247,9 +254,11 @@
|
|||||||
this.$http
|
this.$http
|
||||||
.post('/book/shopproduct/info/' + e.id)
|
.post('/book/shopproduct/info/' + e.id)
|
||||||
.then(res => {
|
.then(res => {
|
||||||
|
console.log('shopproduct',res)
|
||||||
this.productInfo = res.shopProduct
|
this.productInfo = res.shopProduct
|
||||||
|
this.listenList = res.shopProduct.bookidsimages
|
||||||
if (this.productInfo.productImageList == null || this.productInfo.productImageList == '') {
|
if (this.productInfo.productImageList == null || this.productInfo.productImageList == '') {
|
||||||
this.swiperlist.push('../../static/icon/home_ban_1.jpg')
|
this.swiperlist.push(this.productInfo.productImages)
|
||||||
} else {
|
} else {
|
||||||
let imgList = this.productInfo.productImageList.split(",")
|
let imgList = this.productInfo.productImageList.split(",")
|
||||||
// if(this.productInfo.productDetails != null){
|
// if(this.productInfo.productDetails != null){
|
||||||
@@ -454,7 +463,12 @@ formatRichText (html) { //控制小程序中图片大小
|
|||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
<style lang="scss" scoped>
|
<style lang="scss" scoped>
|
||||||
.tingshuList{margin-top: 20rpx;
|
.tingshuList{margin-top: 20rpx; background-color: #fff; padding: 20rpx;
|
||||||
|
border-radius: 20rpx; margin-bottom: 20rpx; padding-top: 40rpx;
|
||||||
|
background-image: linear-gradient(0deg, #f7fffc 0%, #def0ea 100%);
|
||||||
|
.item{margin-bottom: 20rpx;}
|
||||||
|
h4{color: #5fb386; font-size: 40rpx; margin-bottom: 20rpx;}
|
||||||
|
text{color: #444; font-size: 32rpx; padding-left: 20rpx;}
|
||||||
}
|
}
|
||||||
.pjimgs{ margin: 10px 0;flex-wrap: wrap; display: flex; justify-content: space-between;
|
.pjimgs{ margin: 10px 0;flex-wrap: wrap; display: flex; justify-content: space-between;
|
||||||
.item{width: 23%; margin-right: 10px;
|
.item{width: 23%; margin-right: 10px;
|
||||||
|
|||||||
@@ -1,126 +1,844 @@
|
|||||||
<template>
|
<template>
|
||||||
<view>
|
<view class="container">
|
||||||
<view class="top">
|
<z-nav-bar title="读书打卡"></z-nav-bar>
|
||||||
<z-nav-bar title="读书打卡"></z-nav-bar>
|
<!-- 仿钉钉打卡日历组件 -->
|
||||||
<uni-calendar
|
<view class="calendar_container">
|
||||||
:insert="true"
|
<!-- <zsy-calendar @change="change" /> -->
|
||||||
:lunar="true"
|
<!-- <clock-date></clock-date> -->
|
||||||
:start-date="'2019-3-2'"
|
<view class="calendar_info">
|
||||||
:end-date="'2019-5-20'"
|
<text class="title">读书打卡</text>
|
||||||
@change="change"
|
<view class="dakaBtn" @tap="kuickSign()" v-if="signList.indexOf(currentDay) == -1">
|
||||||
/>
|
<u-icon name="checkbox-mark" color="#55aa7f" size="24" style="display: inline;"></u-icon>
|
||||||
|
<text>签到</text>
|
||||||
|
</view>
|
||||||
|
<view v-else class="haveSignText">
|
||||||
|
<text>今天已签到</text>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<scroll-view class="scroll-view_H flexbox" scroll-x="true" @scroll="scroll" :scroll-left="scrollLeft">
|
||||||
|
<view class="" style="padding: 0 6rpx; display: inline-block; width: 20%; box-sizing: border-box; " v-for="(item,index) in 365">
|
||||||
|
<view
|
||||||
|
:class="['item', signList.indexOf(index+1) != -1 ? 'havSign' : '',
|
||||||
|
currentDay == index+1 && signList.indexOf(index+1) == -1 ? 'current' : '',
|
||||||
|
linshiDay == index+1 ? 'linshiDay':'']" @click="getInfo(index+1)">
|
||||||
|
<span class="day">第 <em>{{index+1}}</em> 天</span>
|
||||||
|
<u-icon v-if="signList.indexOf(index+1) != -1" name="checkbox-mark" color="#fff" size="28" style="margin: 0 auto; width: 28px; text-align: center;"></u-icon>
|
||||||
|
<span v-if="signList.indexOf(index+1) == -1 && currentDay > index+1" class="buka">未签</span>
|
||||||
|
<span v-if="currentDay < index+1" class="weidaka">未开始</span>
|
||||||
|
<span v-if="currentDay == index+1 && signList.indexOf(index+1) == -1" class="daka" @click="kuickSign()">签到</span>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</scroll-view>
|
||||||
|
</view>
|
||||||
|
<view class="container1">
|
||||||
|
<view class="task" v-if="taskInfo !== {}">
|
||||||
|
<view class="title" v-if="taskInfo.heading">
|
||||||
|
{{taskInfo.heading}}
|
||||||
|
</view>
|
||||||
|
<view class="video " v-if="taskInfo.video">
|
||||||
|
<!-- 视频形式的任务 -->
|
||||||
|
<view class="taskinfo">
|
||||||
|
<video id="myVideo" :poster="poster" v-show="!addTextShow"
|
||||||
|
:src="taskInfo.video"
|
||||||
|
@error="videoErrorCallback" controls></video>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<view class="image " v-if="taskInfo.images">
|
||||||
|
<!-- 图片形式的任务 -->
|
||||||
|
<image :src="taskInfo.images" style="width: 100%;" mode="aspectFit"></image>
|
||||||
|
</view>
|
||||||
|
<!-- <view class="voice ">
|
||||||
|
音频形式的任务
|
||||||
|
<audio style="text-align: center; width: 100%;" :src="currentAudio.src"
|
||||||
|
:poster="currentAudio.poster" :name="currentAudio.name" :author="currentAudio.author"
|
||||||
|
:action="audioAction" controls></audio>
|
||||||
|
</view> -->
|
||||||
|
<view class="txt" v-if="taskInfo.content" v-html="taskInfo.content"></view>
|
||||||
|
</view>
|
||||||
|
<view class="subContent">
|
||||||
|
<text class="clockTitle">-- 我的签到 --</text>
|
||||||
|
<!-- 未打卡 -->
|
||||||
|
|
||||||
|
<!-- 已打卡 -->
|
||||||
|
<view class="had" v-if="show">
|
||||||
|
<view class="item">
|
||||||
|
<h3>#第三课:专业变现:你的专业 = 超级杠杆! 第一笔只是财富#</h3>
|
||||||
|
<view class="content">
|
||||||
|
借我一个暮年,借我碎片,
|
||||||
|
借我瞻前与顾后,借我执拗如少年。
|
||||||
|
借我后天长成的先天,借我变如不曾改变。
|
||||||
|
借我素淡的世故和明白的愚,借我可预知的险。
|
||||||
|
借我悲怆的磊落,借我温软的鲁莽和玩笑的庄严。
|
||||||
|
借我最初与最终的不敢,借我不言而喻的不见。
|
||||||
|
借我一场秋啊,可你说这已是冬天。
|
||||||
|
</view>
|
||||||
|
<view class="images flexbox">
|
||||||
|
<image @click="previewImage()"
|
||||||
|
src="https://picx.zhimg.com/70/v2-92392172531ba8e252e3f9afaa4232d2_1440w.awebp?source=172ae18b&biz_tag=Post"
|
||||||
|
mode="aspectFill"></image>
|
||||||
|
<image
|
||||||
|
src="https://picx.zhimg.com/70/v2-92392172531ba8e252e3f9afaa4232d2_1440w.awebp?source=172ae18b&biz_tag=Post"
|
||||||
|
mode="aspectFill"></image>
|
||||||
|
</view>
|
||||||
|
<view class="opBtns flexbox">
|
||||||
|
<span class="flexbox"><u-icon name="clock" color="#b3b3b3"></u-icon>2023-08-23 14:01</span>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<!-- 他人的打卡记录 -->
|
||||||
|
<view class="" v-if="commentsList && commentsList.length > 0">
|
||||||
|
<view class="pingjiaBox" v-for="(item, index) in commentsList" :key="index">
|
||||||
|
<view class="flexbox">
|
||||||
|
<view class="touxiang">
|
||||||
|
<image :src="item.avatar" mode="aspectFit"></image>
|
||||||
|
<text class="username nowrap ">{{item.name}}</text>
|
||||||
|
</view>
|
||||||
|
<view class="contentBox">
|
||||||
|
<div class="pjimgs flexbox">
|
||||||
|
<view class="item" v-for="(item1,index) in item.images">
|
||||||
|
<image v-if="item1.length > 10" @click="previewImage(item1)" :src="item1" mode="aspectFill" style="width:100%; height: 50px;"></image>
|
||||||
|
</view>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
<view class="content" v-html="item.phtml"></view>
|
||||||
|
<text class="time">{{item.createdate}}</text>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<!-- 显示追平 -->
|
||||||
|
<view class="zhuiping item" v-if="item.zphtml != ''" style="padding-left: 50px;">
|
||||||
|
<h5 style="color: #dbdbdb; margin:10px;">追评内容:</h5>
|
||||||
|
<view class="flexbox">
|
||||||
|
<view class="contentBox">
|
||||||
|
<view class="content" v-html="item.zphtml"></view>
|
||||||
|
<text class="time">{{item.followUpdate}}</text>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<view class="quesheng" v-else>
|
||||||
|
<text>暂无评价~</text>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<u-popup mode="bottom" :show="addTextShow" :round="10" @close="addTextShow=false">
|
||||||
|
<view class="tanchu">
|
||||||
|
<view class="dp_title">今日签到随想</view>
|
||||||
|
<view style="max-height: 1000rpx;overflow-y: scroll;">
|
||||||
|
<!-- 提交 -->
|
||||||
|
<view class="padding-bottom-sm flex padding-lr-sm" style="border-bottom: 1px solid #EEEEEE;">
|
||||||
|
<view class="mb30">
|
||||||
|
<!-- <uni-file-picker :auto-upload="false" ref="files" @delete="deleteImg" limit="5" @success="upSuccess" @select="select" v-model="Pform.img" fileMediatype="image" :image-styles="imageStyles"/> -->
|
||||||
|
<u-upload :fileList="formData.images" @afterRead="afterRead" @delete="deletePic" multiple
|
||||||
|
:maxCount="4" width="80" height="80" :previewFullImage="true">
|
||||||
|
</u-upload>
|
||||||
|
</view>
|
||||||
|
<view class="flex-sub flexbox mb30">
|
||||||
|
<i @click="showEmj()" :class="emojiIcon"></i>
|
||||||
|
<!-- <input type="text" @focus="InputFocus" @blur="InputBlur" v-model="message" @input="textareaBInput" placeholder-style="font-size:24rpx;color:#aaaaaa;" placeholder="请输入您要发送的内容"></input> -->
|
||||||
|
<textarea style="border: 1px solid #EEEEEE;" class="textarea" v-model="formData.content"
|
||||||
|
@focus="InputFocus" @blur="InputBlur" @input="textareaBInput"
|
||||||
|
placeholder-style="font-size:24rpx;color:#aaaaaa;" placeholder="请输入内容"></textarea>
|
||||||
|
</view>
|
||||||
|
<view>
|
||||||
|
<u-button type="success" @click="goToSign">提交</u-button>
|
||||||
|
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
|
||||||
|
<view style="position: relative;">
|
||||||
|
<emotion @emotion="handleEmj" :height="220" v-if="isShowEmj" :windowWidth="windowWidth">
|
||||||
|
</emotion>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
|
||||||
|
</view>
|
||||||
|
</u-popup>
|
||||||
|
<view class="leaveBtn" v-if="!addTextShow">
|
||||||
|
<button type="primary" plain="true" @click="addTextShow = true">说点什么</button>
|
||||||
</view>
|
</view>
|
||||||
<music-play :playData="playData"></music-play>
|
<music-play :playData="playData"></music-play>
|
||||||
<z-navigation></z-navigation>
|
<!-- <z-navigation></z-navigation> -->
|
||||||
</view>
|
</view>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
|
import $http from '@/config/requestConfig.js';
|
||||||
|
import emotion from '@/bkhumor-emojiplus/components/bkhumor-emojiplus/bkhumor-emojiplus.vue';
|
||||||
|
import zsyCalendar from '@/components/zsy-calendar/zsy-calendar'
|
||||||
|
import clockDate from '@/components/clockDate.vue'
|
||||||
import musicPlay from '@/components/music.vue'
|
import musicPlay from '@/components/music.vue'
|
||||||
function getDate(date, AddDayCount = 0) {
|
import {
|
||||||
if (!date) {
|
mapState
|
||||||
date = new Date()
|
} from 'vuex';
|
||||||
}
|
|
||||||
if (typeof date !== 'object') {
|
|
||||||
date = date.replace(/-/g, '/')
|
|
||||||
}
|
|
||||||
const dd = new Date(date)
|
|
||||||
|
|
||||||
dd.setDate(dd.getDate() + AddDayCount) // 获取AddDayCount天后的日期
|
|
||||||
|
|
||||||
const y = dd.getFullYear()
|
|
||||||
const m = dd.getMonth() + 1 < 10 ? '0' + (dd.getMonth() + 1) : dd.getMonth() + 1 // 获取当前月份的日期,不足10补0
|
|
||||||
const d = dd.getDate() < 10 ? '0' + dd.getDate() : dd.getDate() // 获取当前几号,不足10补0
|
|
||||||
return {
|
|
||||||
fullDate: y + '-' + m + '-' + d,
|
|
||||||
year: y,
|
|
||||||
month: m,
|
|
||||||
date: d,
|
|
||||||
day: dd.getDay()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
export default {
|
export default {
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
playData:{},
|
commentsList:[], // 他人的打卡列表
|
||||||
showCalendar: false,
|
addTextShow: false, // 说点什么弹出层
|
||||||
info: {
|
show: false,
|
||||||
lunar: true,
|
scrollLeft: 0, // 距离左侧的距离
|
||||||
range: true,
|
currentDay:1, // 当前打卡位置
|
||||||
insert: false,
|
currentTid:null, // 今天的任务id
|
||||||
selected: []
|
emojiIcon: 'cuIcon-emoji',
|
||||||
}
|
windowWidth: 0,
|
||||||
|
taskInfo:{
|
||||||
|
heading:''
|
||||||
|
},
|
||||||
|
emoji: [],
|
||||||
|
signList:[], // 已打卡天
|
||||||
|
linshiDay:null,
|
||||||
|
page: 1,
|
||||||
|
bookid: null,
|
||||||
|
windowHeight: 500,
|
||||||
|
isShowEmj: false,
|
||||||
|
playData: {},
|
||||||
|
videoContext: null,
|
||||||
|
innerAudioContext: null, // 音频对象
|
||||||
|
poster: '',
|
||||||
|
formData: {
|
||||||
|
// 打卡表单
|
||||||
|
content: '',
|
||||||
|
images: []
|
||||||
|
},
|
||||||
|
currentAudio: {
|
||||||
|
poster: 'https://qiniu-web-assets.dcloud.net.cn/unidoc/zh/music-a.png',
|
||||||
|
name: '致爱丽丝',
|
||||||
|
author: '暂无',
|
||||||
|
src: 'https://bjetxgzv.cdn.bspapp.com/VKCEYUGU-hello-uniapp/2cc220e0-c27a-11ea-9dfb-6da8e309e0d8.mp3',
|
||||||
|
},
|
||||||
|
audioAction: {
|
||||||
|
method: 'pause'
|
||||||
|
},
|
||||||
|
// 校验规则
|
||||||
|
rules: {
|
||||||
|
content: {
|
||||||
|
rules: [{
|
||||||
|
required: true,
|
||||||
|
errorMessage: '内容不能为空'
|
||||||
|
}]
|
||||||
|
},
|
||||||
|
},
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
onLoad(e) {
|
||||||
|
this.bookid = e.bookid
|
||||||
|
this.windowWidth = uni.getSystemInfoSync().windowWidth;
|
||||||
|
this.getmySign()
|
||||||
|
},
|
||||||
onReady() {
|
onReady() {
|
||||||
this.$nextTick(() => {
|
this.videoContext = uni.createVideoContext('myVideo')
|
||||||
this.showCalendar = true
|
this.innerAudioContext = uni.createInnerAudioContext();
|
||||||
})
|
this.innerAudioContext.autoplay = false;
|
||||||
// TODO 模拟请求异步同步数据
|
},
|
||||||
setTimeout(() => {
|
computed: {
|
||||||
this.info.date = getDate(new Date(),-30).fullDate
|
...mapState(['userInfo'])
|
||||||
this.info.startDate = getDate(new Date(),-60).fullDate
|
},
|
||||||
this.info.endDate = getDate(new Date(),30).fullDate
|
|
||||||
this.info.selected = [{
|
|
||||||
date: getDate(new Date(),-3).fullDate,
|
|
||||||
info: '打卡'
|
|
||||||
},
|
|
||||||
{
|
|
||||||
date: getDate(new Date(),-2).fullDate,
|
|
||||||
info: '签到',
|
|
||||||
data: {
|
|
||||||
custom: '自定义信息',
|
|
||||||
name: '自定义消息头'
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
date: getDate(new Date(),-1).fullDate,
|
|
||||||
info: '已打卡'
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}, 2000)
|
|
||||||
},
|
|
||||||
methods: {
|
methods: {
|
||||||
open() {
|
// 放大图片
|
||||||
this.$refs.calendar.open()
|
previewImage(url){
|
||||||
},
|
console.log(url)
|
||||||
close(){
|
uni.previewImage({
|
||||||
console.log('弹窗关闭');
|
urls: [url]
|
||||||
},
|
});
|
||||||
change(e) {
|
},
|
||||||
console.log('change 返回:', e)
|
// 获取打卡参数
|
||||||
// 模拟动态打卡
|
getmySign(){
|
||||||
if (this.info.selected.length > 5) return
|
let data = {
|
||||||
this.info.selected.push({
|
'bookId': this.bookid,
|
||||||
date: e.fulldate,
|
'userId': this.userInfo.id
|
||||||
info: '打卡'
|
}
|
||||||
})
|
this.$http
|
||||||
},
|
.post('book/clockinPunch/clockindays', data)
|
||||||
confirm(e) {
|
.then(res => {
|
||||||
console.log('confirm 返回:', e)
|
if (res.code == 0) {
|
||||||
},
|
this.currentDay = res.daysBetween
|
||||||
monthSwitch(e) {
|
this.signList = res.dayslist
|
||||||
console.log('monthSwitchs 返回:', e)
|
console.log(res, '打卡参数')
|
||||||
}
|
let zheng = Math.floor(this.currentDay / 5)
|
||||||
|
let yu = this.currentDay % 5
|
||||||
|
if(this.currentDay <=5){this.scrollLeft = 0}
|
||||||
|
|
||||||
|
if(zheng >= 1 && yu > 0){
|
||||||
|
// 不是前五个,并且不能整除
|
||||||
|
this.scrollLeft = (this.windowWidth - 30) * zheng
|
||||||
|
}
|
||||||
|
if(zheng > 1 && yu == 0){
|
||||||
|
this.scrollLeft = (this.windowWidth - 30) * (zheng - 1)
|
||||||
|
}
|
||||||
|
// console.log(zheng, yu, this.scrollLeft, this.windowWidth, 'this.scrollLeft')
|
||||||
|
this.getTask(this.currentDay)
|
||||||
|
this.getAllSign(this.currentDay)
|
||||||
|
}
|
||||||
|
|
||||||
|
});
|
||||||
|
},
|
||||||
|
// 获取签到详情
|
||||||
|
getInfo(index){
|
||||||
|
if(this.currentDay < index){
|
||||||
|
uni.showToast({
|
||||||
|
title:'未来日期不可签到',
|
||||||
|
icon: 'none'
|
||||||
|
})
|
||||||
|
}else{
|
||||||
|
this.linshiDay = index
|
||||||
|
this.getTask(index)
|
||||||
|
this.getAllSign(index)
|
||||||
|
}
|
||||||
|
},
|
||||||
|
// 获取某天的签到列表信息
|
||||||
|
getAllSign(index){
|
||||||
|
let data = {
|
||||||
|
'bookid': this.bookid,
|
||||||
|
'limit': 5,
|
||||||
|
'page': this.page,
|
||||||
|
'taskid': index
|
||||||
|
}
|
||||||
|
console.log(data)
|
||||||
|
this.$http
|
||||||
|
.post('book/clockin/applist', data)
|
||||||
|
.then(res => {
|
||||||
|
if (res.code == 0) {
|
||||||
|
console.log(res, '所有人打卡信息')
|
||||||
|
this.commentsList = res.page.list
|
||||||
|
}
|
||||||
|
|
||||||
|
});
|
||||||
|
},
|
||||||
|
// 获取对应签到内容
|
||||||
|
getTask(index){
|
||||||
|
let data = {
|
||||||
|
'bookid': this.bookid,
|
||||||
|
'days': index
|
||||||
|
}
|
||||||
|
console.log(data)
|
||||||
|
this.$http
|
||||||
|
.post('book/task/applist', data)
|
||||||
|
.then(res => {
|
||||||
|
if (res.code == 0) {
|
||||||
|
console.log(res, '任务信息')
|
||||||
|
this.taskInfo = res.page.list[0]
|
||||||
|
this.taskInfo.video != ''? this.poster = this.taskInfo.video + "?x-oss-process=video/snapshot,t_0,f_jpg" : ''
|
||||||
|
}
|
||||||
|
|
||||||
|
});
|
||||||
|
},
|
||||||
|
// 快捷签到
|
||||||
|
kuickSign(){
|
||||||
|
let data = {
|
||||||
|
"bookId": this.bookid,
|
||||||
|
"userId": this.userInfo.id,
|
||||||
|
"tid": this.taskInfo.id,
|
||||||
|
"days":this.currentDay
|
||||||
|
}
|
||||||
|
// console.log(data,'data')
|
||||||
|
|
||||||
|
$http.request({
|
||||||
|
url : 'book/clockinPunch/save',
|
||||||
|
method: "POST", // POST、GET、PUT、DELETE,具体说明查看官方文档
|
||||||
|
data,
|
||||||
|
header: { //默认 无 说明:请求头
|
||||||
|
'Content-Type': 'application/json'
|
||||||
|
},
|
||||||
|
}).then(res => {
|
||||||
|
if (res.code == 0) {
|
||||||
|
//console.log(res, '快捷签到')
|
||||||
|
uni.showToast({
|
||||||
|
title:res.msg
|
||||||
|
})
|
||||||
|
this.addTextShow = false
|
||||||
|
this.formData.content = ''
|
||||||
|
this.formData.images = []
|
||||||
|
this.getmySign()
|
||||||
|
this.getAllSign(this.currentDay)
|
||||||
|
}
|
||||||
|
|
||||||
|
});
|
||||||
|
},
|
||||||
|
// 说点什么
|
||||||
|
goToSign() {
|
||||||
|
let data = {
|
||||||
|
'bookId': this.bookid,
|
||||||
|
"userId": this.userInfo.id,
|
||||||
|
"taskId": this.currentDay,
|
||||||
|
"content": this.formData.content,
|
||||||
|
"images": this.formData.images.join(),
|
||||||
|
|
||||||
|
}
|
||||||
|
// console.log(data,'data')
|
||||||
|
var surl = ''
|
||||||
|
if(this.signList.indexOf(this.currentDay) != -1){
|
||||||
|
surl='book/clockin/update'
|
||||||
|
}else{
|
||||||
|
surl = 'book/clockin/save'
|
||||||
|
}
|
||||||
|
$http.request({
|
||||||
|
url : surl,
|
||||||
|
method: "POST", // POST、GET、PUT、DELETE,具体说明查看官方文档
|
||||||
|
data,
|
||||||
|
header: { //默认 无 说明:请求头
|
||||||
|
'Content-Type': 'application/json'
|
||||||
|
},
|
||||||
|
}).then(res => {
|
||||||
|
if (res.code == 0) {
|
||||||
|
//console.log(res, '快捷签到')
|
||||||
|
uni.showToast({
|
||||||
|
title:res.msg
|
||||||
|
})
|
||||||
|
this.addTextShow = false
|
||||||
|
this.formData.content = ''
|
||||||
|
this.formData.images = []
|
||||||
|
this.getmySign()
|
||||||
|
this.getAllSign(this.currentDay)
|
||||||
|
}
|
||||||
|
|
||||||
|
});
|
||||||
|
},
|
||||||
|
scroll(e) {
|
||||||
|
|
||||||
|
},
|
||||||
|
// 获得输入的表情数组
|
||||||
|
handleEmj(i) {
|
||||||
|
console.log(i, 'i---------');
|
||||||
|
// this.inputValue = i
|
||||||
|
// console.log(this.inputValue);
|
||||||
|
if (i.emotioni == '[em_98]') {
|
||||||
|
//匹配最后一个表情符号并删除11。
|
||||||
|
this.formData.content = this.formData.content.replace(/(\[[^\]]+\]|[\s\S])$/, '');
|
||||||
|
if (this.emoji.length > 0) {
|
||||||
|
this.emoji = this.emoji.slice(0, -1)
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
this.emoji.push({
|
||||||
|
'tag': i.emotion,
|
||||||
|
'name': i.emotioni
|
||||||
|
})
|
||||||
|
// console.log(this.emoji,'this.emoji')
|
||||||
|
this.formData.content += i.emotioni;
|
||||||
|
/// this.Pform.html += i.emotion
|
||||||
|
}
|
||||||
|
},
|
||||||
|
// 放大图片
|
||||||
|
previewImage(url) {
|
||||||
|
console.log(url)
|
||||||
|
uni.previewImage({
|
||||||
|
urls: [url]
|
||||||
|
});
|
||||||
|
},
|
||||||
|
showEmj() {
|
||||||
|
let bool = !this.isShowEmj;
|
||||||
|
if (bool) {
|
||||||
|
this.emojiIcon = 'cuIcon-keyboard';
|
||||||
|
} else {
|
||||||
|
this.emojiIcon = 'cuIcon-emoji';
|
||||||
|
}
|
||||||
|
|
||||||
|
this.isShowEmj = bool;
|
||||||
|
this.$emit('show')
|
||||||
|
},
|
||||||
|
textareaBInput(e) {
|
||||||
|
this.formData.comment = e.detail.value
|
||||||
|
},
|
||||||
|
InputBlur(e) {
|
||||||
|
|
||||||
|
},
|
||||||
|
InputFocus(e) {
|
||||||
|
this.isShowEmj = false;
|
||||||
|
this.emojiIcon = 'cuIcon-emoji';
|
||||||
|
this.$emit('foc')
|
||||||
|
},
|
||||||
|
// 处理格式
|
||||||
|
getHtmlComment(comment) {
|
||||||
|
// 格式化html
|
||||||
|
// 这里处理 链接 换行符
|
||||||
|
let replacedStr = comment.replace(/\[([^(\]|\[)]*)\]/g, (item, index) => {
|
||||||
|
// console.log(item, index)
|
||||||
|
var indexss = emojiList1.findIndex(item1 => item1.alt === item)
|
||||||
|
// console.log(indexss, 'indexss')
|
||||||
|
return '<img src="https://www.nuttyreading.com/emojis/emojis/qq/' + emojiList1[indexss].url +
|
||||||
|
'" width="18rpx">';
|
||||||
|
});
|
||||||
|
// console.log(replacedStr,'replacedStr')
|
||||||
|
return replacedStr.replace(/(\r\n)|(\n)/g, '<br>');
|
||||||
|
},
|
||||||
|
// 提交打卡
|
||||||
|
submit() {
|
||||||
|
this.$refs['formData'].validate().then(res => {
|
||||||
|
console.log('success', res);
|
||||||
|
uni.showToast({
|
||||||
|
title: `校验通过`
|
||||||
|
})
|
||||||
|
}).catch(err => {
|
||||||
|
console.log('err', err);
|
||||||
|
})
|
||||||
|
},
|
||||||
|
deletePic() {
|
||||||
|
let that = this
|
||||||
|
that.formData.images.splice(0, 1)
|
||||||
|
//console.log(that.Pform.img)
|
||||||
|
},
|
||||||
|
afterRead(e) {
|
||||||
|
//console.log(e)
|
||||||
|
let that = this
|
||||||
|
for (var i = 0; i < e.file.length; i++) {
|
||||||
|
//console.log(i,e.file[i].url)
|
||||||
|
uni.uploadFile({
|
||||||
|
url: this.$baseUrl + 'oss/fileoss',
|
||||||
|
filePath: e.file[i].url,
|
||||||
|
//files:e.file,
|
||||||
|
name: 'file',
|
||||||
|
formData: {},
|
||||||
|
success: (res) => {
|
||||||
|
that.formData.images.push({
|
||||||
|
url: JSON.parse(res.data).url
|
||||||
|
})
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
},
|
||||||
|
videoErrorCallback: function(e) {
|
||||||
|
uni.showModal({
|
||||||
|
content: e.target.errMsg,
|
||||||
|
showCancel: false
|
||||||
|
})
|
||||||
|
},
|
||||||
|
|
||||||
|
// 日历选中日期改变事件回调
|
||||||
|
change(e) {
|
||||||
|
console.log(e)
|
||||||
|
}
|
||||||
},
|
},
|
||||||
components: {
|
components: {
|
||||||
musicPlay
|
musicPlay,
|
||||||
|
zsyCalendar,
|
||||||
|
emotion,
|
||||||
|
clockDate
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style lang="scss">
|
<style lang="scss" scoped>
|
||||||
.example-body {
|
.quesheng{text-align: center; margin-top: 100rpx; color: #8b8a91;}
|
||||||
/* #ifndef APP-NVUE */
|
.haveSignText{color: #999 ;}
|
||||||
|
.calendar_info {
|
||||||
display: flex;
|
display: flex;
|
||||||
/* #endif */
|
align-items: center;
|
||||||
flex-direction: row;
|
justify-content: space-between;
|
||||||
|
padding: 20rpx;
|
||||||
|
|
||||||
|
.dakaBtn {
|
||||||
|
color: #55aa7f;
|
||||||
|
display: flex;
|
||||||
|
padding: 3rpx 5rpx;
|
||||||
|
border: #55aa7f 1px solid;
|
||||||
|
border-radius: 10rpx;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
.calendar-button {
|
|
||||||
flex: 1;
|
.scroll-view_H {
|
||||||
font-weight: bold;
|
white-space: nowrap;
|
||||||
|
margin: 20px 0;
|
||||||
|
width: 100%;
|
||||||
|
|
||||||
|
.item {
|
||||||
|
border: 1px dashed #999;
|
||||||
|
width: calc(100% - 6rpx);
|
||||||
|
// margin: 0 6rpx;
|
||||||
|
text-align: center;
|
||||||
|
display: inline-block;
|
||||||
|
background-color: #F0FDFF;
|
||||||
|
border-radius: 20rpx;
|
||||||
|
padding: 6rpx 3rpx;
|
||||||
|
|
||||||
|
.day {display: block;
|
||||||
|
font-size: 26rpx;
|
||||||
|
color: #999;
|
||||||
|
|
||||||
|
em {
|
||||||
|
font-size: 36rpx;
|
||||||
|
font-style: normal;
|
||||||
|
font-weight: bold;
|
||||||
|
padding-right: 2px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.checkbox-mark {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.buka {
|
||||||
|
display: inline-block; padding: 0 6rpx;
|
||||||
|
color: #888;
|
||||||
|
// border: 1px solid #888;
|
||||||
|
margin: 10px 0;
|
||||||
|
border-radius: 15rpx;
|
||||||
|
margin-bottom: 0; ;
|
||||||
|
}
|
||||||
|
|
||||||
|
.weidaka {
|
||||||
|
color: #A3B4B5;
|
||||||
|
margin: 10px 0; font-size: 24;
|
||||||
|
border-radius: 20rpx;
|
||||||
|
margin-bottom: 0;
|
||||||
|
display: block;
|
||||||
|
}
|
||||||
|
.daka{
|
||||||
|
display: inline-block; padding: 0 6rpx;
|
||||||
|
border: 1px solid #55aaff;
|
||||||
|
color: #55aaff;
|
||||||
|
margin: 10px 0;
|
||||||
|
border-radius: 20rpx;
|
||||||
|
margin-bottom: 0;
|
||||||
|
display: block;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.item.havSign {
|
||||||
|
border: 1px solid #55aa7f;
|
||||||
|
|
||||||
|
text-align: center;
|
||||||
|
display: inline-block;
|
||||||
|
background-color: #55aa7f;
|
||||||
|
border-radius: 20rpx;
|
||||||
|
padding: 6px 6px;
|
||||||
|
|
||||||
|
.day {
|
||||||
|
font-size: 26rpx;
|
||||||
|
color: #fff;
|
||||||
|
em {
|
||||||
|
font-size: 32rpx;
|
||||||
|
font-style: normal;
|
||||||
|
font-weight: bold;
|
||||||
|
padding-right: 2px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.checkbox-mark {
|
||||||
|
display: block;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.item.current{
|
||||||
|
border: 1px solid #55aaff;
|
||||||
|
|
||||||
|
text-align: center;
|
||||||
|
display: inline-block;
|
||||||
|
background-color: #edf9ff;
|
||||||
|
border-radius: 20rpx;
|
||||||
|
padding: 6px 6px;
|
||||||
|
.day {
|
||||||
|
font-size: 26rpx;
|
||||||
|
color: #55aaff;
|
||||||
|
em {
|
||||||
|
font-size: 32rpx;
|
||||||
|
font-style: normal;
|
||||||
|
font-weight: bold;
|
||||||
|
padding-right: 2px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.item.linshiDay{
|
||||||
|
border: 1px solid #55aaff;
|
||||||
|
|
||||||
|
text-align: center;
|
||||||
|
display: inline-block;
|
||||||
|
background-color: #55aaff;
|
||||||
|
border-radius: 20rpx;
|
||||||
|
padding: 6px 6px;
|
||||||
|
.day {
|
||||||
|
font-size: 26rpx;
|
||||||
|
color: #fff;
|
||||||
|
em {
|
||||||
|
font-size: 32rpx;
|
||||||
|
font-style: normal;
|
||||||
|
font-weight: bold;
|
||||||
|
padding-right: 2px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.buka{color: #fff; }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.dp_title {
|
||||||
font-size: 32rpx;
|
font-size: 32rpx;
|
||||||
|
margin-bottom: 50rpx;
|
||||||
|
color: #555;
|
||||||
|
text-align: center;
|
||||||
|
font-weight: bold;
|
||||||
|
}
|
||||||
|
|
||||||
|
.mb30 {
|
||||||
|
margin-bottom: 30rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.tanchu {
|
||||||
|
padding: 40rpx 30rpx 40rpx 30rpx;
|
||||||
|
position: relative;
|
||||||
|
}
|
||||||
|
|
||||||
|
.cuIcon-emoji {
|
||||||
|
background: url(../../static/biaoqing.png) no-repeat;
|
||||||
|
background-size: contain;
|
||||||
|
display: block;
|
||||||
|
margin-right: 20rpx;
|
||||||
|
width: 30px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.cuIcon-keyboard {
|
||||||
|
background: url(../../static/biaoqing.png) no-repeat;
|
||||||
|
background-size: contain;
|
||||||
|
display: block;
|
||||||
|
width: 30px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.leaveBtn {
|
||||||
|
position: fixed;
|
||||||
|
width: calc(100% - 4px);
|
||||||
|
background: #fff;
|
||||||
|
bottom: 1rpx;
|
||||||
|
left: 1px;
|
||||||
|
z-index: 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
.task {
|
||||||
|
margin-top: 40rpx 20rpx;
|
||||||
|
|
||||||
|
.taskinfo {
|
||||||
|
video {
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.subContent {
|
||||||
|
margin-top: 20rpx;
|
||||||
|
background-color: #fff;
|
||||||
|
overflow: hidden;
|
||||||
|
|
||||||
|
.clockTitle {
|
||||||
|
color: #55aa7f;
|
||||||
|
font-size: 38rpx;
|
||||||
|
text-align: center;
|
||||||
|
display: block;
|
||||||
|
margin-top: 30rpx;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.container1 {
|
||||||
|
.margin-top {
|
||||||
|
margin-top: 30rpx;
|
||||||
|
overflow: hidden;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.container {
|
||||||
|
padding: 30rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.calendar_container {
|
||||||
|
//min-height: calc(60vh);
|
||||||
|
background-color: #fff;
|
||||||
|
//padding: 30rpx;
|
||||||
|
box-sizing: border-box;
|
||||||
|
padding-bottom: 20rpx;
|
||||||
|
border-radius: 20rpx;
|
||||||
|
margin-bottom: 20rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.task {
|
||||||
|
padding: 30rpx 20rpx;
|
||||||
|
background-color: #f5f5f5;
|
||||||
|
background-color: #fff;
|
||||||
|
padding-bottom: 50rpx;
|
||||||
|
|
||||||
|
.title {
|
||||||
|
margin-top: 30rpx;
|
||||||
|
padding: 30rpx;
|
||||||
|
color: #002968;
|
||||||
|
background-color: #fff;
|
||||||
|
font-size: 46rpx;
|
||||||
|
padding: 20rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.item {}
|
||||||
|
|
||||||
|
.video {
|
||||||
|
border-radius: 0 0 20rpx 20rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.txt {
|
||||||
|
margin-top: 30rpx;
|
||||||
|
color: #666;
|
||||||
|
line-height: 50rpx;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.haveNo {
|
||||||
|
background: #fff;
|
||||||
|
|
||||||
|
.box {
|
||||||
|
height: 20vh;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
|
||||||
|
button {
|
||||||
|
width: 50%;
|
||||||
|
margin: 0 auto;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.subform {
|
||||||
|
padding: 0 20rpx;
|
||||||
|
margin-top: 30rpx;
|
||||||
|
|
||||||
|
.btns {
|
||||||
|
width: 400rpx;
|
||||||
|
margin: 0 auto;
|
||||||
|
margin-bottom: 40rpx;
|
||||||
|
justify-content: space-between;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.had {
|
||||||
|
padding: 60rpx;
|
||||||
|
margin-top: 30rpx;
|
||||||
|
background-color: #fff;
|
||||||
|
|
||||||
|
h3 {
|
||||||
|
color: #8c9a92;
|
||||||
|
font-size: 34rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.content {
|
||||||
|
line-height: 60rpx;
|
||||||
|
margin-top: 30rpx;
|
||||||
|
font-size: 30rpx;
|
||||||
|
color: #0e0e15;
|
||||||
|
}
|
||||||
|
|
||||||
|
.images {
|
||||||
|
height: 150rpx;
|
||||||
|
overflow: hidden;
|
||||||
|
margin-top: 30rpx;
|
||||||
|
|
||||||
|
image {
|
||||||
|
width: 150rpx;
|
||||||
|
margin: 0 10rpx;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.opBtns {
|
||||||
|
margin-top: 30rpx;
|
||||||
|
|
||||||
|
span {
|
||||||
|
color: #b3b3b3;
|
||||||
|
padding-left: 20rpx;
|
||||||
|
font-size: 24rpx;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.flexbox {
|
||||||
|
display: flex;
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
|
|||||||
@@ -21,20 +21,23 @@
|
|||||||
<view class="info">
|
<view class="info">
|
||||||
<view class="videoBox demo-layout bg-purple" @click="goToListenFree(item)">
|
<view class="videoBox demo-layout bg-purple" @click="goToListenFree(item)">
|
||||||
<image :src="item.image" mode="scaleToFill" ></image>
|
<image :src="item.image" mode="scaleToFill" ></image>
|
||||||
|
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
<view class="btns">
|
<view class="btns">
|
||||||
<view class="item flexbox" @click="">
|
<view class="item flexbox" @click="">
|
||||||
<u-icon name="bookmark" color="#55aaff" size="24"></u-icon>
|
<!-- <u-icon name="bookmark" color="#55aaff" size="24"></u-icon> -->
|
||||||
<text>读 书</text>
|
<image src="../../static/icon/tu1.png" mode="aspectFit"></image>
|
||||||
|
<text >读 书</text>
|
||||||
</view>
|
</view>
|
||||||
<view class="item flexbox" @click="goToListenFree(item)">
|
<view class="item flexbox" @click="goToListenFree(item)">
|
||||||
<u-icon name="volume" color="#71d5a1" size="24"></u-icon>
|
<!-- <u-icon name="volume" color="#71d5a1" size="24"></u-icon> -->
|
||||||
|
<image src="../../static/icon/tu2.png" mode="aspectFit"></image>
|
||||||
<text>听 书</text>
|
<text>听 书</text>
|
||||||
</view>
|
</view>
|
||||||
<view class="item flexbox" @click="goPingshu(item.bookId)">
|
<view class="item flexbox" @click="goPingshu(item.bookId)">
|
||||||
<u-icon name="chat" color="#fcbd71" size="24"></u-icon>
|
<!-- <u-icon name="chat" color="#fcbd71" size="24"></u-icon> -->
|
||||||
|
<image src="../../static/icon/tu3.png" mode="aspectFit"></image>
|
||||||
<text>评 书</text>
|
<text>评 书</text>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
@@ -54,15 +57,15 @@
|
|||||||
</view>
|
</view>
|
||||||
<view class="btns">
|
<view class="btns">
|
||||||
<view class="item flexbox" @click="">
|
<view class="item flexbox" @click="">
|
||||||
<u-icon name="bookmark" color="#55aaff" size="24"></u-icon>
|
<image src="../../static/icon/tu1.png" mode="aspectFit"></image>
|
||||||
<text>读 书</text>
|
<text>读 书</text>
|
||||||
</view>
|
</view>
|
||||||
<view class="item flexbox" @click="goToListen(item)">
|
<view class="item flexbox" @click="goToListen(item)">
|
||||||
<u-icon name="volume" color="#71d5a1" size="24"></u-icon>
|
<image src="../../static/icon/tu2.png" mode="aspectFit"></image>
|
||||||
<text>听 书</text>
|
<text>听 书</text>
|
||||||
</view>
|
</view>
|
||||||
<view class="item flexbox" @click="wgGoPingshu(item)">
|
<view class="item flexbox" @click="wgGoPingshu(item)">
|
||||||
<u-icon name="chat" color="#fcbd71" size="24"></u-icon>
|
<image src="../../static/icon/tu3.png" mode="aspectFit"></image>
|
||||||
<text>评 书</text>
|
<text>评 书</text>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
@@ -251,7 +254,6 @@
|
|||||||
if(res.pages.list[i].bookId != null){
|
if(res.pages.list[i].bookId != null){
|
||||||
booidArr = res.pages.list[i].bookId.split(',')
|
booidArr = res.pages.list[i].bookId.split(',')
|
||||||
//res.pages.list[i].bookId = booidArr
|
//res.pages.list[i].bookId = booidArr
|
||||||
console.log(booidArr,'booidArr')
|
|
||||||
res.pages.list[i].bookId = booidArr
|
res.pages.list[i].bookId = booidArr
|
||||||
}else{
|
}else{
|
||||||
res.pages.list[i].bookId = []
|
res.pages.list[i].bookId = []
|
||||||
@@ -315,7 +317,11 @@
|
|||||||
@import '@/style/mixin.scss';
|
@import '@/style/mixin.scss';
|
||||||
.listenItem{
|
.listenItem{
|
||||||
.btns{margin-top: 60rpx; margin-left: 20rpx; font-size: 34rpx; justify-content: space-between;
|
.btns{margin-top: 60rpx; margin-left: 20rpx; font-size: 34rpx; justify-content: space-between;
|
||||||
.item{ margin-bottom:30rpx;}
|
.item{ margin-bottom:30rpx;
|
||||||
|
image{
|
||||||
|
width: 24px !important;height:24px;display: block; margin-right: 10rpx;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
.info{width: 50%;
|
.info{width: 50%;
|
||||||
image{width:100% ; height: 280rpx; border-radius: 20rpx;}
|
image{width:100% ; height: 280rpx; border-radius: 20rpx;}
|
||||||
|
|||||||
@@ -22,7 +22,7 @@
|
|||||||
<u-icon class="playButton" name="play-circle" color="#54a966" size="28"></u-icon>
|
<u-icon class="playButton" name="play-circle" color="#54a966" size="28"></u-icon>
|
||||||
</view>
|
</view>
|
||||||
<text class="bookName">{{item.bookName}}</text>
|
<text class="bookName">{{item.bookName}}</text>
|
||||||
<view class="btns flexbox">
|
<!-- <view class="btns flexbox">
|
||||||
<view class="item flexbox" @click="goToListenFree(item)">
|
<view class="item flexbox" @click="goToListenFree(item)">
|
||||||
<u-icon name="volume" color="#71d5a1" size="24"></u-icon>
|
<u-icon name="volume" color="#71d5a1" size="24"></u-icon>
|
||||||
<text>听 书</text>
|
<text>听 书</text>
|
||||||
@@ -31,7 +31,7 @@
|
|||||||
<u-icon name="chat" color="#fcbd71" size="24"></u-icon>
|
<u-icon name="chat" color="#fcbd71" size="24"></u-icon>
|
||||||
<text>评 书</text>
|
<text>评 书</text>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view> -->
|
||||||
</u-col>
|
</u-col>
|
||||||
</u-row>
|
</u-row>
|
||||||
</view>
|
</view>
|
||||||
@@ -43,7 +43,7 @@
|
|||||||
<u-icon class="playButton" name="play-circle" color="#54a966" size="28"></u-icon>
|
<u-icon class="playButton" name="play-circle" color="#54a966" size="28"></u-icon>
|
||||||
</view>
|
</view>
|
||||||
<text class="bookName">{{item.productName}}</text>
|
<text class="bookName">{{item.productName}}</text>
|
||||||
<view class="btns flexbox">
|
<!-- <view class="btns flexbox">
|
||||||
<view class="item flexbox" @click="goToListen(item)">
|
<view class="item flexbox" @click="goToListen(item)">
|
||||||
<u-icon name="volume" color="#71d5a1" size="24"></u-icon>
|
<u-icon name="volume" color="#71d5a1" size="24"></u-icon>
|
||||||
<text>听 书</text>
|
<text>听 书</text>
|
||||||
@@ -52,7 +52,7 @@
|
|||||||
<u-icon name="chat" color="#fcbd71" size="24"></u-icon>
|
<u-icon name="chat" color="#fcbd71" size="24"></u-icon>
|
||||||
<text>评 书</text>
|
<text>评 书</text>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view> -->
|
||||||
</u-col>
|
</u-col>
|
||||||
</u-row>
|
</u-row>
|
||||||
</view>
|
</view>
|
||||||
@@ -234,7 +234,7 @@
|
|||||||
if(res.pages.list[i].bookId != null){
|
if(res.pages.list[i].bookId != null){
|
||||||
booidArr = res.pages.list[i].bookId.split(',')
|
booidArr = res.pages.list[i].bookId.split(',')
|
||||||
//res.pages.list[i].bookId = booidArr
|
//res.pages.list[i].bookId = booidArr
|
||||||
console.log(booidArr,'booidArr')
|
// console.log(booidArr,'booidArr')
|
||||||
res.pages.list[i].bookId = booidArr
|
res.pages.list[i].bookId = booidArr
|
||||||
}else{
|
}else{
|
||||||
res.pages.list[i].bookId = []
|
res.pages.list[i].bookId = []
|
||||||
|
|||||||
@@ -39,7 +39,7 @@
|
|||||||
<view class="btns">
|
<view class="btns">
|
||||||
<!-- 已购买组 -->
|
<!-- 已购买组 -->
|
||||||
<view class="home_nar flexbox" v-if="isBuy">
|
<view class="home_nar flexbox" v-if="isBuy">
|
||||||
<view class="hn_cl_tit yigoumai" >
|
<view class="hn_cl_tit yigoumai">
|
||||||
<image src="../../static/icon/yigou.png" mode="aspectFit"></image>
|
<image src="../../static/icon/yigou.png" mode="aspectFit"></image>
|
||||||
<text>已购买</text>
|
<text>已购买</text>
|
||||||
</view>
|
</view>
|
||||||
@@ -71,9 +71,10 @@
|
|||||||
<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
|
<view
|
||||||
:class="[item.sort == 1 && isBuy == false ? 'graytitle' : '',
|
:class="[freeChapterCount < index && isBuy == false ? 'graytitle' : '',
|
||||||
userInfo.playingInfo.bookid==item.bookid && userInfo.playingInfo.chapterId == item.chapterId ? 'playing' : '']" @click="listenOne(item, index)">{{item.chapterName}}
|
userInfo.playingInfo.bookid==item.bookid && userInfo.playingInfo.chapterId == item.chapterId ? 'playing' : '']" @click="listenOne(item, index)">
|
||||||
<uni-tag v-if="item.sort == 0 && isBuy == false" class="tag" size="small" :inverted="true" text="试听" type="success" />
|
<span :class="[freeChapterCount-1 < index && isBuy == false ? 'graytitle' : '']">{{item.chapterName}}</span>
|
||||||
|
<uni-tag v-if="freeChapterCount-1 >= index && isBuy == false" 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>
|
||||||
@@ -114,10 +115,12 @@
|
|||||||
playid:null, // 正在播放的章节id
|
playid:null, // 正在播放的章节id
|
||||||
playchapName:'', // 正在播放的章节名称
|
playchapName:'', // 正在播放的章节名称
|
||||||
playIndex:null, // 正在播放的序号值
|
playIndex:null, // 正在播放的序号值
|
||||||
|
onlineH:{}, // 线上的历史听书
|
||||||
currentTime:{
|
currentTime:{
|
||||||
time:0,
|
time:0,
|
||||||
flag:''
|
flag:''
|
||||||
},
|
},
|
||||||
|
freeChapterCount:0, // 免费章节数
|
||||||
pageTab:[
|
pageTab:[
|
||||||
{name: '正在播放'},
|
{name: '正在播放'},
|
||||||
{name: '播放列表'}
|
{name: '播放列表'}
|
||||||
@@ -195,11 +198,39 @@
|
|||||||
plays() { // 播放音频
|
plays() { // 播放音频
|
||||||
this.muteBgMusic = !this.muteBgMusic
|
this.muteBgMusic = !this.muteBgMusic
|
||||||
console.log(this.muteBgMusic,this.muteBgMusic?'已关闭音乐####':'已开启音乐####');
|
console.log(this.muteBgMusic,this.muteBgMusic?'已关闭音乐####':'已开启音乐####');
|
||||||
|
|
||||||
|
|
||||||
},
|
},
|
||||||
|
// 获取线上听书进度
|
||||||
|
getListenRate(val,op){
|
||||||
|
let data = {
|
||||||
|
bookId: this.bookid,
|
||||||
|
userId: this.userInfo.id,
|
||||||
|
}
|
||||||
|
$http.request({
|
||||||
|
url: "book/listening/getReadRate",
|
||||||
|
method: "POST", // POST、GET、PUT、DELETE,具体说明查看官方文档
|
||||||
|
data,
|
||||||
|
header: { //默认 无 说明:请求头
|
||||||
|
'Content-Type': 'application/json'
|
||||||
|
},
|
||||||
|
}).then(res => {
|
||||||
|
console.log(res,'历史记录')
|
||||||
|
if(res.readRate.chapterId){
|
||||||
|
var item = res.readRate
|
||||||
|
// 有听书进度时
|
||||||
|
this.onlineH.playIndex = bgm.musicList.findIndex(function(info){
|
||||||
|
// console.log(info,'info')
|
||||||
|
if(item.chapterId == info.chapterId && item.bookId == info.bookid ){
|
||||||
|
return info;
|
||||||
|
}
|
||||||
|
})
|
||||||
|
//store.commit('setUserInfo',{'playingInfo':bgm.musicList[bgm.playIndex] })
|
||||||
|
console.log('线上的播放index是:',this.onlineH.playIndex)
|
||||||
|
}else{
|
||||||
|
// 没有听书进度
|
||||||
|
}
|
||||||
|
})
|
||||||
|
},
|
||||||
addMusicList(){
|
addMusicList(){
|
||||||
|
|
||||||
if (this.userInfo.playFlag) {
|
if (this.userInfo.playFlag) {
|
||||||
// 暂停
|
// 暂停
|
||||||
// this.$music.playBgm({mute:true})
|
// this.$music.playBgm({mute:true})
|
||||||
@@ -222,6 +253,7 @@
|
|||||||
// 'myList' : this.libLIst,
|
// 'myList' : this.libLIst,
|
||||||
// // 'fengImg' : this.fengImg,
|
// // 'fengImg' : this.fengImg,
|
||||||
// }
|
// }
|
||||||
|
|
||||||
// 显示播放组件
|
// 显示播放组件
|
||||||
this.setUserInfo({'playVisible':true})
|
this.setUserInfo({'playVisible':true})
|
||||||
uni.setStorage({
|
uni.setStorage({
|
||||||
@@ -275,17 +307,21 @@
|
|||||||
|
|
||||||
// 购买
|
// 购买
|
||||||
buyBook(){
|
buyBook(){
|
||||||
uni.showModal({
|
uni.navigateTo({
|
||||||
title: '提示',
|
url: '../bookShop/settlementBook?type=2&list=' + this.bookid
|
||||||
cancelText: '暂不购买',
|
});
|
||||||
confirmText:'立即购买',
|
// uni.showModal({
|
||||||
content: '确定花费¥95元购买本书电子版吗?',
|
// title: '提示',
|
||||||
success: function (res) {
|
// cancelText: '暂不购买',
|
||||||
if (res.confirm) {
|
// confirmText:'立即购买',
|
||||||
console.log('用户点击确定');
|
// content: '确定花费¥95元购买本书电子版吗?',
|
||||||
}
|
// success: function (res) {
|
||||||
}
|
// if (res.confirm) {
|
||||||
});
|
// console.log('用户点击确定');
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// });
|
||||||
|
|
||||||
},
|
},
|
||||||
|
|
||||||
// 信息介绍跳转
|
// 信息介绍跳转
|
||||||
@@ -431,6 +467,7 @@
|
|||||||
this.libLIst = res.BookCatalogue
|
this.libLIst = res.BookCatalogue
|
||||||
// this.fengImg = res.images
|
// this.fengImg = res.images
|
||||||
this.isBuy = res.buy
|
this.isBuy = res.buy
|
||||||
|
this.freeChapterCount = res.freeChapterCount
|
||||||
}else{
|
}else{
|
||||||
uni.showToast({
|
uni.showToast({
|
||||||
title:'暂无可听章节哦~',
|
title:'暂无可听章节哦~',
|
||||||
|
|||||||
@@ -10,24 +10,24 @@
|
|||||||
</view>
|
</view>
|
||||||
<!-- <view class="home_nar" v-if="showEbook"> -->
|
<!-- <view class="home_nar" v-if="showEbook"> -->
|
||||||
<view class="home_nar">
|
<view class="home_nar">
|
||||||
<view class="hn_cl_tit shuguan" @click="onPageJump('../clock/clock')">
|
<view class="hn_cl_tit shuguan" @click="onPageJump('../clock/index')">
|
||||||
<image src="../../static/icon/daka.png" mode="aspectFit"></image>
|
<image src="../../static/icon/home1.png" mode="aspectFit"></image>
|
||||||
<text>读书打卡</text>
|
<text>读书打卡</text>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
<view class="hn_cl_tit dianzishu" @click="onPageJump('../listen/home')">
|
<view class="hn_cl_tit dianzishu" @click="onPageJump('../listen/home')">
|
||||||
<image src="../../static/icon/ting11.png" mode="aspectFit"></image>
|
<image src="../../static/icon/home2.png" mode="aspectFit"></image>
|
||||||
<text>听书</text>
|
<text>听书</text>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
<!-- <view class="hn_cl_tit" @click="onPageJump('../bookShop/bookShopIndex')"> -->
|
<!-- <view class="hn_cl_tit" @click="onPageJump('../bookShop/bookShopIndex')"> -->
|
||||||
<view class="hn_cl_tit shuping" @click="onTabJump()">
|
<view class="hn_cl_tit shuping" @click="onTabJump()">
|
||||||
<image src="../../static/icon/pingshu1.png" mode="aspectFit"></image>
|
<image src="../../static/icon/home3.png" mode="aspectFit"></image>
|
||||||
<text>书评</text>
|
<text>书评</text>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
<view class="hn_cl_tit chaoshi" @click="onPageJump('../bookShop/classify')">
|
<view class="hn_cl_tit chaoshi" @click="onPageJump('../bookShop/classify')">
|
||||||
<image src="../../static/icon/home_bar_2.png" mode="aspectFit"></image>
|
<image src="../../static/icon/home4.png" mode="aspectFit"></image>
|
||||||
<text>图书馆</text>
|
<text>图书馆</text>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
@@ -619,12 +619,12 @@
|
|||||||
margin: 30rpx 20rpx; justify-content: space-between;
|
margin: 30rpx 20rpx; justify-content: space-between;
|
||||||
display: flex;
|
display: flex;
|
||||||
color: #333;
|
color: #333;
|
||||||
.dianzishu{ margin-right:10rpx;
|
// .dianzishu{ margin-right:10rpx;
|
||||||
background-color:#f8d6f4 ; border: 2px solid #edcce9;
|
// background-color:#f8d6f4 ; border: 2px solid #edcce9;
|
||||||
}
|
// }
|
||||||
.chaoshi{background-color:#fff2d8 ; border: 2px solid #ede6d3; }
|
// .chaoshi{background-color:#fff2d8 ; border: 2px solid #ede6d3; }
|
||||||
.shuping{ background-color: #d6ffda; border: 2px solid #bae9bf;}
|
// .shuping{ background-color: #d6ffda; border: 2px solid #bae9bf;}
|
||||||
.shuguan{ background-color:#e3f9f9 ; border: 2px solid #d7eced; }
|
// .shuguan{ background-color:#e3f9f9 ; border: 2px solid #d7eced; }
|
||||||
.hn_cl_tit { padding-bottom: 10rpx;
|
.hn_cl_tit { padding-bottom: 10rpx;
|
||||||
width: 23%;
|
width: 23%;
|
||||||
text-align: center;
|
text-align: center;
|
||||||
@@ -634,14 +634,13 @@
|
|||||||
align-content: center;
|
align-content: center;
|
||||||
justify-content: center;
|
justify-content: center;
|
||||||
image {
|
image {
|
||||||
|
|
||||||
width: 110upx;
|
width: 110upx;
|
||||||
height:110upx;
|
height:110upx;
|
||||||
display: block;
|
display: block;
|
||||||
margin: 0 auto;
|
margin: 0 auto;
|
||||||
margin: 0 20rpx;
|
margin: 0 20rpx;
|
||||||
}
|
}
|
||||||
text{ display:block; font-size: 34rpx;}
|
text{ display:block; margin-top: 10px; font-size: 36rpx; color: #000; font-weight:blod;}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -59,7 +59,10 @@
|
|||||||
<text>我的订单</text>
|
<text>我的订单</text>
|
||||||
</view>
|
</view>
|
||||||
<view class="nav_list" @click="onPageJump('../listen/home')">
|
<view class="nav_list" @click="onPageJump('../listen/home')">
|
||||||
<text>我的图书</text>
|
<text>我的听书</text>
|
||||||
|
</view>
|
||||||
|
<view class="nav_list" @click="onPageJump('../clock/clockList')">
|
||||||
|
<text>我的打卡</text>
|
||||||
</view>
|
</view>
|
||||||
<view class="nav_list" @click="onPageJump('../listen/setListen')">
|
<view class="nav_list" @click="onPageJump('../listen/setListen')">
|
||||||
<text>听书设置</text>
|
<text>听书设置</text>
|
||||||
@@ -67,6 +70,9 @@
|
|||||||
<view class="nav_list" @click="onPageJump('../peanut/myComments')">
|
<view class="nav_list" @click="onPageJump('../peanut/myComments')">
|
||||||
<text>我的评价</text>
|
<text>我的评价</text>
|
||||||
</view>
|
</view>
|
||||||
|
<view class="nav_list" @click="onPageJump('../peanut/shopping')">
|
||||||
|
<text>购物车</text>
|
||||||
|
</view>
|
||||||
<!-- <view v-if="showEbook" class="nav_list" @click="onPageJump('../eBook/bookBuy')">
|
<!-- <view v-if="showEbook" class="nav_list" @click="onPageJump('../eBook/bookBuy')">
|
||||||
<text>电子书购买记录</text>
|
<text>电子书购买记录</text>
|
||||||
</view> -->
|
</view> -->
|
||||||
|
|||||||
193
utils/music.js
193
utils/music.js
@@ -2,10 +2,13 @@ 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 = uni.createInnerAudioContext();
|
// const bgm = uni.createInnerAudioContext();
|
||||||
|
|
||||||
bgm.musicList = [] // 播放目录
|
bgm.musicList = [] // 播放目录
|
||||||
bgm.src = ''
|
bgm.src = ''
|
||||||
|
bgm.htimes = 0 // 历史播放秒数
|
||||||
bgm.cTime = 0
|
bgm.cTime = 0
|
||||||
bgm.title = ''
|
bgm.title = ''
|
||||||
|
bgm.interval=null // 存储定时器
|
||||||
bgm.loop = true;
|
bgm.loop = true;
|
||||||
bgm.coverImgUrl = ''
|
bgm.coverImgUrl = ''
|
||||||
bgm.oldIndex = 0 // 前面一首的播放索引
|
bgm.oldIndex = 0 // 前面一首的播放索引
|
||||||
@@ -42,24 +45,35 @@ var music = {
|
|||||||
}
|
}
|
||||||
// 没有就添加添加url到播放器,播放新的
|
// 没有就添加添加url到播放器,播放新的
|
||||||
if(bgm.src == ''){
|
if(bgm.src == ''){
|
||||||
console.log(bgm.playIndex,'播放的索引',store.state.userInfo.playIndex)
|
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].images})
|
||||||
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 : ''
|
||||||
this.getChartUrl()
|
this.getChartUrl()
|
||||||
|
// 获取历史秒数
|
||||||
|
|
||||||
}else{
|
}else{
|
||||||
// 如果有正在播放的url,暂停改为播放
|
|
||||||
// bgm.play()
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
bgm.onPause(()=>{
|
bgm.onPause(()=>{
|
||||||
console.log('暂停背景音乐');
|
console.log('暂停背景音乐');
|
||||||
|
this.saveTimes()
|
||||||
|
clearInterval(bgm.interval)
|
||||||
store.commit('setUserInfo',{'playFlag': false})
|
store.commit('setUserInfo',{'playFlag': false})
|
||||||
|
|
||||||
})
|
})
|
||||||
bgm.onPlay(() => {
|
bgm.onPlay(() => {
|
||||||
store.commit('setUserInfo',{'playFlag': true})
|
store.commit('setUserInfo',{'playFlag': true})
|
||||||
console.log('开始播放音乐#######');
|
console.log('开始播放音乐#######');
|
||||||
|
uni.hideLoading()
|
||||||
|
|
||||||
|
bgm.interval = setInterval(()=>{
|
||||||
|
console.log('存一次')
|
||||||
|
this.saveIndex()
|
||||||
|
},180000)
|
||||||
})
|
})
|
||||||
bgm.onError((res) => {
|
bgm.onError((res) => {
|
||||||
console.log(res)
|
console.log(res)
|
||||||
@@ -91,7 +105,10 @@ var music = {
|
|||||||
// 可以播放时
|
// 可以播放时
|
||||||
// console.log('可以播放时')
|
// console.log('可以播放时')
|
||||||
uni.hideLoading()
|
uni.hideLoading()
|
||||||
this.saveIndex()
|
// this.saveIndex()
|
||||||
|
console.log('历史播放进度,秒数', bgm.htimes)
|
||||||
|
bgm.seek(bgm.htimes)
|
||||||
|
bgm.htimes = 0 // 重置播放秒数
|
||||||
// store.commit('setUserInfo',{'duration':bgm.duration})
|
// store.commit('setUserInfo',{'duration':bgm.duration})
|
||||||
// store.commit('setUserInfo',{'playTitle': bgm.title})
|
// store.commit('setUserInfo',{'playTitle': bgm.title})
|
||||||
// store.commit('setUserInfo',{'fengImg': bgm.coverImgUrl})
|
// store.commit('setUserInfo',{'fengImg': bgm.coverImgUrl})
|
||||||
@@ -108,20 +125,68 @@ var music = {
|
|||||||
// 添加播放列表
|
// 添加播放列表
|
||||||
setList(list,op,playindex){
|
setList(list,op,playindex){
|
||||||
bgm.musicList = list
|
bgm.musicList = list
|
||||||
|
bgm.oldIndex = bgm.playIndex // 暂存上一个播放得index
|
||||||
|
console.log('地址异常报错前index:',bgm.oldIndex)
|
||||||
playindex ? bgm.playIndex = playindex : bgm.playIndex = 0
|
playindex ? bgm.playIndex = playindex : bgm.playIndex = 0
|
||||||
console.log(bgm.playIndex,'playindex')
|
|
||||||
|
// console.log(bgm.playIndex,'playindex')
|
||||||
store.commit('setUserInfo',{'playingInfo': {}})
|
store.commit('setUserInfo',{'playingInfo': {}})
|
||||||
if(op == 'autoPlay'){
|
this.getListenRate(bgm.musicList[0], op)
|
||||||
if(bgm._options.src == ''){
|
// if(op == 'autoPlay'){
|
||||||
// this.getChartUrl()
|
// store.commit('setUserInfo',{'playTimes': 0})
|
||||||
this.playBgm({mute:false})
|
// if(bgm._options.src == ''){
|
||||||
console.log('playBgm')
|
// // this.getChartUrl()
|
||||||
}else{
|
// this.playBgm({mute:false})
|
||||||
this.getChartUrl() // 获取对应的播放路径
|
// console.log('playBgm')
|
||||||
// console.log('getChartUrl')
|
// }else{
|
||||||
}
|
// this.getChartUrl() // 获取对应的播放路径
|
||||||
|
// // console.log('getChartUrl')
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
},
|
||||||
|
// 获取线上听书进度
|
||||||
|
getListenRate(val,op){
|
||||||
|
let data = {
|
||||||
|
bookId: val.bookid,
|
||||||
|
userId: store.state.userInfo.id,
|
||||||
}
|
}
|
||||||
|
$http.request({
|
||||||
|
url: "book/listening/getReadRate",
|
||||||
|
method: "POST", // POST、GET、PUT、DELETE,具体说明查看官方文档
|
||||||
|
data,
|
||||||
|
header: { //默认 无 说明:请求头
|
||||||
|
'Content-Type': 'application/json'
|
||||||
|
},
|
||||||
|
}).then(res => {
|
||||||
|
console.log(res,'历史记录')
|
||||||
|
if(res.readRate.chapterId){
|
||||||
|
var item = res.readRate
|
||||||
|
// 有听书进度时
|
||||||
|
bgm.playIndex = bgm.musicList.findIndex(function(info){
|
||||||
|
// console.log(info,'info')
|
||||||
|
if(item.chapterId == info.chapterId && item.bookId == info.bookid ){
|
||||||
|
return info;
|
||||||
|
}
|
||||||
|
})
|
||||||
|
store.commit('setUserInfo',{'playingInfo':bgm.musicList[bgm.playIndex] })
|
||||||
|
console.log('线上的播放index是:',bgm.playIndex)
|
||||||
|
console.log('线上的播放index是:', store.state.userInfo.playingInfo)
|
||||||
|
}else{
|
||||||
|
// 没有听书进度
|
||||||
|
}
|
||||||
|
|
||||||
|
if(op == 'autoPlay'){
|
||||||
|
store.commit('setUserInfo',{'playTimes': 0})
|
||||||
|
if(bgm._options.src == ''){
|
||||||
|
// this.getChartUrl()
|
||||||
|
this.playBgm({mute:false})
|
||||||
|
console.log('playBgm')
|
||||||
|
}else{
|
||||||
|
this.getChartUrl() // 获取对应的播放路径
|
||||||
|
// console.log('getChartUrl')
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
},
|
},
|
||||||
// 获取章节url
|
// 获取章节url
|
||||||
getChartUrl(){
|
getChartUrl(){
|
||||||
@@ -132,25 +197,33 @@ var music = {
|
|||||||
'chapterid': bgm.musicList[bgm.playIndex].chapterId
|
'chapterid': bgm.musicList[bgm.playIndex].chapterId
|
||||||
}
|
}
|
||||||
console.log(data,'data')
|
console.log(data,'data')
|
||||||
$http.post('book/bookchaptercontent/appBooksChapterContent', data)
|
$http.post('book/bookchaptercontent/appBooksChapterContent', data)
|
||||||
|
// $http.post('book/bookchaptercontent/getCatal', data)
|
||||||
.then(res => {
|
.then(res => {
|
||||||
console.log(res,'res')
|
console.log(res,'res')
|
||||||
if(res.code == 0){
|
if(res.code == 0){
|
||||||
// bgm.stop()
|
// bgm.stop()
|
||||||
// 有听权限时
|
// 有听权限时
|
||||||
if(res.bookCatalogue[0].url.length > 10){
|
if(res.bookCatalogue[0].url){ // 空值url:null
|
||||||
bgm.src = res.bookCatalogue[0].url
|
bgm.src = res.bookCatalogue[0].url
|
||||||
bgm.title = res.bookCatalogue[0].name
|
// bgm.title = res.bookCatalogue[0].name
|
||||||
bgm.coverImgUrl = res.image
|
// 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()
|
// bgm.pause()
|
||||||
// this.setCoverImg(bgm.musicList[bgm.playIndex].images)
|
// this.setCoverImg(bgm.musicList[bgm.playIndex].images)
|
||||||
}else{
|
}else{
|
||||||
bgm.src = ''
|
// bgm.src = ''
|
||||||
bgm.title = ''
|
// bgm.title = ''
|
||||||
bgm.coverImgUrl = ''
|
// bgm.coverImgUrl = '../../static/icon/fengziIcon.jpg'
|
||||||
// this.setCoverImg('../../static/icon/x1.jpg')
|
// this.setCoverImg('../../static/icon/x1.jpg')
|
||||||
bgm.stop()
|
// bgm.stop()
|
||||||
|
bgm.playIndex = bgm.oldIndex
|
||||||
|
console.log('地址异常报错后index:',bgm.playIndex)
|
||||||
|
store.commit('setUserInfo',{'playIndex': bgm.playIndex})
|
||||||
|
store.commit('setUserInfo',{'playingInfo':bgm.musicList[bgm.playIndex] })
|
||||||
uni.showToast({
|
uni.showToast({
|
||||||
title:'音频地址异常',
|
title:'音频地址异常',
|
||||||
icon:'error',
|
icon:'error',
|
||||||
@@ -158,44 +231,79 @@ var music = {
|
|||||||
})
|
})
|
||||||
// store.commit('setUserInfo',{'playFlag': false})
|
// store.commit('setUserInfo',{'playFlag': false})
|
||||||
}
|
}
|
||||||
store.commit('setUserInfo',{'playTitle': bgm.title})
|
|
||||||
store.commit('setUserInfo',{'fengImg': bgm.coverImgUrl})
|
|
||||||
}
|
}
|
||||||
console.log(res.bookCatalogue,'单章节信息')
|
console.log(res.bookCatalogue,'单章节信息')
|
||||||
}).catch((e)=>{
|
}).catch((e)=>{
|
||||||
|
console.log(e,'e')
|
||||||
// bgm.pause()
|
// bgm.pause()
|
||||||
bgm.playIndex = bgm.oldIndex
|
bgm.playIndex = bgm.oldIndex
|
||||||
// bgm.stop()
|
// bgm.stop()
|
||||||
store.commit('setUserInfo',{'playFlag': false})
|
// store.commit('setUserInfo',{'playFlag': false})
|
||||||
uni.showModal({
|
|
||||||
title: '提示',
|
uni.showModal({
|
||||||
cancelText: '暂不购买',
|
title: '提示',
|
||||||
confirmText:'立即购买',
|
cancelText: '暂不购买',
|
||||||
content: '抱歉!当前章节不支持试听,购买后可收听',
|
confirmText:'立即购买',
|
||||||
success: function (res) {
|
content: '抱歉!当前章节不支持试听,购买后可收听',
|
||||||
if (res.confirm) {
|
success: function (res) {
|
||||||
console.log('用户点击确定');
|
if (res.confirm) {
|
||||||
uni.navigateTo({
|
console.log('用户点击确定');
|
||||||
url: '../bookShop/settlementBook?type=2&list=' + data.bookid
|
uni.navigateTo({
|
||||||
});
|
url: '../bookShop/settlementBook?type=2&list=' + data.bookid
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
});
|
||||||
});
|
|
||||||
|
// uni.showModal({
|
||||||
|
// title: '提示',
|
||||||
|
// confirmText:'知道了',
|
||||||
|
// content: '当前书籍音频功能未开通,请联系管理员',
|
||||||
|
// success: function (res) {
|
||||||
|
// if (res.confirm) {
|
||||||
|
// console.log('用户点击确定');
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// });
|
||||||
|
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
// 存储播放信息
|
// 存储播放信息
|
||||||
saveIndex(){
|
saveIndex(){
|
||||||
|
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.title})
|
store.commit('setUserInfo',{'playTitle': bgm.title})
|
||||||
store.commit('setUserInfo',{'fengImg': bgm.coverImgUrl})
|
store.commit('setUserInfo',{'fengImg': bgm.coverImgUrl})
|
||||||
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]})
|
||||||
|
store.commit('setUserInfo',{'playTimes': bgm.currentTime})
|
||||||
|
this.saveRate(bgm.musicList[bgm.playIndex])
|
||||||
},
|
},
|
||||||
// 存储播放
|
// 存储播放(本地)
|
||||||
saveTimes(){
|
saveTimes(){
|
||||||
store.commit('setUserInfo',{'playTimes': bgm.currentTime})
|
store.commit('setUserInfo',{'playTimes': bgm.currentTime})
|
||||||
},
|
},
|
||||||
|
// 存储播放进度(线上)
|
||||||
|
saveRate(val){
|
||||||
|
console.log(val,'要存储的播放信息',)
|
||||||
|
$http.post('book/listening/save', {
|
||||||
|
'userId': store.state.userInfo.id,
|
||||||
|
'bookId': val.bookid,
|
||||||
|
'chapterId': val.chapterId,
|
||||||
|
'chapterName': val.chapterName,
|
||||||
|
//'precent': bgm.currentTime
|
||||||
|
'precent': Math.ceil(bgm.currentTime),
|
||||||
|
//'contentId'
|
||||||
|
'loadAnimate':'none', // 请求加载动画
|
||||||
|
})
|
||||||
|
.then(res => {
|
||||||
|
if(res.code == 0){
|
||||||
|
console.log(res,'存储完成')
|
||||||
|
}
|
||||||
|
}).catch((e)=>{})
|
||||||
|
},
|
||||||
// 设置播放index
|
// 设置播放index
|
||||||
setPlayIndex(opName){ // 切换音频
|
setPlayIndex(opName){ // 切换音频
|
||||||
if(opName == 'next'){ // 下一首
|
if(opName == 'next'){ // 下一首
|
||||||
@@ -256,7 +364,8 @@ var music = {
|
|||||||
console.log('success');
|
console.log('success');
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
bgm.htimes = 0
|
||||||
|
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.chapterId == info.chapterId && item.bookid == info.bookid ){
|
||||||
|
|||||||
Reference in New Issue
Block a user