mirror of
https://github.com/LiteyukiStudio/LiteyukiBot.git
synced 2024-11-11 06:27:23 +08:00
📝 新增全球统计
This commit is contained in:
parent
6ba983fae3
commit
850dd75822
@ -1,11 +1,16 @@
|
||||
import {defineClientConfig} from "vuepress/client";
|
||||
|
||||
import resourceStoreComp from "./components/ResStore.vue";
|
||||
import pluginStoreComp from "./components/PluginStore.vue";
|
||||
//导入element-plus
|
||||
import dashComp from "./components/Dash.vue";
|
||||
|
||||
|
||||
import ElementPlus from 'element-plus';
|
||||
|
||||
|
||||
export default defineClientConfig({
|
||||
enhance: ({app, router, siteData}) => {
|
||||
app.component("dashComp", dashComp);
|
||||
app.component("resourceStoreComp", resourceStoreComp);
|
||||
app.component("pluginStoreComp", pluginStoreComp);
|
||||
app.use(ElementPlus);
|
||||
|
38
docs/.vuepress/components/Dash.vue
Normal file
38
docs/.vuepress/components/Dash.vue
Normal file
@ -0,0 +1,38 @@
|
||||
<script setup lang="ts">
|
||||
import {ref} from "vue";
|
||||
|
||||
let total = ref(0);
|
||||
let online = ref(0);
|
||||
fetch("https://api.liteyuki.icu/count")
|
||||
.then(res => res.json())
|
||||
.then(data => {
|
||||
total.value = data.register;
|
||||
})
|
||||
.catch(err => console.error(err));
|
||||
fetch("https://api.liteyuki.icu/online")
|
||||
.then(res => res.json())
|
||||
.then(data => {
|
||||
online.value = data.online;
|
||||
})
|
||||
.catch(err => console.error(err));
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div class="info-box">
|
||||
<h1>Dashboard</h1>
|
||||
<div class="info">
|
||||
<div class="info-item">
|
||||
<h2>Total</h2>
|
||||
<p>{{ total }}</p>
|
||||
</div>
|
||||
<div class="info-item">
|
||||
<h2>Online</h2>
|
||||
<p>{{ online }}</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<style scoped>
|
||||
|
||||
</style>
|
@ -11,6 +11,7 @@ export default defineUserConfig({
|
||||
head: [
|
||||
// 设置 favor.ico,.vuepress/public 下
|
||||
["script", {src: "/js/style.js", "type": "module"}],
|
||||
["script", {src: "/js/get_data.js", "type": "module"}],
|
||||
['link', {rel: 'icon', href: 'https://cdn.liteyuki.icu/favicon.ico'},],
|
||||
|
||||
['link', {rel: 'stylesheet', href: 'https://cdn.bootcdn.net/ajax/libs/firacode/6.2.0/fira_code.min.css'}],
|
||||
|
1
docs/.vuepress/public/js/get_data.js
Normal file
1
docs/.vuepress/public/js/get_data.js
Normal file
@ -0,0 +1 @@
|
||||
|
@ -1,10 +1,15 @@
|
||||
function applyStyle() {
|
||||
// 先检测页面中是否有macos-tab,有则不再添加
|
||||
let tabs = document.body.querySelectorAll('.macos-tab')
|
||||
if (tabs.length > 0) {
|
||||
return
|
||||
}
|
||||
let lineNumbers = document.body.querySelectorAll('[class^="language-"].line-numbers-mode')
|
||||
lineNumbers.forEach((item) => {
|
||||
// 插入现成的html文本
|
||||
let title = item.getAttribute('data-title')
|
||||
let tabStr =
|
||||
"<div class='tab' style='display: flex; background-color: #d0e9ff'>" +
|
||||
"<div class='tab macos-tab' style='display: flex; background-color: #d0e9ff'>" +
|
||||
" <div class='tab-buttons'>" +
|
||||
" <div class='tab-button' style='background-color: #FF5F57'></div>" +
|
||||
" <div class='tab-button' style='background-color: #FFBD2E'></div>" +
|
||||
@ -19,4 +24,8 @@ function applyStyle() {
|
||||
}
|
||||
|
||||
|
||||
applyStyle()
|
||||
applyStyle()
|
||||
// 定时器,每隔1s检查一次
|
||||
setInterval(() => {
|
||||
applyStyle()
|
||||
}, 1000)
|
@ -9,7 +9,7 @@ bgImageDark:
|
||||
bgImageStyle:
|
||||
background-attachment: fixed
|
||||
heroText: LiteyukiBot
|
||||
tagline: LiteyukiBot 轻雪机器人,基于NoneBot2构建的综合应用型聊天机器人
|
||||
tagline: LiteyukiBot 轻雪机器人,基于NoneBot2构建的综合应用型聊天机器人<br><h4>总实例:<span id="total">0</span> 当前在线:<span id="online">0</span></h4>
|
||||
|
||||
actions:
|
||||
- text: 快速部署
|
||||
@ -79,4 +79,32 @@ highlights:
|
||||
details: 如果你有多个 Python 环境,请使用 <code>pythonx -m pip install -r requirements.txt</code>。
|
||||
- title: 使用 <code>python main.py</code> 启动项目。
|
||||
copyright: © 2021-2024 SnowyKami All Rights Reserved
|
||||
|
||||
---
|
||||
<script>
|
||||
function updatePageData() {
|
||||
fetch("https://api.liteyuki.icu/count")
|
||||
.then(res => res.json())
|
||||
.then(data => {
|
||||
let total = document.getElementById("total");
|
||||
if(total !== null) {
|
||||
total.innerText = data.register;
|
||||
}
|
||||
})
|
||||
.catch(err => console.error(err));
|
||||
|
||||
fetch("https://api.liteyuki.icu/online")
|
||||
.then(res => res.json())
|
||||
.then(data => {
|
||||
let online = document.getElementById("online");
|
||||
if(online !== null) {
|
||||
online.innerText = data.online;
|
||||
}
|
||||
})
|
||||
.catch(err => console.error(err));
|
||||
}
|
||||
|
||||
updatePageData();
|
||||
|
||||
setInterval(updatePageData, 1000);
|
||||
</script>
|
@ -4,4 +4,5 @@ icon: box
|
||||
order: 1
|
||||
category: 使用手册
|
||||
---
|
||||
<resourceStoreComp />
|
||||
|
||||
<resourceStoreComp />
|
||||
|
Loading…
Reference in New Issue
Block a user