add some files.
This commit is contained in:
commit
546552b060
|
@ -0,0 +1,26 @@
|
|||
# Logs
|
||||
logs
|
||||
*.log
|
||||
npm-debug.log*
|
||||
yarn-debug.log*
|
||||
yarn-error.log*
|
||||
pnpm-debug.log*
|
||||
lerna-debug.log*
|
||||
|
||||
node_modules
|
||||
dist
|
||||
dist-ssr
|
||||
*.local
|
||||
|
||||
# Editor directories and files
|
||||
.vscode/*
|
||||
!.vscode/extensions.json
|
||||
.idea
|
||||
.DS_Store
|
||||
*.suo
|
||||
*.ntvs*
|
||||
*.njsproj
|
||||
*.sln
|
||||
*.sw?
|
||||
|
||||
bun.lockb
|
|
@ -0,0 +1,21 @@
|
|||
MIT License
|
||||
|
||||
Copyright (c) 2023 Fromsko
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
|
@ -0,0 +1,65 @@
|
|||
# **课表查询**
|
||||
|
||||
<div align="center">
|
||||
|
||||
## <img src="./src/assets/logo.png" height="80" style="border-radius: 50%;"/>
|
||||
|
||||
📅 **吉首大学课表查询**
|
||||
|
||||
🛠️ 简化查询流程
|
||||
|
||||
---
|
||||
|
||||
</div>
|
||||
|
||||
## 📑 功能特点
|
||||
|
||||
- 自动展示本周课表信息
|
||||
- 可以直接下载
|
||||
- 响应式布局
|
||||
|
||||
## 🚀 快速开始
|
||||
|
||||
1. 填写后端地址 `./src/components/CnameData.jsx`
|
||||
|
||||
```jsx
|
||||
export const ApiURL = 'http://1.117.154.114:20000'
|
||||
```
|
||||
|
||||
2. 📦 安装并启动应用
|
||||
|
||||
```bash
|
||||
cd frontend
|
||||
npm i
|
||||
npm run dev
|
||||
```
|
||||
|
||||
3. 展示
|
||||
|
||||
- `Loading`
|
||||
|
||||
<div align="center">
|
||||
<img src="./src/assets/loading.png" height=""/>
|
||||
</div>
|
||||
|
||||
* `Running`
|
||||
|
||||
<div align="center">
|
||||
<img src="./src/assets/app-running.png" height=""/>
|
||||
</div>
|
||||
|
||||
## 🔗 访问
|
||||
|
||||
- **请求地址:** `http://host:prot`
|
||||
|
||||
## 🙏 鸣谢
|
||||
|
||||
感谢以下开源项目,它们为本项目的开发提供了重要支持:
|
||||
|
||||
- [React](https://github.com/facebook/react): 一个 `js` 框架
|
||||
- [chakra-ui](https://github.com/chakra-ui/chakra-uichakra-ui): 🌐 用于构建用户界面
|
||||
- [Vite](https://github.com/vitejs/vite): 🚀 下一代前端工具,它的速度很快!
|
||||
|
||||
## ©️ 许可
|
||||
|
||||
本项目基于 MIT 许可证,请查阅 LICENSE 文件以获取更多信息。
|
|
@ -0,0 +1,16 @@
|
|||
<!doctype html>
|
||||
<html lang="en">
|
||||
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
<link rel="icon" type="image/svg+xml" href="/src/assets/logo.png" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
<title>课表查询</title>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<div id="root"></div>
|
||||
<script type="module" src="/src/main.jsx"></script>
|
||||
</body>
|
||||
|
||||
</html>
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,36 @@
|
|||
{
|
||||
"name": "small-web",
|
||||
"private": true,
|
||||
"version": "5.2.0",
|
||||
"type": "module",
|
||||
"scripts": {
|
||||
"dev": "vite",
|
||||
"build": "vite build",
|
||||
"lint": "eslint . --ext js,jsx --report-unused-disable-directives --max-warnings 0",
|
||||
"preview": "vite preview"
|
||||
},
|
||||
"dependencies": {
|
||||
"@chakra-ui/icons": "^2.1.1",
|
||||
"@chakra-ui/react": "^2.8.1",
|
||||
"@emotion/react": "^11.11.1",
|
||||
"@emotion/styled": "^11.11.0",
|
||||
"@vue/runtime-core": "^3.3.4",
|
||||
"axios": "^1.5.1",
|
||||
"dotenv": "^16.3.1",
|
||||
"framer-motion": "^10.16.4",
|
||||
"path-browserify": "^1.0.1",
|
||||
"react": "^18.2.0",
|
||||
"react-dom": "^18.2.0",
|
||||
"react-hook-form": "^7.47.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/react": "^18.2.15",
|
||||
"@types/react-dom": "^18.2.7",
|
||||
"@vitejs/plugin-react": "^4.0.3",
|
||||
"eslint": "^8.45.0",
|
||||
"eslint-plugin-react": "^7.32.2",
|
||||
"eslint-plugin-react-hooks": "^4.6.0",
|
||||
"eslint-plugin-react-refresh": "^0.4.3",
|
||||
"vite": "^4.4.11"
|
||||
}
|
||||
}
|
|
@ -0,0 +1,37 @@
|
|||
import {
|
||||
ChakraProvider,
|
||||
Flex
|
||||
} from '@chakra-ui/react'
|
||||
import { useEffect, useState } from 'react'
|
||||
import TypingText from './components/TypingText'
|
||||
import instance from './request/http'
|
||||
|
||||
function App () {
|
||||
const [content, setContent] = useState('')
|
||||
|
||||
useEffect(() => {
|
||||
const intervalId = setInterval(() => {
|
||||
instance.get('/rensheng.txt').then((resp) => {
|
||||
setContent(resp)
|
||||
})
|
||||
}, 3500)
|
||||
|
||||
return () => clearInterval(intervalId)
|
||||
}, [])
|
||||
|
||||
return (
|
||||
<ChakraProvider>
|
||||
<Flex direction="column" align="center" justify="center" h="100vh">
|
||||
<TypingText
|
||||
text={content}
|
||||
speed={100}
|
||||
timeOut={2000}
|
||||
isclear={true}
|
||||
/>
|
||||
</Flex>
|
||||
</ChakraProvider>
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
export default App
|
Binary file not shown.
After Width: | Height: | Size: 214 KiB |
Binary file not shown.
After Width: | Height: | Size: 91 KiB |
Binary file not shown.
After Width: | Height: | Size: 14 KiB |
|
@ -0,0 +1,49 @@
|
|||
import { Text } from '@chakra-ui/react'
|
||||
import { useEffect, useState } from 'react'
|
||||
|
||||
const TypingText = ({ text, speed, timeOut, isclear }) => {
|
||||
const [displayText, setDisplayText] = useState('')
|
||||
|
||||
useEffect(() => {
|
||||
let index = 0
|
||||
const intervalId = setInterval(() => {
|
||||
setDisplayText((prev) => {
|
||||
if (text[index] === undefined) {
|
||||
return text
|
||||
}
|
||||
return prev + text[index]
|
||||
})
|
||||
index++
|
||||
if (index === text.length) {
|
||||
clearInterval(intervalId)
|
||||
setTimeout(() => {
|
||||
if (isclear) {
|
||||
setDisplayText('')
|
||||
}
|
||||
}, timeOut)
|
||||
}
|
||||
}, speed)
|
||||
|
||||
return () => clearInterval(intervalId)
|
||||
}, [text, speed, timeOut, isclear])
|
||||
|
||||
return (
|
||||
<Text
|
||||
sx={{
|
||||
fontFamily: 'monospace',
|
||||
background: 'linear-gradient(to right, rgba(238, 174, 202, 1), rgba(148, 187, 233, 1), rgba(179, 229, 252, 1))',
|
||||
backgroundSize: '200% 100%',
|
||||
animation: `rainbow ${text.length * speed}ms linear infinite`,
|
||||
whiteSpace: 'pre',
|
||||
borderRadius: '4px',
|
||||
padding: '8px',
|
||||
fontWeight: 'bold',
|
||||
}}
|
||||
>
|
||||
{displayText}
|
||||
</Text>
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
export default TypingText
|
|
@ -0,0 +1,5 @@
|
|||
{
|
||||
"BACKEND_API": "http://localhost:60000",
|
||||
"VERSION": "5.2.0",
|
||||
"OneSayAPI": "https://v1.jinrishici.com"
|
||||
}
|
|
@ -0,0 +1,10 @@
|
|||
import React from 'react'
|
||||
import ReactDOM from 'react-dom/client'
|
||||
import App from './App.jsx'
|
||||
|
||||
|
||||
ReactDOM.createRoot(document.getElementById('root')).render(
|
||||
<React.StrictMode>
|
||||
<App />
|
||||
</React.StrictMode>
|
||||
)
|
|
@ -0,0 +1,35 @@
|
|||
import axios from "axios"
|
||||
import config from '../config.json'
|
||||
|
||||
|
||||
// 创建一个 Axios 实例
|
||||
const instance = axios.create({
|
||||
baseURL: config.OneSayAPI, // 可选的 baseURL
|
||||
})
|
||||
|
||||
// 请求前拦截器
|
||||
instance.interceptors.request.use(
|
||||
(config) => {
|
||||
return config
|
||||
},
|
||||
(error) => {
|
||||
return Promise.reject(error)
|
||||
}
|
||||
)
|
||||
|
||||
// 请求后拦截器
|
||||
instance.interceptors.response.use(
|
||||
(response) => {
|
||||
if (response.status === 200) {
|
||||
return response.data
|
||||
} else {
|
||||
throw new Error("请求失败")
|
||||
}
|
||||
},
|
||||
(error) => {
|
||||
return Promise.reject(error)
|
||||
}
|
||||
)
|
||||
|
||||
|
||||
export default instance
|
|
@ -0,0 +1,15 @@
|
|||
import react from '@vitejs/plugin-react'
|
||||
import { defineConfig } from 'vite'
|
||||
|
||||
// https://vitejs.dev/config/
|
||||
export default defineConfig({
|
||||
plugins: [react()],
|
||||
server: {
|
||||
host: '0.0.0.0',//ip地址
|
||||
port: 8080, // 设置服务启动端口号
|
||||
open: false, // 设置服务启动时是否自动打开浏览器
|
||||
},
|
||||
// define: {
|
||||
// 'process.env': process.env
|
||||
// }
|
||||
})
|
Loading…
Reference in New Issue