diff --git a/package.json b/package.json index 7432159..0331eb2 100644 --- a/package.json +++ b/package.json @@ -13,6 +13,7 @@ "dependencies": { "@ant-design/icons-vue": "^7.0.1", "ant-design-vue": "^4.2.5", + "js-cookie": "^3.0.5", "pinia": "^2.1.7", "vue": "^3.4.29", "vue-router": "^4.3.3" diff --git a/src/App.vue b/src/App.vue index 36a65c2..892235a 100644 --- a/src/App.vue +++ b/src/App.vue @@ -1,3 +1,36 @@ + + + + + + + + + + + + + + + + jjjj + + + -import CustomCard from '@/components/CustomCard.vue' - - - - - - - - - - - - - - - - - - \ No newline at end of file + \ No newline at end of file diff --git a/src/components/CustomCard.js b/src/components/CustomCard.js deleted file mode 100644 index 4e3e4ad..0000000 --- a/src/components/CustomCard.js +++ /dev/null @@ -1,7 +0,0 @@ -export class CustomCard { - constructor(avatar = 'src/components/images/avatar.jpg', name = '雨霖铃', content = '人生孤旅,天真以渡') { - this.avatar = avatar - this.name = name - this.content = content - } -} diff --git a/src/components/CustomCard.vue b/src/components/CustomCard.vue index 5c387f5..d9a3646 100644 --- a/src/components/CustomCard.vue +++ b/src/components/CustomCard.vue @@ -1,23 +1,31 @@ + - - - - - - - {{ customCard.name }} - - - - {{ customCard.content }} - - + + + + + + + + + + diff --git a/src/components/CustomTimestamp.vue b/src/components/CustomTimestamp.vue new file mode 100644 index 0000000..91c303f --- /dev/null +++ b/src/components/CustomTimestamp.vue @@ -0,0 +1,55 @@ + + + + + + + ms/毫秒 + s/秒 + + 转换 + + + + + 转换 + + ms/毫秒 + s/秒 + + + + + + diff --git a/src/router/index.js b/src/router/index.js index a49ae50..1897c4f 100644 --- a/src/router/index.js +++ b/src/router/index.js @@ -1,5 +1,9 @@ import { createRouter, createWebHistory } from 'vue-router' -import HomeView from '../views/HomeView.vue' +import HomeView from '@/views/HomeView.vue' +import AboutView from '@/views/AboutView.vue' +import ToolView from '@/views/ToolView.vue' +import LoginView from '@/views/LoginView.vue' +import NewsView from '@/views/NewsView.vue' const router = createRouter({ history: createWebHistory(import.meta.env.BASE_URL), @@ -12,10 +16,22 @@ const router = createRouter({ { 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') + component: AboutView + }, + { + path: '/tool', + name: 'tool', + component: ToolView + }, + { + path: '/login', + name: 'login', + component: LoginView + }, + { + path: '/news', + name: 'news', + component: NewsView } ] }) diff --git a/src/utils/time.js b/src/utils/time.js new file mode 100644 index 0000000..2617c48 --- /dev/null +++ b/src/utils/time.js @@ -0,0 +1,54 @@ +function timestampToDateTime(pattern, timestamp) { + if (pattern === 's') { + return new Date(timestamp * 1000) + } else if (pattern === 'ms') { + console.log(typeof timestamp) + console.log(timestamp) + return new Date(timestamp) + } + + return NaN +} + +function dateTimeToTimestamp(pattern, datetime) { + const timestamp = new Date(datetime).getTime() + if (pattern === 's') { + return Math.floor(timestamp / 1000).toString() + } else if (pattern === 'ms') { + return timestamp.toString() + } + return NaN.toString() +} + +Date.prototype.Format = function (fmt) { + var o = { + 'M+': this.getMonth() + 1, //月份 + 'd+': this.getDate(), //日 + 'h+': this.getHours(), //小时 + 'm+': this.getMinutes(), //分 + 's+': this.getSeconds(), //秒 + 'q+': Math.floor((this.getMonth() + 3) / 3), //季度 + S: this.getMilliseconds() //毫秒 + } + if (/(y+)/.test(fmt)) + fmt = fmt.replace(RegExp.$1, (this.getFullYear() + '').substr(4 - RegExp.$1.length)) + for (var k in o) + if (new RegExp('(' + k + ')').test(fmt)) + fmt = fmt.replace( + RegExp.$1, + RegExp.$1.length === 1 ? o[k] : ('00' + o[k]).substr(('' + o[k]).length) + ) + return fmt +} + +function formatDate(date) { + const year = date.getFullYear() + const month = date.getMonth() + 1 + const day = date.getDate() + const hour = date.getHours() + const minute = date.getMinutes() + const second = date.getSeconds() + return `${year}-${month}-${day}-${hour}:${minute}:${second}` +} + +export { timestampToDateTime, dateTimeToTimestamp, formatDate } diff --git a/src/views/AboutView.vue b/src/views/AboutView.vue index 4a7daf1..ac442a1 100644 --- a/src/views/AboutView.vue +++ b/src/views/AboutView.vue @@ -1,7 +1,15 @@ + This is an about page + router.push('/news')">Goto News + diff --git a/src/views/HomeView.vue b/src/views/HomeView.vue index 482f230..207e696 100644 --- a/src/views/HomeView.vue +++ b/src/views/HomeView.vue @@ -3,62 +3,59 @@ 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 moduleCard { + title + content + url -const moduleList_2 = [ + constructor(title, content, url) { + this.title = title + this.content = content + this.url = url + } + + introduceSelf() { + console.log(`title:${this.title}\ncontent:${this.content}\nurl:${this.url}`) + } +} + +const modules = [ { title: 'zero tier', - url: 'https://zerotier.yulinling.asia/' + content: [ + new moduleCard('gitea', '', 'http://10.120.20.137:3000/'), + new moduleCard('pve', '', 'http://10.120.20.15:8006/') + ] }, { - title: 'gitea', - url: 'https://gitea.yulinling.asia/' + title: '腾讯云服务', + content: [ + new moduleCard('zero tier', '', 'https://zerotier.yulinling.asia/'), + new moduleCard('gitea', '', 'https://gitea.yulinling.asia/') + ] } ] - - Zero tier + + {{ item.title }} - - - “{{ item.title }}” - - Get Start - - - - - - - aliyun - - - - - + + “{{ item.title }}” Get Start @@ -70,12 +67,18 @@ const moduleList_2 = [ diff --git a/src/views/LoginView.vue b/src/views/LoginView.vue new file mode 100644 index 0000000..16c0478 --- /dev/null +++ b/src/views/LoginView.vue @@ -0,0 +1,12 @@ + + + + + + + \ No newline at end of file diff --git a/src/views/NewsView.vue b/src/views/NewsView.vue new file mode 100644 index 0000000..e7d5478 --- /dev/null +++ b/src/views/NewsView.vue @@ -0,0 +1,9 @@ + + + + + + + diff --git a/src/views/ToolView.vue b/src/views/ToolView.vue new file mode 100644 index 0000000..53ec6df --- /dev/null +++ b/src/views/ToolView.vue @@ -0,0 +1,12 @@ + + + +this is tool view page + + + + \ No newline at end of file
{{ customCard.content }}