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

Commit 1020969

Browse files
committed
Feat: quick install error view
1 parent 917c4a8 commit 1020969

File tree

4 files changed

+37
-25
lines changed

4 files changed

+37
-25
lines changed

src/app/views/Install/index.vue

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
<div class="contanier">
77
<div class="bg"></div>
88

9-
<div class="panel-wrapper" v-if="step == -1">
9+
<!-- <div class="panel-wrapper" v-if="step == -1">
1010
<Panel class="panel tc" body-style="padding:40px;">
1111
<h1 class="title">
1212
<i class="el-icon-guide"></i>
@@ -24,7 +24,7 @@
2424
</ItemGroup>
2525
</div>
2626
</Panel>
27-
</div>
27+
</div> -->
2828

2929
<div class="panel-wrapper" v-if="step == 0">
3030
<Panel class="panel tc" body-style="padding:40px;">
@@ -74,11 +74,13 @@
7474
<ItemGroup>
7575
<SelectBlock @click="toQuickStart">
7676
<template #title>{{ $t("install.firstTime") }}</template>
77+
<template #info>{{ $t("install.firstTimeInfo") }}</template>
7778
</SelectBlock>
7879
</ItemGroup>
7980
<ItemGroup>
8081
<SelectBlock @click="toOverview">
8182
<template #title>{{ $t("install.oldUSer") }}</template>
83+
<template #info>{{ $t("install.oldUSerInfo") }}</template>
8284
</SelectBlock>
8385
</ItemGroup>
8486
</Panel>
@@ -96,7 +98,7 @@ export default {
9698
data: function () {
9799
return {
98100
isLoading: false,
99-
step: -1,
101+
step: 0,
100102
initUser: {
101103
userName: "",
102104
passWord: ""
@@ -125,6 +127,14 @@ export default {
125127
}
126128
};
127129
},
130+
mounted() {
131+
const language = window.navigator.language;
132+
if (language.includes("zh")) {
133+
this.selectLanguage("zh_cn");
134+
} else {
135+
this.selectLanguage("en_us");
136+
}
137+
},
128138
methods: {
129139
next() {
130140
this.isLoading = true;
@@ -165,9 +175,7 @@ export default {
165175
try {
166176
this.isLoading = true;
167177
await this.updateSettings({ language: lang });
168-
this.$message({ message: this.$t("settings.settingUpdate"), type: "success" });
169178
this.$i18n.locale = lang;
170-
this.next();
171179
} catch (error) {
172180
this.$message({ message: error, type: "error" });
173181
} finally {

src/app/views/quickstart/McPreset.vue

Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -76,13 +76,17 @@
7676
<template #title>{{ $t("views.quickstart_McPreset.014") }}</template>
7777
<template #default>
7878
<div class="display-center">
79-
<div style="text-align: center">
79+
<div style="text-align: center" v-if="taskInfo?.status != -1">
8080
<el-progress type="circle" :percentage="percentage"></el-progress>
8181
<div style="margin-top: 12px; text-align: center">
8282
<p class="tip-title">{{ $t("views.quickstart_McPreset.008") }}</p>
8383
<p class="sub-title-info">{{ $t("views.quickstart_McPreset.009") }}</p>
8484
</div>
8585
</div>
86+
<div style="text-align: center" v-else-if="taskInfo?.status == -1">
87+
<h1>{{ $t("CommonText.044") }}</h1>
88+
<p>{{ $t("views.quickstart_McPreset.015") }}</p>
89+
</div>
8690
</div>
8791
</template>
8892
</Panel>
@@ -157,18 +161,19 @@ export default {
157161
});
158162
this.tableData = data || [];
159163
} catch (error) {
160-
this.$message({ type: "error", message: error.message });
164+
this.$message({
165+
type: "error",
166+
message: error.message
167+
});
161168
this.tableData = null;
162169
} finally {
163170
this.requestLoading = false;
164171
}
165-
166172
if (this.taskId && this.tableData) {
167173
this.percentage = 50;
168174
this.startDownloadTask();
169175
}
170176
},
171-
172177
startDownloadTask() {
173178
if (this.intervalTask) clearInterval(this.intervalTask);
174179
this.requestLoading = false;
@@ -179,14 +184,14 @@ export default {
179184
this.queryStatus();
180185
}, 3000);
181186
},
182-
183187
// Start install
184188
async handleSelectTemplate(index, row) {
185-
const { value: instanceName } = await this.$prompt("请输入新建服务器的名字:");
189+
const { value: instanceName } = await this.$prompt(
190+
window.$t("views.quickstart_McPreset.016")
191+
);
186192
this.requestLoading = true;
187193
this.installView = true;
188194
this.isInstalled = false;
189-
190195
this.newTaskInfo = await request({
191196
method: "POST",
192197
url: API_INSTANCE_ASYNC_TASK,
@@ -204,7 +209,6 @@ export default {
204209
this.requestLoading = false;
205210
this.startDownloadTask();
206211
},
207-
208212
async queryStatus() {
209213
this.taskInfo = await request({
210214
method: "POST",
@@ -218,18 +222,15 @@ export default {
218222
taskId: this.newTaskInfo.taskId
219223
}
220224
});
221-
222225
if (this.taskInfo.status === 0) {
223226
this.percentage = 100;
224227
setTimeout(() => this.installed(), 2000);
225228
}
226229
},
227-
228230
installed() {
229231
console.log(window.$t("views.quickstart_McPreset.013"));
230232
this.isInstalled = true;
231233
},
232-
233234
toInstance() {
234235
this.$router.push({
235236
path: `/terminal/${this.remoteUuid}/${this.taskInfo.detail.instanceUuid}/`,
@@ -239,11 +240,9 @@ export default {
239240
});
240241
}
241242
},
242-
243243
mounted() {
244244
this.init();
245245
},
246-
247246
unmounted() {
248247
clearInterval(this.intervalTask);
249248
}

src/language/en_us.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -952,9 +952,9 @@
952952
}
953953
},
954954
"install": {
955-
"welcome": "Welcome to the MCSManager Control Panel",
956-
"desc": "Open-source, distributed, and out-of-box solution for Minecraft server and all command-line programs.",
957-
"start": "Start using",
955+
"welcome": "Welcome to the MCSManager",
956+
"desc": "Open-source, Distributed, Lightweight Control Panel that supports most Game Servers and Console Programs.",
957+
"start": "Install",
958958
"createAdminAccount": "Create an administrator account",
959959
"createAdminAccountInfo": "Username could contains any language, please make sure to store your password safely.",
960960
"passWord": "Password",

src/language/zh_cn.json

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,8 @@
4242
"040": "提示",
4343
"041": "确定",
4444
"042": "取消",
45-
"043": ""
45+
"043": "",
46+
"044": "安装错误"
4647
},
4748
"general": {
4849
"search": "搜索",
@@ -965,7 +966,9 @@
965966
"oldUSer": "老用户",
966967
"adminOK": "管理员已创建",
967968
"stoppedServiceTitle": "正在维护中",
968-
"stoppedServiceContent": "很抱歉,无法获取最新预设整合包列表,可能是您的网络问题或服务器正在维护中。"
969+
"stoppedServiceContent": "很抱歉,无法获取最新预设整合包列表,可能是您的网络问题或服务器正在维护中。",
970+
"firstTimeInfo": "我们将引导你使用并部署你的应用程序。",
971+
"oldUSerInfo": "以更专业化的界面供你使用。"
969972
},
970973
"notify": {
971974
"connectDaemonError": "访问远程节点异常",
@@ -1092,7 +1095,9 @@
10921095
"012": "测试服务器",
10931096
"013": "已安装完毕",
10941097
"014": "正在安装中",
1095-
"eulaReadTitle": "安装预设整合包将视作你已同意并阅读 Minecraft 最终用户协议:"
1098+
"eulaReadTitle": "安装预设整合包将视作你已同意并阅读 Minecraft 最终用户协议:",
1099+
"015": "可能是因为网络不通畅或服务器正在维护中,请等待一段时间后再进行尝试,或使用其他安装包尝试。",
1100+
"016": "请输入新建服务器的名字:"
10961101
},
10971102
"Settings": {
10981103
"001": "预设资源下载点",
@@ -1137,4 +1142,4 @@
11371142
"019": "保存后启动实例时会自动运行映射程序,重启实例生效。"
11381143
}
11391144
}
1140-
}
1145+
}

0 commit comments

Comments
 (0)