diff --git a/src/api/index.js b/src/api/index.js index 7019745..a7d3464 100644 --- a/src/api/index.js +++ b/src/api/index.js @@ -343,6 +343,19 @@ export default { disableActivityApplicant: `occupationlab/occupationlab/activity/applicant/disableRegistration`, excelExportApplicant: `${host}occupationlab/occupationlab/activity/applicant/excelExport`, exportDataInBatchesApplicant: `${host}occupationlab/occupationlab/activity/applicant/exportDataInBatches`, + addActivityProgress: `occupationlab/occupationlab/activity/progress/addCompetitionProgress`, + delActivityProgress: `occupationlab/occupationlab/activity/progress/batchDeletion`, + findActivityProgress: `occupationlab/occupationlab/activity/progress/findById`, + listActivityProgress: `occupationlab/occupationlab/activity/progress/getCompetitionProgress`, + updateActivityProgress: `occupationlab/occupationlab/activity/progress/update`, + addActivityAnnouncement: `occupationlab/occupationlab/activity/announcement/addAnnouncement`, + updateActivityAnnouncement: `occupationlab/occupationlab/activity/announcement/amendmentAnnouncement`, + delActivityAnnouncement: `occupationlab/occupationlab/activity/announcement/deleteAnnouncement`, + disableActivityAnnouncement: `occupationlab/occupationlab/activity/announcement/disableAnnouncement`, + listActivityAnnouncement: `occupationlab/occupationlab/activity/announcement/queryAnnouncementByCompetitionId`, + findActivityAnnouncement: `occupationlab/occupationlab/activity/announcement/queryAnnouncementDetails`, + delActivityAnnouncementAnnex: `occupationlab/occupationlab/activity/announcement/annex/delete`, + saveActivityAnnouncementAnnex: `occupationlab/occupationlab/activity/announcement/annex/save`, // 数据看板 curriculumListForBeforeLogin: `nakadai/nakadai/curriculum/curriculumListForBeforeLogin`, diff --git a/src/assets/img/ach1.png b/src/assets/img/ach1.png new file mode 100644 index 0000000..b855a97 Binary files /dev/null and b/src/assets/img/ach1.png differ diff --git a/src/assets/img/ach2.png b/src/assets/img/ach2.png new file mode 100644 index 0000000..23df370 Binary files /dev/null and b/src/assets/img/ach2.png differ diff --git a/src/assets/img/match-bg1.png b/src/assets/img/match-bg1.png new file mode 100644 index 0000000..d4936c3 Binary files /dev/null and b/src/assets/img/match-bg1.png differ diff --git a/src/assets/img/match-bg2.png b/src/assets/img/match-bg2.png new file mode 100644 index 0000000..7e1582d Binary files /dev/null and b/src/assets/img/match-bg2.png differ diff --git a/src/pages/achievement/teach/index.vue b/src/pages/achievement/teach/index.vue index 3627079..d5280fc 100644 --- a/src/pages/achievement/teach/index.vue +++ b/src/pages/achievement/teach/index.vue @@ -17,15 +17,15 @@

实验总人数

{{ peopleNum }}

-
+

实验平均分

{{ avgScore }}

-
+

实验最高分

{{ maxScore }}

-
+

实验最低分

{{ minScore }}

@@ -331,16 +331,12 @@ export default { dataZoom: [//滑动条 { // xAxisIndex: 0,//这里是从X轴的0刻度开始 - show: true,//是否显示滑动条,不影响使用 - type: 'slider', // 这个 dataZoom 组件是 slider 型 dataZoom 组件 - start: 0, // 从头开始。 - end: 50, // 一次性展示6个。 + show: true, + type: 'slider', + start: 0, + end: 150, xAxisIndex: [0], bottom: -10, - // handleStyle: { - // borderWidth: 0 - // } - } ], xAxis: [{ @@ -439,7 +435,6 @@ export default { } .stat { display: flex; - .nums { display: flex; align-items: center; @@ -447,48 +442,45 @@ export default { width: 640px; margin-right: 20px; - .item:nth-child(odd) { - background-image: url('../../../assets/img/total.png'); - } - - .item:nth-child(even) { - background-image: url('../../../assets/img/avg.png'); - } - .item { width: 300px; padding: 30px 30px; margin: 0 10px; box-sizing: border-box; border-radius: 8px; - background-size: 100% 100%; - background-repeat: no-repeat; - + background: url('../../../assets/img/total.png') 0 0/100% 100% no-repeat; p { font-size: 18px; color: #ffffff; } - .val { margin-top: 10px; color: #ffffff; font-size: 36px; } } + .item:nth-child(2) { + background-image: url('../../../assets/img/avg.png'); + } + .item:nth-child(3) { + background-image: url('../../../assets/img/ach1.png'); + } + .item:nth-child(4) { + background-image: url('../../../assets/img/ach2.png'); + } } - .chart { - flex: 1; + width: calc(100% - 660px); } } .wrong { - // padding-left: 25%; .line { display: flex; - justify-content: center; - margin-bottom: 10px; + // justify-content: center; + width: 920px; + margin: 0 auto 10px; .jud-name { - width: 400px; + width: 500px; margin-right: 100px; } } diff --git a/src/pages/activity/add/index.vue b/src/pages/activity/add/index.vue index 1c70e83..9003598 100644 --- a/src/pages/activity/add/index.vue +++ b/src/pages/activity/add/index.vue @@ -13,9 +13,13 @@ class="avatar-uploader" accept=".jpg,.png,.jpeg,.gif" :on-success="uploadSuccess" - :limit="1" :action="this.api.fileupload" :headers="headers" + :limit="1" + :on-exceed="handleExceed" + :before-remove="beforeRemove" + :on-remove="handleRemove" + :on-error="uploadError" name="file" > @@ -33,9 +37,13 @@ class="avatar-uploader avatar-uploader-lg" accept=".jpg,.png,.jpeg,.gif" :on-success="uploadLgSuccess" - :limit="1" :action="this.api.fileupload" :headers="headers" + :limit="1" + :on-exceed="handleExceed" + :before-remove="beforeRemove" + :on-remove="handleCarouselRemove" + :on-error="uploadError" name="file" > @@ -98,12 +106,15 @@ 点击上传 @@ -117,7 +128,7 @@
保存 发布 - 预览 + 预览 取消
@@ -147,6 +158,7 @@ export default { activityFileList: [], // 赛事附件 initiator: '', isNeedCode: 0, + invitationCode: '', maximumNumber: 0, signUpStartTime: '', signUpEndTime: '', @@ -167,6 +179,7 @@ export default { sponsorList: [""], fileList: [], submiting: false, + pass: false, updateTime: 0, }; }, @@ -202,6 +215,27 @@ export default { } } }, + // 页面离开的时候如果没有保存则提示 + beforeRouteLeave(to, from, next) { + if (this.submiting) { + next() + } else if (!this.pass) { + // 更改了信息才需要提示 + if (this.updateTime) { + this.$confirm(`所填写内容暂未保存,是否保存?`, '提示', { + type: 'warning' + }).then(() => { + this.save(this.form.publishStatus) + }).catch(() => { + next() + }) + } else { + next() + } + } else { + next() + } + }, mounted() { this.getData() }, @@ -215,24 +249,38 @@ export default { // 附件 const fileList = data.activityFileList if (fileList) { - const files = [] fileList.map(e => { - files.push({ - name: e.fileName, - url: e.filePath - }) + e.name = e.fileName + e.url = e.filePath }) - this.fileList = files } else { data.activityFileList = [] } - this.form = data this.$nextTick(() => { this.updateTime = 0 }) }).catch(err => {}) }, + handleExceed(files, fileList) { + util.warningMsg(`当前限制选择 1 个文件,如需更换,请删除上一个文件再重新选择!`); + }, + beforeRemove(file, fileList) { + return this.$confirm(`确定移除 ${file.name}?`); + }, + handleRemove(file, fileList) { + this.form.coverUrl = '' + }, + handleCarouselRemove(file, fileList) { + this.form.carouselUrl = '' + }, + uploadError(err, file, fileList) { + this.$message({ + message: "上传出错,请重试!", + type: "error", + center: true + }) + }, uploadSuccess(res) { this.form.coverUrl = res.data.filesResult.fileUrl }, @@ -242,14 +290,19 @@ export default { // 附件上传成功 uploadAnnexSuccess(res) { const file = res.data.filesResult - const { id } = this.form + const url = file.fileUrl || file.fileId const data = { - activityId: id || '', + activityId: this.form.id || '', fileName: this.fileName, - filePath: file.fileUrl || file.fileId + name: this.fileName, + filePath: url, + url } this.form.activityFileList.push(data) }, + handleExceedAnnex(files, fileList) { + util.warningMsg(`当前限制选择 5 个文件,如需更换,请删除一个文件再重新选择!`); + }, // 附件上传前 beforeUpload(file) { const isLt2M = file.size / 1024 / 1024 < 10 @@ -262,7 +315,7 @@ export default { } }, handleAnnexRemove(file, fileList) { - + this.form.activityFileList = fileList }, // 随机邀请码 randomInv() { @@ -270,7 +323,7 @@ export default { for (let i = 0; i < 4; i++) { result += Math.floor(Math.random() * 10); } - this.form.completeCompetitionSetup.invitationCode = result + this.form.invitationCode = result }, // 提交 save(status) { @@ -293,24 +346,28 @@ export default { } form.publishStatus = status form.id = this.$route.query.id + if (this.submiting) return false + this.submiting = true if (form.id) { this.$post(this.api.updateActivity, form).then(res => { - this.updateTime = 0 - this.$router.back() + this.backList() util.successMsg("修改成功"); - }).catch(err => {}); + }).catch(err => { + this.submiting = false + }); } else { this.$post(this.api.saveActivity, form).then(res => { - this.updateTime = 0 - this.$router.back() + this.backList() util.successMsg("创建成功"); - }).catch(err => {}); + }).catch(err => { + this.submiting = false + }); } }, // 预览 preview() { util.local.set('activity', this.form) - window.open(this.$router.resolve('/matchPreview').href) + window.open(this.$router.resolve('preview').href) }, addSponsor() { this.sponsorList.push(""); @@ -318,25 +375,26 @@ export default { delSponsor(index) { this.sponsorList.splice(index, 1); }, + backList() { + this.pass = true + this.updateTime = 0 + this.$router.push(`/activity?page=${this.$store.state.activity.page}`) + }, back() { + this.pass = true // 更改了信息才需要提示 - const { updateTime } = this.$refs['step' + this.step] - console.log("🚀 ~ file: index.vue:142 ~ back ~ updateTime", updateTime) - if (this.step < 4 && updateTime) { + if (this.updateTime) { this.$confirm(`编辑的内容未保存,是否保存?`, '提示', { type: 'warning' }).then(() => { - this.save(0) + this.save(this.form.publishStatus) }).catch(() => { - this.backPage() + this.backList() }) } else { - this.backPage() + this.backList() } }, - backPage() { - this.$router.push(`/activity?page=${this.$store.state.activity.page}`) - } } }; diff --git a/src/pages/activity/list/index.vue b/src/pages/activity/list/index.vue index 5a9e97f..ed6dbe1 100644 --- a/src/pages/activity/list/index.vue +++ b/src/pages/activity/list/index.vue @@ -257,15 +257,18 @@ export default { // 获取redis缓存 getRedis() { this.$post(this.api.getRedisCacheActivity).then(({ data }) => { - data && this.getList() + if (data) { + localStorage.getItem('activityTimestamp') !== data && this.getList() // 本地缓存跟redis返回的不一样,就查询列表 + localStorage.setItem('activityTimestamp', data) + } }).catch(res => {}) }, getData() { this.getList() - if (!Setting.isDev) { + // if (!Setting.isDev) { clearInterval(this.redisTimer) this.redisTimer = setInterval(this.getRedis, 1000) - } + // } }, add() { this.$router.push("/activity/add"); @@ -278,7 +281,7 @@ export default { type: "warning" }) .then(() => { - this.$post(`${this.api.batchDeletionActivity}?ids=${row.id}`).then(res => { + this.$post(this.api.batchDeletionActivity, [row.id]).then(res => { util.successMsg("删除成功"); this.getData(); }).catch(res => { @@ -296,8 +299,8 @@ export default { this.$confirm("确定要删除吗?", "提示", { type: "warning" }).then(() => { - let ids = this.multipleSelection.map(i => 'ids=' + i.id); - this.$post(`${this.api.batchDeletionActivity}?${ids.join('&')}`).then(res => { + let ids = this.multipleSelection.map(e => e.id); + this.$post(this.api.batchDeletionActivity, this.multipleSelection.map(e => e.id)).then(res => { this.getData(); this.$message.success("删除成功"); this.$refs.table.clearSelection() @@ -306,7 +309,7 @@ export default { }).catch(() => { }); } else { - this.$message.warning("请先选择赛事 !"); + this.$message.warning("请先选择项目 !"); } }, handleCurrentChange(val) { diff --git a/src/pages/activity/manage/index.vue b/src/pages/activity/manage/index.vue index 5f2d996..6906b06 100644 --- a/src/pages/activity/manage/index.vue +++ b/src/pages/activity/manage/index.vue @@ -27,7 +27,6 @@ import notice from "./notice"; import MatchSignup from "./matchSignup"; import { mapState } from "vuex"; export default { - name: "matchManage", data() { return { name: this.$route.query.name, @@ -54,29 +53,24 @@ export default { 'btns' ]) }, + beforeRouteLeave(to, from, next) { + const detail = this.$refs.detail + if (detail && detail.updateTime) { + this.$confirm(`编辑的内容未保存,是否保存并且发布?`, '提示.......', { + type: 'warning' + }).then(() => { + detail.save(detail.form.publishStatus) + }).catch(() => { + next() + }) + } else { + next() + } + }, mounted() { - Setting.dynamicRoute && this.initTabs() + }, methods: { - initTabs() { - const { btns } = this - const tab1 = btns.includes('/activity/list:管理:大赛详情') - const tab3 = btns.includes('/activity/list:管理:竞赛进展') - const tab4 = btns.includes('/activity/list:管理:公告通知') - const tab5 = btns.includes('/activity/list:管理:报名人员') - - tab1 || this.$delete(this.tabs, 'tab1') - tab3 || this.$delete(this.tabs, 'tab3') - tab4 || this.$delete(this.tabs, 'tab4') - tab5 || this.$delete(this.tabs, 'tab5') - const type = this.$route.query.tab - const keys = Object.keys(this.tabs) - this.active = keys.includes(type) ? type : keys[0] - }, - // 移除成绩管理 - hideArch() { - this.$delete(this.tabs, 'tab2') - }, back() { this.handleSave(0) && this.backPage() }, @@ -85,11 +79,11 @@ export default { // 如果是赛事详情,则要判断是否已经保存,未保存则提示是否保存 if (this.active === 'tab1') { const detail = this.$refs.detail - if (detail.step < 4 && detail.$refs['step' + detail.step].updateTime) { + if (detail && detail.updateTime) { this.$confirm(`编辑的内容未保存,是否保存并且发布?`, '提示', { type: 'warning' }).then(() => { - detail.save(1, 1) + detail.save(detail.form.publishStatus) this.backOrTab(i) }).catch(() => { this.backOrTab(i) diff --git a/src/pages/activity/manage/matchProgress.vue b/src/pages/activity/manage/matchProgress.vue index 605b7d1..c138368 100644 --- a/src/pages/activity/manage/matchProgress.vue +++ b/src/pages/activity/manage/matchProgress.vue @@ -26,13 +26,13 @@ -
+
@@ -77,10 +77,10 @@ export default { row.operate = true }, getData() { - this.$get(this.api.getCompetitionProgress, { - competitionId: this.id + this.$get(this.api.listActivityProgress, { + activityId: this.id }).then(res => { - this.listData = res.competitionProgressList; + this.listData = res.activityProgressList; for(let index=0; index { + this.$post(this.api.updateActivityProgress, data).then(res => { this.touchTime = this.touchTime-1 util.successMsg("修改成功"); this.getData(); }).catch(res => { }); } else { - this.$post(this.api.addCompetitionProgress, data).then(res => { + this.$post(this.api.addActivityProgress, data).then(res => { this.touchTime = this.touchTime-1 util.successMsg("创建成功"); this.getData(); @@ -114,10 +114,6 @@ export default { handleSelectionChange(val) { this.multipleSelection = val; }, - onSearch() { - this.pageNo = 1; - this.getData(); - }, handleCurrentChange(val) { this.pageNo = val; this.getData(); @@ -131,7 +127,7 @@ export default { util.successMsg("删除成功"); }else { this.touchTime = this.touchTime+1 - this.$del(`${this.api.deleteCompetitionProgress}?competitionProgressId=${row.id}`).then(res => { + this.$post(this.api.delActivityProgress, [row.id]).then(res => { util.successMsg("删除成功"); this.getData(); }).catch(res => { @@ -147,7 +143,7 @@ export default { if (this.listData.length) { if (this.listData[this.listData.length - 1].id) { this.listData.push({ - competitionId: this.id, + activityId: this.id, id: "", title: "", description: "", @@ -160,7 +156,7 @@ export default { } } else { this.listData.push({ - competitionId: this.id, + activityId: this.id, id: "", title: "", description: "", diff --git a/src/pages/activity/manage/matchSignup.vue b/src/pages/activity/manage/matchSignup.vue index 1217789..b1b683f 100644 --- a/src/pages/activity/manage/matchSignup.vue +++ b/src/pages/activity/manage/matchSignup.vue @@ -8,14 +8,14 @@
  • - +
  • - 批量导出 + 批量导出
    @@ -37,7 +37,6 @@