Skip to content

Commit

Permalink
optimize pages
Browse files Browse the repository at this point in the history
  • Loading branch information
whalechoi committed Sep 29, 2024
1 parent b81c4e0 commit 481f507
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 19 deletions.
4 changes: 3 additions & 1 deletion src/Dashboard.vue
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ const switchChecked = (custom, idx) => {
}
const refresh = () => {
version.value = ""
status.value = {api: "", coreType: "mihomo", pid: "", method: "", dataDir: ""}
status.value = {api: "", coreType: "xray", pid: "", method: "", dataDir: ""}
running.value = false
coreStatus.value = i18n.global.t('dashboard.status-core-status-stopped')
stdout.value = i18n.global.t('common.waiting-text')
Expand All @@ -212,6 +212,8 @@ const initStatus = () => {
running.value = true
coreStatus.value = i18n.global.t('dashboard.status-core-status-running')
}
}).catch(ex => {
showToast(i18n.global.t('dashboard.status-get-failed') + ex)
})
}
initVersion()
Expand Down
36 changes: 20 additions & 16 deletions src/Manage.vue
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
</van-space>
</template>
</van-nav-bar>
<van-list v-model:loading="loading" :finished="finished" :finished-text="i18n.global.t('manage.no-more')" @load="onLoad">
<van-list v-model:loading="loading" :finished="finished" :finished-text="i18n.global.t('manage.no-more')">
<van-cell-group style="top: 46px;">
<van-cell v-for="(item, index) in showNodeList" :key="index" center>
<template #title>
Expand Down Expand Up @@ -279,7 +279,7 @@ const startSpeedtest = async (custom) => {
node.show = true;
}
}).catch(ex => {
showToast(i18n.global.t('manage.speedtest-fail') + ex)
showToast(i18n.global.t('manage.speedtest-failed') + ex)
}).finally(() => {
for (const node of nowTest) {
node.speedtestLoading = false;
Expand Down Expand Up @@ -334,23 +334,27 @@ const convertObject = (arr, custom) => {
return convertArr;
}
const initXrayData = async () => {
let nodeList = await callApi(`get switch all`);
if (nodeList.custom.length > 0) {
const customData = convertObject(nodeList.custom, true);
allNodeList.value.push(...customData);
showNodeList.value.push(...customData)
}
const nodeData = convertObject(nodeList.result, false);
allNodeList.value.push(...nodeData);
showNodeList.value.push(...nodeData);
console.info('initXrayData complete')
await callApi(`get switch all`).then(value => {
if (value.custom.length > 0) {
const customData = convertObject(value.custom, true);
allNodeList.value.push(...customData);
showNodeList.value.push(...customData)
}
const nodeData = convertObject(value.result, false);
allNodeList.value.push(...nodeData);
showNodeList.value.push(...nodeData);
console.info('initXrayData complete')
}).catch(ex => {
showToast(i18n.global.t('manage.load-switch-data-failed') + ex)
})
}
const onLoad = () => {
console.info('onLoad')
const onLoad = async () => {
console.info('onLoad');
loading.value = true;
finished.value = false;
showNodeList.value = [];
allNodeList.value = [];
initXrayData();
await initXrayData();
loading.value = false;
finished.value = true;
}
Expand Down
4 changes: 3 additions & 1 deletion src/locales/en-US.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ export const dashboard = {
'version-dashboard': 'Dashboard',

'status': 'Status',
'status-get-failed': 'Get status failed, an exception occurred.',
'status-core-pid': "Core Pid",
'status-core-status': "Core Status",
'status-core-status-stopped': "stopped",
Expand All @@ -45,12 +46,13 @@ export const manage = {
'route-manage': 'Routing',
'more-setting': 'Settings',
'load-balancing': 'Balancer',
'load-switch-data-failed': 'Load switch data failed, an exception occurred.',
'speedtest': 'Test',
'switch': 'Switch',
'remarks': 'Remarks',
'search': 'Querying',
'placeholder-text': 'Please enter an Remarks.',
'speedtest-fail': 'The test failed and an exception occurred.',
'speedtest-failed': 'The test failed and an exception occurred.',
'speedtest-reject': 'Wait patiently until the test of other nodes is completed before continuing.',
'speedtest-all-warn': 'All nodes will be tested soon to prevent the airport from being blocked! Use with caution. Confirm to continue?',
}
Expand Down
4 changes: 3 additions & 1 deletion src/locales/zh-CN.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ export const dashboard = {
'version-dashboard': '仪表盘',

'status': '状态',
'status-get-failed': '获取状态信息失败,发生异常。',
'status-core-pid': "进程 ID",
'status-core-status': "核心状态",
'status-core-status-stopped': "停止",
Expand All @@ -45,12 +46,13 @@ export const manage = {
'route-manage': '路由规则',
'more-setting': '更多设置',
'load-balancing': '负载均衡',
'load-switch-data-failed': '加载节点信息失败,发生异常。',
'speedtest': '测试',
'switch': '切换',
'remarks': '别名',
'search': '查询中',
'placeholder-text': '请输入别名',
'speedtest-fail': '测试失败,发生异常。',
'speedtest-failed': '测试失败,发生异常。',
'speedtest-reject': '耐心等待其他节点测试结束后再继续。',
'speedtest-all-warn': '即将测试所有节点,以防机场封号!谨慎使用,确认继续?',
}
Expand Down

0 comments on commit 481f507

Please sign in to comment.