From 93cbc917ba2b0a7911e5124d07abbd3227693150 Mon Sep 17 00:00:00 2001 From: Zhao Zuohong Date: Sat, 23 Sep 2023 17:11:11 +0800 Subject: [PATCH] =?UTF-8?q?=E8=B7=AF=E7=94=B1=E5=88=9D=E6=AD=A5=E6=95=B4?= =?UTF-8?q?=E7=90=86=E3=80=81=E6=A0=B7=E5=BC=8F=E4=BF=AE=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ui/components.d.ts | 3 +- ui/src/App.vue | 157 ++++++++---------- .../{MaaWeeklynew1.vue => MaaWeeklyNew.vue} | 0 ui/src/components/PlanEditor.vue | 5 +- ui/src/components/SKLand.vue | 2 +- ui/src/pages/External.vue | 133 --------------- ui/src/pages/{Home.vue => Log.vue} | 9 - .../pages/{recordline.vue => RecordLine.vue} | 0 ui/src/pages/{Advanced.vue => Settings.vue} | 96 ++++++++++- ui/src/pages/allsetting.vue | 9 - ui/src/router.js | 1 + ui/src/routes.js | 81 ++++----- 12 files changed, 195 insertions(+), 301 deletions(-) rename ui/src/components/{MaaWeeklynew1.vue => MaaWeeklyNew.vue} (100%) delete mode 100644 ui/src/pages/External.vue rename ui/src/pages/{Home.vue => Log.vue} (95%) rename ui/src/pages/{recordline.vue => RecordLine.vue} (100%) rename ui/src/pages/{Advanced.vue => Settings.vue} (81%) delete mode 100644 ui/src/pages/allsetting.vue diff --git a/ui/components.d.ts b/ui/components.d.ts index 1ad093a51..1b0cc5136 100644 --- a/ui/components.d.ts +++ b/ui/components.d.ts @@ -16,7 +16,7 @@ declare module '@vue/runtime-core' { MaaRogue: typeof import('./src/components/MaaRogue.vue')['default'] MaaSss: typeof import('./src/components/MaaSss.vue')['default'] MaaWeekly: typeof import('./src/components/MaaWeekly.vue')['default'] - MaaWeeklynew1: typeof import('./src/components/MaaWeeklynew1.vue')['default'] + MaaWeeklyNew: typeof import('./src/components/MaaWeeklyNew.vue')['default'] NAvatar: typeof import('naive-ui')['NAvatar'] NButton: typeof import('naive-ui')['NButton'] NCard: typeof import('naive-ui')['NCard'] @@ -36,7 +36,6 @@ declare module '@vue/runtime-core' { NLayout: typeof import('naive-ui')['NLayout'] NLayoutContent: typeof import('naive-ui')['NLayoutContent'] NLayoutFooter: typeof import('naive-ui')['NLayoutFooter'] - NLayoutHeader: typeof import('naive-ui')['NLayoutHeader'] NLayoutSider: typeof import('naive-ui')['NLayoutSider'] NLog: typeof import('naive-ui')['NLog'] NMenu: typeof import('naive-ui')['NMenu'] diff --git a/ui/src/App.vue b/ui/src/App.vue index fb229a32c..0ed224f1d 100644 --- a/ui/src/App.vue +++ b/ui/src/App.vue @@ -8,52 +8,43 @@ > - + - - + + - - - - - - - +
- 运行日志 + 日志
- +
- 排班表 + 排班
- +
- 基建报表 + 报表
- - 工作休息比例报表 + + 心情曲线 - - 干员心情折线表 + + 心情饼图
- +
设置 @@ -105,15 +96,9 @@ import { PieChart, StatsChart, Settings, - HelpCircle, - Hammer, - MailOpen, - People, - Bag, - Flash + HelpCircle } from '@vicons/ionicons5' -import { DiceD20 } from '@vicons/fa' -const collapsed = ref(false) + function renderIcon(icon) { return () => h(NIcon, null, { default: () => h(icon) }) } @@ -126,48 +111,13 @@ const menuOptions = computed(() => [ key: 'go-to-log' }, { - label: () => h(RouterLink, { to: { path: '/plan' } }, { default: () => '排班编辑' }), + label: () => h(RouterLink, { to: { path: '/plan-editor' } }, { default: () => '排班编辑' }), icon: renderIcon(Home), key: 'go-to-plan' }, - - { - label: () => 'Mower设置', - icon: renderIcon(Settings), - key: 'go-to-mowersetting', - children: [ - { - label: () => - h(RouterLink, { to: { path: '/setting/Advanced' } }, { default: () => '基本设置' }), - key: 'Advanced', - icon: renderIcon(Settings) - }, - { - label: () => - h(RouterLink, { to: { path: '/setting/External' } }, { default: () => '基建设置' }), - key: 'External', - icon: renderIcon(Hammer) - }, - { - label: () => - h( - RouterLink, - { to: { path: '/setting/MaaWeeklynew1' } }, - { default: () => '清理智-xiner' } - ), - key: 'MaaWeeklynew1', - icon: renderIcon(Flash) - } - ] - }, - - //{ label: () => h(RouterLink, { to: { path: "/setting/sk-land" } }, { default: () => "森空岛签到" }), key: "go-to-skland" }, - { - label: () => - h(RouterLink, { to: { path: '/setting/allsetting' } }, { default: () => '全部设置' }), + label: () => h(RouterLink, { to: { path: '/settings' } }, { default: () => '全部设置' }), icon: renderIcon(Settings), - show: mobile.value, key: 'go-to-allsetting' }, { @@ -177,13 +127,13 @@ const menuOptions = computed(() => [ children: [ { label: () => - h(RouterLink, { to: { path: '/record-line' } }, { default: () => '基建报表-折线' }), + h(RouterLink, { to: { path: '/record/line' } }, { default: () => '基建报表-折线' }), icon: renderIcon(BarChart), key: 'go-to-record-line' }, { label: () => - h(RouterLink, { to: { path: '/record-pie' } }, { default: () => '基建报表-饼图' }), + h(RouterLink, { to: { path: '/record/pie' } }, { default: () => '基建报表-饼图' }), icon: renderIcon(PieChart), key: 'go-to-record-pie' } @@ -223,9 +173,10 @@ function start() { axios.get(`${import.meta.env.VITE_HTTP_URL}/start`) } -function set_window_height() { +function actions_on_resize() { const vh = window.innerHeight * 0.01 document.documentElement.style.setProperty('--vh', `${vh}px`) + mobile.value = window.innerWidth < 800 } const loaded = ref(false) @@ -234,11 +185,9 @@ const mobile = ref(true) provide('mobile', mobile) onMounted(async () => { - set_window_height() - mobile.value = window.innerWidth < 500 + actions_on_resize() window.addEventListener('resize', () => { - set_window_height() - mobile.value = window.innerWidth < 500 + actions_on_resize() }) const params = new URLSearchParams(document.location.search) @@ -246,9 +195,12 @@ onMounted(async () => { axios.defaults.headers.common['token'] = token await Promise.all([load_config(), load_shop(), load_operators(), get_running()]) - const r = RegExp(operators.value.map((x) => "'" + x.value).join('|')) + await load_plan() + loaded.value = true + const r = RegExp(operators.value.map((x) => "'" + x.value).join('|')) + hljs.registerLanguage('mower', () => ({ contains: [ { @@ -276,8 +228,6 @@ onMounted(async () => { ] })) - await load_plan() - if (!ws.value) { listen_ws() } @@ -296,11 +246,16 @@ onMounted(async () => { .provider { height: 100%; } + +.layout-container { + height: 100%; +} diff --git a/ui/src/components/MaaWeeklynew1.vue b/ui/src/components/MaaWeeklyNew.vue similarity index 100% rename from ui/src/components/MaaWeeklynew1.vue rename to ui/src/components/MaaWeeklyNew.vue diff --git a/ui/src/components/PlanEditor.vue b/ui/src/components/PlanEditor.vue index d50fd1767..484d95046 100644 --- a/ui/src/components/PlanEditor.vue +++ b/ui/src/components/PlanEditor.vue @@ -484,10 +484,6 @@ const avatar_bg = computed(() => { - - diff --git a/ui/src/pages/Home.vue b/ui/src/pages/Log.vue similarity index 95% rename from ui/src/pages/Home.vue rename to ui/src/pages/Log.vue index c502a5fc2..ae1126e90 100644 --- a/ui/src/pages/Home.vue +++ b/ui/src/pages/Log.vue @@ -91,15 +91,6 @@ function stop() { + + diff --git a/ui/src/pages/allsetting.vue b/ui/src/pages/allsetting.vue deleted file mode 100644 index 4700eeb69..000000000 --- a/ui/src/pages/allsetting.vue +++ /dev/null @@ -1,9 +0,0 @@ - - - diff --git a/ui/src/router.js b/ui/src/router.js index 8b74f3858..68cc4a496 100644 --- a/ui/src/router.js +++ b/ui/src/router.js @@ -1,5 +1,6 @@ import { createRouter, createWebHistory } from 'vue-router' import { routes } from '@/routes' + const router = createRouter({ history: createWebHistory(), routes diff --git a/ui/src/routes.js b/ui/src/routes.js index e70f693b2..351b3bc12 100644 --- a/ui/src/routes.js +++ b/ui/src/routes.js @@ -1,63 +1,48 @@ export const routes = [ - { path: '/', redirect: '/home', meta: { title: 'Redirect to Home' }, name: 'root' }, { - path: '/home', - component: () => import('@/pages/Home.vue'), - meta: { title: 'Home Page' }, - name: 'home' - }, - { - path: '/plan', - component: () => import('@/pages/Plan.vue'), - meta: { title: 'Plan Page' }, - name: 'plan' - }, - { - path: '/setting', - meta: { title: '设置' }, + path: '/', children: [ { - path: 'allsetting', - component: () => import('@/pages/allsetting.vue'), - meta: { title: '全部设置' }, - name: 'allsetting' + path: '', + component: () => import('@/pages/Log.vue'), + meta: { title: '日志' }, + name: 'log' + }, + { + path: 'plan-editor', + component: () => import('@/pages/Plan.vue'), + meta: { title: '排班' }, + name: 'plan' }, { - path: 'Advanced', - component: () => import('@/pages/Advanced.vue'), + path: 'settings', + component: () => import('@/pages/Settings.vue'), meta: { title: '设置' }, - name: 'Advanced' + name: 'settings' }, { - path: 'External', - component: () => import('@/pages/External.vue'), - meta: { title: '任务设置' }, - name: 'External' + path: 'doc', + component: () => import('@/pages/Doc.vue'), + meta: { title: '文档' }, + name: 'doc' }, { - path: 'MaaWeeklynew1', - component: () => import('@/components/MaaWeeklynew1.vue'), - meta: { title: '任务设置' }, - name: 'MaaWeeklynew1' + path: 'record', + children: [ + { + path: 'line', + component: () => import('@/pages/RecordLine.vue'), + meta: { title: '心情曲线' }, + name: 'record_line' + }, + { + path: 'pie', + component: () => import('@/pages/RecordPie.vue'), + meta: { title: '心情饼图' }, + name: 'record_pie' + } + ] } ] - }, - { - path: '/doc', - component: () => import('@/pages/Doc.vue'), - meta: { title: 'Documentation Page' }, - name: 'doc' - }, - { - path: '/record-line', - component: () => import('@/pages/recordline.vue'), - meta: { title: 'Record Page-line' }, - name: 'record-line' - }, - { - path: '/record-pie', - component: () => import('@/pages/RecordPie.vue'), - meta: { title: 'Record Page-pie' }, - name: 'record-pie' } ]