feat: build admin

This commit is contained in:
mozzie 2023-03-19 01:43:03 +08:00
parent a807f2c557
commit 9115293095
11 changed files with 55 additions and 24 deletions

View File

@ -36,3 +36,30 @@ steps:
command_timeout: 2m command_timeout: 2m
target: /www/wwwroot/nginx/html/backset.cn/ target: /www/wwwroot/nginx/html/backset.cn/
source: ./apps/web/dist/* source: ./apps/web/dist/*
- name: build-admin
image: node:16.19-alpine
# 容器内挂载点
volumes:
- name: node_modules
path: /drone/src/node_modules
commands:
- pwd
- node -v
- npm -v
- npm install -g pnpm
- pnpm install
- pnpm build:admin
- name: deploy-admin
image: appleboy/drone-scp:1.6
settings:
host:
- backset.cn
username: root
password: cr654654.
port: 22
overwrite: true
command_timeout: 2m
target: /www/wwwroot/nginx/html/backset.cn/
source: ./apps/admin/dist/*

View File

@ -97,13 +97,7 @@ export class UserController {
try { try {
const { phoneNumber: phoneNumbers } = params; const { phoneNumber: phoneNumbers } = params;
const code = Math.floor(Math.random() * 9000 + 1000); const code = Math.floor(Math.random() * 9000 + 1000);
const res = await this.redisService.set( await this.redisService.set('' + phoneNumbers, code, 'EX', 60);
'' + phoneNumbers,
code,
'EX',
60
);
console.log('redis here', res);
await this.smsService.send({ code, phoneNumbers }); await this.smsService.send({ code, phoneNumbers });
return { code: BizCode.OK }; return { code: BizCode.OK };
} catch (error) { } catch (error) {

View File

@ -34,7 +34,13 @@ function App() {
<Route path="*" element={<span>404</span>} /> <Route path="*" element={<span>404</span>} />
</Routes> </Routes>
</main> </main>
<Toaster /> <Toaster
toastOptions={{
style: {
fontSize: 14,
},
}}
/>
</> </>
); );
} }

View File

@ -33,6 +33,7 @@ header {
.middle { .middle {
display: flex; display: flex;
align-items: center; align-items: center;
font-size: 14px;
> span { > span {
color: #d7d7d7; color: #d7d7d7;
@ -51,6 +52,7 @@ header {
} }
.end { .end {
font-size: 14px;
.btn { .btn {
cursor: pointer; cursor: pointer;
margin-left: 32px; margin-left: 32px;

View File

@ -113,7 +113,14 @@ function Nav() {
</Icon> </Icon>
</div> */} </div> */}
<div className="bs fc sb"> <div className="bs fc sb">
<span></span> <span
style={{
textDecoration: "line-through",
color: "var(--color-text-4)",
}}
>
</span>
<Icon color="var(--color-text-3)"> <Icon color="var(--color-text-3)">
<Settings20Regular /> <Settings20Regular />
</Icon> </Icon>

View File

@ -1,9 +0,0 @@
import { create } from "zustand";
export const useLoginModalStore = create((set) => {
return {
visible: false,
setVisible: () => set({ visible: true }),
setInVisible: () => set({ visible: false }),
};
});

View File

@ -1,6 +1,7 @@
import { create } from "zustand"; import { create } from "zustand";
import Cookie from "js-cookie"; import Cookie from "js-cookie";
import { userState } from "../api"; import { userState } from "../api";
import toast from "react-hot-toast";
export const useUserStore = create((set) => { export const useUserStore = create((set) => {
return { return {
@ -18,6 +19,7 @@ export const useUserStore = create((set) => {
set({ user: null }); set({ user: null });
Cookie.remove("_sign_web"); Cookie.remove("_sign_web");
Cookie.remove("_sign_web.sig"); Cookie.remove("_sign_web.sig");
toast.success("再见~!");
}, },
}; };
}); });

View File

@ -68,7 +68,7 @@
} }
.mask { .mask {
p { p {
font-size: 15px; font-size: 20px;
} }
} }
} }

View File

@ -3,6 +3,7 @@ import { sms, userLogin } from "../../api";
import "./index.less"; import "./index.less";
import { useNavigate } from "react-router-dom"; import { useNavigate } from "react-router-dom";
import { useUserStore } from "../../store/user.store"; import { useUserStore } from "../../store/user.store";
import toast from "react-hot-toast";
const defaultForm = { const defaultForm = {
user_login: "", user_login: "",
user_pass: "", user_pass: "",
@ -19,11 +20,11 @@ export function Login() {
const onClickSmsBtn = () => { const onClickSmsBtn = () => {
if (!/^1[3456789]\d{9}$/.test(loginForm.user_login)) if (!/^1[3456789]\d{9}$/.test(loginForm.user_login))
return alert("手机号格式有误"); return toast.error("手机号格式有误");
sms(loginForm.user_login).then((res: any) => { sms(loginForm.user_login).then((res: any) => {
if (res?.code === 10000) if (res?.code === 10000)
setTimeout(() => { setTimeout(() => {
alert("验证码已发送"); toast.success("验证码已发送");
timer.current = setInterval(() => setCountdown(countdown--), 1000); timer.current = setInterval(() => setCountdown(countdown--), 1000);
}, 50); }, 50);
}); });

View File

@ -33,19 +33,19 @@ function Subscribe() {
</button> */} </button> */}
<ul> <ul>
<li> <li>
<Icon size={20}> <Icon size={20} color="green">
<Checkmark12Filled /> <Checkmark12Filled />
</Icon> </Icon>
<div></div> <div></div>
</li> </li>
<li> <li>
<Icon size={20}> <Icon size={20} color="green">
<Checkmark12Filled /> <Checkmark12Filled />
</Icon> </Icon>
<div></div> <div></div>
</li> </li>
<li> <li>
<Icon size={20}> <Icon size={20} color="green">
<Checkmark12Filled /> <Checkmark12Filled />
</Icon> </Icon>
<div></div> <div></div>

View File

@ -7,6 +7,7 @@
"dev:apps-web": "cd apps/web && pnpm dev", "dev:apps-web": "cd apps/web && pnpm dev",
"dev:apps-admin": "cd apps/admin && pnpm dev", "dev:apps-admin": "cd apps/admin && pnpm dev",
"build:web": "cd apps/web && pnpm build", "build:web": "cd apps/web && pnpm build",
"build:admin": "cd apps/admin && pnpm build",
"build:pkgs": "pnpm build:ui && pnpm build:util", "build:pkgs": "pnpm build:ui && pnpm build:util",
"build:ui": "cd packages/ui && pnpm build", "build:ui": "cd packages/ui && pnpm build",
"build:util": "cd packages/util && pnpm build" "build:util": "cd packages/util && pnpm build"