Commit a94de873 authored by 李维's avatar 李维

添加获取DPE数据接口

parent 1c01ddcf
No preview for this file type
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
......@@ -11,11 +11,9 @@
</div>
<div class="main-body">
<div ref="refDubbingScrollList" class="dubbing-items">
<el-card v-for="item, index in dubbintItems" :key="index" class="box-card">
<el-card v-for="item, index in dubbingData.dubbingItems" :key="index" class="box-card">
<div style="position: relative;">
<span style="position: absolute;" class="item-index">{{ index + 1 }} <span
style="font-size: medium; line-height: normal;">{{ currentSelectDubbingIndex==index ?
'正在编辑' : '' }}</span></span>
<span style="position: absolute;" class="item-index">{{ index + 1 }} <span style="font-size: medium; line-height: normal;">{{ currentSelectDubbingIndex==index ? '正在编辑' : '' }}</span></span>
<div style="text-align: right;">
<el-button size="mini" type="danger" @click="handleClickDelete(index)">删除</el-button>
<el-button size="mini" type="primary" @click="handleClickSetCurrent(index)">编辑</el-button>
......@@ -97,7 +95,7 @@ export default {
isPlaying: false,
// 视频地址
videoUrl: 'https://teach.cdn.ireadabc.com/3d13b9a7b2cb777836a3d5b29c38384b.mp4',
videoUrl: '',
// 时间区间
timeRange: {
......@@ -105,8 +103,16 @@ export default {
end: 1
},
// 配音列表
dubbintItems: [],
// 配音数据
dubbingData: {
backgroundAudio: {
url: "",
duration: 0,
size: 0
},
dubbingItems: []
},
// 选择内容对话框显示隐藏控制
dialogSelectShow: false,
......@@ -200,13 +206,23 @@ export default {
},
methods: {
async getData() {
const dpeData = await this.$getDPEData();
console.log("====dpeData====", dpeData)
const res = await this.$getData();
console.log("====getData====", res)
if(!res) {
// 默认数据
this.dubbintItems = []
this.dubbingData = {
backgroundAudio: {
url: "",
duration: 0,
size: 0
},
dubbingItems: []
}
} else {
this.dubbintItems = res
this.dubbingData = res
}
},
......@@ -215,8 +231,8 @@ export default {
const sTime = this.timeRange.start * this.$refs.refVideo.duration;
const eTime = this.timeRange.end * this.$refs.refVideo.duration;
this.dubbintItems[this.currentSelectDubbingIndex].timelineIn = sTime;
this.dubbintItems[this.currentSelectDubbingIndex].timelineOut = eTime;
this.dubbingData.dubbingItems[this.currentSelectDubbingIndex].timelineIn = sTime;
this.dubbingData.dubbingItems[this.currentSelectDubbingIndex].timelineOut = eTime;
},
// 点击区间播放
......@@ -258,18 +274,18 @@ export default {
handleClickSetStart() {
this.timeRange.start = this.$refs.refVideo.currentTime / this.$refs.refVideo.duration;
this.dubbintItems[this.currentSelectDubbingIndex].timelineIn = this.$refs.refVideo.currentTime;
this.dubbingData.dubbingItems[this.currentSelectDubbingIndex].timelineIn = this.$refs.refVideo.currentTime;
},
handleClickSetEnd() {
this.timeRange.end = this.$refs.refVideo.currentTime / this.$refs.refVideo.duration;
this.dubbintItems[this.currentSelectDubbingIndex].timelineOut = this.$refs.refVideo.currentTime;
this.dubbingData.dubbingItems[this.currentSelectDubbingIndex].timelineOut = this.$refs.refVideo.currentTime;
},
handleClickSetCurrent(index, play = false) {
const timelineIn = this.dubbintItems[index].timelineIn / this.$refs.refVideo.duration;
const timelineOut = this.dubbintItems[index].timelineOut / this.$refs.refVideo.duration;
const timelineIn = this.dubbingData.dubbingItems[index].timelineIn / this.$refs.refVideo.duration;
const timelineOut = this.dubbingData.dubbingItems[index].timelineOut / this.$refs.refVideo.duration;
this.currentSelectDubbingIndex = index;
......@@ -284,13 +300,13 @@ export default {
// 删除配音秀
handleClickDelete(index) {
this.$confirm("确定要删除吗?").then(res=>{
this.dubbintItems.splice(index, 1)
this.dubbingData.dubbingItems.splice(index, 1)
}).catch(_=>"")
},
// 添加配音
handelClickAdd() {
this.dubbintItems.push({
this.dubbingData.dubbingItems.push({
orgText: '',
transText: '',
timelineIn: 0,
......@@ -356,7 +372,7 @@ export default {
// 保存数据
async handleClickSave() {
this.$setData(this.dubbintItems)
this.$setData(this.dubbingData)
}
}
}
......
......@@ -15,6 +15,14 @@ Vue.prototype.$getData = () => {
})
}
Vue.prototype.$getDPEData = () => {
return new Promise((resolve, reject) => {
(window).courseware.getDPEData((data) => {
resolve(data)
})
})
}
Vue.prototype.$setData = (data) => {
(window).courseware.setData(data, null, "default_key")
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment