赛事联调

alioss
yujialong 2 years ago
parent 506eb20204
commit d7c28d8063
  1. 28
      src/api/index.js
  2. 144
      src/pages/account/login/index.vue
  3. 278
      src/pages/match/details/index.vue
  4. 273
      src/pages/match/list/index.vue
  5. 8
      src/pages/screen/index.vue
  6. 241
      src/pages/touristMatch/list/index.vue
  7. 4
      src/setting.js

@ -10,6 +10,7 @@ export default {
logoDetail: `occupationlab/occupationlab/sys/logo/detail`, //查看系统设置信息
isClient: `${host}users/users/user/isClient`,
sendPhoneVerificationCode: `users/users/user/sendPhoneVerificationCode`,
sendPhoneOrEmailCode: `users/users/userAccount/sendPhoneOrEmailCode`,
getToken: `users/users/user/getToken`,
getOtherAccountByPhone: `users/users/user/getOtherAccountByPhone`,
unbindAccounts: `users/users/user/unbindAccounts`,
@ -78,17 +79,21 @@ export default {
getArticle: `occupationlab/occupationlab/information/article/getArticle`, // 根据id查询文章
// 线上赛事
notLoggedInBeforeStudentEvents: `occupationlab/occupationlab/enterprise/match/contest/notLoggedInBeforeStudentEvents`,
contestPageConditionQueryByOccupationlabStu: `occupationlab/occupationlab/enterprise/match/contest/contestPageConditionQueryByOccupationlabStu`,
contestPageConditionQueryByOccupationlab: `occupationlab/occupationlab/enterprise/match/contest/onlineCompetitionByStudent`,
listOfRegisteredEvents: `occupationlab/occupationlab/enterprise/match/contest/listOfRegisteredEvents`,
addApplicant: `occupationlab/occupationlab/enterprise/match/applicant/addApplicant`, // 添加报名人员
getContestProgress: `occupationlab/occupationlab/enterprise/match/contest-progress/getContestProgress`, // 根据赛事id查询竞赛进展
getContest: `occupationlab/occupationlab/enterprise/match/contest/getContest`, // 根据id查询赛事
queryAnnouncementByContestId: `occupationlab/occupationlab/contest/announcement/queryAnnouncementByContestId`,
queryAnnouncementDetails: `occupationlab/occupationlab/contest/announcement/queryAnnouncementDetails`,
contestAfterLogin: `occupationlab/occupationlab/enterprise/match/contest/contestAfterLogin`,
cancelRegistration: `occupationlab/occupationlab/enterprise/match/applicant/cancelRegistration`,
notLoggedInBeforeStudentEvents: `competition/competition/management/notLoggedInBeforeStudentEvents`,
addCompetitionRegistration: `competition/competition/registration/addCompetitionRegistration`,
getCompetitionProgress: `competition/competition/progress/getCompetitionProgress`,
getCompetition: `competition/competition/management/getCompetition`,
queryAnnouncementByCompetitionId: `competition/competition/announcement/queryAnnouncementByCompetitionId`,
queryAnnouncementDetails: `competition/competition/announcement/queryAnnouncementDetails`,
competitionAfterLogin: `competition/competition/management/competitionAfterLogin`,
cancelRegistration: `competition/competition/registration/cancelRegistration`,
addCompetitionTeam: `competition/competition/team/addCompetitionTeam`,
captainOfTransfer: `competition/competition/team/captainOfTransfer`,
entryInformation: `competition/competition/team/entryInformation`,
joinCompetitionTeam: `competition/competition/team/joinCompetitionTeam`,
removeTheLine: `competition/competition/team/removeTheLine`,
studentAccountApplication: `users/users/register/studentAccountApplication`,
searchTeam: `competition/competition/team/searchTeam`,
// 阿里云文件/视频管理
fileDeletion: `${uploadURL}oss/manage/fileDeletion`, // 删除OSS文件
@ -108,7 +113,6 @@ export default {
updatePersonCenter: `users/users/userAccount/updatePersonCenter`,//个人中心信息修改
examinePassword: `users/users/userAccount/examinePassword`,//更换密码
bindPhoneOrEmail: `users/users/userAccount/bindPhoneOrEmail`,// 绑定手机或邮箱
sendPhoneOrEmailCode: `users/users/userAccount/sendPhoneOrEmailCode`,// 更换手机号或邮箱--发送手机验证码
unbindMobilePhone: `users/users/userAccount/unbindMobilePhone`,
joinPractice: `tms/classTech/joinPractice`, //通过邀请码进入实验

@ -71,7 +71,7 @@
</el-form-item>
</template>
<div class="bottom">
<!-- <el-link :underline="false" type="primary" @click="toTrial">申请试用</el-link> -->
<el-link :underline="false" type="primary" @click="toAccount">暂无账号点击申请</el-link>
<el-checkbox v-show="!form.distinguish" v-model="setDefault">设置为默认学校</el-checkbox>
</div>
<el-button class="submit" type="primary" @click="submit">登录</el-button>
@ -138,6 +138,40 @@
</div>
</div>
</el-dialog>
<el-dialog title="账号申请" :visible.sync="accountVisible" :close-on-click-modal="false" width="500px" @close="accountClose">
<el-form class="dia-form" ref="accountForm" label-width="80px" :model="accountRules" :rules="accountRules">
<el-form-item prop="userName" label="所属院校">
<el-select class="w-100" v-model="accountForm.schoolId" filterable placeholder="请选择院校">
<el-option v-for="(item, i) in schoolList" :key="i" :label="item.schoolName" :value="item.schoolId"></el-option>
</el-select>
</el-form-item>
<el-form-item prop="userName" label="姓名">
<el-input placeholder="请输入姓名" v-model="accountForm.userName"></el-input>
</el-form-item>
<el-form-item prop="workNumber" label="学号">
<el-input placeholder="请输入学号" v-model="accountForm.workNumber"></el-input>
</el-form-item>
<el-form-item prop="phone" label="手机号">
<el-input placeholder="请输入手机号" maxlength="11" v-model.trim="accountForm.phone"></el-input>
</el-form-item>
<el-form-item prop="code" label="验证码">
<div class="ver-code">
<el-input v-model="accountForm.code" placeholder="请输入验证码" maxlength="6"></el-input>
<el-button style="top: 1px" type="text" @click="sendCode" :disabled="phoneDisabled">{{ phoneBtnText }}
</el-button>
</div>
</el-form-item>
<el-form-item prop="password" label="登录密码">
<el-input placeholder="请输入登录密码" type="password" maxlength="6" v-model="accountForm.password"></el-input>
</el-form-item>
</el-form>
<span slot="footer" class="dialog-footer">
<el-button size="small" type="primary" @click="accountSubmit">申请</el-button>
<el-button size="small" @click="accountVisible = false">取消</el-button>
</span>
</el-dialog>
<v-footer ref="footer"></v-footer>
</div>
</template>
@ -151,6 +185,32 @@ import axios from "axios"
import { Loading } from 'element-ui'
export default {
data: function() {
const workNumberPass = (rule, value, callback) => {
const val = this.accountForm.workNumber
if (val === '') {
callback(new Error('请输入学号'))
} else {
const pattern = /^[A-Za-z0-9]*$/
if(pattern.test(val)){
callback()
}else{
callback(new Error('请输入正确学号格式'))
}
}
}
const phonePass = (rule, value, callback) => {
const val = this.accountForm.phone
if (val === '') {
callback(new Error('请输入手机号'))
} else {
const pattern = /^1[3456789]\d{9}$/
if(pattern.test(val)){
callback()
}else{
callback(new Error('请输入正确手机号格式'))
}
}
}
return {
tabList: [
{
@ -204,7 +264,27 @@ export default {
accountIds: [],
binding: '',
infoVisible: false,
infos: []
infos: [],
accountVisible: false,
accountForm: {
schoolId: '',
account: '',
code: '',
password: '',
phone: '',
userName: '',
workNumber: '',
uniqueIdentification: Date.now()
},
accountRules: {
schoolId: [{ required: true, message: "请选择所属院校", trigger: "change" }],
userName: [{ required: true, message: "请输入姓名", trigger: "blur" }],
workNumber: [{ required: true, validator: workNumberPass, trigger: "blur" }],
phone: [{ required: true, validator: phonePass, trigger: "blur" }],
password: [{ required: true, message: "请输入密码", trigger: "blur" }],
code: [{ required: true, message: "请输入验证码", trigger: "blur" }]
},
};
},
computed: {
@ -227,7 +307,7 @@ export default {
clearInterval(this.phoneTimerLogin)
this.phoneTimer = null
this.phoneTimerLogin = null
});
})
},
methods: {
...mapMutations("user", [
@ -288,10 +368,6 @@ export default {
'请输入学生学号' :
'请输入老师工号'
},
//
toTrial() {
// window.open('https://www.wjx.cn/vm/wB0RcMm.aspx')
},
//
reloadIndex() {
try {
@ -436,6 +512,47 @@ export default {
return true
},
//
toAccount() {
this.accountVisible = true
},
//
sendCode() {
const { phone } = this.accountForm
if (!this.verifyPhone(phone)) return false
this.$post(`${this.api.sendPhoneVerificationCode}?phoneOrEmail=${phone}&loginOrBind=1&platform=${Setting.platformId}`).then(({ message }) => {
util.successMsg(message)
this.phoneCountdown()
}).catch(res => {})
},
//
accountSubmit() {
this.$refs.accountForm.validate(valid => {
if (valid) {
const form = this.accountForm
// id-id-schoolId-workNumber
form.account = `${Setting.platformId}-1-${form.schoolId}-${form.workNumber}`
this.$post(this.api.studentAccountApplication, form).then(({ status, data, message }) => {
this.accountVisible = false
util.successMsg(message)
}).catch(res => {})
}
})
},
//
accountClose() {
this.accountForm = {
schoolId: '',
account: '',
code: '',
password: '',
phone: '',
userName: '',
workNumber: '',
uniqueIdentification: Date.now()
}
},
//
phoneCountdownLogin() {
let count = 60
@ -655,8 +772,7 @@ export default {
}
.bottom {
display: flex;
// justify-content: space-between;
justify-content: flex-end;
justify-content: space-between;
}
.el-select {
width: 100%;
@ -831,6 +947,16 @@ export default {
line-height: 1.6;
}
}
/deep/.dia-form {
.w-100 {
width: 100%;
}
.tips {
display: flex;
justify-content: center;
align-items: center;
}
}
@media (max-height: 680px) {
.wrap .login {
padding: 40px 0;

@ -73,6 +73,48 @@
</div>
</div>
</div>
<el-dialog title="报名" :visible.sync="enterVisible" :close-on-click-modal="false" width="300px" @close="enterClose">
<el-form class="dia-form">
<p style="margin-bottom: 5px">请选择要加入的团队</p>
<el-form-item>
<el-select class="w-100" v-model="enterForm.teamId">
<el-option v-for="(item, i) in teams" :key="i" :label="item.teamName" :value="item.teamId"></el-option>
</el-select>
</el-form-item>
<el-form-item>
<el-input placeholder="请输入团队邀请码" maxlength="6" v-model="enterForm.invitationCode"></el-input>
</el-form-item>
<el-form-item v-if="form.completeCompetitionSetup.isNeedCode">
<el-input placeholder="请输入大赛邀请码" maxlength="6" v-model="enterForm.registrationInvitationCode"></el-input>
</el-form-item>
<p class="tips">
查找不到团队点击 <el-link :underline="false" type="primary" @click="toTeam">创建团队</el-link>
</p>
</el-form>
<span slot="footer" class="dialog-footer">
<el-button size="small" type="primary" @click="enterSubmit">报名</el-button>
<el-button size="small" @click="enterVisible = false">取消</el-button>
</span>
</el-dialog>
<el-dialog title="创建团队" :visible.sync="teamVisible" :close-on-click-modal="false" width="300px" @close="teamClose">
<el-form class="dia-form">
<el-form-item>
<el-input placeholder="请输入团队名称" maxlength="10" v-model="teamForm.teamName"></el-input>
</el-form-item>
<el-form-item>
<el-input placeholder="请设置团队邀请码" maxlength="6" v-model="teamForm.invitationCode"></el-input>
</el-form-item>
<el-form-item v-if="form.completeCompetitionSetup.isNeedCode">
<el-input placeholder="请输入大赛邀请码" maxlength="6" v-model="teamForm.registrationInvitationCode"></el-input>
</el-form-item>
</el-form>
<span slot="footer" class="dialog-footer">
<el-button size="small" type="primary" @click="teamSubmit">创建并报名</el-button>
<el-button size="small" @click="teamVisible = false">取消</el-button>
</span>
</el-dialog>
</div>
</template>
@ -86,9 +128,9 @@ export default {
data() {
return {
id: this.$route.query.id,
end: this.$route.query.end,
status: this.$route.query.status,
statusList: ["等待报名", "已报名", "立即报名", "报名截止", "比赛中", "已结束"],
end: '',
status: '',
statusList: ["等待报名", "已报名", "立即报名", "报名截止", "进入初赛", "已结束"],
endList: ["报名开始", "报名截止", "报名截止", "竞赛开始", "竞赛结束", ""],
form: {
name: '',
@ -98,6 +140,7 @@ export default {
signUpEndTime: '',
playStartTime: '',
playEndTime: '',
completeCompetitionSetup: {}
},
curType: '1',
typeList: [
@ -115,10 +158,28 @@ export default {
}
],
progress: [],
statusList: ["等待报名", "已报名", "立即报名", "报名截止", "比赛中", "已结束"],
timer: null,
notices: [],
noticeDetail: {}
noticeDetail: {},
enterVisible: false,
enterForm: {
competitionId: this.$route.query.id,
teamId: '',
invitationCode: '',
registrationInvitationCode: ''
},
teamVisible: false,
teams: [],
teamNameRepeat: false,
teamForm: {
competitionId: this.$route.query.id,
registrationInvitationCode: '',
teamName: '',
invitationCode: '',
},
curStage: null
};
},
components: {
@ -197,34 +258,84 @@ export default {
this.getData()
this.getProgress()
this.getNotice()
this.getTeam()
},
methods: {
...mapMutations('match', [
'SET_SOURCE'
]),
getData() { //
this.$post(`${this.api.getContest}?contestId=${this.id}`).then(({ contest }) => {
const list = contest.contestAnnexList
this.$post(`${this.api.getCompetition}?competitionId=${this.id}`).then(({ competition }) => {
this.handleStatus(competition)
console.log("🚀 ~ file: index.vue:273 ~ this.$post ~ competition", competition)
const list = competition.competitionAnnexList
//
if (list) {
list.map(e => {
const { filePath } = e
e.canPreview = util.canPreview(filePath.substr(filePath.lastIndexOf('.') + 1))
})
}
this.form = contest
this.$refs.breadcrumb.update('全部赛事/' + contest.name)
this.form = competition
this.$refs.breadcrumb.update('全部赛事/' + competition.name)
}).catch(err => {})
},
//
handleStatus(form) {
const second = 1000;
const minute = second * 60;
const hour = minute * 60;
let status
const n = form
let now = new Date().getTime();
let signUpStartTime = new Date(this.core.dateCompatible(n.signUpStartTime)).getTime(); //
let signUpEndTime = new Date(this.core.dateCompatible(n.signUpEndTime)).getTime(); //
let playStartTime = new Date(this.core.dateCompatible(n.playStartTime)).getTime(); //
let playEndTime = new Date(this.core.dateCompatible(n.playEndTime)).getTime(); //
let total = 0
if (now < signUpStartTime) { //
status = 0;
total = signUpStartTime - now
} else if (now > signUpStartTime && now < signUpEndTime) { //
status = n.competitionRegistration ? 1 : 2 // 12
total = signUpEndTime - now
} else if (now > signUpEndTime && now < playStartTime) { // ,
status = 3;
total = playStartTime - now
} else if (now > playStartTime && now < playEndTime) { //
//
if (n.competitionStage) {
for (const e of n.competitionStage) {
if (now > new Date(e.startTime) && now < new Date(e.endTime) && !e.count) {
this.curStage = e
this.statusList[4] = '进入' + e.stageName
break
}
}
}
status = 4
total = playEndTime - now
} else if (now > playEndTime) { //
status = 5;
}
this.status = status
if (total > 0) {
const day = Math.floor(total / (60 * 60 * 1000 * 24))
const time = `${this.core.formateTime(Math.floor(total / hour))}:${this.core.formateTime(Math.floor(total % hour / minute))}:${this.core.formateTime(Math.floor(total % hour % minute / second))}`
this.end = day ? day + '天' : time
}
},
getProgress() { //
this.$get(this.api.getContestProgress, {
contestId: this.id
this.$get(this.api.getCompetitionProgress, {
competitionId: this.id
}).then(res => {
this.progress = res.contestProgressList.reverse()
this.progress = res.competitionProgressList.reverse()
}).catch(err => {});
},
//
getNotice() {
this.$post(`${this.api.queryAnnouncementByContestId}?pageNum=1&pageSize=1000&contestId=${this.id}`).then(({ data }) => {
this.$post(`${this.api.queryAnnouncementByCompetitionId}?pageNum=1&pageSize=1000&competitionId=${this.id}`).then(({ data }) => {
const records = data.records.filter(e => e.status) // status 0稿 1
records.map(e => {
e.announcementText = e.announcementText.replace(/<img.*?(?:>|\/>)/gi, '')
@ -250,31 +361,98 @@ export default {
toNotice(item) {
this.$router.push(`noticeDetail?id=${item.id}&matchId=${this.id}&name=${this.form.name}&end=${this.end}&status=${this.status}`)
},
//
enterSubmit() {
const form = this.enterForm
if (!form.teamId) return util.errorMsg('请选择团队')
if (!form.invitationCode) return util.errorMsg('请输入团队邀请码')
if (this.form.completeCompetitionSetup.isNeedCode && !form.registrationInvitationCode) return util.errorMsg('请输入大赛邀请码')
this.$post(this.api.joinCompetitionTeam, form).then(({ status, data, message }) => {
this.enterVisible = false
this.getData()
util.successMsg('报名成功!')
}).catch(res => {})
},
//
enterClose() {
this.enterForm = {
competitionId: this.id,
teamId: '',
registrationInvitationCode: '',
invitationCode: ''
}
},
//
toTeam() {
this.teamVisible = true
},
//
getTeam() {
this.$get(this.api.searchTeam, {
teamName: '',
competitionId: this.id
}).then(({ teamList }) => {
this.teams = teamList
}).catch(res => {})
},
//
teamSubmit() {
const form = this.teamForm
if (!form.teamName) return util.errorMsg('请输入团队名称')
if (this.teamNameRepeat) return util.errorMsg('团队名称重复,请重新输入')
if (form.invitationCode.length !== 6) return util.errorMsg('请输入6位数团队邀请码')
if (this.form.completeCompetitionSetup.isNeedCode && !form.registrationInvitationCode) return util.errorMsg('请输入大赛邀请码')
this.$post(this.api.addCompetitionTeam, form).then(({ status, data, message }) => {
this.teamVisible = false
this.enterVisible = false
this.getData()
util.successMsg('报名成功!')
}).catch(res => {})
},
//
teamClose() {
this.teamForm = {
competitionId: this.id,
teamName: '',
invitationCode: '',
registrationInvitationCode: ''
}
},
//
signup(){
const { status } = this
//
//
if (util.local.get(Setting.tokenKey)) {
if (this.status == 2) {
let data = {
contestId: this.id
}
this.$post(this.api.addApplicant,data).then(res => {
if (status == 4) { //
this.toSub()
} else if (status == 2) { //
//
if (this.form.completeCompetitionSetup.competitionType) {
this.enterVisible = true
} else { //
this.$post(this.api.addCompetitionRegistration, {
competitionId: this.id
}).then(res => {
this.getData()
this.$message.success('报名成功')
this.status = 1;
}).catch(res => {})
}).catch(res => {})
}
} else if (status == 1) {
//
this.$confirm('是否要取消报名?', '提示', {
type: 'success'
}).then(() => {
this.$post(`${this.api.cancelRegistration}?contestId=${this.id}`).then(res => {
this.$post(`${this.api.cancelRegistration}?competitionId=${this.id}`).then(res => {
this.getData()
this.$message.success('取消报名成功')
this.status = 2
}).catch(res => {})
}).catch(() => {})
}
} else {
} else { //
this.$confirm('请先登录,是否直接前往登录?', "提示", {
type: 'success'
}).then(() => {
@ -282,6 +460,48 @@ export default {
this.$router.push('/login')
}).catch(() => {})
}
},
// python
toPython() {
const form = this.curStage
let token = util.local.get(Setting.tokenKey);
util.cookies.set('assessmentId', '', -1)
util.cookies.set('startTime', '', -1)
util.cookies.set('stopTime', '', -1)
util.cookies.set('projectId', form.projectId)
util.cookies.set('token', token)
util.cookies.set('courseId', form.cid)
// util.cookies.set('curriculumName', escape(this.curriculumName))
util.cookies.set('systemId', form.systemId)
util.cookies.set('competitionId', this.form.id)
util.cookies.set('stageId', form.stageId)
util.cookies.set('teamId', this.form.competitionRegistration.teamId)
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 { form } = this
const { systemId, projectId, cid } = this.curStage
const competitionId = form.id
const { stageId } = form
const teamId = form.competitionRegistration.teamId
let token = util.local.get(Setting.tokenKey);
if (systemId == 11) {
//
location.href = `${Setting.systemPath}/#/index/list?curriculumName=${this.curriculumName}&token=${token}&cid=${this.courseId}&systemId=${systemId}&projectId=${projectId}&competitionId=${competitionId}&stageId=${stageId}&teamId=${teamId}&assessmentId=&classId=&stopTime=&test=true`
} else if (systemId == 12) {
//
window.open(`http://120.78.139.126:8879?systemId=${systemId}&courseId=${cid}&projectId=${projectId}&token=${token}&userId=${this.userId}&classId=1&competitionId=${competitionId}&stageId=${stageId}&teamId=${teamId}`);
} else {
// python
this.toPython(this.curProject)
}
}
}
};
@ -584,4 +804,14 @@ export default {
text-overflow: ellipsis;
}
}
/deep/.dia-form {
.w-100 {
width: 100%;
}
.tips {
display: flex;
justify-content: center;
align-items: center;
}
}
</style>

@ -103,8 +103,9 @@
</div>
<div class="right">
<p class="status"
:class="{wait: item.status == 0,signing: item.status == 2,signed: item.status == 1,playing: item.status == 4,finish: item.status == 3 || item.status == 5}"
@click.stop="signup(item)">{{ statusList[item.status] }}</p>
v-if="item.status != 4 || (item.status == 4 && item.curStage)"
:class="{wait: item.status == 0,signing: item.status == 2,signed: item.status == 1,playing: item.status == 4 && item.curStage,finish: item.status == 3 || item.status == 5}"
@click.stop="signup(item)">{{ item.status == 4 ? item.stageName : statusList[item.status] }}</p>
<p class="end-text" v-if="item.status != 5">
距离{{ endList[item.status] }}还有
<em>{{ item.end }}</em>
@ -131,6 +132,48 @@
</div>
</div>
</div>
<el-dialog title="报名" :visible.sync="enterVisible" :close-on-click-modal="false" width="300px">
<el-form class="dia-form">
<p style="margin-bottom: 5px">请选择要加入的团队</p>
<el-form-item>
<el-select class="w-100" v-model="enterForm.teamId">
<el-option v-for="(item, i) in teams" :key="i" :label="item.teamName" :value="item.teamId"></el-option>
</el-select>
</el-form-item>
<el-form-item>
<el-input placeholder="请输入团队邀请码" maxlength="6" v-model="enterForm.invitationCode"></el-input>
</el-form-item>
<el-form-item v-if="curItem.isNeedCode">
<el-input placeholder="请输入大赛邀请码" maxlength="6" v-model="enterForm.registrationInvitationCode"></el-input>
</el-form-item>
<p class="tips">
查找不到团队点击 <el-link :underline="false" type="primary" @click="toTeam">创建团队</el-link>
</p>
</el-form>
<span slot="footer" class="dialog-footer">
<el-button size="small" type="primary" @click="enterSubmit">报名</el-button>
<el-button size="small" @click="enterVisible = false">取消</el-button>
</span>
</el-dialog>
<el-dialog title="创建团队" :visible.sync="teamVisible" :close-on-click-modal="false" width="300px">
<el-form class="dia-form">
<el-form-item>
<el-input placeholder="请输入团队名称" maxlength="10" v-model="teamForm.teamName"></el-input>
</el-form-item>
<el-form-item>
<el-input placeholder="请设置团队邀请码" maxlength="6" v-model="teamForm.invitationCode"></el-input>
</el-form-item>
<el-form-item v-if="curItem.isNeedCode">
<el-input placeholder="请输入大赛邀请码" maxlength="6" v-model="teamForm.registrationInvitationCode"></el-input>
</el-form-item>
</el-form>
<span slot="footer" class="dialog-footer">
<el-button size="small" type="primary" @click="teamSubmit">创建并报名</el-button>
<el-button size="small" @click="teamVisible = false">取消</el-button>
</span>
</el-dialog>
</div>
</template>
@ -146,8 +189,7 @@ export default {
return {
timer: null,
token: util.local.get(Setting.tokenKey),
apis: ['contestPageConditionQueryByOccupationlab', 'contestPageConditionQueryByOccupationlabStu', 'listOfRegisteredEvents'], // 3
statusList: ["等待报名", "已报名", "立即报名", "报名截止", "比赛中", "已结束"],
statusList: ["等待报名", "已报名", "立即报名", "报名截止", "进入初赛", "已结束"],
endList: ["报名开始", "报名截止", "报名截止", "竞赛开始", "竞赛结束", ""],
typeList: [
{
@ -225,6 +267,26 @@ export default {
loadIns: null,
contestIds: [],
timerList: [],
enterVisible: false,
enterForm: {
competitionId: '',
teamId: '',
invitationCode: '',
registrationInvitationCode: ''
},
teamVisible: false,
teams: [],
teamNameRepeat: false,
teamForm: {
competitionId: '',
registrationInvitationCode: '',
teamName: '',
invitationCode: '',
},
curItem: {}
};
},
computed: {
@ -268,13 +330,13 @@ export default {
}
if (eventType === 2 && !competitionScope) form.competitionScope = 3 // 广competitionScope=03广
if (eventType !== 1) data.competitionScope = form.competitionScope //
this.$post(this.api.contestAfterLogin, data).then(({ data }) => {
this.listData = data.records
this.totals = data.total
this.$post(this.api.competitionAfterLogin, data).then(({ data }) => {
const { records } = data
const second = 1000;
const minute = second * 60;
const hour = minute * 60;
this.listData.forEach((n, k) => {
records.forEach((n, k) => {
n.invitationCode = n.setup.invitationCode
//
let now = new Date().getTime();
let signUpStartTime = new Date(this.core.dateCompatible(n.signUpStartTime)).getTime(); //
@ -284,19 +346,31 @@ export default {
let total = 0
// whetherToSignUp 01
if (now < signUpStartTime) { //
n.status = 0;
total = signUpStartTime - now
n.status = 0;
total = signUpStartTime - now
} else if (now > signUpStartTime && now < signUpEndTime) { //
n.status = n.whetherToSignUp ? 2 : 1 // 12
total = signUpEndTime - now
n.status = n.whetherToSignUp ? 2 : 1 // 12
total = signUpEndTime - now
} else if (now > signUpEndTime && now < playStartTime) { // ,
n.status = 3;
total = playStartTime - now
n.status = 3;
total = playStartTime - now
} else if (now > playStartTime && now < playEndTime) { //
n.status = 4;
total = playEndTime - now
//
let curStage = null
if (n.competitionStageList) {
for (const e of n.competitionStageList) {
if (now > new Date(e.startTime) && now < new Date(e.endTime) && !e.count) {
n.stageName = '进入' + e.stageName
curStage = e
break
}
}
}
n.curStage = curStage
n.status = 4
total = playEndTime - now
} else if (now > playEndTime) { //
n.status = 5;
n.status = 5;
}
if (total > 0) {
@ -306,7 +380,7 @@ export default {
}
//
const list = n.contestRangeRespList
const list = n.competitionRangeRespList
if (list) {
const range = []
list.map(e => {
@ -317,6 +391,9 @@ export default {
n.ranges = n.range
}
});
this.listData = records
this.totals = data.total
this.loadIns.close();
}).catch(res => {
this.loadIns.close()
@ -374,33 +451,149 @@ export default {
},
toDetail(item) {
this.SET_TYPE(this.form.eventType)
this.$router.push(`/match/details?id=${item.id}&status=${item.status}${item.end ? '&end=' + item.end : ''}`);
this.$router.push(`/match/details?id=${item.id}`);
},
handleCurrentChange(val) {
this.page = val;
this.getData();
},
//
enterSubmit() {
const form = this.enterForm
if (!form.teamId) return util.errorMsg('请选择团队')
if (!form.invitationCode) return util.errorMsg('请输入团队邀请码')
if (this.curItem.isNeedCode && !form.registrationInvitationCode) return util.errorMsg('请输入大赛邀请码')
this.$post(this.api.joinCompetitionTeam, form).then(res => {
this.enterVisible = false
this.getData()
util.successMsg('报名成功!')
}).catch(res => {})
},
//
toTeam() {
this.teamForm = {
competitionId: this.curItem.id,
teamName: '',
invitationCode: '',
registrationInvitationCode: ''
}
this.teamVisible = true
},
//
getTeam() {
this.$get(this.api.searchTeam, {
teamName: '',
competitionId: this.curItem.id
}).then(({ teamList }) => {
this.teams = teamList
}).catch(res => {})
},
//
teamSubmit() {
const form = this.teamForm
if (!form.teamName) return util.errorMsg('请输入团队名称')
if (this.teamNameRepeat) return util.errorMsg('团队名称重复,请重新输入')
if (form.invitationCode.length !== 6) return util.errorMsg('请输入6位数团队邀请码')
if (this.curItem.isNeedCode && !form.registrationInvitationCode) return util.errorMsg('请输入大赛邀请码')
this.$post(this.api.addCompetitionTeam, form).then(res => {
this.teamVisible = false
this.enterVisible = false
this.getData()
util.successMsg('报名成功!')
}).catch(res => {})
},
//
signup(item) {
const { status } = item
//
if (status == 2) {
this.$post(this.api.addApplicant, {
contestId: item.id
}).then(res => {
this.$message.success("报名成功");
this.getData();
}).catch(res => {})
} else if (status === 1) {
//
this.$confirm('是否要取消报名?', '提示', {
const { status, id } = item
//
if (util.local.get(Setting.tokenKey)) {
this.curItem = item
if (status == 4) { //
this.toSub()
} else if (status == 2) { //
//
if (item.setup.competitionType) {
this.getTeam()
this.enterForm = {
competitionId: id,
teamId: '',
invitationCode: '',
registrationInvitationCode: ''
}
this.enterVisible = true
} else { //
this.$post(this.api.addCompetitionRegistration, {
competitionId: id
}).then(res => {
this.getData()
this.$message.success('报名成功')
}).catch(res => {})
}
} else if (status == 1) {
//
this.$confirm('是否要取消报名?', '提示', {
type: 'success'
}).then(() => {
this.$post(`${this.api.cancelRegistration}?competitionId=${item.id}`).then(res => {
this.getData()
this.$message.success('取消报名成功')
}).catch(res => {})
}).catch(() => {})
}
} else {
this.$confirm('请先登录,是否直接前往登录?', "提示", {
type: 'success'
}).then(() => {
this.$post(`${this.api.cancelRegistration}?contestId=${item.id}`).then(res => {
this.$message.success('取消报名成功')
this.getData()
}).catch(res => {})
this.SET_SOURCE(item.id)
this.$router.push('/login')
}).catch(() => {})
}
},
// python
toPython() {
const form = this.curItem.curStage
let token = util.local.get(Setting.tokenKey);
util.cookies.set('assessmentId', '', -1)
util.cookies.set('startTime', '', -1)
util.cookies.set('stopTime', '', -1)
util.cookies.set('projectId', form.projectId)
util.cookies.set('token', token)
util.cookies.set('courseId', form.cid)
// util.cookies.set('curriculumName', escape(this.curriculumName))
util.cookies.set('systemId', form.systemId)
util.cookies.set('competitionId', this.curItem.id)
util.cookies.set('stageId', form.stageId)
util.cookies.set('teamId', this.curItem.teamId)
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 form = this.curItem
const { systemId, projectId, cid } = form.curStage
const competitionId = form.id
const { stageId } = form
const teamId = form.competitionRegistration.teamId
let token = util.local.get(Setting.tokenKey);
if (systemId == 11) {
//
location.href = `${Setting.systemPath}/#/index/list?curriculumName=${this.curriculumName}&token=${token}&cid=${this.courseId}&systemId=${systemId}&projectId=${projectId}&competitionId=${competitionId}&stageId=${stageId}&teamId=${teamId}&assessmentId=&classId=&stopTime=&test=true`
} else if (systemId == 12) {
//
window.open(`http://120.78.139.126:8879?systemId=${systemId}&courseId=${cid}&projectId=${projectId}&token=${token}&userId=${this.userId}&classId=1&competitionId=${competitionId}&stageId=${stageId}&teamId=${teamId}`);
} else {
// python
this.toPython(this.curProject)
}
}
}
};
@ -667,4 +860,14 @@ export default {
}
}
}
/deep/.dia-form {
.w-100 {
width: 100%;
}
.tips {
display: flex;
justify-content: center;
align-items: center;
}
}
</style>

@ -281,7 +281,7 @@
</thead>
</table>
</div>
<div class="main_table" style="margin-top: 0;overflow: auto">
<div class="main_table" ref="ach" style="max-height: 520px;margin-top: 0;overflow: auto">
<table>
<tbody>
<tr v-for="(item, i) in achs" :key="i">
@ -1016,13 +1016,13 @@ export default {
//
scrollTable() {
const dom = this.$refs.popularCourses
// const dom1 = this.$refs.gdpList
const dom1 = this.$refs.ach
setInterval(() => {
dom.scrollTop += 1
if (dom.clientHeight + dom.scrollTop === dom.scrollHeight) dom.scrollTop = 0
// dom1.scrollTop += 1
// if (dom1.clientHeight + dom1.scrollTop === dom1.scrollHeight) dom1.scrollTop = 0
dom1.scrollTop += 1
if (dom1.clientHeight + dom1.scrollTop === dom1.scrollHeight) dom1.scrollTop = 0
}, 30)
}
}

@ -90,8 +90,9 @@
</div>
<div class="right">
<p class="status"
:class="{wait: item.status == 0,signing: item.status == 2,signed: item.status == 1,playing: item.status == 4,finish: item.status == 3 || item.status == 5}"
@click.stop="signup(item)">{{ statusList[item.status] }}</p>
v-if="item.status != 4 || (item.status == 4 && item.curStage)"
:class="{wait: item.status == 0,signing: item.status == 2,signed: item.status == 1,playing: item.status == 4 && item.curStage,finish: item.status == 3 || item.status == 5}"
@click.stop="signup(item)">{{ item.status == 4 ? item.stageName : statusList[item.status] }}</p>
<p class="end-text" v-if="item.status != 5">
距离{{ endList[item.status] }}还有
<em>{{ item.end }}</em>
@ -118,6 +119,49 @@
</div>
</div>
</div>
<el-dialog title="报名" :visible.sync="enterVisible" :close-on-click-modal="false" width="300px">
<el-form class="dia-form">
<p style="margin-bottom: 5px">请选择要加入的团队</p>
<el-form-item>
<el-select class="w-100" v-model="enterForm.teamId">
<el-option v-for="(item, i) in teams" :key="i" :label="item.teamName" :value="item.teamId"></el-option>
</el-select>
</el-form-item>
<el-form-item>
<el-input placeholder="请输入团队邀请码" maxlength="6" v-model="enterForm.invitationCode"></el-input>
</el-form-item>
<el-form-item v-if="curItem.isNeedCode">
<el-input placeholder="请输入大赛邀请码" maxlength="6" v-model="enterForm.registrationInvitationCode"></el-input>
</el-form-item>
<p class="tips">
查找不到团队点击 <el-link :underline="false" type="primary" @click="toTeam">创建团队</el-link>
</p>
</el-form>
<span slot="footer" class="dialog-footer">
<el-button size="small" type="primary" @click="enterSubmit">报名</el-button>
<el-button size="small" @click="enterVisible = false">取消</el-button>
</span>
</el-dialog>
<el-dialog title="创建团队" :visible.sync="teamVisible" :close-on-click-modal="false" width="300px">
<el-form class="dia-form">
<el-form-item>
<el-input placeholder="请输入团队名称" maxlength="10" v-model="teamForm.teamName"></el-input>
</el-form-item>
<el-form-item>
<el-input placeholder="请设置团队邀请码" maxlength="6" v-model="teamForm.invitationCode"></el-input>
</el-form-item>
<el-form-item v-if="curItem.isNeedCode">
<el-input placeholder="请输入大赛邀请码" maxlength="6" v-model="teamForm.registrationInvitationCode"></el-input>
</el-form-item>
</el-form>
<span slot="footer" class="dialog-footer">
<el-button size="small" type="primary" @click="teamSubmit">创建并报名</el-button>
<el-button size="small" @click="teamVisible = false">取消</el-button>
</span>
</el-dialog>
</div>
</template>
@ -134,7 +178,7 @@ export default {
timer: null,
token: util.local.get(Setting.tokenKey),
way: 2,
statusList: ["等待报名", "已报名", "立即报名", "报名截止", "比赛中", "已结束"],
statusList: ["等待报名", "已报名", "立即报名", "报名截止", "进入初赛", "已结束"],
endList: ["报名开始", "报名截止", "报名截止", "竞赛开始", "竞赛结束", ""],
typeList: [
{
@ -194,6 +238,25 @@ export default {
contestIds: [],
isFirst: true,
timerList: [],
enterVisible: false,
enterForm: {
competitionId: '',
teamId: '',
invitationCode: '',
registrationInvitationCode: ''
},
teamVisible: false,
teams: [],
teamNameRepeat: false,
teamForm: {
competitionId: '',
registrationInvitationCode: '',
teamName: '',
invitationCode: '',
},
curItem: {}
};
},
computed: {
@ -240,6 +303,7 @@ export default {
const hour = minute * 60;
const { token } = this
records.forEach((n, k) => {
n.invitationCode = n.setup.invitationCode
//
let now = new Date().getTime();
let signUpStartTime = new Date(this.core.dateCompatible(n.signUpStartTime)).getTime(); //
@ -249,19 +313,31 @@ export default {
let total = 0
// whetherToSignUp 01
if (now < signUpStartTime) { //
n.status = 0;
total = signUpStartTime - now
n.status = 0;
total = signUpStartTime - now
} else if (now > signUpStartTime && now < signUpEndTime) { //
n.status = !token || n.whetherToSignUp ? 2 : 1 // 12
total = signUpEndTime - now
n.status = n.whetherToSignUp ? 2 : 1 // 12
total = signUpEndTime - now
} else if (now > signUpEndTime && now < playStartTime) { // ,
n.status = 3;
total = playStartTime - now
n.status = 3;
total = playStartTime - now
} else if (now > playStartTime && now < playEndTime) { //
n.status = 4;
total = playEndTime - now
//
let curStage = null
if (n.competitionStageList) {
for (const e of n.competitionStageList) {
if (now > new Date(e.startTime) && now < new Date(e.endTime) && !e.count) {
n.stageName = '进入' + e.stageName
curStage = e
break
}
}
}
n.curStage = curStage
n.status = 4
total = playEndTime - now
} else if (now > playEndTime) { //
n.status = 5;
n.status = 5;
}
if (total > 0) {
@ -271,7 +347,7 @@ export default {
}
//
const list = n.contestRangeRespList
const list = n.competitionRangeRespList
if (list) {
const range = []
list.map(e => {
@ -348,26 +424,89 @@ export default {
this.page = val;
this.getData();
},
//
enterSubmit() {
const form = this.enterForm
if (!form.teamId) return util.errorMsg('请选择团队')
if (!form.invitationCode) return util.errorMsg('请输入团队邀请码')
if (this.curItem.isNeedCode && !form.registrationInvitationCode) return util.errorMsg('请输入大赛邀请码')
this.$post(this.api.joinCompetitionTeam, form).then(res => {
this.enterVisible = false
this.getData()
util.successMsg('报名成功!')
}).catch(res => {})
},
//
toTeam() {
this.teamForm = {
competitionId: this.curItem.id,
teamName: '',
invitationCode: '',
registrationInvitationCode: ''
}
this.teamVisible = true
},
//
getTeam() {
this.$get(this.api.searchTeam, {
teamName: '',
competitionId: this.curItem.id
}).then(({ teamList }) => {
this.teams = teamList
}).catch(res => {})
},
//
teamSubmit() {
const form = this.teamForm
if (!form.teamName) return util.errorMsg('请输入团队名称')
if (this.teamNameRepeat) return util.errorMsg('团队名称重复,请重新输入')
if (form.invitationCode.length !== 6) return util.errorMsg('请输入6位数团队邀请码')
if (this.curItem.isNeedCode && !form.registrationInvitationCode) return util.errorMsg('请输入大赛邀请码')
this.$post(this.api.addCompetitionTeam, form).then(res => {
this.teamVisible = false
this.enterVisible = false
this.getData()
util.successMsg('报名成功!')
}).catch(res => {})
},
//
signup(item) {
const { status } = item
const { status, id } = item
//
if (util.local.get(Setting.tokenKey)) {
//
if (status == 2) {
this.$post(this.api.addApplicant, {
contestId: item.id
}).then(res => {
this.$message.success("报名成功");
this.getData();
}).catch(res => {})
} else if (status === 1) {
this.curItem = item
if (status == 4) { //
this.toSub()
} else if (status == 2) { //
//
if (item.setup.competitionType) {
this.getTeam()
this.enterForm = {
competitionId: id,
teamId: '',
invitationCode: '',
registrationInvitationCode: ''
}
this.enterVisible = true
} else { //
this.$post(this.api.addCompetitionRegistration, {
competitionId: id
}).then(res => {
this.getData()
this.$message.success('报名成功')
}).catch(res => {})
}
} else if (status == 1) {
//
this.$confirm('是否要取消报名?', '提示', {
type: 'success'
}).then(() => {
this.$post(`${this.api.cancelRegistration}?contestId=${item.id}`).then(res => {
this.$message.success('取消报名成功')
this.$post(`${this.api.cancelRegistration}?competitionId=${item.id}`).then(res => {
this.getData()
this.$message.success('取消报名成功')
}).catch(res => {})
}).catch(() => {})
}
@ -379,6 +518,48 @@ export default {
this.$router.push('/login')
}).catch(() => {})
}
},
// python
toPython() {
const form = this.curItem.curStage
let token = util.local.get(Setting.tokenKey);
util.cookies.set('assessmentId', '', -1)
util.cookies.set('startTime', '', -1)
util.cookies.set('stopTime', '', -1)
util.cookies.set('projectId', form.projectId)
util.cookies.set('token', token)
util.cookies.set('courseId', form.cid)
// util.cookies.set('curriculumName', escape(this.curriculumName))
util.cookies.set('systemId', form.systemId)
util.cookies.set('competitionId', this.curItem.id)
util.cookies.set('stageId', form.stageId)
util.cookies.set('teamId', this.curItem.teamId)
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 form = this.curItem
const { systemId, projectId, cid } = form.curStage
const competitionId = form.id
const { stageId } = form
const teamId = form.competitionRegistration.teamId
let token = util.local.get(Setting.tokenKey);
if (systemId == 11) {
//
location.href = `${Setting.systemPath}/#/index/list?curriculumName=${this.curriculumName}&token=${token}&cid=${this.courseId}&systemId=${systemId}&projectId=${projectId}&competitionId=${competitionId}&stageId=${stageId}&teamId=${teamId}&assessmentId=&classId=&stopTime=&test=true`
} else if (systemId == 12) {
//
window.open(`http://120.78.139.126:8879?systemId=${systemId}&courseId=${cid}&projectId=${projectId}&token=${token}&userId=${this.userId}&classId=1&competitionId=${competitionId}&stageId=${stageId}&teamId=${teamId}`);
} else {
// python
this.toPython(this.curProject)
}
}
}
};
@ -640,4 +821,14 @@ export default {
}
}
}
/deep/.dia-form {
.w-100 {
width: 100%;
}
.tips {
display: flex;
justify-content: center;
align-items: center;
}
}
</style>

@ -28,8 +28,8 @@ if (isPro) {
uploadURL = `http://121.37.12.51/`
host = "http://121.37.12.51/"; // 测试服
// host = 'https://www.occupationlab.com/' // 正式服
// host = "http://192.168.31.51:9000/"; // 榕
// host = "http://192.168.31.116:9000/"; // 赓
host = "http://192.168.31.51:9000/"; // 榕
host = "http://192.168.31.116:9000/"; // 赓
}
const Setting = {

Loading…
Cancel
Save