first
24
.gitignore
vendored
Normal 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
@ -0,0 +1,3 @@
|
||||
{
|
||||
"recommendations": ["Vue.volar"]
|
||||
}
|
||||
7
env.d.ts
vendored
Normal file
@ -0,0 +1,7 @@
|
||||
/// <reference types="vite/client" />
|
||||
|
||||
declare module '*.vue' {
|
||||
import type { DefineComponent } from 'vue'
|
||||
const component: DefineComponent<{}, {}, any>
|
||||
export default component
|
||||
}
|
||||
13
index.html
Normal file
@ -0,0 +1,13 @@
|
||||
<!doctype html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
<link rel="icon" href="/favicon.ico">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
<title>hi快下载</title>
|
||||
</head>
|
||||
<body>
|
||||
<div id="app"></div>
|
||||
<script type="module" src="/src/main.ts"></script>
|
||||
</body>
|
||||
</html>
|
||||
36
package.json
Normal file
@ -0,0 +1,36 @@
|
||||
{
|
||||
"name": "hi-download",
|
||||
"private": true,
|
||||
"version": "0.0.0",
|
||||
"type": "module",
|
||||
"scripts": {
|
||||
"dev": "vite --mode dev",
|
||||
"build:test": "vite build --mode test",
|
||||
"build:prod": "vite build --mode pord",
|
||||
"preview": "vite preview"
|
||||
},
|
||||
"dependencies": {
|
||||
"@tailwindcss/vite": "^4.1.18",
|
||||
"axios": "^1.13.2",
|
||||
"clsx": "^2.1.1",
|
||||
"lucide-vue-next": "^0.562.0",
|
||||
"reka-ui": "^2.7.0",
|
||||
"tailwindcss": "^4.1.18",
|
||||
"vue": "^3.5.24",
|
||||
"vue-sonner": "^2.0.9"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@tsconfig/node24": "^24.0.3",
|
||||
"@types/node": "^24.10.4",
|
||||
"@vitejs/plugin-vue": "^6.0.1",
|
||||
"@vue/tsconfig": "^0.8.1",
|
||||
"prettier": "^3.8.0",
|
||||
"prettier-plugin-tailwindcss": "^0.7.2",
|
||||
"tailwind-merge": "^3.4.0",
|
||||
"tw-animate-css": "^1.4.0",
|
||||
"typescript": "^5.9.3",
|
||||
"vite": "^7.2.4",
|
||||
"vite-svg-loader": "^5.1.0",
|
||||
"vue-tsc": "^3.2.2"
|
||||
}
|
||||
}
|
||||
1921
pnpm-lock.yaml
generated
Normal file
BIN
public/favicon.ico
Normal file
|
After Width: | Height: | Size: 4.2 KiB |
26
src/App.vue
Normal file
@ -0,0 +1,26 @@
|
||||
<script setup lang="ts" >
|
||||
import Home from './pages/Home/index.vue'
|
||||
import 'vue-sonner/style.css'
|
||||
import { Toaster } from '@/components/ui/sonner'
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<Home />
|
||||
<Toaster
|
||||
position="top-center"
|
||||
:toast-options="{
|
||||
style: {
|
||||
background: '#ddd',
|
||||
color: '#000',
|
||||
border: '1px solid rgba(255, 255, 255)',
|
||||
},
|
||||
classes: {
|
||||
title: 'text-[20px] font-bold',
|
||||
toast: 'rounded-[20px]', // 顺便统一一下你 Dialog 的圆角风格
|
||||
},
|
||||
}"
|
||||
/>
|
||||
</template>
|
||||
|
||||
<style scoped>
|
||||
</style>
|
||||
29
src/components/ui/button/Button.vue
Normal file
@ -0,0 +1,29 @@
|
||||
<script setup lang="ts">
|
||||
import type { PrimitiveProps } from "reka-ui"
|
||||
import type { HTMLAttributes } from "vue"
|
||||
import type { ButtonVariants } from "."
|
||||
import { Primitive } from "reka-ui"
|
||||
import { cn } from "@/lib/utils"
|
||||
import { buttonVariants } from "."
|
||||
|
||||
interface Props extends PrimitiveProps {
|
||||
variant?: ButtonVariants["variant"]
|
||||
size?: ButtonVariants["size"]
|
||||
class?: HTMLAttributes["class"]
|
||||
}
|
||||
|
||||
const props = withDefaults(defineProps<Props>(), {
|
||||
as: "button",
|
||||
})
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<Primitive
|
||||
data-slot="button"
|
||||
:as="as"
|
||||
:as-child="asChild"
|
||||
:class="cn(buttonVariants({ variant, size }), props.class)"
|
||||
>
|
||||
<slot />
|
||||
</Primitive>
|
||||
</template>
|
||||
35
src/components/ui/button/index.ts
Normal file
@ -0,0 +1,35 @@
|
||||
import type { VariantProps } from 'class-variance-authority'
|
||||
import { cva } from 'class-variance-authority'
|
||||
|
||||
export { default as Button } from './Button.vue'
|
||||
|
||||
export const buttonVariants = cva(
|
||||
"inline-flex cursor-pointer items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium transition-all disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4 shrink-0 [&_svg]:shrink-0 outline-none focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive",
|
||||
{
|
||||
variants: {
|
||||
variant: {
|
||||
default: 'bg-primary text-primary-foreground hover:bg-primary/90',
|
||||
destructive:
|
||||
'bg-destructive text-white hover:bg-destructive/90 focus-visible:ring-destructive/20 dark:focus-visible:ring-destructive/40 dark:bg-destructive/60',
|
||||
outline:
|
||||
'border bg-background shadow-xs hover:bg-accent hover:text-accent-foreground dark:bg-input/30 dark:border-input dark:hover:bg-input/50',
|
||||
secondary: 'bg-secondary text-secondary-foreground hover:bg-secondary/80',
|
||||
ghost: 'hover:bg-accent hover:text-accent-foreground dark:hover:bg-accent/50',
|
||||
link: 'text-primary underline-offset-4 hover:underline',
|
||||
},
|
||||
size: {
|
||||
default: 'h-9 px-4 py-2 has-[>svg]:px-3',
|
||||
sm: 'h-8 rounded-md gap-1.5 px-3 has-[>svg]:px-2.5',
|
||||
lg: 'h-10 rounded-md px-6 has-[>svg]:px-4',
|
||||
icon: 'size-9',
|
||||
'icon-sm': 'size-8',
|
||||
'icon-lg': 'size-10',
|
||||
},
|
||||
},
|
||||
defaultVariants: {
|
||||
variant: 'default',
|
||||
size: 'default',
|
||||
},
|
||||
},
|
||||
)
|
||||
export type ButtonVariants = VariantProps<typeof buttonVariants>
|
||||
33
src/components/ui/input/Input.vue
Normal file
@ -0,0 +1,33 @@
|
||||
<script setup lang="ts">
|
||||
import type { HTMLAttributes } from "vue"
|
||||
import { useVModel } from "@vueuse/core"
|
||||
import { cn } from "@/lib/utils"
|
||||
|
||||
const props = defineProps<{
|
||||
defaultValue?: string | number
|
||||
modelValue?: string | number
|
||||
class?: HTMLAttributes["class"]
|
||||
}>()
|
||||
|
||||
const emits = defineEmits<{
|
||||
(e: "update:modelValue", payload: string | number): void
|
||||
}>()
|
||||
|
||||
const modelValue = useVModel(props, "modelValue", emits, {
|
||||
passive: true,
|
||||
defaultValue: props.defaultValue,
|
||||
})
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<input
|
||||
v-model="modelValue"
|
||||
data-slot="input"
|
||||
:class="cn(
|
||||
'file:text-foreground placeholder:text-muted-foreground selection:bg-primary selection:text-primary-foreground dark:bg-input/30 border-input h-9 w-full min-w-0 rounded-md border bg-transparent px-3 py-1 text-base shadow-xs transition-[color,box-shadow] outline-none file:inline-flex file:h-7 file:border-0 file:bg-transparent file:text-sm file:font-medium disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50 md:text-sm',
|
||||
'focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px]',
|
||||
'aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive',
|
||||
props.class,
|
||||
)"
|
||||
>
|
||||
</template>
|
||||
1
src/components/ui/input/index.ts
Normal file
@ -0,0 +1 @@
|
||||
export { default as Input } from "./Input.vue"
|
||||
42
src/components/ui/sonner/Sonner.vue
Normal file
@ -0,0 +1,42 @@
|
||||
<script lang="ts" setup>
|
||||
import type { ToasterProps } from "vue-sonner"
|
||||
import { CircleCheckIcon, InfoIcon, Loader2Icon, OctagonXIcon, TriangleAlertIcon, XIcon } from "lucide-vue-next"
|
||||
import { Toaster as Sonner } from "vue-sonner"
|
||||
import { cn } from "@/lib/utils"
|
||||
|
||||
const props = defineProps<ToasterProps>()
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<Sonner
|
||||
:class="cn('toaster group', props.class)"
|
||||
:style="{
|
||||
'--normal-bg': 'var(--popover)',
|
||||
'--normal-text': 'var(--popover-foreground)',
|
||||
'--normal-border': 'var(--border)',
|
||||
'--border-radius': 'var(--radius)',
|
||||
}"
|
||||
v-bind="props"
|
||||
>
|
||||
<template #success-icon>
|
||||
<CircleCheckIcon class="size-4" />
|
||||
</template>
|
||||
<template #info-icon>
|
||||
<InfoIcon class="size-4" />
|
||||
</template>
|
||||
<template #warning-icon>
|
||||
<TriangleAlertIcon class="size-4" />
|
||||
</template>
|
||||
<template #error-icon>
|
||||
<OctagonXIcon class="size-4" />
|
||||
</template>
|
||||
<template #loading-icon>
|
||||
<div>
|
||||
<Loader2Icon class="size-4 animate-spin" />
|
||||
</div>
|
||||
</template>
|
||||
<template #close-icon>
|
||||
<XIcon class="size-4" />
|
||||
</template>
|
||||
</Sonner>
|
||||
</template>
|
||||
1
src/components/ui/sonner/index.ts
Normal file
@ -0,0 +1 @@
|
||||
export { default as Toaster } from "./Sonner.vue"
|
||||
7
src/lib/utils.ts
Normal file
@ -0,0 +1,7 @@
|
||||
import type { ClassValue } from "clsx"
|
||||
import { clsx } from "clsx"
|
||||
import { twMerge } from "tailwind-merge"
|
||||
|
||||
export function cn(...inputs: ClassValue[]) {
|
||||
return twMerge(clsx(inputs))
|
||||
}
|
||||
6
src/main.ts
Normal file
@ -0,0 +1,6 @@
|
||||
import { createApp } from 'vue'
|
||||
import './styles/index.css'
|
||||
import App from './App.vue'
|
||||
import '@/utils/openinstall.ts'
|
||||
|
||||
createApp(App).mount('#app')
|
||||
BIN
src/pages/Home/Liquid-button-bg.png
Normal file
|
After Width: | Height: | Size: 5.1 KiB |
BIN
src/pages/Home/bg-desktop.webp
Normal file
|
After Width: | Height: | Size: 87 KiB |
BIN
src/pages/Home/bg-mobile.webp
Normal file
|
After Width: | Height: | Size: 81 KiB |
66
src/pages/Home/components/DownloadButton.vue
Normal file
@ -0,0 +1,66 @@
|
||||
<template>
|
||||
<div class="mx-auto grid grid-cols-2 gap-[10px] md:flex md:flex-wrap">
|
||||
<template v-for="(item, index) in downloadLinks" :key="index">
|
||||
<a
|
||||
v-if="link"
|
||||
:href="item.link"
|
||||
target="_blank"
|
||||
:aria-label="item.label"
|
||||
class="lucid-glass-bar flex h-[40px] w-[140px] shrink-0 items-center space-x-2 rounded-full transition-transform hover:brightness-110 active:scale-95 md:h-[50px] md:w-[180px]"
|
||||
>
|
||||
<div class="flex items-center justify-center">
|
||||
<component :is="item.icon" class="h-[40px] w-[140px] md:h-[50px] md:w-[180px]" />
|
||||
</div>
|
||||
</a>
|
||||
<div
|
||||
v-else
|
||||
:id="item.id"
|
||||
:aria-label="item.label"
|
||||
class="lucid-glass-bar flex h-[40px] w-[140px] shrink-0 items-center space-x-2 rounded-full transition-transform hover:brightness-110 active:scale-95 md:h-[50px] md:w-[180px]"
|
||||
>
|
||||
<div class="flex items-center justify-center">
|
||||
<component :is="item.icon" class="h-[40px] w-[140px] md:h-[50px] md:w-[180px]" />
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import Icon1 from './Group 105.svg?component'
|
||||
import Icon2 from './Group 106.svg?component'
|
||||
import Icon3 from './Group 107.svg?component'
|
||||
import Icon4 from './Group 108.svg?component'
|
||||
import request from '@/utils/request'
|
||||
import {computed, ref} from "vue";
|
||||
import { getAllQuertString } from "@/utils/url-utils.ts";
|
||||
console.log(getAllQuertString('ic'));
|
||||
|
||||
const downLoadWin = ref('')
|
||||
const downLoadMac = ref('')
|
||||
request.get('/api/v1/common/client/download', {
|
||||
invite_code: getAllQuertString('ic'),
|
||||
platform: 'mac',
|
||||
}).then((res) => {
|
||||
downLoadMac.value = res.url
|
||||
})
|
||||
|
||||
request.get('/api/v1/common/client/download', {
|
||||
invite_code: getAllQuertString('ic'),
|
||||
platform: 'windows',
|
||||
}).then((res) => {
|
||||
downLoadWin.value = res.url
|
||||
})
|
||||
|
||||
|
||||
// 定义下载链接数据
|
||||
const downLoadIos = ''
|
||||
const downloadLinks = computed(() => {
|
||||
return [
|
||||
{ icon: Icon2, id: 'downloadButton_apple', label: '下载 ios 版客户端' },
|
||||
{ icon: Icon1, link: downLoadWin.value, label: '下载 Windows 版客户端' },
|
||||
{ icon: Icon3, link: downLoadMac.value, label: '下载 macOS 版客户端' },
|
||||
{ icon: Icon4, id: 'downloadButton_android', label: '下载 Android 版客户端' },
|
||||
]
|
||||
})
|
||||
</script>
|
||||
7
src/pages/Home/components/Group 105.svg
Normal file
|
After Width: | Height: | Size: 6.0 KiB |
5
src/pages/Home/components/Group 106.svg
Normal file
|
After Width: | Height: | Size: 8.3 KiB |
6
src/pages/Home/components/Group 107.svg
Normal file
|
After Width: | Height: | Size: 8.5 KiB |
14
src/pages/Home/components/Group 108.svg
Normal file
|
After Width: | Height: | Size: 8.0 KiB |
BIN
src/pages/Home/connected-bg.png
Normal file
|
After Width: | Height: | Size: 22 KiB |
BIN
src/pages/Home/connected-mobile-bg.png
Normal file
|
After Width: | Height: | Size: 6.0 KiB |
3
src/pages/Home/hiLogo.svg
Normal file
|
After Width: | Height: | Size: 5.9 KiB |
BIN
src/pages/Home/image-1.png
Normal file
|
After Width: | Height: | Size: 6.0 KiB |
182
src/pages/Home/index.vue
Normal file
@ -0,0 +1,182 @@
|
||||
<template>
|
||||
<div
|
||||
class="relative min-h-screen overflow--hidden bg-black bg-[url('@/pages/Home/bg-mobile.webp')] bg-cover bg-center bg-no-repeat pb-[calc(1rem+env(safe-area-inset-bottom))] font-sans text-white md:flex md:flex-col md:bg-[url('@/pages/Home/bg-desktop.webp')] md:pb-0"
|
||||
>
|
||||
<!-- Full Width Header -->
|
||||
<div class="h-[60px] md:h-[125px]">
|
||||
<div class="fixed top-[20px] z-50 w-full md:top-[45px]">
|
||||
<div class="container">
|
||||
<header
|
||||
class="lucid-glass-bar flex h-[40px] items-center justify-between rounded-[90px] pr-[5px] pl-5 transition-all duration-300 md:h-[60px] md:pr-[10px]"
|
||||
>
|
||||
<a href="/" class="flex items-center gap-2">
|
||||
<!-- Desktop Logo -->
|
||||
<Logo alt="Hi快VPN" class="h-[18px] w-auto md:ml-8 md:h-[29px]" />
|
||||
</a>
|
||||
|
||||
<HiLogo alt="下载Hi快VPN" class="h-[22px] w-auto mr-4 "></HiLogo>
|
||||
</header>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Main Content Container -->
|
||||
<div class="container mx-auto flex flex-1 flex-col">
|
||||
<main class="pt-10 md:grid md:flex-1 md:grid-cols-2 md:pt-0">
|
||||
<!-- Left Column: Text & Downloads -->
|
||||
<div class="md:flex md:w-[432px] md:flex-col md:justify-center">
|
||||
<div class="mb-[20px] ml-[42px] md:ml-[17px]">
|
||||
<h2 class="mb-2 text-2xl font-black md:text-8xl">
|
||||
<Logo class="h-[34px] md:h-[66px]" />
|
||||
</h2>
|
||||
<p class="font-600 text-3xl md:text-[48px]">网在我在, 网快我快</p>
|
||||
</div>
|
||||
|
||||
<!-- Screenshot Image -->
|
||||
<div class="relative z-10 mx-auto mb-9 w-full max-w-[182px] md:hidden">
|
||||
<img
|
||||
:src="ScreenshotMobile"
|
||||
alt="App Screenshot"
|
||||
class="h-auto w-full drop-shadow-2xl"
|
||||
/>
|
||||
<div class="absolute right-[8%] bottom-[97px] z-50 aspect-square w-[58%]">
|
||||
<!-- Ripple Animation (Background) -->
|
||||
<!-- <div class="ripple-container absolute inset-0 top-[7px]">
|
||||
<div class="ripple ripple-outer-3"></div>
|
||||
<div class="ripple ripple-outer-2"></div>
|
||||
<div class="ripple ripple-outer-1"></div>
|
||||
<div class="ripple ripple-core size-[80%]!"></div>
|
||||
</div>-->
|
||||
<!-- Center Image (Foreground/Top Layer) -->
|
||||
<div
|
||||
class="absolute inset-0 bottom-0 z-100 bg-[url('@/pages/Home/connected-mobile-bg.png')] bg-cover bg-center bg-no-repeat"
|
||||
></div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Download Buttons Grid -->
|
||||
<div
|
||||
class="mb-6 flex grid-cols-2 flex-wrap gap-[10px] px-[24px] md:mt-[124px] md:mb-[65px] md:ml-[17px] md:px-0"
|
||||
>
|
||||
<DownloadButton />
|
||||
</div>
|
||||
|
||||
<!-- Features / Footer Info -->
|
||||
<div
|
||||
class="mb-5 w-full text-center text-[10px] leading-5 font-[300] md:ml-[17px] md:text-left md:text-sm"
|
||||
>
|
||||
<p>最新加密协议-安全有保障</p>
|
||||
<p>IEPL专线-纯净、稳定</p>
|
||||
<p>不限速/不限流-网速多快,Hi快多快</p>
|
||||
<p>极速闪连-永远快人一步</p>
|
||||
</div>
|
||||
|
||||
<div class="mx-auto mb-1 h-[20px] w-[352px] md:ml-[17px]">
|
||||
<img src="./image-1.png" alt="image" />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Right Column: Phone Screenshot -->
|
||||
<div class="relative hidden w-full max-w-[632px] md:mt-0 md:block">
|
||||
<!-- Screenshot with Ripple Effect -->
|
||||
<div class="absolute right-[10%] bottom-0 z-50 aspect-square w-[58%] overflow-hidden">
|
||||
<!-- Ripple Animation (Background) -->
|
||||
<div class="ripple-container absolute inset-0">
|
||||
<div class="ripple ripple-outer-3"></div>
|
||||
<div class="ripple ripple-outer-2"></div>
|
||||
<div class="ripple ripple-outer-1"></div>
|
||||
<div class="ripple ripple-core"></div>
|
||||
</div>
|
||||
<!-- Center Image (Foreground/Top Layer) -->
|
||||
<div
|
||||
class="absolute inset-0 bottom-[36px] z-100 bg-[url('@/pages/Home/connected-bg.png')] bg-cover bg-center bg-no-repeat"
|
||||
></div>
|
||||
</div>
|
||||
<div class="absolute right-[2vw] bottom-0 max-w-[632px]">
|
||||
<img :src="ScreenshotDesktop" alt="App Screenshot" class="relative z-10 w-full" />
|
||||
</div>
|
||||
</div>
|
||||
</main>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { ref, onMounted, watch, computed } from 'vue'
|
||||
import LoginFormModal from './components/LoginFormModal.vue'
|
||||
import DownloadButton from './components/DownloadButton.vue'
|
||||
import Logo from './logo.svg?component'
|
||||
import HiLogo from './hiLogo.svg?component'
|
||||
import ScreenshotMobile from './screenshot-mobile.png'
|
||||
import ScreenshotDesktop from './screenshot-desktop.webp'
|
||||
|
||||
|
||||
const loginModalRef = ref<InstanceType<typeof LoginFormModal> | null>(null)
|
||||
|
||||
const openLoginModal = () => {
|
||||
loginModalRef.value?.show()
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.ripple-container {
|
||||
position: relative;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
pointer-events: none;
|
||||
z-index: 50;
|
||||
}
|
||||
|
||||
.ripple {
|
||||
position: absolute;
|
||||
top: 50%;
|
||||
left: 50%;
|
||||
transform: translate(-50%, -50%);
|
||||
border-radius: 50%;
|
||||
background: #a8ff53; /* Brand neon green */
|
||||
will-change: width, height, opacity;
|
||||
}
|
||||
|
||||
/* Core: Fixed minimum diameter (~57% of max) */
|
||||
.ripple-core {
|
||||
width: 70%;
|
||||
height: 70%;
|
||||
opacity: 1;
|
||||
z-index: 4;
|
||||
}
|
||||
|
||||
/* Outer Layer 1: Opacity 0.8, 5.4s */
|
||||
.ripple-outer-1 {
|
||||
width: 65%;
|
||||
height: 65%;
|
||||
opacity: 0.8;
|
||||
z-index: 3;
|
||||
}
|
||||
|
||||
/* Outer Layer 2: Opacity 0.6, 4.2s */
|
||||
.ripple-outer-2 {
|
||||
width: 85%;
|
||||
height: 85%;
|
||||
opacity: 0.6;
|
||||
z-index: 2;
|
||||
}
|
||||
|
||||
/* Outer Layer 3 (Outer-most): Opacity 0.4, 3s */
|
||||
.ripple-outer-3 {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
opacity: 0.4;
|
||||
z-index: 1;
|
||||
}
|
||||
|
||||
@keyframes breathe {
|
||||
0% {
|
||||
width: 57%;
|
||||
height: 57%;
|
||||
}
|
||||
100% {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
9
src/pages/Home/logo.svg
Normal file
@ -0,0 +1,9 @@
|
||||
<svg viewBox="0 0 103 29" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
<path d="M10.4016 11.4828H17.0339L19.3193 0H26.26L20.5763 28.7559H13.6144L15.8796 17.2933H9.24829L6.96193 28.7559H0L4.88123 4.20849L2.71884 0H12.6668L10.4016 11.4828Z" fill="currentColor"/>
|
||||
<path d="M29.5968 28.7559H22.6561L26.7156 8.2363H33.6708L29.5968 28.7559Z" fill="currentColor"/>
|
||||
<path fill-rule="evenodd" clip-rule="evenodd" d="M45.8974 5.31659L47.9128 6.28534L48.4606 3.90191H52.8411L53.7012 0H60.0375L59.3081 3.90191H67.3656L65.775 13.4087H67.7568L66.9216 18.8301H58.1346L65.775 24.4081L61.4983 28.7559L53.3629 22.3658L44.1319 28.7559L41.9109 26.556L41.4977 28.7559H35.4228L37.8303 16.29L33.6237 15.7134L36.7327 5.46556H39.9206L40.9768 0H46.896L45.8974 5.31659ZM42.6336 22.706L48.9036 18.8301H43.3612L42.6336 22.706ZM46.896 12.7283L44.7086 11.6538L44.3789 13.4087H51.042L52.0069 9.11375H49.4774L46.896 12.7283ZM57.4561 13.4087H59.5945L60.3768 9.11375H58.3172L57.4561 13.4087Z" fill="currentColor"/>
|
||||
<path d="M75.7576 22.3514L78.5379 15.6634H81.5884L76.1459 28.7559H73.0955L72.3103 15.6634H75.3607L75.7576 22.3514Z" fill="currentColor"/>
|
||||
<path fill-rule="evenodd" clip-rule="evenodd" d="M85.5412 15.6634C86.4527 15.6725 87.5357 15.7459 88.5464 16.0651C89.0518 16.2202 89.5124 16.4575 89.9275 16.7676C90.7578 17.3971 91.2998 18.3916 91.2999 19.9334C91.2999 21.1832 90.8303 22.4242 89.7564 23.3913C88.6734 24.3584 86.9764 24.9789 84.5215 24.9789H83.7632L83.0501 28.7559H79.9997L82.4994 15.6634H85.5412ZM84.2688 22.3331H85.027C86.7057 22.3331 88.4474 21.6942 88.4474 20.0247C88.4473 18.3279 86.6334 18.3092 85.3067 18.3092H85.0357L84.2688 22.3331Z" fill="currentColor"/>
|
||||
<path d="M98.0504 22.3149L99.3228 15.6634H102.373L99.8735 28.7559H96.8231L94.9462 22.114L93.6824 28.7559H90.6319L93.1317 15.6634H96.1821L98.0504 22.3149Z" fill="currentColor"/>
|
||||
<path d="M34.011 6.52561H27.0539L28.3407 0.0201823H35.3027L34.011 6.52561Z" fill="currentColor"/>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 1.9 KiB |
18
src/pages/Home/mobile-logo.svg
Normal file
@ -0,0 +1,18 @@
|
||||
<svg viewBox="0 0 67 28" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
<path d="M6.64761 6.43747H10.3658L11.647 0H15.5382L12.3518 16.1211H8.44879L9.71872 9.69499H6.00106L4.71928 16.1211H0.816284L3.5528 2.35936L2.34052 0H7.91754L6.64761 6.43747Z" fill="currentColor"/>
|
||||
<path d="M17.4089 16.1211H13.5177L15.7936 4.61743H19.6928L17.4089 16.1211Z" fill="currentColor"/>
|
||||
<path fill-rule="evenodd" clip-rule="evenodd" d="M26.5473 2.98059L27.6771 3.52369L27.9842 2.18749H30.4401L30.9223 0H34.4745L34.0656 2.18749H38.5828L37.6911 7.5172H38.8021L38.3339 10.5565H33.4077L37.6911 13.6837L35.2935 16.1211L30.7326 12.5387L25.5575 16.1211L24.3124 14.8879L24.0807 16.1211H20.675L22.0247 9.13249L19.6664 8.80922L21.4094 3.0641H23.1966L23.7887 0H27.1071L26.5473 2.98059ZM24.7176 12.7295L28.2326 10.5565H25.1254L24.7176 12.7295ZM27.1071 7.13574L25.8808 6.53337L25.696 7.5172H29.4314L29.9724 5.10935H28.5543L27.1071 7.13574ZM33.0273 7.5172H34.2261L34.6647 5.10935H33.5101L33.0273 7.5172Z" fill="currentColor"/>
|
||||
<path d="M43.2875 12.5306L44.8462 8.7812H46.5563L43.5052 16.1211H41.7951L41.3549 8.7812H43.065L43.2875 12.5306Z" fill="currentColor"/>
|
||||
<path fill-rule="evenodd" clip-rule="evenodd" d="M48.7724 8.7812C49.2834 8.78632 49.8905 8.82745 50.4572 9.00642C50.7405 9.09336 50.9987 9.2264 51.2314 9.40027C51.6969 9.75318 52.0008 10.3107 52.0008 11.175C52.0008 11.8757 51.7376 12.5715 51.1355 13.1136C50.5284 13.6558 49.577 14.0037 48.2007 14.0037H47.7756L47.3758 16.1211H45.6657L47.0671 8.7812H48.7724ZM48.059 12.5204H48.4841C49.4252 12.5204 50.4017 12.1622 50.4017 11.2262C50.4016 10.275 49.3847 10.2645 48.6409 10.2645H48.489L48.059 12.5204Z" fill="currentColor"/>
|
||||
<path d="M55.7853 12.5102L56.4986 8.7812H58.2088L56.8074 16.1211H55.0972L54.045 12.3976L53.3365 16.1211H51.6264L53.0278 8.7812H54.7379L55.7853 12.5102Z" fill="currentColor"/>
|
||||
<path d="M19.8835 3.65839H15.9832L16.7047 0.0113146H20.6077L19.8835 3.65839Z" fill="currentColor"/>
|
||||
<path d="M2.77626 25.5216C2.5952 25.2235 2.41414 24.9333 2.23308 24.651C1.98412 25.3412 1.6899 25.9373 1.35041 26.4392L0.852494 25.7961C1.19953 25.2471 1.48621 24.6039 1.71253 23.8824C1.41076 23.4588 1.09391 23.0431 0.777052 22.6431V27.349H0V20.3373H6.20133V26.4706C6.20133 27.0196 5.93728 27.2941 5.41673 27.2941H4.66231L4.46616 26.502L5.16023 26.5412C5.33375 26.5412 5.42428 26.4549 5.42428 26.2824V25.3961L4.9339 25.9059C4.73775 25.5451 4.54161 25.1922 4.33037 24.8471C4.05878 25.5373 3.74192 26.1255 3.3798 26.6275L2.88188 25.9843C3.25909 25.4196 3.57595 24.7765 3.83245 24.0392C3.53068 23.5765 3.21383 23.1294 2.88943 22.6902L3.37226 22.2039C3.59104 22.4706 3.83245 22.7843 4.08895 23.1608C4.21721 22.651 4.32282 22.1098 4.40581 21.5373L5.14514 21.6706C5.01689 22.5176 4.84337 23.2941 4.63214 23.9843C4.88864 24.3843 5.15269 24.8235 5.42428 25.2941V21.1216H0.777052V22.5569L1.22216 22.1098C1.44849 22.3608 1.6899 22.6588 1.9464 23.0039C2.05202 22.5333 2.14255 22.0314 2.21045 21.5137L2.93469 21.6471C2.82153 22.4314 2.67819 23.1373 2.50467 23.7804C2.76118 24.1412 3.02522 24.5412 3.29681 24.9804L2.77626 25.5216Z" fill="currentColor"/>
|
||||
<path d="M9.55095 23.6471H11.173V22.298H11.9726V23.6471H13.7003V24.4471H11.9726V26.2824H14.0247V27.0824H9.27936V26.2824H11.173V24.4471H9.55095V23.6471ZM8.23072 24.4314C8.02702 24.6353 7.81579 24.8314 7.597 25.0275L7.09154 24.3451C7.93649 23.6157 8.61547 22.7843 9.12093 21.8588H7.36313V21.0588H9.49814C9.64148 20.7137 9.76219 20.3608 9.86781 20L10.6826 20.102C10.5921 20.4314 10.4864 20.7451 10.3733 21.0588H14.0247V21.8588H10.0262C9.73956 22.4549 9.40007 23.0118 9.00777 23.5294V27.3647H8.23072V24.4314Z" fill="currentColor"/>
|
||||
<path d="M18.272 23.6471V24.4784C17.8722 24.6196 17.4573 24.7451 17.0197 24.8627V26.4549C17.0197 26.9725 16.7557 27.2392 16.2276 27.2392H15.3751L15.2016 26.4627C15.4656 26.4941 15.7146 26.5098 15.956 26.5098C16.1295 26.5098 16.22 26.4157 16.22 26.2431V25.0588C15.7825 25.1529 15.3373 25.2392 14.8696 25.3176L14.7564 24.4941C15.2695 24.4157 15.7598 24.3216 16.22 24.2196V22.8706H14.7489V22.0863H16.22V21.3569C15.8579 21.4353 15.4882 21.498 15.0959 21.5529L14.93 20.7765C15.9711 20.6588 16.9065 20.4314 17.7213 20.0863L17.9929 20.8549C17.6836 20.9725 17.3592 21.0745 17.0197 21.1686V22.0863H18.5663C18.521 21.4824 18.5059 20.8157 18.5059 20.0941H19.2981C19.3056 20.8471 19.3282 21.5059 19.3735 22.0863H21.6292V22.8706H19.4338C19.4791 23.3804 19.547 23.7961 19.63 24.1255C19.6602 24.251 19.6904 24.3608 19.7205 24.4706C20.0298 24.0706 20.3014 23.6235 20.5278 23.1373L21.2067 23.5137C20.8748 24.2196 20.4749 24.8392 20.0148 25.3569C20.0902 25.5451 20.1732 25.7098 20.2562 25.8353C20.4674 26.1804 20.6334 26.3529 20.739 26.3529C20.822 26.3529 20.905 25.9529 20.9955 25.1686L21.6971 25.5529C21.501 26.6745 21.2218 27.2392 20.8522 27.2392C20.5202 27.2392 20.1732 27.0039 19.8186 26.5412C19.6828 26.3608 19.5546 26.1569 19.4414 25.9216C18.9284 26.3608 18.355 26.7059 17.7289 26.9569L17.2913 26.2588C17.9854 25.9922 18.5964 25.6157 19.117 25.1294C19.034 24.8784 18.9586 24.6196 18.8907 24.3529C18.7775 23.9294 18.6945 23.4353 18.6342 22.8706H17.0197V24.0314C17.4573 23.9137 17.8797 23.7882 18.272 23.6471ZM20.1279 20.1647C20.656 20.5098 21.1087 20.8549 21.4859 21.2L20.9201 21.7882C20.6107 21.4431 20.1732 21.0824 19.5998 20.6902L20.1279 20.1647Z" fill="currentColor"/>
|
||||
<path d="M24.6393 23.6471H26.2613V22.298H27.061V23.6471H28.7887V24.4471H27.061V26.2824H29.1131V27.0824H24.3678V26.2824H26.2613V24.4471H24.6393V23.6471ZM23.3191 24.4314C23.1154 24.6353 22.9042 24.8314 22.6854 25.0275L22.1799 24.3451C23.0249 23.6157 23.7039 22.7843 24.2093 21.8588H22.4515V21.0588H24.5865C24.7299 20.7137 24.8506 20.3608 24.9562 20L25.771 20.102C25.6804 20.4314 25.5748 20.7451 25.4617 21.0588H29.1131V21.8588H25.1146C24.8279 22.4549 24.4885 23.0118 24.0962 23.5294V27.3647H23.3191V24.4314Z" fill="currentColor"/>
|
||||
<path d="M30.9689 25.3412C31.1726 25.3412 31.3461 25.4275 31.4819 25.6C31.6102 25.7725 31.6781 26 31.6781 26.2745C31.6781 26.6902 31.5574 27.051 31.331 27.3647C31.0972 27.6706 30.7803 27.8824 30.388 28V27.4824C30.5917 27.4039 30.7652 27.2784 30.9086 27.1059C31.0368 26.9176 31.1047 26.7373 31.1047 26.549C31.0595 26.5647 30.9991 26.5804 30.9161 26.5804C30.7501 26.5804 30.6143 26.5176 30.5012 26.4C30.388 26.2824 30.3352 26.1333 30.3352 25.9608C30.3352 25.7725 30.3956 25.6235 30.5163 25.5137C30.6294 25.3961 30.7803 25.3412 30.9689 25.3412Z" fill="currentColor"/>
|
||||
<path d="M40.4972 25.5216C40.3162 25.2235 40.1351 24.9333 39.9541 24.651C39.7051 25.3412 39.4109 25.9373 39.0714 26.4392L38.5735 25.7961C38.9205 25.2471 39.2072 24.6039 39.4335 23.8824C39.1317 23.4588 38.8149 23.0431 38.498 22.6431V27.349H37.721V20.3373H43.9223V26.4706C43.9223 27.0196 43.6583 27.2941 43.1377 27.2941H42.3833L42.1871 26.502L42.8812 26.5412C43.0547 26.5412 43.1453 26.4549 43.1453 26.2824V25.3961L42.6549 25.9059C42.4587 25.5451 42.2626 25.1922 42.0513 24.8471C41.7798 25.5373 41.4629 26.1255 41.1008 26.6275L40.6029 25.9843C40.9801 25.4196 41.2969 24.7765 41.5534 24.0392C41.2517 23.5765 40.9348 23.1294 40.6104 22.6902L41.0932 22.2039C41.312 22.4706 41.5534 22.7843 41.8099 23.1608C41.9382 22.651 42.0438 22.1098 42.1268 21.5373L42.8661 21.6706C42.7379 22.5176 42.5644 23.2941 42.3531 23.9843C42.6096 24.3843 42.8737 24.8235 43.1453 25.2941V21.1216H38.498V22.5569L38.9431 22.1098C39.1695 22.3608 39.4109 22.6588 39.6674 23.0039C39.773 22.5333 39.8635 22.0314 39.9314 21.5137L40.6557 21.6471C40.5425 22.4314 40.3992 23.1373 40.2257 23.7804C40.4822 24.1412 40.7462 24.5412 41.0178 24.9804L40.4972 25.5216Z" fill="currentColor"/>
|
||||
<path d="M47.5963 21.2H48.8487V20.0941H49.6182V21.2H51.2175V23.5451H51.7079V24.3451H49.8596C50.3047 25.2863 50.9912 26.0627 51.9116 26.6588L51.376 27.3098C50.4556 26.6118 49.7615 25.7569 49.2938 24.7373C48.9317 25.8824 48.2829 26.7373 47.3323 27.302L46.8495 26.6275C47.7397 26.149 48.3281 25.3882 48.6223 24.3451H47.2946V23.5451H48.7808C48.826 23.2314 48.8487 22.902 48.8487 22.5569V21.9608H47.5963V21.2ZM49.6182 21.9608V22.3765C49.6182 22.7843 49.588 23.1765 49.5427 23.5451H50.4631V21.9608H49.6182ZM45.069 21.6314L45.6726 21.6784C45.6575 22.4627 45.5745 23.2078 45.4387 23.9137L44.805 23.7255C44.9559 23.0667 45.0464 22.3686 45.069 21.6314ZM47.1663 21.4275C47.3625 21.9294 47.5435 22.5098 47.6944 23.1608L47.0682 23.3255C46.9551 22.7765 46.8117 22.2431 46.6307 21.7333V27.3176H45.8536V20.102H46.6307V21.6078L47.1663 21.4275Z" fill="currentColor"/>
|
||||
<path d="M55.993 23.6471V24.4784C55.5932 24.6196 55.1782 24.7451 54.7407 24.8627V26.4549C54.7407 26.9725 54.4766 27.2392 53.9485 27.2392H53.0961L52.9225 26.4627C53.1866 26.4941 53.4355 26.5098 53.6769 26.5098C53.8505 26.5098 53.941 26.4157 53.941 26.2431V25.0588C53.5034 25.1529 53.0583 25.2392 52.5906 25.3176L52.4774 24.4941C52.9904 24.4157 53.4808 24.3216 53.941 24.2196V22.8706H52.4699V22.0863H53.941V21.3569C53.5789 21.4353 53.2092 21.498 52.8169 21.5529L52.6509 20.7765C53.692 20.6588 54.6275 20.4314 55.4423 20.0863L55.7139 20.8549C55.4046 20.9725 55.0802 21.0745 54.7407 21.1686V22.0863H56.2872C56.242 21.4824 56.2269 20.8157 56.2269 20.0941H57.019C57.0266 20.8471 57.0492 21.5059 57.0945 22.0863H59.3502V22.8706H57.1548C57.2001 23.3804 57.268 23.7961 57.351 24.1255C57.3812 24.251 57.4113 24.3608 57.4415 24.4706C57.7508 24.0706 58.0224 23.6235 58.2487 23.1373L58.9277 23.5137C58.5958 24.2196 58.1959 24.8392 57.7357 25.3569C57.8112 25.5451 57.8942 25.7098 57.9771 25.8353C58.1884 26.1804 58.3544 26.3529 58.46 26.3529C58.543 26.3529 58.6259 25.9529 58.7165 25.1686L59.4181 25.5529C59.2219 26.6745 58.9428 27.2392 58.5731 27.2392C58.2412 27.2392 57.8942 27.0039 57.5396 26.5412C57.4038 26.3608 57.2755 26.1569 57.1624 25.9216C56.6494 26.3608 56.076 26.7059 55.4498 26.9569L55.0123 26.2588C55.7063 25.9922 56.3174 25.6157 56.838 25.1294C56.755 24.8784 56.6795 24.6196 56.6116 24.3529C56.4985 23.9294 56.4155 23.4353 56.3551 22.8706H54.7407V24.0314C55.1782 23.9137 55.6007 23.7882 55.993 23.6471ZM57.8489 20.1647C58.377 20.5098 58.8296 20.8549 59.2068 21.2L58.641 21.7882C58.3317 21.4431 57.8942 21.0824 57.3208 20.6902L57.8489 20.1647Z" fill="currentColor"/>
|
||||
<path d="M62.6847 21.2H63.9371V20.0941H64.7066V21.2H66.3059V23.5451H66.7963V24.3451H64.948C65.3931 25.2863 66.0796 26.0627 67 26.6588L66.4644 27.3098C65.544 26.6118 64.8499 25.7569 64.3822 24.7373C64.02 25.8824 63.3712 26.7373 62.4207 27.302L61.9378 26.6275C62.8281 26.149 63.4165 25.3882 63.7107 24.3451H62.383V23.5451H63.8692C63.9144 23.2314 63.9371 22.902 63.9371 22.5569V21.9608H62.6847V21.2ZM64.7066 21.9608V22.3765C64.7066 22.7843 64.6764 23.1765 64.6311 23.5451H65.5515V21.9608H64.7066ZM60.1574 21.6314L60.761 21.6784C60.7459 22.4627 60.6629 23.2078 60.5271 23.9137L59.8934 23.7255C60.0443 23.0667 60.1348 22.3686 60.1574 21.6314ZM62.2547 21.4275C62.4509 21.9294 62.6319 22.5098 62.7828 23.1608L62.1566 23.3255C62.0435 22.7765 61.9001 22.2431 61.7191 21.7333V27.3176H60.942V20.102H61.7191V21.6078L62.2547 21.4275Z" fill="currentColor"/>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 11 KiB |
BIN
src/pages/Home/screenshot-desktop.webp
Normal file
|
After Width: | Height: | Size: 149 KiB |
BIN
src/pages/Home/screenshot-mobile.png
Normal file
|
After Width: | Height: | Size: 84 KiB |
BIN
src/pages/Home/x-logo.png
Normal file
|
After Width: | Height: | Size: 2.0 KiB |
186
src/styles/index.css
Normal file
@ -0,0 +1,186 @@
|
||||
@font-face {
|
||||
font-family: 'Roboto';
|
||||
src: url('/src/styles/roboto.woff2') format('woff2');
|
||||
font-weight: 100 900;
|
||||
font-style: normal;
|
||||
font-display: swap;
|
||||
}
|
||||
html, body {
|
||||
background: #000;
|
||||
}
|
||||
.lucid-glass-bar {
|
||||
/* 基础背景:Figma 中通常是叠加的,这里取中值确保通透度 */
|
||||
background: rgb(255 255 255 / 6%);
|
||||
|
||||
/* 核心模糊 */
|
||||
@apply backdrop-blur-[36px];
|
||||
|
||||
/* 圆角:由于你有 border-image,建议使用这种方式保留圆角 */
|
||||
border-radius: 999px;
|
||||
|
||||
/* 边框:Figma 的 border-image 在 CSS 圆角容器上会有兼容问题
|
||||
建议改用单纯的 border 配合 rgba 以达到线性渐变的效果 */
|
||||
border: 1px solid rgba(255, 255, 255, 0.2);
|
||||
|
||||
/* 阴影叠加:按照 Figma 从上到下的顺序转换 */
|
||||
box-shadow:
|
||||
/* 1. 这里的 #F2F2F280 33px 扩散是导致发白的主因,建议将其放在最底层并调低不透明度 */
|
||||
inset 0px 0px 33px 0px rgba(242, 242, 242, 0.15),
|
||||
|
||||
/* 2. 右下角的反向高光 (原本的 -3px -4.5px) */
|
||||
inset 0px -2px 1.5px -3px rgba(179, 179, 179, 0.5),
|
||||
|
||||
/* 3. 左上角的微弱亮边 */
|
||||
inset 3px 4.5px 1.5px -3px rgba(179, 179, 179, 0.2),
|
||||
|
||||
/* 4. 核心受光面 (Figma: 4.5px 4.5px #FFFFFF80) */
|
||||
inset 4.5px 4.5px 1.5px -5.25px rgba(255, 255, 255, 0.4),
|
||||
|
||||
/* 5. 核心背光面 (Figma: -4.5px -4.5px #FFFFFF80) */
|
||||
inset -4.5px -4.5px 1.5px -5.25px rgba(255, 255, 255, 0.3);
|
||||
}
|
||||
|
||||
@import "tailwindcss";
|
||||
@import "tw-animate-css";
|
||||
|
||||
@layer components {
|
||||
.container {
|
||||
width: 100%;
|
||||
margin-left: auto;
|
||||
margin-right: auto;
|
||||
|
||||
/* 1. 移动端默认:左右 18px 边距 */
|
||||
padding-left: 18px;
|
||||
padding-right: 18px;
|
||||
|
||||
/* 2. 桌面端逻辑:当屏幕达到 1440px 及以上 */
|
||||
@media (width >= 1440px) {
|
||||
/* 计算公式:
|
||||
内容区固定为 1268px
|
||||
侧边留白 = (1440 - 1268) / 2 = 86px
|
||||
*/
|
||||
max-width: 1268px;
|
||||
|
||||
/* 此时 padding 可以设为 0,因为 max-width 配合 margin: auto 已经产生了 86px 的留白 */
|
||||
padding-left: 0;
|
||||
padding-right: 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
@custom-variant dark (&:is(.dark *));
|
||||
|
||||
@theme inline {
|
||||
--radius-sm: calc(var(--radius) - 4px);
|
||||
--radius-md: calc(var(--radius) - 2px);
|
||||
--radius-lg: var(--radius);
|
||||
--radius-xl: calc(var(--radius) + 4px);
|
||||
--color-background: var(--background);
|
||||
--color-foreground: var(--foreground);
|
||||
--color-card: var(--card);
|
||||
--color-card-foreground: var(--card-foreground);
|
||||
--color-popover: var(--popover);
|
||||
--color-popover-foreground: var(--popover-foreground);
|
||||
--color-primary: var(--primary);
|
||||
--color-primary-foreground: var(--primary-foreground);
|
||||
--color-secondary: var(--secondary);
|
||||
--color-secondary-foreground: var(--secondary-foreground);
|
||||
--color-muted: var(--muted);
|
||||
--color-muted-foreground: var(--muted-foreground);
|
||||
--color-accent: var(--accent);
|
||||
--color-accent-foreground: var(--accent-foreground);
|
||||
--color-destructive: var(--destructive);
|
||||
--color-border: var(--border);
|
||||
--color-input: var(--input);
|
||||
--color-ring: var(--ring);
|
||||
--color-chart-1: var(--chart-1);
|
||||
--color-chart-2: var(--chart-2);
|
||||
--color-chart-3: var(--chart-3);
|
||||
--color-chart-4: var(--chart-4);
|
||||
--color-chart-5: var(--chart-5);
|
||||
--color-sidebar: var(--sidebar);
|
||||
--color-sidebar-foreground: var(--sidebar-foreground);
|
||||
--color-sidebar-primary: var(--sidebar-primary);
|
||||
--color-sidebar-primary-foreground: var(--sidebar-primary-foreground);
|
||||
--color-sidebar-accent: var(--sidebar-accent);
|
||||
--color-sidebar-accent-foreground: var(--sidebar-accent-foreground);
|
||||
--color-sidebar-border: var(--sidebar-border);
|
||||
--color-sidebar-ring: var(--sidebar-ring);
|
||||
}
|
||||
|
||||
:root {
|
||||
--radius: 0.625rem;
|
||||
--background: oklch(1 0 0);
|
||||
--foreground: oklch(0.145 0 0);
|
||||
--card: oklch(1 0 0);
|
||||
--card-foreground: oklch(0.145 0 0);
|
||||
--popover: oklch(1 0 0);
|
||||
--popover-foreground: oklch(0.145 0 0);
|
||||
--primary: oklch(0.205 0 0);
|
||||
--primary-foreground: oklch(0.985 0 0);
|
||||
--secondary: oklch(0.97 0 0);
|
||||
--secondary-foreground: oklch(0.205 0 0);
|
||||
--muted: oklch(0.97 0 0);
|
||||
--muted-foreground: oklch(0.556 0 0);
|
||||
--accent: oklch(0.97 0 0);
|
||||
--accent-foreground: oklch(0.205 0 0);
|
||||
--destructive: oklch(0.577 0.245 27.325);
|
||||
--border: oklch(0.922 0 0);
|
||||
--input: oklch(0.922 0 0);
|
||||
--ring: oklch(0.708 0 0);
|
||||
--chart-1: oklch(0.646 0.222 41.116);
|
||||
--chart-2: oklch(0.6 0.118 184.704);
|
||||
--chart-3: oklch(0.398 0.07 227.392);
|
||||
--chart-4: oklch(0.828 0.189 84.429);
|
||||
--chart-5: oklch(0.769 0.188 70.08);
|
||||
--sidebar: oklch(0.985 0 0);
|
||||
--sidebar-foreground: oklch(0.145 0 0);
|
||||
--sidebar-primary: oklch(0.205 0 0);
|
||||
--sidebar-primary-foreground: oklch(0.985 0 0);
|
||||
--sidebar-accent: oklch(0.97 0 0);
|
||||
--sidebar-accent-foreground: oklch(0.205 0 0);
|
||||
--sidebar-border: oklch(0.922 0 0);
|
||||
--sidebar-ring: oklch(0.708 0 0);
|
||||
}
|
||||
|
||||
.dark {
|
||||
--background: oklch(0.145 0 0);
|
||||
--foreground: oklch(0.985 0 0);
|
||||
--card: oklch(0.205 0 0);
|
||||
--card-foreground: oklch(0.985 0 0);
|
||||
--popover: oklch(0.205 0 0);
|
||||
--popover-foreground: oklch(0.985 0 0);
|
||||
--primary: oklch(0.922 0 0);
|
||||
--primary-foreground: oklch(0.205 0 0);
|
||||
--secondary: oklch(0.269 0 0);
|
||||
--secondary-foreground: oklch(0.985 0 0);
|
||||
--muted: oklch(0.269 0 0);
|
||||
--muted-foreground: oklch(0.708 0 0);
|
||||
--accent: oklch(0.269 0 0);
|
||||
--accent-foreground: oklch(0.985 0 0);
|
||||
--destructive: oklch(0.704 0.191 22.216);
|
||||
--border: oklch(1 0 0 / 10%);
|
||||
--input: oklch(1 0 0 / 15%);
|
||||
--ring: oklch(0.556 0 0);
|
||||
--chart-1: oklch(0.488 0.243 264.376);
|
||||
--chart-2: oklch(0.696 0.17 162.48);
|
||||
--chart-3: oklch(0.769 0.188 70.08);
|
||||
--chart-4: oklch(0.627 0.265 303.9);
|
||||
--chart-5: oklch(0.645 0.246 16.439);
|
||||
--sidebar: oklch(0.205 0 0);
|
||||
--sidebar-foreground: oklch(0.985 0 0);
|
||||
--sidebar-primary: oklch(0.488 0.243 264.376);
|
||||
--sidebar-primary-foreground: oklch(0.985 0 0);
|
||||
--sidebar-accent: oklch(0.269 0 0);
|
||||
--sidebar-accent-foreground: oklch(0.985 0 0);
|
||||
--sidebar-border: oklch(1 0 0 / 10%);
|
||||
--sidebar-ring: oklch(0.556 0 0);
|
||||
}
|
||||
|
||||
@layer base {
|
||||
* {
|
||||
@apply border-border outline-ring/50;
|
||||
}
|
||||
body {
|
||||
@apply bg-background text-foreground;
|
||||
}
|
||||
}
|
||||
BIN
src/styles/roboto.woff2
Normal file
7
src/utils/constant.ts
Normal file
@ -0,0 +1,7 @@
|
||||
// utils/constant.ts
|
||||
const BASE_URL = window.location.origin // 自动获取当前域名
|
||||
|
||||
export const downLoadAndroid = `${BASE_URL}/download/app-arm64-v8a-release.apk`
|
||||
export const downLoadMac = `${BASE_URL}/download/HiFastVPN-1.0.0+100-macos.dmg`
|
||||
export const downLoadWin = `${BASE_URL}/download/HiFastVPN-0.0.2-windows-setup.exe`
|
||||
export const downLoadIos = 'https://apps.apple.com/us/app/hi%E5%BF%ABvpn/id6755683167'
|
||||
72
src/utils/openinstall.ts
Normal file
@ -0,0 +1,72 @@
|
||||
import { getAllQuertString } from '@/utils/url-utils.ts'
|
||||
|
||||
/**
|
||||
* OpenInstall sdk 用于上报h5邀请参数
|
||||
* 自动注册openinstall sdk 挂在到window对象上 通过window.OI_SDK访问
|
||||
* sdk初始化时会自动检索url上的参数并作为拉起下载或唤醒app时的参数
|
||||
*/
|
||||
const script = document.createElement('script')
|
||||
script.type = 'text/javascript'
|
||||
script.charset = 'UTF-8'
|
||||
script.src = 'https://web.cdn.openinstall.io/openinstall.js'
|
||||
document.head.appendChild(script)
|
||||
|
||||
script.addEventListener('load', () => {
|
||||
window.OI_SDK = new OpenInstallSdk()
|
||||
})
|
||||
|
||||
class OpenInstallSdk {
|
||||
public urlQuery: any // openinstall.js中提供的api,解析当前网页url中的查询参数并对data进行赋值
|
||||
|
||||
public OI: Record<string, any> // openinstall 实例
|
||||
|
||||
constructor() {
|
||||
this.OI = {}
|
||||
this.urlQuery = window.OpenInstall.parseUrlParams()
|
||||
const id = getAllQuertString('id')
|
||||
if (id) {
|
||||
this.urlQuery = {
|
||||
platform: 'merchant',
|
||||
code: id,
|
||||
}
|
||||
}
|
||||
this.init()
|
||||
}
|
||||
|
||||
async init() {
|
||||
try {
|
||||
this.OI = new window.OpenInstall({
|
||||
appKey: 'alf57p',
|
||||
onready: function () { // 初始化成功回调方法。当初始化完成后,会自动进入
|
||||
this.schemeWakeup()// 尝试使用scheme打开App(主要用于Android以及iOS的QQ环境中)
|
||||
const m = this
|
||||
const button = document.getElementById('downloadButton_apple')
|
||||
const button1 = document.getElementById('downloadButton_android')
|
||||
const ic = getAllQuertString('ic')
|
||||
if (button) {
|
||||
button.onclick = function () {
|
||||
if (ic) {
|
||||
m.wakeupOrInstall({ data: { platform: 'download', inviteCode: ic } })
|
||||
} else {
|
||||
m.wakeupOrInstall()// 此方法为scheme、Universal Link唤醒以及引导下载的作用(必须调用且不可额外自行跳转下载)
|
||||
}
|
||||
return false
|
||||
}
|
||||
}
|
||||
if (button1) {
|
||||
button1.onclick = function () {
|
||||
if (ic) {
|
||||
m.wakeupOrInstall({ data: { platform: 'download', inviteCode: ic } })
|
||||
} else {
|
||||
m.wakeupOrInstall()// 此方法为scheme、Universal Link唤醒以及引导下载的作用(必须调用且不可额外自行跳转下载)
|
||||
}
|
||||
return false
|
||||
}
|
||||
}
|
||||
},
|
||||
}, this.urlQuery)// 初始化时传入data,作为一键拉起/App传参安装时候的参数
|
||||
} catch (e) {
|
||||
console.log(e, 'OpenInstall——sdk初始化失败')
|
||||
}
|
||||
}
|
||||
}
|
||||
58
src/utils/request/cancel.ts
Normal file
@ -0,0 +1,58 @@
|
||||
import type { AxiosRequestConfig, Canceler } from 'axios'
|
||||
import axios from 'axios'
|
||||
|
||||
// Used to store the identification and cancellation function of each request
|
||||
let pendingMap = new Map<string, Canceler>()
|
||||
|
||||
const getPendingUrl = (config: AxiosRequestConfig) => [config.method, config.url].join('&')
|
||||
|
||||
export class AxiosCanceler {
|
||||
/**
|
||||
* Add request
|
||||
* @param {Object} config
|
||||
*/
|
||||
addPending(config: AxiosRequestConfig): void {
|
||||
this.removePending(config)
|
||||
const url = getPendingUrl(config)
|
||||
config.cancelToken = config.cancelToken
|
||||
|| new axios.CancelToken((cancel) => {
|
||||
if (!pendingMap.has(url)) {
|
||||
// If there is no current request in pending, add it
|
||||
pendingMap.set(url, cancel)
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* @description: Clear all pending
|
||||
*/
|
||||
removeAllPending(): void {
|
||||
pendingMap.forEach((cancel) => {
|
||||
cancel?.()
|
||||
})
|
||||
pendingMap.clear()
|
||||
}
|
||||
|
||||
/**
|
||||
* Removal request
|
||||
* @param {Object} config
|
||||
*/
|
||||
removePending(config: AxiosRequestConfig): void {
|
||||
const url = getPendingUrl(config)
|
||||
|
||||
if (pendingMap.has(url)) {
|
||||
// If there is a current request identifier in pending,
|
||||
// the current request needs to be cancelled and removed
|
||||
const cancel = pendingMap.get(url)
|
||||
cancel && cancel(url)
|
||||
pendingMap.delete(url)
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @description: reset
|
||||
*/
|
||||
reset(): void {
|
||||
pendingMap = new Map<string, Canceler>()
|
||||
}
|
||||
}
|
||||
269
src/utils/request/core.ts
Normal file
@ -0,0 +1,269 @@
|
||||
import type { AxiosInstance, AxiosRequestConfig, AxiosResponse } from 'axios'
|
||||
import axios from 'axios'
|
||||
import { AxiosCanceler } from './cancel'
|
||||
import { toast } from 'vue-sonner'
|
||||
export interface ExtraConfig {
|
||||
/**
|
||||
* 默认值 1 错误等级 0-忽略,1-warning,2-error
|
||||
*/
|
||||
errorLevel?: 0 | 1 | 2
|
||||
/**
|
||||
* 默认true 是否携带token
|
||||
*/
|
||||
withToken?: boolean
|
||||
/**
|
||||
* 默认true 是否处理响应
|
||||
*/
|
||||
handleResponse?: boolean
|
||||
/**
|
||||
* 默认false 是否取消重复请求
|
||||
*/
|
||||
cancelRepetition?: boolean
|
||||
/**
|
||||
* 默认false 是否返回axios完整响应
|
||||
*/
|
||||
originResponseData?: boolean
|
||||
/**
|
||||
* 默认token 存储key
|
||||
*/
|
||||
tokenKey?: string
|
||||
/**
|
||||
* 获取token的方法
|
||||
*/
|
||||
getToken?: () => string
|
||||
/**
|
||||
* 自定义header方法,此方法返回的header会覆盖默认的header
|
||||
*/
|
||||
formatHeader?: (header: Record<string, string>) => Record<string, string>
|
||||
}
|
||||
|
||||
export interface RequestConfig extends AxiosRequestConfig {
|
||||
extraConfig?: ExtraConfig
|
||||
}
|
||||
|
||||
interface ResponseType extends AxiosResponse {
|
||||
config: RequestConfig
|
||||
}
|
||||
|
||||
const ERROR_MESSAGES: Record<number | string, string> = {
|
||||
'200': '成功',
|
||||
'500': '内部服务器错误',
|
||||
'10001': '数据库查询错误',
|
||||
'10002': '数据库更新错误',
|
||||
'10003': '数据库插入错误',
|
||||
'10004': '数据库删除错误',
|
||||
'20001': '用户已存在',
|
||||
'20002': '用户不存在',
|
||||
'20003': '用户密码错误',
|
||||
'20004': '用户已禁用',
|
||||
'20005': '余额不足',
|
||||
'20006': '停止注册',
|
||||
'20007': '未绑定Telegram',
|
||||
'20008': '用户未绑定OAuth方式',
|
||||
'20009': '邀请码错误',
|
||||
'30001': '节点已存在',
|
||||
'30002': '节点不存在',
|
||||
'30003': '节点组已存在',
|
||||
'30004': '节点组不存在',
|
||||
'30005': '节点组不为空',
|
||||
'400': '参数错误',
|
||||
'40002': '用户令牌为空',
|
||||
'40003': '用户令牌无效',
|
||||
'40004': '用户令牌已过期',
|
||||
'40005': '您还没有登录',
|
||||
'401': '请求过多',
|
||||
'50001': '优惠券不存在',
|
||||
'50002': '优惠券已被使用',
|
||||
'50003': '优惠券不匹配',
|
||||
'60001': '订阅已过期',
|
||||
'60002': '订阅不可用',
|
||||
'60003': '用户已有订阅',
|
||||
'60004': '订阅已被使用',
|
||||
'60005': '单一订阅模式超出限制',
|
||||
'60006': '订阅配额限制',
|
||||
'70001': '验证码错误',
|
||||
'80001': '队列入队错误',
|
||||
'90001': '调试模式已启用',
|
||||
'90002': '发送短信错误',
|
||||
'90003': '短信功能未启用',
|
||||
'90004': '电子邮件功能未启用',
|
||||
'90005': '不支持的登录方式',
|
||||
'90006': '身份验证器不支持此方式',
|
||||
'90007': '电话区号为空',
|
||||
'90008': '密码为空',
|
||||
'90009': '区号为空',
|
||||
'90010': '需要密码或验证码',
|
||||
'90011': '电子邮件已存在',
|
||||
'90012': '电话号码已存在',
|
||||
'90013': '设备已存在',
|
||||
'90014': '电话号码错误',
|
||||
'90015': '此账户今日已达到发送次数限制',
|
||||
'90017': '设备不存在',
|
||||
'90018': '用户 ID 不匹配',
|
||||
'61001': '订单不存在',
|
||||
'61002': '支付方式未找到',
|
||||
'61003': '订单状态错误',
|
||||
'61004': '重置周期不足',
|
||||
'61005': '存在没用完的流量',
|
||||
}
|
||||
|
||||
export default class Request {
|
||||
public axiosInstance: AxiosInstance
|
||||
|
||||
private config: RequestConfig
|
||||
|
||||
constructor(config: RequestConfig) {
|
||||
this.config = config
|
||||
this.axiosInstance = axios.create(config)
|
||||
this.init()
|
||||
}
|
||||
|
||||
static defaultConfig: Required<ExtraConfig> = {
|
||||
errorLevel: 2,
|
||||
withToken: true,
|
||||
handleResponse: true,
|
||||
cancelRepetition: false,
|
||||
originResponseData: false,
|
||||
tokenKey: 'token',
|
||||
formatHeader: (headers) => {
|
||||
return headers
|
||||
},
|
||||
getToken: () => '',
|
||||
}
|
||||
|
||||
private errorReport(lv: number, message: string) {
|
||||
toast(message)
|
||||
}
|
||||
|
||||
private init() {
|
||||
const axiosCanceler = new AxiosCanceler()
|
||||
|
||||
this.axiosInstance.interceptors.request.use(
|
||||
(config: RequestConfig) => {
|
||||
const mergeExtraConfig = {
|
||||
...Request.defaultConfig,
|
||||
...this.config.extraConfig,
|
||||
...config.extraConfig,
|
||||
}
|
||||
|
||||
// if (config.data && !(config.data instanceof FormData)) {
|
||||
// const plainText = JSON.stringify(config.data)
|
||||
// config.data = HiAesUtil.encryptData(plainText, encryptionKey)
|
||||
// }
|
||||
//
|
||||
// if (config.method?.toLowerCase() === 'get' || config.params) {
|
||||
// const paramsToEncrypt = config.params || {}
|
||||
// const plainParamsText = JSON.stringify(paramsToEncrypt)
|
||||
// const encryptedParams = HiAesUtil.encryptData(plainParamsText, encryptionKey)
|
||||
//
|
||||
// config.params = {
|
||||
// data: encryptedParams.data,
|
||||
// time: encryptedParams.time,
|
||||
// }
|
||||
// }
|
||||
|
||||
config.headers = mergeExtraConfig.formatHeader({
|
||||
...this.config.headers,
|
||||
...config.headers,
|
||||
lang: 'zh_CN',
|
||||
// 'login-type': 'device',
|
||||
...(mergeExtraConfig.withToken && {
|
||||
[mergeExtraConfig.tokenKey]: mergeExtraConfig.getToken(),
|
||||
}),
|
||||
} as any)
|
||||
config.extraConfig = mergeExtraConfig
|
||||
if (mergeExtraConfig.cancelRepetition) {
|
||||
axiosCanceler.addPending(config)
|
||||
}
|
||||
return config
|
||||
},
|
||||
(error) => {
|
||||
this.errorReport(error?.config.extraConfig.errorLevel, error)
|
||||
return Promise.reject(error)
|
||||
},
|
||||
)
|
||||
|
||||
this.axiosInstance.interceptors.response.use(
|
||||
(response: ResponseType) => {
|
||||
const { data, config } = response
|
||||
const responseData = response.data.data
|
||||
|
||||
// if (responseData && responseData.data && responseData.time) {
|
||||
// try {
|
||||
// const decryptedStr = HiAesUtil.decryptData(
|
||||
// responseData.data,
|
||||
// responseData.time,
|
||||
// encryptionKey,
|
||||
// )
|
||||
// responseData = JSON.parse(decryptedStr)
|
||||
// } catch (e) {
|
||||
// console.error('解密失败:', e)
|
||||
// return Promise.reject({ message: '数据解密异常' })
|
||||
// }
|
||||
// }
|
||||
axiosCanceler.removePending(config)
|
||||
|
||||
if (data.code !== 200) {
|
||||
const msg = ERROR_MESSAGES[data.code] || response.data?.msg || data?.error || '未知错误'
|
||||
if (data.code == 40004 || data.code == 40003 || data.code == 40005) {
|
||||
toast.error(msg)
|
||||
return
|
||||
}
|
||||
|
||||
if (config.extraConfig?.handleResponse) {
|
||||
this.errorReport(config.extraConfig.errorLevel ?? 2, msg)
|
||||
return Promise.reject({
|
||||
...data,
|
||||
message: msg,
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
return config.extraConfig?.originResponseData ? response : responseData
|
||||
},
|
||||
(error) => {
|
||||
const status = error?.response?.status
|
||||
const code = error?.code
|
||||
let message = error?.message
|
||||
if (status === 401) {
|
||||
return
|
||||
}
|
||||
if (code === 'ECONNABORTED') {
|
||||
message = '网络环境太差,请求超时'
|
||||
} else if (code === 'Network Error' || message === 'Network Error') {
|
||||
if (error.response) {
|
||||
message = `${error.response.status}:network连接失败,请求中断`
|
||||
} else {
|
||||
message = '网络好像出现问题了'
|
||||
}
|
||||
}
|
||||
if (error.__CANCEL__) {
|
||||
console.warn('request canceled', error?.message)
|
||||
} else {
|
||||
this.errorReport(error?.config?.extraConfig?.errorLevel, message)
|
||||
}
|
||||
return Promise.reject(error)
|
||||
},
|
||||
)
|
||||
}
|
||||
|
||||
public get<T>(url: string, params?: Record<string, unknown>, config?: RequestConfig): Promise<T> {
|
||||
return this.axiosInstance.get(url, { ...config, params })
|
||||
}
|
||||
|
||||
public post<D, T>(url: string, data?: D, config?: RequestConfig): Promise<T> {
|
||||
return this.axiosInstance.post(url, data, { ...config })
|
||||
}
|
||||
|
||||
public put<D, T>(url: string, data?: D, config?: RequestConfig): Promise<T> {
|
||||
return this.axiosInstance.put(url, data, { ...config })
|
||||
}
|
||||
|
||||
public patch<D, T>(url: string, data?: D, config?: RequestConfig): Promise<T> {
|
||||
return this.axiosInstance.patch(url, data, { ...config })
|
||||
}
|
||||
|
||||
public delete<D, T>(url: string, params?: D, config?: RequestConfig): Promise<T> {
|
||||
return this.axiosInstance.delete(url, { ...config, params })
|
||||
}
|
||||
}
|
||||
16
src/utils/request/index.ts
Normal file
@ -0,0 +1,16 @@
|
||||
import Request from './core'
|
||||
export * from './core'
|
||||
const baseUrl = import.meta.env.VITE_APP_BASE_URL
|
||||
|
||||
const request = new Request({
|
||||
baseURL: baseUrl,
|
||||
timeout: 6000,
|
||||
headers: {},
|
||||
extraConfig: {
|
||||
/** 这里是核心配置,一般不需要再去修改request/core.ts */
|
||||
tokenKey: 'Authorization',
|
||||
getToken: () => localStorage.getItem('Authorization') || '',
|
||||
},
|
||||
})
|
||||
|
||||
export default request
|
||||
157
src/utils/url-utils.ts
Normal file
@ -0,0 +1,157 @@
|
||||
/**
|
||||
* 拼接参数
|
||||
* @param {Object} data
|
||||
*/
|
||||
export const param = data => {
|
||||
if (!data) {
|
||||
return ''
|
||||
}
|
||||
|
||||
let url = ''
|
||||
for (const k in data) {
|
||||
const value = data[k] !== undefined ? data[k] : ''
|
||||
url += `&${k}=${encodeURIComponent(value)}`
|
||||
}
|
||||
return url ? url.substr(1) : ''
|
||||
}
|
||||
/**
|
||||
* 拼接参数,处理对象类型数据
|
||||
*/
|
||||
export const paramToObj = data => {
|
||||
if (!data) {
|
||||
return ''
|
||||
}
|
||||
let url = ''
|
||||
for (const k in data) {
|
||||
const value = data[k] !== undefined ? data[k] : ''
|
||||
if (typeof value === 'object') {
|
||||
url += `&${k}=${encodeURIComponent(JSON.stringify(value))}`
|
||||
} else {
|
||||
url += `&${k}=${encodeURIComponent(value)}`
|
||||
}
|
||||
}
|
||||
return url ? url.substr(1) : ''
|
||||
}
|
||||
|
||||
/**
|
||||
* 为了获取微信登录的code
|
||||
* @param {string} name
|
||||
*/
|
||||
export const getQueryString = name => {
|
||||
const reg = `(^|&)${name}=([^&]*)(&|$)`
|
||||
const query = window.location.search.substr(1) || window.location.hash.split('?')[1]
|
||||
const r = query ? query.match(reg) : null
|
||||
if (r != null) return decodeURIComponent(r[2])
|
||||
return null
|
||||
}
|
||||
|
||||
/**
|
||||
* 为了获取URL上的值
|
||||
* @param {*} name 需要获取的key
|
||||
* @param {*} isMerge 是否合并hash和search,search优先级高
|
||||
*/
|
||||
export const getAllQuertString = (name, isMerge = true) => {
|
||||
const reg = `(?:^|&)${name}=([^&]*)(?:&|$)`
|
||||
const search = window.location.search.substr(1)
|
||||
const hash = window.location.hash.split('?')[1]
|
||||
const searchR = search ? search.match(reg) && search.match(reg)![1] : null
|
||||
const hashR = hash ? hash.match(reg) && hash.match(reg)![1] : null
|
||||
if (isMerge) {
|
||||
const result = searchR || hashR
|
||||
return result ? unescape(result) : null
|
||||
}
|
||||
return {
|
||||
search: searchR ? unescape(searchR) : null,
|
||||
hash: hashR ? unescape(hashR) : null,
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 授权时把所有参数进行筛选,防止二次授权存在多个code情况
|
||||
* @param {string} url
|
||||
*/
|
||||
export function parseURL(url) {
|
||||
const a = document.createElement('a')
|
||||
a.href = url
|
||||
const protocol = a.protocol.replace(':', '')
|
||||
const host = a.hostname
|
||||
const path = a.pathname.replace(/^([^\/])/, '/$1')
|
||||
return {
|
||||
href: `${protocol}://${host}${path}?`,
|
||||
source: url,
|
||||
protocol,
|
||||
host,
|
||||
port: a.port,
|
||||
query: a.search,
|
||||
params: (function () {
|
||||
const params = {}
|
||||
const seg = a.search.replace(/^\?/, '').split('&')
|
||||
const len = seg.length
|
||||
let p
|
||||
for (let i = 0; i < len; i++) {
|
||||
if (seg[i]) {
|
||||
p = seg[i].split('=')
|
||||
params[p[0]] = p[1]
|
||||
}
|
||||
}
|
||||
return params
|
||||
}()),
|
||||
hash: a.hash.replace('#', ''),
|
||||
path,
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取url query对象
|
||||
*/
|
||||
export function urlGetParam() {
|
||||
const t = location.search
|
||||
.substring(1)
|
||||
.split('&')
|
||||
.filter(item => !!item)
|
||||
const f = {}
|
||||
for (let i = 0; i < t.length; i++) {
|
||||
const x = t[i].split('=')
|
||||
f[x[0]] = x[1]
|
||||
}
|
||||
return f
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除地址参数
|
||||
* @param {array} removes 需要删除的参数
|
||||
* @param {boolean} hash 返回的链接是否拼上hash值
|
||||
*/
|
||||
export function removeUrlQuery(removes, isHash = false) {
|
||||
const currentParam = urlGetParam()
|
||||
removes.forEach(removeItem => {
|
||||
delete currentParam[removeItem]
|
||||
})
|
||||
return `${location.origin}${location.pathname}?${param(currentParam)}${
|
||||
isHash ? location.hash : ''
|
||||
}`
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取链接上的keyValue
|
||||
*/
|
||||
export function hrefKeyValue(key, url) {
|
||||
const reg = new RegExp(/(\w+)=(\w+)/, 'gi')
|
||||
const currentUrl = url || location.href
|
||||
const results = currentUrl.match(reg)
|
||||
if (results) {
|
||||
const resultKeyValues = results.map(o => ({
|
||||
[o.split('=')[0]]: o.split('=')[1],
|
||||
}))
|
||||
const result = resultKeyValues.find(o => o.hasOwnProperty(key))
|
||||
return (result && result[key]) || null
|
||||
}
|
||||
return null
|
||||
}
|
||||
/**
|
||||
* 替换url中的参数
|
||||
*/
|
||||
export function replaceQueryString(url, name, value) {
|
||||
const re = new RegExp(name + '=[^&]*', 'gi')
|
||||
return url.replace(re, name + '=' + value)
|
||||
}
|
||||
16
tsconfig.app.json
Normal file
@ -0,0 +1,16 @@
|
||||
{
|
||||
"extends": "@vue/tsconfig/tsconfig.dom.json",
|
||||
"compilerOptions": {
|
||||
"tsBuildInfoFile": "./node_modules/.tmp/tsconfig.app.tsbuildinfo",
|
||||
"types": ["vite/client"],
|
||||
|
||||
/* Linting */
|
||||
"strict": true,
|
||||
"noUnusedLocals": true,
|
||||
"noUnusedParameters": true,
|
||||
"erasableSyntaxOnly": true,
|
||||
"noFallthroughCasesInSwitch": true,
|
||||
"noUncheckedSideEffectImports": true
|
||||
},
|
||||
"include": ["src/**/*.ts", "src/**/*.tsx", "src/**/*.vue"]
|
||||
}
|
||||
18
tsconfig.json
Normal file
@ -0,0 +1,18 @@
|
||||
{
|
||||
"files": [],
|
||||
"references": [
|
||||
{
|
||||
"path": "./tsconfig.node.json"
|
||||
},
|
||||
{
|
||||
"path": "./tsconfig.app.json"
|
||||
}
|
||||
],
|
||||
/* 必须在根目录也加上这部分,让 shadcn 的脚本能读到 */
|
||||
"compilerOptions": {
|
||||
"baseUrl": ".",
|
||||
"paths": {
|
||||
"@/*": ["./src/*"]
|
||||
}
|
||||
}
|
||||
}
|
||||
26
tsconfig.node.json
Normal file
@ -0,0 +1,26 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"tsBuildInfoFile": "./node_modules/.tmp/tsconfig.node.tsbuildinfo",
|
||||
"target": "ES2023",
|
||||
"lib": ["ES2023"],
|
||||
"module": "ESNext",
|
||||
"types": ["node"],
|
||||
"skipLibCheck": true,
|
||||
|
||||
/* Bundler mode */
|
||||
"moduleResolution": "bundler",
|
||||
"allowImportingTsExtensions": true,
|
||||
"verbatimModuleSyntax": true,
|
||||
"moduleDetection": "force",
|
||||
"noEmit": true,
|
||||
|
||||
/* Linting */
|
||||
"strict": true,
|
||||
"noUnusedLocals": true,
|
||||
"noUnusedParameters": true,
|
||||
"erasableSyntaxOnly": true,
|
||||
"noFallthroughCasesInSwitch": true,
|
||||
"noUncheckedSideEffectImports": true
|
||||
},
|
||||
"include": ["vite.config.ts"]
|
||||
}
|
||||
35
vite.config.ts
Normal file
@ -0,0 +1,35 @@
|
||||
import { fileURLToPath, URL } from 'node:url'
|
||||
|
||||
import { defineConfig } from 'vite'
|
||||
import vue from '@vitejs/plugin-vue'
|
||||
import tailwindcss from '@tailwindcss/vite'
|
||||
import svgLoader from 'vite-svg-loader'
|
||||
|
||||
// https://vite.dev/config/
|
||||
export default defineConfig({
|
||||
plugins: [vue(), tailwindcss(),svgLoader()],
|
||||
resolve: {
|
||||
alias: {
|
||||
'@': fileURLToPath(new URL('./src', import.meta.url)),
|
||||
},
|
||||
},
|
||||
server: {
|
||||
proxy: {
|
||||
// 将所有以 /api 开头的请求转发到目标服务器
|
||||
// 1. 匹配所有以 /public 开头的请求
|
||||
'/api/v1': {
|
||||
target: 'https://hifastvpn.com',
|
||||
changeOrigin: true,
|
||||
// rewrite: (path) => path.replace(/^\/api/, ''),
|
||||
autoRewrite: true,
|
||||
// 3. 关键:将路径重写,在前面补上 /api/v1
|
||||
// 验证请求是否进入代理,可以在终端看到打印
|
||||
configure: (proxy, _options) => {
|
||||
proxy.on('proxyReq', (proxyReq, req, _res) => {
|
||||
console.log('代理请求:', req.method, req.url, ' -> ', proxyReq.path)
|
||||
})
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
})
|
||||