|
@@ -50,7 +50,8 @@
|
|
|
</el-select>
|
|
|
</el-form-item>
|
|
|
|
|
|
- <el-form-item label="授课教师" class="teacher-tag">
|
|
|
+ <el-form-item v-if="!is_template" label="授课教师" class="teacher-tag">
|
|
|
+ <el-button class="teacher" icon="el-icon-plus" circle @click="selectTeacher" />
|
|
|
<el-tag
|
|
|
v-for="(item, i) in user_list"
|
|
|
:key="item.id"
|
|
@@ -60,7 +61,6 @@
|
|
|
>
|
|
|
{{ item.real_name }}
|
|
|
</el-tag>
|
|
|
- <el-button class="teacher" icon="el-icon-plus" circle @click="selectTeacher" />
|
|
|
</el-form-item>
|
|
|
|
|
|
<el-form-item label="课程周期">
|
|
@@ -104,6 +104,8 @@
|
|
|
</el-form-item>
|
|
|
</el-form>
|
|
|
</div>
|
|
|
+
|
|
|
+ <!-- 选择教师 -->
|
|
|
<select-teacher
|
|
|
:dialog-visible="dialogVisible"
|
|
|
:org-id="form.org_id"
|
|
@@ -126,8 +128,13 @@ export default {
|
|
|
name: 'CourseInfo',
|
|
|
components: { StepBar, SelectTeacher },
|
|
|
data() {
|
|
|
+ let query = this.$route.query;
|
|
|
+
|
|
|
return {
|
|
|
- id: this.$route.query.id,
|
|
|
+ id: query.id,
|
|
|
+ is_template: 'is_template' in query ? query.is_template : false,
|
|
|
+ is_use_template: 'is_use_template' in query ? query.is_use_template : false,
|
|
|
+ template_id: 'template_id' in query ? query.template_id : '',
|
|
|
form: {
|
|
|
imageUrl: '',
|
|
|
picture_id: '',
|
|
@@ -157,7 +164,43 @@ export default {
|
|
|
this.orgList = org_list;
|
|
|
});
|
|
|
if (this.id) {
|
|
|
- GetCourseInfo_ContainCSItem({ id: this.id }).then(
|
|
|
+ this.getCourseInfo_ContainCSItem(this.id);
|
|
|
+ }
|
|
|
+ if (this.is_use_template) {
|
|
|
+ this.getCourseInfo_ContainCSItem(this.template_id);
|
|
|
+ }
|
|
|
+ },
|
|
|
+ methods: {
|
|
|
+ nextStep() {
|
|
|
+ this.$refs.form.validate(valid => {
|
|
|
+ if (valid) {
|
|
|
+ if (this.id) {
|
|
|
+ this.form.id = this.id;
|
|
|
+ UpdateCourse(this.form).then(() => {
|
|
|
+ this.$message.success('修改课程成功!');
|
|
|
+ this.$router.push({
|
|
|
+ path: `/create_course_step_table/select_book/${this.id}?is_template=${this.is_template}`
|
|
|
+ });
|
|
|
+ });
|
|
|
+ } else {
|
|
|
+ this.form.is_template = this.is_template;
|
|
|
+ this.form.is_use_template = this.is_use_template;
|
|
|
+ this.form.template_id = this.template_id;
|
|
|
+
|
|
|
+ CreateCourse(this.form).then(res => {
|
|
|
+ this.$message.success('创建课程成功!');
|
|
|
+ this.$router.push({
|
|
|
+ path: `/create_course_step_table/select_book/${res.id}?is_template=${this.is_template}`
|
|
|
+ });
|
|
|
+ });
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ });
|
|
|
+ },
|
|
|
+ getCourseInfo_ContainCSItem(id) {
|
|
|
+ GetCourseInfo_ContainCSItem({ id }).then(
|
|
|
({
|
|
|
name,
|
|
|
org_id,
|
|
@@ -187,34 +230,14 @@ export default {
|
|
|
this.form.price = price;
|
|
|
this.form.is_enable_KHPJ = is_enable_KHPJ === 'true';
|
|
|
this.form.is_enable_XYZP = is_enable_XYZP === 'true';
|
|
|
- teacher_list.forEach(item => {
|
|
|
- this.form.teacher_id_list.push(item.teacher_id);
|
|
|
- this.user_list.push({ id: item.teacher_id, real_name: item.teacher_name });
|
|
|
- });
|
|
|
- }
|
|
|
- );
|
|
|
- }
|
|
|
- },
|
|
|
- methods: {
|
|
|
- nextStep() {
|
|
|
- this.$refs.form.validate(valid => {
|
|
|
- if (valid) {
|
|
|
- if (this.id) {
|
|
|
- this.form.id = this.id;
|
|
|
- UpdateCourse(this.form).then(() => {
|
|
|
- this.$message.success('修改课程成功!');
|
|
|
- this.$router.push({ path: `/create_course_step_table/select_book/${this.id}` });
|
|
|
- });
|
|
|
- } else {
|
|
|
- CreateCourse(this.form).then(res => {
|
|
|
- this.$message.success('创建课程成功!');
|
|
|
- this.$router.push({ path: `/create_course_step_table/select_book/${res.id}` });
|
|
|
+ if (!this.is_template) {
|
|
|
+ teacher_list.forEach(item => {
|
|
|
+ this.form.teacher_id_list.push(item.teacher_id);
|
|
|
+ this.user_list.push({ id: item.teacher_id, real_name: item.teacher_name });
|
|
|
});
|
|
|
}
|
|
|
- } else {
|
|
|
- return false;
|
|
|
}
|
|
|
- });
|
|
|
+ );
|
|
|
},
|
|
|
beforeUpload(file) {
|
|
|
let isImage = /^image/.test(file.type);
|
|
@@ -296,7 +319,7 @@ export default {
|
|
|
}
|
|
|
|
|
|
.teacher-tag .el-tag {
|
|
|
- margin-right: 16px;
|
|
|
+ margin-left: 16px;
|
|
|
}
|
|
|
|
|
|
.teacher {
|