初始化

This commit is contained in:
wcx 2024-07-28 23:29:47 +08:00
commit 05b348c46f
29 changed files with 1628 additions and 0 deletions

24
.gitignore vendored Normal file
View File

@ -0,0 +1,24 @@
# 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?

3
.vscode/extensions.json vendored Normal file
View File

@ -0,0 +1,3 @@
{
"recommendations": ["Vue.volar"]
}

5
README.md Normal file
View File

@ -0,0 +1,5 @@
# Vue 3 + TypeScript + Vite
This template should help get you started developing with Vue 3 and TypeScript in Vite. The template uses Vue 3 `<script setup>` SFCs, check out the [script setup docs](https://v3.vuejs.org/api/sfc-script-setup.html#sfc-script-setup) to learn more.
Learn more about the recommended Project Setup and IDE Support in the [Vue Docs TypeScript Guide](https://vuejs.org/guide/typescript/overview.html#project-setup).

16
index.html Normal file
View File

@ -0,0 +1,16 @@
<!doctype html>
<html lang="zh">
<head>
<meta charset="UTF-8"/>
<link rel="apple-touch-icon" sizes="180x180" href="src/assets/icons/apple-touch-icon.png">
<link rel="icon" type="image/png" sizes="32x32" href="src/assets/icons/favicon-32x32.png">
<link rel="icon" type="image/png" sizes="16x16" href="src/assets/icons/favicon-16x16.png">
<link rel="manifest" href="manifest.json">
<meta name="viewport" content="width=device-width, initial-scale=1.0"/>
<title>S-URL services</title>
</head>
<body>
<div id="app"></div>
<script type="module" src="src/main.ts"></script>
</body>
</html>

34
manifest.json Normal file
View File

@ -0,0 +1,34 @@
{
"name": "surl",
"short_name": "surl",
"start_url": "/",
"icons": [
{
"src": "src/assets/icons/android-chrome-192x192.png",
"sizes": "192x192",
"type": "image/png"
},
{
"src": "src/assets/icons/android-chrome-512x512.png",
"sizes": "512x512",
"type": "image/png"
}
],
"theme_color": "#ffffff",
"background_color": "#ffffff",
"display": "standalone",
"screenshots": [
{
"src": "src/assets/icons/android-chrome-512x512.png",
"sizes": "512x512",
"type": "image/png",
"form_factor": "wide"
},
{
"src": "src/assets/icons/android-chrome-512x512.png",
"sizes": "512x512",
"type": "image/png",
"form_factor": "narrow"
}
]
}

1162
package-lock.json generated Normal file

File diff suppressed because it is too large Load Diff

21
package.json Normal file
View File

@ -0,0 +1,21 @@
{
"name": "surl-front",
"private": true,
"version": "0.0.0",
"type": "module",
"scripts": {
"dev": "vite",
"build": "vue-tsc -b && vite build",
"preview": "vite preview"
},
"dependencies": {
"vue": "^3.4.31",
"vue-router": "^4.4.0"
},
"devDependencies": {
"@vitejs/plugin-vue": "^5.0.5",
"typescript": "^5.2.2",
"vite": "^5.3.4",
"vue-tsc": "^2.0.24"
}
}

1
public/vite.svg Normal file
View File

@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" class="iconify iconify--logos" width="31.88" height="32" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 257"><defs><linearGradient id="IconifyId1813088fe1fbc01fb466" x1="-.828%" x2="57.636%" y1="7.652%" y2="78.411%"><stop offset="0%" stop-color="#41D1FF"></stop><stop offset="100%" stop-color="#BD34FE"></stop></linearGradient><linearGradient id="IconifyId1813088fe1fbc01fb467" x1="43.376%" x2="50.316%" y1="2.242%" y2="89.03%"><stop offset="0%" stop-color="#FFEA83"></stop><stop offset="8.333%" stop-color="#FFDD35"></stop><stop offset="100%" stop-color="#FFA800"></stop></linearGradient></defs><path fill="url(#IconifyId1813088fe1fbc01fb466)" d="M255.153 37.938L134.897 252.976c-2.483 4.44-8.862 4.466-11.382.048L.875 37.958c-2.746-4.814 1.371-10.646 6.827-9.67l120.385 21.517a6.537 6.537 0 0 0 2.322-.004l117.867-21.483c5.438-.991 9.574 4.796 6.877 9.62Z"></path><path fill="url(#IconifyId1813088fe1fbc01fb467)" d="M185.432.063L96.44 17.501a3.268 3.268 0 0 0-2.634 3.014l-5.474 92.456a3.268 3.268 0 0 0 3.997 3.378l24.777-5.718c2.318-.535 4.413 1.507 3.936 3.838l-7.361 36.047c-.495 2.426 1.782 4.5 4.151 3.78l15.304-4.649c2.372-.72 4.652 1.36 4.15 3.788l-11.698 56.621c-.732 3.542 3.979 5.473 5.943 2.437l1.313-2.028l72.516-144.72c1.215-2.423-.88-5.186-3.54-4.672l-25.505 4.922c-2.396.462-4.435-1.77-3.759-4.114l16.646-57.705c.677-2.35-1.37-4.583-3.769-4.113Z"></path></svg>

After

Width:  |  Height:  |  Size: 1.5 KiB

14
src/App.vue Normal file
View File

@ -0,0 +1,14 @@
<script setup lang="ts">
import {useRouter} from "vue-router";
const token = localStorage.getItem("token")
if (token == null) useRouter().push("/login")
</script>
<template>
<RouterView/>
</template>
<style scoped>
</style>

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 26 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 566 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

View File

View File

@ -0,0 +1,85 @@
<script setup lang="ts">
defineOptions({
inheritAttrs: false
})
defineProps<{
prefix?: string,
type?: string,
placeholder?: string,
suffix?: string
}>()
const val = defineModel('val')
</script>
<template>
<div class="input-container">
<div class="input-prefix">
<span>{{ prefix }}</span>
</div>
<div class="input-input">
<input :type="type" :placeholder="placeholder" v-model="val">
<div class="input-indicator"></div>
</div>
<div class="input-suffix">
<span>{{ suffix }}</span>
</div>
</div>
</template>
<style scoped>
.input-container {
font-size: var(--font-size-medium);
display: flex;
align-items: center;
flex-direction: row;
position: relative;
width: 100%;
height: 40px;
color: var(--color-font-base);
margin-top: 10px;
}
.input-prefix, .input-input, .input-suffix {
margin: 0 10px;
text-align: right;
}
.input-prefix {
flex-grow: 0;
width: 4em;
text-align: center;
color: var(--color-font-base);
}
.input-input {
flex-grow: 1;
}
.input-input input {
height: 30px;
width: 100%;
outline: none;
border: none;
font-size: var(--font-size-medium);
border-bottom: 1px solid var(--color-border-base);
}
.input-input input:hover {
border-bottom: 1px solid black;
}
.input-input input:focus{
border-bottom: 1px solid var(--color-primary);
}
.input-indicator {
position: relative;
display: block;
width: 0;
height: 2px;
background-color: var(--color-border-base);
}
.input-input input:focus + .input-indicator {
width: 100%;
background-color: var(--color-primary);
}
</style>

14
src/components/Login.vue Normal file
View File

@ -0,0 +1,14 @@
<script setup lang="ts">
import {ref} from "vue";
import LoginPage from "./LoginPage.vue";
const username = ref('')
const password = ref('')
</script>
<template>
<LoginPage v-model:username="username" v-model:password="password"/>
</template>
<style scoped>
</style>

View File

@ -0,0 +1,73 @@
<script setup lang="ts">
import InputBox from "./InputBox.vue";
import SubmitButton from "./SubmitButton.vue";
const username = defineModel<string>('username')
const password = defineModel<string>('password')
</script>
<template>
<div class="loginpage-container">
<div class="loginpage-dialog">
<div class="loginpage-dialog-header"> 登录 </div>
<div class="loginpage-dialog-body">
<InputBox prefix="用户名" type="text" placeholder="用户名" v-model:val="username"/>
<InputBox prefix="密码" type="password" placeholder="密码" v-model:val="password"/>
<SubmitButton class="loginpage-submit-button"/>
</div>
<div class="loginpage-dialog-footer"> powered by @surl</div>
</div>
</div>
</template>
<style scoped>
.loginpage-container {
position: relative;
display: flex;
flex-direction: column;
width: 100%;
height: 100%;
align-items: center;
justify-content: center;
}
.loginpage-dialog {
height: 500px;
width: 700px;
border: 1px solid var(--color-border-base);
}
.loginpage-dialog-header {
display: flex;
height: 40px;
text-align: center;
justify-content: center;
align-items: center;
font-size: var(--font-size-large);
color: var(--color-font-base);
}
.loginpage-dialog-body {
display: flex;
flex-direction: column;
justify-content: center;
width: 100%;
height: calc(100% - 60px);
padding: 0 80px;
border-top: 1px solid var(--color-border-base);
border-bottom: 1px solid var(--color-border-base);
}
.loginpage-dialog-footer {
height: 20px;
text-align: right;
padding-right: 5px;
font-size: var(--font-size-small);
color: var(--color-font-base);
}
.loginpage-submit-button {
margin-top: 40px !important;
padding-right: 30px;
}
</style>

View File

@ -0,0 +1,11 @@
<script setup lang="ts">
</script>
<template>
404 NOT FOUND
</template>
<style scoped>
</style>

View File

@ -0,0 +1,49 @@
<script setup lang="ts">
import {useRouter} from "vue-router";
const router = useRouter()
function jmp () {
console.log("jmp")
router.push("/input")
}
</script>
<template>
<div class="submit-button-container">
<button @click="jmp"> 提交 </button>
<div></div>
</div>
</template>
<style scoped>
.submit-button-container {
position: relative;
display: flex;
justify-content: right;
top: 0;
left: 0;
width: 100%;
height: 30px;
margin-top: 20px;
}
.submit-button-container button {
position: relative;
top: 0;
left: 0;
border: none;
background-color: var(--color-primary);
color: white;
width: 80px;
height: 30px;
border-radius: 5px;
}
.submit-button-container button:hover {
cursor: pointer;
background-color: var(--color-primary-lighter);
}
.submit-button-container button:active {
background-color: var(--color-primary-deeper);
}
</style>

8
src/main.ts Normal file
View File

@ -0,0 +1,8 @@
import {createApp} from 'vue'
import './style.css'
import {router} from "./router.ts";
import App from "./App.vue";
createApp(App)
.use(router)
.mount('#app')

14
src/router.ts Normal file
View File

@ -0,0 +1,14 @@
import {createRouter, createWebHistory} from "vue-router";
import Login from "./components/Login.vue";
import InputBox from "./components/InputBox.vue";
import App from "./App.vue";
const routes = [
{path: '/', component: App},
{path: '/login', component: Login},
{path: '/input', component: InputBox},
]
export const router = createRouter({
history: createWebHistory(),
routes
})

35
src/style.css Normal file
View File

@ -0,0 +1,35 @@
:root {
--font-size-small: 0.5em;
--font-size-medium: 1em;
--font-size-large: 1.2em;
--color-font-base: #555;
--color-border-base: #ccc;
--color-primary: #1BA0F2;
--color-primary-deeper: #1B8EF2;
--color-primary-lighter: #38BDF2;
}
html, body {
display: block;
position: relative;
left: 0;
top: 0;
padding: 0;
margin: 0;
height: 100%;
width: 100%;
}
#app * {
box-sizing: border-box;
transition: all 0.3s ease;
}
#app {
display: block;
position: relative;
top: 0;
left: 0;
height: 100%;
width: 100%;
}

1
src/vite-env.d.ts vendored Normal file
View File

@ -0,0 +1 @@
/// <reference types="vite/client" />

27
tsconfig.app.json Normal file
View File

@ -0,0 +1,27 @@
{
"compilerOptions": {
"composite": true,
"tsBuildInfoFile": "./node_modules/.tmp/tsconfig.app.tsbuildinfo",
"target": "ES2020",
"useDefineForClassFields": true,
"module": "ESNext",
"lib": ["ES2020", "DOM", "DOM.Iterable"],
"skipLibCheck": true,
/* Bundler mode */
"moduleResolution": "bundler",
"allowImportingTsExtensions": true,
"resolveJsonModule": true,
"isolatedModules": true,
"moduleDetection": "force",
"noEmit": true,
"jsx": "preserve",
/* Linting */
"strict": true,
"noUnusedLocals": true,
"noUnusedParameters": true,
"noFallthroughCasesInSwitch": true
},
"include": ["src/**/*.ts", "src/**/*.tsx", "src/**/*.vue"]
}

11
tsconfig.json Normal file
View File

@ -0,0 +1,11 @@
{
"files": [],
"references": [
{
"path": "./tsconfig.app.json"
},
{
"path": "./tsconfig.node.json"
}
]
}

13
tsconfig.node.json Normal file
View File

@ -0,0 +1,13 @@
{
"compilerOptions": {
"composite": true,
"tsBuildInfoFile": "./node_modules/.tmp/tsconfig.node.tsbuildinfo",
"skipLibCheck": true,
"module": "ESNext",
"moduleResolution": "bundler",
"allowSyntheticDefaultImports": true,
"strict": true,
"noEmit": true
},
"include": ["vite.config.ts"]
}

7
vite.config.ts Normal file
View File

@ -0,0 +1,7 @@
import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'
// https://vitejs.dev/config/
export default defineConfig({
plugins: [vue()],
})