muxi feng commited on
Commit
b22362b
·
1 Parent(s): 51dc757

修复编译报错问题

Browse files
app/components/findpwd.tsx CHANGED
@@ -1,5 +1,5 @@
1
  import { ErrorBoundary } from "./error";
2
- import Locale, { AllLangs, changeLang, getLang } from "../locales";
3
  import ChatIcon from "../icons/chatgpt.svg"
4
  import styles from "./findpwd.module.scss";
5
  import { IconButton } from "./button";
@@ -7,16 +7,15 @@ import { useUserStore } from "../store";
7
  import { useState } from "react";
8
 
9
 
10
- export function findpwd(){
11
- const userStore=useUserStore()
12
  const [user, setUser] = useState("");
13
 
14
  const onUser = (text: string) => {
15
  setUser(text)
16
  };
17
 
18
- const findpwd=()=>{
19
- userStore.findpwd(user)
20
  }
21
 
22
  return (
 
1
  import { ErrorBoundary } from "./error";
2
+ import Locale from "../locales";
3
  import ChatIcon from "../icons/chatgpt.svg"
4
  import styles from "./findpwd.module.scss";
5
  import { IconButton } from "./button";
 
7
  import { useState } from "react";
8
 
9
 
10
+ export function FindPwd(){
 
11
  const [user, setUser] = useState("");
12
 
13
  const onUser = (text: string) => {
14
  setUser(text)
15
  };
16
 
17
+ function findpwd(){
18
+ useUserStore.getState().findPwd(user)
19
  }
20
 
21
  return (
app/components/home.tsx CHANGED
@@ -46,7 +46,7 @@ const User = dynamic(async () => (await import("./user")).User, {
46
  loading: () => <Loading noLogo />,
47
  });
48
 
49
- const Findpwd = dynamic(async () => (await import("./findpwd")).findpwd, {
50
  loading: () => <Loading noLogo />,
51
  });
52
 
@@ -142,7 +142,7 @@ function Screen() {
142
  <Route path={Path.Chat} element={<Chat />} />
143
  <Route path={Path.User} element={<User />} />
144
  <Route path={Path.Login} element={<Login />} />
145
- <Route path={Path.Findpwd} element={<Findpwd />} />
146
  <Route path={Path.Register} element={<Register />} />
147
  <Route path={Path.Settings} element={<Settings />} />
148
  </Routes>
 
46
  loading: () => <Loading noLogo />,
47
  });
48
 
49
+ const FindPwd = dynamic(async () => (await import("./findpwd")).FindPwd, {
50
  loading: () => <Loading noLogo />,
51
  });
52
 
 
142
  <Route path={Path.Chat} element={<Chat />} />
143
  <Route path={Path.User} element={<User />} />
144
  <Route path={Path.Login} element={<Login />} />
145
+ <Route path={Path.Findpwd} element={<FindPwd />} />
146
  <Route path={Path.Register} element={<Register />} />
147
  <Route path={Path.Settings} element={<Settings />} />
148
  </Routes>
app/components/user.tsx CHANGED
@@ -24,22 +24,22 @@ export function User() {
24
  const updateConfig = config.update;
25
 
26
  const accessStore = useAccessStore();
27
- const userStor = useUserStore()
28
 
29
  const [userName, setUserName] = useState("");
30
  const [kami, setKami] = useState("");
31
  const onUserName = (text: string) => {
32
  setUserName(text)
33
- userStor.updateName(userName)
34
  };
35
 
36
  function getVipTime(){
37
- if(!userStor.vip_time_stmp){
38
  return ""
39
  }
40
  let time=new Date().getTime();
41
  console.log(time)
42
- time=time+Number(userStor.vip_time_stmp)*1000
43
  console.log(time)
44
  const date = new Date(time)
45
  const Y = date.getFullYear()
@@ -49,8 +49,8 @@ export function User() {
49
  }
50
 
51
  useEffect(()=>{
52
- setUserName(()=>{return userStor.name;})
53
- },[])
54
 
55
  useEffect(() => {
56
  const keydownEvent = (e: KeyboardEvent) => {
@@ -113,18 +113,18 @@ export function User() {
113
  </ListItem>
114
 
115
  <ListItem title={Locale.User.Mail}>
116
- <span>{userStor.mail}</span>
117
  </ListItem>
118
 
119
  <ListItem title={Locale.User.Wallet}>
120
  <div className={styles.font} >
121
- 剩余积分:<span className={styles.wallet}>{userStor.wallet}</span>
122
  </div>
123
  </ListItem>
124
 
125
  <ListItem title={Locale.User.Vip}>
126
  <div className={styles.font}>
127
- <div className={styles.vipState}>{userStor.vip_state=="已开通"?"VIP":"非VIP"}</div>
128
  <div className={styles.vipTime}>{getVipTime()}</div>
129
  </div>
130
  </ListItem>
@@ -142,7 +142,7 @@ export function User() {
142
  disabled={!accessStore.auth}
143
  text="兑换"
144
  onClick={()=>{
145
- userStor.useKami(kami)
146
  setKami("")
147
  }}
148
  />
@@ -152,10 +152,10 @@ export function User() {
152
  <ListItem title={Locale.User.SigState}>
153
  <IconButton
154
  icon={<EditIcon />}
155
- disabled={!accessStore.auth || userStor.sig_state=="已签到"}
156
  text="签到"
157
  onClick={()=>{
158
- userStor.userSig()
159
  }}
160
  />
161
  </ListItem>
@@ -167,7 +167,7 @@ export function User() {
167
  text="登出"
168
  onClick={()=>{
169
  accessStore.updateAuth("")
170
- userStor.reset()
171
  setUserName("")
172
  showToast("登出成功!")
173
  }}
 
24
  const updateConfig = config.update;
25
 
26
  const accessStore = useAccessStore();
27
+ const useStor = useUserStore()
28
 
29
  const [userName, setUserName] = useState("");
30
  const [kami, setKami] = useState("");
31
  const onUserName = (text: string) => {
32
  setUserName(text)
33
+ useStor.updateName(userName)
34
  };
35
 
36
  function getVipTime(){
37
+ if(!useStor.vip_time_stmp){
38
  return ""
39
  }
40
  let time=new Date().getTime();
41
  console.log(time)
42
+ time=time+Number(useStor.vip_time_stmp)*1000
43
  console.log(time)
44
  const date = new Date(time)
45
  const Y = date.getFullYear()
 
49
  }
50
 
51
  useEffect(()=>{
52
+ setUserName(useStor.name)
53
+ },[useStor.name])
54
 
55
  useEffect(() => {
56
  const keydownEvent = (e: KeyboardEvent) => {
 
113
  </ListItem>
114
 
115
  <ListItem title={Locale.User.Mail}>
116
+ <span>{useStor.mail}</span>
117
  </ListItem>
118
 
119
  <ListItem title={Locale.User.Wallet}>
120
  <div className={styles.font} >
121
+ 剩余积分:<span className={styles.wallet}>{useStor.wallet}</span>
122
  </div>
123
  </ListItem>
124
 
125
  <ListItem title={Locale.User.Vip}>
126
  <div className={styles.font}>
127
+ <div className={styles.vipState}>{useStor.vip_state=="已开通"?"VIP":"非VIP"}</div>
128
  <div className={styles.vipTime}>{getVipTime()}</div>
129
  </div>
130
  </ListItem>
 
142
  disabled={!accessStore.auth}
143
  text="兑换"
144
  onClick={()=>{
145
+ useStor.useKami(kami)
146
  setKami("")
147
  }}
148
  />
 
152
  <ListItem title={Locale.User.SigState}>
153
  <IconButton
154
  icon={<EditIcon />}
155
+ disabled={!accessStore.auth || useStor.sig_state=="已签到"}
156
  text="签到"
157
  onClick={()=>{
158
+ useStor.userSig()
159
  }}
160
  />
161
  </ListItem>
 
167
  text="登出"
168
  onClick={()=>{
169
  accessStore.updateAuth("")
170
+ useStor.reset()
171
  setUserName("")
172
  showToast("登出成功!")
173
  }}
app/store/user.ts CHANGED
@@ -52,7 +52,7 @@ export interface UserStore {
52
  updateWallet:(wallet:number) => void;
53
  updateName:(name:string) => void;
54
  getUserInfo:() => void;
55
- findpwd:(user:string) => void;
56
  useKami:(code:string) => void;
57
  }
58
  export const DEFAULT_USER = {
@@ -182,7 +182,7 @@ export const useUserStore = create<UserStore>()(
182
  let data=responsedata.data
183
  this.updateInfo(data.name,data.wallet,data.vip_state,data.vip_time_stmp,data.mail,data.sig_state,data.head)
184
  },
185
- async findpwd(user) {
186
  let res=await fetch("/api/user/findpwd?user="+user,{
187
  method: "GET",
188
  headers:{
 
52
  updateWallet:(wallet:number) => void;
53
  updateName:(name:string) => void;
54
  getUserInfo:() => void;
55
+ findPwd:(user:string) => void;
56
  useKami:(code:string) => void;
57
  }
58
  export const DEFAULT_USER = {
 
182
  let data=responsedata.data
183
  this.updateInfo(data.name,data.wallet,data.vip_state,data.vip_time_stmp,data.mail,data.sig_state,data.head)
184
  },
185
+ async findPwd(user) {
186
  let res=await fetch("/api/user/findpwd?user="+user,{
187
  method: "GET",
188
  headers:{