alioss V2.3.0
yujialong 2 years ago
parent 4e745615fb
commit d543dbf308
  1. 1797
      src/pages/account/login/index.vue
  2. 771
      src/pages/activity/list/index.vue
  3. 242
      src/pages/activity/manage/manage/index.vue
  4. 1700
      src/pages/station/preview/index.vue

File diff suppressed because it is too large Load Diff

@ -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">发起方&emsp;</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">发起方&emsp;</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 01
status = item.whetherToSignUp ? 2 : 1 // 12
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 01
status = item.whetherToSignUp ? 2 : 1 // 12
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)
// 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, 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)
// 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, 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>

@ -1,20 +1,28 @@
<template>
<div>
<el-card shadow="hover" class="m-b-20">
<div class="flex-between">
<el-page-header @back="back" :content="name + '/管理'"></el-page-header>
</div>
</el-card>
<div class="page" style="margin-bottom: 24px">
<div class="tabs">
<a class="item" v-for="(item,index) in tabs" :key="index" :class="{active: index == active}" @click="tabChange(index)">{{ item }}</a>
</div>
<MatchDetail v-if="active == 'tab1'" ref="detail" />
<MatchProgress v-else-if="active == 'tab2'" />
<notice v-else-if="active == 'tab3'" />
<MatchSignup v-else-if="active == 'tab4'" />
</div>
<div>
<el-card shadow="hover"
class="m-b-20">
<div class="flex-between">
<el-page-header @back="back"
:content="name + '/管理'"></el-page-header>
</div>
</el-card>
<div class="page"
style="margin-bottom: 24px">
<div class="tabs">
<a class="item"
v-for="(item,index) in tabs"
:key="index"
:class="{active: index == active}"
@click="tabChange(index)">{{ item }}</a>
</div>
<MatchDetail v-if="active == 'tab1'"
ref="detail" />
<MatchProgress v-else-if="active == 'tab2'" />
<notice v-else-if="active == 'tab3'" />
<MatchSignup v-else-if="active == 'tab4'" />
</div>
</div>
</template>
@ -26,122 +34,122 @@ import notice from "./notice";
import MatchSignup from "./matchSignup";
import { mapState } from "vuex";
export default {
name: "matchManage",
data() {
return {
name: this.$route.query.name,
active: this.$route.query.tab || "tab1",
tabs: {
tab1: "项目详情",
tab2: "项目进展",
tab3: "公告通知",
tab4: "报名人员"
},
};
},
components: {
MatchDetail,
MatchProgress,
notice,
MatchSignup
name: "matchManage",
data () {
return {
name: this.$route.query.name,
active: this.$route.query.tab || "tab1",
tabs: {
tab1: "项目详情",
tab2: "项目进展",
tab3: "公告通知",
tab4: "报名人员"
},
};
},
components: {
MatchDetail,
MatchProgress,
notice,
MatchSignup
},
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 () {
},
methods: {
back () {
this.handleSave(0) && this.backPage()
},
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()
})
// confirm
handleSave (i) {
//
if (this.active === 'tab1') {
const detail = this.$refs.detail
if (detail && detail.updateTime) {
this.$confirm(`编辑的内容未保存,是否保存并且发布?`, '提示', {
type: 'warning'
}).then(() => {
detail.save(detail.form.publishStatus)
this.backOrTab(i)
}).catch(() => {
this.backOrTab(i)
})
} else {
this.backOrTab(i)
}
return false
} else {
next()
return true
}
},
mounted() {
//
backPage () {
this.$router.push(`/activity/manage?page=${this.$store.state.activity.page}`)
},
methods: {
back() {
this.handleSave(0) && this.backPage()
},
// confirm
handleSave(i) {
//
if (this.active === 'tab1') {
const detail = this.$refs.detail
if (detail && detail.updateTime) {
this.$confirm(`编辑的内容未保存,是否保存并且发布?`, '提示', {
type: 'warning'
}).then(() => {
detail.save(detail.form.publishStatus)
this.backOrTab(i)
}).catch(() => {
this.backOrTab(i)
})
} else {
this.backOrTab(i)
}
return false
} else {
return true
}
},
//
backPage(){
this.$router.push(`/activity/manage?page=${this.$store.state.activity.page}`)
},
// tab
tabSwitch(i) {
this.active = i
this.$router.push(`manageDetail?id=${this.$route.query.id}&tab=${i}&name=${this.name}`)
},
// tab
backOrTab(i) {
i ? this.tabSwitch(i) : this.backPage()
},
// tab
tabChange(i) {
this.handleSave(i) && this.tabSwitch(i)
}
// tab
tabSwitch (i) {
this.active = i
this.$router.push(`manageDetail?id=${this.$route.query.id}&tab=${i}&name=${this.name}`)
},
// tab
backOrTab (i) {
i ? this.tabSwitch(i) : this.backPage()
},
// tab
tabChange (i) {
this.handleSave(i) && this.tabSwitch(i)
}
}
};
</script>
<style lang="scss" scoped>
.tabs {
display: flex;
align-items: center;
padding: 0 24px;
border-bottom: 1px solid rgba(0, 0, 0, .06);
.item {
position: relative;
padding: 20px 0;
margin-right: 40px;
font-size: 16px;
color: rgba(0, 0, 0, 0.65);
cursor: pointer;
display: flex;
align-items: center;
padding: 0 24px;
border-bottom: 1px solid rgba(0, 0, 0, 0.06);
.item {
position: relative;
padding: 20px 0;
margin-right: 40px;
font-size: 16px;
color: rgba(0, 0, 0, 0.65);
cursor: pointer;
&:after {
content: '';
position: absolute;
bottom: 0;
left: 0;
width: 100%;
height: 3px;
border-bottom: 3px solid transparent;
border-radius: 2px;
}
&:after {
content: '';
position: absolute;
bottom: 0;
left: 0;
width: 100%;
height: 3px;
border-bottom: 3px solid transparent;
border-radius: 2px;
}
&.active {
font-weight: 500;
color: rgba(0, 0, 0, 0.85);
}
&.active {
font-weight: 500;
color: rgba(0, 0, 0, 0.85);
}
&.active:after {
border-bottom-color: $main-color;
&.active:after {
border-bottom-color: $main-color;
}
}
}
}
</style>

File diff suppressed because it is too large Load Diff
Loading…
Cancel
Save