Compare commits

...

33 Commits
main ... dev

Author SHA1 Message Date
john 0440a31558 🌈 style:
删除无用代码
2024-07-10 10:34:16 +08:00
john 637cdf9175 feat:
优化行为验证
2024-06-14 18:41:22 +08:00
john 84d566b787 Merge tag '1.0.5' into dev
1.0.5 1.0.5
2024-06-13 18:42:20 +08:00
john f5b6645b77 Merge branch 'release/1.0.5' 2024-06-13 18:42:11 +08:00
john fb211a2fc6 Merge branch 'feature/注册添加密码' into dev 2024-06-13 18:41:16 +08:00
john 1bd2ab1312 🐎 ci:
1.0.5
2024-06-13 18:41:06 +08:00
john a97072958a feat:
切换中文语言自动切换区号
2024-06-13 16:38:00 +08:00
john c2e89373b6 feat:
注册添加密码
2024-06-13 16:34:18 +08:00
john b093323170 Merge tag '1.0.4-issue' into dev
1.0.4-issue 1.0.4-issue
2024-06-13 15:48:34 +08:00
john 25de2f6159 Merge branch 'hotfix/1.0.4-issue' 2024-06-13 15:48:01 +08:00
john 1a0f3b1fb8 🐞 fix:
隐藏邮箱
2024-06-07 18:41:06 +08:00
john d73f7c2f7e Merge tag '1.0.4' into dev
v1.0.4 1.0.4
2024-06-06 21:25:02 +08:00
john 906a28fe15 Merge branch 'release/1.0.4' 2024-06-06 21:25:00 +08:00
john b66308b566 feat:
修改版本号
2024-06-06 21:24:19 +08:00
john f6e6c8d91d Merge tag '1.0.2-issue' into dev
v1.0.2-issue 1.0.2-issue
2024-06-06 21:23:46 +08:00
john 7f3fd030b7 Merge branch 'hotfix/1.0.2-issue' 2024-06-06 21:23:40 +08:00
john 33fb9caa69 🐞 fix:
修改翻译
2024-06-06 21:08:42 +08:00
john a7a1a208dc feat:
添加人机校验
2024-06-06 20:25:29 +08:00
john 7b3e1bc287 🐞 fix: 2024-06-05 15:31:19 +08:00
john 47bc37ac2c Merge tag '1.0.2' into dev
v1.0.2 1.0.2
2024-06-03 18:44:10 +08:00
john 101fe2bb10 Merge branch 'release/1.0.2' 2024-06-03 18:44:07 +08:00
john b90d388e1f Merge tag 'v1.0.1-issue' into dev
v1.0.1-issue v1.0.1-issue
2024-06-03 18:43:16 +08:00
john 0140ed789a Merge branch 'hotfix/v1.0.1-issue' 2024-06-03 18:43:13 +08:00
john d4a96614b3 🐞 fix:
修复翻译
2024-06-03 18:42:17 +08:00
john cc0f5e2bf5 🐞 fix:
1、去掉接口language参数
2、修复Accept-Language参数
3、手机号校验
4、全局语言标识
2024-06-03 18:37:13 +08:00
john 8e7625c2be Merge tag '1.0.1' into dev
v1.0.1 1.0.1
2024-06-03 14:43:13 +08:00
john e4ad56be66 Merge branch 'release/1.0.1' 2024-06-03 14:42:56 +08:00
john 007c207950 🐞 fix:
添加版本号
2024-06-03 14:42:20 +08:00
john bc75c7885c 🐞 fix:
修复倒计时bug,删除eslint
2024-06-03 14:38:18 +08:00
john 3795aedede 🐞 fix:
修复已知bug
2024-05-24 10:21:29 +08:00
john 2173394a71 update 2024-05-22 18:47:27 +08:00
john 7d465ca568 update(修改页面) 2024-05-22 18:34:41 +08:00
xia.zhang d6ebf4aef5 注册页 2024-05-22 17:41:51 +08:00
50 changed files with 3325 additions and 2485 deletions

View File

@ -1,2 +1,10 @@
###
# @LastEditors: John
# @Date: 2024-06-03 14:42:56
# @LastEditTime: 2024-06-06 17:31:31
# @Author: John
###
VITE_APP_DEV = 'dev-api'
VITE_API_URL = 'http://192.168.10.166:8096'
VITE_API_URL = 'http://192.168.10.166:8097'
# VITE_API_URL = 'https://8.217.122.133:10020'
# VITE_API_URL = 'https://api.pineer.cc'

View File

@ -1,2 +1,4 @@
VITE_APP_DEV = 'prod-api'
VITE_API_URL = 'http://192.168.10.166:8096'
# VITE_API_URL = 'http://192.168.10.166:8096'
# VITE_API_URL = 'https://8.217.122.133:10020'
VITE_API_URL = 'https://api.pineer.cc'

View File

@ -1,18 +0,0 @@
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 },
],
},
}

BIN
.yarn/install-state.gz Normal file

Binary file not shown.

1
.yarnrc.yml Normal file
View File

@ -0,0 +1 @@
nodeLinker: node-modules

View File

