-
![avatar]()
+
-
{{ customCard.name }}
-
@@ -24,35 +23,29 @@ const customCard = ref(new CustomCard())
.card {
display: flex;
flex-direction: column;
- text-align: center;
+ justify-content: center;
align-items: center;
+ text-align: center;
+ height: 100%;
+ width: 100%;
box-sizing: border-box;
-
- .avatar {
- width: 50%;
- img {
- border-radius: 50%;
- }
- }
-
- .name {
- width: 50%;
- }
-
- .content {
- width: 100%;
- }
}
-@media screen and (max-width: 800px) {
- .card {
- width: 160px;
- }
+.avatar {
+ display: flex;
+ justify-content: center;
+ align-items: center;
+ width: 100%;
}
-@media screen and (min-width: 800px) {
- .card {
- width: 200px;
- }
+.avatar img {
+ border-radius: 50%;
+}
+
+.name,
+.content {
+ white-space: nowrap;
+ overflow: hidden;
+ text-overflow: ellipsis;
}
diff --git a/src/components/images/avatar.jpg b/src/components/images/avatar.jpg
index db49813..806ed2e 100644
Binary files a/src/components/images/avatar.jpg and b/src/components/images/avatar.jpg differ
diff --git a/src/router/index.js b/src/router/index.js
index a49ae50..6bac95c 100644
--- a/src/router/index.js
+++ b/src/router/index.js
@@ -1,23 +1,42 @@
import { createRouter, createWebHistory } from 'vue-router'
import HomeView from '../views/HomeView.vue'
+const routes = [
+ {
+ path: '/',
+ name: 'home',
+ component: HomeView
+ },
+ {
+ path: '/about',
+ name: 'about',
+ component: () => import('../views/AboutView.vue')
+ },
+ {
+ path: '/login',
+ name: 'login',
+ component: () => import('../views/LoginView.vue'),
+ meta: {
+ requiresAuth: false
+ }
+ }
+]
+
const router = createRouter({
history: createWebHistory(import.meta.env.BASE_URL),
- routes: [
- {
- path: '/',
- name: 'home',
- component: HomeView
- },
- {
- path: '/about',
- name: 'about',
- // route level code-splitting
- // this generates a separate chunk (About.[hash].js) for this route
- // which is lazy-loaded when the route is visited.
- component: () => import('../views/AboutView.vue')
- }
- ]
+ routes: routes
+})
+
+router.beforeEach((to, from, next) => {
+ console.log('beforeEach', to, from)
+ const token = localStorage.getItem('token')
+ if (to.matched.some((record) => record.meta.requiresAuth === false)) {
+ next()
+ } else if (!token) {
+ next({ name: 'login' })
+ } else {
+ next()
+ }
})
export default router
diff --git a/src/views/HomeView.vue b/src/views/HomeView.vue
index 482f230..ca74252 100644
--- a/src/views/HomeView.vue
+++ b/src/views/HomeView.vue
@@ -3,68 +3,58 @@ const cardStyle = {
width: '200px'
}
-const moduleList_1 = [
- {
- title: 'Gitea',
- url: 'http://10.120.20.137:3000/'
- },
- {
- title: 'Pve',
- url: 'https://10.120.20.15:8006/'
+class Module {
+ /**
+ * 模块
+ * @param {string} title
+ * @param {string} url
+ */
+ constructor(title, url) {
+ this.title = title
+ this.url = url
}
-]
+}
-const moduleList_2 = [
- {
- title: 'zero tier',
- url: 'https://zerotier.yulinling.asia/'
- },
- {
- title: 'gitea',
- url: 'https://gitea.yulinling.asia/'
+class ManagerModule {
+ /**
+ * 模块管理
+ * @param {string} name
+ * @param {Module[]} moduleList
+ */
+ constructor(name, moduleList) {
+ this.name = name
+ this.moduleList = moduleList
}
+}
+
+const manageModuleList = [
+ new ManagerModule('Zero tier', [
+ new Module('Pve', 'https://10.18.80.15:8006/'),
+ new Module('fnOS', 'http://10.18.80.124:8000/')
+ ]),
+ new ManagerModule('云服务器', [
+ new Module('zero tier', 'https://zerotier.yulinling.asia/'),
+ new Module('gitea', 'https://gitea.yulinling.asia/')
+ ])
]
-
-
Zero tier
+
+
{{ item.name }}
-
-
-
-
- “{{ item.title }}”
-
- Get Start
+
+
+
+
+
+ “{{ module.title }}”
+
+ Get Start
+
-
-
-
-
-
-
aliyun
-
-
-
-
-
- “{{ item.title }}”
-
- Get Start
-
-
-
+
+
diff --git a/src/views/LoginView.vue b/src/views/LoginView.vue
new file mode 100644
index 0000000..fce119c
--- /dev/null
+++ b/src/views/LoginView.vue
@@ -0,0 +1,123 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Remember me
+
+
+
+ Submit
+
+
+
+
+
Welcome, you are logged in!
+
+
+
+
+
+