|
|
@@ -92,12 +92,33 @@
|
|
|
</div>
|
|
|
<div class="match-info">
|
|
|
<label>关联生词:</label>
|
|
|
- <el-input v-model="itemActive.matchWords"></el-input>
|
|
|
+ <el-input
|
|
|
+ v-model="itemActive.matchWords"
|
|
|
+ placeholder="请输入生词表的“生词/短语”"
|
|
|
+ @blur="onBlur(itemActive, 'matchWords')"
|
|
|
+ ></el-input>
|
|
|
</div>
|
|
|
<div class="match-info">
|
|
|
<label>关联注释:</label>
|
|
|
- <el-input v-model="itemActive.matchNotes"></el-input>
|
|
|
+ <el-input
|
|
|
+ v-model="itemActive.matchNotes"
|
|
|
+ placeholder="请输入注释表的“内容”"
|
|
|
+ @blur="onBlur(itemActive, 'matchNotes')"
|
|
|
+ ></el-input>
|
|
|
</div>
|
|
|
+ <el-upload
|
|
|
+ action="no"
|
|
|
+ accept="image/*,video/*"
|
|
|
+ :file-list="itemActive.img"
|
|
|
+ :http-request="handleImage"
|
|
|
+ :before-upload="handleBeforeImage"
|
|
|
+ :on-exceed="handleExceed"
|
|
|
+ :limit="1"
|
|
|
+ class="upload-resource"
|
|
|
+ v-if="data.type === 'article'"
|
|
|
+ >
|
|
|
+ <div class="remark-box"><i class="el-icon-upload"></i>上传图片</div>
|
|
|
+ </el-upload>
|
|
|
<div class="btn-box">
|
|
|
<el-button type="info" size="small" @click="cancleDialog">取消</el-button>
|
|
|
<el-button type="primary" size="small" @click="surePinyin">保存</el-button>
|
|
|
@@ -109,7 +130,7 @@
|
|
|
|
|
|
<script>
|
|
|
// import { publicMethods, reparse } from '@/api/api';
|
|
|
-import th from 'element-ui/lib/locale/lang/th';
|
|
|
+import { fileUpload } from '@/api/app';
|
|
|
|
|
|
export default {
|
|
|
components: {},
|
|
|
@@ -151,6 +172,9 @@ export default {
|
|
|
this.getArticleData();
|
|
|
},
|
|
|
methods: {
|
|
|
+ onBlur(item, field) {
|
|
|
+ item[field] = item[field] ? item[field].trim() : '';
|
|
|
+ },
|
|
|
// 获取分析结果
|
|
|
getArticleData() {
|
|
|
this.loading = true;
|
|
|
@@ -255,6 +279,29 @@ export default {
|
|
|
this.$set(this.itemActive, 'border', style.border);
|
|
|
}
|
|
|
},
|
|
|
+ // 处理超出图片个数操作
|
|
|
+ handleExceed(files, fileList) {
|
|
|
+ this.$message.warning(
|
|
|
+ `当前限制选择 1 个文件,本次选择了 ${files.length} 个文件,共选择了 ${files.length + fileList.length} 个文件`,
|
|
|
+ );
|
|
|
+ },
|
|
|
+ // 图片上传前处理
|
|
|
+ handleBeforeImage(file) {
|
|
|
+ // 判断文件是否为图片
|
|
|
+ if (!file.type.includes('image')) {
|
|
|
+ this.$message.error('请选择图片文件');
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ },
|
|
|
+ // 图片上传
|
|
|
+ handleImage(file) {
|
|
|
+ fileUpload('Mid', file, { isGlobalprogress: true }).then(({ file_info_list }) => {
|
|
|
+ if (file_info_list.length > 0) {
|
|
|
+ this.itemActive.img = file_info_list;
|
|
|
+ this.itemActive.img[0].name = file_info_list[0].file_name;
|
|
|
+ }
|
|
|
+ });
|
|
|
+ },
|
|
|
},
|
|
|
};
|
|
|
</script>
|
|
|
@@ -477,6 +524,23 @@ export default {
|
|
|
width: 100px;
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
+.remark-box {
|
|
|
+ display: flex;
|
|
|
+ gap: 8px;
|
|
|
+ align-items: center;
|
|
|
+ justify-content: center;
|
|
|
+ width: fit-content;
|
|
|
+ height: 24px;
|
|
|
+ padding: 2px 12px;
|
|
|
+ font-size: 12px;
|
|
|
+ font-weight: 400;
|
|
|
+ line-height: 20px; /* 166.667% */
|
|
|
+ color: #165dff;
|
|
|
+ cursor: pointer;
|
|
|
+ border: 1px solid #165dff;
|
|
|
+ border-radius: 2px;
|
|
|
+}
|
|
|
</style>
|
|
|
<style lang="scss">
|
|
|
.check-article {
|