diff --git a/package-lock.json b/package-lock.json index 99505cb..2d5f464 100644 --- a/package-lock.json +++ b/package-lock.json @@ -11381,9 +11381,9 @@ } }, "sortablejs": { - "version": "1.10.1", - "resolved": "https://registry.npmjs.org/sortablejs/-/sortablejs-1.10.1.tgz", - "integrity": "sha512-N6r7GrVmO8RW1rn0cTdvK3JR0BcqecAJ0PmYMCL3ZuqTH3pY+9QyqkmJSkkLyyDvd+AJnwaxTP22Ybr/83V9hQ==" + "version": "1.14.0", + "resolved": "https://registry.npmjs.org/sortablejs/-/sortablejs-1.14.0.tgz", + "integrity": "sha512-pBXvQCs5/33fdN1/39pPL0NZF20LeRbLQ5jtnheIPN9JQAaufGjKdWduZn4U7wCtVuzKhmRkI0DFYHYRbB2H1w==" }, "source-list-map": { "version": "2.0.1", diff --git a/package.json b/package.json index 442253c..b3591f0 100644 --- a/package.json +++ b/package.json @@ -15,6 +15,7 @@ "mavon-editor": "^2.6.17", "postcss-px2rem": "^0.3.0", "px2rem-loader": "^0.1.9", + "sortablejs": "^1.14.0", "vue": "^2.6.10", "vue-cropperjs": "^3.0.0", "vue-pdf": "^4.3.0", diff --git a/src/utils/api.js b/src/utils/api.js index ddb499f..6c625e7 100644 --- a/src/utils/api.js +++ b/src/utils/api.js @@ -1,6 +1,6 @@ import Setting from '@/setting'; let host = Setting.host; -let uploadURL = "http://8.134.8.197:8001"; +let uploadURL = "http://39.108.250.202:10000"; export default { @@ -93,6 +93,9 @@ export default { // 判分点 getBcJudgmentPoint: `${host}/judgment/bcJudgmentPoint/getBcJudgmentPoint`, // 获取编程类判分点列表(分页) getLcJudgmentPoint: `${host}/judgment/lcJudgmentPoint/queryAllJudgmentPoint`, // 获取流程类判分点列表(分页) + addProjectJudgment: `${host}occupationlab/projectJudgment/addProjectJudgment`, // 添加项目管理、判分点中间表 + updateProjectJudgment: `${host}occupationlab/projectJudgment/updateProjectJudgment`, // 判分点中间表批量更新 + deleteProjectJudgment: `${host}occupationlab/projectJudgment/deleteProjectJudgment`, // 判分点中间表批量删除 // 课程管理三级联查 courseDiscipline: `${host}/nakadai/nakadai/subject/courseDiscipline`, //课程学科类别 @@ -120,9 +123,9 @@ export default { // 阿里云文件/视频管理 - fileDeletion: `${host}/nakadai/nakadai/oss/fileDeletion`, // 删除OSS文件 - fileupload: `${host}/nakadai/nakadai/oss/fileUpload`, // 文件上传 - getPlayAuth: `${host}/nakadai/nakadai/oss/getPlayAuth`, // 获取播放凭证 + fileDeletion: `${uploadURL}/oss/manage/fileDeletion`, // 删除OSS文件 + fileupload: `${uploadURL}/oss/manage/fileUpload`, // 文件上传 + getPlayAuth: `${uploadURL}/oss/manage/getPlayAuth`, // 获取播放凭证 diff --git a/src/views/course/AddCurriculum.vue b/src/views/course/AddCurriculum.vue index edfac15..69301a0 100644 --- a/src/views/course/AddCurriculum.vue +++ b/src/views/course/AddCurriculum.vue @@ -100,7 +100,7 @@

只能上传jpg/png文件

-

课程封面图将按2:1显示,最佳分辨率1400*700

+

课程封面图将按1:1显示,最佳分辨率80*80

diff --git a/src/views/serve/projectAdd.vue b/src/views/serve/projectAdd.vue index 5d6a95a..7eb8e6c 100644 --- a/src/views/serve/projectAdd.vue +++ b/src/views/serve/projectAdd.vue @@ -6,7 +6,8 @@
- 保存为草稿 + 保存为草稿 + 确定并发布
@@ -23,10 +24,12 @@
- + - + @@ -46,7 +49,8 @@
- +
@@ -61,7 +65,8 @@
- +
@@ -74,7 +79,8 @@ 实验任务
- 进入判分点 + 进入判分点 +
@@ -86,68 +92,64 @@
- 平均分配分值 - 手动分配分值 + + 平均分配分值 + + + 手动分配分值 + (待分配分值: {{ handDistributionScore }}/100分)
- 判分点 - 批量删除 - - - - - - - - - - - - - - - - - - - - + 判分点 + + 批量删除 + +
+ + + + + + + + + + + + + + + + + +
@@ -158,14 +160,16 @@
启用 - +
- +
@@ -175,13 +179,14 @@ -
+
import Setting from "@/setting"; import quill from "@/components/quill"; +import Sortable from "sortablejs"; + export default { components: { quill @@ -222,8 +229,7 @@ export default { data() { return { projectId: this.$route.query.projectId, - systemList: Setting.systemList, - token: btoa(sessionStorage.getItem('token')), + token: btoa(sessionStorage.getItem("token")), isDetail: Boolean(this.$route.query.show), projectManage: { @@ -254,7 +260,8 @@ export default { avgValuelist: [], //取得判分点平均分的数组 searchTimer: null, - isToPoint: false // 判断是否是跳转到判分点系统 + isToPoint: false, // 判断是否是跳转到判分点系统 + visibleLoading: false// 加载判分点数据 }; }, computed: { @@ -302,15 +309,16 @@ export default { this.getInfoData(); } // 判断有没有缓存数据 - if (JSON.stringify(this.projectFields) != '{}') { + if (JSON.stringify(this.projectFields) != "{}") { let { projectManage, projectJudgmentData } = this.projectFields; this.projectManage = projectManage; this.projectJudgmentData = projectJudgmentData; } + this.rowDrop(); }, beforeDestroy() { if (!this.isToPoint) { - this.$store.dispatch('setProject',{}); + this.$store.dispatch("setProject", {}); } }, methods: { @@ -362,7 +370,7 @@ export default { type: "warning" }).then(() => { this.projectJudgmentData = []; - this.$store.dispatch('setSystemId',this.projectManage.systemId); + this.$store.dispatch("setSystemId", this.projectManage.systemId); }).catch(() => { this.projectManage.systemId = this.lastSystemId; console.log(this.lastSystemId, "this.lastSystemId"); @@ -415,7 +423,7 @@ export default { if (!this.judgmentRelease()) { //判断页面是否有没有输入的内容 return; } - this.$store.dispatch('setSystemId',this.projectManage.systemId) + this.$store.dispatch("setSystemId", this.projectManage.systemId); this.projectManage.state = state; let tempArr = this.projectJudgmentData.map(i => { let obj = { @@ -486,12 +494,12 @@ export default { }); } }, - handleMoveUp(index) { // 处理上移 + handleMoveUp(index) { // 处理上移(作废) let x = index; let y = index + 1; this.projectJudgmentData.splice(x - 1, 1, ...this.projectJudgmentData.splice(y - 1, 1, this.projectJudgmentData[x - 1])); }, - handleMoveDown(index) { // 处理下移 + handleMoveDown(index) { // 处理下移(作废) let x = index + 1; let y = index + 2; this.projectJudgmentData.splice(x - 1, 1, ...this.projectJudgmentData.splice(y - 1, 1, this.projectJudgmentData[x - 1])); @@ -553,6 +561,7 @@ export default { } }, getProcessClassData(params) { // 获取流程类判分点列表数据 + this.visibleLoading = true; this.$post(`${this.api.getLcJudgmentPoint}`, params).then(res => { if (res.status === 200) { let list = res.message.records; @@ -561,6 +570,7 @@ export default { i.judgmentId = i.lcId; this.projectJudgmentData.find(j => j.judgmentId === i.judgmentId) || result.push(i); }); + this.visibleLoading = false; this.judgementData = result; } }).catch(err => { @@ -568,6 +578,7 @@ export default { }); }, getProgrammingClassData(params) { // 获取编程类判分点列表数据 + this.visibleLoading = true; this.$post(this.api.getBcJudgmentPoint, params).then(res => { if (res.status === 200) { let list = res.message.records; @@ -576,9 +587,9 @@ export default { i.judgmentId = i.bcId; this.projectJudgmentData.find(j => j.judgmentId === i.judgmentId) || result.push(i); }); + this.visibleLoading = false; this.judgementData = result; } - }).catch(err => { console.log(err); }); @@ -589,34 +600,139 @@ export default { addJudgment() { // 确认选择判分点 if (this.selectedJudgment.length) { this.dialogVisible = false; - let tempArr = this.selectedJudgment.map(i => { - i.score = 0; - return i; - }); - this.projectJudgmentData = this.projectJudgmentData.concat(tempArr); - this.$nextTick(() => { - this.$refs.projectJudgementTable.clearSelection(); - }); + if (this.projectId) { // 编辑的时候,新增调接口 + this.addProjectJudgment(); + } else { + // 新增时,假添加 + let tempArr = this.selectedJudgment.map(i => { + i.score = 0; + return i; + }); + this.projectJudgmentData = this.projectJudgmentData.concat(tempArr); + this.projectJudgmentData.map((e, i) => { + e.sort = i + 1; + }); + this.$nextTick(() => { + this.$refs.projectJudgementTable.clearSelection(); + }); + } } else { this.$message.warning("请选择判分点"); } }, + // 行拖拽 + rowDrop() { + // 此时找到的元素是要拖拽元素的父容器 + const tbody = document.querySelector(".draggable .el-table__body-wrapper tbody"); + const _this = this; + Sortable.create(tbody, { + // 指定父元素下可被拖拽的子元素 + draggable: ".draggable .el-table__row", + onEnd({ newIndex, oldIndex }) { + let newItem = _this.projectJudgmentData[newIndex]; + _this.projectJudgmentData[newIndex] = _this.projectJudgmentData[oldIndex]; + _this.projectJudgmentData[oldIndex] = newItem; + // 循环,重新赋值排序赋值 + _this.projectJudgmentData.forEach((e, i) => { + _this.$set(e, "sort", i + 1);// 不更新 + _this.$set(e, "name", e.name + "?"); + _this.$set(e, "name", e.name.slice(0, e.name.length - 1)); // 不更新的解决方案 + }); + // 调修改接口,更新列表 + if (_this.projectId) {// 如果是编辑项目,则调编辑接口 + _this.updateProjectJudgment(); + } + } + }); + }, + // 添加判分点中间表 + addProjectJudgment() { + let param = this.selectedJudgment.map((e, i) => { + let obj = { + judgmentId: e.judgmentId, + projectId: this.projectId || "", + score: 0, + sort: i + 1 + }; + return obj; + }); + console.log(param, "param", this.projectId); + this.$post(this.api.addProjectJudgment, param).then(res => { + // 重新调接口 + console.log("添加成功", res); + if (this.projectId) { // 有项目id,调接口,没有项目id,手动更新 + this.listAgain(); + } + }).catch(err => { + console.log(err); + }); + + }, + // 修改判分点中间表 + updateProjectJudgment() { + // 直接传data回去 + let param = this.projectJudgmentData.map((e, i) => { + let obj = { + judgmentId: e.judgmentId, + projectId: this.projectId || "", + score: e.score, + sort: i + 1, + id: e.id + }; + return obj; + }); + this.$post(this.api.updateProjectJudgment, param).then(res => { + + // 重新调接口 + if (this.projectId) { // 有项目id,调接口,没有项目id,手动更新 + this.listAgain(); + } + }).catch(err => { + console.log(err); + }); + }, + // 批量删除判分点中间表 + deleteProjectJudgment(values) { + if (values && values.length > 0) { + this.$post(this.api.deleteProjectJudgment + "?projectJudgmentIds=" + `${values}`).then(res => { + + // 重新调接口 + if (this.projectId) { // 有项目id,调接口,没有项目id,手动更新 + this.listAgain(); + } + }).catch(err => { + + }); + } + }, + // 重新调接口,专门赋值列表 + listAgain() { + this.$get(`${this.api.getProjectDetail}?projectId=${this.projectId}`).then(res => { + let { projectManage, projectJudgmentVos } = res; + this.projectJudgmentData = projectJudgmentVos; + this.projectJudgmentData.map((e, i) => { + e.sort = i + 1; + }); + }); + }, handleCacheData() { // 处理缓存数据 this.isToPoint = true; - this.$store.dispatch('setProject',{ projectManage: this.projectManage, projectJudgmentData: this.projectJudgmentData }); + this.$store.dispatch("setProject", { + projectManage: this.projectManage, + projectJudgmentData: this.projectJudgmentData + }); }, toJudgePoint(type, row) { // 进入判分点系统 this.handleCacheData(); let jumpPath = Setting.jumpPath; - // let jumpPath = "http://192.168.31.154:8087/"; // 本地 let { systemId } = this.projectManage; let href = ""; if (type === "view") { // 查看 if (systemId == 2) { - href = `${jumpPath}/#/programOption?id=${row.judgmentPointsId}`; + console.log(systemId); } else if (systemId == 3) { - href = `${jumpPath}/#/programOptions?id=${row.judgmentPointsId}`; + console.log(systemId); } else if (systemId == 11) { // 交易类判分点(银行综合系统) href = `${jumpPath}/#/Transaction?isView=true&systemId=${systemId}&lcId=${row.judgmentId}&token=${this.token}&referrer=${btoa(location.href)}`; @@ -627,9 +743,9 @@ export default { } else if (type === "edit") { // 自定义(老师端隐藏此功能) if (systemId == 2) { - href = `${jumpPath}/#/programOption?id=${row.judgmentPointsId}`; + console.log(systemId); } else if (systemId == 3) { - href = `${jumpPath}/#/programOptions?id=${row.judgmentPointsId}`; + console.log(systemId); } else if (systemId == 11) { // 交易类判分点(银行综合系统) href = `${jumpPath}/#/Transaction?isEdit=true&systemId=${systemId}&lcId=${row.judgmentId}&token=${this.token}&referrer=${btoa(location.href)}`; @@ -637,7 +753,7 @@ export default { // 编程类判分点(python子系统) href = `${jumpPath}/#/program?isEdit=true&systemId=${systemId}&bcId=${row.judgmentId}&token=${this.token}&referrer=${btoa(location.href)}`; } - } else if (type === 'home') { + } else if (type === "home") { if (systemId == 2 || systemId == 3) { href = `${jumpPath}/#/list`; } else { @@ -648,7 +764,7 @@ export default { location.href = href; } } -} +};