@ -1,30 +1,27 @@
# React + TypeScript + Vite
<!--
* @LastEditors: John
* @Date: 2024-04-12 19:24:25
* @LastEditTime: 2024-06-03 14:37:23
* @Author: John
-->
This template provides a minimal setup to get React working in Vite with HMR and some ESLint rules.
## Git Flow
Currently, two official plugins are available:
- 初始化Git Flow
git flow init
- [@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
- 创建一个新功能分支
git flow feature start new-feature
## Expanding the ESLint configuration
- 完成功能开发
git flow feature finish new-feature
If you are developing a production application, we recommend updating the configuration to enable type aware lint rules:
- 创建一个release分支
git flow release start 1.0.0
- Configure the top-level `parserOptions` property like this:
- 完成release分支
git flow release finish 1.0.0
```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
- 紧急修复
git flow hotfix start hotfix-issue
git flow hotfix finish hotfix-issue

View File

@ -1,18 +0,0 @@
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 },
],
},
}

24
antd-demo/.gitignore vendored
View File

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

View File

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

View File

@ -1,13 +0,0 @@
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<link rel="icon" type="image/svg+xml" href="/vite.svg" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Vite + React + TS</title>
</head>
<body>
<div id="root"></div>
<script type="module" src="/src/main.tsx"></script>
</body>
</html>

View File

@ -1,28 +0,0 @@
{
"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"
}
}

View File

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

Before

Width:  |  Height:  |  Size: 1.5 KiB

View File

@ -1,42 +0,0 @@
#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;
}

View File

@ -1,35 +0,0 @@
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 (
<>
<div>
<a href="https://vitejs.dev" target="_blank">
<img src={viteLogo} className="logo" alt="Vite logo" />
</a>
<a href="https://react.dev" target="_blank">
<img src={reactLogo} className="logo react" alt="React logo" />
</a>
</div>
<h1>Vite + React</h1>
<div className="card">
<button onClick={() => setCount((count) => count + 1)}>
count is {count}
</button>
<p>
Edit <code>src/App.tsx</code> and save to test HMR
</p>
</div>
<p className="read-the-docs">
Click on the Vite and React logos to learn more
</p>
</>
)
}
export default App

View File

@ -1 +0,0 @@
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" class="iconify iconify--logos" width="35.93" height="32" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 228"><path fill="#00D8FF" d="M210.483 73.824a171.49 171.49 0 0 0-8.24-2.597c.465-1.9.893-3.777 1.273-5.621c6.238-30.281 2.16-54.676-11.769-62.708c-13.355-7.7-35.196.329-57.254 19.526a171.23 171.23 0 0 0-6.375 5.848a155.866 155.866 0 0 0-4.241-3.917C100.759 3.829 77.587-4.822 63.673 3.233C50.33 10.957 46.379 33.89 51.995 62.588a170.974 170.974 0 0 0 1.892 8.48c-3.28.932-6.445 1.924-9.474 2.98C17.309 83.498 0 98.307 0 113.668c0 15.865 18.582 31.778 46.812 41.427a145.52 145.52 0 0 0 6.921 2.165a167.467 167.467 0 0 0-2.01 9.138c-5.354 28.2-1.173 50.591 12.134 58.266c13.744 7.926 36.812-.22 59.273-19.855a145.567 145.567 0 0 0 5.342-4.923a168.064 168.064 0 0 0 6.92 6.314c21.758 18.722 43.246 26.282 56.54 18.586c13.731-7.949 18.194-32.003 12.4-61.268a145.016 145.016 0 0 0-1.535-6.842c1.62-.48 3.21-.974 4.76-1.488c29.348-9.723 48.443-25.443 48.443-41.52c0-15.417-17.868-30.326-45.517-39.844Zm-6.365 70.984c-1.4.463-2.836.91-4.3 1.345c-3.24-10.257-7.612-21.163-12.963-32.432c5.106-11 9.31-21.767 12.459-31.957c2.619.758 5.16 1.557 7.61 2.4c23.69 8.156 38.14 20.213 38.14 29.504c0 9.896-15.606 22.743-40.946 31.14Zm-10.514 20.834c2.562 12.94 2.927 24.64 1.23 33.787c-1.524 8.219-4.59 13.698-8.382 15.893c-8.067 4.67-25.32-1.4-43.927-17.412a156.726 156.726 0 0 1-6.437-5.87c7.214-7.889 14.423-17.06 21.459-27.246c12.376-1.098 24.068-2.894 34.671-5.345a134.17 134.17 0 0 1 1.386 6.193ZM87.276 214.515c-7.882 2.783-14.16 2.863-17.955.675c-8.075-4.657-11.432-22.636-6.853-46.752a156.923 156.923 0 0 1 1.869-8.499c10.486 2.32 22.093 3.988 34.498 4.994c7.084 9.967 14.501 19.128 21.976 27.15a134.668 134.668 0 0 1-4.877 4.492c-9.933 8.682-19.886 14.842-28.658 17.94ZM50.35 144.747c-12.483-4.267-22.792-9.812-29.858-15.863c-6.35-5.437-9.555-10.836-9.555-15.216c0-9.322 13.897-21.212 37.076-29.293c2.813-.98 5.757-1.905 8.812-2.773c3.204 10.42 7.406 21.315 12.477 32.332c-5.137 11.18-9.399 22.249-12.634 32.792a134.718 134.718 0 0 1-6.318-1.979Zm12.378-84.26c-4.811-24.587-1.616-43.134 6.425-47.789c8.564-4.958 27.502 2.111 47.463 19.835a144.318 144.318 0 0 1 3.841 3.545c-7.438 7.987-14.787 17.08-21.808 26.988c-12.04 1.116-23.565 2.908-34.161 5.309a160.342 160.342 0 0 1-1.76-7.887Zm110.427 27.268a347.8 347.8 0 0 0-7.785-12.803c8.168 1.033 15.994 2.404 23.343 4.08c-2.206 7.072-4.956 14.465-8.193 22.045a381.151 381.151 0 0 0-7.365-13.322Zm-45.032-43.861c5.044 5.465 10.096 11.566 15.065 18.186a322.04 322.04 0 0 0-30.257-.006c4.974-6.559 10.069-12.652 15.192-18.18ZM82.802 87.83a323.167 323.167 0 0 0-7.227 13.238c-3.184-7.553-5.909-14.98-8.134-22.152c7.304-1.634 15.093-2.97 23.209-3.984a321.524 321.524 0 0 0-7.848 12.897Zm8.081 65.352c-8.385-.936-16.291-2.203-23.593-3.793c2.26-7.3 5.045-14.885 8.298-22.6a321.187 321.187 0 0 0 7.257 13.246c2.594 4.48 5.28 8.868 8.038 13.147Zm37.542 31.03c-5.184-5.592-10.354-11.779-15.403-18.433c4.902.192 9.899.29 14.978.29c5.218 0 10.376-.117 15.453-.343c-4.985 6.774-10.018 12.97-15.028 18.486Zm52.198-57.817c3.422 7.8 6.306 15.345 8.596 22.52c-7.422 1.694-15.436 3.058-23.88 4.071a382.417 382.417 0 0 0 7.859-13.026a347.403 347.403 0 0 0 7.425-13.565Zm-16.898 8.101a358.557 358.557 0 0 1-12.281 19.815a329.4 329.4 0 0 1-23.444.823c-7.967 0-15.716-.248-23.178-.732a310.202 310.202 0 0 1-12.513-19.846h.001a307.41 307.41 0 0 1-10.923-20.627a310.278 310.278 0 0 1 10.89-20.637l-.001.001a307.318 307.318 0 0 1 12.413-19.761c7.613-.576 15.42-.876 23.31-.876H128c7.926 0 15.743.303 23.354.883a329.357 329.357 0 0 1 12.335 19.695a358.489 358.489 0 0 1 11.036 20.54a329.472 329.472 0 0 1-11 20.722Zm22.56-122.124c8.572 4.944 11.906 24.881 6.52 51.026c-.344 1.668-.73 3.367-1.15 5.09c-10.622-2.452-22.155-4.275-34.23-5.408c-7.034-10.017-14.323-19.124-21.64-27.008a160.789 160.789 0 0 1 5.888-5.4c18.9-16.447 36.564-22.941 44.612-18.3ZM128 90.808c12.625 0 22.86 10.235 22.86 22.86s-10.235 22.86-22.86 22.86s-22.86-10.235-22.86-22.86s10.235-22.86 22.86-22.86Z"></path></svg>

Before

Width:  |  Height:  |  Size: 4.0 KiB

View File

@ -1,68 +0,0 @@
: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;
}
}

View File

@ -1,10 +0,0 @@
import React from 'react'
import ReactDOM from 'react-dom/client'
import App from './App.tsx'
import './index.css'
ReactDOM.createRoot(document.getElementById('root')!).render(
<React.StrictMode>
<App />
</React.StrictMode>,
)

View File

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

View File

@ -1,25 +0,0 @@
{
"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" }]
}

View File

@ -1,10 +0,0 @@
{
"compilerOptions": {
"composite": true,
"skipLibCheck": true,
"module": "ESNext",
"moduleResolution": "bundler",
"allowSyntheticDefaultImports": true
},
"include": ["vite.config.ts"]
}

View File

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

View File

@ -1,10 +1,19 @@
<!doctype html>
<!--
* @LastEditors: John
* @Date: 2024-05-22 18:06:14
* @LastEditTime: 2024-06-06 19:23:15
* @Author: John
-->
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<link rel="icon" type="image/svg+xml" href="/src/assets/img/logo.png" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>NEER-APP-H5</title>
<meta
name="viewport"
content="width=device-width, initial-scale=1, maximum-scale=1, minimum-scale=1, user-scalable=no"
/>
<title>Pioneer</title>
</head>
<body>
<div id="root"></div>

View File

@ -1,15 +1,15 @@
{
"name": "neer-app-h5",
"private": true,
"version": "0.0.0",
"version": "1.0.5",
"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": {
"@use-gesture/react": "^10.3.1",
"antd-mobile": "^5.34.0",
"axios": "^1.6.7",
"i18next": "^23.7.20",
@ -18,18 +18,14 @@
"react-i18next": "^14.0.1",
"react-router-dom": "^6.21.3",
"sass": "^1.70.0",
"ts-md5": "^1.3.1",
"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"
}

View File

@ -1,8 +1,9 @@
#root {
max-width: 1280px;
margin: 0 auto;
padding: 2rem;
text-align: center;
}
.adm-center-popup-wrap {
min-width: fit-content !important;
max-width: fit-content !important;
}

View File

@ -1,17 +1,24 @@
/*
* @LastEditors: John
* @Date: 2024-05-22 18:06:14
* @LastEditTime: 2024-06-06 16:49:46
* @Author: John
*/
import "./App.css";
import { useEffect } from "react";
import { BrowserRouter as Router, Route, Routes } from "react-router-dom";
import { HashRouter as Router, Route, Routes } from "react-router-dom";
import SignIn from "./pages/SignIn";
import Download from "./pages/Download";
import SelectCountry from "./pages/SelectCountry";
import { useTranslation } from "react-i18next";
import Auth from "./pages/Auth";
function App() {
const {i18n} = useTranslation()
const lang:string = navigator.language.split('-')[1].toLocaleLowerCase()
useEffect(()=>{
i18n.changeLanguage(lang)
},[ i18n,lang])
const { i18n } = useTranslation();
const lang: string = navigator.language.split("-")[1].toLocaleLowerCase();
useEffect(() => {
i18n.changeLanguage("en");
}, [i18n, lang]);
return (
<Router>
<div>
@ -19,6 +26,7 @@ function App() {
<Route path="/" Component={SignIn} />
<Route path="/Download" Component={Download} />
<Route path="/SelectCountry" Component={SelectCountry} />
<Route path="/Auth" Component={Auth} />
</Routes>
</div>
</Router>

View File

@ -1,15 +1,53 @@
import { request } from "./request";
import { AxiosRequestConfig } from 'axios';
import { AxiosRequestConfig } from "axios";
export type SendCodeResType = {
sms?: boolean;
captcha?: {
bigWidth: number;
bigHeight: number;
bigImageBase64: string;
bigImage: null;
posY: number;
posX: null;
smallWidth: number;
smallHeight: number;
smallImageBase64: string;
smallImage: null;
};
};
//发送验证码
export const sendCode = <T>(params: any,config:AxiosRequestConfig) =>
request.get<T>("/api/account/sendVerificationCode", params, {
export const sendCode = (
params: {
areaCode?: string; // 区号,只有手机号才有
account: string; // 账号(邮箱或手机号)
status: 1 | 2; // 1=登录 2=注册
signature: string;
timestamp: string;
posX?: number;
},
config: AxiosRequestConfig
) =>
request.get<SendCodeResType>("/api/account/sendVerificationCode", params, {
timeout: 15000,
...config
...config,
});
//注册
export const signUp = <T>(params: any,config:AxiosRequestConfig) =>
export const signUp = <T>(
params: {
account: string; // account
area?: string; // 顶级区域:朝鲜/平壤、中国/广东
areaCode?: string; // 区号,只有手机号才有
authCode: string; // 验证码
district?: string; // 二级区域:具体的区域
shareCode: string; // invitation code
userName: string; // 用户名称
password?: string;
},
config: AxiosRequestConfig
) =>
request.post<T>("/api/account/signUp", params, {
timeout: 15000,
...config
});
...config,
});

View File

@ -1,8 +1,11 @@
import axios, { AxiosRequestConfig, AxiosRequestHeaders } from 'axios';
import { Toast } from "antd-mobile";
import axios, { AxiosRequestConfig, AxiosRequestHeaders } from "axios";
//基础URLaxios将会自动拼接在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 baseURL = import.meta.env.DEV
? import.meta.env.VITE_API_URL
: import.meta.env.VITE_API_URL;
//默认请求超时时间
const timeout = 30000;
@ -11,7 +14,7 @@ const service = axios.create({
timeout,
baseURL,
//如需要携带cookie 该值需设为true
withCredentials: true
withCredentials: true,
});
// 统一请求拦截,可配置自定义 headers 例如 language、token 等
service.interceptors.request.use(
@ -21,24 +24,28 @@ service.interceptors.request.use(
config.headers = {};
}
// 配置自定义请求头
const customHeaders: Partial<AxiosRequestHeaders> = {
language: 'zh-cn',
const customHeaders: Partial<AxiosRequestHeaders> = {
// language: "zh-cn",
// 这里可以添加其他自定义头信息,例如 token
};
// 合并自定义头信息到 config.headers 中
config.headers = { ...config.headers, ...customHeaders } as AxiosRequestHeaders;
config.headers = {
...config.headers,
...customHeaders,
appVersion: "1.0.5",
} as AxiosRequestHeaders;
return config;
},
error => {
(error) => {
console.log(error);
return Promise.reject(error);
}
);
//axios返回格式
interface axiosTypes<T>{
interface axiosTypes<T> {
data: T;
status: number;
statusText: string;
@ -47,66 +54,65 @@ interface axiosTypes<T>{
//后台响应数据格式
//###该接口用于规定后台返回的数据格式意为必须携带code、msg以及result
//###而result的数据格式 由外部提供。如此即可根据不同需求,定制不同的数据格式
interface responseTypes<T>{
code: number,
msg: string,
result: T
interface responseTypes<T> {
code: number;
msg: string;
data: T | null;
}
//核心处理代码 将返回一个promise 调用then将可获取响应的业务数据
const requestHandler = <T>(method: 'get' | 'post' | 'put' | 'delete', url: string, params: object = {}, config: AxiosRequestConfig = {}): Promise<T> => {
const requestHandler = <T>(
method: "get" | "post" | "put" | "delete",
url: string,
params: object = {},
config: AxiosRequestConfig = {}
): Promise<axiosTypes<responseTypes<T>>> => {
let response: Promise<axiosTypes<responseTypes<T>>>;
switch(method){
case 'get':
response = service.get(url, {params: { ...params }, ...config});
switch (method) {
case "get":
response = service.get(url, { params: { ...params }, ...config });
break;
case 'post':
response = service.post(url, {...params}, {...config});
case "post":
response = service.post(url, { ...params }, { ...config });
break;
case 'put':
response = service.put(url, {...params}, {...config});
case "put":
response = service.put(url, { ...params }, { ...config });
break;
case 'delete':
response = service.delete(url, {params: { ...params }, ...config});
case "delete":
response = service.delete(url, { params: { ...params }, ...config });
break;
}
return new Promise<T>((resolve, reject) => {
response.then(res => {
//业务代码 可根据需求自行处理
const data = res.data;
if(data.code !== 200 && data.code !== 0){
//特定状态码 处理特定的需求
if(data.code == 401){
console.log('登录异常,执行登出...');
return new Promise<axiosTypes<responseTypes<T>>>((resolve, reject) => {
response
.then((res) => {
if (res.data.code != 0 && res.data.code != 200) {
Toast.show({ content: res.data.msg });
}
//业务代码 可根据需求自行处理
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);
})
})
}
resolve(res as axiosTypes<responseTypes<T>>);
})
.catch((error) => {
const e = JSON.stringify(error);
console.log(`网络错误:${e}`);
Toast.show({ content: "NetWork Error" });
reject(error);
});
});
};
// 使用 request 统一调用包括封装的get、post、put、delete等方法
const request = {
get: <T>(url: string, params?: object, config?: AxiosRequestConfig) => requestHandler<T>('get', url, params, config),
post: <T>(url: string, params?: object, config?: AxiosRequestConfig) => requestHandler<T>('post', url, params, config),
put: <T>(url: string, params?: object, config?: AxiosRequestConfig) => requestHandler<T>('put', url, params, config),
delete: <T>(url: string, params?: object, config?: AxiosRequestConfig) => requestHandler<T>('delete', url, params, config)
get: <T>(url: string, params?: object, config?: AxiosRequestConfig) =>
requestHandler<T>("get", url, params, config),
post: <T>(url: string, params?: object, config?: AxiosRequestConfig) =>
requestHandler<T>("post", url, params, config),
put: <T>(url: string, params?: object, config?: AxiosRequestConfig) =>
requestHandler<T>("put", url, params, config),
delete: <T>(url: string, params?: object, config?: AxiosRequestConfig) =>
requestHandler<T>("delete", url, params, config),
};
// 导出至外层,方便统一使用
export { request };
export { request };

View File

@ -9,7 +9,7 @@
<g>
<path
d="M15.38570390625,3.583333L2.33317390625,3.583333C2.2623339062500003,3.583333,2.19317390625,3.592083,2.12692390625,3.6091670000000002L8.449003906249999,9.93083C8.61171390625,10.09349,8.87546390625,10.09349,9.03817390625,9.93083L15.38570390625,3.583333ZM16.28690390625,3.86042L11.19520390625,8.952079999999999L16.33070390625,14.0871C16.436903906250002,13.9471,16.49980390625,13.7725,16.49980390625,13.5833L16.49980390625,4.41667C16.49980390625,4.20292,16.41940390625,4.00833,16.28730390625,3.86042L16.28690390625,3.86042ZM15.48150390625,14.4167L10.60650390625,9.54125L9.62733390625,10.52042C9.13916390625,11.00867,8.347593906250001,11.00867,7.85942390625,10.52042L6.88067390625,9.54125L2.05400390625,14.3688C2.14150390625,14.3996,2.23525390625,14.4167,2.33358390625,14.4167L15.48190390625,14.4167L15.48150390625,14.4167ZM1.51275390625,13.7308L6.29150390625,8.95167L1.5306709062500001,4.19167C1.51018390625,4.26491,1.4998099062499999,4.34061,1.49983690625,4.41667L1.49983690625,13.5833C1.49983690625,13.6333,1.50400390625,13.6829,1.51275390625,13.7308ZM2.33317390625,2.75L15.66650390625,2.75C16.58700390625,2.75,17.33320390625,3.4961919999999997,17.33320390625,4.41667L17.33320390625,13.5833C17.33320390625,14.5038,16.58700390625,15.25,15.66650390625,15.25L2.33317390625,15.25C1.41269590625,15.25,0.66650390625,14.5038,0.66650390625,13.5833L0.66650390625,4.41667C0.666503757238,3.4961919999999997,1.41269590625,2.75,2.33317390625,2.75Z"
fill="#333333" fill-opacity="1" />
fill="#999999" fill-opacity="1" />
</g>
</g>
</svg>

Before

Width:  |  Height:  |  Size: 1.9 KiB

After

Width:  |  Height:  |  Size: 1.9 KiB

View File

@ -9,7 +9,7 @@
<g>
<path
d="M15.38570390625,3.583333L2.33317390625,3.583333C2.2623339062500003,3.583333,2.19317390625,3.592083,2.12692390625,3.6091670000000002L8.449003906249999,9.93083C8.61171390625,10.09349,8.87546390625,10.09349,9.03817390625,9.93083L15.38570390625,3.583333ZM16.28690390625,3.86042L11.19520390625,8.952079999999999L16.33070390625,14.0871C16.436903906250002,13.9471,16.49980390625,13.7725,16.49980390625,13.5833L16.49980390625,4.41667C16.49980390625,4.20292,16.41940390625,4.00833,16.28730390625,3.86042L16.28690390625,3.86042ZM15.48150390625,14.4167L10.60650390625,9.54125L9.62733390625,10.52042C9.13916390625,11.00867,8.347593906250001,11.00867,7.85942390625,10.52042L6.88067390625,9.54125L2.05400390625,14.3688C2.14150390625,14.3996,2.23525390625,14.4167,2.33358390625,14.4167L15.48190390625,14.4167L15.48150390625,14.4167ZM1.51275390625,13.7308L6.29150390625,8.95167L1.5306709062500001,4.19167C1.51018390625,4.26491,1.4998099062499999,4.34061,1.49983690625,4.41667L1.49983690625,13.5833C1.49983690625,13.6333,1.50400390625,13.6829,1.51275390625,13.7308ZM2.33317390625,2.75L15.66650390625,2.75C16.58700390625,2.75,17.33320390625,3.4961919999999997,17.33320390625,4.41667L17.33320390625,13.5833C17.33320390625,14.5038,16.58700390625,15.25,15.66650390625,15.25L2.33317390625,15.25C1.41269590625,15.25,0.66650390625,14.5038,0.66650390625,13.5833L0.66650390625,4.41667C0.666503757238,3.4961919999999997,1.41269590625,2.75,2.33317390625,2.75Z"
fill="#BF62FF" fill-opacity="1" />
fill="#FCB44B" fill-opacity="1" />
</g>
</g>
</svg>

Before

Width:  |  Height:  |  Size: 1.9 KiB

After

Width:  |  Height:  |  Size: 1.9 KiB

File diff suppressed because one or more lines are too long

Before

Width:  |  Height:  |  Size: 6.7 KiB

After

Width:  |  Height:  |  Size: 6.7 KiB

File diff suppressed because one or more lines are too long

Before

Width:  |  Height:  |  Size: 6.7 KiB

After

Width:  |  Height:  |  Size: 6.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 684 B

After

Width:  |  Height:  |  Size: 2.9 KiB

View File

@ -1,74 +1,33 @@
/* eslint-disable @typescript-eslint/no-unused-vars */
import { useState, useEffect } from "react";
import { useState, useRef } from "react";
import { useTranslation } from "react-i18next";
import { Form, Input, Button } from "antd-mobile";
import "../pages/SignIn.scss";
import { useCountdown } from "../hooks/useCountdown";
import { sendCode, signUp } from "../api";
import { sendCodeTypes, signUpTypes,ErrorType } from "../type/SignIn";
import { signUp } from "../api";
import { signUpTypes, ErrorType } from "../type/SignIn";
import { Toast } from "antd-mobile";
import { useNavigate } from "react-router-dom";
import { Md5 } from "ts-md5";
import { FormInstance } from "antd-mobile/es/components/form";
import useUserStore from "../store/user";
import SendVerificationCode from "./SendVerificationCode";
function EmailForm() {
const formRef = useRef<FormInstance>(null);
const navigate = useNavigate();
const { t } = useTranslation();
const { start, time } = useCountdown();
const [email, setEmail] = useState("");
const [authCode, setAuthCode] = useState("");
const [shareCode, setShareCode] = useState("");
const [remainingTime, setRemainingTime] = useState(0);
const [password, setPassword] = useState("");
const [confirmPassword, setConfirmPassword] = useState("");
const { Lang } = useUserStore();
const config = {
headers: {
"Accept-Language": navigator.language,
"Accept-Language": Lang,
},
};
const sendVerificationCode = async () => {
try {
if (email === "") {
return;
}
const res = await sendCode<sendCodeTypes>(
{
account: email,
areaCode: "",
status: 2,
},
config
);
console.log("res", res);
if (res.status === 200 && res.data.data.sms) {
Toast.show({
content: t('send successfully'),
afterClose: () => {
start(60 * 1000);
},
});
} else {
Toast.show({
content: t('Send failure'),
afterClose: () => {
start(60 * 1000);
},
});
}
} catch (error:unknown) {
// 检查 error 是否是 ErrorType 类型
if (typeof error === 'object' && error !== null && 'msg' in error) {
const typedError = error as ErrorType; // 使用类型断言
Toast.show({
content: typedError.msg,
afterClose: () => {
start(60 * 1000);
},
});
} else {
// 处理不是 ErrorType 类型的错误
console.log('An unexpected error occurred');
}
console.warn(error);
}
};
useEffect(() => {
setRemainingTime(time / 1000);
}, [time]);
const handleSignUp = async () => {
if (email === "" || authCode === "") {
return;
@ -80,37 +39,47 @@ function EmailForm() {
area: "",
areaCode: "",
authCode: authCode,
shareCode: shareCode,
shareCode: shareCode || formRef.current?.getFieldValue("shareCode"),
userName: "",
password: Md5.hashStr(password),
},
config
);
console.log("res", res);
if (res.status === 200 && res.data.data.token) {
if (res.status === 200 && res.data.data?.token) {
Toast.show({
content: res.data.msg,
});
setTimeout(() => {
navigate("/Download");
}, 1000);
} else {
Toast.show({
content: res.data.msg,
});
}
} catch (error:unknown) {
} catch (error: unknown) {
// 检查 error 是否是 ErrorType 类型
if (typeof error === 'object' && error !== null && 'msg' in error) {
if (typeof error === "object" && error !== null && "msg" in error) {
const typedError = error as ErrorType; // 使用类型断言
Toast.show({
content: typedError.msg,
});
} else {
// 处理不是 ErrorType 类型的错误
console.log('An unexpected error occurred');
console.log("An unexpected error occurred");
}
console.warn(error);
}
};
return (
<Form
ref={formRef}
name="form"
initialValues={{
shareCode: getShareCode(window.location.search),
}}
footer={
<Button
block
@ -118,11 +87,14 @@ function EmailForm() {
type="submit"
color="primary"
size="large"
onClick={handleSignUp}
// onClick={handleSignUp}
>
{t("register")}
</Button>
}
onFinish={() => {
handleSignUp();
}}
>
<Form.Item
name="account"
@ -136,6 +108,60 @@ function EmailForm() {
onChange={(text) => setEmail(text)}
/>
</Form.Item>
<Form.Item
name="password"
rules={[
{
required: true,
message: t("Please enter password"),
},
{
validator: (_, v: string) => {
if (v && (v.length < 6 || v.length > 30)) {
return Promise.reject(
new Error(
t(
"Please ensure your password length is between 6 and 30 characters."
)
)
);
}
return Promise.resolve();
},
},
]}
>
<Input
type="password"
placeholder={t("Please enter password")}
value={password}
onChange={(v) => setPassword(v)}
/>
</Form.Item>
<Form.Item
name="confirmPassword"
rules={[
{
required: true,
message: t("Please enter confirm password"),
},
{
validator: (_, v: string) => {
if (v != password) {
return Promise.reject(new Error(t("Passwords do not match")));
}
return Promise.resolve();
},
},
]}
>
<Input
type="password"
placeholder={t("Please enter confirm password")}
value={confirmPassword}
onChange={(v) => setConfirmPassword(v)}
/>
</Form.Item>
<Form.Item
name="authCode"
rules={[
@ -151,15 +177,16 @@ function EmailForm() {
onChange={(code) => setAuthCode(code)}
/>
</Form.Item>
{remainingTime === 0 ? (
<p className="send-code" onClick={sendVerificationCode}>
{t("Send verification code")}
</p>
) : (
<p className="send-code">
{remainingTime} {t("seconds")}
</p>
)}
<SendVerificationCode
account={email}
beforeSendVerificationCode={() => {
if (!/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(email)) {
Toast.show({ content: t("Invalid email") });
return false;
}
return true;
}}
/>
<Form.Item name="shareCode">
<Input
@ -172,4 +199,19 @@ function EmailForm() {
);
}
const getShareCode = (url: string) => {
const newStr = url.replace("?", "")?.split("&");
if (!newStr) return "";
const shareStr = newStr.find((item) => item.includes("shareCode"));
if (!shareStr) return "";
if (shareStr) {
const code = shareStr.split("=")[1];
if (code) {
// setShareCode(code)
return code;
}
}
return "";
};
export default EmailForm;

View File

@ -1,28 +1,60 @@
import { useState, useEffect } from "react";
/*
* @LastEditors: John
* @Date: 2024-06-06 21:23:46
* @LastEditTime: 2024-06-14 16:26:14
* @Author: John
*/
/*
* @LastEditors: John
* @Date: 2024-06-03 18:43:16
* @LastEditTime: 2024-06-13 15:56:56
* @Author: John
*/
import { useState, useRef } from "react";
import { useTranslation } from "react-i18next";
import { Form, Input, Button } from "antd-mobile";
import { useNavigate } from "react-router-dom";
import "../pages/SignIn.scss";
import useUserStore from "../store/user.ts";
import { useCountdown } from "../hooks/useCountdown";
import { sendCode, signUp } from "../api";
import { sendCodeTypes, signUpTypes,ErrorType} from "../type/SignIn";
import { signUp } from "../api";
import { signUpTypes, ErrorType } from "../type/SignIn";
import { Toast } from "antd-mobile";
import { Md5 } from "ts-md5";
import { FormInstance } from "antd-mobile/es/components/form/form";
import SendVerificationCode from "./SendVerificationCode";
const defaultAreaCode = "+1";
function PhoneForm() {
const formRef = useRef<FormInstance>(null);
const { t } = useTranslation();
const { start, time } = useCountdown();
const navigate = useNavigate();
const {
SelectCountry,
CurrentPhoneNumber,
UpdateCurrentPhoneNumber,
UpdatePreviousPathName,
Lang,
} = useUserStore();
const defaultAreaCode = "+1";
const getShareCode = (url: string) => {
const newStr = url.replace("?", "")?.split("&");
if (!newStr) return "";
const shareStr = newStr.find((item) => item.includes("shareCode"));
if (!shareStr) return "";
if (shareStr) {
const code = shareStr.split("=")[1];
if (code) {
// setShareCode(code)
return code;
}
}
return "";
};
const [authCode, setAuthCode] = useState("");
const [shareCode, setShareCode] = useState("");
const [remainingTime, setRemainingTime] = useState(0);
const [password, setPassword] = useState("");
const [confirmPassword, setConfirmPassword] = useState("");
const gotoSelectCountry = () => {
UpdatePreviousPathName("/");
@ -33,97 +65,61 @@ function PhoneForm() {
};
const config = {
headers: {
"Accept-Language": navigator.language,
"Accept-Language": Lang,
},
};
const sendVerificationCode = async () => {
try {
if (CurrentPhoneNumber === "") {
return;
}
const res = await sendCode<sendCodeTypes>({
account: CurrentPhoneNumber,
areaCode: SelectCountry?.code,
status: 2,
},config);
console.log("res", res);
if (res.status === 200 && res.data.data.sms) {
Toast.show({
content:t('send successfully'),
afterClose: () => {
start(60 * 1000);
},
});
} else {
Toast.show({
content: t('Send failure'),
afterClose: () => {
start(60 * 1000);
},
});
}
} catch (error:unknown) {
// 检查 error 是否是 ErrorType 类型
if (typeof error === 'object' && error !== null && 'msg' in error) {
const typedError = error as ErrorType; // 使用类型断言
Toast.show({
content: typedError.msg,
afterClose: () => {
start(60 * 1000);
},
});
} else {
// 处理不是 ErrorType 类型的错误
console.log('An unexpected error occurred');
}
console.warn(error);
}
};
useEffect(() => {
setRemainingTime(time / 1000)
}, [time]);
const handleSignUp = async () =>{
if(CurrentPhoneNumber === '' || authCode === '') {
return
const handleSignUp = async () => {
if (CurrentPhoneNumber === "" || authCode === "") {
return;
}
try {
const res = await signUp<signUpTypes>({
account:CurrentPhoneNumber,
area:SelectCountry?.cn,
areaCode:SelectCountry?.code,
authCode:authCode,
shareCode:shareCode
},config)
console.log('res',res)
if(res.status === 200 && res.data.data.token) {
const res = await signUp<signUpTypes>(
{
account: CurrentPhoneNumber,
area: SelectCountry?.cn,
areaCode: SelectCountry?.code,
authCode: authCode,
shareCode: shareCode || formRef.current?.getFieldValue("shareCode"),
userName: "",
password: Md5.hashStr(password),
},
config
);
if (res.status === 200 && res.data.data?.token) {
Toast.show({
content: res.data.msg,
})
}else {
});
setTimeout(() => {
navigate("/Download");
}, 1000);
} else {
Toast.show({
content: res.data.msg,
})
});
}
} catch (error:unknown) {
} catch (error: unknown) {
// 检查 error 是否是 ErrorType 类型
if (typeof error === 'object' && error !== null && 'msg' in error) {
if (typeof error === "object" && error !== null && "msg" in error) {
const typedError = error as ErrorType; // 使用类型断言
Toast.show({
content: typedError.msg,
});
} else {
// 处理不是 ErrorType 类型的错误
console.log('An unexpected error occurred');
console.log("An unexpected error occurred");
}
console.warn(error);
}
};
return (
<Form
name="form"
ref={formRef}
initialValues={{
shareCode: getShareCode(window.location.search),
}}
footer={
<Button
block
@ -131,16 +127,27 @@ function PhoneForm() {
type="submit"
color="primary"
size="large"
onClick={handleSignUp}
// onClick={handleSignUp}
>
{t("register")}
</Button>
}
onFinish={() => {
handleSignUp();
}}
>
<Form.Item
name="account"
rules={[
{ required: true, message: t("Please enter your phone number") },
{
validator: (_, v) => {
if (v != "" && !/^\d+$/.test(v)) {
return Promise.reject(new Error(t("Invalid phone number")));
}
return Promise.resolve();
},
},
]}
>
<div className="phone-box">
@ -154,6 +161,58 @@ function PhoneForm() {
/>
</div>
</Form.Item>
<Form.Item
name="password"
rules={[
{
required: true,
message: t("Please enter password"),
},
{
validator: (_, v: string) => {
if (v && (v.length < 6 || v.length > 30)) {
return Promise.reject(
new Error(
t("password length is between 6 and 30 characters.")
)
);
}
return Promise.resolve();
},
},
]}
>
<Input
type="password"
placeholder={t("Please enter password")}
value={password}
onChange={(v) => setPassword(v)}
/>
</Form.Item>
<Form.Item
name="confirmPassword"
rules={[
{
required: true,
message: t("Please enter confirm password"),
},
{
validator: (_, v: string) => {
if (v != password) {
return Promise.reject(new Error(t("Passwords do not match")));
}
return Promise.resolve();
},
},
]}
>
<Input
type="password"
placeholder={t("Please enter confirm password")}
value={confirmPassword}
onChange={(v) => setConfirmPassword(v)}
/>
</Form.Item>
<Form.Item
name="authCode"
rules={[
@ -169,15 +228,17 @@ function PhoneForm() {
onChange={(code) => setAuthCode(code)}
/>
</Form.Item>
{remainingTime === 0 ? (
<p className="send-code" onClick={sendVerificationCode}>
{t("Send verification code")}
</p>
) : (
<p className="send-code">
{remainingTime} {t("seconds")}
</p>
)}
<SendVerificationCode
account={CurrentPhoneNumber}
areaCode={SelectCountry?.code || defaultAreaCode}
beforeSendVerificationCode={() => {
if (CurrentPhoneNumber == "") {
Toast.show({ content: t("Invalid phone number") });
return false;
}
return true;
}}
/>
<Form.Item name="shareCode">
<Input
placeholder={t("Please enter the invitation code (optional)")}

View File

@ -0,0 +1,167 @@
import { DotLoading, Modal, Toast } from "antd-mobile";
import { useEffect, useRef, useState } from "react";
import SilderVertify, { SilderVertify_handleType } from "./SilderVertify";
import { useCountdown } from "../hooks/useCountdown";
import useUserStore from "../store/user";
import { sendCode } from "../api";
import { Md5 } from "ts-md5";
import { useTranslation } from "react-i18next";
import { ErrorType } from "../type/SignIn";
export default function ({
account,
areaCode,
beforeSendVerificationCode,
}: {
account: string;
areaCode?: string;
beforeSendVerificationCode?: () => boolean;
}) {
const [remainingTime, setRemainingTime] = useState(0);
const { start, time } = useCountdown();
const { t } = useTranslation();
const { Lang } = useUserStore();
const [bigImage, setBigImage] = useState<string>("");
const [smallImage, setSmallImage] = useState<string>("");
const [smallImageY, setSmallImageY] = useState(0);
const SilderVertifyRef = useRef<SilderVertify_handleType>(null);
const [visible, setVisible] = useState(false);
const [sendingverfityCodeLoading, setSendingverfityCodeLoading] =
useState(false);
const config = {
headers: {
"Accept-Language": Lang,
},
};
async function getVerfityCode() {
return new Promise<void>(async (reslove, _reject) => {
const timestamp = `${new Date().getTime()}`;
if (sendingverfityCodeLoading) return;
setSendingverfityCodeLoading(true);
try {
const res = await sendCode(
{
account: account,
areaCode,
status: 2,
signature: Md5.hashStr(`Neer${account},${2},${timestamp}GetCode`),
timestamp,
},
config
);
if (res.status == 200 && res.data.code == 0) {
setBigImage(res.data.data?.captcha?.bigImageBase64 || "");
setSmallImage(res.data.data?.captcha?.smallImageBase64 || "");
setSmallImageY(res.data.data?.captcha?.posY || 0);
reslove();
}
} catch (error) {}
setSendingverfityCodeLoading(false);
});
}
const sendVerificationCode = async () => {
try {
if (beforeSendVerificationCode && !beforeSendVerificationCode?.()) {
return;
}
await getVerfityCode();
setVisible(true);
} catch (error: unknown) {
// 检查 error 是否是 ErrorType 类型
if (typeof error === "object" && error !== null && "msg" in error) {
const typedError = error as ErrorType; // 使用类型断言
Toast.show({
content: typedError.msg,
afterClose: () => {
// start(60 * 1000);
},
});
} else {
// 处理不是 ErrorType 类型的错误
console.log("An unexpected error occurred");
}
console.warn(error);
}
};
useEffect(() => {
setRemainingTime(time / 1000);
}, [time]);
return (
<>
{remainingTime === 0 ? (
<p className="send-code" onClick={sendVerificationCode}>
{t("Send verification code")}
</p>
) : (
<p className="send-code">
{remainingTime} {t("seconds")}
</p>
)}
<Modal
visible={visible}
content={
<>
<SilderVertify
bigImage={bigImage}
smallImage={smallImage}
smallImageY={smallImageY}
ref={SilderVertifyRef}
onFinish={async (pox) => {
const timestamp = `${new Date().getTime()}`;
const res = await sendCode(
{
account: account,
areaCode,
status: 2,
signature: Md5.hashStr(
`Neer${account},${2},${timestamp}GetCode`
),
timestamp,
posX: pox,
},
config
);
if (res.status === 200 && res.data.data?.sms) {
Toast.show({
content: t("send successfully"),
afterClose: () => {
start(60 * 1000);
},
});
setVisible(false);
} else {
Toast.show({
content: res.data.msg,
});
if (res.data.code == 1021 || res.data.code == 1015) {
await getVerfityCode();
SilderVertifyRef.current?._init();
return;
}
setVisible(false);
}
}}
/>
</>
}
closeOnMaskClick={true}
onClose={() => {
setVisible(false);
}}
/>
<Modal
visible={sendingverfityCodeLoading}
content={
<>
<DotLoading />
</>
}
closeOnMaskClick={false}
onClose={() => {
setSendingverfityCodeLoading(false);
}}
/>
</>
);
}

View File

@ -0,0 +1,124 @@
import { useDrag } from "@use-gesture/react";
import { forwardRef, useState, useImperativeHandle, useEffect } from "react";
import { useTranslation } from "react-i18next";
/*
* @LastEditors: John
* @Date: 2024-06-06 16:41:24
* @LastEditTime: 2024-06-14 16:35:28
* @Author: John
*/
export type SilderVertify_handleType = {
_init: () => void;
};
const SilderVertify = forwardRef<
SilderVertify_handleType,
{
bigImage: string;
smallImage: string;
smallImageY: number;
onFinish: (pox: number) => Promise<void>;
}
>(function ({ bigImage, smallImage, smallImageY, onFinish }, ref) {
const [offsetX, setOffsetX] = useState(0);
// Set the drag hook and define component movement based on gesture data.
const bind = useDrag(async ({ event, down, movement: [mx, _] }) => {
event.preventDefault();
// console.log(down, [mx, my]);
if (down) {
if (mx <= 0) return;
if (mx >= 280) return;
setOffsetX(mx);
} else {
await onFinish(parseInt(`${mx}`));
setOffsetX(0);
}
});
const { t } = useTranslation();
useImperativeHandle(ref, () => {
return {
_init() {
init();
},
};
});
async function init() {
setOffsetX(0);
}
useEffect(() => {
init();
return () => {};
}, []);
return (
<div
style={{
width: "320px",
display: "flex",
flexDirection: "column",
gap: "10px",
}}
>
<span>{t("Complete security verification")}</span>
<div
style={{
width: "100%",
height: "160px",
position: "relative",
}}
>
<img
style={{ width: "100%", height: "100%" }}
src={`data:image/png;base64,${bigImage}`}
alt=""
/>
<img
style={{
width: "40px",
height: "40px",
position: "absolute",
left: `${offsetX}px`,
top: `${smallImageY}px`,
}}
src={`data:image/png;base64,${smallImage}`}
alt=""
/>
</div>
<div
style={{
width: "100%",
height: "40px",
borderWidth: "1px",
borderStyle: "solid",
borderColor: "#e4e7eb",
position: "relative",
}}
>
<div
style={{
width: "40px",
height: "40px",
borderWidth: "1px",
borderStyle: "solid",
borderColor: "#593B8B",
display: "flex",
justifyContent: "center",
alignItems: "center",
position: "absolute",
top: 0,
left: `${offsetX}px`,
touchAction: "none",
}}
{...bind()}
>
<span>--{">"}</span>
</div>
</div>
</div>
);
});
export default SilderVertify;

View File

@ -1,24 +1,30 @@
{
"E-mail": "电子邮件",
"phone":"电话",
"Please enter your email address":"请输入您的电子邮件地址",
"Please enter the email verification code":"请输入电子邮件验证码",
"Please enter your phone number":"请输入您的电话号码",
"Please enter SMS verification code":"请输入短信验证码",
"Send verification code":"发送验证码",
"Please enter the invitation code (optional)":"请输入邀请码(可选)",
"register":"注册",
"If you already have an account":"如果你已经有一个帐户",
"download the APP directly":"直接下载APP",
"Continuing to represent you in agreeing to our":"继续代表你方同意我们的",
"Terms of Service":"服务条款",
"and":"和",
"Privacy Policy":"隐私政策",
"Select country/region":"选择国家/地区",
"seconds": "秒",
"Official Website":"官方网站",
"Download":"下载",
"send successfully":"发送成功",
"Send failure":"发送失败"
}
"E-mail": "電子郵件",
"phone": "電話",
"Please enter your email address": "請輸入您的電子郵件地址",
"Please enter the email verification code": "請輸入電子郵件驗證碼",
"Please enter your phone number": "請輸入您的電話號碼",
"Please enter SMS verification code": "請輸入短信驗證碼",
"Send verification code": "發送驗證碼",
"Please enter the invitation code (optional)": "請輸入邀請碼(可選)",
"register": "注冊",
"If you already have an account": "已有帳戶",
"download the APP directly": "直接下載APP",
"Continuing to represent you in agreeing to our": "繼續代表妳方同意我們的",
"Terms of Service": "服務條款",
"and": "和",
"Privacy Policy": "隱私政策",
"Select country/region": "選擇國家/地區",
"seconds": "秒",
"Official Website": "官方網站",
"Download": "下載",
"send successfully": "發送成功",
"Send failure": "發送失敗",
"Invalid phone number": "無效手機號碼",
"Invalid email": "無效電子郵件",
"Complete security verification": "完成安全驗證",
"Please enter password": "請輸入密碼",
"Please enter confirm password": "確認密碼",
"password length is between 6 and 30 characters.": "請確保您的密碼長度在6位到30位之間",
"Passwords do not match": "密碼不一致"
}

View File

@ -1,23 +1,30 @@
{
"E-mail": "E-mail",
"phone":"phone",
"Please enter your email address":"Please enter your email address",
"Please enter the email verification code":"Please enter the email verification code",
"Please enter your phone number":"Please enter your phone number",
"Please enter SMS verification code":"Please enter SMS verification code",
"Send verification code":"Send verification code",
"Please enter the invitation code (optional)":"Please enter the invitation code (optional)",
"register":"register",
"If you already have an account":"If you already have an account",
"download the APP directly":"download the APP directly",
"Continuing to represent you in agreeing to our":"Continuing to represent you in agreeing to our",
"Terms of Service":"Terms of Service",
"and":"and",
"Privacy Policy":"Privacy Policy",
"Select country/region":"Select country/region",
"seconds": "s",
"Official Website":"Official Website",
"Download":"Download",
"send successfully":"send successfully",
"Send failure":"Send failure"
"phone": "phone",
"Please enter your email address": "Please enter your email address",
"Please enter the email verification code": "Please enter the email verification code",
"Please enter your phone number": "Please enter your phone number",
"Please enter SMS verification code": "Please enter SMS verification code",
"Send verification code": "Send verification code",
"Please enter the invitation code (optional)": "Please enter the invitation code (optional)",
"register": "Register",
"If you already have an account": "If you already have an account",
"download the APP directly": "download the APP directly",
"Continuing to represent you in agreeing to our": "Continuing to represent you in agreeing to our",
"Terms of Service": "Terms of Service",
"and": "and",
"Privacy Policy": "Privacy Policy",
"Select country/region": "Select country/region",
"seconds": "s",
"Official Website": "Official Website",
"Download": "Download",
"send successfully": "send successfully",
"Send failure": "Send failure",
"Invalid phone number": "Invalid phone number",
"Invalid email": "Invalid email",
"Complete security verification": "Complete security verification",
"Please enter password": "Please enter password",
"Please enter confirm password": "Please enter confirm password",
"password length is between 6 and 30 characters.": "password length is between 6 and 30 characters.",
"Passwords do not match": "Passwords do not match"
}

View File

@ -1,5 +1,5 @@
:
{
body,
html {
font-family: Inter, system-ui, Avenir, Helvetica, Arial, sans-serif;
line-height: 1.5;
font-weight: 400;
@ -13,16 +13,19 @@
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
}
#root {
padding: 0;
background: #fafafb;
}
a {
font-weight: 500;
color: #646cff;
text-decoration: inherit;
}
a:hover {
color: #535bf2;
}
@ -51,23 +54,31 @@ button {
cursor: pointer;
transition: border-color 0.25s;
}
button:hover {
border-color: #646cff;
}
button:focus,
button:focus-visible {
outline: 4px auto -webkit-focus-ring-color;
}
.adm-form-item-feedback-error {
text-align: left;
}
@media (prefers-color-scheme: light) {
:root {
color: #213547;
background-color: #ffffff;
}
a:hover {
color: #747bff;
}
button {
background-color: #f9f9f9;
}
}
}

View File

@ -1,10 +1,5 @@
import React from 'react'
import ReactDOM from 'react-dom/client'
import App from './App.tsx'
import './index.css'
import './i18n/config.ts'
ReactDOM.createRoot(document.getElementById('root')!).render(
<React.StrictMode>
<App />
</React.StrictMode>,
)
import ReactDOM from "react-dom/client";
import App from "./App.tsx";
import "./index.css";
import "./i18n/config.ts";
ReactDOM.createRoot(document.getElementById("root")!).render(<App />);

15
src/pages/Auth.tsx Normal file
View File

@ -0,0 +1,15 @@
/*
* @LastEditors: John
* @Date: 2024-06-06 11:22:50
* @LastEditTime: 2024-06-06 11:35:16
* @Author: John
*/
export default function () {
return (
<>
<a href="pioneer://example/path" style={{ color: "black" }}>
Open My App with Params
</a>
</>
);
}

View File

@ -1,5 +1,5 @@
.container {
background: #fafafb;
background: #131313;
width: 100vw;
min-height: 100vh;
padding: 4.625rem 2.5rem;
@ -18,12 +18,16 @@
.btn-box {
margin-top: 11.4375rem;
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
.btn-item {
width: 18.4375rem;
height: 2.75rem;
border-radius: .3125rem;
box-sizing: border-box;
border: .0625rem solid #BF62FF;
border: .0625rem solid #FCB44B;
margin-bottom: 1.25rem;
display: flex;
align-items: center;
@ -36,7 +40,7 @@
a {
font-family: PingFang SC;
font-size: 1.125rem;
color: #333333;
color: #ffffff;
}
}
}

View File

@ -1,5 +1,5 @@
import googleIcon from '../assets/img/google.png'
import appStoreIcon from '../assets/img/app_store.png'
// import googleIcon from '../assets/img/google.png'
// import appStoreIcon from '../assets/img/app_store.png'
import { useTranslation } from "react-i18next";
import Logo from "../assets/img/logo.png"
@ -14,19 +14,19 @@ function Download() {
<img src={Logo} alt="" />
</div>
<div className="btn-box">
<div className="btn-item">
{/* <div className="btn-item">
<img src={googleIcon}alt="" />
<a href="">Google Play</a>
<a>Google Play</a>
</div>
<div className="btn-item">
<img src={appStoreIcon} alt="" />
<a href="">App Store</a>
<a>App Store</a>
</div> */}
<div className="btn-item">
<a href="https://d.pineer.cc/app-release.apk">{t('Download')} APK</a>
</div>
<div className="btn-item">
<a href="http://8.217.122.133/upload/apk/app-release.apk">{t('Download')} APK</a>
</div>
<div className="btn-item">
<a href="">{t('Official Website')}</a>
<a href="https://www.pineer.cc">{t('Official Website')}</a>
</div>
</div>
</div>

View File

@ -55,7 +55,7 @@
}
}
.area-box {
overflow: scroll;
overflow-y: scroll;
height: calc(100vh - 7.5rem);
padding: 0 1.5rem;
box-sizing: border-box;
@ -69,8 +69,8 @@
line-height: 3.25rem;
border-bottom: .0625rem solid #D8D8D8;
&.selected {
border-bottom: .0625rem solid #BF62FF;
color: #BF62FF;
border-bottom: .0625rem solid #FCB44B;
color: #FCB44B;
}
}
}

View File

@ -1,15 +1,32 @@
.popoverContainer {
.adm-popover-inner {
.adm-popover-inner-content {
padding: 0 !important;
}
}
}
.container {
background: #fafafb;
width: 100vw;
min-height: 100vh;
padding: 4.625rem 2.5rem;
box-sizing: border-box;
position: relative;
.language {
position: absolute;
right: 3rem;
top: 2rem;
color: #fff;
}
.logo {
width: 4.25rem;
height: 4.25rem;
margin-left: 50%;
transform: translateX(-50%);
img {
width: 100%;
height: 100%;
@ -26,14 +43,16 @@
font-size: 18px;
font-weight: normal;
line-height: normal;
color: #333333;
color: #999999;
display: flex;
align-items: center;
margin-right: 2.0625rem;
&.selected {
border-bottom: .0625rem solid #BF62FF;
color:#BF62FF;
border-bottom: .0625rem solid #FCB44B;
color: #FCB44B;
}
img {
margin-right: .4375rem;
}
@ -47,16 +66,19 @@
}
.adm-list-item {
background: #FFFFFF;
background: #333333;
margin-bottom: 1.7rem;
width: 100%;
height: 2.75rem;
border-radius: .3125rem;
box-sizing: border-box;
border: 1px solid #999999 !important;
box-shadow: 0px 2px 5px 0px rgba(153, 153, 153, 50%);
border: 1px solid #56512c !important;
// box-shadow: 0px 2px 5px 0px rgba(153, 153, 153, 50%);
padding-left: 0;
.adm-input-element {
color: #c6c6c6;
&::placeholder {
font-size: .75rem;
color: #999999
@ -67,55 +89,70 @@
.adm-list-item-content {
border-style: none;
}
.adm-list-item-content-main {
padding: 0;
}
.adm-input {
padding: .75rem 0;
padding: 0.5rem 0 0.6rem 0;
padding-left: .625rem;
}
.send-code {
font-family: PingFang SC;
font-size: .75rem;
color: #BF62FF;
margin-bottom:.9375rem;
color: #0957c0;
margin-bottom: 1.5375rem;
margin-top: -0.5rem;
text-align: right;
}
.adm-form-footer {
display: flex;
justify-content: center;
}
.submit-btn {
display: flex;
justify-content: center;
align-items: center;
width: 6.1875rem;
height: 2.75rem;
border-radius: .3125rem;
background: #BF62FF;
background: #FCB44B;
font-family: PingFang SC;
font-size: .75rem;
color: #FFFFFF;
color: #333;
}
.to-download {
font-family: PingFang SC;
font-size: .875rem;
color: #BF62FF;
color: #0957c0;
}
.terms-service {
font-family: PingFang SC;
font-size: .75rem;
text-align: center;
width: 100%;
margin-top: 5rem;
p {
color: #999999;
}
span {
color:#BF62FF;
span>a {
color: #0957c0;
}
}
.phone-box {
display: flex;
align-items: center;
border-radius: .3125rem;
span {
width: 3.75rem;
height: 2.6rem;
@ -123,18 +160,17 @@
text-align: center;
font-family: PingFang SC;
font-size: .75rem;
color: #666666;
background: #EAEAEA;
border-right: .0625rem solid #999999;
border-left: .0625rem solid #999999;
border-bottom: .0625rem solid #999999;
color: #c6c6c6;
background: #333333;
border-right: .0625rem solid #5d5d5d;
border-top-left-radius: .3125rem;
border-bottom-left-radius: .3125rem;
}
.adm-input {
padding-top: 0.55rem;
padding-top: 0rem;
padding-left: 0.625rem;
padding-bottom: 0;
padding-bottom: 0.1rem;
}
}
}

View File

@ -1,39 +1,107 @@
import { useState, useEffect } from "react";
import { useTranslation } from "react-i18next";
import { useTranslation, getI18n } from "react-i18next";
import phoneIconSelect from "../assets/iconfont/phone_Select.svg";
import phoneIcon from "../assets/iconfont/phone.svg";
import emailIcon from "../assets/iconfont/email.svg";
import emailIconSelect from "../assets/iconfont/email_Select.svg";
import Logo from "../assets/img/logo.png"
import emailIcon from "../assets/iconfont/email.svg";
import Logo from "../assets/img/logo.png";
import "./SignIn.scss";
import EmailForm from "../components/EmailForm";
import PhoneForm from "../components/PhoneForm";
import { useNavigate } from "react-router-dom";
import useUserStore from "../store/user.ts";
import { Popover } from "antd-mobile";
import EmailForm from "../components/EmailForm.tsx";
import Area from "../i18n/area/area.json";
console.log('language',navigator.language)
function SignIn() {
const { t } = useTranslation();
const { t, i18n } = useTranslation();
const lang: string = getI18n().language;
const [visible, setVisible] = useState(false);
const [selectIndex, setSelectIndex] = useState<number>(0);
const {previousPathName,UpdatePreviousPathName} = useUserStore()
const [selectIndex, setSelectIndex] = useState<number>(1);
const { previousPathName, UpdatePreviousPathName } = useUserStore();
const navigate = useNavigate();
const { UpdateLang, UpdateSelectCountry } = useUserStore();
const handleTabs = (num: number) => {
return () => {
UpdatePreviousPathName('/');
UpdatePreviousPathName("/");
setSelectIndex(num);
};
};
useEffect(() => {
// 当组件加载时,保存当前路径
console.log("previousPathName", previousPathName);
// 当组件加载时,保存当前路径
console.log("previousPathName", previousPathName);
if (previousPathName === "/SelectCountry") {
setSelectIndex(1);
}
if (previousPathName === "/SelectCountry") {
setSelectIndex(1);
}
}, [previousPathName]);
return (
<div className="container">
<div className="language">
<Popover
className="popoverContainer"
mode="dark"
visible={visible}
placement="bottom-end"
trigger="click"
content={
<ul
style={{
listStyle: "none",
display: "flex",
flexDirection: "column",
justifyContent: "flex-start",
alignItems: "center",
margin: 0,
padding: "5px 10px",
fontSize: 14,
background: "#333333",
borderRadius: 6,
}}
>
<li
style={{
borderBottom: "1px solid #2f2f2f",
padding: "5px 10px",
cursor: "pointer",
}}
>
<span
onClick={() => {
i18n.changeLanguage("cn");
setVisible(false);
UpdateLang("zh-TW");
const areaItem = Area.find((v) => v.code == "+86");
if (areaItem) UpdateSelectCountry(areaItem);
}}
>
</span>
</li>
<li style={{ padding: "5px 10px", cursor: "pointer" }}>
<span
onClick={() => {
i18n.changeLanguage("en");
setVisible(false);
UpdateLang("en-US");
}}
>
English
</span>
</li>
</ul>
}
>
<span
style={{ cursor: "pointer" }}
onClick={() => setVisible(!visible)}
>
{lang === "cn" ? "中文" : "English"}
</span>
</Popover>
</div>
<div className="logo">
<img src={Logo} alt="" />
</div>
@ -42,28 +110,44 @@ function SignIn() {
className={`tabs-button ${selectIndex === 0 && "selected"}`}
onClick={handleTabs(0)}
>
<img src={selectIndex === 0 ? phoneIconSelect : phoneIcon} alt="" />
<img src={selectIndex === 0 ? emailIconSelect : emailIcon} alt="" />
<span>{t("E-mail")}</span>
</div>
<div
className={`tabs-button ${selectIndex === 1 && "selected"}`}
onClick={handleTabs(1)}
>
<img src={selectIndex === 1 ? emailIconSelect : emailIcon} alt="" />
<img src={selectIndex === 1 ? phoneIconSelect : phoneIcon} alt="" />
<span>{t("phone")}</span>
</div>
</div>
{selectIndex === 0 && <EmailForm></EmailForm>}
{selectIndex === 1 && <PhoneForm></PhoneForm>}
<div className="to-download" onClick={()=> navigate("/Download")}>
<p>{t("If you already have an account")}</p>
<p>{t("download the APP directly")}</p>
<div className="to-download">
<p style={{ color: "#999999" }}>
{t("If you already have an account")}
</p>
<p onClick={() => navigate("/Download")}>
{t("download the APP directly")}
</p>
</div>
<div className="terms-service">
<p>{t("Continuing to represent you in agreeing to our")}</p>
<p>
<span>{t("Terms of Service")}</span> {t("and")}{" "}
<span>{t("Privacy Policy")}</span>
<span>
<a
target="_blank"
href="https://lm0-1.gitbook.io/terms-of-service/"
>
{t("Terms of Service")}
</a>
</span>{" "}
{t("and")}{" "}
<span>
<a target="_blank" href="https://lm0-1.gitbook.io/privacy-policy/">
{t("Privacy Policy")}
</a>
</span>
</p>
</div>
</div>

View File

@ -1,21 +1,25 @@
/*
* @LastEditors: John
* @Date: 2024-01-19 11:31:12
* @LastEditTime: 2024-01-25 15:42:25
* @LastEditTime: 2024-06-03 14:52:45
* @Author: John
*/
import { create } from "zustand";
import { CountryItem } from "../type/SelectCountry";
export type LanguageCode = "en-US" | "zh-CN" | "zh-TW" | "ko-KR";
// 状态管理器
export interface UserState {
SelectCountry: CountryItem | null;
UpdateSelectCountry: (item: CountryItem) => void
UpdateSelectCountry: (item: CountryItem) => void;
Token: string;
UpdateToken: (token: string) => void;
CurrentPhoneNumber:string;
CurrentPhoneNumber: string;
UpdateCurrentPhoneNumber: (number: string) => void;
previousPathName:string;
UpdatePreviousPathName:(number: string) => void;
previousPathName: string;
UpdatePreviousPathName: (number: string) => void;
Lang: LanguageCode;
UpdateLang: (lan: LanguageCode) => void;
}
const useUserStore = create<UserState>()((set) => ({
@ -30,16 +34,22 @@ const useUserStore = create<UserState>()((set) => ({
set((state) => {
return { ...state, Token: token };
}),
CurrentPhoneNumber:'',
CurrentPhoneNumber: "",
UpdateCurrentPhoneNumber: (val) =>
set((state) => {
return { ...state, CurrentPhoneNumber: val };
}),
previousPathName:'/',
UpdatePreviousPathName:(url) =>
set((state)=>{
return {...state,previousPathName:url}
})
return { ...state, CurrentPhoneNumber: val };
}),
previousPathName: "/",
UpdatePreviousPathName: (url) =>
set((state) => {
return { ...state, previousPathName: url };
}),
Lang: "en-US",
UpdateLang: (Lang) => {
set((state) => {
return { ...state, Lang };
});
},
}));
export default useUserStore;

View File

@ -5,7 +5,7 @@
"module": "commonjs",
"moduleResolution": "bundler",
"allowSyntheticDefaultImports": true,
"sourceMap":true
"sourceMap": true
},
"include": ["vite.config.ts"]
}

View File

@ -1,7 +1,16 @@
import { defineConfig } from 'vite'
import react from '@vitejs/plugin-react-swc'
/*
* @LastEditors: John
* @Date: 2024-05-22 18:06:14
* @LastEditTime: 2024-06-05 17:41:40
* @Author: John
*/
import { defineConfig } from "vite";
import react from "@vitejs/plugin-react-swc";
// https://vitejs.dev/config/
export default defineConfig({
server: {
host: "192.168.10.167",
},
plugins: [react()],
})
});

4052
yarn.lock

File diff suppressed because it is too large Load Diff