update
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@kevisual/kevisual-home",
|
||||
"version": "0.0.8",
|
||||
"version": "0.0.9",
|
||||
"description": "",
|
||||
"main": "index.js",
|
||||
"basename": "/root/home",
|
||||
@@ -10,7 +10,7 @@
|
||||
"preview": "astro preview",
|
||||
"ui": "pnpm dlx shadcn@latest add ",
|
||||
"prepub": "pnpm run build",
|
||||
"pub": "envision deploy ./dist -k home -v 0.0.8 -u -y yes"
|
||||
"pub": "envision deploy ./dist -k home -v 0.0.9 -u -y yes"
|
||||
},
|
||||
"keywords": [],
|
||||
"author": "abearxiong <xiongxiao@xiongxiao.me> (https://www.xiongxiao.me)",
|
||||
|
||||
@@ -30,6 +30,7 @@ export const App = () => {
|
||||
const firstStore = useFirstStore();
|
||||
const [username, setUsername] = useState<string>("");
|
||||
const [nickname, setNickname] = useState<string>("");
|
||||
const [password, setPassword] = useState<string>("");
|
||||
const [isLoading, setIsLoading] = useState(true);
|
||||
|
||||
useEffect(() => {
|
||||
@@ -51,6 +52,7 @@ export const App = () => {
|
||||
const res = await firstStore.updateUserInfo({
|
||||
username,
|
||||
nickname,
|
||||
password,
|
||||
});
|
||||
|
||||
};
|
||||
@@ -138,6 +140,20 @@ export const App = () => {
|
||||
/>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<label className="block text-sm font-medium text-white/90 mb-3">
|
||||
密码
|
||||
</label>
|
||||
<input
|
||||
type="password"
|
||||
value={password ?? ""}
|
||||
onChange={(e) => setPassword(e.target.value)}
|
||||
disabled={!canChange}
|
||||
className="w-full px-5 py-3 rounded-xl border-2 focus:outline-none focus:ring-2 focus:ring-white/50 focus:border-white/50 backdrop-blur-sm bg-white/5 text-white placeholder-white/40 border-white/20 disabled:bg-white/5 disabled:cursor-not-allowed disabled:border-white/10 disabled:text-white/40 transition-all duration-200"
|
||||
placeholder="输入密码"
|
||||
/>
|
||||
</div>
|
||||
|
||||
<button
|
||||
onClick={handleSubmit}
|
||||
disabled={!canChange}
|
||||
|
||||
@@ -17,7 +17,7 @@ interface FirstState {
|
||||
userInfo?: UserInfo;
|
||||
getMe(): Promise<void>;
|
||||
getAvatar(): string;
|
||||
updateUserInfo: (opts?: { username: string; nickname: string }) => Promise<void>;
|
||||
updateUserInfo: (opts?: { username: string; nickname: string; password?: string }) => Promise<void>;
|
||||
}
|
||||
|
||||
export const useFirstStore = create<FirstState>((set, get) => ({
|
||||
@@ -76,7 +76,7 @@ export const useFirstStore = create<FirstState>((set, get) => ({
|
||||
);
|
||||
return `data:image/svg+xml;base64,${svgBase64}`;
|
||||
},
|
||||
updateUserInfo: async (opts?: { username: string; nickname: string }) => {
|
||||
updateUserInfo: async (opts?: { username: string; nickname: string; password?: string }) => {
|
||||
if (!opts) return;
|
||||
const newUsername = opts.username;
|
||||
const newNickname = opts.nickname;
|
||||
@@ -84,6 +84,9 @@ export const useFirstStore = create<FirstState>((set, get) => ({
|
||||
username: newUsername,
|
||||
nickname: newNickname
|
||||
}
|
||||
if (opts.password) {
|
||||
(update as any).password = opts.password;
|
||||
}
|
||||
const res = await queryLogin.post({
|
||||
path: 'user',
|
||||
key: 'updateSelf',
|
||||
|
||||
Reference in New Issue
Block a user