-
+
+
启用插件
-
GrasscuttersWebDashboard
+
+
+ GrasscuttersWebDashboard
+
+
+ 连接失败先去直接先https://ip
+ 访问一下 然后 高级 继续访问
@@ -45,18 +117,26 @@ function send() {
登录
+
+
+
diff --git a/src/pages/start/components/startnav.vue b/src/pages/start/components/startnav.vue
index aff04fa..21795b3 100644
--- a/src/pages/start/components/startnav.vue
+++ b/src/pages/start/components/startnav.vue
@@ -1,6 +1,16 @@
-
-
- {{ item.name }}
-
-
+
+
+
+
+
+ 控制台代码生成
+
+ {{ item.name }}
+
+
+
+
+
+
+ {{ GMTitle }}
+
+ {{ item.name }}
+
+
+
diff --git a/src/pages/start/components/thing.vue b/src/pages/start/components/thing.vue
index 87b4090..7d38167 100644
--- a/src/pages/start/components/thing.vue
+++ b/src/pages/start/components/thing.vue
@@ -3,8 +3,8 @@
import { reactive, ref, computed } from 'vue'
import { useClipboard } from '@vueuse/core'
import thing from './json/thing.json'
-const { text, isSupported, copy } = useClipboard()
import { Message } from '@arco-design/web-vue'
+const { text, isSupported, copy } = useClipboard()
var value2 = ref()
var value3 = ref('/give')
@@ -53,7 +53,6 @@ function copyvalue() {
v-model="value2"
:options="options"
placeholder="请输入物品"
- :virtual-list-props="{ height: 200 }"
filterable
/>
diff --git a/src/pages/start/index.vue b/src/pages/start/index.vue
index 15142c2..1fc34a8 100644
--- a/src/pages/start/index.vue
+++ b/src/pages/start/index.vue
@@ -11,7 +11,7 @@ import commuse from './components/commuse.vue'
diff --git a/src/pages/start/style.less b/src/pages/start/style.less
index 8ad47e5..e2d5b5e 100644
--- a/src/pages/start/style.less
+++ b/src/pages/start/style.less
@@ -1,25 +1,9 @@
.cont {
- width: 800px;
+ height: 100%;
+ overflow: auto;
margin: auto;
display: flex;
-
- .nav {
- height: 600px;
- width: 120px;
- border-right: 1px solid #777777;
- padding-right: 30px;
-
- >div {
- margin: 10px 0;
- cursor: pointer;
- font-size: 18px;
- color: #000;
- }
-
+ .selectcom{
+ margin: 0 auto ;
}
-
- .selectcom {
- width: 660px;
- }
-
}
\ No newline at end of file
diff --git a/src/router/index.ts b/src/router/index.ts
index 442d20a..15a9284 100644
--- a/src/router/index.ts
+++ b/src/router/index.ts
@@ -1,14 +1,67 @@
import { createRouter, createWebHashHistory, RouteRecordRaw } from 'vue-router'
-import routes from 'virtual:generated-pages'
+// import routes from 'virtual:generated-pages'
// console.log(routes,'打印生成自动生成的路由')
-routes.push({
- path: '/',
- redirect: '/login',
-})
+let constantRoutes = [
+ {
+ path: '/',
+ component: () => import('@/pages/index.vue'),
+ },
+ {
+ path: '/start',
+ component: () => import('@/pages/start/index.vue'),
+ children: [
+ {
+ path: "/start/commuse",
+ component: () => import('@/pages/start/components/commuse.vue'),
+ },
+ {
+ path: "/start/thing",
+ component: () => import('@/pages/start/components/thing.vue'),
+ },
+ {
+ path: "/start/role",
+ component: () => import('@/pages/start/components/role.vue'),
+ },
+ {
+ path: "/start/holyrelic",
+ component: () => import('@/pages/start/components/holyrelic.vue'),
+ },
+ {
+ path: "/start/monster",
+ component: () => import('@/pages/start/components/monster.vue'),
+ },
+ {
+ path: "/start/other",
+ component: () => import('@/pages/start/components/other.vue'),
+ },
+ {
+ path: "/start/weapon",
+ component: () => import('@/pages/start/components/weapon.vue'),
+ },
+ {
+ path: "/start/login",
+ component: () => import('@/pages/login/index.vue'),
+ },
+ {
+ path: "/start/consoled",
+ component: () => import('@/pages/consoled/index.vue'),
+ },
+ {
+ path: "/start/personnel",
+ component: () => import('@/pages/start/components/personnel.vue'),
+ }
+ ]
+ }
+
+]
+
+
+
//导入生成的路由数据
const router = createRouter({
history: createWebHashHistory(),
- routes,
+ routes: constantRoutes,
})
+
export default router
diff --git a/src/router/root.ts b/src/router/root.ts
index bc5f24e..6f79ab2 100644
--- a/src/router/root.ts
+++ b/src/router/root.ts
@@ -1,6 +1,4 @@
export default [
- {
- path: '/',
- component: () => import('@/pages/login/index.vue'),
- },
+
+
]
diff --git a/src/store/modules/app/index.ts b/src/store/modules/app/index.ts
index 4995215..3a4c757 100644
--- a/src/store/modules/app/index.ts
+++ b/src/store/modules/app/index.ts
@@ -3,16 +3,61 @@ import piniaStore from '@/store/index'
import { AppState } from './types';
import { useWebSocket } from '@vueuse/core'
import { watch } from 'vue'
+import { Message } from '@arco-design/web-vue'
export const useAppStore = defineStore(
// 唯一ID
'app',
{
state: () => ({
- title: "FastVue3,一个快速开箱即用的Vue3+Vite模板",
- h1: 'Vue3+Vite2.x+Ts+Pinia大厂开发必备',
+ title: "",
+ h1: '',
theme: 'dark',
- send: (data: string | ArrayBuffer | Blob, useBuffer?: boolean | undefined) => { }
+ isLogin: false,
+ tick: [
+ {
+ label: '系统运行时长',
+ value: '/',
+ },
+ {
+ label: '在线玩家数量',
+ value: '/',
+ },
+ {
+ label: 'Tick耗时',
+ value: '/',
+ },
+ {
+ label: '内存占用',
+ value: '/',
+ }
+ ],
+ baseData: [
+ {
+ label: '服务器名称',
+ value: '/',
+ },
+ {
+ label: '系统',
+ value: '/',
+ },
+ {
+ label: '服务器地址',
+ value: '/',
+ },
+ {
+ label: 'JAVA版本',
+ value: '/',
+ },
+ {
+ label: '插件版本',
+ value: '/',
+ }
+ ],
+ send: (data: string | ArrayBuffer | Blob, useBuffer?: boolean | undefined) => { },
+ close: () => { },
+ open: () => { },
+ mesgData: [""]
}),
getters: {},
actions: {
@@ -37,17 +82,135 @@ export const useAppStore = defineStore(
}
},
socketConnect(wss: string) {
- const { status, data, send, open, close } = useWebSocket(wss)
+
+ const { status, data, send, open, close } = useWebSocket(wss, {
+ autoReconnect: {
+ retries: 2,
+ delay: 1000,
+ onFailed() {
+ Message.error('连接失败,请去GrasscuttersWebDashboard查看处理方法')
+ localStorage.removeItem("WSS")
+ },
+ },
+ // heartbeat: {
+ // message: 'ping',
+ // interval: 10000,
+ // },
+ onConnected: (ws) => {
+ this.isLogin = true
+ console.log("已登录");
+ ws.send("{\"type\":\"State\",\"data\":\"0\"}");
+ ws.send("{\"type\":\"Player\",\"data\":\"0\"}");
+ }
+ })
+ localStorage.setItem("WSS", wss)
watch(
data,
- (v) => {
- console.log(v);
+ (parse) => {
+ parse = JSON.parse(parse)
+ switch (parse.eventName) {
+ case "tick":
+ const data = []
+ for (const key in parse.data) {
+ if (Object.prototype.hasOwnProperty.call(parse.data, key)) {
+ var element = parse.data[key];
+ var label = ""
+ if (key == "getAllocatedMemory") {
+ label = "系统内存"
+ element = (element/1024/1024).toFixed(2) + "M"
+ }
+ if (key == "playerCount") {
+ label = "在线玩家数量"
+ }
+ if (key == "serverUptime") {
+ label = "系统运行时长"
+ element = this.formatSecToStr(Math.ceil(element / 1000))
+ }
+ if (key == "tickTimeElapsed") {
+ label = "Tick耗时"
+ }
+ if (key == "getFreeMemory") {
+ label = "已用内存"
+ element = (element/1024/1024).toFixed(2) + "M"
+ }
+ data.push({
+ label: label,
+ value: element,
+ })
+ }
+ }
+ this.tick = data
+ break;
+ case "BaseData":
+ const data2 = []
+
+ for (const key in parse.data) {
+ if (Object.prototype.hasOwnProperty.call(parse.data, key)) {
+ var element = parse.data[key];
+ var label = ""
+ if (key == "GrVersion") {
+ label = "插件版本"
+ }
+ if (key == "IP") {
+ label = "服务器地址"
+ }
+ if (key == "JavaVersion") {
+ label = "JAVA版本"
+ }
+ if (key == "SystemVersion") {
+ label = "系统"
+ }
+ if (key == "ServerName") {
+ label = "服务名称"
+ }
+ data2.push({
+ label: label,
+ value: element,
+ })
+ }
+ }
+ this.baseData = data2
+
+ break;
+
+ case "cmd_msg":
+ this.mesgData.push(parse.data)
+ break;
+
+ default:
+ break;
+ }
}
)
this.send = send
+ this.close = close
+ this.open = open
},
socketSend(str: string) {
this.send(str)
+ },
+ socketClose() {
+ this.isLogin = false
+ this.close()
+ localStorage.removeItem("WSS")
+ },
+ formatSecToStr(seconds: number) {
+ let daySec = 24 * 60 * 60;
+ let hourSec = 60 * 60;
+ let minuteSec = 60;
+ let dd = Math.floor(seconds / daySec);
+ let hh = Math.floor((seconds % daySec) / hourSec);
+ let mm = Math.floor((seconds % hourSec) / minuteSec);
+ let ss = seconds % minuteSec;
+ if (dd > 0) {
+ return dd + "天" + hh + "小时" + mm + "分钟" + ss + "秒";
+ } else if (hh > 0) {
+ return hh + "小时" + mm + "分钟" + ss + "秒";
+ } else if (mm > 0) {
+ return mm + "分钟" + ss + "秒";
+ } else {
+ return ss + "秒";
+ }
}
}
}
diff --git a/src/store/modules/app/types.ts b/src/store/modules/app/types.ts
index 762c9a1..82fa736 100644
--- a/src/store/modules/app/types.ts
+++ b/src/store/modules/app/types.ts
@@ -9,4 +9,5 @@ export interface AppState {
menuWidth: number;
globalSettings: boolean;
[key: string]: unknown;
+ mesgData:string[];
}
diff --git a/src/utils/http/axios/index.ts b/src/utils/http/axios/index.ts
index 7c8cbb2..d1cb0eb 100644
--- a/src/utils/http/axios/index.ts
+++ b/src/utils/http/axios/index.ts
@@ -113,5 +113,5 @@ export type { AxiosInstance, AxiosResponse };
* @return {Promise}
*/
// export const login = (params: ILogin): Promise
=> {
-// return axiosInstance.post('user/login', params).then(res => res.data);
+// return axiosInstance.post('user', params).then(res => res.data);
// };