|
@@ -259,6 +259,7 @@ export default {
|
|
|
});
|
|
|
this.data.answer.answer_list = answer_list;
|
|
|
},
|
|
|
+ // 音频上传前处理
|
|
|
handleBeforeAudio(file) {
|
|
|
if (this.curRole.length <= 0) {
|
|
|
this.$message.error('请先选择角色');
|
|
@@ -270,6 +271,7 @@ export default {
|
|
|
return false;
|
|
|
}
|
|
|
},
|
|
|
+ // 图片上传前处理
|
|
|
handleBeforeImage(file) {
|
|
|
if (this.curRole.length <= 0) {
|
|
|
this.$message.error('请先选择角色');
|
|
@@ -281,12 +283,15 @@ export default {
|
|
|
return false;
|
|
|
}
|
|
|
},
|
|
|
+ // 音频上传
|
|
|
handleAudio(file) {
|
|
|
this.upload('audio', file);
|
|
|
},
|
|
|
+ // 图片上传
|
|
|
handleImage(file) {
|
|
|
this.upload('image', file);
|
|
|
},
|
|
|
+ // 上传
|
|
|
upload(type, file) {
|
|
|
fileUpload('Mid', file, { isGlobalprogress: true }).then(({ file_info_list }) => {
|
|
|
if (file_info_list.length > 0) {
|
|
@@ -299,6 +304,7 @@ export default {
|
|
|
}
|
|
|
});
|
|
|
},
|
|
|
+ // 处理输入文本
|
|
|
handleText() {
|
|
|
if (this.curRole.length <= 0) {
|
|
|
return this.$message.error('请先选择角色');
|
|
@@ -339,12 +345,21 @@ export default {
|
|
|
});
|
|
|
this.textInput = '';
|
|
|
},
|
|
|
+ /**
|
|
|
+ * 移动选项
|
|
|
+ * @param {'up'|'down'} type 类型
|
|
|
+ * @param {number} i 索引
|
|
|
+ */
|
|
|
moveOption(type, i) {
|
|
|
if ((type === 'up' && i === 0) || (type === 'down' && i === this.data.option_list.length - 1)) return;
|
|
|
const item = this.data.option_list[i];
|
|
|
this.data.option_list.splice(i, 1);
|
|
|
this.data.option_list.splice(type === 'up' ? i - 1 : i + 1, 0, item);
|
|
|
},
|
|
|
+ /**
|
|
|
+ * 删除选项
|
|
|
+ * @param {number} i 索引
|
|
|
+ */
|
|
|
deleteOption(i) {
|
|
|
let type = this.data.option_list[i].type;
|
|
|
this.data.option_list.splice(i, 1);
|
|
@@ -353,6 +368,10 @@ export default {
|
|
|
this.identifyText();
|
|
|
}
|
|
|
},
|
|
|
+ /**
|
|
|
+ * 保存音频
|
|
|
+ * @param {string} file_id 文件id
|
|
|
+ */
|
|
|
saveWav(file_id) {
|
|
|
this.data.option_list.push({
|
|
|
role: this.curRole,
|