Commit feafe8e8 by HoMeTown

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

parent 55d8a609
......@@ -30,9 +30,12 @@ export const MainLayout: React.FC<MainLayoutProps> = ({ children }) => {
const [isHistoryVisible, setHistoryVisible] = useState(false)
const location = useLocation()
const dispatch = useAppDispatch()
const token = window.localStorage.getItem('__TOKEN__')
useEffect(() => {
dispatch(fetchConversations())
if (token) {
dispatch(fetchConversations())
}
}, [dispatch])
useEffect(() => {
......
......@@ -27,11 +27,12 @@ export const ChatAnswerAttachment: React.FC<ChatAnswerAttachmentProps> = ({ from
const handleClickDocLink = async (docId: string) => {
if (fromParser) {
const res = await fetchGetDocumentLink(docId)
if (res.data)
window.location.href = res.data.docUrl
if (res.data) {
window.open(res.data.docUrl)
}
}
else {
window.location.href = docId
window.open(docId)
}
}
return (
......
import type React from 'react'
import { Virtuoso } from 'react-virtuoso'
import { motion } from 'framer-motion'
import styles from './Home.module.less'
import { QuestionList } from './components/QuestionList'
......@@ -54,26 +53,30 @@ export const Home: React.FC = () => {
<GradientBackground />
<div className="h-full w-full">
<div className="box flex flex-col h-full w-full">
<div className="flex-1">
<Virtuoso
<div className="flex-1 flex items-center overflow-y-scroll pt-[32px] scrollbar-hide sm:overflow-hidden">
<div className="w-full">
<div className="px-[24px] pb-[24px] sm:px-0">
{/* slogan */}
<Slogan />
{/* 欢迎语 */}
<div className="gap-[20px] flex justify-center flex-row flex-wrap mt-[42px] sm:mt-[62px] lg:mt-[112px]">
<motion.div className="w-full hidden sm:block sm:w-auto" {...getAnimationProps(1)}><WelcomeWord /></motion.div>
<motion.div className="w-full sm:w-auto" {...getAnimationProps(2)}><QuestionList questions={RECOMMEND_QUESTIONS_PRODUCT} dotColor="#D4CCFF" title="产品问答" iconImg={HomeIcon1} /></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>
{/* pt-[42px] sm:pt-[80px] lg:pt-[180px] */}
{/* <Virtuoso
style={{ height: '100%' }}
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 />
{/* 欢迎语 */}
<div className="gap-[20px] flex justify-center flex-row flex-wrap mt-[42px] sm:mt-[62px] lg:mt-[112px]">
<motion.div className="w-full hidden sm:block sm:w-auto" {...getAnimationProps(1)}><WelcomeWord /></motion.div>
<motion.div className="w-full sm:w-auto" {...getAnimationProps(2)}><QuestionList questions={RECOMMEND_QUESTIONS_PRODUCT} dotColor="#D4CCFF" title="产品问答" iconImg={HomeIcon1} /></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 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} />
......
......@@ -55,6 +55,8 @@ service.interceptors.response.use(
}
else if (code === '00000005') {
// 处理登录失效
window.localStorage.removeItem('__TOKEN__')
window.location.reload()
}
else {
// 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