update
This commit is contained in:
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@kevisual/kevisual-home",
|
"name": "@kevisual/kevisual-home",
|
||||||
"version": "0.0.8",
|
"version": "0.0.9",
|
||||||
"description": "",
|
"description": "",
|
||||||
"main": "index.js",
|
"main": "index.js",
|
||||||
"basename": "/root/home",
|
"basename": "/root/home",
|
||||||
@@ -10,7 +10,7 @@
|
|||||||
"preview": "astro preview",
|
"preview": "astro preview",
|
||||||
"ui": "pnpm dlx shadcn@latest add ",
|
"ui": "pnpm dlx shadcn@latest add ",
|
||||||
"prepub": "pnpm run build",
|
"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": [],
|
"keywords": [],
|
||||||
"author": "abearxiong <xiongxiao@xiongxiao.me> (https://www.xiongxiao.me)",
|
"author": "abearxiong <xiongxiao@xiongxiao.me> (https://www.xiongxiao.me)",
|
||||||
|
|||||||
@@ -30,6 +30,7 @@ export const App = () => {
|
|||||||
const firstStore = useFirstStore();
|
const firstStore = useFirstStore();
|
||||||
const [username, setUsername] = useState<string>("");
|
const [username, setUsername] = useState<string>("");
|
||||||
const [nickname, setNickname] = useState<string>("");
|
const [nickname, setNickname] = useState<string>("");
|
||||||
|
const [password, setPassword] = useState<string>("");
|
||||||
const [isLoading, setIsLoading] = useState(true);
|
const [isLoading, setIsLoading] = useState(true);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
@@ -51,6 +52,7 @@ export const App = () => {
|
|||||||
const res = await firstStore.updateUserInfo({
|
const res = await firstStore.updateUserInfo({
|
||||||
username,
|
username,
|
||||||
nickname,
|
nickname,
|
||||||
|
password,
|
||||||
});
|
});
|
||||||
|
|
||||||
};
|
};
|
||||||
@@ -138,6 +140,20 @@ export const App = () => {
|
|||||||
/>
|
/>
|
||||||
</div>
|
</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
|
<button
|
||||||
onClick={handleSubmit}
|
onClick={handleSubmit}
|
||||||
disabled={!canChange}
|
disabled={!canChange}
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ interface FirstState {
|
|||||||
userInfo?: UserInfo;
|
userInfo?: UserInfo;
|
||||||
getMe(): Promise<void>;
|
getMe(): Promise<void>;
|
||||||
getAvatar(): string;
|
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) => ({
|
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}`;
|
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;
|
if (!opts) return;
|
||||||
const newUsername = opts.username;
|
const newUsername = opts.username;
|
||||||
const newNickname = opts.nickname;
|
const newNickname = opts.nickname;
|
||||||
@@ -84,6 +84,9 @@ export const useFirstStore = create<FirstState>((set, get) => ({
|
|||||||
username: newUsername,
|
username: newUsername,
|
||||||
nickname: newNickname
|
nickname: newNickname
|
||||||
}
|
}
|
||||||
|
if (opts.password) {
|
||||||
|
(update as any).password = opts.password;
|
||||||
|
}
|
||||||
const res = await queryLogin.post({
|
const res = await queryLogin.post({
|
||||||
path: 'user',
|
path: 'user',
|
||||||
key: 'updateSelf',
|
key: 'updateSelf',
|
||||||
|
|||||||
Reference in New Issue
Block a user