Commit feafe8e8 by HoMeTown

fix: 修复首页样式的问题&登录失效的处理

parent 55d8a609
...@@ -30,9 +30,12 @@ export const MainLayout: React.FC<MainLayoutProps> = ({ children }) => { ...@@ -30,9 +30,12 @@ export const MainLayout: React.FC<MainLayoutProps> = ({ children }) => {
const [isHistoryVisible, setHistoryVisible] = useState(false) const [isHistoryVisible, setHistoryVisible] = useState(false)
const location = useLocation() const location = useLocation()
const dispatch = useAppDispatch() const dispatch = useAppDispatch()
const token = window.localStorage.getItem('__TOKEN__')
useEffect(() => { useEffect(() => {
if (token) {
dispatch(fetchConversations()) dispatch(fetchConversations())
}
}, [dispatch]) }, [dispatch])
useEffect(() => { useEffect(() => {
......
...@@ -27,11 +27,12 @@ export const ChatAnswerAttachment: React.FC<ChatAnswerAttachmentProps> = ({ from ...@@ -27,11 +27,12 @@ export const ChatAnswerAttachment: React.FC<ChatAnswerAttachmentProps> = ({ from
const handleClickDocLink = async (docId: string) => { const handleClickDocLink = async (docId: string) => {
if (fromParser) { if (fromParser) {
const res = await fetchGetDocumentLink(docId) const res = await fetchGetDocumentLink(docId)
if (res.data) if (res.data) {
window.location.href = res.data.docUrl window.open(res.data.docUrl)
}
} }
else { else {
window.location.href = docId window.open(docId)
} }
} }
return ( return (
......
import type React from 'react' import type React from 'react'
import { Virtuoso } from 'react-virtuoso'
import { motion } from 'framer-motion' import { motion } from 'framer-motion'
import styles from './Home.module.less' import styles from './Home.module.less'
import { QuestionList } from './components/QuestionList' import { QuestionList } from './components/QuestionList'
...@@ -54,13 +53,9 @@ export const Home: React.FC = () => { ...@@ -54,13 +53,9 @@ export const Home: React.FC = () => {
<GradientBackground /> <GradientBackground />
<div className="h-full w-full"> <div className="h-full w-full">
<div className="box flex flex-col h-full w-full"> <div className="box flex flex-col h-full w-full">
<div className="flex-1"> <div className="flex-1 flex items-center overflow-y-scroll pt-[32px] scrollbar-hide sm:overflow-hidden">
<Virtuoso <div className="w-full">
style={{ height: '100%' }} <div className="px-[24px] pb-[24px] sm:px-0">
className="scrollbar-hide"
totalCount={1}
itemContent={() => (
<div className="px-[24px] pb-[24px] pt-[42px] sm:pt-[80px] lg:pt-[180px] sm:px-0">
{/* slogan */} {/* slogan */}
<Slogan /> <Slogan />
...@@ -72,8 +67,16 @@ export const Home: React.FC = () => { ...@@ -72,8 +67,16 @@ export const Home: React.FC = () => {
<motion.div className="w-full sm:w-auto" {...getAnimationProps(3)}><QuestionList questions={RECOMMEND_QUESTIONS_OTHER} dotColor="#CBECFF" title="其他问答" iconImg={HomeIcon2} /></motion.div> <motion.div className="w-full sm:w-auto" {...getAnimationProps(3)}><QuestionList questions={RECOMMEND_QUESTIONS_OTHER} dotColor="#CBECFF" title="其他问答" iconImg={HomeIcon2} /></motion.div>
</div> </div>
</div> </div>
)} </div>
/> {/* pt-[42px] sm:pt-[80px] lg:pt-[180px] */}
{/* <Virtuoso
style={{ height: '100%' }}
className="scrollbar-hide"
totalCount={1}
itemContent={() => (
)} */}
{/* /> */}
</div> </div>
<div className="box-border px-[0] mx-auto iptContainer w-full max-w-[1000px] flex-shrink-0 sm:px-0 pb-[18px]"> <div className="box-border px-[0] mx-auto iptContainer w-full max-w-[1000px] flex-shrink-0 sm:px-0 pb-[18px]">
<ChatEditor onSubmit={handleCreateConversation} placeholders={RECOMMEND_QUESTIONS_OTHER} /> <ChatEditor onSubmit={handleCreateConversation} placeholders={RECOMMEND_QUESTIONS_OTHER} />
......
...@@ -55,6 +55,8 @@ service.interceptors.response.use( ...@@ -55,6 +55,8 @@ service.interceptors.response.use(
} }
else if (code === '00000005') { else if (code === '00000005') {
// 处理登录失效 // 处理登录失效
window.localStorage.removeItem('__TOKEN__')
window.location.reload()
} }
else { else {
// showToast(message) // showToast(message)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment