|
|
|
@ -1,99 +1,127 @@ |
|
|
|
|
<template> |
|
|
|
|
<div class="wrap index"> |
|
|
|
|
<div class="search"> |
|
|
|
|
<h6>创业活动</h6> |
|
|
|
|
<div class="input"> |
|
|
|
|
<img src="@/assets/img/search.png" alt=""> |
|
|
|
|
<input type="text" placeholder="请输入关键词" v-model="keyword"> |
|
|
|
|
</div> |
|
|
|
|
</div> |
|
|
|
|
<div class="wrap index"> |
|
|
|
|
<div class="search"> |
|
|
|
|
<h6>创业活动</h6> |
|
|
|
|
<div class="input"> |
|
|
|
|
<img src="@/assets/img/search.png" |
|
|
|
|
alt=""> |
|
|
|
|
<input type="text" |
|
|
|
|
placeholder="请输入关键词" |
|
|
|
|
v-model="keyword"> |
|
|
|
|
</div> |
|
|
|
|
</div> |
|
|
|
|
|
|
|
|
|
<div class="main"> |
|
|
|
|
<div class="center-wrap list-inner"> |
|
|
|
|
<ul v-if="token" class="nav"> |
|
|
|
|
<li :class="{ active: form.whetherToSignUp === item.id }" v-for="(item, index) in typeList" :key="index" @click="changeType(item.id)">{{ item.name }} |
|
|
|
|
</li> |
|
|
|
|
</ul> |
|
|
|
|
<div class="list-wrap"> |
|
|
|
|
<!-- 课程筛选 --> |
|
|
|
|
<div class="filter"> |
|
|
|
|
<div> |
|
|
|
|
<dl> |
|
|
|
|
<dt>筛选排序:</dt> |
|
|
|
|
<dd v-for="(item, i) in sorts" :key="i" :class="{active: form.filterSort == item.id}" @click="changeSort(item.id)">{{ item.name }}</dd> |
|
|
|
|
</dl> |
|
|
|
|
</div> |
|
|
|
|
<el-button type="primary" @click="$router.push('manage')">我的项目</el-button> |
|
|
|
|
</div> |
|
|
|
|
<div class="main"> |
|
|
|
|
<div class="center-wrap list-inner"> |
|
|
|
|
<ul v-if="token" |
|
|
|
|
class="nav"> |
|
|
|
|
<li :class="{ active: form.whetherToSignUp === item.id }" |
|
|
|
|
v-for="(item, index) in typeList" |
|
|
|
|
:key="index" |
|
|
|
|
@click="changeType(item.id)">{{ item.name }} |
|
|
|
|
</li> |
|
|
|
|
</ul> |
|
|
|
|
<div class="list-wrap"> |
|
|
|
|
<!-- 课程筛选 --> |
|
|
|
|
<div class="filter"> |
|
|
|
|
<div> |
|
|
|
|
<dl> |
|
|
|
|
<dt>筛选排序:</dt> |
|
|
|
|
<dd v-for="(item, i) in sorts" |
|
|
|
|
:key="i" |
|
|
|
|
:class="{active: form.filterSort == item.id}" |
|
|
|
|
@click="changeSort(item.id)">{{ item.name }}</dd> |
|
|
|
|
</dl> |
|
|
|
|
</div> |
|
|
|
|
<el-button type="primary" |
|
|
|
|
@click="$router.push('manage')">我的项目</el-button> |
|
|
|
|
</div> |
|
|
|
|
|
|
|
|
|
<div class="list"> |
|
|
|
|
<template v-if="listData.length"> |
|
|
|
|
<ul> |
|
|
|
|
<li v-for="(item,index) in listData" :key="index" @click="toDetail(item)"> |
|
|
|
|
<div class="left"> |
|
|
|
|
<div class="cover"> |
|
|
|
|
<img :src="item.coverUrl || 'https://huoran.oss-cn-shenzhen.aliyuncs.com/20230515/jpg/1657937339328520192.jpg'" alt=""> |
|
|
|
|
</div> |
|
|
|
|
<div class="info"> |
|
|
|
|
<div class="title">{{ item.projectName }}</div> |
|
|
|
|
<div class="metas"> |
|
|
|
|
<div> |
|
|
|
|
<span class="label">报名时间:</span><span class="val">{{ item.signUpStartTime}} ~ {{ item.signUpEndTime }}</span> |
|
|
|
|
</div> |
|
|
|
|
<div> |
|
|
|
|
<span class="label">项目时间:</span><span class="val">{{ item.playStartTime}} ~ {{ item.playEndTime }}</span> |
|
|
|
|
</div> |
|
|
|
|
<template v-if="item.initiator"> |
|
|
|
|
<div :class="{'flex-top': item.initiator.split(',').length > 1}"> |
|
|
|
|
<span class="label">发起方: </span> |
|
|
|
|
<span class="val">{{ item.initiator }}</span> |
|
|
|
|
</div> |
|
|
|
|
</template> |
|
|
|
|
</div> |
|
|
|
|
</div> |
|
|
|
|
</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 == 4}" @click.stop="signup(item)">{{ statusList[item.status] }}</p> |
|
|
|
|
<p class="end-text" v-if="item.end"> |
|
|
|
|
距离{{ endList[item.status] }}还有 |
|
|
|
|
<em >{{ item.end }}</em> |
|
|
|
|
</p> |
|
|
|
|
</div> |
|
|
|
|
</li> |
|
|
|
|
</ul> |
|
|
|
|
<div class="pagination"> |
|
|
|
|
<el-pagination background layout="total, prev, pager, next" :total="totals" |
|
|
|
|
@current-change="handleCurrentChange" |
|
|
|
|
:current-page="page"> |
|
|
|
|
</el-pagination> |
|
|
|
|
</div> |
|
|
|
|
</template> |
|
|
|
|
<template v-else> |
|
|
|
|
<div class="empty"> |
|
|
|
|
<div> |
|
|
|
|
<img src="@/assets/img/none.png" alt=""> |
|
|
|
|
<p>暂无赛事</p> |
|
|
|
|
</div> |
|
|
|
|
</div> |
|
|
|
|
<div class="list"> |
|
|
|
|
<template v-if="listData.length"> |
|
|
|
|
<ul> |
|
|
|
|
<li v-for="(item,index) in listData" |
|
|
|
|
:key="index" |
|
|
|
|
@click="toDetail(item)"> |
|
|
|
|
<div class="left"> |
|
|
|
|
<div class="cover"> |
|
|
|
|
<img :src="item.coverUrl || 'https://huoran.oss-cn-shenzhen.aliyuncs.com/20230515/jpg/1657937339328520192.jpg'" |
|
|
|
|
alt=""> |
|
|
|
|
</div> |
|
|
|
|
<div class="info"> |
|
|
|
|
<div class="title">{{ item.projectName }}</div> |
|
|
|
|
<div class="metas"> |
|
|
|
|
<div> |
|
|
|
|
<span class="label">报名时间:</span><span class="val">{{ item.signUpStartTime}} ~ {{ item.signUpEndTime }}</span> |
|
|
|
|
</div> |
|
|
|
|
<div> |
|
|
|
|
<span class="label">项目时间:</span><span class="val">{{ item.playStartTime}} ~ {{ item.playEndTime }}</span> |
|
|
|
|
</div> |
|
|
|
|
<template v-if="item.initiator"> |
|
|
|
|
<div :class="{'flex-top': item.initiator.split(',').length > 1}"> |
|
|
|
|
<span class="label">发起方: </span> |
|
|
|
|
<span class="val">{{ item.initiator }}</span> |
|
|
|
|
</div> |
|
|
|
|
</template> |
|
|
|
|
</div> |
|
|
|
|
</div> |
|
|
|
|
</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 == 4}" |
|
|
|
|
@click.stop="signup(item)">{{ statusList[item.status] }}</p> |
|
|
|
|
<p class="end-text" |
|
|
|
|
v-if="item.end"> |
|
|
|
|
距离{{ endList[item.status] }}还有 |
|
|
|
|
<em>{{ item.end }}</em> |
|
|
|
|
</p> |
|
|
|
|
</div> |
|
|
|
|
</li> |
|
|
|
|
</ul> |
|
|
|
|
<div class="pagination"> |
|
|
|
|
<el-pagination background |
|
|
|
|
layout="total, prev, pager, next" |
|
|
|
|
:total="totals" |
|
|
|
|
@current-change="handleCurrentChange" |
|
|
|
|
:current-page="page"> |
|
|
|
|
</el-pagination> |
|
|
|
|
</div> |
|
|
|
|
</template> |
|
|
|
|
<template v-else> |
|
|
|
|
<div class="empty"> |
|
|
|
|
<div> |
|
|
|
|
<img src="@/assets/img/none.png" |
|
|
|
|
alt=""> |
|
|
|
|
<p>暂无赛事</p> |
|
|
|
|
</div> |
|
|
|
|
</div> |
|
|
|
|
</div> |
|
|
|
|
</template> |
|
|
|
|
</div> |
|
|
|
|
</div> |
|
|
|
|
|
|
|
|
|
<el-dialog title="报名" :visible.sync="signupVisible" :close-on-click-modal="false" width="300px"> |
|
|
|
|
<el-form class="dia-form"> |
|
|
|
|
<el-form-item> |
|
|
|
|
<el-input placeholder="请输入4位数大赛邀请码" maxlength="4" v-model="invitationCode"></el-input> |
|
|
|
|
</el-form-item> |
|
|
|
|
</el-form> |
|
|
|
|
<span slot="footer" class="dialog-footer"> |
|
|
|
|
<el-button size="small" type="primary" @click="signupSubmit">报名</el-button> |
|
|
|
|
<el-button size="small" @click="signupVisible = false">取消</el-button> |
|
|
|
|
</span> |
|
|
|
|
</el-dialog> |
|
|
|
|
</div> |
|
|
|
|
</div> |
|
|
|
|
|
|
|
|
|
<el-dialog title="报名" |
|
|
|
|
:visible.sync="signupVisible" |
|
|
|
|
:close-on-click-modal="false" |
|
|
|
|
width="300px"> |
|
|
|
|
<el-form class="dia-form"> |
|
|
|
|
<el-form-item> |
|
|
|
|
<el-input placeholder="请输入4位数大赛邀请码" |
|
|
|
|
maxlength="4" |
|
|
|
|
v-model="invitationCode"></el-input> |
|
|
|
|
</el-form-item> |
|
|
|
|
</el-form> |
|
|
|
|
<span slot="footer" |
|
|
|
|
class="dialog-footer"> |
|
|
|
|
<el-button size="small" |
|
|
|
|
type="primary" |
|
|
|
|
@click="signupSubmit">报名</el-button> |
|
|
|
|
<el-button size="small" |
|
|
|
|
@click="signupVisible = false">取消</el-button> |
|
|
|
|
</span> |
|
|
|
|
</el-dialog> |
|
|
|
|
</div> |
|
|
|
|
</template> |
|
|
|
|
|
|
|
|
|
<script> |
|
|
|
@ -102,270 +130,270 @@ import { Loading } from "element-ui"; |
|
|
|
|
import Setting from "@/setting" |
|
|
|
|
import util from "@/libs/util" |
|
|
|
|
export default { |
|
|
|
|
data() { |
|
|
|
|
return { |
|
|
|
|
timer: null, |
|
|
|
|
redisTimer: null, |
|
|
|
|
token: util.local.get(Setting.tokenKey), |
|
|
|
|
statusList: ["待报名", "取消报名", "马上报名", "报名截止", "已结束"], |
|
|
|
|
endList: ["报名开始", "报名截止", "报名截止", "项目开始", "项目结束"], |
|
|
|
|
typeList: [ |
|
|
|
|
{ |
|
|
|
|
id: '', |
|
|
|
|
name: "本校项目" |
|
|
|
|
}, |
|
|
|
|
{ |
|
|
|
|
id: 0, |
|
|
|
|
name: "已报名" |
|
|
|
|
} |
|
|
|
|
], |
|
|
|
|
form: { |
|
|
|
|
filterSort: 0, |
|
|
|
|
whetherToSignUp: '' |
|
|
|
|
}, |
|
|
|
|
sorts: [ |
|
|
|
|
{ |
|
|
|
|
id: 0, |
|
|
|
|
name: '最近更新' |
|
|
|
|
}, |
|
|
|
|
{ |
|
|
|
|
id: 1, |
|
|
|
|
name: '近期报名' |
|
|
|
|
} |
|
|
|
|
], |
|
|
|
|
sort: 1, |
|
|
|
|
keyword: "", |
|
|
|
|
searchTimer: null, |
|
|
|
|
page: 1, |
|
|
|
|
pageSize: 10, |
|
|
|
|
totals: 0, |
|
|
|
|
listData: [], |
|
|
|
|
loadIns: null, |
|
|
|
|
timerList: [], |
|
|
|
|
signupVisible: false, |
|
|
|
|
curRow: {}, |
|
|
|
|
invitationCode: '' |
|
|
|
|
}; |
|
|
|
|
}, |
|
|
|
|
watch: { |
|
|
|
|
keyword: function(val) { |
|
|
|
|
clearTimeout(this.searchTimer); |
|
|
|
|
this.searchTimer = setTimeout(() => { |
|
|
|
|
this.initData(); |
|
|
|
|
}, 500); |
|
|
|
|
data () { |
|
|
|
|
return { |
|
|
|
|
timer: null, |
|
|
|
|
redisTimer: null, |
|
|
|
|
token: util.local.get(Setting.tokenKey), |
|
|
|
|
statusList: ["待报名", "取消报名", "马上报名", "报名截止", "已结束"], |
|
|
|
|
endList: ["报名开始", "报名截止", "报名截止", "项目开始", "项目结束"], |
|
|
|
|
typeList: [ |
|
|
|
|
{ |
|
|
|
|
id: '', |
|
|
|
|
name: "本校项目" |
|
|
|
|
}, |
|
|
|
|
{ |
|
|
|
|
id: 0, |
|
|
|
|
name: "已报名" |
|
|
|
|
} |
|
|
|
|
}, |
|
|
|
|
mounted() { |
|
|
|
|
this.getData() |
|
|
|
|
this.$once('hook:beforeDestroy', function() { |
|
|
|
|
this.clearTimer() |
|
|
|
|
clearInterval(this.redisTimer) |
|
|
|
|
], |
|
|
|
|
form: { |
|
|
|
|
filterSort: 0, |
|
|
|
|
whetherToSignUp: '' |
|
|
|
|
}, |
|
|
|
|
sorts: [ |
|
|
|
|
{ |
|
|
|
|
id: 0, |
|
|
|
|
name: '最近更新' |
|
|
|
|
}, |
|
|
|
|
{ |
|
|
|
|
id: 1, |
|
|
|
|
name: '近期报名' |
|
|
|
|
} |
|
|
|
|
], |
|
|
|
|
sort: 1, |
|
|
|
|
keyword: "", |
|
|
|
|
searchTimer: null, |
|
|
|
|
page: 1, |
|
|
|
|
pageSize: 10, |
|
|
|
|
totals: 0, |
|
|
|
|
listData: [], |
|
|
|
|
loadIns: null, |
|
|
|
|
timerList: [], |
|
|
|
|
signupVisible: false, |
|
|
|
|
curRow: {}, |
|
|
|
|
invitationCode: '' |
|
|
|
|
}; |
|
|
|
|
}, |
|
|
|
|
watch: { |
|
|
|
|
keyword: function (val) { |
|
|
|
|
clearTimeout(this.searchTimer); |
|
|
|
|
this.searchTimer = setTimeout(() => { |
|
|
|
|
this.initData(); |
|
|
|
|
}, 500); |
|
|
|
|
} |
|
|
|
|
}, |
|
|
|
|
mounted () { |
|
|
|
|
this.getData() |
|
|
|
|
this.$once('hook:beforeDestroy', function () { |
|
|
|
|
this.clearTimer() |
|
|
|
|
clearInterval(this.redisTimer) |
|
|
|
|
}) |
|
|
|
|
}, |
|
|
|
|
methods: { |
|
|
|
|
...mapMutations('match', [ |
|
|
|
|
'SET_TYPE' |
|
|
|
|
]), |
|
|
|
|
getList () { |
|
|
|
|
this.clearTimer() |
|
|
|
|
const data = { |
|
|
|
|
pageNum: this.page, |
|
|
|
|
pageSize: this.pageSize, |
|
|
|
|
platformSource: 2, |
|
|
|
|
keyWords: this.keyword, |
|
|
|
|
...this.form |
|
|
|
|
} |
|
|
|
|
this.$post(this.api.schoolActivities, data).then(({ data }) => { |
|
|
|
|
const { records } = data |
|
|
|
|
this.listData = records |
|
|
|
|
this.totals = data.total |
|
|
|
|
this.handleStatus() |
|
|
|
|
// this.loadIns.close(); |
|
|
|
|
}).catch(res => { |
|
|
|
|
// this.loadIns.close() |
|
|
|
|
}) |
|
|
|
|
}, |
|
|
|
|
methods: { |
|
|
|
|
...mapMutations('match', [ |
|
|
|
|
'SET_TYPE' |
|
|
|
|
]), |
|
|
|
|
getList() { |
|
|
|
|
this.clearTimer() |
|
|
|
|
const data = { |
|
|
|
|
pageNum: this.page, |
|
|
|
|
pageSize: this.pageSize, |
|
|
|
|
platformSource: 2, |
|
|
|
|
keyWords: this.keyword, |
|
|
|
|
...this.form |
|
|
|
|
} |
|
|
|
|
this.$post(this.api.schoolActivities, data).then(({ data }) => { |
|
|
|
|
const { records } = data |
|
|
|
|
this.listData = records |
|
|
|
|
this.totals = data.total |
|
|
|
|
this.handleStatus() |
|
|
|
|
// this.loadIns.close(); |
|
|
|
|
}).catch(res => { |
|
|
|
|
// this.loadIns.close() |
|
|
|
|
}) |
|
|
|
|
}, |
|
|
|
|
// 定时处理时间及状态 |
|
|
|
|
handleStatus() { |
|
|
|
|
this.listData.map(item => { |
|
|
|
|
if (item.signUpStartTime && item.signUpEndTime && item.playStartTime && item.playEndTime) { |
|
|
|
|
let total = '' |
|
|
|
|
let time = '' |
|
|
|
|
let status = '' |
|
|
|
|
let signUpStartTime = new Date(this.core.dateCompatible(item.signUpStartTime)) // 报名开始时间 |
|
|
|
|
let signUpEndTime = new Date(this.core.dateCompatible(item.signUpEndTime)) // 报名结束时间 |
|
|
|
|
let playStartTime = new Date(this.core.dateCompatible(item.playStartTime)) // 比赛开始时间 |
|
|
|
|
let playEndTime = new Date(this.core.dateCompatible(item.playEndTime)) // 比赛结束时间 |
|
|
|
|
let timer = setInterval(() => { |
|
|
|
|
const now = new Date() |
|
|
|
|
if (now < signUpStartTime) { // 报名没开始 |
|
|
|
|
status = 0 |
|
|
|
|
total = signUpStartTime - now |
|
|
|
|
} else if (now > signUpStartTime && now < signUpEndTime) { // 报名进行中 |
|
|
|
|
// whetherToSignUp 0已报名,1未报名 |
|
|
|
|
status = item.whetherToSignUp ? 2 : 1 // 1已报名,2立即报名 |
|
|
|
|
total = signUpEndTime - now |
|
|
|
|
} else if (now > signUpEndTime && now < playStartTime) { // 报名结束了,但比赛没开始 |
|
|
|
|
status = 3 |
|
|
|
|
total = playStartTime - now |
|
|
|
|
} else if (now > playEndTime) { // 比赛结束 |
|
|
|
|
status = 4 |
|
|
|
|
} |
|
|
|
|
this.$set(item, 'status', status) |
|
|
|
|
total = total / 1000 |
|
|
|
|
--total |
|
|
|
|
if (total > 86400) { // 超过一天则显示天数 |
|
|
|
|
// clearInterval(timer) |
|
|
|
|
this.$set(item, 'end', Math.floor(total / 86400) + '天') |
|
|
|
|
} else if (total > 0) { // 一天之内,显示时分秒 |
|
|
|
|
let hours = Math.floor(total / (60 * 60)) |
|
|
|
|
let minutes = Math.floor(total % (60 * 60) / 60) |
|
|
|
|
let seconds = Math.floor(total % (60 * 60) % 60) |
|
|
|
|
time = `${this.core.formateTime(hours)}:${this.core.formateTime(minutes)}:${this.core.formateTime(seconds)}` |
|
|
|
|
if (total > 0) this.$set(item, 'end', time) |
|
|
|
|
} else if (item.status === 4) { // 竞赛结束,清除定时器 |
|
|
|
|
clearInterval(timer) |
|
|
|
|
} |
|
|
|
|
}, 1000) |
|
|
|
|
this.timerList.push(timer) |
|
|
|
|
// 定时处理时间及状态 |
|
|
|
|
handleStatus () { |
|
|
|
|
this.listData.map(item => { |
|
|
|
|
if (item.signUpStartTime && item.signUpEndTime && item.playStartTime && item.playEndTime) { |
|
|
|
|
let total = '' |
|
|
|
|
let time = '' |
|
|
|
|
let status = '' |
|
|
|
|
let signUpStartTime = new Date(this.core.dateCompatible(item.signUpStartTime)) // 报名开始时间 |
|
|
|
|
let signUpEndTime = new Date(this.core.dateCompatible(item.signUpEndTime)) // 报名结束时间 |
|
|
|
|
let playStartTime = new Date(this.core.dateCompatible(item.playStartTime)) // 比赛开始时间 |
|
|
|
|
let playEndTime = new Date(this.core.dateCompatible(item.playEndTime)) // 比赛结束时间 |
|
|
|
|
let timer = setInterval(() => { |
|
|
|
|
const now = new Date() |
|
|
|
|
if (now < signUpStartTime) { // 报名没开始 |
|
|
|
|
status = 0 |
|
|
|
|
total = signUpStartTime - now |
|
|
|
|
} else if (now > signUpStartTime && now < signUpEndTime) { // 报名进行中 |
|
|
|
|
// whetherToSignUp 0已报名,1未报名 |
|
|
|
|
status = item.whetherToSignUp ? 2 : 1 // 1已报名,2立即报名 |
|
|
|
|
total = signUpEndTime - now |
|
|
|
|
} else if (now > signUpEndTime && now < playStartTime) { // 报名结束了,但比赛没开始 |
|
|
|
|
status = 3 |
|
|
|
|
total = playStartTime - now |
|
|
|
|
} else if (now > playEndTime) { // 比赛结束 |
|
|
|
|
status = 4 |
|
|
|
|
} |
|
|
|
|
}) |
|
|
|
|
}, |
|
|
|
|
// 清除定时器 |
|
|
|
|
clearTimer() { |
|
|
|
|
this.timerList.forEach(n => { |
|
|
|
|
clearInterval(n) |
|
|
|
|
}) |
|
|
|
|
this.timerList = [] |
|
|
|
|
}, |
|
|
|
|
getData() { |
|
|
|
|
// this.loadIns = Loading.service() |
|
|
|
|
this.getList() |
|
|
|
|
// if (!Setting.isDev) { |
|
|
|
|
clearInterval(this.redisTimer) |
|
|
|
|
this.redisTimer = setInterval(this.getRedis, 1000) |
|
|
|
|
// } |
|
|
|
|
}, |
|
|
|
|
initData() { |
|
|
|
|
this.page = 1 |
|
|
|
|
this.getData() |
|
|
|
|
}, |
|
|
|
|
// 获取redis缓存 |
|
|
|
|
getRedis() { |
|
|
|
|
this.$post(this.api.getRedisCacheActivity).then(({ data }) => { |
|
|
|
|
if (data) { |
|
|
|
|
localStorage.getItem('activityTimestampClient') !== data && this.getList() // 本地缓存跟redis返回的不一样,就查询列表 |
|
|
|
|
localStorage.setItem('activityTimestampClient', data) |
|
|
|
|
this.$set(item, 'status', status) |
|
|
|
|
total = total / 1000 |
|
|
|
|
--total |
|
|
|
|
if (total > 86400) { // 超过一天则显示天数 |
|
|
|
|
// clearInterval(timer) |
|
|
|
|
this.$set(item, 'end', Math.floor(total / 86400) + '天') |
|
|
|
|
} else if (total > 0) { // 一天之内,显示时分秒 |
|
|
|
|
let hours = Math.floor(total / (60 * 60)) |
|
|
|
|
let minutes = Math.floor(total % (60 * 60) / 60) |
|
|
|
|
let seconds = Math.floor(total % (60 * 60) % 60) |
|
|
|
|
time = `${this.core.formateTime(hours)}:${this.core.formateTime(minutes)}:${this.core.formateTime(seconds)}` |
|
|
|
|
if (total > 0) this.$set(item, 'end', time) |
|
|
|
|
} else if (item.status === 4) { // 竞赛结束,清除定时器 |
|
|
|
|
clearInterval(timer) |
|
|
|
|
} |
|
|
|
|
}).catch(res => {}) |
|
|
|
|
}, |
|
|
|
|
changeType(type) { |
|
|
|
|
const { form } = this |
|
|
|
|
form.competitionScope = 3 |
|
|
|
|
form.provinceId = '' |
|
|
|
|
form.cityId = '' |
|
|
|
|
form.filterSort = 2 |
|
|
|
|
form.whetherToSignUp = type |
|
|
|
|
this.initData() |
|
|
|
|
}, |
|
|
|
|
// 筛选排序 |
|
|
|
|
changeSort(type) { |
|
|
|
|
this.form.filterSort = type |
|
|
|
|
this.initData() |
|
|
|
|
}, |
|
|
|
|
toDetail(item) { |
|
|
|
|
this.$router.push(`/activity/details?id=${item.id}`); |
|
|
|
|
}, |
|
|
|
|
handleCurrentChange(val) { |
|
|
|
|
this.page = val; |
|
|
|
|
this.getData(); |
|
|
|
|
}, |
|
|
|
|
}, 1000) |
|
|
|
|
this.timerList.push(timer) |
|
|
|
|
} |
|
|
|
|
}) |
|
|
|
|
}, |
|
|
|
|
// 清除定时器 |
|
|
|
|
clearTimer () { |
|
|
|
|
this.timerList.forEach(n => { |
|
|
|
|
clearInterval(n) |
|
|
|
|
}) |
|
|
|
|
this.timerList = [] |
|
|
|
|
}, |
|
|
|
|
getData () { |
|
|
|
|
// this.loadIns = Loading.service() |
|
|
|
|
this.getList() |
|
|
|
|
// if (!Setting.isDev) { |
|
|
|
|
clearInterval(this.redisTimer) |
|
|
|
|
this.redisTimer = setInterval(this.getRedis, 1000) |
|
|
|
|
// } |
|
|
|
|
}, |
|
|
|
|
initData () { |
|
|
|
|
this.page = 1 |
|
|
|
|
this.getData() |
|
|
|
|
}, |
|
|
|
|
// 获取redis缓存 |
|
|
|
|
getRedis () { |
|
|
|
|
this.$post(this.api.getRedisCacheActivity).then(({ data }) => { |
|
|
|
|
if (data) { |
|
|
|
|
localStorage.getItem('activityTimestampClient') !== data && this.getList() // 本地缓存跟redis返回的不一样,就查询列表 |
|
|
|
|
localStorage.setItem('activityTimestampClient', data) |
|
|
|
|
} |
|
|
|
|
}).catch(res => { }) |
|
|
|
|
}, |
|
|
|
|
changeType (type) { |
|
|
|
|
const { form } = this |
|
|
|
|
form.competitionScope = 3 |
|
|
|
|
form.provinceId = '' |
|
|
|
|
form.cityId = '' |
|
|
|
|
form.filterSort = 2 |
|
|
|
|
form.whetherToSignUp = type |
|
|
|
|
this.initData() |
|
|
|
|
}, |
|
|
|
|
// 筛选排序 |
|
|
|
|
changeSort (type) { |
|
|
|
|
this.form.filterSort = type |
|
|
|
|
this.initData() |
|
|
|
|
}, |
|
|
|
|
toDetail (item) { |
|
|
|
|
this.$router.push(`/activity/details?id=${item.id}`); |
|
|
|
|
}, |
|
|
|
|
handleCurrentChange (val) { |
|
|
|
|
this.page = val; |
|
|
|
|
this.getData(); |
|
|
|
|
}, |
|
|
|
|
|
|
|
|
|
// 报名提交 |
|
|
|
|
signupSubmit() { |
|
|
|
|
// 报名提交 |
|
|
|
|
signupSubmit () { |
|
|
|
|
this.$post(this.api.saveActivityApplicant, { |
|
|
|
|
activityId: this.curRow.id, |
|
|
|
|
registrationInvitationCode: this.invitationCode |
|
|
|
|
}).then(res => { |
|
|
|
|
this.signupVisible = false |
|
|
|
|
this.getData() |
|
|
|
|
this.$message.success('报名成功') |
|
|
|
|
}).catch(res => { }) |
|
|
|
|
}, |
|
|
|
|
// 报名 |
|
|
|
|
signup (item) { |
|
|
|
|
const { status, id } = item |
|
|
|
|
if (status == 2) { // 报名 |
|
|
|
|
// 如果需要邀请码 |
|
|
|
|
if (item.isNeedCode) { |
|
|
|
|
this.invitationCode = '' |
|
|
|
|
this.curRow = item |
|
|
|
|
this.signupVisible = true |
|
|
|
|
} else { |
|
|
|
|
this.$post(this.api.saveActivityApplicant, { |
|
|
|
|
activityId: this.curRow.id, |
|
|
|
|
registrationInvitationCode: this.invitationCode |
|
|
|
|
activityId: id |
|
|
|
|
}).then(res => { |
|
|
|
|
this.signupVisible = false |
|
|
|
|
this.getData() |
|
|
|
|
this.$message.success('报名成功') |
|
|
|
|
}).catch(res => {}) |
|
|
|
|
}, |
|
|
|
|
// 报名 |
|
|
|
|
signup(item) { |
|
|
|
|
const { status, id } = item |
|
|
|
|
if (status == 2) { // 报名 |
|
|
|
|
// 如果需要邀请码 |
|
|
|
|
if (item.isNeedCode) { |
|
|
|
|
this.invitationCode = '' |
|
|
|
|
this.curRow = item |
|
|
|
|
this.signupVisible = true |
|
|
|
|
} else { |
|
|
|
|
this.$post(this.api.saveActivityApplicant, { |
|
|
|
|
activityId: id |
|
|
|
|
}).then(res => { |
|
|
|
|
this.getData() |
|
|
|
|
this.$message.success('报名成功') |
|
|
|
|
}).catch(res => {}) |
|
|
|
|
} |
|
|
|
|
} else if (status == 1) { |
|
|
|
|
// 已报名,点击取消报名 |
|
|
|
|
this.$confirm('是否要取消报名?', '提示', { |
|
|
|
|
type: 'success' |
|
|
|
|
}).then(() => { |
|
|
|
|
this.$post(`${this.api.delActivityApplicant}?id=${item.cancelId}`).then(res => { |
|
|
|
|
this.getData() |
|
|
|
|
this.$message.success('取消报名成功') |
|
|
|
|
}).catch(res => {}) |
|
|
|
|
}).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(form.systemName)) |
|
|
|
|
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('stopTime', form.endTime) |
|
|
|
|
util.cookies.set('resultsDetails', form.resultsDetails) |
|
|
|
|
util.cookies.set('resultAnnouncementTime', form.resultAnnouncementTime) |
|
|
|
|
util.cookies.set('fromManager', '', -1) |
|
|
|
|
// 8个python子系统都跳这个地址,子系统会通过cookie里的systemId识别展示哪套系统 |
|
|
|
|
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, stageId } = form.curStage |
|
|
|
|
const competitionId = form.id |
|
|
|
|
const teamId = form.teamId |
|
|
|
|
let token = util.local.get(Setting.tokenKey); |
|
|
|
|
if (systemId == 11) { |
|
|
|
|
// 银行系统 |
|
|
|
|
location.href = `${Setting.systemPath}/#/index/list?curriculumName=${this.curriculumName}&token=${token}&cid=${cid}&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() |
|
|
|
|
} |
|
|
|
|
}).catch(res => { }) |
|
|
|
|
} |
|
|
|
|
} else if (status == 1) { |
|
|
|
|
// 已报名,点击取消报名 |
|
|
|
|
this.$confirm('是否要取消报名?', '提示', { |
|
|
|
|
type: 'success' |
|
|
|
|
}).then(() => { |
|
|
|
|
this.$post(`${this.api.delActivityApplicant}?id=${item.cancelId}`).then(res => { |
|
|
|
|
this.getData() |
|
|
|
|
this.$message.success('取消报名成功') |
|
|
|
|
}).catch(res => { }) |
|
|
|
|
}).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(form.systemName)) |
|
|
|
|
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('stopTime', form.endTime) |
|
|
|
|
util.cookies.set('resultsDetails', form.resultsDetails) |
|
|
|
|
util.cookies.set('resultAnnouncementTime', form.resultAnnouncementTime) |
|
|
|
|
util.cookies.set('fromManager', '', -1) |
|
|
|
|
// 8个python子系统都跳这个地址,子系统会通过cookie里的systemId识别展示哪套系统 |
|
|
|
|
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, stageId } = form.curStage |
|
|
|
|
const competitionId = form.id |
|
|
|
|
const teamId = form.teamId |
|
|
|
|
let token = util.local.get(Setting.tokenKey); |
|
|
|
|
if (systemId == 11) { |
|
|
|
|
// 银行系统 |
|
|
|
|
location.href = `${Setting.systemPath}/#/index/list?curriculumName=${this.curriculumName}&token=${token}&cid=${cid}&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() |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
}; |
|
|
|
|
</script> |
|
|
|
|
|
|
|
|
@ -402,11 +430,11 @@ export default { |
|
|
|
|
border-radius: 4px; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
.main{ |
|
|
|
|
background: url(../../../assets/img/match-bg1.png) (0px 95px)/auto auto no-repeat, |
|
|
|
|
url(../../../assets/img/match-bg2.png) (98% bottom)/auto auto no-repeat; |
|
|
|
|
.main { |
|
|
|
|
background: url(../../../assets/img/match-bg1.png) (0px 95px) / auto auto no-repeat, |
|
|
|
|
url(../../../assets/img/match-bg2.png) (98% bottom) / auto auto no-repeat; |
|
|
|
|
.center-wrap { |
|
|
|
|
width: 1078px; |
|
|
|
|
width: 1078px; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
.filter { |
|
|
|
@ -441,23 +469,23 @@ export default { |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
.select-wrap { |
|
|
|
|
display: inline-flex; |
|
|
|
|
align-items: center; |
|
|
|
|
margin: 0 10px; |
|
|
|
|
.label { |
|
|
|
|
margin-right: 10px; |
|
|
|
|
white-space: nowrap; |
|
|
|
|
} |
|
|
|
|
.el-select { |
|
|
|
|
width: 130px; |
|
|
|
|
} |
|
|
|
|
display: inline-flex; |
|
|
|
|
align-items: center; |
|
|
|
|
margin: 0 10px; |
|
|
|
|
.label { |
|
|
|
|
margin-right: 10px; |
|
|
|
|
white-space: nowrap; |
|
|
|
|
} |
|
|
|
|
.el-select { |
|
|
|
|
width: 130px; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
.list-inner { |
|
|
|
|
display: flex; |
|
|
|
|
justify-content: center; |
|
|
|
|
align-items:flex-start; |
|
|
|
|
align-items: flex-start; |
|
|
|
|
} |
|
|
|
|
.nav{ |
|
|
|
|
.nav { |
|
|
|
|
width: 156px; |
|
|
|
|
text-align: right; |
|
|
|
|
overflow: hidden; |
|
|
|
@ -516,11 +544,11 @@ export default { |
|
|
|
|
font-size: 14px; |
|
|
|
|
color: #fff; |
|
|
|
|
white-space: nowrap; |
|
|
|
|
background-color: #52C41A; |
|
|
|
|
background-color: #52c41a; |
|
|
|
|
border-radius: 4px; |
|
|
|
|
@include ellipsis(); |
|
|
|
|
&.wait { |
|
|
|
|
background-color: #FAAD14; |
|
|
|
|
background-color: #faad14; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
&.signing { |
|
|
|
@ -528,7 +556,7 @@ export default { |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
&.signed { |
|
|
|
|
background-color: #52C41A; |
|
|
|
|
background-color: #52c41a; |
|
|
|
|
} |
|
|
|
|
&.playing { |
|
|
|
|
background-color: #f96d6d; |
|
|
|
@ -547,7 +575,7 @@ export default { |
|
|
|
|
cursor: pointer; |
|
|
|
|
|
|
|
|
|
&:hover { |
|
|
|
|
opacity: .9; |
|
|
|
|
opacity: 0.9; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
&.disabled { |
|
|
|
@ -558,7 +586,7 @@ export default { |
|
|
|
|
|
|
|
|
|
.end-text { |
|
|
|
|
margin-top: 10px; |
|
|
|
|
color: rgba(0, 0, 0, .65); |
|
|
|
|
color: rgba(0, 0, 0, 0.65); |
|
|
|
|
font-size: 12px; |
|
|
|
|
white-space: nowrap; |
|
|
|
|
|
|
|
|
@ -597,7 +625,7 @@ export default { |
|
|
|
|
margin-bottom: 10px; |
|
|
|
|
font-size: 20px; |
|
|
|
|
font-weight: 500; |
|
|
|
|
color: #0B1D30; |
|
|
|
|
color: #0b1d30; |
|
|
|
|
word-break: break-all; |
|
|
|
|
@include mul-ellipsis(2); |
|
|
|
|
} |
|
|
|
@ -614,7 +642,8 @@ export default { |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
.label, .val { |
|
|
|
|
.label, |
|
|
|
|
.val { |
|
|
|
|
font-size: 14px; |
|
|
|
|
color: #666; |
|
|
|
|
white-space: nowrap; |
|
|
|
@ -639,13 +668,13 @@ export default { |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
/deep/.dia-form { |
|
|
|
|
.w-100 { |
|
|
|
|
width: 100%; |
|
|
|
|
} |
|
|
|
|
.tips { |
|
|
|
|
display: flex; |
|
|
|
|
justify-content: center; |
|
|
|
|
align-items: center; |
|
|
|
|
} |
|
|
|
|
.w-100 { |
|
|
|
|
width: 100%; |
|
|
|
|
} |
|
|
|
|
.tips { |
|
|
|
|
display: flex; |
|
|
|
|
justify-content: center; |
|
|
|
|
align-items: center; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
</style> |