dev_2022-05-11
luoJunYong.123 3 years ago
parent 9968525fc4
commit fe1e2aff7e
  1. 33
      src/pages/match/manage/index.vue
  2. 27
      src/pages/match/manage/matchProgress.vue
  3. 6
      src/store/modules/match.js

@ -25,6 +25,7 @@
import MatchDetail from "./matchDetail"; import MatchDetail from "./matchDetail";
import MatchProgress from "./matchProgress"; import MatchProgress from "./matchProgress";
import MatchSignup from "./matchSignup"; import MatchSignup from "./matchSignup";
import EventBus from "@/libs/bus.js";
export default { export default {
name: "matchManage", name: "matchManage",
@ -44,35 +45,29 @@ export default {
MatchSignup MatchSignup
}, },
created() { created() {
EventBus.$on("tabChangeWait", (waitIndex) => {
this.tabChange(waitIndex)
});
},
beforeDestroy() {
// EventBus.$off()
}, },
methods: { methods: {
goBack() { goBack() {
this.$router.back(); this.$router.back();
}, },
tabChange(index) { tabChange(index) {
console.log('changewait?') this.$store.commit("match/setWaitIndex", index);
console.log(this.wait) if(!(this.wait !== 999)) {
// this.active = index;
if(!this.wait) {
this.active = index; this.active = index;
}else { }else {
sessionStorage.setItem('tabIndex', index) EventBus.$emit("tabClickWait", this.wait);
this.$store.commit("match/setWait", 999);
} }
}, },
tabChangeWait() { tabChangeWait(index) {
tabChange(sessionStorage.setItem('tabIndex', index)) this.tabChange(index)
}, // tabChange(sessionStorage.setItem('tabIndex', fromIndex))
beforeLeave(newTab, oldTab) {
console.log(newTab)
console.log(oldTab)
// if(sessionStorage.getItem('wait')) {
// this.$confirm('?', '', {
// confirmButtonText: '',
// cancelButtonText: '',
// type: 'warning'
// })
// }
} }
}, },
computed: { computed: {

@ -9,18 +9,18 @@
</el-table-column> </el-table-column>
<el-table-column prop="name" label="标题"> <el-table-column prop="name" label="标题">
<template slot-scope="scope"> <template slot-scope="scope">
<el-input placeholder="请输入标题" :disabled="!scope.row.operate" @blur="blur(scope.row)" @focus="focus()" v-model="scope.row.title"></el-input> <el-input placeholder="请输入标题" :disabled="!scope.row.operate" v-model="scope.row.title"></el-input>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column prop="name" label="详情描述"> <el-table-column prop="name" label="详情描述">
<template slot-scope="scope"> <template slot-scope="scope">
<el-input placeholder="请输入详情描述" :disabled="!scope.row.operate" @blur="blur(scope.row)" @focus="focus()" type="textarea" v-model="scope.row.description"></el-input> <el-input placeholder="请输入详情描述" :disabled="!scope.row.operate" type="textarea" v-model="scope.row.description"></el-input>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column prop="name" label="状态" width="150"> <el-table-column prop="name" label="状态" width="150">
<template slot-scope="scope"> <template slot-scope="scope">
<el-select v-model="scope.row.status" :disabled="!scope.row.operate" clearable placeholder="请选择状态"> <el-select v-model="scope.row.status" :disabled="!scope.row.operate" clearable placeholder="请选择状态">
<el-option v-for="(item,index) in statusList" :key="index" @blur="blur(scope.row)" @focus="focus()" :label="item.name" :value="item.value"></el-option> <el-option v-for="(item,index) in statusList" :key="index" :label="item.name" :value="item.value"></el-option>
</el-select> </el-select>
</template> </template>
</el-table-column> </el-table-column>
@ -40,6 +40,7 @@
<script> <script>
import util from "@/libs/util"; import util from "@/libs/util";
import EventBus from "@/libs/bus.js";
export default { export default {
name: "matchProgress", name: "matchProgress",
@ -73,10 +74,11 @@ export default {
mounted() { mounted() {
this.getData(); this.getData();
console.log(this.listData) console.log(this.listData)
EventBus.$on("tabClickWait", () => this.waitSave());
}, },
methods: { methods: {
operateIt(row) { operateIt(row) {
this.$store.commit("match/setWait", true); this.$store.commit("match/setWait", 1);
row.operate = true row.operate = true
}, },
blur(row) { blur(row) {
@ -112,13 +114,12 @@ export default {
// //
this.$set(this.listData, index, { operate: false, ...this.listData[index]}) this.$set(this.listData, index, { operate: false, ...this.listData[index]})
} }
console.log(this.listData)
}).catch(res => { }).catch(res => {
}); });
}, },
saveData(row) { saveData(row) {
// //
this.$store.commit("match/setWait", false); this.$store.commit("match/setWait", 999);
let data = row; let data = row;
if (data.title.length) { if (data.title.length) {
if (row.id) { if (row.id) {
@ -225,17 +226,16 @@ export default {
message: '保存成功!' message: '保存成功!'
}); });
} }
this.$store.commit("match/setWait", false); EventBus.$emit('tabChangeWait', this.$store.state.match.waitIndex)
this.$emit('waitChange')
}).catch(() => { }).catch(() => {
this.$message({ this.$message({
type: 'info', type: 'info',
message: '已取消保存' message: '已取消保存'
}); });
this.$store.commit("match/setWait", false); EventBus.$emit('tabChangeWait', this.$store.state.match.waitIndex)
this.$emit('waitChange')
}); });
} }
} }
}, },
computed: { computed: {
@ -245,7 +245,12 @@ export default {
} }
}, },
beforeDestroy() { beforeDestroy() {
console.log('beforeDestroy')
// EventBus.$off();
// this.waitSave()
// if(this.hasEdit) {
// console.log('what')
// }
// if (this.touchTime>0){ // if (this.touchTime>0){
// if (this.hasEdit){ // if (this.hasEdit){
// this.$confirm('?', '', { // this.$confirm('?', '', {

@ -5,7 +5,8 @@ export default {
namespaced: true, namespaced: true,
state: { state: {
matchId: "", matchId: "",
wait: false wait: false,
waitIndex: 0
}, },
mutations: { mutations: {
SET_MATCH_ID: (state, id) => { SET_MATCH_ID: (state, id) => {
@ -13,6 +14,9 @@ export default {
}, },
setWait: (state, wait) => { setWait: (state, wait) => {
state.wait = wait; state.wait = wait;
},
setWaitIndex: (state, waitIndex) => {
state.waitIndex = waitIndex;
} }
}, },
actions: { actions: {

Loading…
Cancel
Save