-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
130 additions
and
82 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,30 +1,27 @@ | ||
<template> | ||
<!-- <el-button class="my-10" type="primary" :loading-icon="Star" loading>在这没有意义, 去管理一下你的文章吧</el-button><br /> | ||
<el-button type="primary" @click="$router.push('/admin/ArticleList')">文章列表</el-button> | ||
<el-button type="primary" @click="$router.push('/admin/addArticle')">添加新文章</el-button> | ||
<el-button type="primary" @click="$router.push('/admin/CategoryManager')">分类管理</el-button> | ||
<el-button type="primary" @click="$router.push('/admin/TagManager')">标签管理</el-button> --> | ||
<!-- <el-image class="h-full" :src="imgUrl" fit="contain"></el-image> --> | ||
<!-- <div class="flex items-center justify-center w-3/4 h-3/4 bg-cover bg-center" | ||
:style="{ backgroundImage: `url(${imgUrl})` }"> | ||
</div> --> | ||
<div> | ||
|
||
<div class="h-full flex items-center justify-center text-2xl"> | ||
<div class="bg-gray-600 bg-opacity-40"> | ||
<p>{{ dailyQuote }}</p> | ||
</div> | ||
</div> | ||
</template> | ||
|
||
<script lang="ts" setup> | ||
// import { Star } from '@element-plus/icons-vue' | ||
import { onMounted, ref } from 'vue'; | ||
// 生成一个三位随机数, 从0到206, 不足的用0补齐 | ||
const random = ref(Math.floor(Math.random() * 206).toString().padStart(3, '0')); | ||
const imgUrl = ref(''); | ||
onMounted(() => { | ||
setInterval(() => { | ||
random.value = Math.floor(Math.random() * 200).toString().padStart(3, '0'); | ||
imgUrl.value = `/api/images/img-${random.value}.jpg` | ||
}, 2 * 1000) | ||
}) | ||
<script lang="ts"> | ||
import axios from 'axios'; | ||
export default { | ||
data() { | ||
return { | ||
dailyQuote: '', | ||
}; | ||
}, | ||
async created() { | ||
try { | ||
const response = await axios.get('https://v1.hitokoto.cn'); | ||
this.dailyQuote = response.data.hitokoto; | ||
} catch (error) { | ||
console.error('获取每日一言失败:', error); | ||
} | ||
}, | ||
}; | ||
</script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters