From c1c326f26321cfecdb87e9b2550f712d6c44a98b Mon Sep 17 00:00:00 2001 From: "xia.zhang" Date: Wed, 31 Jan 2024 10:28:31 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B3=A8=E5=86=8C=E9=A1=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .env.development | 2 + .env.production | 2 + .eslintrc.cjs | 18 + .gitignore | 24 + README.md | 30 + antd-demo/.eslintrc.cjs | 18 + antd-demo/.gitignore | 24 + antd-demo/README.md | 30 + antd-demo/index.html | 13 + antd-demo/package.json | 28 + antd-demo/public/vite.svg | 1 + antd-demo/src/App.css | 42 + antd-demo/src/App.tsx | 35 + antd-demo/src/assets/react.svg | 1 + antd-demo/src/index.css | 68 + antd-demo/src/main.tsx | 10 + antd-demo/src/vite-env.d.ts | 1 + antd-demo/tsconfig.json | 25 + antd-demo/tsconfig.node.json | 10 + antd-demo/vite.config.ts | 7 + index.html | 13 + package.json | 36 + public/vite.svg | 1 + src/App.css | 8 + src/App.tsx | 28 + src/api/index.ts | 15 + src/api/request.ts | 112 ++ src/assets/iconfont/email.svg | 15 + src/assets/iconfont/email_Select.svg | 15 + src/assets/iconfont/goback.svg | 9 + src/assets/iconfont/phone.svg | 15 + src/assets/iconfont/phone_Select.svg | 15 + src/assets/iconfont/search.svg | 8 + src/assets/img/app_store.png | Bin 0 -> 660 bytes src/assets/img/go_back.png | Bin 0 -> 324 bytes src/assets/img/google.png | Bin 0 -> 896 bytes src/assets/react.svg | 1 + src/components/EmailForm.tsx | 164 +++ src/components/PhoneForm.tsx | 181 +++ src/hooks/useCountdown.ts | 39 + src/i18n/area/area.json | 952 ++++++++++++++ src/i18n/cn/translation.json | 24 + src/i18n/config.ts | 27 + src/i18n/en/translation.json | 23 + src/index.css | 73 ++ src/main.tsx | 10 + src/pages/Download.scss | 41 + src/pages/Download.tsx | 33 + src/pages/SelectCountry.scss | 78 ++ src/pages/SelectCountry.tsx | 89 ++ src/pages/SignIn.scss | 138 ++ src/pages/SignIn.tsx | 70 + src/store/user.ts | 45 + src/type/SelectCountry.d.ts | 6 + src/type/SignIn.d.ts | 16 + src/vite-env.d.ts | 1 + tsconfig.json | 25 + tsconfig.node.json | 10 + vite.config.ts | 7 + yarn.lock | 1759 ++++++++++++++++++++++++++ 60 files changed, 4491 insertions(+) create mode 100644 .env.development create mode 100644 .env.production create mode 100644 .eslintrc.cjs create mode 100644 .gitignore create mode 100644 README.md create mode 100644 antd-demo/.eslintrc.cjs create mode 100644 antd-demo/.gitignore create mode 100644 antd-demo/README.md create mode 100644 antd-demo/index.html create mode 100644 antd-demo/package.json create mode 100644 antd-demo/public/vite.svg create mode 100644 antd-demo/src/App.css create mode 100644 antd-demo/src/App.tsx create mode 100644 antd-demo/src/assets/react.svg create mode 100644 antd-demo/src/index.css create mode 100644 antd-demo/src/main.tsx create mode 100644 antd-demo/src/vite-env.d.ts create mode 100644 antd-demo/tsconfig.json create mode 100644 antd-demo/tsconfig.node.json create mode 100644 antd-demo/vite.config.ts create mode 100644 index.html create mode 100644 package.json create mode 100644 public/vite.svg create mode 100644 src/App.css create mode 100644 src/App.tsx create mode 100644 src/api/index.ts create mode 100644 src/api/request.ts create mode 100644 src/assets/iconfont/email.svg create mode 100644 src/assets/iconfont/email_Select.svg create mode 100644 src/assets/iconfont/goback.svg create mode 100644 src/assets/iconfont/phone.svg create mode 100644 src/assets/iconfont/phone_Select.svg create mode 100644 src/assets/iconfont/search.svg create mode 100644 src/assets/img/app_store.png create mode 100644 src/assets/img/go_back.png create mode 100644 src/assets/img/google.png create mode 100644 src/assets/react.svg create mode 100644 src/components/EmailForm.tsx create mode 100644 src/components/PhoneForm.tsx create mode 100644 src/hooks/useCountdown.ts create mode 100644 src/i18n/area/area.json create mode 100644 src/i18n/cn/translation.json create mode 100644 src/i18n/config.ts create mode 100644 src/i18n/en/translation.json create mode 100644 src/index.css create mode 100644 src/main.tsx create mode 100644 src/pages/Download.scss create mode 100644 src/pages/Download.tsx create mode 100644 src/pages/SelectCountry.scss create mode 100644 src/pages/SelectCountry.tsx create mode 100644 src/pages/SignIn.scss create mode 100644 src/pages/SignIn.tsx create mode 100644 src/store/user.ts create mode 100644 src/type/SelectCountry.d.ts create mode 100644 src/type/SignIn.d.ts create mode 100644 src/vite-env.d.ts create mode 100644 tsconfig.json create mode 100644 tsconfig.node.json create mode 100644 vite.config.ts create mode 100644 yarn.lock diff --git a/.env.development b/.env.development new file mode 100644 index 0000000..b5df337 --- /dev/null +++ b/.env.development @@ -0,0 +1,2 @@ +VITE_APP_DEV = 'dev-api' +VITE_API_URL = 'http://192.168.10.166:8096' \ No newline at end of file diff --git a/.env.production b/.env.production new file mode 100644 index 0000000..9735622 --- /dev/null +++ b/.env.production @@ -0,0 +1,2 @@ +VITE_APP_DEV = 'prod-api' +VITE_API_URL = 'http://192.168.10.166:8096' \ No newline at end of file diff --git a/.eslintrc.cjs b/.eslintrc.cjs new file mode 100644 index 0000000..d6c9537 --- /dev/null +++ b/.eslintrc.cjs @@ -0,0 +1,18 @@ +module.exports = { + root: true, + env: { browser: true, es2020: true }, + extends: [ + 'eslint:recommended', + 'plugin:@typescript-eslint/recommended', + 'plugin:react-hooks/recommended', + ], + ignorePatterns: ['dist', '.eslintrc.cjs'], + parser: '@typescript-eslint/parser', + plugins: ['react-refresh'], + rules: { + 'react-refresh/only-export-components': [ + 'warn', + { allowConstantExport: true }, + ], + }, +} diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..a547bf3 --- /dev/null +++ b/.gitignore @@ -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? diff --git a/README.md b/README.md new file mode 100644 index 0000000..0d6babe --- /dev/null +++ b/README.md @@ -0,0 +1,30 @@ +# React + TypeScript + Vite + +This template provides a minimal setup to get React working in Vite with HMR and some ESLint rules. + +Currently, two official plugins are available: + +- [@vitejs/plugin-react](https://github.com/vitejs/vite-plugin-react/blob/main/packages/plugin-react/README.md) uses [Babel](https://babeljs.io/) for Fast Refresh +- [@vitejs/plugin-react-swc](https://github.com/vitejs/vite-plugin-react-swc) uses [SWC](https://swc.rs/) for Fast Refresh + +## Expanding the ESLint configuration + +If you are developing a production application, we recommend updating the configuration to enable type aware lint rules: + +- Configure the top-level `parserOptions` property like this: + +```js +export default { + // other rules... + parserOptions: { + ecmaVersion: 'latest', + sourceType: 'module', + project: ['./tsconfig.json', './tsconfig.node.json'], + tsconfigRootDir: __dirname, + }, +} +``` + +- Replace `plugin:@typescript-eslint/recommended` to `plugin:@typescript-eslint/recommended-type-checked` or `plugin:@typescript-eslint/strict-type-checked` +- Optionally add `plugin:@typescript-eslint/stylistic-type-checked` +- Install [eslint-plugin-react](https://github.com/jsx-eslint/eslint-plugin-react) and add `plugin:react/recommended` & `plugin:react/jsx-runtime` to the `extends` list diff --git a/antd-demo/.eslintrc.cjs b/antd-demo/.eslintrc.cjs new file mode 100644 index 0000000..d6c9537 --- /dev/null +++ b/antd-demo/.eslintrc.cjs @@ -0,0 +1,18 @@ +module.exports = { + root: true, + env: { browser: true, es2020: true }, + extends: [ + 'eslint:recommended', + 'plugin:@typescript-eslint/recommended', + 'plugin:react-hooks/recommended', + ], + ignorePatterns: ['dist', '.eslintrc.cjs'], + parser: '@typescript-eslint/parser', + plugins: ['react-refresh'], + rules: { + 'react-refresh/only-export-components': [ + 'warn', + { allowConstantExport: true }, + ], + }, +} diff --git a/antd-demo/.gitignore b/antd-demo/.gitignore new file mode 100644 index 0000000..a547bf3 --- /dev/null +++ b/antd-demo/.gitignore @@ -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? diff --git a/antd-demo/README.md b/antd-demo/README.md new file mode 100644 index 0000000..0d6babe --- /dev/null +++ b/antd-demo/README.md @@ -0,0 +1,30 @@ +# React + TypeScript + Vite + +This template provides a minimal setup to get React working in Vite with HMR and some ESLint rules. + +Currently, two official plugins are available: + +- [@vitejs/plugin-react](https://github.com/vitejs/vite-plugin-react/blob/main/packages/plugin-react/README.md) uses [Babel](https://babeljs.io/) for Fast Refresh +- [@vitejs/plugin-react-swc](https://github.com/vitejs/vite-plugin-react-swc) uses [SWC](https://swc.rs/) for Fast Refresh + +## Expanding the ESLint configuration + +If you are developing a production application, we recommend updating the configuration to enable type aware lint rules: + +- Configure the top-level `parserOptions` property like this: + +```js +export default { + // other rules... + parserOptions: { + ecmaVersion: 'latest', + sourceType: 'module', + project: ['./tsconfig.json', './tsconfig.node.json'], + tsconfigRootDir: __dirname, + }, +} +``` + +- Replace `plugin:@typescript-eslint/recommended` to `plugin:@typescript-eslint/recommended-type-checked` or `plugin:@typescript-eslint/strict-type-checked` +- Optionally add `plugin:@typescript-eslint/stylistic-type-checked` +- Install [eslint-plugin-react](https://github.com/jsx-eslint/eslint-plugin-react) and add `plugin:react/recommended` & `plugin:react/jsx-runtime` to the `extends` list diff --git a/antd-demo/index.html b/antd-demo/index.html new file mode 100644 index 0000000..e4b78ea --- /dev/null +++ b/antd-demo/index.html @@ -0,0 +1,13 @@ + + + + + + + Vite + React + TS + + +
+ + + diff --git a/antd-demo/package.json b/antd-demo/package.json new file mode 100644 index 0000000..31ae432 --- /dev/null +++ b/antd-demo/package.json @@ -0,0 +1,28 @@ +{ + "name": "antd-demo", + "private": true, + "version": "0.0.0", + "type": "module", + "scripts": { + "dev": "vite", + "build": "tsc && vite build", + "lint": "eslint . --ext ts,tsx --report-unused-disable-directives --max-warnings 0", + "preview": "vite preview" + }, + "dependencies": { + "react": "^18.2.0", + "react-dom": "^18.2.0" + }, + "devDependencies": { + "@types/react": "^18.2.43", + "@types/react-dom": "^18.2.17", + "@typescript-eslint/eslint-plugin": "^6.14.0", + "@typescript-eslint/parser": "^6.14.0", + "@vitejs/plugin-react-swc": "^3.5.0", + "eslint": "^8.55.0", + "eslint-plugin-react-hooks": "^4.6.0", + "eslint-plugin-react-refresh": "^0.4.5", + "typescript": "^5.2.2", + "vite": "^5.0.8" + } +} diff --git a/antd-demo/public/vite.svg b/antd-demo/public/vite.svg new file mode 100644 index 0000000..e7b8dfb --- /dev/null +++ b/antd-demo/public/vite.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/antd-demo/src/App.css b/antd-demo/src/App.css new file mode 100644 index 0000000..b9d355d --- /dev/null +++ b/antd-demo/src/App.css @@ -0,0 +1,42 @@ +#root { + max-width: 1280px; + margin: 0 auto; + padding: 2rem; + text-align: center; +} + +.logo { + height: 6em; + padding: 1.5em; + will-change: filter; + transition: filter 300ms; +} +.logo:hover { + filter: drop-shadow(0 0 2em #646cffaa); +} +.logo.react:hover { + filter: drop-shadow(0 0 2em #61dafbaa); +} + +@keyframes logo-spin { + from { + transform: rotate(0deg); + } + to { + transform: rotate(360deg); + } +} + +@media (prefers-reduced-motion: no-preference) { + a:nth-of-type(2) .logo { + animation: logo-spin infinite 20s linear; + } +} + +.card { + padding: 2em; +} + +.read-the-docs { + color: #888; +} diff --git a/antd-demo/src/App.tsx b/antd-demo/src/App.tsx new file mode 100644 index 0000000..afe48ac --- /dev/null +++ b/antd-demo/src/App.tsx @@ -0,0 +1,35 @@ +import { useState } from 'react' +import reactLogo from './assets/react.svg' +import viteLogo from '/vite.svg' +import './App.css' + +function App() { + const [count, setCount] = useState(0) + + return ( + <> +
+ + Vite logo + + + React logo + +
+

