Skip to content

Commit c2bc781

Browse files
committed
feat: 环境配置
1 parent 8bd7d4b commit c2bc781

File tree

5 files changed

+12
-7
lines changed

5 files changed

+12
-7
lines changed

.env.development

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
VITE_APP_WS_URL='ws://localhost:3333'
2+
VITE_APP_API_URL='/api'

.env.production

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
ENV=production
2+
3+
VITE_APP_WS_URL='ws://43.153.50.34:3333'
4+
VITE_APP_API_URL='http://43.153.50.34:8999'

src/DrawPanel.vue

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,10 @@ const onClickSend = () => {
6767
sendPrompt()
6868
}
6969
70-
const onKeyDown = useDebounceFn((event: Event) => {
70+
const onKeyDown = useDebounceFn((event: KeyboardEvent) => {
71+
if (event.ctrlKey || event.metaKey || event.shiftKey) {
72+
return;
73+
}
7174
event.stopPropagation()
7275
event.preventDefault()
7376
sendPrompt()

src/utils/axios.ts

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,9 @@ import Toast from '../components/Toast/index'
33
import { tokenStorage, userStorage } from '@/utils/storage'
44
import { showLoginModal } from '@/utils/index';
55

6-
// export const host = "http://localhost:8999";
7-
// export const host = "/api";
8-
export const host = "http://43.153.50.34:8999";
6+
export const host = import.meta.env.VITE_APP_API_URL;
97

108
export const $http = axios.create({
11-
// baseURL: host + '/api'
129
baseURL: host
1310
});
1411

src/utils/websocket.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,7 @@ export const createWebsocket = (ops?: CreateWsOptions) => {
3636
}
3737
}
3838

39-
const ws = wsInstance = new WebSocket(`ws://43.153.50.34:3333`)
40-
// const ws = wsInstance = new WebSocket(`ws://localhost:3333`);
39+
const ws = wsInstance = new WebSocket(import.meta.env.VITE_APP_WS_URL);
4140
ws.addEventListener('open', (event) => {
4241
ws.send(JSON.stringify({
4342
event: 'init'

0 commit comments

Comments
 (0)