Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
赵月辉
/
fastgpt-migrated
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Members
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Unverified
Commit
2c5f88b8
authored
Nov 12, 2024
by
heheer
Committed by
GitHub
Nov 12, 2024
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add baidu keywords (#3127)
parent
2e1bf66d
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
35 additions
and
6 deletions
+35
-6
packages/global/support/user/type.d.ts
+3
-0
packages/service/support/user/schema.ts
+3
-0
projects/app/src/pages/login/components/LoginForm/components/FormLayout.tsx
+2
-1
projects/app/src/pages/login/components/RegisterForm.tsx
+12
-1
projects/app/src/pages/login/index.tsx
+5
-0
projects/app/src/web/context/useInitApp.ts
+4
-3
projects/app/src/web/support/user/api.ts
+6
-1
No files found.
packages/global/support/user/type.d.ts
View file @
2c5f88b8
...
@@ -18,6 +18,9 @@ export type UserModelSchema = {
...
@@ -18,6 +18,9 @@ export type UserModelSchema = {
key
:
string
;
key
:
string
;
baseUrl
:
string
;
baseUrl
:
string
;
};
};
fastgpt_sem
?:
{
keyword
:
string
;
};
};
};
export
type
UserType
=
{
export
type
UserType
=
{
...
...
packages/service/support/user/schema.ts
View file @
2c5f88b8
...
@@ -70,6 +70,9 @@ const UserSchema = new Schema({
...
@@ -70,6 +70,9 @@ const UserSchema = new Schema({
},
},
lastLoginTmbId
:
{
lastLoginTmbId
:
{
type
:
Schema
.
Types
.
ObjectId
type
:
Schema
.
Types
.
ObjectId
},
fastgpt_sem
:
{
type
:
Object
}
}
});
});
...
...
projects/app/src/pages/login/components/LoginForm/components/FormLayout.tsx
View file @
2c5f88b8
...
@@ -71,7 +71,8 @@ const FormLayout = ({ children, setPageType, pageType }: Props) => {
...
@@ -71,7 +71,8 @@ const FormLayout = ({ children, setPageType, pageType }: Props) => {
:
[])
:
[])
];
];
const
show_oauth
=
!!
(
feConfigs
?.
sso
||
oAuthList
.
length
>
0
);
const
show_oauth
=
!
sessionStorage
.
getItem
(
'bd_vid'
)
&&
!!
(
feConfigs
?.
sso
||
oAuthList
.
length
>
0
);
return
(
return
(
<
Flex
flexDirection=
{
'column'
}
h=
{
'100%'
}
>
<
Flex
flexDirection=
{
'column'
}
h=
{
'100%'
}
>
...
...
projects/app/src/pages/login/components/RegisterForm.tsx
View file @
2c5f88b8
...
@@ -45,13 +45,24 @@ const RegisterForm = ({ setPageType, loginSuccess }: Props) => {
...
@@ -45,13 +45,24 @@ const RegisterForm = ({ setPageType, loginSuccess }: Props) => {
const
{
runAsync
:
onclickRegister
,
loading
:
requesting
}
=
useRequest2
(
const
{
runAsync
:
onclickRegister
,
loading
:
requesting
}
=
useRequest2
(
async
({
username
,
password
,
code
}:
RegisterType
)
=>
{
async
({
username
,
password
,
code
}:
RegisterType
)
=>
{
const
fastgpt_sem
=
(()
=>
{
try
{
return
sessionStorage
.
getItem
(
'fastgpt_sem'
)
?
JSON
.
parse
(
sessionStorage
.
getItem
(
'fastgpt_sem'
)
!
)
:
undefined
;
}
catch
{
return
undefined
;
}
})();
loginSuccess
(
loginSuccess
(
await
postRegister
({
await
postRegister
({
username
,
username
,
code
,
code
,
password
,
password
,
inviterId
:
localStorage
.
getItem
(
'inviterId'
)
||
undefined
,
inviterId
:
localStorage
.
getItem
(
'inviterId'
)
||
undefined
,
bd_vid
:
localStorage
.
getItem
(
'bd_vid'
)
||
undefined
bd_vid
:
sessionStorage
.
getItem
(
'bd_vid'
)
||
undefined
,
fastgpt_sem
:
fastgpt_sem
})
})
);
);
...
...
projects/app/src/pages/login/index.tsx
View file @
2c5f88b8
...
@@ -86,6 +86,11 @@ const Login = ({ ChineseRedirectUrl }: { ChineseRedirectUrl: string }) => {
...
@@ -86,6 +86,11 @@ const Login = ({ ChineseRedirectUrl }: { ChineseRedirectUrl: string }) => {
/* default login type */
/* default login type */
useEffect
(()
=>
{
useEffect
(()
=>
{
const
bd_vid
=
sessionStorage
.
getItem
(
'bd_vid'
);
if
(
bd_vid
)
{
setPageType
(
LoginPageTypeEnum
.
passwordLogin
);
return
;
}
setPageType
(
setPageType
(
feConfigs
?.
oauth
?.
wechat
?
LoginPageTypeEnum
.
wechat
:
LoginPageTypeEnum
.
passwordLogin
feConfigs
?.
oauth
?.
wechat
?
LoginPageTypeEnum
.
wechat
:
LoginPageTypeEnum
.
passwordLogin
);
);
...
...
projects/app/src/web/context/useInitApp.ts
View file @
2c5f88b8
...
@@ -8,7 +8,7 @@ import { TrackEventName } from '../common/system/constants';
...
@@ -8,7 +8,7 @@ import { TrackEventName } from '../common/system/constants';
export
const
useInitApp
=
()
=>
{
export
const
useInitApp
=
()
=>
{
const
router
=
useRouter
();
const
router
=
useRouter
();
const
{
hiId
,
bd_vid
}
=
router
.
query
as
{
hiId
?:
string
;
bd_vid
?:
string
};
const
{
hiId
,
bd_vid
,
k
}
=
router
.
query
as
{
hiId
?:
string
;
bd_vid
?:
string
;
k
?:
string
};
const
{
loadGitStar
,
setInitd
,
feConfigs
}
=
useSystemStore
();
const
{
loadGitStar
,
setInitd
,
feConfigs
}
=
useSystemStore
();
const
[
scripts
,
setScripts
]
=
useState
<
FastGPTFeConfigsType
[
'scripts'
]
>
([]);
const
[
scripts
,
setScripts
]
=
useState
<
FastGPTFeConfigsType
[
'scripts'
]
>
([]);
const
[
title
,
setTitle
]
=
useState
(
process
.
env
.
SYSTEM_NAME
||
'AI'
);
const
[
title
,
setTitle
]
=
useState
(
process
.
env
.
SYSTEM_NAME
||
'AI'
);
...
@@ -59,8 +59,9 @@ export const useInitApp = () => {
...
@@ -59,8 +59,9 @@ export const useInitApp = () => {
useEffect
(()
=>
{
useEffect
(()
=>
{
hiId
&&
localStorage
.
setItem
(
'inviterId'
,
hiId
);
hiId
&&
localStorage
.
setItem
(
'inviterId'
,
hiId
);
bd_vid
&&
localStorage
.
setItem
(
'bd_vid'
,
bd_vid
);
bd_vid
&&
sessionStorage
.
setItem
(
'bd_vid'
,
bd_vid
);
},
[
bd_vid
,
hiId
]);
k
&&
sessionStorage
.
setItem
(
'fastgpt_sem'
,
JSON
.
stringify
({
keyword
:
k
}));
},
[
bd_vid
,
hiId
,
k
]);
return
{
return
{
feConfigs
,
feConfigs
,
...
...
projects/app/src/web/support/user/api.ts
View file @
2c5f88b8
...
@@ -31,19 +31,24 @@ export const postRegister = ({
...
@@ -31,19 +31,24 @@ export const postRegister = ({
password
,
password
,
code
,
code
,
inviterId
,
inviterId
,
bd_vid
bd_vid
,
fastgpt_sem
}:
{
}:
{
username
:
string
;
username
:
string
;
code
:
string
;
code
:
string
;
password
:
string
;
password
:
string
;
inviterId
?:
string
;
inviterId
?:
string
;
bd_vid
?:
string
;
bd_vid
?:
string
;
fastgpt_sem
?:
{
keyword
:
string
;
};
})
=>
})
=>
POST
<
ResLogin
>
(
`/proApi/support/user/account/register/emailAndPhone`
,
{
POST
<
ResLogin
>
(
`/proApi/support/user/account/register/emailAndPhone`
,
{
username
,
username
,
code
,
code
,
inviterId
,
inviterId
,
bd_vid
,
bd_vid
,
fastgpt_sem
,
password
:
hashStr
(
password
)
password
:
hashStr
(
password
)
});
});
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment