|
@@ -33,6 +33,10 @@
|
|
|
</div>
|
|
|
<SvgIcon icon-class="delete-black" size="12" @click="removeFile" />
|
|
|
</div>
|
|
|
+ <el-radio-group v-model="isText" style="width: 100%; margin: 20px 0; text-align: center">
|
|
|
+ <el-radio-button :label="true">文字框</el-radio-button>
|
|
|
+ <el-radio-button :label="false">输入框</el-radio-button>
|
|
|
+ </el-radio-group>
|
|
|
<div
|
|
|
v-if="data.image_list[0]"
|
|
|
id="selectableArea"
|
|
@@ -55,7 +59,7 @@
|
|
|
left: `${startX}px`,
|
|
|
width: `${endX - startX}px`,
|
|
|
height: `${endY - startY}px`,
|
|
|
- border: '2px solid #165DFF',
|
|
|
+ border: isText ? '2px solid #165DFF' : '2px solid #f90',
|
|
|
}"
|
|
|
></div>
|
|
|
<template v-for="(itemh, indexh) in data.text_list">
|
|
@@ -89,34 +93,94 @@
|
|
|
>
|
|
|
</div>
|
|
|
</template>
|
|
|
- </div>
|
|
|
- <ul class="hotspots-list" v-if="data.image_list[0] && data.text_list">
|
|
|
- <li v-for="(itemh, indexh) in data.text_list" :key="indexh">
|
|
|
- <span>{{ indexh + 1 }}</span>
|
|
|
- <div class="content">
|
|
|
- <el-input
|
|
|
- v-if="indexh === hotspotsActiveIndex"
|
|
|
- type="textarea"
|
|
|
- :rows="2"
|
|
|
- placeholder="请输入"
|
|
|
- v-model="itemh.text"
|
|
|
- maxlength="500"
|
|
|
- show-word-limit
|
|
|
+ <template v-for="(itemh, indexhs) in data.input_list">
|
|
|
+ <div
|
|
|
+ v-if="indexhs === inputActiveIndex"
|
|
|
+ :key="indexhs"
|
|
|
+ :style="{
|
|
|
+ position: 'absolute',
|
|
|
+ top: `${itemh.y}`,
|
|
|
+ left: `${itemh.x}`,
|
|
|
+ width: `${itemh.width}`,
|
|
|
+ height: `${itemh.height}`,
|
|
|
+ border: '2px solid #f90',
|
|
|
+ }"
|
|
|
+ >
|
|
|
+ <label
|
|
|
+ :style="{
|
|
|
+ position: 'absolute',
|
|
|
+ top: '-13px',
|
|
|
+ right: '-13px',
|
|
|
+ width: '26px',
|
|
|
+ height: '26px',
|
|
|
+ border: '2px solid #f90',
|
|
|
+ textAlign: 'center',
|
|
|
+ borderRadius: '50%',
|
|
|
+ boxShadow: ' 0px 5px 5px -3px #0000001A',
|
|
|
+ background: '#fff',
|
|
|
+ color: '#f90',
|
|
|
+ }"
|
|
|
+ >{{ indexhs + 1 }}</label
|
|
|
>
|
|
|
- </el-input>
|
|
|
- <p v-else>{{ itemh.text }}</p>
|
|
|
</div>
|
|
|
- <el-button
|
|
|
- v-if="hotspotsActiveIndex !== indexh"
|
|
|
- type="primary"
|
|
|
- size="small"
|
|
|
- @click="hotspotsActiveIndex = indexh"
|
|
|
- >编辑</el-button
|
|
|
- >
|
|
|
- <el-button v-else type="primary" size="small" @click="hotspotsActiveIndex = null">保存</el-button>
|
|
|
- <el-button type="danger" size="small" @click="deletehotspots(indexh)">删除</el-button>
|
|
|
- </li>
|
|
|
- </ul>
|
|
|
+ </template>
|
|
|
+ </div>
|
|
|
+ <template v-if="data.image_list[0] && data.text_list.length > 0">
|
|
|
+ <h4>文本框内容</h4>
|
|
|
+ <ul class="hotspots-list">
|
|
|
+ <li v-for="(itemh, indexh) in data.text_list" :key="indexh">
|
|
|
+ <span>{{ indexh + 1 }}</span>
|
|
|
+ <div class="content">
|
|
|
+ <el-input
|
|
|
+ v-if="indexh === hotspotsActiveIndex"
|
|
|
+ type="textarea"
|
|
|
+ :rows="2"
|
|
|
+ placeholder="请输入"
|
|
|
+ v-model="itemh.text"
|
|
|
+ maxlength="500"
|
|
|
+ show-word-limit
|
|
|
+ >
|
|
|
+ </el-input>
|
|
|
+ <p v-else>{{ itemh.text }}</p>
|
|
|
+ </div>
|
|
|
+ <el-button
|
|
|
+ v-if="hotspotsActiveIndex !== indexh"
|
|
|
+ type="primary"
|
|
|
+ size="small"
|
|
|
+ @click="hotspotsActiveIndex = indexh"
|
|
|
+ >编辑</el-button
|
|
|
+ >
|
|
|
+ <el-button v-else type="primary" size="small" @click="hotspotsActiveIndex = null">保存</el-button>
|
|
|
+ <el-button type="danger" size="small" @click="deletehotspots(indexh)">删除</el-button>
|
|
|
+ </li>
|
|
|
+ </ul>
|
|
|
+ </template>
|
|
|
+ <template v-if="data.image_list[0] && data.input_list.length > 0">
|
|
|
+ <h4>输入框答案</h4>
|
|
|
+ <ul class="hotspots-list">
|
|
|
+ <li v-for="(itemh, indexh) in data.input_list" :key="indexh">
|
|
|
+ <span>{{ indexh + 1 }}</span>
|
|
|
+ <div class="content">
|
|
|
+ <el-input
|
|
|
+ v-if="indexh === inputActiveIndex"
|
|
|
+ type="textarea"
|
|
|
+ :rows="2"
|
|
|
+ placeholder="请输入"
|
|
|
+ v-model="itemh.text"
|
|
|
+ maxlength="500"
|
|
|
+ show-word-limit
|
|
|
+ >
|
|
|
+ </el-input>
|
|
|
+ <p v-else>{{ itemh.text }}</p>
|
|
|
+ </div>
|
|
|
+ <el-button v-if="inputActiveIndex !== indexh" type="primary" size="small" @click="inputActiveIndex = indexh"
|
|
|
+ >编辑</el-button
|
|
|
+ >
|
|
|
+ <el-button v-else type="primary" size="small" @click="inputActiveIndex = null">保存</el-button>
|
|
|
+ <el-button type="danger" size="small" @click="deletehotspotsInput(indexh)">删除</el-button>
|
|
|
+ </li>
|
|
|
+ </ul>
|
|
|
+ </template>
|
|
|
</template>
|
|
|
</ModuleBase>
|
|
|
</template>
|
|
@@ -143,8 +207,10 @@ export default {
|
|
|
startY: 0,
|
|
|
endX: 0,
|
|
|
endY: 0,
|
|
|
- hotspotsActiveIndex: null, // 当前编辑热区索引
|
|
|
+ hotspotsActiveIndex: null, // 当前编辑文本框热区索引
|
|
|
genloading: false, // 字幕节点loading
|
|
|
+ isText: true, // 框选是文本还是输入框
|
|
|
+ inputActiveIndex: null, // 当前编辑输入框热区索引
|
|
|
};
|
|
|
},
|
|
|
watch: {
|
|
@@ -200,20 +266,26 @@ export default {
|
|
|
const height = Math.abs(this.endY - this.startY);
|
|
|
const x = this.endX > this.startX ? this.startX + 'px' : this.endX + 'px';
|
|
|
const y = this.endY > this.startY ? this.startY + 'px' : this.endY + 'px';
|
|
|
- if (width && height) {
|
|
|
- this.data.text_list.push({
|
|
|
- id: Math.random().toString(36).substring(2, 10),
|
|
|
- width: width + 'px',
|
|
|
- height: height + 'px',
|
|
|
- x: x,
|
|
|
- y: y,
|
|
|
- text: '',
|
|
|
- });
|
|
|
- this.startX = 0;
|
|
|
- this.endX = 0;
|
|
|
- this.startY = 0;
|
|
|
- this.endY = 0;
|
|
|
+ let obj = {
|
|
|
+ id: Math.random().toString(36).substring(2, 10),
|
|
|
+ width: width + 'px',
|
|
|
+ height: height + 'px',
|
|
|
+ x: x,
|
|
|
+ y: y,
|
|
|
+ text: '',
|
|
|
+ };
|
|
|
+ this.startX = 0;
|
|
|
+ this.endX = 0;
|
|
|
+ this.startY = 0;
|
|
|
+ this.endY = 0;
|
|
|
+ if (width && height && this.isText) {
|
|
|
+ this.data.text_list.push(obj);
|
|
|
+
|
|
|
this.hotspotsActiveIndex = this.data.text_list.length - 1;
|
|
|
+ } else if (width && height && !this.isText) {
|
|
|
+ this.data.input_list.push(obj);
|
|
|
+
|
|
|
+ this.inputActiveIndex = this.data.input_list.length - 1;
|
|
|
}
|
|
|
},
|
|
|
handleData() {
|
|
@@ -223,13 +295,20 @@ export default {
|
|
|
});
|
|
|
});
|
|
|
},
|
|
|
- // 删除热区
|
|
|
+ // 删除文本框热区
|
|
|
deletehotspots(index) {
|
|
|
this.data.text_list.splice(index, 1);
|
|
|
if (this.hotspotsActiveIndex === index) {
|
|
|
this.hotspotsActiveIndex = null;
|
|
|
}
|
|
|
},
|
|
|
+ // 删除输入框热区
|
|
|
+ deletehotspotsInput(index) {
|
|
|
+ this.data.input_list.splice(index, 1);
|
|
|
+ if (this.inputActiveIndex === index) {
|
|
|
+ this.inputActiveIndex = null;
|
|
|
+ }
|
|
|
+ },
|
|
|
},
|
|
|
};
|
|
|
</script>
|