aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorNtkskwk <natsukawa247@outlook.com>2024-09-03 07:41:34 +0800
committerNtkskwk <natsukawa247@outlook.com>2024-09-03 07:41:34 +0800
commita1a20e51d6c9efea406cf18facf707ea50e3d18c (patch)
treef8516f5ce30efa59189c78a1cdfaf5614acb7d58
parentd77828d97ee98792e50a034f905cd3894807d5ff (diff)
downloadHydroRoll-a1a20e51d6c9efea406cf18facf707ea50e3d18c.tar.gz
HydroRoll-a1a20e51d6c9efea406cf18facf707ea50e3d18c.zip
refactor: Optimize the structure of the code
-rw-r--r--site/src/components/ChangeLog.vue61
-rw-r--r--site/src/components/Right.vue203
-rw-r--r--site/src/components/RightPage1.vue65
-rw-r--r--site/src/components/TheWelcome.vue88
-rw-r--r--site/src/components/WelcomeItem.vue87
-rw-r--r--site/src/router/index.ts2
-rw-r--r--site/src/views/Home.vue7
-rw-r--r--site/src/views/index/Left.vue (renamed from site/src/components/Left.vue)4
-rw-r--r--site/src/views/index/Notepad/changelog.ts16
-rw-r--r--site/src/views/index/Notepad/index.vue45
-rw-r--r--site/src/views/index/Right.vue160
-rw-r--r--site/src/views/index/index.vue (renamed from site/src/views/Welcome.vue)12
12 files changed, 230 insertions, 520 deletions
diff --git a/site/src/components/ChangeLog.vue b/site/src/components/ChangeLog.vue
deleted file mode 100644
index e58ee39..0000000
--- a/site/src/components/ChangeLog.vue
+++ /dev/null
@@ -1,61 +0,0 @@
-<script lang="ts">
-import axios from 'axios';
-
-export default {
- data() {
- return {
- ChangeLogMessage: 'testChangeLogMessage',
- }
- },
- props: {
- msg: {
- type: String,
- require: true
- },
- date: {
- type: Date,
- default: new Date('2024-07-14T12:00:00Z')
- }
- },
- methods: {
- getChangeLog() {
- axios.get('https://api.github.com/repos/HydroRoll-Team/HydroRoll/releases/latest').then(res => {
-
- this.ChangeLogMessage ="## "+ res.data['tag_name']+"\n"+res.data['body'];
- console.log(res.data);
- })
- }
- },
- beforeMount() {
- this.getChangeLog()
- }
-
-}
-</script>
-
-
-<template>
- <div class="details" style="overflow-y:scroll;overflow-x:hidden;height:100%">
- <h3>
- ChangeLog
- </h3>
- <v-md-preview :text="ChangeLogMessage"></v-md-preview>
- </div>
-</template>
-
-
-<style scoped>
-
-
-h3 {
- font-size: 1.2rem;
- font-weight: 500;
- margin-bottom: 0.4rem;
- color: var(--color-heading);
-}
-
-.details {
- flex: 1;
- margin-left: 1rem;
-}
-</style>
diff --git a/site/src/components/Right.vue b/site/src/components/Right.vue
deleted file mode 100644
index 055d11b..0000000
--- a/site/src/components/Right.vue
+++ /dev/null
@@ -1,203 +0,0 @@
-<script lang="ts">
-import ChangeLog from './ChangeLog.vue'
-import RightPage1 from './RightPage1.vue'
-import DocumentationIcon from './icons/IconDocumentation.vue'
-
-export default {
- data() {
- return {
- mainPage: 1,
- changelogDisplay: "",
- page2Display: "none",
- page3Display: "none",
- page4Display: "none",
- icon1Back: "var(--icon-highlight)",
- icon2Back: "",
- icon3Back: "",
- icon4Back: "",
- }
- },
- components: {
- ChangeLog,
- RightPage1,
- DocumentationIcon
- },
- methods: {
- control_page(type: string, n: number) {
- if (type == "over") {
- this.mainPage = n
- this.change_page(n)
- }
- if (type == "click") {
- this.mainPage = n
- this.change_page(n)
- }
- if (type == "out") {
- this.change_page(this.mainPage)
- }
- },
- change_page(n: number) {
- if (n == 1) {
- this.changelogDisplay = "";
- this.page2Display = "none";
- this.page3Display = "none";
- this.page4Display = "none";
- this.icon1Back = "var(--icon-highlight)";
- this.icon2Back = "var(--color-border)";
- this.icon3Back = "var(--color-border-hover)";
- this.icon4Back = "var(--color-border-hover)";
- } else if (n == 2) {
- this.changelogDisplay = "none";
- this.page2Display = "";
- this.page3Display = "none";
- this.page4Display = "none";
- this.icon1Back = "var(--color-border)";
- this.icon2Back = "var(--icon-highlight)";
- this.icon3Back = "var(--color-border-hover)";
- this.icon4Back = "var(--color-border-hover)";
- } else if (n == 3) {
- this.changelogDisplay = "none";
- this.page2Display = "none";
- this.page3Display = "";
- this.page4Display = "none";
- this.icon1Back = "var(--color-border)";
- this.icon2Back = "var(--color-border)";
- this.icon3Back = "var(--color-border-hover)";
- this.icon4Back = "var(--color-border-hover)";
- } else if (n == 4) {
- this.changelogDisplay = "none";
- this.page2Display = "none";
- this.page3Display = "none";
- this.page4Display = "";
- this.icon1Back = "var(--color-border)";
- this.icon2Back = "var(--color-border)";
- this.icon3Back = "var(--color-border-hover)";
- this.icon4Back = "var(--color-border-hover)";
- }
-
- }
- }
-}
-
-</script>
-
-<template>
- <div class="item">
- <el-tooltip content="ChangeLog" placement="left">
- <i :style="{background:icon1Back}" @mouseover="control_page('over',1)" @click="control_page('click',1)"
- @mouseout="control_page('out',1)">
- <DocumentationIcon/>
- </i>
- </el-tooltip>
- <el-tooltip content="Page2" placement="left">
- <i :style="{background:icon2Back}" @mouseover="control_page('over',2)" @click="control_page('click',2)"
- @mouseout="control_page('out',2)">
- <DocumentationIcon/>
- </i>
- </el-tooltip>
- <el-tooltip content="敬请期待" placement="left">
- <i :style="{background:icon3Back}" @mouseover="control_page('over',3)" @click="control_page('click',3)"
- @mouseout="control_page('out',3)">
- <DocumentationIcon/>
- </i>
- </el-tooltip>
- <el-tooltip content="敬请期待" placement="left">
- <i :style="{background:icon4Back}" @mouseover="control_page('over',4)" @click="control_page('click',4)"
- @mouseout="control_page('out',4)">
- <DocumentationIcon/>
- </i>
- </el-tooltip>
- <div>
- <ChangeLog :style="{display:changelogDisplay}"/>
- <RightPage1 title="Test Page 2" :style="{display:page2Display}"/>
- <RightPage1 title="Test Page 3" :style="{display:page3Display}"/>
- <RightPage1 title="Test Page 4" :style="{display:page4Display}"/>
- </div>
- </div>
-
-</template>
-
-<style>
-
-.item {
- height: 600px;
- margin-top: 2rem;
- display: flex;
- position: relative;
-}
-
-
-i {
- display: flex;
- place-items: center;
- place-content: center;
- width: 32px;
- height: 32px;
- color: var(--color-text);
-}
-
-
-h3 {
- font-size: 1.2rem;
- font-weight: 500;
- margin-bottom: 0.4rem;
- color: var(--color-heading);
-}
-
-@media (min-width: 1024px) {
- .item {
- margin-top: 0;
- padding: 0.4rem 0 1rem calc(var(--section-gap) / 2);
- }
-
- i {
- left: -26px;
- position: absolute;
- border-radius: 8px;
- width: 50px;
- height: 50px;
- }
-
- div i:nth-child(1) {
- top: calc(20% - 25px);
- }
-
- div i:nth-child(2) {
- top: calc(40% - 25px);
- }
-
- div i:nth-child(3) {
- top: calc(60% - 25px);
- }
-
- div i:nth-child(4) {
- top: calc(80% - 25px);
- }
-
- .item:before {
- content: ' ';
- border-left: 1px solid var(--color-border);
- position: absolute;
- left: 0;
- bottom: calc(50% + 25px);
- height: calc(50% - 25px);
- }
-
- .item:after {
- content: ' ';
- border-left: 1px solid var(--color-border);
- position: absolute;
- left: 0;
- top: calc(50% + 25px);
- height: calc(50% - 25px);
- }
-
- .item:first-of-type:before {
- display: none;
- }
-
- .item:last-of-type:after {
- display: none;
- }
-}
-</style>
diff --git a/site/src/components/RightPage1.vue b/site/src/components/RightPage1.vue
deleted file mode 100644
index 5b93ea8..0000000
--- a/site/src/components/RightPage1.vue
+++ /dev/null
@@ -1,65 +0,0 @@
-<script lang="ts">
-import axios from "axios";
-
-export default {
- data() {
- return {
- ChangeLogTagName: "beta",
- ChangeLogMessage: 'testChangeLogMessage',
- }
- },
- props: {
- title: {
- type: String,
- default: "1",
- },
- msg: {
- type: String,
- require: true
- },
- date: {
- type: Date,
- default: new Date('2024-07-14T12:00:00Z')
- }
- },
- methods: {
- getChangeLog() {
- axios.get('https://api.github.com/repos/HydroRoll-Team/HydroRoll/releases/latest').then(res => {
- this.ChangeLogTagName = res.data['tag_name'];
- this.ChangeLogMessage = res.data['body'];
- console.log(res.data);
- })
- }
- },
- beforeMount() {
- this.getChangeLog()
- }
-}
-</script>
-
-
-<template>
- <div class="details" style="overflow-y:scroll;overflow-x:hidden;height:100%">
- <h3>
- {{ title }}
- </h3>
- <v-md-preview :text="ChangeLogMessage"></v-md-preview>
- </div>
-</template>
-
-
-<style scoped>
-
-
-h3 {
- font-size: 1.2rem;
- font-weight: 500;
- margin-bottom: 0.4rem;
- color: var(--color-heading);
-}
-
-.details {
- flex: 1;
- margin-left: 1rem;
-}
-</style>
diff --git a/site/src/components/TheWelcome.vue b/site/src/components/TheWelcome.vue
deleted file mode 100644
index 49d8f73..0000000
--- a/site/src/components/TheWelcome.vue
+++ /dev/null
@@ -1,88 +0,0 @@
-<script setup lang="ts">
-import WelcomeItem from './WelcomeItem.vue'
-import DocumentationIcon from './icons/IconDocumentation.vue'
-import ToolingIcon from './icons/IconTooling.vue'
-import EcosystemIcon from './icons/IconEcosystem.vue'
-import CommunityIcon from './icons/IconCommunity.vue'
-import SupportIcon from './icons/IconSupport.vue'
-</script>
-
-<template>
- <WelcomeItem>
- <template #icon>
- <DocumentationIcon />
- </template>
- <template #heading>Documentation</template>
-
- Vue’s
- <a href="https://vuejs.org/" target="_blank" rel="noopener">official documentation</a>
- provides you with all information you need to get started.
- </WelcomeItem>
-
- <WelcomeItem>
- <template #icon>
- <ToolingIcon />
- </template>
- <template #heading>Tooling</template>
-
- This project is served and bundled with
- <a href="https://vitejs.dev/guide/features.html" target="_blank" rel="noopener">Vite</a>. The
- recommended IDE setup is
- <a href="https://code.visualstudio.com/" target="_blank" rel="noopener">VSCode</a> +
- <a href="https://github.com/johnsoncodehk/volar" target="_blank" rel="noopener">Volar</a>. If
- you need to test your components and web pages, check out
- <a href="https://www.cypress.io/" target="_blank" rel="noopener">Cypress</a> and
- <a href="https://on.cypress.io/component" target="_blank" rel="noopener"
- >Cypress Component Testing</a
- >.
-
- <br />
-
- More instructions are available in <code>README.md</code>.
- </WelcomeItem>
-
- <WelcomeItem>
- <template #icon>
- <EcosystemIcon />
- </template>
- <template #heading>Ecosystem</template>
-
- Get official tools and libraries for your project:
- <a href="https://pinia.vuejs.org/" target="_blank" rel="noopener">Pinia</a>,
- <a href="https://router.vuejs.org/" target="_blank" rel="noopener">Vue Router</a>,
- <a href="https://test-utils.vuejs.org/" target="_blank" rel="noopener">Vue Test Utils</a>, and
- <a href="https://github.com/vuejs/devtools" target="_blank" rel="noopener">Vue Dev Tools</a>. If
- you need more resources, we suggest paying
- <a href="https://github.com/vuejs/awesome-vue" target="_blank" rel="noopener">Awesome Vue</a>
- a visit.
- </WelcomeItem>
-
- <WelcomeItem>
- <template #icon>
- <CommunityIcon />
- </template>
- <template #heading>Community</template>
-
- Got stuck? Ask your question on
- <a href="https://chat.vuejs.org" target="_blank" rel="noopener">Vue Land</a>, our official
- Discord server, or
- <a href="https://stackoverflow.com/questions/tagged/vue.js" target="_blank" rel="noopener"
- >StackOverflow</a
- >. You should also subscribe to
- <a href="https://news.vuejs.org" target="_blank" rel="noopener">our mailing list</a> and follow
- the official
- <a href="https://twitter.com/vuejs" target="_blank" rel="noopener">@vuejs</a>
- twitter account for latest news in the Vue world.
- </WelcomeItem>
-
- <WelcomeItem>
- <template #icon>
- <SupportIcon />
- </template>
- <template #heading>Support Vue</template>
-
- As an independent project, Vue relies on community backing for its sustainability. You can help
- us by
- <a href="https://vuejs.org/sponsor/" target="_blank" rel="noopener">becoming a sponsor</a>.
- </WelcomeItem>
-</template>
diff --git a/site/src/components/WelcomeItem.vue b/site/src/components/WelcomeItem.vue
deleted file mode 100644
index 6d7086a..0000000
--- a/site/src/components/WelcomeItem.vue
+++ /dev/null
@@ -1,87 +0,0 @@
-<template>
- <div class="item">
- <i>
- <slot name="icon"></slot>
- </i>
- <div class="details">
- <h3>
- <slot name="heading"></slot>
- </h3>
- <slot></slot>
- </div>
- </div>
-</template>
-
-<style scoped>
-.item {
- margin-top: 2rem;
- display: flex;
- position: relative;
-}
-
-.details {
- flex: 1;
- margin-left: 1rem;
-}
-
-i {
- display: flex;
- place-items: center;
- place-content: center;
- width: 32px;
- height: 32px;
-
- color: var(--color-text);
-}
-
-h3 {
- font-size: 1.2rem;
- font-weight: 500;
- margin-bottom: 0.4rem;
- color: var(--color-heading);
-}
-
-@media (min-width: 1024px) {
- .item {
- margin-top: 0;
- padding: 0.4rem 0 1rem calc(var(--section-gap) / 2);
- }
-
- i {
- top: calc(50% - 25px);
- left: -26px;
- position: absolute;
- border: 1px solid var(--color-border);
- background: var(--color-background);
- border-radius: 8px;
- width: 50px;
- height: 50px;
- }
-
- .item:before {
- content: ' ';
- border-left: 1px solid var(--color-border);
- position: absolute;
- left: 0;
- bottom: calc(50% + 25px);
- height: calc(50% - 25px);
- }
-
- .item:after {
- content: ' ';
- border-left: 1px solid var(--color-border);
- position: absolute;
- left: 0;
- top: calc(50% + 25px);
- height: calc(50% - 25px);
- }
-
- .item:first-of-type:before {
- display: none;
- }
-
- .item:last-of-type:after {
- display: none;
- }
-}
-</style>
diff --git a/site/src/router/index.ts b/site/src/router/index.ts
index 5b90a51..38c65fd 100644
--- a/site/src/router/index.ts
+++ b/site/src/router/index.ts
@@ -4,7 +4,7 @@ import { createRouter, createWebHistory } from 'vue-router'
const routes = [
{
path: '/',
- component: () => import('@/views/Welcome.vue'),
+ component: () => import('@/views/index/index.vue'),
},
{
path: '/:path(.*)',
diff --git a/site/src/views/Home.vue b/site/src/views/Home.vue
deleted file mode 100644
index f07e0c8..0000000
--- a/site/src/views/Home.vue
+++ /dev/null
@@ -1,7 +0,0 @@
-<template>
- <HelloWorld />
-</template>
-
-<script lang="ts" setup>
- import HelloWorld from '@/components/Left.vue'
-</script>
diff --git a/site/src/components/Left.vue b/site/src/views/index/Left.vue
index 672ba36..f774223 100644
--- a/site/src/components/Left.vue
+++ b/site/src/views/index/Left.vue
@@ -44,7 +44,7 @@ export default {
<div class="greetings">
<h1 class="green">{{ msg }}</h1>
<h3>
- 距离水系公测还有
+ 距离水系公测计划:
</h3>
<h2>
{{ day }} 天 {{ hour }} 时 {{ min }} 分 {{ sec }} 秒
@@ -72,7 +72,7 @@ h3 {
text-align: center;
}
-@media (min-width: 1024px) {
+@media screen and (orientation:landscape) {
.greetings h1,
.greetings h2 {
text-align: left;
diff --git a/site/src/views/index/Notepad/changelog.ts b/site/src/views/index/Notepad/changelog.ts
new file mode 100644
index 0000000..111f8f2
--- /dev/null
+++ b/site/src/views/index/Notepad/changelog.ts
@@ -0,0 +1,16 @@
+import axios from 'axios';
+
+export const getChangeLog = async() =>
+{
+ const changeLog = axios.get('https://api.github.com/repos/HydroRoll-Team/HydroRoll/releases/latest')
+ .then(res => {
+ console.log(res.data);
+ const ChangeLogMessage ="## "+ res.data['tag_name']+"\n"+res.data['body'];
+ return ChangeLogMessage;
+ })
+ .catch(err => {
+ console.log(err);
+ return err.toString();
+ })
+ return changeLog;
+}
diff --git a/site/src/views/index/Notepad/index.vue b/site/src/views/index/Notepad/index.vue
new file mode 100644
index 0000000..c4c82aa
--- /dev/null
+++ b/site/src/views/index/Notepad/index.vue
@@ -0,0 +1,45 @@
+<script lang="ts">
+export default {
+ props: {
+ title: {
+ type: String,
+ default: "1",
+ },
+ message: {
+ type: String,
+ require: true
+ },
+ date: {
+ type: Date,
+ default: new Date('2024-07-14T12:00:00Z')
+ }
+ },
+}
+</script>
+
+
+<template>
+ <div class="details" style="overflow-y:scroll;overflow-x:hidden;height:100%">
+ <h3>
+ {{ title }}
+ </h3>
+ <v-md-preview :text="message" ></v-md-preview>
+ </div>
+</template>
+
+
+<style scoped>
+
+
+h3 {
+ font-size: 1.2rem;
+ font-weight: 500;
+ margin-bottom: 0.4rem;
+ color: var(--color-heading);
+}
+
+.details {
+ flex: 1;
+ width: 30dvw;
+}
+</style>
diff --git a/site/src/views/index/Right.vue b/site/src/views/index/Right.vue
new file mode 100644
index 0000000..e0a70e1
--- /dev/null
+++ b/site/src/views/index/Right.vue
@@ -0,0 +1,160 @@
+<script lang="ts">
+import Notepad from './Notepad/index.vue'
+import DocumentationIcon from '@/components/icons/IconDocumentation.vue'
+import { getChangeLog } from './Notepad/changelog'
+
+
+export default {
+ data() {
+ return {
+ mainPage: 0,
+ tooltip: [
+ "ChangeLog",
+ "What's new?",
+ "敬请期待",
+ "敬请期待",
+ ],
+ title: "",
+ message:"",
+ changeLogMessage:"",
+ }
+ },
+ components: {
+ Notepad,
+ DocumentationIcon
+ },
+ methods: {
+ change_page(n: number) {
+ this.mainPage = n;
+ this.title = this.tooltip[n];
+ switch (n) {
+ case 0:
+ this.message = this.changeLogMessage;
+ break;
+ default:
+ this.message = "敬请期待";
+ break;
+ }
+ },
+ getBgColor(index: number) {
+ if (index < this.mainPage) {
+ return "var(--color-border)"
+ } else if (index == this.mainPage) {
+ return "var(--icon-highlight)"
+ } else {
+ return "var(--color-border-hover)"
+ }
+ }
+ },
+ beforeCreate() {
+ getChangeLog().then(res => {
+ this.changeLogMessage = res;
+ this.change_page(this.mainPage);
+ })
+ },
+}
+
+</script>
+
+<template>
+ <div class="messageBar">
+ <div class="options">
+ <li v-for="(item, index) in tooltip" :key="index" class="item">
+ <el-tooltip :content="item" placement="left" >
+ <i :style="{background:getBgColor(index)}" @mouseover="change_page(index)">
+ <DocumentationIcon/>
+ </i>
+ </el-tooltip>
+ </li>
+ </div>
+ <div class="messageBox">
+ <Notepad :title="title" :message="message"/>
+ </div>
+ </div>
+</template>
+
+<style lang="scss">
+
+.messageBar {
+ display: flex;
+ height: 600px;
+ margin-top: 2rem;
+ position: relative;
+ flex-direction: row;
+}
+
+.messageBar .options{
+ display: flex;
+ flex-direction: column;
+ flex-grow: 1;
+ width: 32px;
+ color: var(--color-text);
+}
+
+.messageBar .options .item{
+ display: flex;
+ margin: auto;
+}
+
+.messageBar .messageBox {
+ height: 100%;
+ width: 100%;
+ overflow-y: auto;
+ overflow-x: hidden;
+}
+
+i {
+ display: flex;
+ align-items: center;
+ justify-content: center;
+ font-size: 1.2rem;
+ color: var(--color-text);
+ width: 32px;
+ height: 32px;
+ border-radius: 8px;
+}
+
+@media screen and (orientation:landscape) {
+ .messageBar {
+ margin-top: 0;
+ padding: 5rem 0 5rem calc(var(--section-gap) / 2);
+ }
+
+ i {
+ left: -26px;
+ position: absolute;
+ border-radius: 8px;
+ width: 50px;
+ height: 50px;
+ }
+
+ // 黑线
+ .messageBar:before {
+ content: ' ';
+ border-left: 1px solid var(--color-border);
+ position: absolute;
+ left: 0;
+ bottom: calc(50% + 25px);
+ height: calc(50% - 25px);
+ }
+
+ // 画白线
+ .messageBar:after {
+ content: ' ';
+ border-left: 1px solid var(--vt-c-divider-light-2);
+ position: absolute;
+ left: 0;
+ top: calc(15%);
+ height: calc(75%);
+ z-index: -10;
+ }
+
+ .messageBar:first-of-type:before {
+ display: none;
+ }
+
+ .item:last-of-type:after {
+ display: none;
+ }
+}
+</style>
diff --git a/site/src/views/Welcome.vue b/site/src/views/index/index.vue
index 4a608ee..ed34b4f 100644
--- a/site/src/views/Welcome.vue
+++ b/site/src/views/index/index.vue
@@ -1,6 +1,6 @@
<script setup lang="ts">
-import Left from '@/components/Left.vue'
-import TheWelcome from '@/components/Right.vue'
+import Left from './Left.vue'
+import Right from './Right.vue'
</script>
<template>
@@ -12,13 +12,14 @@ import TheWelcome from '@/components/Right.vue'
</div>
</header>
- <main>
- <TheWelcome />
+ <main class="main">
+ <Right />
</main>
</template>
<style scoped>
header {
+ display: flex;
line-height: 1.5;
}
@@ -27,9 +28,8 @@ header {
margin: 0 auto 2rem;
}
-@media (min-width: 1024px) {
+@media screen and (orientation:landscape) {
header {
- display: flex;
place-items: center;
padding-right: calc(var(--section-gap) / 2);
}