|
@@ -9,6 +9,7 @@ import {useUserInfo} from '@/hooks/common'
|
|
|
import { showToast } from 'vant'
|
|
|
import {useUploadFileToOSS} from '@/hooks/useUploadFileToOSS'
|
|
|
import MD5 from 'js-md5'
|
|
|
+import AudioBox from '../components/AudioBox.vue'
|
|
|
|
|
|
const userInfo=useUserInfo()
|
|
|
|
|
@@ -52,11 +53,13 @@ function getChapterDetail(){
|
|
|
chapterBaseInfo.audioSize=res.Data.VideoSize
|
|
|
}
|
|
|
|
|
|
+ // 由于周报有个上传音频区域 所以得在此处初始化富文本区域 不然高度有问题
|
|
|
nextTick(()=>{
|
|
|
const el=document.getElementById('editor')
|
|
|
initFroalaEditor('#editor',{height:el.offsetHeight-150})
|
|
|
-
|
|
|
- FroalaEditorIns.value.html.set(res.Data.Content);
|
|
|
+ setTimeout(() => {
|
|
|
+ FroalaEditorIns.value.html.set(res.Data.Content);
|
|
|
+ }, 100);
|
|
|
})
|
|
|
|
|
|
}
|
|
@@ -79,7 +82,15 @@ const chapterBaseInfo=reactive({
|
|
|
})
|
|
|
// 保存报告基本内容
|
|
|
function handleChapterBaseInfoSave(e){
|
|
|
+ console.log(e);
|
|
|
+ // 继承报告
|
|
|
+ if(e.addType==2){
|
|
|
|
|
|
+ }else{
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ showChapterBaseInfo.value=false
|
|
|
}
|
|
|
|
|
|
// 上传音频
|
|
@@ -87,8 +98,14 @@ const showUploadAudio=ref(false)
|
|
|
const temAudioData=reactive({
|
|
|
time:0,
|
|
|
size:0,
|
|
|
- url:''
|
|
|
+ url:'',
|
|
|
})
|
|
|
+function handleShowUploadAudio(){
|
|
|
+ temAudioData.time=chapterBaseInfo.audioDuration
|
|
|
+ temAudioData.size=chapterBaseInfo.audioSize
|
|
|
+ temAudioData.url=chapterBaseInfo.audioUrl
|
|
|
+ showUploadAudio.value=true
|
|
|
+}
|
|
|
// 获取音频时长
|
|
|
function handleGetAudioDuration(file){
|
|
|
return new Promise((resolve,reject)=>{
|
|
@@ -125,12 +142,18 @@ async function handleAudioUploadAfterRead(e){
|
|
|
}
|
|
|
temAudioData.time=duration
|
|
|
temAudioData.size=e.file.size/1024/1024 //单位MB
|
|
|
+ temAudioData.name=e.file.name
|
|
|
// 生成文件名
|
|
|
const t=new Date().getTime().toString()
|
|
|
const temName=`static/yb/audio/${import.meta.env.MODE}/${MD5(t)}.${e.file.type.split('/')[1]}`
|
|
|
console.log(temName);
|
|
|
- const url=await useUploadFileToOSS(e.file,temName)
|
|
|
-
|
|
|
+ temAudioData.url=await useUploadFileToOSS(e.file,temName)
|
|
|
+}
|
|
|
+function handleUpdateAudio(){
|
|
|
+ chapterBaseInfo.audioUrl=temAudioData.url
|
|
|
+ chapterBaseInfo.audioDuration=temAudioData.time
|
|
|
+ chapterBaseInfo.audioSize=temAudioData.size
|
|
|
+ showUploadAudio.value=false
|
|
|
}
|
|
|
|
|
|
</script>
|
|
@@ -138,7 +161,7 @@ async function handleAudioUploadAfterRead(e){
|
|
|
<template>
|
|
|
<div class="chapter-detail-edit-page">
|
|
|
<van-cell title="基础信息" is-link @click="showChapterBaseInfo=true"/>
|
|
|
- <van-cell title="上传音频" is-link v-if="info?.ReportType==='week'" @click="showUploadAudio=true"/>
|
|
|
+ <van-cell title="上传音频" is-link v-if="info?.ReportType==='week'" @click="handleShowUploadAudio"/>
|
|
|
<div class="main-wrap">
|
|
|
<div class="editor-box" id="editor"></div>
|
|
|
</div>
|
|
@@ -189,19 +212,24 @@ async function handleAudioUploadAfterRead(e){
|
|
|
<van-popup
|
|
|
v-model:show="showUploadAudio"
|
|
|
position="bottom"
|
|
|
- :style="{height:'100%'}"
|
|
|
+ round
|
|
|
+ :style="{height:'60%'}"
|
|
|
>
|
|
|
- <div class="upload-audio-wrap">
|
|
|
-
|
|
|
+ <div class="upload-audio-wrap" v-if="showUploadAudio">
|
|
|
+ <template v-if="temAudioData.url">
|
|
|
+ <h2>音频名称</h2>
|
|
|
+ <p>{{temAudioData.url}}</p>
|
|
|
+ <AudioBox :url="temAudioData.url" />
|
|
|
+ </template>
|
|
|
<div class="bot-btns">
|
|
|
<van-uploader
|
|
|
accept="*"
|
|
|
:after-read="handleAudioUploadAfterRead"
|
|
|
:before-read="handleAudioUploadBeforeRead"
|
|
|
>
|
|
|
- <van-button class="bot-btn" type="default">重新上传</van-button>
|
|
|
+ <van-button class="bot-btn" type="default">{{temAudioData.url?'重新上传':'上传音频'}}</van-button>
|
|
|
</van-uploader>
|
|
|
- <van-button class="bot-btn" type="primary">保存</van-button>
|
|
|
+ <van-button class="bot-btn" type="primary" :disabled="!temAudioData.url" @click="handleUpdateAudio">保存</van-button>
|
|
|
</div>
|
|
|
</div>
|
|
|
</van-popup>
|
|
@@ -275,6 +303,14 @@ async function handleAudioUploadAfterRead(e){
|
|
|
.upload-audio-wrap{
|
|
|
height: 100%;
|
|
|
position: relative;
|
|
|
+ overflow: hidden;
|
|
|
+ padding: $page-padding;
|
|
|
+ p{
|
|
|
+ color: rgba(0, 0, 0, 0.6);
|
|
|
+ padding-bottom: 32px;
|
|
|
+ border-bottom: 1px solid $border-color;
|
|
|
+ margin-bottom: 32px;
|
|
|
+ }
|
|
|
.bot-btns{
|
|
|
width: 100%;
|
|
|
position: absolute;
|