|
@@ -51,17 +51,17 @@
|
|
|
<!-- 作者 -->
|
|
|
<!-- 多个作者请用逗号隔开 -->
|
|
|
|
|
|
- <!-- <el-form-item :label="$t('Key227')" prop="author">
|
|
|
+ <el-form-item :label="$t('Key227')" prop="author">
|
|
|
<el-input
|
|
|
v-model="form.author"
|
|
|
style="width: 500px"
|
|
|
:placeholder="$t('Key553')"
|
|
|
@change="authorChange"
|
|
|
-
|
|
|
+ @input="authorInput"
|
|
|
></el-input>
|
|
|
- </el-form-item> -->
|
|
|
+ </el-form-item>
|
|
|
|
|
|
- <el-form-item :label="$t('Key227')" prop="author">
|
|
|
+ <!-- <el-form-item :label="$t('Key227')" prop="author">
|
|
|
<el-tag
|
|
|
:key="tag + i"
|
|
|
v-for="(tag, i) in dynamicTags"
|
|
@@ -90,10 +90,8 @@
|
|
|
@click="showInput"
|
|
|
>
|
|
|
{{ $t("Key151") }}
|
|
|
-
|
|
|
- <!-- 新增教师 -->
|
|
|
</el-button>
|
|
|
- </el-form-item>
|
|
|
+ </el-form-item> -->
|
|
|
<!-- 定价 -->
|
|
|
<el-form-item :label="$t('Key135')" prop="price">
|
|
|
<el-input
|
|
@@ -195,7 +193,7 @@ export default {
|
|
|
file: null,
|
|
|
institutionID: null, //当前机构id
|
|
|
},
|
|
|
- authorList: null,
|
|
|
+ authorList: [],
|
|
|
dynamicTags: [], //教师列表
|
|
|
inputVisible: false,
|
|
|
TeahcerName: "",
|
|
@@ -267,24 +265,31 @@ export default {
|
|
|
});
|
|
|
window.open(href, "_blank");
|
|
|
},
|
|
|
+ // 作者禁止输入数字
|
|
|
+ authorInput() {
|
|
|
+ this.form.author = this.form.author.replace(/[0-9]/g, "");
|
|
|
+ },
|
|
|
// 处理作者数据
|
|
|
authorChange() {
|
|
|
this.form.author = this.form.author.trim();
|
|
|
let index1 = this.form.author.indexOf(",");
|
|
|
let index2 = this.form.author.indexOf(",");
|
|
|
let newauthorList = []; //处理之后的老师
|
|
|
- if (index1 != -1) {
|
|
|
- let arr = this.form.author.split(",");
|
|
|
- arr.forEach((item) => {
|
|
|
- newauthorList.push(item);
|
|
|
- });
|
|
|
- } else if (index2 != -1) {
|
|
|
- let arr = this.form.author.split(",");
|
|
|
+ if (index1 != -1 || index2 != -1) {
|
|
|
+ let str = this.form.author;
|
|
|
+ let newstr = str.replace(/,/g, ",");
|
|
|
+ let arr = newstr.split(",");
|
|
|
arr.forEach((item) => {
|
|
|
- newauthorList.push(item);
|
|
|
+ if (item) {
|
|
|
+ newauthorList.push(item);
|
|
|
+ }
|
|
|
});
|
|
|
} else {
|
|
|
- newauthorList.push(this.form.author);
|
|
|
+ if (this.form.author != "") {
|
|
|
+ newauthorList.push(this.form.author);
|
|
|
+ } else {
|
|
|
+ newauthorList = [];
|
|
|
+ }
|
|
|
}
|
|
|
if (newauthorList.length > 10) {
|
|
|
// 最多只能有10个
|
|
@@ -325,7 +330,7 @@ export default {
|
|
|
// });
|
|
|
if (
|
|
|
!this.form.name ||
|
|
|
- this.dynamicTags.length == 0 ||
|
|
|
+ this.authorList.length == 0 ||
|
|
|
this.form.price == "" ||
|
|
|
!this.form.institutionID
|
|
|
) {
|
|
@@ -387,7 +392,7 @@ export default {
|
|
|
materialinsert({
|
|
|
name: this.form.name,
|
|
|
price: this.form.price,
|
|
|
- teacherList: this.dynamicTags,
|
|
|
+ teacherList: this.authorList,
|
|
|
tenantId: this.form.institutionID,
|
|
|
tagList: tag,
|
|
|
attachmentIdList: res.data.attachmentIdList,
|
|
@@ -426,7 +431,7 @@ export default {
|
|
|
id: this.materialId,
|
|
|
name: this.form.name,
|
|
|
price: this.form.price,
|
|
|
- teacherList: this.dynamicTags,
|
|
|
+ teacherList: this.authorList,
|
|
|
tenantId: this.form.institutionID,
|
|
|
tagList: tag,
|
|
|
attachmentIdList: res.data.attachmentIdList,
|
|
@@ -465,7 +470,7 @@ export default {
|
|
|
for (let key in this.form) {
|
|
|
this.form[key] = res.data.result[key];
|
|
|
}
|
|
|
- this.dynamicTags = res.data.result.teacher;
|
|
|
+ this.authorList = res.data.result.teacher;
|
|
|
this.loading = false;
|
|
|
this.isSubmit = true;
|
|
|
this.form.fileList = JSON.parse(res.data.result.attachment);
|
|
@@ -606,7 +611,7 @@ export default {
|
|
|
font-size: 16px;
|
|
|
color: #000000;
|
|
|
}
|
|
|
- .upload{
|
|
|
+ .upload {
|
|
|
width: 400px;
|
|
|
}
|
|
|
// .el-upload-list__item-name {
|