Skip to content

Commit

Permalink
game
Browse files Browse the repository at this point in the history
  • Loading branch information
GaryDu0123 committed Mar 7, 2024
1 parent a63daf1 commit 0e2d778
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 6 deletions.
6 changes: 3 additions & 3 deletions src/pages/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import { io } from 'socket.io-client'
const router = useRouter()
const { t } = useI18n()
const imageSrc = ref('https://cdn.devdojo.com/images/november2020/hero-image.jpeg')
// {data: 'What is the capital of Australia?', choice: Array(4), remaining_time: 941, stage: 1}
type GameData = {
data: string,
Expand Down Expand Up @@ -78,7 +77,7 @@ socket.on('started_update_data', async (data) => {
socket.on('update_data', (data) => {
disabled.value = false
// 处理从服务器接收的数据更新
console.log('Received data update from server:', data)
// console.log('Received data update from server:', data)
if (data['data'] === 'pending') {
loading.value = true
return
Expand Down Expand Up @@ -208,7 +207,8 @@ async function getRankListDialog() {
</template>
</v-dialog>
<v-toolbar-title class="text-h6 text-center">
Stage {{ gameData.stage }}
<v-chip color="primary" label>Question {{ gameData.current_question }} / {{ gameData.total_question }}</v-chip>
Stage {{ gameData.stage }} / {{ gameData.total_stage }}

<!-- 显示已提交的绿色tag-->
<v-chip v-if="disabled" color="success" label>已提交</v-chip>
Expand Down
12 changes: 9 additions & 3 deletions src/utils/api.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,17 @@
import axios from 'axios'

// API服务器地址
export const apiURL = 'quizgame.jacarandastock.com'
// export const apiURL = 'quizgame.jacarandastock.com'
//
// // 协议
// export const protocol = 'https';

export const apiURL = '127.0.0.1:5000';

// 协议
export const protocol = 'https';
export const wsProtocol = protocol === 'http' ? 'ws' : 'wss'
export const protocol = 'http';

export const wsProtocol = protocol === 'http' ? 'ws' : 'wss';


// 携带token的请求
Expand Down

0 comments on commit 0e2d778

Please sign in to comment.