-
+
@@ -28,13 +28,11 @@ import MatchDetail from "./matchDetail";
import MatchProgress from "./matchProgress";
import notice from "./notice";
import MatchSignup from "./matchSignup";
-import EventBus from "@/libs/bus.js";
-
export default {
name: "matchManage",
data() {
return {
- active: "first",
+ active: this.$route.query.tab || "first",
tabs: {
first: "大赛详情",
second: "竞赛进展",
@@ -50,19 +48,44 @@ export default {
MatchSignup
},
methods: {
- goBack() {
- this.$router.back();
+ back() {
+ this.handleSave(0) && this.$router.back()
},
- tabChange(index) {
- this.active = index
+ // 判断是否需要confirm
+ handleSave(i) {
+ // 如果是赛事详情,则要判断是否已经保存,未保存则提示是否保存
+ if (this.active === 'first') {
+ const detail = this.$refs.detail
+ console.log(11, detail.updateTime, i)
+ if (detail.updateTime > 1) {
+ this.$confirm(`编辑的内容未保存,是否保存?`, '提示', {
+ type: 'warning'
+ }).then(() => {
+ detail.save(1)
+ this.backOrTab(i)
+ }).catch(() => {
+ this.backOrTab(i)
+ })
+ } else {
+ this.backOrTab(i)
+ }
+ return false
+ } else {
+ return true
+ }
},
- tabChangeWait(index) {
- this.tabChange(index)
- }
- },
- computed: {
- wait() {
- return this.$store.state.wait
+ backPage(){
+ this.$router.back()
+ },
+ tabSwitch(i) {
+ this.active = i
+ this.$router.push(`/matchManage?id=${this.$route.query.id}&tab=${i}`)
+ },
+ backOrTab(i) {
+ i ? this.tabSwitch(i) : this.backPage()
+ },
+ tabChange(i) {
+ this.handleSave(i) && this.tabSwitch(i)
}
}
};
diff --git a/src/views/match/manage/matchDetail.vue b/src/views/match/manage/matchDetail.vue
index 971243f..ea189c9 100644
--- a/src/views/match/manage/matchDetail.vue
+++ b/src/views/match/manage/matchDetail.vue
@@ -124,7 +124,7 @@
- 发布
+ 发布
取消
@@ -203,14 +203,16 @@ export default {
// 省份
console.log('lazy', node)
if (!level) {
- const data = []
- that.$store.state.provinceList.map(e => {
- data.push({
- value: e.provinceId,
- label: e.provinceName
+ that.$get(that.api.queryProvince).then(({ list }) => {
+ const data = []
+ list.map(e => {
+ data.push({
+ value: e.provinceId,
+ label: e.provinceName
+ })
})
- })
- resolve(data)
+ resolve(data)
+ }).catch(res => {})
} else if (level === 1) {
// 城市
that.$get(that.api.queryCity, {
@@ -310,17 +312,31 @@ export default {
}
// 选择范围
- const range = []
- contest.contestRangeList.map(e => {
- const item = [+e.provinceId]
- e.cityId && item.push(+e.cityId)
- e.schoolId && item.push(+e.schoolId)
- range.push(item)
- })
- this.range = range
-
+ const ranges = contest.contestRangeList
+ if (ranges) {
+ const range = []
+ ranges.map(e => {
+ const item = [+e.provinceId]
+ e.cityId && item.push(+e.cityId)
+ e.schoolId && item.push(+e.schoolId)
+ range.push(item)
+ })
+ this.range = range
+ }
+
+ // 选择范围name
+ const rangeName = contest.contestRangeRespList
+ if (rangeName) {
+ const range = []
+ rangeName.map(e => {
+ range.push(e.type ? (e.provinceName || e.cityName) : e.schoolName)
+ })
+ this.rangeName = range.join(',')
+ }
+ this.form = contest
// 处理显示的name
this.$nextTick(() => {
+ this.updateTime = 1
// const checked = this.$refs.range.getCheckedNodes()
// console.log(444, contest, checked)
// const name = []
@@ -329,9 +345,6 @@ export default {
// })
// this.rangeName = name.join('、')
})
-
- this.form = contest
-
}).catch(err => {})
},
// 选择范围
@@ -431,7 +444,7 @@ export default {
form.undertaker = this.undertakerList.filter(d => d).join();
if (form.competitionScope == 2 && !form.contestRangeList.length) return util.warningMsg('请选择区域、院校')
if (!form.name) return util.warningMsg("请填写竞赛名称");
- if (status == 0) {
+ if (status == 1) {
if (!form.sponsor) return util.warningMsg("请填写主办方");
if (!form.signUpStartTime) return util.warningMsg("请选择报名时间");
}
@@ -440,15 +453,16 @@ export default {
let signUpEndTime = new Date(form.signUpEndTime).getTime();
let playStartTime = new Date(form.playStartTime).getTime();
if (signUpStartTime && now > signUpStartTime) return util.warningMsg("报名时间不能早于当前时间");
- if (!form.playStartTime && status == 0) return util.warningMsg("请选择竞赛时间");
+ if (!form.playStartTime && status == 1) return util.warningMsg("请选择竞赛时间");
if (playStartTime && playStartTime < signUpEndTime) return util.warningMsg("竞赛时间不能早于报名结束时间");
- if (!form.description && status == 0) return util.warningMsg("请填写竞赛详情");
+ if (!form.description && status == 1) return util.warningMsg("请填写竞赛详情");
this.submiting = true
form.publishStatus = status
- if (form.id) delete form.contestAnnexList
if (this.form.id) {
+ delete form.contestAnnexList
this.$post(this.api.editContest, form).then(res => {
+ this.updateTime = 1
this.submiting = false;
util.successMsg("修改成功");
this.$router.back();
@@ -471,11 +485,10 @@ export default {
preview() {
},
- back(i) {
- const id = this.form.cid
+ back() {
const updateTime = this.updateTime
// 更改了信息才需要提示
- if ((id && updateTime > 1) || (!id && updateTime)) {
+ if (updateTime > 1) {
this.$confirm(`编辑的内容未保存,是否保存?`, '提示', {
type: 'warning'
}).then(() => {
diff --git a/src/views/match/manage/matchProgress.vue b/src/views/match/manage/matchProgress.vue
index b66c238..aed583a 100644
--- a/src/views/match/manage/matchProgress.vue
+++ b/src/views/match/manage/matchProgress.vue
@@ -77,7 +77,9 @@ export default {
row.operate = true
},
getData() {
- this.$get(`${this.api.getContestProgress}/${this.id}`).then(res => {
+ this.$get(this.api.getContestProgress, {
+ contestId: this.id
+ }).then(res => {
this.listData = res.contestProgressList;
for(let index=0; index
-
+
- {{ scope.$index + (pageNo - 1) * pageSize + 1 }}
+ {{ scope.$index + (page - 1) * pageSize + 1 }}
@@ -33,9 +33,9 @@
@@ -43,7 +43,7 @@