diff --git a/package.json b/package.json
index 1b370be..1e5f0e5 100644
--- a/package.json
+++ b/package.json
@@ -5,14 +5,22 @@
"type": "module",
"scripts": {
"dev": "vite",
+ "dev:server": "pnpm --filter chuanqi-server dev",
+ "start:server": "pnpm --filter chuanqi-server start",
"build": "vite build",
"preview": "vite preview"
},
"dependencies": {
- "vue": "^3.5.21"
+ "vue": "^3.5.21",
+ "vue-router": "^4.5.1"
},
"devDependencies": {
"@vitejs/plugin-vue": "^6.0.1",
"vite": "^7.1.7"
+ },
+ "pnpm": {
+ "workspace": [
+ "server"
+ ]
}
}
diff --git a/pnpm-workspace.yaml b/pnpm-workspace.yaml
new file mode 100644
index 0000000..3d17f04
--- /dev/null
+++ b/pnpm-workspace.yaml
@@ -0,0 +1,2 @@
+packages:
+ - server
\ No newline at end of file
diff --git a/public/config.json b/public/config.json
new file mode 100644
index 0000000..f3e1a34
--- /dev/null
+++ b/public/config.json
@@ -0,0 +1,4 @@
+{
+ "reg_code_open": true,
+ "code_type": ""
+}
\ No newline at end of file
diff --git a/public/js/index.js b/public/js/index.js
index b823e80..da36def 100644
--- a/public/js/index.js
+++ b/public/js/index.js
@@ -1,17 +1,7 @@
-/**
- * 冰雪传奇H5
- * 2022 XX信息科技有限公司
- *
- * @author 123456
- * @wx 123456
- * @qq 123456
- */
-
let host = window.location.hostname || '100.88.157.105';
let port = 80;
-const webUrl = getHttp() + host + (port && 80 != port ? ':' + port : ''),
- account = getQueryString('account'),
+const account = getQueryString('account'),
token = getQueryString('token'),
noLogin = !account || !token;
@@ -20,7 +10,7 @@ if (noLogin) {
loadBarClear();
loadBarFull();
setTimeout(function () {
- window.location.href = webUrl + '/login';
+ window.location.href = '/login';
}, randomRange(250, 500));
}, 1e3);
}
@@ -79,19 +69,18 @@ window['loginView'] = 'app.MainLoginView';
// 相关URL
window['webHost'] = host;
-window['webUrl'] = webUrl;
-window['serviceListdUrl'] = webUrl + '/server';
-window['setServiceListdUrl'] = webUrl + '/server';
-window['payUrl'] = webUrl + '/pay';
-window['apiUrl'] = webUrl + '/api';
-window['orderUrl'] = webUrl + '/api?act=order';
-window['reportUrl'] = webUrl + '/api?act=report'; // 上报接口
-window['errorReportUrl'] = webUrl + '/api?act=report&do=error';// 错误上报接口
-window['checkUrl'] = webUrl + '/api?act=check'; // 验证URL
-window['versionUrl'] = webUrl + '/api?act=version'; // 请求客户端版本
-window['getActorInfoUrl'] = webUrl + '/api?act=actor';
-window['roleInfoUrl'] = webUrl + '/api?act=role';
-window['gongGaoUrl'] = webUrl + '/notice.txt';
+window['serviceListdUrl'] = '/server';
+window['setServiceListdUrl'] = '/server';
+window['payUrl'] = '/pay';
+window['apiUrl'] = '/api';
+window['orderUrl'] = '/api?act=order';
+window['reportUrl'] = '/api?act=report'; // 上报接口
+window['errorReportUrl'] = '/api?act=report&do=error';// 错误上报接口
+window['checkUrl'] = '/api?act=check'; // 验证URL
+window['versionUrl'] = '/api?act=version'; // 请求客户端版本
+window['getActorInfoUrl'] = '/api?act=actor';
+window['roleInfoUrl'] = '/api?act=role';
+window['gongGaoUrl'] = '/notice.txt';
// 客服信息
window['kfQQ'] = '123456';
@@ -341,7 +330,7 @@ function feedbackFunction(info) {
param += key + '=' + msgInfo[key] + '&'
}
param = param.substring(0, param.length - 1)
- let srcStr = webUrl + '/api?' + param;
+ let srcStr = '/api?' + param;
const div = document.createElement('div');
div.id = 'iframDiv';
div.innerHTML = '';
@@ -369,7 +358,7 @@ function feedbackFunction(info) {
// 防沉迷
function IdCardFunction() {
- window.open(webUrl);
+ window.open();
}
function addQQGrp() {
@@ -378,17 +367,17 @@ function addQQGrp() {
//下载YY游戏大厅
function downYYGameHallFun() {
- window.open(webUrl);
+ window.open();
}
//开通会员
function openYYVip() {
- window.open(webUrl);
+ window.open();
}
//开超玩会员
function openChaoWanVip() {
- window.open(webUrl);
+ window.open();
}
function removeIfram() {
diff --git a/server/config/index.js b/server/config/index.js
new file mode 100644
index 0000000..e69de29
diff --git a/server/index.js b/server/index.js
new file mode 100644
index 0000000..27d17c4
--- /dev/null
+++ b/server/index.js
@@ -0,0 +1,27 @@
+import Koa from 'koa';
+import Router from 'koa-router';
+import config from "./config/index.js"
+
+const app = new Koa();
+const router = new Router();
+
+// 简单的路由示例
+router.get('/', (ctx) => {
+ ctx.body = {message: 'Hello from Koa server!'};
+});
+
+router.get('/api/test', (ctx) => {
+ ctx.body = {message: 'This is a test API endpoint'};
+});
+
+router.get('/api/config', (ctx) => {
+ ctx.body = {data: config}
+})
+app.use(router.routes());
+app.use(router.allowedMethods());
+
+const PORT = process.env.PORT || 3001;
+
+app.listen(PORT, () => {
+ console.log(`Koa server is running on port ${PORT}`);
+});
\ No newline at end of file
diff --git a/server/package.json b/server/package.json
new file mode 100644
index 0000000..8dd043c
--- /dev/null
+++ b/server/package.json
@@ -0,0 +1,15 @@
+{
+ "name": "chuanqi-server",
+ "version": "1.0.0",
+ "description": "A simple Koa server for chuanqi web",
+ "main": "index.js",
+ "type": "module",
+ "scripts": {
+ "start": "node index.js",
+ "dev": "node index.js"
+ },
+ "dependencies": {
+ "koa": "^2.15.0",
+ "koa-router": "^12.0.0"
+ }
+}
\ No newline at end of file
diff --git a/src/App.vue b/src/App.vue
index 29a975f..2c658f2 100644
--- a/src/App.vue
+++ b/src/App.vue
@@ -1,6 +1,7 @@
-
+
+
@@ -103,4 +105,4 @@ if (isMobile()) {
justify-content: center;
}
}
-
+
\ No newline at end of file
diff --git a/src/config.js b/src/config.js
new file mode 100644
index 0000000..6664f04
--- /dev/null
+++ b/src/config.js
@@ -0,0 +1,5 @@
+export default {
+ gameName: "神临苍月",
+ reg_code_open: true,
+ code_type: "email",
+}
\ No newline at end of file
diff --git a/src/main.js b/src/main.js
index 8aa1dda..3fa5d22 100644
--- a/src/main.js
+++ b/src/main.js
@@ -1,6 +1,7 @@
import {createApp} from 'vue'
import './style.css'
import App from './App.vue'
+import router from './router'
// window.external?.OpenGameWindowNew(window.location.href, '', '', '', false);
document.onkeydown = document.onkeyup = document.onkeypress = function (e) {
@@ -9,4 +10,10 @@ document.onkeydown = document.onkeyup = document.onkeypress = function (e) {
return false;
}
}
-createApp(App).mount('#app')
+const app = createApp(App)
+
+fetch("/api/config", {method: "GET"}).then(res => res.json()).then(res => {
+ app.config.globalProperties.$gameName = res.data.gameName || "神临苍月";
+ app.config.globalProperties.$_CONFIG = res.data;
+ app.use(router).mount('#app')
+})
diff --git a/src/router/index.js b/src/router/index.js
new file mode 100644
index 0000000..f430f77
--- /dev/null
+++ b/src/router/index.js
@@ -0,0 +1,22 @@
+import {createRouter, createWebHistory} from 'vue-router'
+import Index from "../views/index.vue";
+
+// 示例路由配置
+const routes = [
+ {
+ path: '/',
+ name: 'Home',
+ component: Index
+ },
+ {
+ path: '/login', name: 'Login',
+ component: () => import('../views/login.vue')
+ }
+]
+
+const router = createRouter({
+ history: createWebHistory(),
+ routes
+})
+
+export default router
\ No newline at end of file
diff --git a/src/views/index.vue b/src/views/index.vue
new file mode 100644
index 0000000..efc275b
--- /dev/null
+++ b/src/views/index.vue
@@ -0,0 +1,10 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/views/login.vue b/src/views/login.vue
new file mode 100644
index 0000000..6108236
--- /dev/null
+++ b/src/views/login.vue
@@ -0,0 +1,49 @@
+
+
+
+
+
+
{{$gameName}}
+
+
+
+
+
+
+
+
登 录
+
+
+

+
Linux.do
+
+
+

+
奶昔登录
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/vite.config.js b/vite.config.js
index bbcf80c..171bc3b 100644
--- a/vite.config.js
+++ b/vite.config.js
@@ -4,4 +4,13 @@ import vue from '@vitejs/plugin-vue'
// https://vite.dev/config/
export default defineConfig({
plugins: [vue()],
-})
+ server: {
+ proxy: {
+ '/api': {
+ target: 'http://localhost:3001',
+ changeOrigin: true,
+ rewrite: (path) => path.replace(/^\/api/, '')
+ }
+ }
+ }
+})
\ No newline at end of file