课程等修复

Branch_d40a2540
yujialong 2 years ago
parent f0fb411670
commit 100e8ce165
  1. 2
      src/api/index.js
  2. BIN
      src/assets/img/project.png
  3. 166
      src/pages/course/add/index.vue
  4. 16
      src/pages/match/add/index.vue
  5. 43
      src/pages/project/list/index.vue
  6. 158
      src/pages/station/preview/index.vue

@ -18,6 +18,8 @@ export default {
curriculumDetail: `nakadai/nakadai/curriculum/curriculumDetail`, // 课程详情 curriculumDetail: `nakadai/nakadai/curriculum/curriculumDetail`, // 课程详情
curriculumChapter: `nakadai/nakadai/curriculum/chapter/queryChaptersAndSubsections`, // 根据课程id查询章节小节,树状结构 curriculumChapter: `nakadai/nakadai/curriculum/chapter/queryChaptersAndSubsections`, // 根据课程id查询章节小节,树状结构
curriculumGetSubsection: `nakadai/nakadai/curriculum/subsection/getSubsection`, // 根据小节id获取预览文件地址 curriculumGetSubsection: `nakadai/nakadai/curriculum/subsection/getSubsection`, // 根据小节id获取预览文件地址
getProjectBySystemId: 'occupationlab/occupationlab/projectManage/getProjectBySystemId',
getTheMostRecentlyRunProject: 'python/python/getTheMostRecentlyRunProject',
// 权限管理 // 权限管理
getUserRolesPermissionMenu: `users/users/user-role/getUserRolesPermissionMenu`, getUserRolesPermissionMenu: `users/users/user-role/getUserRolesPermissionMenu`,

Binary file not shown.

After

Width:  |  Height:  |  Size: 343 B

@ -2,7 +2,7 @@
<div> <div>
<el-card shadow="hover" class="m-b-20"> <el-card shadow="hover" class="m-b-20">
<div class="flex-between"> <div class="flex-between">
<el-page-header @back="goback" :content="id ? '编辑课程' : '新增课程'"></el-page-header> <el-page-header @back="back" :content="form.id ? '编辑课程' : '新增课程'"></el-page-header>
</div> </div>
</el-card> </el-card>
@ -10,12 +10,12 @@
<el-form :disabled="isDetail" label-width="80px" label-suffix=":"> <el-form :disabled="isDetail" label-width="80px" label-suffix=":">
<el-form-item label="课程名称"> <el-form-item label="课程名称">
<div class="d-inline-block"> <div class="d-inline-block">
<el-input placeholder="请输入课程名称" v-model="name" clearable maxlength="25"></el-input> <el-input placeholder="请输入课程名称" v-model="form.name" clearable maxlength="25"></el-input>
</div> </div>
</el-form-item> </el-form-item>
<el-form-item label="课程分类"> <el-form-item label="课程分类">
<div class="d-inline-block"> <div class="d-inline-block">
<el-select v-model="classificationId" placeholder="请选择课程分类"> <el-select v-model="form.classificationId" placeholder="请选择课程分类">
<el-option v-for="item in classificationList" :key="item.id" :label="item.name" :value="item.id"></el-option> <el-option v-for="item in classificationList" :key="item.id" :label="item.name" :value="item.id"></el-option>
</el-select> </el-select>
</div> </div>
@ -34,7 +34,7 @@
:headers="headers" :headers="headers"
name="file" name="file"
> >
<img v-if="coverUrl" :src="coverUrl" class="avatar"> <img v-if="form.coverUrl" :src="form.coverUrl" class="avatar">
<div class="uploader-default" v-else> <div class="uploader-default" v-else>
<i class="el-icon-plus"></i> <i class="el-icon-plus"></i>
<p>上传封面</p> <p>上传封面</p>
@ -47,10 +47,10 @@
</el-upload> </el-upload>
</el-form-item> </el-form-item>
<el-form-item label="课程介绍"> <el-form-item label="课程介绍">
<quill :border="true" :readonly="isDetail" v-model="description" :height="400" /> <quill :border="true" :readonly="isDetail" v-model="form.description" :height="400" />
</el-form-item> </el-form-item>
<el-form-item> <el-form-item>
<el-button type="primary" v-throttle @click="save" v-show="!isDetail">{{ id ? "更新" : "创建" }}</el-button> <el-button type="primary" v-throttle @click="save" v-show="!isDetail">{{ form.id ? "更新" : "创建" }}</el-button>
</el-form-item> </el-form-item>
</el-form> </el-form>
</el-card> </el-card>
@ -67,94 +67,59 @@ export default {
data() { data() {
return { return {
headers: { headers: {
token: util.local.get(Setting.tokenKey) token: util.local.get(Setting.tokenKey)
}, },
id: this.$route.query.id,
isDetail: Boolean(this.$route.query.show), isDetail: Boolean(this.$route.query.show),
username: this.$store.state.name, form: {
classificationId: "", id: this.$route.query.id,
coverUrl: "", classificationId: '',
name: "", coverUrl: '',
name: '',
description: '',
distinguish: 1
},
classificationList: [], classificationList: [],
uploadList: [], uploadList: [],
description: "", submiting: false,
submiting: false updateTime: 0
}; };
}, },
watch: {
// ,
form: {
handler(val){
this.updateTime++
},
deep:true
}
},
mounted() { mounted() {
this.getClassification(); this.getClassification();
this.id && this.getData(); this.form.id && this.getData();
}, },
components: { components: {
quill quill
}, },
methods: { methods: {
save() {
if (this.submiting) return false;
if (!this.name) return util.warningMsg("请填写课程名称");
if (!this.classificationId) return util.warningMsg("请选择课程分类");
if (!this.coverUrl) return util.warningMsg("请上传课程封面");
this.submiting = true;
let data = {
id: this.id,
classificationId: this.classificationId,
coverUrl: this.coverUrl,
description: this.description,
name: this.name,
founderId: this.userId,
founderName: this.username,
distinguish: 1
};
if (this.id) {
this.$put(this.api.editCourse, data).then(res => {
this.submiting = false;
util.successMsg("修改成功");
this.$router.back();
}).catch(err => {
this.submiting = false;
});
} else {
this.$post(this.api.addCourse, data).then(res => {
this.submiting = false;
this.$confirm("课程创建成功,是否马上进行课程内容设置?", "提示", {
type: "success",
confirmButtonText: "马上设置",
cancelButtonText: "稍后操作"
}).then(() => {
this.$router.push(`/course/contentSettings?id=${res.courseId}`);
}).catch(() => {
this.$router.back();
});
}).catch(err => {
this.submiting = false;
});
}
},
getClassification() { getClassification() {
this.$get(this.api.queryGlClassification).then(res => { this.$get(this.api.queryGlClassification).then(res => {
this.classificationList = res.classificationList; this.classificationList = res.classificationList;
}).catch(res => {}); }).catch(res => {});
}, },
getData() { getData() {
this.$get(`${this.api.getCourse}/${this.id}`).then(res => { this.$get(`${this.api.getCourse}/${this.form.id}`).then(({ course }) => {
let data = res.course; this.form = course
this.name = data.name; this.uploadList.push({
this.classificationId = data.classificationId; name: "cover.jpg",
this.description = data.description; url: course.coverUrl
this.coverUrl = data.coverUrl; })
this.uploadList.push({ }).catch(err => {})
name: "cover.jpg",
url: this.coverUrl
});
}).catch(err => {});
}, },
handleExceed(files, fileList) { // handleExceed(files, fileList) { //
util.warningMsg("当前限制选择 1 个文件,如需更换,请删除上一个文件再重新选择!"); util.warningMsg("当前限制选择 1 个文件,如需更换,请删除上一个文件再重新选择!");
}, },
uploadSuccess(res, file, fileList) { uploadSuccess(res, file, fileList) {
this.coverUrl = res.data.filesResult.fileUrl; this.form.coverUrl = res.data.filesResult.fileUrl
// this.uploadList.push({ name: file.name, url: response.message.fileUrl });
}, },
uploadError(err, file, fileList) { uploadError(err, file, fileList) {
this.$message({ this.$message({
@ -167,21 +132,62 @@ export default {
return this.$confirm(`确定移除 ${file.name}`); return this.$confirm(`确定移除 ${file.name}`);
}, },
handleRemove(file, fileList) { handleRemove(file, fileList) {
let fileName = this.coverUrl.replace("https://liuwanr.oss-cn-shenzhen.aliyuncs.com/", ""); let fileName = this.form.coverUrl.replace('https://huoran.oss-cn-shenzhen.aliyuncs.com/', "");
this.$del(`${this.api.fileDeletion}?keys=${fileName}`).then(res => { this.$del(`${this.api.fileDeletion}?keys=${fileName}`).then(res => {
this.coverUrl = ""; this.form.coverUrl = ''
}).catch(res => {}); }).catch(res => {});
}, },
goback() { // save() {
if (this.isDetail) { if (this.submiting) return false
this.$router.back(); const { form } = this
} else { if (!form.name) return util.warningMsg("请填写课程名称")
this.$confirm("确定返回?未更新的信息将不会保存。", "提示", { if (!form.classificationId) return util.warningMsg("请选择课程分类")
type: "warning" if (!form.coverUrl) return util.warningMsg("请上传课程封面")
}).then(() => { this.submiting = true
if (form.id) {
this.$put(this.api.editCourse, form).then(res => {
this.submiting = false;
util.successMsg("修改成功");
this.$router.back(); this.$router.back();
}).catch(() => {}); }).catch(err => {
this.submiting = false;
});
} else {
this.$post(this.api.addCourse, form).then(res => {
this.submiting = false;
this.$confirm("课程创建成功,是否马上进行课程内容设置?", "提示", {
type: "success",
confirmButtonText: "马上设置",
cancelButtonText: "稍后操作"
}).then(() => {
this.$router.push(`/course/contentSettings?id=${res.courseId}`);
}).catch(() => {
this.$router.back();
});
}).catch(err => {
this.submiting = false;
});
} }
},
//
backPage() {
this.$router.back()
},
back() {
const { id } = this.form
const updateTime = this.updateTime
//
if ((id && updateTime > 2) || (!id && updateTime)) {
this.$confirm(`编辑的内容未保存,是否保存?`, '提示', {
type: 'warning'
}).then(() => {
this.save()
}).catch(() => {
this.backPage()
})
} else {
this.backPage()
}
} }
} }
}; };

@ -156,6 +156,7 @@
:before-filter="beforeFilter" :before-filter="beforeFilter"
:options="rangeList" :options="rangeList"
@change="rangeChange" @change="rangeChange"
@visible-change="rangeViChange"
@input.native="rangeSearch"></el-cascader> @input.native="rangeSearch"></el-cascader>
<el-tag <el-tag
v-for="(tag, i) in rangeChecked" v-for="(tag, i) in rangeChecked"
@ -249,7 +250,7 @@ export default {
e.value = e.provinceId e.value = e.provinceId
e.label = e.provinceName e.label = e.provinceName
e.children = [] e.children = []
e.disabled = !!checked.find(n => n.provinceId == e.provinceId) e.disabled = !!checked.find(n => n.provinceId == e.provinceId && !n.cityId)
data.push(e) data.push(e)
}) })
resolve(data) resolve(data)
@ -264,7 +265,7 @@ export default {
e.value = e.cityId e.value = e.cityId
e.label = e.cityName e.label = e.cityName
e.children = [] e.children = []
e.disabled = !!checked.find(n => n.cityId == e.cityId) e.disabled = !!checked.find(n => n.cityId == e.cityId && n.provinceId == e.provinceId && !n.schoolId)
data.push(e) data.push(e)
}) })
resolve(data) resolve(data)
@ -281,7 +282,7 @@ export default {
e.value = e.schoolId e.value = e.schoolId
e.label = e.schoolName e.label = e.schoolName
e.leaf = true e.leaf = true
e.disabled = !!checked.find(n => n.schoolId == e.schoolId) e.disabled = !!checked.find(n => n.schoolId == e.schoolId && n.cityId == e.cityId && n.provinceId == e.provinceId)
data.push(e) data.push(e)
}) })
resolve(data) resolve(data)
@ -389,10 +390,17 @@ export default {
const name = [] const name = []
const { rangeChecked } = this const { rangeChecked } = this
checked.map(e => { checked.map(e => {
rangeChecked.find(n => n.value === e.value) || name.push(e.data) // push rangeChecked.find(n => n.value === e.value && n.label == e.label) || name.push(e.data) // push
}) })
this.rangeChecked.push(...name) this.rangeChecked.push(...name)
}, },
//
rangeViChange(e) {
//
if (e) {
this.rangeList = []
}
},
// //
getSchool() { getSchool() {
this.$get(this.api.querySchoolData).then(({ list }) => { this.$get(this.api.querySchoolData).then(({ list }) => {

@ -42,16 +42,22 @@
</li> </li>
<li> <li>
<label>课程</label> <label>课程</label>
<el-select v-model="queryData.cid" @change="courseChange"> <el-cascader
v-model="cid"
:options="curs"
:props="{ checkStrictly: true, value: 'id' }"
clearable
@change="curChange"></el-cascader>
<!-- <el-select v-model="queryData.cid" @change="courseChange">
<el-option <el-option
v-for="item in curriculumList" v-for="item in curriculumList"
:key="item.cid" :key="item.cid"
:label="item.curriculumName" :label="item.curriculumName"
:value="item.cid"> :value="item.cid">
</el-option> </el-option>
</el-select> </el-select> -->
</li> </li>
<li> <!-- <li>
<label>系统</label> <label>系统</label>
<el-select v-model="systemId" placeholder="请选择" @change="initData"> <el-select v-model="systemId" placeholder="请选择" @change="initData">
<el-option <el-option
@ -61,7 +67,7 @@
:value="item.id" :value="item.id"
></el-option> ></el-option>
</el-select> </el-select>
</li> </li> -->
<li> <li>
<el-input placeholder="请输入项目名称" prefix-icon="el-icon-search" v-model="keyword" clearable></el-input> <el-input placeholder="请输入项目名称" prefix-icon="el-icon-search" v-model="keyword" clearable></el-input>
</li> </li>
@ -141,7 +147,8 @@ export default {
data() { data() {
return { return {
showBack: Boolean(this.$route.query.show), showBack: Boolean(this.$route.query.show),
roleIdEd: this.roleId ? 13 : this.roleId,// roleId13roleId14113,1413> cid: [],
curs: [],
systemId: "", systemId: "",
systemList: [], systemList: [],
systemListAll: [], systemListAll: [],
@ -278,9 +285,8 @@ export default {
getSystemData() { getSystemData() {
this.$get(this.api.getSystemIdBySchool).then(({ data }) => { this.$get(this.api.getSystemIdBySchool).then(({ data }) => {
this.systemListAll = data this.systemListAll = data
// systemIdsystemIdsystemId
this.getschoolCourse() this.getschoolCourse()
}); }).catch(err => {})
}, },
// //
getschoolCourse() { getschoolCourse() {
@ -288,16 +294,27 @@ export default {
this.curriculumList = data this.curriculumList = data
const { cid } = this.queryData const { cid } = this.queryData
if (data.length) { if (data.length) {
this.queryData.cid = cid || data[0].cid this.cid = [cid || data[0].cid]
this.courseChange() const all = this.systemListAll
data.map(e => {
e.id = e.cid
e.label = e.curriculumName
e.children = all.filter(n => e.systemId.split(',').includes(n.id + '')) //
})
this.curs = data
this.curChange(this.cid)
} }
}).catch(err => {}) }).catch(err => {})
}, },
// //
courseChange(val) { curChange(val) {
const systemIds = this.curriculumList.find(e => e.cid == this.queryData.cid).systemId.split(',') // systemId const cid = val[0]
this.systemList = this.systemListAll.filter(e => systemIds.includes(e.id + '')) // if (val.length === 1) {
this.systemId = this.systemList.length ? this.systemList[0].id : '' //
this.cid = [cid, this.curs.find(e => e.id === cid).children[0].id]
}
this.queryData.cid = cid
this.systemId = this.cid[1]
this.initData() this.initData()
}, },
// //

@ -49,7 +49,7 @@
</div> </div>
<div class="catalog"> <div class="catalog">
<div class="m-b-20"> <div class="m-b-20">
<el-button type="primary" @click="goSystem" style="width: 100%; height: 50px; font-size: 18px"> </el-button> <el-button type="primary" @click="entry" style="width: 100%; height: 50px; font-size: 18px"> </el-button>
</div> </div>
<div class="list"> <div class="list">
<h4 class="title">{{ courseName }}</h4> <h4 class="title">{{ courseName }}</h4>
@ -78,12 +78,19 @@
<h4 style="margin-bottom: 10px">课程目标</h4> <h4 style="margin-bottom: 10px">课程目标</h4>
<p>{{ teachingObjectives }}</p> <p>{{ teachingObjectives }}</p>
</el-card> </el-card>
<!-- <el-dialog title="请选择项目" v-loading="loading" :visible.sync="projectVisible" width="828px" custom-class="project-dia" :close-on-click-modal="false">
<el-card shadow="hover" class="m-b-20"> <ul class="projects">
<h4 style="margin-bottom: 10px">课程进度</h4> <li v-for="(item, i) in projects" :key="i" :class="{active: curProject == item.projectId}" @click="selectProject(item)">
<el-progress :text-inside="true" :stroke-width="16" :percentage="70"></el-progress> <img src="@/assets/img/project.png" alt="">
</el-card> <span>{{ item.projectName }}</span>
--> </li>
</ul>
<span slot="footer" class="dialog-footer">
<el-button size="small" @click="projectVisible = false"> </el-button>
<el-button size="small" type="primary" @click="toSub"> </el-button>
</span>
</el-dialog>
</div> </div>
</template> </template>
@ -130,7 +137,11 @@ export default {
currentPage: 0, // pdf currentPage: 0, // pdf
pageCount: 0, // pdf pageCount: 0, // pdf
fileType: "pdf", // fileType: "pdf", //
desShrink: false desShrink: false,
projectVisible: false,
projects: [],
loading: false,
curProject: ''
}; };
}, },
computed: { computed: {
@ -289,32 +300,84 @@ export default {
loadPdfHandler(e) { loadPdfHandler(e) {
this.currentPage = 1; this.currentPage = 1;
}, },
goSystem() { // //
const id = this.systemIds selectProject(item) {
let href = '' this.curProject = item.projectId
},
//
queryProject() {
this.projectVisible = true
this.loading = true
this.$get(this.api.getProjectBySystemId, {
systemId: this.systemIds,
cId: this.courseId, // id
permissions: 0 // 0: ,1:
}).then(({ projects }) => {
this.loading = false
this.projects = projects
}).catch(res => {})
},
//
entry() {
//
this.$get(this.api.getTheMostRecentlyRunProject, {
cid: this.courseId
}).then(({ data }) => {
// data
if (data && data.length) {
this.$confirm('是否要继续上次的实验?', '提示', {
confirmButtonText: '是',
cancelButtonText: '否',
type: 'success'
}).then(() => {
this.toPython(data[0].projectId)
}).catch(() => {
this.queryProject()
})
} else {
this.queryProject()
}
}).catch(res => {
this.queryProject()
})
},
// python
toPython(projectId) {
const id = this.systemIds
let token = util.local.get(Setting.tokenKey);
util.cookies.set('assessmentId', '', -1)
util.cookies.set('startTime', '', -1)
util.cookies.set('stopTime', '', -1)
projectId ? util.cookies.set('projectId', projectId) : util.cookies.set('projectId', '', -1)
util.cookies.set('token', token)
util.cookies.set('courseId', this.courseId)
util.cookies.set('curriculumName', escape(this.curriculumName))
util.cookies.set('systemId', id)
util.cookies.set('fromManager', 1)
// 8pythoncookiesystemId
location.href = process.env.NODE_ENV === 'development' ?
`http://${location.hostname}:8085/#/` :
Setting.isPro ?
`https://${location.hostname}/pyTrials` :
`${location.origin}/pyTrials`
},
//
toSub() {
const { systemId } = this.projects.find(e => e.projectId == this.curProject)
let token = util.local.get(Setting.tokenKey); let token = util.local.get(Setting.tokenKey);
let roleId = this.roleId == 4 ? 0 : 1; let roleId = this.roleId == 4 ? 0 : 1;
let userName = window.btoa(encodeURIComponent(this.userName)); let userName = window.btoa(encodeURIComponent(this.userName));
if (id == 11) {
if (systemId == 11) {
// //
location.href = `${Setting.bankPath}/#/index/list?token=${token}&cid=${this.courseId}&systemId=${this.assessmentList[0].systemId}&projectId=&assessmentId=&classId=&stopTime=&test=true` location.href = `${Setting.bankPath}/#/index/list?curriculumName=${this.curriculumName}&token=${token}&cid=${this.courseId}&systemId=${this.systemIds}&projectId=${this.curProject}&assessmentId=&classId=&stopTime=&test=true`
} else if (id == 21) { } else if (systemId == 21) {
window.open(`http://121.37.29.24:80/yyyflogin?userId=${this.userId}&userName=${userName}&userType=${roleId}&reqType=1&reqId=3989a0ad671849b99dcbdcc208782333&caseId=9681f86902314b10bc752909121f9ab9&authorization=87DIVy348Oxzj3ha&classId=1876&courserId=7ff5d4715b114b7398b6f26c20fac460`); window.open(`http://121.37.29.24:80/yyyflogin?userId=${this.userId}&userName=${userName}&userType=${roleId}&reqType=1&reqId=3989a0ad671849b99dcbdcc208782333&caseId=9681f86902314b10bc752909121f9ab9&authorization=87DIVy348Oxzj3ha&classId=1876&courserId=7ff5d4715b114b7398b6f26c20fac460`);
} else if (id == 22) { } else if (systemId == 22) {
window.open(`https://danbao.czcyedu.com/#/loginFromYyyf?userId=${this.userId}&userName=${userName}&userType=${roleId}&reqType=1&reqId=eb7d8355119d449184c548b07dc01ed9&caseId=1198241070647873538&authorization=87DIVy348Oxzj3ha&classId=1876&courserId=faaedd82adb9444285a5785e4a3dd4f9`); window.open(`https://danbao.czcyedu.com/#/loginFromYyyf?userId=${this.userId}&userName=${userName}&userType=${roleId}&reqType=1&reqId=eb7d8355119d449184c548b07dc01ed9&caseId=1198241070647873538&authorization=87DIVy348Oxzj3ha&classId=1876&courserId=faaedd82adb9444285a5785e4a3dd4f9`);
} else { } else {
// python // python
util.cookies.set("assessmentId", "", -1); this.toPython(this.curProject)
util.cookies.set("projectId", "", -1);
util.cookies.set("startTime", "", -1);
util.cookies.set("stopTime", "", -1);
util.cookies.set("token", token);
util.cookies.set("courseId", this.courseId);
util.cookies.set("curriculumName", escape(this.curriculumName));
util.cookies.set("systemId", id);
location.href = process.env.NODE_ENV === 'development' ?
`http://${location.hostname}:8085/#/` :
`${location.origin}/pyTrials` // 8pythoncookiesystemId
} }
} }
} }
@ -536,4 +599,45 @@ $height: 700px;
} }
} }
/deep/.project-dia {
.el-dialog__body {
padding: 28px 32px;
}
}
.projects {
display: flex;
flex-wrap: wrap;
max-height: 400px;
overflow: auto;
li {
display: inline-flex;
align-items: center;
width: 238px;
padding: 16px;
margin: 0 20px 20px 0;
background-color: #F6F8FA;
border-radius: 16px;
cursor: pointer;
&:hover {
span {
color: #007EFF;
}
}
&:nth-child(3n) {
margin-right: 0;
}
&.active {
background-color: #f2f7ff;
span {
color: #3988ff;
}
}
}
span {
max-width: 140px;
margin-left: 14px;
font-size: 14px;
color: #333;
}
}
</style> </style>
Loading…
Cancel
Save