Vite + React

+
+ +

+ Edit src/App.tsx and save to test HMR +

+
+

+ Click on the Vite and React logos to learn more +

+ + ) +} + +export default App diff --git a/antd-demo/src/assets/react.svg b/antd-demo/src/assets/react.svg new file mode 100644 index 0000000..6c87de9 --- /dev/null +++ b/antd-demo/src/assets/react.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/antd-demo/src/index.css b/antd-demo/src/index.css new file mode 100644 index 0000000..6119ad9 --- /dev/null +++ b/antd-demo/src/index.css @@ -0,0 +1,68 @@ +:root { + font-family: Inter, system-ui, Avenir, Helvetica, Arial, sans-serif; + line-height: 1.5; + font-weight: 400; + + color-scheme: light dark; + color: rgba(255, 255, 255, 0.87); + background-color: #242424; + + font-synthesis: none; + text-rendering: optimizeLegibility; + -webkit-font-smoothing: antialiased; + -moz-osx-font-smoothing: grayscale; +} + +a { + font-weight: 500; + color: #646cff; + text-decoration: inherit; +} +a:hover { + color: #535bf2; +} + +body { + margin: 0; + display: flex; + place-items: center; + min-width: 320px; + min-height: 100vh; +} + +h1 { + font-size: 3.2em; + line-height: 1.1; +} + +button { + border-radius: 8px; + border: 1px solid transparent; + padding: 0.6em 1.2em; + font-size: 1em; + font-weight: 500; + font-family: inherit; + background-color: #1a1a1a; + cursor: pointer; + transition: border-color 0.25s; +} +button:hover { + border-color: #646cff; +} +button:focus, +button:focus-visible { + outline: 4px auto -webkit-focus-ring-color; +} + +@media (prefers-color-scheme: light) { + :root { + color: #213547; + background-color: #ffffff; + } + a:hover { + color: #747bff; + } + button { + background-color: #f9f9f9; + } +} diff --git a/antd-demo/src/main.tsx b/antd-demo/src/main.tsx new file mode 100644 index 0000000..3d7150d --- /dev/null +++ b/antd-demo/src/main.tsx @@ -0,0 +1,10 @@ +import React from 'react' +import ReactDOM from 'react-dom/client' +import App from './App.tsx' +import './index.css' + +ReactDOM.createRoot(document.getElementById('root')!).render( + + + , +) diff --git a/antd-demo/src/vite-env.d.ts b/antd-demo/src/vite-env.d.ts new file mode 100644 index 0000000..11f02fe --- /dev/null +++ b/antd-demo/src/vite-env.d.ts @@ -0,0 +1 @@ +/// diff --git a/antd-demo/tsconfig.json b/antd-demo/tsconfig.json new file mode 100644 index 0000000..a7fc6fb --- /dev/null +++ b/antd-demo/tsconfig.json @@ -0,0 +1,25 @@ +{ + "compilerOptions": { + "target": "ES2020", + "useDefineForClassFields": true, + "lib": ["ES2020", "DOM", "DOM.Iterable"], + "module": "ESNext", + "skipLibCheck": true, + + /* Bundler mode */ + "moduleResolution": "bundler", + "allowImportingTsExtensions": true, + "resolveJsonModule": true, + "isolatedModules": true, + "noEmit": true, + "jsx": "react-jsx", + + /* Linting */ + "strict": true, + "noUnusedLocals": true, + "noUnusedParameters": true, + "noFallthroughCasesInSwitch": true + }, + "include": ["src"], + "references": [{ "path": "./tsconfig.node.json" }] +} diff --git a/antd-demo/tsconfig.node.json b/antd-demo/tsconfig.node.json new file mode 100644 index 0000000..42872c5 --- /dev/null +++ b/antd-demo/tsconfig.node.json @@ -0,0 +1,10 @@ +{ + "compilerOptions": { + "composite": true, + "skipLibCheck": true, + "module": "ESNext", + "moduleResolution": "bundler", + "allowSyntheticDefaultImports": true + }, + "include": ["vite.config.ts"] +} diff --git a/antd-demo/vite.config.ts b/antd-demo/vite.config.ts new file mode 100644 index 0000000..861b04b --- /dev/null +++ b/antd-demo/vite.config.ts @@ -0,0 +1,7 @@ +import { defineConfig } from 'vite' +import react from '@vitejs/plugin-react-swc' + +// https://vitejs.dev/config/ +export default defineConfig({ + plugins: [react()], +}) diff --git a/index.html b/index.html new file mode 100644 index 0000000..e4b78ea --- /dev/null +++ b/index.html @@ -0,0 +1,13 @@ + + + + + + + Vite + React + TS + + +
+ + + diff --git a/package.json b/package.json new file mode 100644 index 0000000..2dc9ae3 --- /dev/null +++ b/package.json @@ -0,0 +1,36 @@ +{ + "name": "neer-app-h5", + "private": true, + "version": "0.0.0", + "type": "module", + "scripts": { + "dev": "vite", + "build": "tsc && vite build", + "lint": "eslint . --ext ts,tsx --report-unused-disable-directives --max-warnings 0", + "preview": "vite preview" + }, + "dependencies": { + "antd-mobile": "^5.34.0", + "axios": "^1.6.7", + "i18next": "^23.7.20", + "react": "^18.2.0", + "react-dom": "^18.2.0", + "react-i18next": "^14.0.1", + "react-router-dom": "^6.21.3", + "sass": "^1.70.0", + "zustand": "^4.5.0" + }, + "devDependencies": { + "@types/node": "^20.11.7", + "@types/react": "^18.2.43", + "@types/react-dom": "^18.2.17", + "@typescript-eslint/eslint-plugin": "^6.14.0", + "@typescript-eslint/parser": "^6.14.0", + "@vitejs/plugin-react-swc": "^3.5.0", + "eslint": "^8.55.0", + "eslint-plugin-react-hooks": "^4.6.0", + "eslint-plugin-react-refresh": "^0.4.5", + "typescript": "^5.3.3", + "vite": "^5.0.8" + } +} diff --git a/public/vite.svg b/public/vite.svg new file mode 100644 index 0000000..e7b8dfb --- /dev/null +++ b/public/vite.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/App.css b/src/App.css new file mode 100644 index 0000000..c15efd4 --- /dev/null +++ b/src/App.css @@ -0,0 +1,8 @@ +#root { + max-width: 1280px; + margin: 0 auto; + padding: 2rem; + text-align: center; +} + + diff --git a/src/App.tsx b/src/App.tsx new file mode 100644 index 0000000..31b3c52 --- /dev/null +++ b/src/App.tsx @@ -0,0 +1,28 @@ +import "./App.css"; +import { useEffect } from "react"; +import { BrowserRouter as Router, Route, Routes, Navigate } from "react-router-dom"; +import SignIn from "./pages/SignIn"; +import Download from "./pages/Download"; +import SelectCountry from "./pages/SelectCountry"; +import { useTranslation } from "react-i18next"; + +function App() { + const {i18n} = useTranslation() + const lang:string = navigator.language.split('-')[1].toLocaleLowerCase() + useEffect(()=>{ + i18n.changeLanguage(lang) + },[ i18n,lang]) + return ( + +
+ + + + + +
+
+ ); +} + +export default App; diff --git a/src/api/index.ts b/src/api/index.ts new file mode 100644 index 0000000..004384d --- /dev/null +++ b/src/api/index.ts @@ -0,0 +1,15 @@ +import { request } from "./request"; +import { AxiosRequestConfig } from 'axios'; + +//发送验证码 +export const sendCode = (params: any,config:AxiosRequestConfig) => + request.get("/api/account/sendVerificationCode", params, { + timeout: 15000, + ...config + }); +//注册 +export const signUp = (params: any,config:AxiosRequestConfig) => + request.post("/api/account/signUp", params, { + timeout: 15000, + ...config + }); \ No newline at end of file diff --git a/src/api/request.ts b/src/api/request.ts new file mode 100644 index 0000000..e7dea6c --- /dev/null +++ b/src/api/request.ts @@ -0,0 +1,112 @@ +import axios, { AxiosRequestConfig, AxiosRequestHeaders } from 'axios'; + +//基础URL,axios将会自动拼接在url前 +//process.env.NODE_ENV 判断是否为开发环境 根据不同环境使用不同的baseURL 方便调试 +const baseURL = import.meta.env.DEV ? import.meta.env.VITE_API_URL : import.meta.env.VITE_API_URL; +//默认请求超时时间 +const timeout = 30000; + +//创建axios实例 +const service = axios.create({ + timeout, + baseURL, + //如需要携带cookie 该值需设为true + withCredentials: true +}); +// 统一请求拦截,可配置自定义 headers 例如 language、token 等 +service.interceptors.request.use( + (config: AxiosRequestConfig) => { + // 确保 headers 对象存在 + if (!config.headers) { + config.headers = {}; + } + // 配置自定义请求头 + const customHeaders: Partial = { + language: 'zh-cn', + // 这里可以添加其他自定义头信息,例如 token + }; + + // 合并自定义头信息到 config.headers 中 + config.headers = { ...config.headers, ...customHeaders } as AxiosRequestHeaders; + + return config; + }, + error => { + console.log(error); + return Promise.reject(error); + } +); + +//axios返回格式 +interface axiosTypes{ + data: T; + status: number; + statusText: string; +} + +//后台响应数据格式 +//###该接口用于规定后台返回的数据格式,意为必须携带code、msg以及result +//###而result的数据格式 由外部提供。如此即可根据不同需求,定制不同的数据格式 +interface responseTypes{ + code: number, + msg: string, + result: T +} + +//核心处理代码 将返回一个promise 调用then将可获取响应的业务数据 +const requestHandler = (method: 'get' | 'post' | 'put' | 'delete', url: string, params: object = {}, config: AxiosRequestConfig = {}): Promise => { + let response: Promise>>; + switch(method){ + case 'get': + response = service.get(url, {params: { ...params }, ...config}); + break; + case 'post': + response = service.post(url, {...params}, {...config}); + break; + case 'put': + response = service.put(url, {...params}, {...config}); + break; + case 'delete': + response = service.delete(url, {params: { ...params }, ...config}); + break; + } + + return new Promise((resolve, reject) => { + response.then(res => { + //业务代码 可根据需求自行处理 + + const data = res.data; + if(data.code !== 200 && data.code !== 0){ + + //特定状态码 处理特定的需求 + if(data.code == 401){ + console.log('登录异常,执行登出...'); + } + + const e = JSON.stringify(data); + console.log(`请求错误:${e}`) + //数据请求错误 使用reject将错误返回 + reject(data); + }else{ + //数据请求正确 使用resolve将结果返回 + resolve(res as T); + } + + }).catch(error => { + const e = JSON.stringify(error); + console.log(`网络错误:${e}`) + reject(error); + }) + }) +} + +// 使用 request 统一调用,包括封装的get、post、put、delete等方法 +const request = { + get: (url: string, params?: object, config?: AxiosRequestConfig) => requestHandler('get', url, params, config), + post: (url: string, params?: object, config?: AxiosRequestConfig) => requestHandler('post', url, params, config), + put: (url: string, params?: object, config?: AxiosRequestConfig) => requestHandler('put', url, params, config), + delete: (url: string, params?: object, config?: AxiosRequestConfig) => requestHandler('delete', url, params, config) +}; + +// 导出至外层,方便统一使用 +export { request }; \ No newline at end of file diff --git a/src/assets/iconfont/email.svg b/src/assets/iconfont/email.svg new file mode 100644 index 0000000..e227e16 --- /dev/null +++ b/src/assets/iconfont/email.svg @@ -0,0 +1,15 @@ + + + + + + + + + + + + \ No newline at end of file diff --git a/src/assets/iconfont/email_Select.svg b/src/assets/iconfont/email_Select.svg new file mode 100644 index 0000000..15fc912 --- /dev/null +++ b/src/assets/iconfont/email_Select.svg @@ -0,0 +1,15 @@ + + + + + + + + + + + + \ No newline at end of file diff --git a/src/assets/iconfont/goback.svg b/src/assets/iconfont/goback.svg new file mode 100644 index 0000000..2817192 --- /dev/null +++ b/src/assets/iconfont/goback.svg @@ -0,0 +1,9 @@ + + + + + \ No newline at end of file diff --git a/src/assets/iconfont/phone.svg b/src/assets/iconfont/phone.svg new file mode 100644 index 0000000..36890b2 --- /dev/null +++ b/src/assets/iconfont/phone.svg @@ -0,0 +1,15 @@ + + + + + + + + + + + + \ No newline at end of file diff --git a/src/assets/iconfont/phone_Select.svg b/src/assets/iconfont/phone_Select.svg new file mode 100644 index 0000000..a876e31 --- /dev/null +++ b/src/assets/iconfont/phone_Select.svg @@ -0,0 +1,15 @@ + + + + + + + + + + + + \ No newline at end of file diff --git a/src/assets/iconfont/search.svg b/src/assets/iconfont/search.svg new file mode 100644 index 0000000..56cf0bd --- /dev/null +++ b/src/assets/iconfont/search.svg @@ -0,0 +1,8 @@ + + + + + \ No newline at end of file diff --git a/src/assets/img/app_store.png b/src/assets/img/app_store.png new file mode 100644 index 0000000000000000000000000000000000000000..efe2d216bcc3a28037d3882383212ac46e3cd535 GIT binary patch literal 660 zcmV;F0&D$=P)Px#1am@3R0s$N2z&@+hyVZrK1oDDR7i=nmAy+_Q5eR5?@hdBxEC(AP@HlXr)Eeh zU5i4u4vj;%4h{yo)jyy#R{96j*+3Npp&jDnR4|U`ROD< zOA%av?+Uqc$l+-;`k?S2X%a}Ku8BNb@NB&nwAA>63b9NCf|lY#wH^Pj?6;{k4Fmuq z0f4z_?R)J^v3b-nJ!U4bIFlrMPj6lO(dJ+w#o~;SyJiB#+ytPbuhb(vTjI5U7AWQ> z@Lk>T^Sfc3T;DYl87bg9!pb8}vT@X*)>PD*ij7_lmNQ9wM{X}r?2!j8#k>8>D(ZiG zw#0jGf>1h->&M zNjzKFITm(~Z*HoMqYkeh>K@5XSwrM-O_KGz(bxRi=-x=)$HJEjK-)W1QGyam=fAiz zQRk+$Zhy#)!-)M2p>+NUcwxl!w-B{$L9_~l|A9WFt=?NKxmA=Z+_8v$^k2C@wRr_+ ui%v9)sBNHuU^eWBaRPjX=rILn3*Zkc?9M@0APx#1am@3R0s$N2z&@+hyVZp?ny*JR2Y?YkugrgP!I*@#i@|ME({G=GE^}Y+#u;v zQl`ui!U@6+as+Y(N-E$6>2UcYgk%X9UxqFcO94(C%WONN-PL>IpGnTMCo_BQcfyOy zd(4KC(q0>$rGq(UQ^0M^MruPzcQq_r?$iPO#_YOqxdZ3{oTk~VhTo=94FUQ|I+!9B z0GQpryVq6oY!7Mv2bXUyU$&nP!svL7m>^w+QM|5vxwj#xe3^$)yhge~8XiU`kDvad z*a`rZFIPuVjHI!|q$vfpS^4s%A&n2B_~FZ!elIA1B+V9xS!a@4>9>n1;5r4^wfO@> Wl4wt{7Zm{j0000Px#1am@3R0s$N2z&@+hyVZsDoI2^R7i=XmQQFLRUF4Z@6GOHgX`|37Fr~<8$Fat zF|8$dP`iIxG*Cl#El4d`6WV*s!HalkKoHEK35thO=@!A#g6@_|5sGC~JQ#yeQP31@ zCbX5BlxDi!G`o|`dp*=$lWb-h$@et#e((4F{AS+!y%|A(W>Y&YLx!_b$Rt{)8UcZ$ z!PZ(|@RU(%EB$2qc?dsaQ=0u+a6G7hhO{1DP{zn=pe8^$)72{lCqP(hGH*bzm0%$D z!_P%uz+-c9`hOX(kkYy@c4a(YznArk@x!m~Tdz5Q6ykI_)74wQ7XaObY@$VR@#LvH ziKko@T`vT*v*0asw3V(o5+Dryo@B?FJ#lCK<^aMnrP&W4x(nGv2qx>HPtMI$I%XD@ zJ%#Z~lJHxHFgjlX!29(Vys-lO^Hm_md~LcTBo(RuRsz1*XH|yI&NKkwBgdG|9c5(P zcYqWxY3raty3D3y|iB)N3#<}=~VW6wt_0HN3SGo3rio9E~GW@3@D zt0}vhvA;bIUzq3Ch7TdWC*V!V_oRlME5}b}ti?G~Rzh#==YuOX%C2t8z4bsdGVa3G zj{*QBq=u%3nro5Pw_VYS(Yc#H?keB>%aa~NU-So{E$J8fzB3wi-TB4Us$Zs1aKrlo zJV|t-{8#AUwvcb~_Kgyps{!`HkrGON;j@39qrb}}W;UOR?N1AaGA+SdRdY>xic!D# zZ+Cy^>h1G<_jW5UKWh*(1u;`_a9fD4546%g`)TzFfKibxWUWP*^`8ZMx1`y-CBt*^ z4ghZ4pTxfLd8MbC4?b2@txW**6tX8YydOAug-*psolVBWpcNh#$=ZMfFklc^^EuQL znX-e;wS%e+!oRzym@7I82G(M33h&N=h`l**lA=$f9~a!%rk8TXyn?<+McQqA)t2?arCc#DAg94zEwxS7sy&gZgpaX<(m9cI2bYdEHQL2ovFJfs!0^i0 zyRFxKymcNWcP*{Fu2ugk>gq0J6H<{fB+0GD1M9Q+k6F+TV55bDR%gH{iFDQW^LPYN W#2!9)mNk?B0000