Compare commits

..

10 Commits

Author SHA1 Message Date
e1e795b5dc 新增热搜列表 2023-09-02 01:54:56 +08:00
91f56bd170 sh 2023-09-01 17:22:16 +08:00
9d5e3733a2 修改了查询所有的笔顺码seo 2023-09-01 16:52:32 +08:00
5418e0ddd5 自动杀掉占用端口程序 2023-08-30 16:18:16 +08:00
1659399f53 修改启动脚本 2023-08-30 16:12:19 +08:00
2d7d88891c 修改脚本bug 2023-08-30 16:07:02 +08:00
605fd531c1 让脚本更安全 2023-08-30 16:03:32 +08:00
50d0c797ef 启动脚本 2023-08-30 15:56:24 +08:00
b6776739c7 自动添加word.json文件 2023-08-30 15:48:01 +08:00
7d7bae9a77 更改word.json加载方式 2023-08-30 15:46:11 +08:00
7 changed files with 91 additions and 21 deletions

View File

@ -5,6 +5,9 @@ let route = useRoute()
// const handleSelect = (key: string, keyPath: string[]) => { // const handleSelect = (key: string, keyPath: string[]) => {
// console.log(key, keyPath) // console.log(key, keyPath)
// } // }
const HotArray = await $fetch("https://data.zziyu.cn/hot/webs")
// console.log(HotArray)
</script> </script>
<template> <template>
@ -21,8 +24,9 @@ let route = useRoute()
<el-sub-menu index="/data/all"> <el-sub-menu index="/data/all">
<template #title>数据收集</template> <template #title>数据收集</template>
<el-menu-item index="/data/all">总览</el-menu-item> <el-menu-item index="/data/all">总览</el-menu-item>
<el-menu-item index="/data/bilibili">bilibili</el-menu-item> <el-menu-item v-for="(item,index) in HotArray" :key="index" :index="'/data/'+item">{{item}}</el-menu-item>
<el-menu-item index="/data/baidu">baidu</el-menu-item> <!-- <el-menu-item index="/data/bilibili">bilibili</el-menu-item>-->
<!-- <el-menu-item index="/data/baidu">baidu</el-menu-item>-->
</el-sub-menu> </el-sub-menu>
<el-sub-menu index="/tools"> <el-sub-menu index="/tools">
<template #title>工具</template> <template #title>工具</template>

View File

@ -6,6 +6,7 @@ let {api} = await $fetch('/api/data/all')
</script> </script>
<template> <template>
<Title>热搜 {{route.params.WebName}} </Title>
这是 {{route.params.WebName}} 数据展示 这是 {{route.params.WebName}} 数据展示
</template> </template>

View File

@ -1,18 +1,19 @@
<script setup lang="ts"> <script setup lang="ts">
const HotArray = await $fetch("https://data.zziyu.cn/hot/webs")
</script> </script>
<template> <template>
<Title>网站地图</Title> <Title>网站地图</Title>
<div style="display: flex;justify-content: center;flex-direction: column;align-items: center"> <div style="display: flex;justify-content: center;flex-direction: column;align-items: center">
<NuxtLink to="/">主页</NuxtLink> <NuxtLink to="/">主页</NuxtLink>
<NuxtLink to="/data/all">数据收集</NuxtLink> <NuxtLink to="/data/all">数据收集所有</NuxtLink>
<NuxtLink to="/data/bilibili">数据收集Bilibili</NuxtLink> <!-- <NuxtLink to="/data/bilibili">数据收集Bilibili</NuxtLink>-->
<NuxtLink to="/data/baidu">数据收集百度</NuxtLink> <!-- <NuxtLink to="/data/baidu">数据收集百度</NuxtLink>-->
<NuxtLink v-for="(item,index) in HotArray" :to="'/data/'+item" :key="index">数据收集 {{item}}</NuxtLink>
<NuxtLink to="/">主页</NuxtLink> <NuxtLink to="/">主页</NuxtLink>
<NuxtLink to="/tools/qqazk/">笔顺码字典首页</NuxtLink> <NuxtLink to="/tools/qqazk/">笔顺码字典首页</NuxtLink>
<NuxtLink to="/tools/qqazk/about">笔顺码字典关于</NuxtLink> <NuxtLink to="/tools/qqazk/about">笔顺码字典关于</NuxtLink>
<NuxtLink to="/tools/qqazk/search?words=&method=bsmf">所有笔顺码</NuxtLink> <NuxtLink to="/map/qqazk">所有笔顺码</NuxtLink>
</div> </div>
</template> </template>

30
pages/map/qqazk.vue Normal file
View File

@ -0,0 +1,30 @@
<script setup lang="ts">
import {Action} from "element-plus";
const dataRaw = await $fetch(`/api/tools/qqazk/search?words=&method=hz`)
if (dataRaw.haveMess){
ElMessageBox.alert(dataRaw.message,"获取资源错误",{
confirmButtonText: '确认',
callback:(action:Action)=>{
}
})
}
let arr = dataRaw.data
// console.log(arr)
</script>
<template>
<Title>网站地图-所有笔顺码</Title>
<NuxtLink v-for="value in arr" :to="'/tools/qqazk/details/'+value.id">
{{value.hz}}
</NuxtLink>
</template>
<style scoped>
a {
margin: 10px;
}
</style>

View File

@ -1,4 +1,4 @@
import {readFile} from "fs"; import {readFile, readFileSync} from "fs";
interface Word{ interface Word{
bsm:string bsm:string
@ -11,12 +11,18 @@ interface Ret{
message:string message:string
haveMess:boolean haveMess:boolean
} }
let words:Word[] let words:Word[] = []
readFile("./word.json",'utf-8',(err, data)=>{ const loadWords = ()=>{
if (err)console.error(err) const wordRaw = readFileSync('./word.json','utf-8')
words=JSON.parse(data) words = JSON.parse(wordRaw)
}) for (let i = 0; i< words.length ; i++){
words[i].id =i;
}
}
export default defineEventHandler((event):Ret=>{ export default defineEventHandler((event):Ret=>{
if (words.length===0){
loadWords()
}
const query = getQuery(event) const query = getQuery(event)
if (query.id=="错误"){ if (query.id=="错误"){
return { return {
@ -25,6 +31,7 @@ export default defineEventHandler((event):Ret=>{
haveMess:true haveMess:true
} }
} }
// @ts-ignore
if (query.id>=words.length){ if (query.id>=words.length){
return { return {
data:words[0], data:words[0],
@ -32,7 +39,9 @@ export default defineEventHandler((event):Ret=>{
haveMess:true haveMess:true
} }
} }
return { return {
// @ts-ignore
data:words[query.id], data:words[query.id],
message:"", message:"",
haveMess:false haveMess:false

View File

@ -1,4 +1,4 @@
import {readFile} from "fs"; import {readFile, readFileSync} from "fs";
import path from "path"; import path from "path";
interface Word{ interface Word{
bsm:string bsm:string
@ -11,17 +11,23 @@ interface Ret{
message:string message:string
haveMess:boolean haveMess:boolean
} }
let words:Word[] let words:Word[] = []
readFile("./word.json",'utf-8',(err, data)=>{
if (err)console.error(err) const loadWords = ()=>{
words = JSON.parse(data) const wordRaw = readFileSync('./word.json','utf-8')
words = JSON.parse(wordRaw)
for (let i = 0; i< words.length ; i++){ for (let i = 0; i< words.length ; i++){
words[i].id=i words[i].id =i;
} }
}) }
export default defineEventHandler((event):Ret=>{ export default defineEventHandler((event):Ret=>{
if (words.length===0){
loadWords()
}
const retWords:Word[] = [] const retWords:Word[] = []
const query = getQuery(event) const query = getQuery(event)
// @ts-ignore
if (query.words=="错误"||query.method=="错误"||!(query.method=="bsmf"||query.method=="bsmc"||query.method=="hz")||query.words.length>20){ if (query.words=="错误"||query.method=="错误"||!(query.method=="bsmf"||query.method=="bsmc"||query.method=="hz")||query.words.length>20){
return { return {
data:[], data:[],

19
start.sh Normal file
View File

@ -0,0 +1,19 @@
#!/bin/bash
# 1. 执行 git pull
git pull
# 2. 执行 npm i
npm i
# 3. 执行 npm run build
npm run build
cp ./word.json ./.output/
# 4. 切换到 ./.output 目录
cd ./.output
# 5. 执行 node ./server/index.mjs
node ./server/index.mjs