Skip to content
This repository has been archived by the owner on Nov 13, 2024. It is now read-only.

Commit

Permalink
Feat: optimization of text
Browse files Browse the repository at this point in the history
  • Loading branch information
yumao233 committed Aug 10, 2022
1 parent 4338b5a commit c5b754e
Show file tree
Hide file tree
Showing 56 changed files with 374 additions and 634 deletions.
4 changes: 3 additions & 1 deletion jsconfig.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
{
"compilerOptions": {
"target": "es6"
"target": "es6",
"jsx": "preserve",
},

"exclude": [
"node_modules",
"dist"
Expand Down
22 changes: 11 additions & 11 deletions src/app/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ Copyright (C) 2022 MCSManager <[email protected]>
-->
<template>
<el-container>
<!-- 管理用户 手机屏幕菜单栏 -->
<!-- Manage users phone screen menu bar -->
<el-drawer
v-if="isTopPermission"
size="240"
Expand All @@ -16,7 +16,7 @@ Copyright (C) 2022 MCSManager <[email protected]>
<Aside />
</el-aside>
</el-drawer>
<!-- 管理用户 电脑屏幕菜单栏 -->
<!-- Manage users Computer screen menu bar -->
<div v-if="isTopPermission" id="app-menu" class="only-pc-display">
<el-aside width="240px" style="height: 100%">
<Aside />
Expand All @@ -29,7 +29,7 @@ Copyright (C) 2022 MCSManager <[email protected]>
<Header v-bind:breadcrumbsList="breadCrumbs" :aside="toAside" />
</el-col>
</el-row>
<div v-loading="loading" style="min-height:50px">
<div v-loading="loading" style="min-height: 50px">
<router-view v-if="!loading"></router-view>
</div>
</el-main>
Expand All @@ -50,7 +50,7 @@ export default {
components: { Aside, Header },
data: function () {
return {
loading:true,
loading: true,
breadCrumbs: [],
mode: 1,
drawer: false
Expand Down Expand Up @@ -82,7 +82,7 @@ export default {
},
async beforeCreate() {
try {
// 获取当前面板状态信息
// Get current panel status information
const statusInfo = await getPanelStatus();
if (statusInfo?.isInstall === false) {
return router.push({ path: "/install" });
Expand All @@ -92,22 +92,22 @@ export default {
} else {
this.$i18n.locale = "en_us";
}
// 第一次刷新后,尝试获取一次用户数据
// 如果失败,则导航至 / 视图进一步决定跳转路由
// After the first refresh, try to get user data once
// If it fails, navigate to / view to further decide the jump route

await setupUserInfo();
const userInfo = this.$store.state.userInfo;
if (!userInfo || !userInfo.uuid) throw new Error("userInfo.uuid is null");
} catch (error) {
router.push({ path: "/" });
}finally{
this.loading = false
} finally {
this.loading = false;
}
},
async mounted() {
router.beforeEach((to, from, next) => {
console.log("Router:", from, "->", to);
// 设置在线信息全局状态
// Set the global status of online information
this.$store.commit(
"setOnlineNotice",
window.onlineMCSManagerNotice ? window.onlineMCSManagerNotice() : null
Expand Down
14 changes: 14 additions & 0 deletions src/app/directive/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
// Copyright (C) 2022 MCSManager <[email protected]>

import i18n from "../i18n"

export default function (app) {
app.directive("iszh", {
// eslint-disable-next-line no-unused-vars
mounted(el, binding, vnode) {
const language = i18n.global.locale
if (language != "zh_cn") el.style.display = 'none'
}
})

}
21 changes: 8 additions & 13 deletions src/app/index.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
// Copyright (C) 2022 MCSManager <[email protected]>

// 此文件为程序入口文件

import { createApp } from "vue";
import i18n from "./i18n"
import elementPlus from "element-plus";
Expand All @@ -16,23 +14,21 @@ import "../assets/css/action.css";

import App from "./App.vue";
import "./service/protocol";
import directive from "./directive"



const app = createApp(App);

// Vuex https://next.vuex.vuejs.org/zh/
// Vuex
import store from "./store";
app.use(store);
app.use(i18n)

app.directive("iszh", {
// eslint-disable-next-line no-unused-vars
mounted(el, binding, vnode) {
const language = i18n.global.locale
if (language != "zh_cn") el.style.display = 'none'
}
})

// custom directive
directive(app)


// Vue-Router
import router from "./router";
Expand All @@ -41,9 +37,8 @@ app.use(router);
// Install element-plus
app.use(elementPlus);

// 全局组件
// global component
import ItemGroup from "../components/ItemGroup";

app.component("ItemGroup", ItemGroup);
app.mount("#app");

app.mount("#app");
6 changes: 3 additions & 3 deletions src/app/service/common.js
Original file line number Diff line number Diff line change
Expand Up @@ -126,8 +126,8 @@ export function getDescriptionByTitle(description, title = "") {
return _exec(arr, description);
}

// 适用于配置文件解析成 JSON 格式后再解析成网页可循环的二维表格式
// 其具体原理是实现一个简单双向绑定,来对应每一个具体的配置项目
// It is suitable for parsing the configuration file into JSON format and then parsing it into a two-dimensional table format that can be cycled by web pages
// The specific principle is to implement a simple two-way binding to correspond to each specific configuration item
export function jsonToMap(json, topTitle = "", map = {}) {
for (const key in json) {
let title = null;
Expand Down Expand Up @@ -190,4 +190,4 @@ function leftZero4(str) {
}
}
return str;
}
}
8 changes: 4 additions & 4 deletions src/app/service/instance_type.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Copyright (C) 2022 MCSManager <[email protected]>

export const TYPE_UNIVERSAL = "universal"; // 通用输入输出程序
export const TYPE_WEB_SHELL = "universal/web_shell"; // WebShell 程序
export const TYPE_UNIVERSAL = "universal";
export const TYPE_WEB_SHELL = "universal/web_shell";
export const TYPE_MINECRAFT_MCDR = "universal/mcdr";

export const TYPE_MINECRAFT_JAVA = "minecraft/java";
Expand All @@ -19,7 +19,7 @@ export const TYPE_MINECRAFT_BDS = "minecraft/bedrock/bds";
export const TYPE_MINECRAFT_NUKKIT = "minecraft/bedrock/nukkit";
export const TYPE_STEAM_SERVER_UNIVERSAL = "steam/universal";

// 前端可选择类型列表
// Front-end selectable type list
const INSTANCE_TYPE_TRANSLATION = {};
INSTANCE_TYPE_TRANSLATION[TYPE_UNIVERSAL] = "General console program";
INSTANCE_TYPE_TRANSLATION[TYPE_STEAM_SERVER_UNIVERSAL] = "Steam Game Server";
Expand All @@ -37,7 +37,7 @@ INSTANCE_TYPE_TRANSLATION[TYPE_MINECRAFT_GEYSER] = "MC Geyser";
INSTANCE_TYPE_TRANSLATION[TYPE_MINECRAFT_MCDR] = "MC MCDR";
INSTANCE_TYPE_TRANSLATION[TYPE_WEB_SHELL] = "Web Shell";

// 不同类型的具体配置文件
// Different types of specific configuration files
const INSTANCE_TYPE_DEF_CONFIG = {
[TYPE_MINECRAFT_BUNGEECORD]: {
stopCommand: "end"
Expand Down
29 changes: 16 additions & 13 deletions src/app/service/process_config.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
// Copyright (C) 2022 MCSManager <[email protected]>

// This file is only for Chinese users, Added Chinese explanation to the configuration file
// 此文件仅用于中国用户,其作用是为配置文件新增中文解释

import {
TYPE_MINECRAFT_JAVA,
TYPE_MINECRAFT_BDS,
Expand Down Expand Up @@ -39,9 +42,9 @@ export const INSTANCE_CONFIGS = [
// 配置文件中文解释
info: `Minecraft 服务端极其重要的配置文件,几乎绝大部分常用配置(端口,人数,视距等)均在此文件中进行编辑`,
// 配置文件适配模块作者名
author: "Suwings",
author: "Unitwk",
// 配置文件 Github 地址(只能放置 Github 地址)
github: "https://github.com/Suwings",
github: "https://github.com/Unitwk",
// 在哪些服务端类型下此配置文件可见
category: [
TYPE_MINECRAFT_SPIGOT,
Expand Down Expand Up @@ -76,8 +79,8 @@ export const INSTANCE_CONFIGS = [
redirect: "bukkit/spigot.yml",
type: "yml",
info: "Spigot 配置文件,能够进一步的控制服务器的行为和具体参数,一些更为高级的限制都在此配置文件中",
author: "Suwings",
github: "https://github.com/Suwings",
author: "Unitwk",
github: "https://github.com/Unitwk",
category: [
TYPE_MINECRAFT_SPIGOT,
TYPE_MINECRAFT_PAPER,
Expand All @@ -91,8 +94,8 @@ export const INSTANCE_CONFIGS = [
// redirect: "bukkit/permissions.yml",
// type: "yml",
// info: "基本权限配置文件,一般情况无需多过改动",
// author: "Suwings",
// github: "https://github.com/Suwings",
// author: "Unitwk",
// github: "https://github.com/Unitwk",
// category: [TYPE_MINECRAFT_SPIGOT, TYPE_MINECRAFT_PAPER, TYPE_MINECRAFT_JAVA, TYPE_MINECRAFT_BUKKIT]
// },
// {
Expand All @@ -101,8 +104,8 @@ export const INSTANCE_CONFIGS = [
// redirect: "bukkit/commands.yml",
// type: "yml",
// info: "Bukkit 原始命令文件,一般情况无需改动",
// author: "Suwings",
// github: "https://github.com/Suwings",
// author: "Unitwk",
// github: "https://github.com/Unitwk",
// category: [TYPE_MINECRAFT_SPIGOT, TYPE_MINECRAFT_PAPER, TYPE_MINECRAFT_JAVA, TYPE_MINECRAFT_BUKKIT]
// },
{
Expand All @@ -126,8 +129,8 @@ export const INSTANCE_CONFIGS = [
// info: "服务器白名单",
// path: "whitelist.json",
// redirect: "bukkit/whitelist.json",
// author: "Suwings",
// github: "https://github.com/Suwings",
// author: "Unitwk",
// github: "https://github.com/Unitwk",
// category: [TYPE_MINECRAFT_SPIGOT, TYPE_MINECRAFT_PAPER, TYPE_MINECRAFT_JAVA, TYPE_MINECRAFT_BUKKIT]
// },
// {
Expand All @@ -136,8 +139,8 @@ export const INSTANCE_CONFIGS = [
// info: "服务器管理员列表",
// path: "ops.json",
// redirect: "bukkit/ops.json",
// author: "Suwings",
// github: "https://github.com/Suwings",
// author: "Unitwk",
// github: "https://github.com/Unitwk",
// category: [TYPE_MINECRAFT_SPIGOT, TYPE_MINECRAFT_PAPER, TYPE_MINECRAFT_JAVA, TYPE_MINECRAFT_BUKKIT]
// },
{
Expand Down Expand Up @@ -166,7 +169,7 @@ export const INSTANCE_CONFIGS = [
redirect: "mohist/mohist.yml",
type: "yml",
info: "mohist.yml 服务端配置文件",
author: "Suwings",
author: "Unitwk",
github: "https://github.com/LazyCreeper",
category: [TYPE_MINECRAFT_JAVA, TYPE_MINECRAFT_MOHIST]
},
Expand Down
Loading

0 comments on commit c5b754e

Please sign in to comment.