Commit 01ff539a by Liu

fix:左侧推荐问部分样式

parent 32c6981d
This diff was suppressed by a .gitattributes entry.
This diff was suppressed by a .gitattributes entry.
This diff was suppressed by a .gitattributes entry.
This diff was suppressed by a .gitattributes entry.
...@@ -5,8 +5,8 @@ import { Outlet, useLocation } from 'react-router-dom' ...@@ -5,8 +5,8 @@ import { Outlet, useLocation } from 'react-router-dom'
import { useLocalStorageState } from 'ahooks' import { useLocalStorageState } from 'ahooks'
import styles from './Home.module.less' import styles from './Home.module.less'
import { QuestionList } from './components/QuestionList' import { QuestionList } from './components/QuestionList'
import HomeIcon1 from '@/assets/homeIcon1.png'
import HomeIcon2 from '@/assets/homeIcon2.png' import HomeIcon2 from '@/assets/homeIcon2.png'
import SmartIce from '@/assets/smart-ice.png'
import { createConversation, fetchConversations } from '@/store/conversationSlice' import { createConversation, fetchConversations } from '@/store/conversationSlice'
import { useAppDispatch } from '@/store/hook' import { useAppDispatch } from '@/store/hook'
import { fetchQuestionList } from '@/api/home' import { fetchQuestionList } from '@/api/home'
...@@ -46,7 +46,7 @@ export const Home: React.FC = () => { ...@@ -46,7 +46,7 @@ export const Home: React.FC = () => {
const location = useLocation() const location = useLocation()
const hasFetched = useRef(false) const hasFetched = useRef(false)
// 使用 useState // 使用 useState
const [productQuestions, setProductQuestions] = useState<any>({ content: [] }) const [_productQuestions, setProductQuestions] = useState<any>({ content: [] })
const [otherQuestions, setOtherQuestions] = useState<any>({ content: [] }) const [otherQuestions, setOtherQuestions] = useState<any>({ content: [] })
const [token, setToken] = useLocalStorageState<string | undefined>('__TOKEN__', { const [token, setToken] = useLocalStorageState<string | undefined>('__TOKEN__', {
...@@ -188,9 +188,9 @@ export const Home: React.FC = () => { ...@@ -188,9 +188,9 @@ export const Home: React.FC = () => {
{/* 左侧区域 - 产品问答和您可以试着问我 */} {/* 左侧区域 - 产品问答和您可以试着问我 */}
<div <div
className="flex flex-col gap-[20px] items-center overflow-y-auto scrollbar-hide" className="flex flex-col gap-[20px] items-center overflow-y-auto scrollbar-hide"
style={{ height: 'calc(100vh - 64px)' }} style={{ height: 'calc(100vh - 64px)', background: 'linear-gradient(180deg, #DBF1FF 0%, #FFFFFF 50%, #FFFFFF 100%)', borderRadius: '24px' }}
> >
<motion.div className="w-full sm:w-auto" {...getAnimationProps(2)}> {/* <motion.div className="w-full sm:w-auto" {...getAnimationProps(2)}>
<QuestionList <QuestionList
questions={productQuestions.content} questions={productQuestions.content}
dotColor="#D4CCFF" dotColor="#D4CCFF"
...@@ -198,16 +198,20 @@ export const Home: React.FC = () => { ...@@ -198,16 +198,20 @@ export const Home: React.FC = () => {
title={productQuestions.configName} title={productQuestions.configName}
iconImg={HomeIcon1} iconImg={HomeIcon1}
/> />
</motion.div> </motion.div> */}
<motion.div className="w-full sm:w-auto" {...getAnimationProps(3)}> <motion.div className="w-full sm:w-auto" {...getAnimationProps(3)}>
<QuestionList <QuestionList
questions={otherQuestions.content} questions={otherQuestions.content}
dotColor="#CBECFF" dotColor="#CBECFF"
background="linear-gradient(180deg, #DBF1FF 0%, #FFFFFF 50%, #FFFFFF 100%)" background="linear-gradient(180deg, #DBF1FF 0%, #FFFFFF 50%, #FFFFFF 100%)"
height="388px"
title={otherQuestions.configName} title={otherQuestions.configName}
iconImg={HomeIcon2} iconImg={HomeIcon2}
/> />
</motion.div> </motion.div>
<div>
<img src={SmartIce} alt="Smart Ice" className="w-[260px] h-[330px] object-contain" />
</div>
</div> </div>
{/* 右侧区域 */} {/* 右侧区域 */}
<div className="hidden sm:flex flex-1 h-full"> <div className="hidden sm:flex flex-1 h-full">
......
...@@ -16,6 +16,7 @@ interface QuestionListProps { ...@@ -16,6 +16,7 @@ interface QuestionListProps {
showRefresh?: boolean showRefresh?: boolean
displayCount?: number displayCount?: number
background: string background: string
height?: string
} }
const containerVariants = { const containerVariants = {
hidden: {}, hidden: {},
...@@ -55,10 +56,11 @@ const QuestionListBase: React.FC<QuestionListProps & WithAuthProps> = ({ ...@@ -55,10 +56,11 @@ const QuestionListBase: React.FC<QuestionListProps & WithAuthProps> = ({
questions, questions,
dotColor, dotColor,
background, background,
height,
title, title,
iconImg, iconImg,
showRefresh = true, showRefresh = true,
displayCount = 4, displayCount = 8,
}) => { }) => {
const [isRotating, setIsRotating] = useState(false) const [isRotating, setIsRotating] = useState(false)
const [displayedItems, setDisplayedItems] = useState<string[]>([]) const [displayedItems, setDisplayedItems] = useState<string[]>([])
...@@ -97,8 +99,8 @@ const QuestionListBase: React.FC<QuestionListProps & WithAuthProps> = ({ ...@@ -97,8 +99,8 @@ const QuestionListBase: React.FC<QuestionListProps & WithAuthProps> = ({
}, [updateDisplayedItems]) }, [updateDisplayedItems])
return ( return (
<div <div
className="bg-white box-border px-[20px] py-[12px] rounded-[24px] w-full sm:w-[360px] md:w-[300px]" className="bg-white box-border px-[20px] py-[12px] rounded-[24px] w-full sm:w-[300px] md:w-[300px]"
style={{ background }} style={{ background, height }}
> >
<h3 className="flex items-center justify-between whitespace-nowrap"> <h3 className="flex items-center justify-between whitespace-nowrap">
<div className="flex items-center min-w-0 flex-1 h-full"> <div className="flex items-center min-w-0 flex-1 h-full">
......
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