Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
F
fc-minigame
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
陈冲
fc-minigame
Commits
948fdad3
Commit
948fdad3
authored
Jun 02, 2026
by
陈冲
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
commit
parent
285e540b
Hide whitespace changes
Inline
Side-by-side
Showing
15 changed files
with
39 additions
and
58 deletions
+39
-58
env.d.ts
frontend-h5/env.d.ts
+2
-0
main.ts
frontend-h5/src/main.ts
+2
-0
Login.vue
frontend-h5/src/pages/Login.vue
+1
-1
index.ts
frontend-h5/src/router/index.ts
+4
-4
vite.config.ts
frontend-h5/vite.config.ts
+5
-0
env.d.ts
frontend-large/env.d.ts
+2
-0
index.html
frontend-large/index.html
+0
-1
utils.ts
frontend-large/src/commons/utils.ts
+3
-3
ws.ts
frontend-large/src/commons/ws.ts
+5
-1
useAdminGameSocket.ts
frontend-large/src/composables/useAdminGameSocket.ts
+1
-1
main.ts
frontend-large/src/main.ts
+2
-0
Login.vue
frontend-large/src/pages/Login.vue
+2
-36
Game1.vue
frontend-large/src/pages/game1/Game1.vue
+1
-1
index.ts
frontend-large/src/router/index.ts
+4
-4
vite.config.ts
frontend-large/vite.config.ts
+5
-6
No files found.
frontend-h5/env.d.ts
View file @
948fdad3
...
...
@@ -2,6 +2,8 @@
declare
module
'crypto-js'
;
declare
const
__APP_DOMAIN__
:
string
;
interface
ImportMetaEnv
{
readonly
VITE_ASSET_BASE_URL
?:
string
;
readonly
VITE_ASSET_DEV_LOCAL
?:
string
;
...
...
frontend-h5/src/main.ts
View file @
948fdad3
...
...
@@ -4,4 +4,6 @@ import { createApp } from 'vue'
import
App
from
'./App.vue'
import
router
from
'./router'
localStorage
.
setItem
(
'domain'
,
__APP_DOMAIN__
)
createApp
(
App
).
use
(
router
).
mount
(
'#app'
)
frontend-h5/src/pages/Login.vue
View file @
948fdad3
...
...
@@ -40,7 +40,7 @@ const loginHandler = async () => {
telephone
:
'13111223344'
,
avatar
:
'13111223344'
,
});
await
router
.
replace
(
'/
h5/
game1'
)
await
router
.
replace
(
'/game1'
)
}
</
script
>
...
...
frontend-h5/src/router/index.ts
View file @
948fdad3
...
...
@@ -12,15 +12,15 @@ const router = createRouter({
routes
:
[
{
path
:
'/'
,
redirect
:
()
=>
(
getWechatId
()
?
'/
h5/game1'
:
'/h5
/login'
),
redirect
:
()
=>
(
getWechatId
()
?
'/
game1'
:
'
/login'
),
},
{
path
:
'/
h5/
login'
,
path
:
'/login'
,
name
:
'Login'
,
component
:
Login
,
},
{
path
:
'/
h5/
game1'
,
path
:
'/game1'
,
name
:
'Game1'
,
component
:
Game1
,
meta
:
{
...
...
@@ -38,7 +38,7 @@ router.beforeEach((to) => {
const
wechatId
=
getWechatId
()
if
(
to
.
meta
.
requiresAuth
&&
!
wechatId
)
{
return
'/
h5/
login'
return
'/login'
}
return
true
...
...
frontend-h5/vite.config.ts
View file @
948fdad3
...
...
@@ -6,6 +6,8 @@ import { defineConfig } from 'vite'
import
vue
from
'@vitejs/plugin-vue'
import
vueDevTools
from
'vite-plugin-vue-devtools'
const
buildDomain
=
'https://hddpserver.guocai365.org.cn'
function
copyImageAssets
()
{
return
{
name
:
'copy-image-assets'
,
...
...
@@ -25,6 +27,9 @@ function copyImageAssets() {
export
default
defineConfig
(({
command
})
=>
({
base
:
command
===
'build'
?
'/cc/h5/'
:
'/'
,
define
:
{
__APP_DOMAIN__
:
JSON
.
stringify
(
command
===
'build'
?
buildDomain
:
''
),
},
plugins
:
[
vue
(),
vueDevTools
(),
...
...
frontend-large/env.d.ts
View file @
948fdad3
...
...
@@ -2,6 +2,8 @@
declare
module
'crypto-js'
;
declare
const
__APP_DOMAIN__
:
string
;
interface
ImportMetaEnv
{
readonly
VITE_ASSET_BASE_URL
?:
string
;
readonly
VITE_ASSET_DEV_LOCAL
?:
string
;
...
...
frontend-large/index.html
View file @
948fdad3
...
...
@@ -6,7 +6,6 @@
<meta
name=
"viewport"
content=
"width=device-width, initial-scale=1.0"
>
<title>
小游戏-大屏
</title>
<style>body
{
background
:
#FA6047
;}
</style>
<script>
localStorage
.
setItem
(
'domain'
,
''
);
</script>
</head>
<body>
<div
id=
"app"
></div>
...
...
frontend-large/src/commons/utils.ts
View file @
948fdad3
...
...
@@ -74,8 +74,9 @@ export function $read_socket_storge(): any {
let
token
=
$read
(
'token'
,
''
);
const
socket_path
=
$read
(
'socket_path'
,
''
);
const
client_ns
=
$read
(
'client_ns'
,
''
)
const
domain
=
localStorage
.
getItem
(
'domain'
)
||
''
return
{
passphrase
,
token
,
socket_path
,
client_ns
passphrase
,
token
,
socket_path
,
client_ns
,
domain
}
}
...
...
@@ -91,4 +92,4 @@ export function $is_run_local(): boolean {
return
true
;
}
return
false
;
}
\ No newline at end of file
}
frontend-large/src/commons/ws.ts
View file @
948fdad3
...
...
@@ -34,8 +34,12 @@ export function initSocket(args: SocketInitArgs): Socket | null {
if
(
socket
)
{
if
(
socket
.
connected
)
{
args
.
onConnect
?.(
socket
);
return
socket
;
}
return
socket
;
socket
.
removeAllListeners
();
socket
.
disconnect
();
socket
=
null
;
}
socket
=
io
(
args
.
client_ns
,
{
...
...
frontend-large/src/composables/useAdminGameSocket.ts
View file @
948fdad3
...
...
@@ -58,7 +58,7 @@ export function useAdminGameSocket(options: AdminGameSocketOptions) {
offSocketMessage
=
onSocketMessage
(
async
(
evt
,
payload
:
SocketPayload
)
=>
{
const
{
msg
,
state
,
data
}
=
payload
if
(
$goto_login
(
evt
,
router
,
options
.
loginRedirectPath
??
'/
pc/
game1'
))
{
if
(
$goto_login
(
evt
,
router
,
options
.
loginRedirectPath
??
'/game1'
))
{
return
}
...
...
frontend-large/src/main.ts
View file @
948fdad3
...
...
@@ -4,4 +4,6 @@ import { createApp } from 'vue'
import
App
from
'./App.vue'
import
router
from
'./router'
localStorage
.
setItem
(
'domain'
,
__APP_DOMAIN__
)
createApp
(
App
).
use
(
router
).
mount
(
'#app'
)
frontend-large/src/pages/Login.vue
View file @
948fdad3
<
script
setup
lang=
"ts"
>
import
CryptoJS
from
'crypto-js'
;
import
{
$save
}
from
'@/commons/utils.ts'
;
import
{
ref
,
onUnmounted
}
from
'vue'
import
{
ref
}
from
'vue'
import
{
useRouter
}
from
'vue-router'
import
DesignStage
from
'@/components/DesignStage.vue'
import
{
initSocket
,
onSocketMessage
,
sendSocketMessage
}
from
'@/commons/ws.ts'
;
let
offSocketMessage
:
(()
=>
void
)
|
undefined
;
const
router
=
useRouter
()
const
username
=
ref
(
''
)
const
password
=
ref
(
''
)
...
...
@@ -40,38 +36,8 @@ const loginHandler = async () => {
for
(
let
i
in
data
)
{
$save
(
i
,
data
[
i
]);
}
let
domain
=
localStorage
.
getItem
(
'domain'
)
||
''
;
initSocket
({
socket_path
:
`
${
domain
}${
data
.
socket_path
}
`
,
client_ns
:
data
.
client_ns
,
auth
:
{
userid
:
data
.
token
,
validuser
:
CryptoJS
.
AES
.
encrypt
(
data
.
token
,
data
.
passphrase
).
toString
(),
},
onConnect
:
async
()
=>
{
setTimeout
(()
=>
{
sendSocketMessage
(
'room_create'
,
1
);
},
200
);
},
onDisconnect
:
(
reason
:
string
)
=>
{
},
onError
:
(
error
:
any
)
=>
{
},
});
await
router
.
replace
(
'/game1'
)
}
offSocketMessage
=
onSocketMessage
(
async
(
evt
,
{
msg
,
state
,
data
})
=>
{
if
(
state
==
0
)
{
alert
(
msg
);
return
;
}
switch
(
evt
)
{
case
'room_create_result'
:
{
await
router
.
replace
(
'/pc/game1'
)
break
;
}
}
});
onUnmounted
(()
=>
{
offSocketMessage
?.();
});
</
script
>
<
template
>
...
...
frontend-large/src/pages/game1/Game1.vue
View file @
948fdad3
...
...
@@ -97,7 +97,7 @@ function handleRoomState(data: any) {
const
{
startGame
,
createRoom
,
requestRoomState
}
=
useAdminGameSocket
({
gameId
:
'game1'
,
loginRedirectPath
:
'/pc
/game1'
,
// loginRedirectPath: '
/game1',
onGameStartRejected
:
gotoLoading
,
onRoomState
:
handleRoomState
,
onRoomJoin
:
(
data
)
=>
{
...
...
frontend-large/src/router/index.ts
View file @
948fdad3
...
...
@@ -8,15 +8,15 @@ const router = createRouter({
routes
:
[
{
path
:
'/'
,
redirect
:
()
=>
(
$read
(
'token'
,
''
)
?
'/
pc/game1'
:
'/pc
/login'
),
redirect
:
()
=>
(
$read
(
'token'
,
''
)
?
'/
game1'
:
'
/login'
),
},
{
path
:
'/
pc/
login'
,
path
:
'/login'
,
name
:
'Login'
,
component
:
Login
,
},
{
path
:
'/
pc/
game1'
,
path
:
'/game1'
,
name
:
'Game1'
,
component
:
Game1
,
meta
:
{
...
...
@@ -34,7 +34,7 @@ router.beforeEach((to) => {
const
token
=
$read
(
'token'
,
''
)
if
(
to
.
meta
.
requiresAuth
&&
!
token
)
{
return
'/
pc/
login'
return
'/login'
}
return
true
...
...
frontend-large/vite.config.ts
View file @
948fdad3
...
...
@@ -6,7 +6,7 @@ import { defineConfig } from 'vite'
import
vue
from
'@vitejs/plugin-vue'
import
vueDevTools
from
'vite-plugin-vue-devtools'
const
build
Base
=
'/cc/pc/
'
const
build
Domain
=
'https://hddpserver.guocai365.org.cn
'
function
copyImageAssets
()
{
return
{
...
...
@@ -25,11 +25,10 @@ function copyImageAssets() {
}
}
// https://vite.dev/config/
export
default
defineConfig
(({
command
})
=>
({
base
:
command
===
'build'
?
buildBase
:
'/'
,
build
:
{
emptyOutDir
:
false
,
base
:
command
===
'build'
?
'/cc/pc/'
:
'/'
,
define
:
{
__APP_DOMAIN__
:
JSON
.
stringify
(
command
===
'build'
?
buildDomain
:
''
)
,
},
plugins
:
[
vue
(),
...
...
@@ -51,7 +50,7 @@ export default defineConfig(({ command }) => ({
},
resolve
:
{
alias
:
{
'@'
:
fileURLToPath
(
new
URL
(
'./src'
,
import
.
meta
.
url
))
'@'
:
fileURLToPath
(
new
URL
(
'./src'
,
import
.
meta
.
url
))
,
},
},
}))
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment