Compare commits

...

10 Commits

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

View File

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

View File

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

View File

@ -1,21 +0,0 @@
<script setup lang="ts">
</script>
<template>
<Title>网站地图</Title>
<div style="display: flex;justify-content: center;flex-direction: column;align-items: center">
<NuxtLink to="/">主页</NuxtLink>
<NuxtLink to="/data/all">数据收集</NuxtLink>
<NuxtLink to="/data/bilibili">数据收集Bilibili</NuxtLink>
<NuxtLink to="/data/baidu">数据收集百度</NuxtLink>
<NuxtLink to="/">主页</NuxtLink>
<NuxtLink to="/tools/qqazk/">笔顺码字典首页</NuxtLink>
<NuxtLink to="/tools/qqazk/about">笔顺码字典关于</NuxtLink>
<NuxtLink to="/tools/qqazk/search?words=&method=bsmf">所有笔顺码</NuxtLink>
</div>
</template>
<style scoped>
</style>

22
pages/map/index.vue Normal file
View File

@ -0,0 +1,22 @@
<script setup lang="ts">
const HotArray = await $fetch("https://data.zziyu.cn/hot/webs")
</script>
<template>
<Title>网站地图</Title>
<div style="display: flex;justify-content: center;flex-direction: column;align-items: center">
<NuxtLink to="/">主页</NuxtLink>
<NuxtLink to="/data/all">数据收集所有</NuxtLink>
<!-- <NuxtLink to="/data/bilibili">数据收集Bilibili</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="/tools/qqazk/">笔顺码字典首页</NuxtLink>
<NuxtLink to="/tools/qqazk/about">笔顺码字典关于</NuxtLink>
<NuxtLink to="/map/qqazk">所有笔顺码</NuxtLink>
</div>
</template>
<style scoped>
</style>

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

View File

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