赛事定时器

dev_202303
yujialong 2 years ago
parent f3ac5af564
commit 9b0c0a0f4f
  1. 2
      src/setting.js
  2. 1
      src/utils/api.js
  3. 12
      src/views/match/list/index.vue

@ -12,7 +12,7 @@ if (isDev) {
host = 'http://121.37.12.51/'
// host = 'https://huorantech.cn/'
host = 'http://192.168.31.151:9000/'// 榕
// host = 'http://192.168.31.116:9000/'// 赓
// host = 'http://192.168.31.117:9000/'// 赓
} else if (isPro) {
jumpPath = 'https://www.huorantech.cn/judgmentPoint/'
}

@ -312,6 +312,7 @@ export default {
publishCompetition: `competition/competition/management/publishCompetition`,
detailsOfCompetitionStage: `competition/competition/management/detailsOfCompetitionStage`,
entryInformation: `competition/competition/team/entryInformation`,
getRedisCacheCompetition: `competition/competition/management/getRedisCache`,
// 赛事内容
addCompetitionContent: `competition/competition/content/addCompetitionContent`,

@ -207,6 +207,7 @@ export default {
playingStages: []
},
timer: null,
redisTimer: null,
pickerOptions: {
shortcuts: [{
text: '此刻',
@ -247,6 +248,7 @@ export default {
this.getData()
this.$once('hook:beforeDestroy', function() {
clearInterval(this.timer)
clearInterval(this.redisTimer)
})
},
methods: {
@ -300,11 +302,21 @@ export default {
},
getData() {
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.getRedisCacheCompetition).then(({ data }) => {
data && this.getList()
}).catch(res => {})
},
add() {
this.$router.push("/addMatch");
},

Loading…
Cancel
Save