|
@@ -1,14 +1,15 @@
|
|
|
<!-- -->
|
|
|
<template>
|
|
|
<div class="NPC-da-role">
|
|
|
- <div class="NPC-da-role-flex">
|
|
|
- <span class="NPC-da-role-text">角色:</span>
|
|
|
+ <div class="adult-book-input-item NPC-da-role-flex">
|
|
|
+ <span class="adult-book-lable">角色:</span>
|
|
|
<el-input
|
|
|
- style="width: 100px"
|
|
|
+ style="width: 110px"
|
|
|
class="NPC-role-input"
|
|
|
placeholder="请输入角色"
|
|
|
- v-model="curRole.roleName"
|
|
|
- @blur="onBlur(curRole, 'roleName')"
|
|
|
+ v-model="curRole.role"
|
|
|
+ @change="changeRole"
|
|
|
+ @blur="onBlur(curRole, 'role')"
|
|
|
></el-input>
|
|
|
<span style="margin-right: 10px">或</span>
|
|
|
<Upload
|
|
@@ -19,31 +20,37 @@
|
|
|
:uploadType="'image'"
|
|
|
/>
|
|
|
</div>
|
|
|
- <div class="NPC-da-role-flex">
|
|
|
- <span class="NPC-da-role-text">姓名:</span>
|
|
|
+ <div class="adult-book-input-item">
|
|
|
+ <span class="adult-book-lable">姓名:</span>
|
|
|
<el-input
|
|
|
class="NPC-role-input"
|
|
|
placeholder="请输入内容"
|
|
|
- v-model="curRole.fullName"
|
|
|
- @blur="onBlur(curRole, 'fullName')"
|
|
|
+ v-model="curRole.detail.fullName"
|
|
|
+ @blur="onBlur(curRole.detail, 'fullName')"
|
|
|
></el-input>
|
|
|
- <el-button type="danger" @click="segWord(curRole.fullName)"
|
|
|
+ <el-button type="danger" @click="segWord(curRole.detail.fullName)"
|
|
|
>分词</el-button
|
|
|
>
|
|
|
</div>
|
|
|
- <div class="NPC-da-role-flex">
|
|
|
- <span class="NPC-da-role-text">分词结果:</span>
|
|
|
+ <div class="adult-book-input-item">
|
|
|
+ <span class="adult-book-lable">分词结果:</span>
|
|
|
<el-input
|
|
|
class="NPC-role-input"
|
|
|
placeholder="请输入分词结果"
|
|
|
- v-model="curRole.seg_words"
|
|
|
+ v-model="curRole.detail.seg_words"
|
|
|
@change="handleChange"
|
|
|
- @blur="onBlur(curRole, 'seg_words')"
|
|
|
+ @blur="onBlur(curRole.detail, 'seg_words')"
|
|
|
></el-input>
|
|
|
<el-button type="danger" @click="_createPinyin">生成拼音</el-button>
|
|
|
</div>
|
|
|
- <div v-if="curRole && curRole.wordsList && curRole.wordsList.length > 0">
|
|
|
- <Pinyin :wordsList="curRole.wordsList" />
|
|
|
+ <div
|
|
|
+ v-if="
|
|
|
+ curRole &&
|
|
|
+ curRole.detail.wordsList &&
|
|
|
+ curRole.detail.wordsList.length > 0
|
|
|
+ "
|
|
|
+ >
|
|
|
+ <Pinyin :wordsList="curRole.detail.wordsList" />
|
|
|
</div>
|
|
|
</div>
|
|
|
</template>
|
|
@@ -77,10 +84,15 @@ export default {
|
|
|
onBlur(item, field) {
|
|
|
item[field] = item[field] ? item[field].trim() : "";
|
|
|
},
|
|
|
+ changeRole(val) {
|
|
|
+ if (val && this.curRole.img_list.length > 0) {
|
|
|
+ this.curRole.img_list.splice(0, 1);
|
|
|
+ }
|
|
|
+ },
|
|
|
handleChange(val) {
|
|
|
- this.curRole.seg_words = val.replace(/\s+/g, " ");
|
|
|
- let arr = this.curRole.seg_words.split(/\s+/);
|
|
|
- this.$set(this.curRole, "segList", arr);
|
|
|
+ this.curRole.detail.seg_words = val.replace(/\s+/g, " ");
|
|
|
+ let arr = this.curRole.detail.seg_words.split(/\s+/);
|
|
|
+ this.$set(this.curRole.detail, "segList", arr);
|
|
|
},
|
|
|
//生成分词
|
|
|
segWord(sentence) {
|
|
@@ -101,21 +113,21 @@ export default {
|
|
|
BatchSegContent(data).then((res) => {
|
|
|
this.loading = false;
|
|
|
let list = res.data.result.list;
|
|
|
- this.$set(this.curRole, "segList", list);
|
|
|
+ this.$set(this.curRole.detail, "segList", list);
|
|
|
let seg_words = list.join(" ");
|
|
|
- this.$set(this.curRole, "seg_words", seg_words);
|
|
|
+ this.$set(this.curRole.detail, "seg_words", seg_words);
|
|
|
});
|
|
|
},
|
|
|
//生成拼音
|
|
|
_createPinyin() {
|
|
|
- let res_str = this.curRole.seg_words.replace(/\s+/g, "");
|
|
|
- let org_sent = this.curRole.fullName;
|
|
|
+ let res_str = this.curRole.detail.seg_words.replace(/\s+/g, "");
|
|
|
+ let org_sent = this.curRole.detail.fullName;
|
|
|
if (res_str.trim() != org_sent.trim()) {
|
|
|
this.$message.warning("跟原句不一致,请检查是否误删除或新增其他内容");
|
|
|
return;
|
|
|
}
|
|
|
let textListList = [];
|
|
|
- let segArr = JSON.parse(JSON.stringify(this.curRole.segList));
|
|
|
+ let segArr = JSON.parse(JSON.stringify(this.curRole.detail.segList));
|
|
|
segArr.forEach((item) => {
|
|
|
let str = Base64.encode(item);
|
|
|
textListList.push(str);
|
|
@@ -125,7 +137,7 @@ export default {
|
|
|
};
|
|
|
createPinyin(data).then((res) => {
|
|
|
let wordsList = res.data.result[0];
|
|
|
- this.$set(this.curRole, "wordsList", wordsList);
|
|
|
+ this.$set(this.curRole.detail, "wordsList", wordsList);
|
|
|
});
|
|
|
},
|
|
|
changeImage(fileList) {
|
|
@@ -142,7 +154,8 @@ export default {
|
|
|
}
|
|
|
});
|
|
|
//this.articleImgList = articleImgRes;
|
|
|
- this.curQueItem.img_list = JSON.parse(JSON.stringify(articleImgRes));
|
|
|
+ this.curRole.img_list = JSON.parse(JSON.stringify(articleImgRes));
|
|
|
+ this.curRole.role = "";
|
|
|
},
|
|
|
},
|
|
|
//生命周期 - 创建完成(可以访问当前this实例)
|
|
@@ -170,10 +183,6 @@ export default {
|
|
|
display: flex;
|
|
|
justify-content: flex-start;
|
|
|
align-items: center;
|
|
|
- margin-bottom: 16px;
|
|
|
- .NPC-da-role-text {
|
|
|
- margin-right: 10px;
|
|
|
- }
|
|
|
}
|
|
|
}
|
|
|
</style>
|