Commit b263c6e0 authored by zhangjing's avatar zhangjing
Browse files

关于课时的选择

No related merge requests found
Showing with 89 additions and 27 deletions
+89 -27
......@@ -123,3 +123,11 @@ export function getKnowledgePointsInfoList(data) {
}
// 根据课程id获取课时数据
export function getCourseLessonData(params) {
return request({
url: '/auth/studentCourseTable/showTimeList',
method: 'get',
params
})
}
......@@ -59,7 +59,9 @@ export function rules() {
}],
fileDir: [{
validator: (rule, value, callback) => {
if(!value || !value.length) {
if (!this.form.courseLessonNum) {
callback(new Error('请选择课时'));
} else if(!value) {
callback(new Error('请选择目录'));
} else {
callback();
......
import {
getGradeBySchoolSection,
getTextbookByTextbookVersion,
getTextbookChaptersByTextbookId,
getKnowledgePointsInfoList,
addSync,
getSyncById,
editSync,
updateAuditedStatus,
getFolderData
getFolderData,
getCourseLessonData
} from '@/api/sync';
import { getSubjectByParams, getTextbookVersionByParams, getCourseList } from '@/api/common';
import { getCourseList } from '@/api/common';
import { parseTime, fileFormat, byteChange, showLabel } from '@/utils/index';
import { mapActions, mapGetters } from 'vuex';
import { rules } from './asset/rules.js';
......@@ -29,11 +26,12 @@ export default {
id: '',
name: '',
semester: '',
academic: [],
academic: '',
course: '',
courseSn: '',
fileDir: [],
fileDir: '',
courseLessonNum: '',
// ifOpen: 1,
type: 0,
enabled: 1,
......@@ -49,7 +47,8 @@ export default {
clickTotal: '',
},
fileList: [],
courseLessonData: [], // 课时数据
course: [],
schemaCourse: {},
......@@ -67,9 +66,11 @@ export default {
if (this.$route.query.id) {
await this.fetchData();// 编辑
if (this.form.semester && this.form.academic) {
var academic = Array.isArray(this.form.academic) ? this.form.academic[this.form.academic.length-1] : this.form.academic;
if (this.form.semester && academic) {
getCourseList({
unitId: this.form.academic,
unitId: academic,
semesterId: this.form.semester,
}).then(res => {
this.course = res.result;
......@@ -126,11 +127,15 @@ export default {
this.form.course = '';
this.form.courseSn = '';
this.form.courseLessonNum = '';
this.courseLessonNum = [];
// 目录数据
this.dirData = [];
this.form.parentId = '';
if (this.form.semester && this.form.academic && this.form.academic.length) {
var academic = Array.isArray(this.form.academic) ? this.form.academic[this.form.academic.length-1] : this.form.academic;
if (this.form.semester && academic) {
this.getCourseList();
}
......@@ -145,7 +150,13 @@ export default {
this.dirData = [];
this.form.parentId = '';
if (this.form.semester && this.form.academic && this.form.academic.length) {
this.form.fileDir = [];
this.form.courseLessonNum = '';
this.courseLessonNum = [];
var academic = Array.isArray(this.form.academic) ? this.form.academic[this.form.academic.length-1] : this.form.academic;
if (this.form.semester && academic) {
this.getCourseList();
}
},
......@@ -154,16 +165,32 @@ export default {
// 目录数据
this.dirData = [];
this.form.parentId = '';
// 课时数据
this.courseLessonData = [];
this.form.courseLessonNum = '';
this.form.fileDir = [];
if (value) {
this.form.courseSn = this.schemaCourse[value].courseRoomSn;
this.getFolderData();
this.getCourseLessonData();
}
},
getCourseLessonData() {
getCourseLessonData({
openCourseNum: this.form.courseSn,
tremId: this.form.semester,
showFlag: false
}).then(res => {
this.courseLessonData = res.result;
});
},
// 获取课程
getCourseList() {
var academic = Array.isArray(this.form.academic) ? this.form.academic[this.form.academic.length-1] : this.form.academic;
getCourseList({
unitId: this.form.academic[this.form.academic.length-1],
unitId: academic,
semesterId: this.form.semester,
}).then(res => {
this.course = res.result;
......@@ -282,15 +309,8 @@ export default {
}
}
var academic = '';
if (this.form.academic && this.form.academic.length && typeof this.form.academic === 'object') {
academic = this.form.academic[this.form.academic.length - 1]
} else if (typeof this.form.academic === 'string') {
academic = this.form.academic;
} else {
academic = '';
}
var academic = Array.isArray(this.form.academic) ? this.form.academic[this.form.academic.length-1] : this.form.academic;
var fileDir = Array.isArray(this.form.fileDir) ? this.form.fileDir[this.form.fileDir.length - 1] : this.form.fileDir;
var params = {
id: this.form.id,
......@@ -302,7 +322,7 @@ export default {
semesterId: this.form.semester,
resourceTypeId: this.form.type,
parentId: this.form.fileDir[this.form.fileDir.length - 1],
parentId: fileDir,
enabled: this.form.enabled,
// ifOpen: this.form.ifOpen,
......@@ -312,6 +332,7 @@ export default {
sourceFileName: this.form.sourceFileName,
resourceFormat: formatCode,
ifFolder: 0,
courseLessonNum: this.form.courseLessonNum,
ifAdmin: true // 为了分辨是否是管理员上传
};
......@@ -355,10 +376,17 @@ export default {
enshrineTotal: res.result.enshrineTotal,
clickTotal: res.result.clickTotal,
fileDir: res.result.parentId,
courseLessonNum: res.result.courseLessonNum,
verifiedUserRealName: res.result.verifiedUserRealName,
verifiedDate: res.result.verifiedDate,
};
};
if (this.form.courseSn && this.form.semester) {
this.getCourseLessonData();
}
if (this.form.file) {
// 视频、音频
// var typeFormat = ['mp4', 'wmv', 'flv', 'f4v', 'avi', 'mp3', 'wma'];
......
......@@ -33,7 +33,7 @@
}
.el-form {
width: 680px;
width: 720px;
margin: 50px auto 0;
}
......@@ -95,4 +95,11 @@
.save {
margin-left: 140px;
}
.class-lesson {
.el-input {
width: 200px;
margin-right: 10px;
}
}
}
\ No newline at end of file
......@@ -82,8 +82,25 @@
</section>
</el-form-item>
<el-form-item label="所属目录:" prop="fileDir">
<el-select
v-model="form.courseLessonNum"
placeholder="选择课时"
style="float: left"
class="class-lesson"
:disabled="!form.course"
@change="form.catalog=[]"
clearable>
<el-option
:label="item.name"
:value="item.id"
:key="key"
v-for="(item, key) in courseLessonData"
></el-option>
</el-select>
<el-cascader
clearable
class="class-lesson"
:disabled="!form.courseLessonNum"
placeholder="选择课程下的文件目录"
:options="dirData"
v-model="form.fileDir"
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment