Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
shijiaixin committed Jun 5, 2024
1 parent 9f69891 commit 72f6671
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 17 deletions.
2 changes: 1 addition & 1 deletion src/utils/request.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { getToken } from './tokenStore'
const service = axios.create({
baseURL: 'http://hiyou.space/api',
withCredentials: false,
timeout: 15000
timeout: 35000
})

// request拦截器 request interceptor
Expand Down
27 changes: 17 additions & 10 deletions src/views/home/detail.vue
Original file line number Diff line number Diff line change
Expand Up @@ -20,19 +20,26 @@ const data = ref({})
const loading = ref(false)
function goGame() {
if (loading.value) {
return false
}
loading.value = true
gamePlay(route.params.templateId).then(res => {
console.log(res)
loading.value = false
setQuestion(route.params.templateId, res.data)
gamePlay(route.params.templateId)
.then(res => {
console.log(res)
loading.value = false
setQuestion(route.params.templateId, res.data)
router.push({
name: 'game',
params: {
templateId: route.params.templateId
}
router.push({
name: 'game',
params: {
templateId: route.params.templateId
}
})
})
.finally(() => {
loading.value = false
})
})
}
function goHome() {
Expand Down
19 changes: 13 additions & 6 deletions src/views/home/game.vue
Original file line number Diff line number Diff line change
Expand Up @@ -37,18 +37,25 @@ function goHome() {
}
function submit(val) {
if (loading.value) {
return false
}
loading.value = true
playNext({
templateId: route.params.templateId,
messages: [gameData.value.message],
option: val
}).then(res => {
loading.value = false
searchValue.value = ''
console.log(res)
gameData.value = res.data
setQuestion(route.params.templateId, gameData.value)
})
.then(res => {
loading.value = false
searchValue.value = ''
console.log(res)
gameData.value = res.data
setQuestion(route.params.templateId, gameData.value)
})
.finally(() => {
loading.value = false
})
}
onMounted(() => {
Expand Down

0 comments on commit 72f6671

Please sign in to comment.