-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
24 changed files
with
384 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{ | ||
"recommendations": ["Vue.volar"] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
{ | ||
"prettier.enable": false, | ||
"editor.formatOnSave": false, | ||
"editor.codeActionsOnSave": { | ||
"source.fixAll.eslint": "explicit", | ||
"source.organizeImports": "never" | ||
}, | ||
"eslint.rules.customizations": [ | ||
{ | ||
"rule": "style/*", | ||
"severity": "off" | ||
}, | ||
{ | ||
"rule": "format/*", | ||
"severity": "off" | ||
}, | ||
{ | ||
"rule": "*-indent", | ||
"severity": "off" | ||
}, | ||
{ | ||
"rule": "*-spacing", | ||
"severity": "off" | ||
}, | ||
{ | ||
"rule": "*-spaces", | ||
"severity": "off" | ||
}, | ||
{ | ||
"rule": "*-order", | ||
"severity": "off" | ||
}, | ||
{ | ||
"rule": "*-dangle", | ||
"severity": "off" | ||
}, | ||
{ | ||
"rule": "*-newline", | ||
"severity": "off" | ||
}, | ||
{ | ||
"rule": "*quotes", | ||
"severity": "off" | ||
}, | ||
{ | ||
"rule": "*semi", | ||
"severity": "off" | ||
} | ||
], | ||
"eslint.validate": [ | ||
"javascript", | ||
"javascriptreact", | ||
"typescript", | ||
"typescriptreact", | ||
"vue", | ||
"html", | ||
"markdown", | ||
"json", | ||
"jsonc", | ||
"yaml", | ||
"toml", | ||
"xml", | ||
"gql", | ||
"graphql", | ||
"astro", | ||
"css", | ||
"less", | ||
"scss", | ||
"pcss", | ||
"postcss" | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
# vue-a | ||
|
||
Vue3 + TypeScript + Vite + VueRouter + UnoCss + VueUse + Axios |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
# 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 | ||
.idea | ||
.DS_Store | ||
*.suo | ||
*.ntvs* | ||
*.njsproj | ||
*.sln | ||
*.sw? |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
import antfu from '@antfu/eslint-config' | ||
|
||
export default antfu() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
<!doctype html> | ||
<html lang="en"> | ||
<head> | ||
<meta charset="UTF-8" /> | ||
<meta name="viewport" content="width=device-width, initial-scale=1.0" /> | ||
<title>Vite + Vue + TS</title> | ||
</head> | ||
<body> | ||
<div id="app"></div> | ||
<script type="module" src="/src/main.ts"></script> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
{ | ||
"name": "my-vue-app", | ||
"type": "module", | ||
"version": "0.0.0", | ||
"private": true, | ||
"scripts": { | ||
"dev": "vite", | ||
"build": "vue-tsc -b && vite build", | ||
"preview": "vite preview" | ||
}, | ||
"dependencies": { | ||
"@unocss/reset": "^0.61.5", | ||
"@vueuse/core": "^10.11.0", | ||
"@vueuse/integrations": "^10.11.0", | ||
"axios": "^1.7.2", | ||
"crypto-js": "^4.2.0", | ||
"vue": "^3.4.31", | ||
"vue-router": "^4.4.0" | ||
}, | ||
"devDependencies": { | ||
"@antfu/eslint-config": "^2.21.3", | ||
"@types/crypto-js": "^4.2.2", | ||
"@vitejs/plugin-vue": "^5.0.5", | ||
"eslint": "^9.6.0", | ||
"typescript": "^5.2.2", | ||
"unocss": "^0.61.5", | ||
"unplugin-auto-import": "^0.18.2", | ||
"unplugin-vue-components": "^0.27.3", | ||
"vite": "^5.3.4", | ||
"vue-tsc": "^2.0.24" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
<script setup lang="ts"> | ||
</script> | ||
|
||
<template> | ||
<router-view /> | ||
</template> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
import { createApp } from 'vue' | ||
import App from './App.vue' | ||
import router from './router' | ||
|
||
import 'virtual:uno.css' | ||
|
||
// https://unocss.dev/guide/style-reset | ||
import '@unocss/reset/tailwind-compat.css' | ||
|
||
createApp(App).use(router).mount('#app') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
<script setup lang="ts"> | ||
</script> | ||
|
||
<template> | ||
<div>Home</div> | ||
</template> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
import axios from 'axios' | ||
|
||
export const instance = axios.create({ | ||
baseURL: '', | ||
// timeout: 20000, | ||
// withCredentials: true, | ||
}) | ||
|
||
// 请求拦截 | ||
instance.interceptors.request.use( | ||
(config) => { | ||
// | ||
return config | ||
}, | ||
(error) => { | ||
// | ||
return Promise.reject(error) | ||
}, | ||
) | ||
|
||
// 响应拦截 | ||
instance.interceptors.response.use( | ||
(response) => { | ||
// | ||
return response | ||
}, | ||
(error) => { | ||
// | ||
return Promise.reject(error) | ||
}, | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
// import { useAxios } from '@vueuse/integrations/useAxios' | ||
// import { instance } from './axios' | ||
|
||
// export function getTestList() { | ||
// return useAxios( | ||
// '/test', | ||
// { | ||
// method: 'GET', | ||
// }, | ||
// instance, | ||
// ) | ||
// } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
import type { RouteRecordRaw } from 'vue-router' | ||
import { createRouter, createWebHashHistory } from 'vue-router' | ||
|
||
const routes: Array<RouteRecordRaw> = [ | ||
{ | ||
path: '/', | ||
name: 'Home', | ||
component: () => import('@/pages/home/index.vue'), | ||
}, | ||
] | ||
|
||
const router = createRouter({ | ||
// createWebHistory or createWebHashHistory | ||
history: createWebHashHistory(), | ||
routes, | ||
}) | ||
|
||
export default router |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
// @/utils |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
import CryptoJS from 'crypto-js' | ||
|
||
// 十六位十六进制数作为密钥 | ||
const SECRET_KEY = CryptoJS.enc.Utf8.parse('86f1fda459fa47c7') | ||
// 十六位十六进制数作为密钥偏移量 | ||
const SECRET_IV = CryptoJS.enc.Utf8.parse('c18eea9cbe12489e') | ||
|
||
/** | ||
* 加密方法 | ||
*/ | ||
export function encrypt(data: string) { | ||
const dataHex = CryptoJS.enc.Utf8.parse(data) | ||
const encrypted = CryptoJS.AES.encrypt(dataHex, SECRET_KEY, { | ||
iv: SECRET_IV, | ||
mode: CryptoJS.mode.CBC, | ||
padding: CryptoJS.pad.Pkcs7, | ||
}) | ||
return encrypted.ciphertext.toString() | ||
} | ||
|
||
/** | ||
* 解密方法 | ||
*/ | ||
export function decrypt(data: string) { | ||
const encryptedHexStr = CryptoJS.enc.Hex.parse(data) | ||
const str = CryptoJS.enc.Base64.stringify(encryptedHexStr) | ||
const decrypt = CryptoJS.AES.decrypt(str, SECRET_KEY, { | ||
iv: SECRET_IV, | ||
mode: CryptoJS.mode.CBC, | ||
padding: CryptoJS.pad.Pkcs7, | ||
}) | ||
const decryptedStr = decrypt.toString(CryptoJS.enc.Utf8) | ||
return decryptedStr.toString() | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
/** | ||
* @/utils/storage/index.ts | ||
* localstorage集中管理 | ||
* | ||
* 添加: AUTH.value = {...} | ||
* 清空: AUTH.value = null | ||
*/ | ||
import { StorageSerializers, useStorage } from '@vueuse/core' | ||
|
||
// 加密 | ||
// import { decrypt, encrypt } from './crypto' | ||
|
||
// const serializer = { | ||
// read: (v: any) => (v ? JSON.parse(decrypt(v)) : null), | ||
// write: (v: any) => encrypt(JSON.stringify(v)), | ||
// } | ||
|
||
export interface Auth { | ||
// | ||
} | ||
|
||
export const AUTH = useStorage<Auth | null>('AUTH', null, undefined, { | ||
serializer: StorageSerializers.object, | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
/// <reference types="vite/client" /> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
{ | ||
"compilerOptions": { | ||
"composite": true, | ||
"tsBuildInfoFile": "./node_modules/.tmp/tsconfig.app.tsbuildinfo", | ||
"target": "ES2020", | ||
"jsx": "preserve", | ||
"lib": ["ES2020", "DOM", "DOM.Iterable"], | ||
"moduleDetection": "force", | ||
"useDefineForClassFields": true, | ||
"baseUrl": "./", | ||
"module": "ESNext", | ||
|
||
/* Bundler mode */ | ||
"moduleResolution": "bundler", | ||
"paths": { | ||
"@": ["src"], | ||
"@/*": ["src/*"] | ||
}, | ||
"resolveJsonModule": true, | ||
"allowImportingTsExtensions": true, | ||
|
||
/* Linting */ | ||
"strict": true, | ||
"noFallthroughCasesInSwitch": true, | ||
"noUnusedLocals": true, | ||
"noUnusedParameters": true, | ||
"noEmit": true, | ||
"isolatedModules": true, | ||
"skipLibCheck": true | ||
}, | ||
"include": ["src/**/*.ts", "src/**/*.tsx", "src/**/*.vue"] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
{ | ||
"references": [ | ||
{ | ||
"path": "./tsconfig.app.json" | ||
}, | ||
{ | ||
"path": "./tsconfig.node.json" | ||
} | ||
], | ||
"files": [] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
{ | ||
"compilerOptions": { | ||
"composite": true, | ||
"tsBuildInfoFile": "./node_modules/.tmp/tsconfig.node.tsbuildinfo", | ||
"module": "ESNext", | ||
"moduleResolution": "bundler", | ||
"strict": true, | ||
"noEmit": true, | ||
"allowSyntheticDefaultImports": true, | ||
"skipLibCheck": true | ||
}, | ||
"include": ["vite.config.ts"] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
// uno.config.ts | ||
import { defineConfig, presetUno } from 'unocss' | ||
|
||
export default defineConfig({ | ||
presets: [ | ||
presetUno(), | ||
], | ||
}) |
Oops, something went wrong.