make some part of page as component

pangu
PeterAlbus 3 years ago
parent 32ec1cf57e
commit 56f1eac7c8

2
components.d.ts vendored

@ -22,6 +22,8 @@ declare module 'vue' {
ElTooltip: typeof import('element-plus/es')['ElTooltip'] ElTooltip: typeof import('element-plus/es')['ElTooltip']
ElUpload: typeof import('element-plus/es')['ElUpload'] ElUpload: typeof import('element-plus/es')['ElUpload']
Footer: typeof import('./src/components/Footer.vue')['default'] Footer: typeof import('./src/components/Footer.vue')['default']
FriendLinks: typeof import('./src/components/FriendLinks.vue')['default']
PersonalInfo: typeof import('./src/components/PersonalInfo.vue')['default']
TopNavBar: typeof import('./src/components/TopNavBar.vue')['default'] TopNavBar: typeof import('./src/components/TopNavBar.vue')['default']
} }
} }

@ -145,7 +145,7 @@ a {
*::-webkit-scrollbar { *::-webkit-scrollbar {
/*滚动条整体样式*/ /*滚动条整体样式*/
width : 10px; /*高宽分别对应横竖滚动条的尺寸*/ width : 3px; /*高宽分别对应横竖滚动条的尺寸*/
height: 1px; height: 1px;
} }
*::-webkit-scrollbar-thumb { *::-webkit-scrollbar-thumb {

@ -0,0 +1,37 @@
<template>
<div class="module">
<h2 class="title"><el-icon style="vertical-align: -10%"><link-icon /></el-icon></h2>
<div class="content paragraph">
<p v-for="item in friendLinkList"><a :href="item.linkUrl" target="_blank">{{ item.linkName }}</a></p>
</div>
</div>
</template>
<script setup lang="ts">
import {Link as LinkIcon} from "@element-plus/icons-vue";
import {onMounted, ref} from "vue";
import axios from "axios";
let friendLinkList=ref([
{
linkId: 1,
linkName: 'loading',
linkUrl: '#'
}
])
const getFriendLinkList=function () {
axios.get('friendLink/getFriendLinkList')
.then(res => {
friendLinkList.value = res.data;
})
}
onMounted(()=>{
getFriendLinkList()
})
</script>
<style scoped>
</style>

@ -0,0 +1,43 @@
<template>
<div class="module">
<div class="content paragraph">
<el-avatar :size="50" src="/assets/2.png"></el-avatar>
<h4>PeterAlbus</h4>
<p v-if="info!==''">{{ info }}</p>
<el-tooltip class="item" effect="dark" content="发送电子邮件" placement="top">
<a href="mailto:wuhongdb@163.com">
<i class="fa fa-fw fa-envelope" style="font-size:20px"></i>
</a>
</el-tooltip>
<el-tooltip class="item" effect="dark" content="github" placement="top">
<a href="https://github.com/PeterAlbus" target="_blank">
<i class="fa fa-fw fa-github" style="font-size:20px"></i>
</a>
</el-tooltip>
<el-tooltip class="item" effect="dark" content="bilibili" placement="top">
<a href="https://space.bilibili.com/2003822" target="_blank">
<i class="iconfont icon-bilibili-line" style="font-size:20px"></i>
</a>
</el-tooltip>
</div>
</div>
</template>
<script setup lang="ts">
import {toRefs} from "vue";
const props = defineProps({
info: {
type: String,
default() {
return ''
},
},
});
const {info} = toRefs(props);
</script>
<style scoped>
</style>

@ -17,7 +17,7 @@ const routes: Array<RouteRecordRaw> = [
meta:{ meta:{
title:'主页——PeterAlbus的博客', title:'主页——PeterAlbus的博客',
content:{ content:{
keywords:'PeterAlbus,Vue', keywords:'PeterAlbus,Vue,个人博客',
description:'PeterAlbus的博客主页' description:'PeterAlbus的博客主页'
} }
} }
@ -113,7 +113,7 @@ const routes: Array<RouteRecordRaw> = [
meta:{ meta:{
title:'添加友情链接——PeterAlbus的博客', title:'添加友情链接——PeterAlbus的博客',
content:{ content:{
keywords:'PeterAlbus,Vue', keywords:'PeterAlbus,Vue,个人博客',
description:'PeterAlbus的博客' description:'PeterAlbus的博客'
} }
} }
@ -125,18 +125,18 @@ const router = createRouter({
routes routes
}) })
// router.beforeEach((to, from, next)=>{ router.beforeEach((to, from, next)=>{
// if(to.meta.content) { if(to.meta.content) {
// // @ts-ignore // @ts-ignore
// document.querySelector('meta[name="keywords"]').setAttribute('content',to.meta.content.keywords) document.querySelector('meta[name="keywords"]').setAttribute('content',to.meta.content.keywords)
// // @ts-ignore // @ts-ignore
// document.querySelector('meta[name="description"]').setAttribute('content',to.meta.content.description) document.querySelector('meta[name="description"]').setAttribute('content',to.meta.content.description)
// } }
// if(to.meta.title) { if(to.meta.title) {
// // @ts-ignore // @ts-ignore
// document.title = to.meta.title document.title = to.meta.title
// } }
// next() next()
// }) })
export default router export default router

@ -20,34 +20,8 @@
</div> </div>
</el-col> </el-col>
<el-col :lg="{span:6}" :sm="9"> <el-col :lg="{span:6}" :sm="9">
<div class="module"> <PersonalInfo></PersonalInfo>
<div class="content paragraph"> <FriendLinks></FriendLinks>
<el-avatar :size="50" src="/assets/2.png"></el-avatar>
<h4>PeterAlbus</h4>
<el-tooltip class="item" effect="dark" content="发送电子邮件" placement="top">
<a href="mailto:wuhongdb@163.com">
<i class="fa fa-fw fa-envelope" style="font-size:20px"></i>
</a>
</el-tooltip>
<el-tooltip class="item" effect="dark" content="github" placement="top">
<a href="https://github.com/PeterAlbus" target="_blank">
<i class="fa fa-fw fa-github" style="font-size:20px"></i>
</a>
</el-tooltip>
<el-tooltip class="item" effect="dark" content="bilibili" placement="top">
<a href="https://space.bilibili.com/2003822" target="_blank">
<i class="iconfont icon-bilibili-line" style="font-size:20px"></i>
</a>
</el-tooltip>
</div>
</div>
<div class="module">
<h2 class="title"><el-icon style="vertical-align: -10%"><link-icon /></el-icon></h2>
<div class="content paragraph">
<p v-for="item in friendLinkList"><a :href="item.linkUrl" target="_blank">{{ item.linkName }}</a></p>
</div>
</div>
</el-col> </el-col>
</el-row> </el-row>
</div> </div>
@ -55,8 +29,10 @@
<script> <script>
import {Link} from "@element-plus/icons-vue"; import {Link} from "@element-plus/icons-vue";
import FriendLinks from "@/components/FriendLinks.vue"
import PersonalInfo from "@/components/PersonalInfo.vue"
export default { export default {
components:{LinkIcon:Link}, components:{LinkIcon:Link,PersonalInfo,FriendLinks},
name: "About", name: "About",
data(){ data(){
return{ return{

@ -18,29 +18,9 @@
</div> </div>
</el-col> </el-col>
<el-col :lg="{span:6}" :sm="9"> <el-col :lg="{span:6}" :sm="9">
<div class="module"> <PersonalInfo></PersonalInfo>
<div class="content paragraph">
<el-avatar :size="50" src="/assets/2.png"></el-avatar>
<h4>PeterAlbus</h4>
<el-tooltip class="item" effect="dark" content="发送电子邮件" placement="top">
<a href="mailto:wuhongdb@163.com">
<i class="fa fa-fw fa-envelope" style="font-size:20px"></i>
</a>
</el-tooltip>
<el-tooltip class="item" effect="dark" content="github" placement="top">
<a href="https://github.com/PeterAlbus" target="_blank">
<i class="fa fa-fw fa-github" style="font-size:20px"></i>
</a>
</el-tooltip>
<el-tooltip class="item" effect="dark" content="bilibili" placement="top">
<a href="https://space.bilibili.com/2003822" target="_blank">
<i class="iconfont icon-bilibili-line" style="font-size:20px"></i>
</a>
</el-tooltip>
</div>
</div>
<div class="sticky-box"> <div class="sticky-box">
<div class="module anchors" :class="{'hide-small-screen':hideCatalogue}"> <div class="module anchors" :class="{'hide-small-screen':hideCatalogue}" v-if="titleList.length!==0">
<h2 class="title"><el-icon style="vertical-align: -10%"><notebook /></el-icon></h2> <h2 class="title"><el-icon style="vertical-align: -10%"><notebook /></el-icon></h2>
<div class="content" style="padding: 10px"> <div class="content" style="padding: 10px">
<el-scrollbar max-height="30vh"> <el-scrollbar max-height="30vh">
@ -74,7 +54,7 @@
</el-row> </el-row>
</div> </div>
<div class="fixed-buttons hide-big-screen"> <div class="fixed-buttons hide-big-screen">
<el-button type="success" :icon="Notebook" circle @click="hideCatalogue=!hideCatalogue" /> <el-button type="success" :icon="Notebook" circle @click="hideCatalogue=!hideCatalogue" v-if="titleList.length!==0"/>
</div> </div>
</template> </template>
@ -84,6 +64,7 @@ import {useRoute} from "vue-router";
import {ArrowRight,Notebook,Share as shareIcon} from "@element-plus/icons-vue"; import {ArrowRight,Notebook,Share as shareIcon} from "@element-plus/icons-vue";
import axios from "axios"; import axios from "axios";
import qs from "qs"; import qs from "qs";
import PersonalInfo from '@/components/PersonalInfo.vue'
import type {vMdEditor} from "@kangc/v-md-editor" import type {vMdEditor} from "@kangc/v-md-editor"
const route=useRoute() const route=useRoute()
@ -229,6 +210,7 @@ onMounted(()=>{
.anchor:hover{ .anchor:hover{
transform: translateX(+5px); transform: translateX(+5px);
background-color: #f1f1f1;
} }
.fixed-buttons{ .fixed-buttons{

@ -85,34 +85,8 @@
</el-col> </el-col>
<el-col :lg="{span:6}" :sm="9"> <el-col :lg="{span:6}" :sm="9">
<div class="sticky-box"> <div class="sticky-box">
<div class="module"> <PersonalInfo></PersonalInfo>
<div class="content paragraph"> <FriendLinks></FriendLinks>
<el-avatar :size="50" src="/assets/2.png"></el-avatar>
<h4>PeterAlbus</h4>
<el-tooltip class="item" effect="dark" content="发送电子邮件" placement="top">
<a href="mailto:wuhongdb@163.com">
<i class="fa fa-fw fa-envelope" style="font-size:20px"></i>
</a>
</el-tooltip>
<el-tooltip class="item" effect="dark" content="github" placement="top">
<a href="https://github.com/PeterAlbus" target="_blank">
<i class="fa fa-fw fa-github" style="font-size:20px"></i>
</a>
</el-tooltip>
<el-tooltip class="item" effect="dark" content="bilibili" placement="top">
<a href="https://space.bilibili.com/2003822" target="_blank">
<i class="iconfont icon-bilibili-line" style="font-size:20px"></i>
</a>
</el-tooltip>
</div>
</div>
<div class="module">
<h2 class="title"><el-icon style="vertical-align: -10%"><link-icon /></el-icon></h2>
<div class="content paragraph">
<p v-for="item in friendLinkList"><a :href="item.linkUrl" target="_blank">{{ item.linkName }}</a></p>
</div>
</div>
</div> </div>
</el-col> </el-col>
</el-row> </el-row>
@ -120,10 +94,12 @@
<script setup lang="ts"> <script setup lang="ts">
import {computed, onMounted, ref} from "vue"; import {computed, onMounted, ref} from "vue";
import {Avatar,StarFilled,Clock,Link as LinkIcon} from "@element-plus/icons-vue"; import {Avatar,StarFilled,Clock} from "@element-plus/icons-vue";
import { toClipboard } from '@soerenmartius/vue3-clipboard' import { toClipboard } from '@soerenmartius/vue3-clipboard'
import axios from "axios"; import axios from "axios";
import {ElMessage} from "element-plus"; import {ElMessage} from "element-plus";
import FriendLinks from "@/components/FriendLinks.vue"
import PersonalInfo from "@/components/PersonalInfo.vue"
let blogList = ref([ let blogList = ref([
{ {
@ -141,14 +117,6 @@ let blogList = ref([
} }
]) ])
let friendLinkList=ref([
{
linkId: 1,
linkName: 'loading',
linkUrl: '#'
}
])
let famousQuotes= ref({ let famousQuotes= ref({
id: 0, id: 0,
uuid: "", uuid: "",
@ -184,7 +152,10 @@ const copyQuotes=()=>{
let backgrounds=[ let backgrounds=[
'https://file.peteralbus.com/assets/blog/static/background/background-lumine.jpg', 'https://file.peteralbus.com/assets/blog/static/background/background-lumine.jpg',
'https://file.peteralbus.com/assets/blog/static/background/background-kazuha.jpg', 'https://file.peteralbus.com/assets/blog/static/background/background-kazuha.jpg',
'https://file.peteralbus.com/assets/blog/static/background/background-blueeyes.jpg' 'https://file.peteralbus.com/assets/blog/static/background/background-blueeyes.jpg',
'https://file.peteralbus.com/assets/blog/static/background/background-girl1.jpg',
'https://file.peteralbus.com/assets/blog/static/background/background-mountain1.jpg',
'https://file.peteralbus.com/assets/blog/static/background/background-nogamenolife.jpg',
] ]
let randomIndex=Math.floor(Math.random()*backgrounds.length) let randomIndex=Math.floor(Math.random()*backgrounds.length)
@ -196,16 +167,8 @@ const getBlogList=function () {
}) })
} }
const getFriendLinkList=function () {
axios.get('friendLink/getFriendLinkList')
.then(res => {
friendLinkList.value = res.data;
})
}
onMounted(()=>{ onMounted(()=>{
getBlogList() getBlogList()
getFriendLinkList()
getQuotes() getQuotes()
}) })

@ -10,6 +10,7 @@
<div class="main-container"> <div class="main-container">
<el-row> <el-row>
<el-col :lg="{span:11,offset:3}" :sm="15"> <el-col :lg="{span:11,offset:3}" :sm="15">
<div style="margin: 0 auto;width: 90%;">
<el-row> <el-row>
<el-col :span="7"> <el-col :span="7">
<el-card class="photo" v-for="item in photoLeft" shadow="hover" :body-style="{ padding: '0px' }"> <el-card class="photo" v-for="item in photoLeft" shadow="hover" :body-style="{ padding: '0px' }">
@ -54,37 +55,12 @@
</el-card> </el-card>
</el-col> </el-col>
</el-row> </el-row>
</div>
</el-col> </el-col>
<el-col :lg="{span:6}" :sm="9"> <el-col :lg="{span:6}" :sm="9">
<div class="sticky-box"> <div class="sticky-box">
<div class="module"> <PersonalInfo info="若有侵权,深表歉意。可联系删除"></PersonalInfo>
<div class="content paragraph"> <FriendLinks></FriendLinks>
<el-avatar :size="50" src="/assets/2.png"></el-avatar>
<h4>PeterAlbus</h4>
<p>若有侵权深表歉意可联系删除</p>
<el-tooltip class="item" effect="dark" content="发送电子邮件" placement="top">
<a href="mailto:wuhongdb@163.com">
<i class="fa fa-fw fa-envelope" style="font-size:20px"></i>
</a>
</el-tooltip>
<el-tooltip class="item" effect="dark" content="github" placement="top">
<a href="https://github.com/PeterAlbus" target="_blank">
<i class="fa fa-fw fa-github" style="font-size:20px"></i>
</a>
</el-tooltip>
<el-tooltip class="item" effect="dark" content="bilibili" placement="top">
<a href="https://space.bilibili.com/2003822" target="_blank">
<i class="iconfont icon-bilibili-line" style="font-size:20px"></i>
</a>
</el-tooltip>
</div>
</div>
<div class="module">
<h2 class="title"><el-icon style="vertical-align: -10%"><link-icon /></el-icon></h2>
<div class="content paragraph">
<p v-for="item in friendLinkList"><a :href="item.linkUrl" target="_blank">{{ item.linkName }}</a></p>
</div>
</div>
</div> </div>
</el-col> </el-col>
</el-row> </el-row>
@ -93,8 +69,10 @@
<script> <script>
import {Link} from "@element-plus/icons-vue"; import {Link} from "@element-plus/icons-vue";
import FriendLinks from "@/components/FriendLinks.vue"
import PersonalInfo from "@/components/PersonalInfo.vue"
export default { export default {
components:{LinkIcon:Link}, components:{LinkIcon:Link,FriendLinks,PersonalInfo},
name: "Photo", name: "Photo",
data(){ data(){
return { return {

@ -70,33 +70,8 @@
</el-col> </el-col>
<el-col :lg="{span:6}" :sm="9"> <el-col :lg="{span:6}" :sm="9">
<div class="sticky-box"> <div class="sticky-box">
<div class="module"> <PersonalInfo></PersonalInfo>
<div class="content paragraph"> <FriendLinks></FriendLinks>
<el-avatar :size="50" src="/assets/2.png"></el-avatar>
<h4>PeterAlbus</h4>
<el-tooltip class="item" effect="dark" content="发送电子邮件" placement="top">
<a href="mailto:wuhongdb@163.com">
<i class="fa fa-fw fa-envelope" style="font-size:20px"></i>
</a>
</el-tooltip>
<el-tooltip class="item" effect="dark" content="github" placement="top">
<a href="https://github.com/PeterAlbus" target="_blank">
<i class="fa fa-fw fa-github" style="font-size:20px"></i>
</a>
</el-tooltip>
<el-tooltip class="item" effect="dark" content="bilibili" placement="top">
<a href="https://space.bilibili.com/2003822" target="_blank">
<i class="iconfont icon-bilibili-line" style="font-size:20px"></i>
</a>
</el-tooltip>
</div>
</div>
<div class="module">
<h2 class="title"><el-icon style="vertical-align: -10%"><link-icon /></el-icon></h2>
<div class="content paragraph">
<p v-for="item in friendLinkList"><a :href="item.linkUrl" target="_blank">{{ item.linkName }}</a></p>
</div>
</div>
</div> </div>
</el-col> </el-col>
</el-row> </el-row>
@ -104,8 +79,10 @@
<script> <script>
import {Avatar,StarFilled,Clock,Link} from "@element-plus/icons-vue"; import {Avatar,StarFilled,Clock,Link} from "@element-plus/icons-vue";
import FriendLinks from "@/components/FriendLinks.vue"
import PersonalInfo from "@/components/PersonalInfo.vue"
export default { export default {
components:{Avatar,StarFilled,Clock,LinkIcon:Link}, components:{Avatar,StarFilled,Clock,LinkIcon:Link,FriendLinks,PersonalInfo},
name: "Types", name: "Types",
data(){ data(){
return { return {

@ -78,15 +78,15 @@ const onFileChange = (file: UploadFile, fileList: UploadFile[])=>{
const beforeAvatarUpload = (file: UploadRawFile) => { const beforeAvatarUpload = (file: UploadRawFile) => {
const isIMG = file.type === 'image/jpeg'||file.type === 'image/png'||file.type === 'image/gif' const isIMG = file.type === 'image/jpeg'||file.type === 'image/png'||file.type === 'image/gif'
const isLt2M = file.size / 1024 / 1024 < 2 const isLt10M = file.size / 1024 / 1024 < 10
if (!isIMG) { if (!isIMG) {
ElMessage.error('选择的文件不是图片!') ElMessage.error('选择的文件不是图片!')
} }
if (!isLt2M) { if (!isLt10M) {
ElMessage.error('图片大小不能超过2M') ElMessage.error('图片大小不能超过10M')
} }
return isIMG && isLt2M return isIMG && isLt10M
} }
const upData=computed(()=>{ const upData=computed(()=>{

Loading…
Cancel
Save