diff --git a/src/main.js b/src/main.js index af2eeec..4d4e648 100644 --- a/src/main.js +++ b/src/main.js @@ -12,7 +12,7 @@ import {post,get,del,put} from './utils/http'; import api from './utils/api'; import store from './store' import { systemStatus, systemTypeStatus, systemAttributionStatus, courseTypeStatus, - hoursStatus, roleStatus, orderTypeFn, orderStatusFn, orderNatureFn, Percentage, removeByValue, isIE, encodeString, formatDate, downloadFile } from './utils/core'; + hoursStatus, roleStatus, orderTypeFn, orderStatusFn, orderNatureFn, Percentage, removeByValue, isIE, encodeString, formatDate, downloadFile, dateCompatible } from './utils/core'; import preventReClick from './utils/preventReClick' //防多次点击,重复提交 import plugins from '@/directive'; @@ -38,6 +38,7 @@ Vue.prototype.isIE = isIE; Vue.prototype.encodeString = encodeString; Vue.prototype.formatDate = formatDate; Vue.prototype.downloadFile = downloadFile; +Vue.prototype.dateCompatible = dateCompatible; Vue.config.productionTip = false; Vue.use(ElementUI, { size: 'small' }); diff --git a/src/setting.js b/src/setting.js index a0e935e..1ed2e9f 100644 --- a/src/setting.js +++ b/src/setting.js @@ -12,7 +12,7 @@ if (isDev) { host = 'http://121.37.12.51/' // host = 'https://huorantech.cn/' host = 'http://192.168.31.51:9000/'// 榕 - // host = 'http://192.168.31.116:9000/'// 赓 + host = 'http://192.168.31.116:9000/'// 赓 } else if (isPro) { jumpPath = 'https://www.huorantech.cn/judgmentPoint/' } diff --git a/src/utils/api.js b/src/utils/api.js index 2e421dd..c696171 100644 --- a/src/utils/api.js +++ b/src/utils/api.js @@ -71,6 +71,7 @@ export default { examinePassword: `users/users/userAccount/examinePassword`, viewUserDetailsforNakadai: `users/users/userAccount/viewUserDetailsforNakadai`, oneClickEnableVerification: `users/users/userAccount/oneClickEnableVerification`, + getValueModule: `nakadai/nakadai/valueModuleManagement/getValueModule`, queryServiceConfig: `nakadai/nakadai/serviceConfiguration/getAllService`, //查询服务配置 // 项目管理 @@ -338,6 +339,16 @@ export default { searchTeam: `competition/competition/team/searchTeam`, joinCompetitionTeam: `competition/competition/team/joinCompetitionTeam`, addCompetitionTeam: `competition/competition/team/addCompetitionTeam`, + studentAccountApplication: `users/users/register/studentAccountApplication`, + checkPhoneOrEmailExist: `users/users/userInfo/checkPhoneOrEmailExist`, + editCompetitionTeam: `competition/competition/team/editCompetitionTeam`, + addAnAdvisor: `competition/competition/teamInstructor/addAnAdvisor`, + deleteAnAdvisor: `competition/competition/teamInstructor/deleteAnAdvisor`, + captainOfTransfer: `competition/competition/team/captainOfTransfer`, + removeTheLine: `competition/competition/team/removeTheLine`, + stageSelectParticipants: `competition/competition/teamParticipant/stageSelectParticipants`, + updateUser: `users/users/userInfo/updateUser`, + enquireAboutSchoolStudents: `users/users/userAccount/enquireAboutSchoolStudents`, // 赛事公告 addAnnouncement: `competition/competition/announcement/addAnnouncement`, amendmentAnnouncement: `competition/competition/announcement/amendmentAnnouncement`, @@ -350,11 +361,11 @@ export default { batchImportGrades: `${host1}competition/competition/performance/batchImportGrades`, exportExperimentalResultsInBatch: `${host1}competition/competition/performance/exportExperimentalResultsInBatch`, performanceExportFailure: `${host1}competition/competition/performance/exportFailure`, + rankExportFailure: `${host1}competition/competition/rank/exportFailure`, stageGradeManagementList: `${host1}competition/competition/performance/stageGradeManagementList`, stageRaceRanking: `${host1}competition/competition/rank/stageRaceRanking`, overallStandingsInThePointsRace: `${host1}competition/competition/rank/overallStandingsInThePointsRace`, batchImportRanking: `${host1}competition/competition/rank/batchImportRanking`, - rankExportFailure: `${host1}competition/competition/rank/exportFailure`, publishRanking: `${host1}competition/competition/rank/publishRanking`, stageTeamScoreDetails: `${host1}competition/competition/rank/stageTeamScoreDetails`, multipleStageTeamScoreDetails: `${host1}competition/competition/rank/multipleStageTeamScoreDetails`, @@ -362,6 +373,10 @@ export default { cancelRanking: `${host1}competition/competition/rank/cancelRanking`, reportDetail: `${host1}occupationlab/occupationlab/achievement/reportDetail`, deleteLastPublication: `${host1}competition/competition/rank/deleteLastPublication`, + whetherToPublish: `${host1}competition/competition/rank/whetherToPublish`, + manuallyRankTheUploadList: `${host1}competition/competition/rank/manuallyRankTheUploadList`, + queryPublicationSource: `${host1}competition/competition/rank/queryPublicationSource`, + releaseVerification: `${host1}competition/competition/rank/releaseVerification`, gradeImport: `${host2}template/赛事成绩导入模板.xlsx`, rankImportTeam: `${host2}template/赛事排名导入模板(团队赛).xlsx`, rankImportPerson: `${host2}template/赛事排名导入模板(个人赛).xlsx`, diff --git a/src/utils/core.js b/src/utils/core.js index c370fb1..96b5d0d 100644 --- a/src/utils/core.js +++ b/src/utils/core.js @@ -29,6 +29,14 @@ function toDateTime (date, time) { return str } +function formateTime(num) { + return num < 10 ? `0${num}` : num +} + +// new Date('2020-11-12 00:00:00') 在IE下失效,因此把-替换成/ +function dateCompatible(date) { + return date.replace(/\-/g, '/') +} function Percentage(num, total) { if (num == 0 || total == 0){ @@ -215,6 +223,8 @@ function downloadFile(fileName, url) { export { fMoney, toDateTime, + formateTime, + dateCompatible, Percentage, fMoney2, systemStatus, diff --git a/src/views/match/add/index.vue b/src/views/match/add/index.vue index ca78939..e5561c7 100644 --- a/src/views/match/add/index.vue +++ b/src/views/match/add/index.vue @@ -6,7 +6,7 @@ - 预览 - 取消 + 取消 @@ -80,7 +80,7 @@ export default { updateTime: 0, setupId: '', releaseType: 0, - editing: 0, + editing: this.$route.query.id ? 0 : 1, showBtns: true, loadIns: null }; @@ -110,7 +110,20 @@ export default { }, // 上一步 prev() { - this.step-- + // 更改了信息才需要提示 + const { updateTime } = this.$refs['step' + this.step] + console.log("🚀 ~ file: index.vue:142 ~ back ~ updateTime", updateTime) + if (updateTime) { + this.$confirm(`编辑的内容未保存,是否保存?`, '提示', { + type: 'warning' + }).then(() => { + this.save(0) + }).catch(() => { + this.step-- + }) + } else { + this.step-- + } }, // 发布后的逻辑 next(next, setupId, competitionId) { @@ -118,34 +131,42 @@ export default { this.$router.push(`/match?page=${this.$store.state.matchPage}`) } else if (next === 2) { if (setupId) this.setupId = setupId - if (competitionId) this.competitionId = competitionId + if (competitionId) { + this.$router.push('/addMatch?id=' + competitionId) + this.id = competitionId + this.competitionId = competitionId + } this.step++ } }, + // 点击步骤条跳转 + toStep(i) { + if (this.id && !this.editing) this.step = i + }, // 预览 preview() { - util.local.set('match', this.form) + util.local.set('match', this.$refs.step1.form) window.open(this.$router.resolve('/matchPreview').href) }, back() { - // const updateTime = this.updateTime - // const { id } = this.form - // // 更改了信息才需要提示 - // if ((id && updateTime > 1) || (!id && updateTime)) { - // this.$confirm(`编辑的内容未保存,是否保存?`, '提示', { - // type: 'warning' - // }).then(() => { - // this.save(0) - // }).catch(() => { - // this.backPage() - // }) - // } else { + // 更改了信息才需要提示 + const { updateTime } = this.$refs['step' + this.step] + console.log("🚀 ~ file: index.vue:142 ~ back ~ updateTime", updateTime) + if (this.step < 4 && updateTime) { + this.$confirm(`编辑的内容未保存,是否保存?`, '提示', { + type: 'warning' + }).then(() => { + this.save(0) + }).catch(() => { + this.backPage() + }) + } else { this.backPage() - // } - }, - backPage(){ - this.$router.back() + } }, + backPage() { + this.$router.push(`/match?page=${this.$store.state.matchPage}&platformSource=${this.$store.state.platformSource}`) + } } }; @@ -162,6 +183,11 @@ export default { .steps { display: flex; justify-content: center; + &.pointer { + li { + cursor: pointer; + } + } li { position: relative; margin-right: 100px; @@ -191,11 +217,11 @@ export default { .active { .circle { color: #fff; - border-color: #e0a1ff; - background: #d379ff; + border-color: #459ffb; + background: #007EFF; } .text { - color: #d379ff; + color: #007EFF; } } .done { diff --git a/src/views/match/add/step1.vue b/src/views/match/add/step1.vue index e8aeaca..4973d5c 100644 --- a/src/views/match/add/step1.vue +++ b/src/views/match/add/step1.vue @@ -61,7 +61,7 @@
- @@ -73,13 +73,13 @@
-
- @@ -412,6 +412,9 @@ export default { this.rangeName = range.join(',') } this.form = competition + this.$nextTick(() => { + this.updateTime = 0 + }) }).catch(err => {}) }, // 选择范围 @@ -584,7 +587,7 @@ export default { form.undertaker = this.undertakerList.filter(d => d).join(); if (!form.name) return util.warningMsg("请填写竞赛名称"); // 发布才需要校验 - if (status) { + // if (status) { if (form.competitionScope == 2 && !form.competitionRangeList.length) return util.warningMsg('请选择区域、院校') if (!form.sponsor) return util.warningMsg("请填写主办方"); if (!form.signUpStartTime) return util.warningMsg("请选择报名时间"); @@ -594,7 +597,7 @@ export default { let playStartTime = new Date(form.playStartTime).getTime(); // if (signUpStartTime && now > signUpStartTime) return util.warningMsg("报名时间不能早于当前时间"); if (!form.playStartTime) return util.warningMsg("请选择竞赛时间"); - if (playStartTime && playStartTime < signUpEndTime) return util.warningMsg("竞赛时间不能早于报名结束时间"); + if (playStartTime && signUpEndTime && playStartTime < signUpEndTime) return util.warningMsg("竞赛时间不能早于报名结束时间"); const { competitionType, quantityLimit, minTeamSize, maxTeamSize, isNeedCode, invitationCode } = form.completeCompetitionSetup // 团队 if (competitionType) { @@ -610,12 +613,12 @@ export default { } if (isNeedCode && (!invitationCode || invitationCode.length !== 4)) return util.warningMsg('请填写四位数邀请码') if (!form.description) return util.warningMsg("请填写竞赛详情"); - } - + // } this.$parent.showLoad() form.publishStatus = status form.ztOpen = status ? 0 : 1 // 保存则禁用,发布则启用 form.releaseType = releaseType + form.id = this.$route.query.id if (form.id) { this.$post(this.api.editCompetition, form).then(res => { this.$parent.hideLoad() @@ -639,25 +642,6 @@ export default { util.local.set('match', this.form) window.open(this.$router.resolve('/matchPreview').href) }, - back() { - const updateTime = this.updateTime - const { id } = this.form - // 更改了信息才需要提示 - if ((id && updateTime > 1) || (!id && updateTime)) { - this.$confirm(`编辑的内容未保存,是否保存?`, '提示', { - type: 'warning' - }).then(() => { - this.save(0) - }).catch(() => { - this.backPage() - }) - } else { - this.backPage() - } - }, - backPage(){ - this.$router.back() - }, addSponsor() { this.sponsorList.push(""); }, diff --git a/src/views/match/add/step2.vue b/src/views/match/add/step2.vue index 5891a10..e511612 100644 --- a/src/views/match/add/step2.vue +++ b/src/views/match/add/step2.vue @@ -3,7 +3,7 @@
赛程与规则设置
- + {{ step1.completeCompetitionSetup.competitionType ? '团队赛(' + step1.completeCompetitionSetup.minTeamSize + '-' + step1.completeCompetitionSetup.maxTeamSize + '人/队)' : '个人赛' }} (如需修改,请返回上一步。) @@ -58,7 +58,7 @@ {{ j.name }} (可设置本阶段的团队取分规则)
-
+

*晋级规则:

@@ -145,10 +145,11 @@ import util from "@/libs/util"; import quill from "@/components/quill"; import Const from '@/const/match' export default { - props: ['setupId'], + props: ['setupId', 'editing'], data() { return { id: this.$route.query.id, + updateTime: 0, step1: this.$parent.$refs.step1.form, serials: ['一', '二', '三', '四', '五', '六', '七', '八', '九', '十'], form: { @@ -241,10 +242,9 @@ export default { }, }, mounted() { - const { minTeamSize, maxTeamSize, competitionType } = this.step1.completeCompetitionSetup - competitionType && minTeamSize !== '' && maxTeamSize !== '' && minTeamSize == maxTeamSize && this.teamCalculationMethods.pop() // 团队上下限人数相等,则不显示求和 this.ruleForm = JSON.parse(JSON.stringify(this.form.competitionStageList[0])) this.id && this.getData() + this.step1 || this.getStep1() // 如果没有第一步的数据,则直接接口获取 }, methods: { getData() { @@ -265,8 +265,19 @@ export default { }) this.form = rule } + this.$nextTick(() => { + this.updateTime = 0 + }) }).catch(res => {}) }, + // 获取第二部的数据 + getStep1() { + this.$post(`${this.api.getCompetition}?competitionId=${this.id}`).then(({ competition }) => { + this.step1 = competition + const { minTeamSize, maxTeamSize, competitionType } = this.step1.completeCompetitionSetup + competitionType && minTeamSize !== '' && maxTeamSize !== '' && minTeamSize == maxTeamSize && this.teamCalculationMethods.pop() // 团队上下限人数相等,则不显示求和 + }).catch(err => {}) + }, // 阶段数量选择回调 stageChange(val) { const list = [] @@ -313,7 +324,7 @@ export default { invalid = 1 util.errorMsg('团队参数人数不得小于0') break - } else if (e.teamNumLimit > maxTeamSize) { + } else if (maxTeamSize !== '' && e.teamNumLimit > maxTeamSize) { invalid = 1 util.errorMsg('团队参数人数不得大于团队人数上限') break @@ -332,7 +343,6 @@ export default { break } } - } if (invalid) return if (form.resultCalculationMethod == 0 && !rule && pointWeight > 0 && pointWeight !== 100) return util.errorMsg('权重须等于100,请重新输入') diff --git a/src/views/match/add/step3.vue b/src/views/match/add/step3.vue index 8e294e7..f660698 100644 --- a/src/views/match/add/step3.vue +++ b/src/views/match/add/step3.vue @@ -3,7 +3,7 @@
比赛内容设置
- +
{{ item.stageName }}(第{{ nums[i] }}阶段) | {{ methods.find(e => e.id === item.method).name }} @@ -44,7 +44,7 @@