课程等修复

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`, // 课程详情
curriculumChapter: `nakadai/nakadai/curriculum/chapter/queryChaptersAndSubsections`, // 根据课程id查询章节小节,树状结构
curriculumGetSubsection: `nakadai/nakadai/curriculum/subsection/getSubsection`, // 根据小节id获取预览文件地址
getProjectBySystemId: 'occupationlab/occupationlab/projectManage/getProjectBySystemId',
getTheMostRecentlyRunProject: 'python/python/getTheMostRecentlyRunProject',
// 权限管理
getUserRolesPermissionMenu: `users/users/user-role/getUserRolesPermissionMenu`,

Binary file not shown.

After

Width:  |  Height:  |  Size: 343 B

@ -2,7 +2,7 @@
<div>
<el-card shadow="hover" class="m-b-20">
<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>
</el-card>
@ -10,12 +10,12 @@
<el-form :disabled="isDetail" label-width="80px" label-suffix=":">
<el-form-item label="课程名称">
<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>
</el-form-item>
<el-form-item label="课程分类">
<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-select>
</div>
@ -34,7 +34,7 @@
:headers="headers"
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>
<i class="el-icon-plus"></i>
<p>上传封面</p>
@ -47,10 +47,10 @@
</el-upload>
</el-form-item>
<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-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>
</el-card>
@ -67,94 +67,59 @@ export default {
data() {
return {
headers: {
token: util.local.get(Setting.tokenKey)
token: util.local.get(Setting.tokenKey)
},
id: this.$route.query.id,
isDetail: Boolean(this.$route.query.show),
username: this.$store.state.name,
classificationId: "",
coverUrl: "",
name: "",
form: {
id: this.$route.query.id,
classificationId: '',
coverUrl: '',
name: '',
description: '',
distinguish: 1
},
classificationList: [],
uploadList: [],
description: "",
submiting: false
submiting: false,
updateTime: 0
};
},
watch: {
// ,
form: {
handler(val){
this.updateTime++
},
deep:true
}
},
mounted() {
this.getClassification();
this.id && this.getData();
this.form.id && this.getData();
},
components: {
quill
},
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() {
this.$get(this.api.queryGlClassification).then(res => {
this.classificationList = res.classificationList;
}).catch(res => {});
},
getData() {
this.$get(`${this.api.getCourse}/${this.id}`).then(res => {
let data = res.course;
this.name = data.name;
this.classificationId = data.classificationId;
this.description = data.description;
this.coverUrl = data.coverUrl;
this.uploadList.push({
name: "cover.jpg",
url: this.coverUrl
});
}).catch(err => {});
this.$get(`${this.api.getCourse}/${this.form.id}`).then(({ course }) => {
this.form = course
this.uploadList.push({
name: "cover.jpg",
url: course.coverUrl
})
}).catch(err => {})
},
handleExceed(files, fileList) { //
util.warningMsg("当前限制选择 1 个文件,如需更换,请删除上一个文件再重新选择!");
},
uploadSuccess(res, file, fileList) {
this.coverUrl = res.data.filesResult.fileUrl;
// this.uploadList.push({ name: file.name, url: response.message.fileUrl });
this.form.coverUrl = res.data.filesResult.fileUrl
},
uploadError(err, file, fileList) {
this.$message({
@ -167,21 +132,62 @@ export default {
return this.$confirm(`确定移除 ${file.name}`);
},
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.coverUrl = "";
this.form.coverUrl = ''
}).catch(res => {});
},
goback() { //
if (this.isDetail) {
this.$router.back();
} else {
this.$confirm("确定返回?未更新的信息将不会保存。", "提示", {
type: "warning"
}).then(() => {
save() {
if (this.submiting) return false
const { form } = this
if (!form.name) return util.warningMsg("请填写课程名称")
if (!form.classificationId) return util.warningMsg("请选择课程分类")
if (!form.coverUrl) return util.warningMsg("请上传课程封面")
this.submiting = true
if (form.id) {
this.$put(this.api.editCourse, form).then(res => {
this.submiting = false;
util.successMsg("修改成功");
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"
:options="rangeList"
@change="rangeChange"
@visible-change="rangeViChange"
@input.native="rangeSearch"></el-cascader>
<el-tag
v-for="(tag, i) in rangeChecked"
@ -249,7 +250,7 @@ export default {
e.value = e.provinceId
e.label = e.provinceName
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)
})
resolve(data)
@ -264,7 +265,7 @@ export default {
e.value = e.cityId
e.label = e.cityName
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)
})
resolve(data)
@ -281,7 +282,7 @@ export default {
e.value = e.schoolId
e.label = e.schoolName
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)
})
resolve(data)
@ -389,10 +390,17 @@ export default {
const name = []
const { rangeChecked } = this
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)
},
//
rangeViChange(e) {
//
if (e) {
this.rangeList = []
}
},
//
getSchool() {
this.$get(this.api.querySchoolData).then(({ list }) => {

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

@ -49,7 +49,7 @@
</div>
<div class="catalog">
<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 class="list">
<h4 class="title">{{ courseName }}</h4>
@ -78,12 +78,19 @@
<h4 style="margin-bottom: 10px">课程目标</h4>
<p>{{ teachingObjectives }}</p>
</el-card>
<!--
<el-card shadow="hover" class="m-b-20">
<h4 style="margin-bottom: 10px">课程进度</h4>
<el-progress :text-inside="true" :stroke-width="16" :percentage="70"></el-progress>
</el-card>
-->
<el-dialog title="请选择项目" v-loading="loading" :visible.sync="projectVisible" width="828px" custom-class="project-dia" :close-on-click-modal="false">
<ul class="projects">
<li v-for="(item, i) in projects" :key="i" :class="{active: curProject == item.projectId}" @click="selectProject(item)">
<img src="@/assets/img/project.png" alt="">
<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>
</template>
@ -130,7 +137,11 @@ export default {
currentPage: 0, // pdf
pageCount: 0, // pdf
fileType: "pdf", //
desShrink: false
desShrink: false,
projectVisible: false,
projects: [],
loading: false,
curProject: ''
};
},
computed: {
@ -289,32 +300,84 @@ export default {
loadPdfHandler(e) {
this.currentPage = 1;
},
goSystem() { //
const id = this.systemIds
let href = ''
//
selectProject(item) {
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 roleId = this.roleId == 4 ? 0 : 1;
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`
} else if (id == 21) {
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 (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`);
} 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`);
} else {
// python
util.cookies.set("assessmentId", "", -1);
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
// python
this.toPython(this.curProject)
}
}
}
@ -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>
Loading…
Cancel
Save