feat: 个人中心
This commit is contained in:
@@ -1,2 +1,2 @@
|
|||||||
VITE_API_HOST1=http://117.72.14.166:3010
|
VITE_API_HOST=http://117.72.10.84:3010
|
||||||
VITE_IMG_HOST=http://117.72.14.166:9000
|
VITE_IMG_HOST=http://117.72.14.166:9000
|
@@ -1,8 +1,9 @@
|
|||||||
import React, { Fragment, useState } from "react";
|
import React, { Fragment, useState } from "react";
|
||||||
import { Tag, Table, Input } from "antd";
|
import { Tag, Table, Input, Radio, Space, Button, Divider } from "antd";
|
||||||
import { filterDifficulty, gradeObject } from "@constants";
|
import { filterDifficulty, gradeObject } from "@constants";
|
||||||
import { useNavigate } from "react-router-dom";
|
import { useNavigate } from "react-router-dom";
|
||||||
import "./index.less";
|
import "./index.less";
|
||||||
|
|
||||||
const { Search } = Input;
|
const { Search } = Input;
|
||||||
|
|
||||||
const colors = ['#ffffb8', '#f4ffb8', '#b5f5ec', '#bae0ff', '#d9f7be', '#efdbff', ' #ffd6e7', '#d6e4ff']
|
const colors = ['#ffffb8', '#f4ffb8', '#b5f5ec', '#bae0ff', '#d9f7be', '#efdbff', ' #ffd6e7', '#d6e4ff']
|
||||||
@@ -10,12 +11,9 @@ const colors = ['#ffffb8', '#f4ffb8', '#b5f5ec', '#bae0ff', '#d9f7be', '#efdbff'
|
|||||||
|
|
||||||
const QuestionList = (props) => {
|
const QuestionList = (props) => {
|
||||||
|
|
||||||
|
const [difficuty, setDifficuty] = useState(0)
|
||||||
const [selectValue, setSelectValue] = useState('难度')
|
|
||||||
const navigate = useNavigate();
|
const navigate = useNavigate();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
const RandomNumBoth = (Min, Max) => {
|
const RandomNumBoth = (Min, Max) => {
|
||||||
//差值
|
//差值
|
||||||
const Range = Max - Min;
|
const Range = Max - Min;
|
||||||
@@ -24,6 +22,15 @@ const QuestionList = (props) => {
|
|||||||
return Min + Math.round(Rand * Range); //四舍五入
|
return Min + Math.round(Rand * Range); //四舍五入
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const handleSearch = (close) => {
|
||||||
|
props.changeDifficuty(difficuty)
|
||||||
|
close()
|
||||||
|
}
|
||||||
|
|
||||||
|
const changeDifficuty = (e) => {
|
||||||
|
setDifficuty(e.target.value)
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 题目列表
|
* 题目列表
|
||||||
*/
|
*/
|
||||||
@@ -40,8 +47,7 @@ const QuestionList = (props) => {
|
|||||||
return (
|
return (
|
||||||
<div className="question-info-container">
|
<div className="question-info-container">
|
||||||
<div className="question-info-desc">
|
<div className="question-info-desc">
|
||||||
{record.subjectName}
|
{record.id}: {record.subjectName}
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
<div className="question-info-tags">
|
<div className="question-info-tags">
|
||||||
{item?.labelName?.length > 0 &&
|
{item?.labelName?.length > 0 &&
|
||||||
@@ -62,31 +68,29 @@ const QuestionList = (props) => {
|
|||||||
dataIndex: "subjectDifficult",
|
dataIndex: "subjectDifficult",
|
||||||
key: "subjectDifficult",
|
key: "subjectDifficult",
|
||||||
align: "center",
|
align: "center",
|
||||||
filters: [
|
filterDropdown: ({ close }) => (
|
||||||
{
|
<div style={{ padding: 16 }} onKeyDown={(e) => e.stopPropagation()}>
|
||||||
value: 0,
|
<div style={{ textAlign: 'center', fontSize: '16px', fontWeight: 'bold', marginBottom: 10 }}>请选择</div>
|
||||||
text: '全部',
|
<Radio.Group style={{ width: '100%', textAlign: 'center' }} value={difficuty} onChange={changeDifficuty}>
|
||||||
},
|
<Space direction="vertical">
|
||||||
{
|
{
|
||||||
value: 1,
|
filterDifficulty.map(item => {
|
||||||
text: '初级',
|
return <Radio value={item.id} key={item.id}>{item.title}</Radio>
|
||||||
},
|
})
|
||||||
{
|
}
|
||||||
value: 2,
|
</Space>
|
||||||
text: '中级',
|
</Radio.Group>
|
||||||
},
|
|
||||||
{
|
<Button
|
||||||
value: 3,
|
block
|
||||||
text: '高级',
|
size="small"
|
||||||
},
|
type="primary"
|
||||||
{
|
style={{ marginTop: 12 }}
|
||||||
value: 4,
|
onClick={() => handleSearch(close)}
|
||||||
text: '资深',
|
>
|
||||||
},
|
确定
|
||||||
],
|
</Button>
|
||||||
onFilter: (value, record) => {
|
</div>),
|
||||||
return value === 0 ? record : record.subjectDifficult === value
|
|
||||||
},
|
|
||||||
width: 90,
|
width: 90,
|
||||||
render: (key) => {
|
render: (key) => {
|
||||||
return (
|
return (
|
||||||
@@ -96,62 +100,19 @@ const QuestionList = (props) => {
|
|||||||
},
|
},
|
||||||
];
|
];
|
||||||
|
|
||||||
/**
|
|
||||||
* 选择标签
|
|
||||||
* @param {*} id
|
|
||||||
*/
|
|
||||||
const handleChangeSelect = (id) => {
|
|
||||||
let selectValue = "难度";
|
|
||||||
if (id != 0) {
|
|
||||||
filterDifficulty.forEach((item) => {
|
|
||||||
if (item.id == id) {
|
|
||||||
selectValue = item.id;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
setSelectValue(selectValue)
|
|
||||||
props.handleChangeSelect(id);
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 进入详情
|
* 进入详情
|
||||||
* @param {*} item
|
* @param {*} item
|
||||||
* @param {*} type
|
* @param {*} type
|
||||||
* @returns
|
* @returns
|
||||||
*/
|
*/
|
||||||
const onChangeAction = (item, index) => () => {
|
const onChangeAction = (item) => () => {
|
||||||
let { isNotToDetail, difficulty, primaryCategoryId, labelList, pageIndex } =
|
navigate("/brush-question/" + item.id)
|
||||||
props;
|
// let { isNotToDetail } = props;
|
||||||
!isNotToDetail && navigate("/brush-question/" + item.id)
|
// !isNotToDetail &&
|
||||||
// this.props.history.push(
|
// if (!isNotToDetail) return;
|
||||||
// splicingQuery("/brush-questions", {
|
|
||||||
// id: item?.id,
|
|
||||||
// index: index + (pageIndex - 1) * 10 + 1,
|
|
||||||
// difficulty,
|
|
||||||
// primaryCategoryId,
|
|
||||||
// labelList,
|
|
||||||
// })
|
|
||||||
// );
|
|
||||||
if (!isNotToDetail) return;
|
|
||||||
toChangeSelectRows(item);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const toChangeSelectRows = (record) => {
|
|
||||||
let newSelectedRows = [...props.selectRows];
|
|
||||||
const isHas = newSelectedRows.some((rowItem) => rowItem.id === record.id);
|
|
||||||
if (isHas) {
|
|
||||||
newSelectedRows = newSelectedRows.filter(
|
|
||||||
(rowItem) => rowItem.id !== record.id
|
|
||||||
);
|
|
||||||
} else {
|
|
||||||
newSelectedRows.push(record);
|
|
||||||
}
|
|
||||||
props.setSelectRows(newSelectedRows);
|
|
||||||
};
|
|
||||||
|
|
||||||
const onChangePagination = (e) => {
|
|
||||||
props.onChangePagination(e);
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 过滤框-搜索框-模块
|
* 过滤框-搜索框-模块
|
||||||
@@ -174,8 +135,7 @@ const QuestionList = (props) => {
|
|||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
const { questionList, total, pageIndex, isHideSelect, isMultiple } =
|
const { questionList, isHideSelect } = props;
|
||||||
props;
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Fragment>
|
<Fragment>
|
||||||
@@ -193,20 +153,7 @@ const QuestionList = (props) => {
|
|||||||
rowKey="id"
|
rowKey="id"
|
||||||
pagination={false}
|
pagination={false}
|
||||||
rowClassName="question-table-row"
|
rowClassName="question-table-row"
|
||||||
|
|
||||||
/>
|
/>
|
||||||
{/* {total > 10 && (
|
|
||||||
<Pagination
|
|
||||||
style={{
|
|
||||||
padding: "24px 0",
|
|
||||||
textAlign: "center",
|
|
||||||
}}
|
|
||||||
showQuickJumper
|
|
||||||
defaultCurrent={pageIndex}
|
|
||||||
total={total}
|
|
||||||
onChange={onChangePagination}
|
|
||||||
/>
|
|
||||||
)} */}
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</Fragment>
|
</Fragment>
|
||||||
|
@@ -258,7 +258,9 @@ export default class TagsEditor extends Component {
|
|||||||
{tagElem}
|
{tagElem}
|
||||||
</Tooltip>
|
</Tooltip>
|
||||||
) : (
|
) : (
|
||||||
tagElem
|
<div key={item.id}>
|
||||||
|
{tagElem}
|
||||||
|
</div>
|
||||||
);
|
);
|
||||||
})}
|
})}
|
||||||
{inputVisible && (
|
{inputVisible && (
|
||||||
|
@@ -80,7 +80,7 @@
|
|||||||
line-height: 35px;
|
line-height: 35px;
|
||||||
border-radius: 6px;
|
border-radius: 6px;
|
||||||
margin-bottom: 5px;
|
margin-bottom: 5px;
|
||||||
height: 500px;
|
max-height: 500px;
|
||||||
overflow-y: scroll;
|
overflow-y: scroll;
|
||||||
}
|
}
|
||||||
.answer-box {
|
.answer-box {
|
||||||
|
@@ -6,7 +6,7 @@
|
|||||||
border-radius: 5px;
|
border-radius: 5px;
|
||||||
height: calc(100vh - 90px);
|
height: calc(100vh - 90px);
|
||||||
overflow-y: scroll;
|
overflow-y: scroll;
|
||||||
.ant-spin-nested-loading {
|
.mask-box {
|
||||||
flex: 1;
|
flex: 1;
|
||||||
overflow-y: auto;
|
overflow-y: auto;
|
||||||
border-radius: 8px;
|
border-radius: 8px;
|
||||||
@@ -20,6 +20,11 @@
|
|||||||
.question-list-box {
|
.question-list-box {
|
||||||
margin-top: 1px;
|
margin-top: 1px;
|
||||||
}
|
}
|
||||||
|
.loading-more{
|
||||||
|
background-color: white;
|
||||||
|
text-align: center;
|
||||||
|
padding-bottom: 15px;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -1,39 +1,32 @@
|
|||||||
// import { Component } from 'react';
|
|
||||||
import { useState, useEffect, memo } from 'react'
|
import { useState, useEffect, memo } from 'react'
|
||||||
// import { useSearchParams } from 'react-router-dom'
|
|
||||||
import QuestionList from '@components/question-list';
|
import QuestionList from '@components/question-list';
|
||||||
import CategoryList from '@components/category-list';
|
import CategoryList from '@components/category-list';
|
||||||
import ContributionList from './components/contribution-list';
|
import ContributionList from './components/contribution-list';
|
||||||
import RankingList from './components/practice-list'
|
import RankingList from './components/practice-list'
|
||||||
import { apiName } from './constant';
|
import { apiName } from './constant';
|
||||||
import req from '@utils/request';
|
import req from '@utils/request';
|
||||||
import { Spin } from 'antd';
|
|
||||||
import './index.less';
|
import './index.less';
|
||||||
|
|
||||||
const QuestionBank = () => {
|
const QuestionBank = () => {
|
||||||
|
|
||||||
const [firstCategoryList, setFirstCategoryList] = useState<Record<string, any>[]>([])
|
const [firstCategoryList, setFirstCategoryList] = useState<Record<string, any>[]>([])
|
||||||
const [questionList, setQuestionList] = useState([])
|
const [questionList, setQuestionList] = useState([])
|
||||||
const [isShowSpin, setIsShowSpin] = useState(false)
|
|
||||||
const [labelList, setLabelList] = useState<string | number>(); // 选中的标签列表
|
const [labelList, setLabelList] = useState<string | number>(); // 选中的标签列表
|
||||||
const [difficulty, setDiffculty] = useState(0); //困难度(全部)
|
const [difficulty, setDiffculty] = useState(''); //困难度(全部)
|
||||||
const [total, setTotal] = useState(0); // 总条数
|
const [total, setTotal] = useState(0); // 总条数
|
||||||
const [pageIndex, setPageIndex] = useState(0);
|
const [pageIndex, setPageIndex] = useState(0);
|
||||||
const [primaryCategoryId, setPromaryCategoryId] = useState(''); //第一个大类id
|
const [primaryCategoryId, setPromaryCategoryId] = useState(''); //第一个大类id
|
||||||
const [secondCategoryId, setSecondCategoryId] = useState('')
|
const [secondCategoryId, setSecondCategoryId] = useState('')
|
||||||
|
|
||||||
// let [searchParams, setSearchParams] = useSearchParams();
|
const [loading, setLoading] = useState(false)
|
||||||
// const changeUrlParam = () => {
|
const [finished, setFinished] = useState(false)
|
||||||
// // console.log(searchParams.size)
|
const [switchFlag, setSwitchFlag] = useState(false)
|
||||||
// setSearchParams({ id: 1 })
|
|
||||||
// // window.history.pushState({}, '0', window.location.href + '?url=' + '参数');
|
|
||||||
// }
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取大类分类
|
* 获取大类分类
|
||||||
*/
|
*/
|
||||||
const getPrimaryCategoryInfo = () => {
|
const getPrimaryCategoryInfo = () => {
|
||||||
setIsShowSpin(true)
|
|
||||||
req({
|
req({
|
||||||
method: 'post',
|
method: 'post',
|
||||||
url: apiName.queryPrimaryCategory,
|
url: apiName.queryPrimaryCategory,
|
||||||
@@ -47,8 +40,6 @@ const QuestionBank = () => {
|
|||||||
})
|
})
|
||||||
.catch((err: string) => {
|
.catch((err: string) => {
|
||||||
console.log(err)
|
console.log(err)
|
||||||
}).finally(() => {
|
|
||||||
setIsShowSpin(false)
|
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -60,8 +51,8 @@ const QuestionBank = () => {
|
|||||||
setLabelList('')
|
setLabelList('')
|
||||||
setPromaryCategoryId(item.id)
|
setPromaryCategoryId(item.id)
|
||||||
setQuestionList([])
|
setQuestionList([])
|
||||||
setPageIndex(1)
|
|
||||||
setTotal(0)
|
setTotal(0)
|
||||||
|
setPageIndex(1)
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@@ -73,24 +64,43 @@ const QuestionBank = () => {
|
|||||||
const onChangeLabel = (secondCategoryId: any, assembleIds: string) => {
|
const onChangeLabel = (secondCategoryId: any, assembleIds: string) => {
|
||||||
setSecondCategoryId(secondCategoryId)
|
setSecondCategoryId(secondCategoryId)
|
||||||
setLabelList(assembleIds)
|
setLabelList(assembleIds)
|
||||||
|
setQuestionList([])
|
||||||
|
setTotal(0)
|
||||||
setPageIndex(1)
|
setPageIndex(1)
|
||||||
};
|
};
|
||||||
|
|
||||||
const queryQuestionList = () => {
|
const queryQuestionList = () => {
|
||||||
|
setLoading(true)
|
||||||
const params = {
|
const params = {
|
||||||
pageNo: pageIndex,
|
pageNo: pageIndex,
|
||||||
pageSize: 10,
|
pageSize: 20,
|
||||||
labelId: labelList,
|
labelId: labelList,
|
||||||
categoryId: secondCategoryId,
|
categoryId: secondCategoryId,
|
||||||
// subjectDifficult: 1
|
subjectDifficult: difficulty || ''
|
||||||
}
|
}
|
||||||
req({
|
req({
|
||||||
method: 'post',
|
method: 'post',
|
||||||
url: apiName.getSubjectPage,
|
url: apiName.getSubjectPage,
|
||||||
data: params
|
data: params
|
||||||
}).then(res => {
|
}).then(res => {
|
||||||
setTotal(res.data.total)
|
setLoading(false)
|
||||||
setQuestionList(res.data.result)
|
let lastList = [...questionList]
|
||||||
|
const { total, result } = res.data
|
||||||
|
if (result.length) {
|
||||||
|
lastList = lastList.concat(result)
|
||||||
|
setQuestionList(lastList)
|
||||||
|
setTotal(total)
|
||||||
|
if (result.length < 20 || lastList.length >= total) {
|
||||||
|
setFinished(true)
|
||||||
|
} else {
|
||||||
|
setFinished(false)
|
||||||
|
setSwitchFlag(false)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}).catch(err => {
|
||||||
|
console.log(err)
|
||||||
|
}).finally(() => {
|
||||||
|
setLoading(false)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -102,10 +112,9 @@ const QuestionBank = () => {
|
|||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (labelList && secondCategoryId) {
|
if (labelList && secondCategoryId) {
|
||||||
// setSearchParams({ second: secondCategoryId, label: labelList })
|
|
||||||
queryQuestionList()
|
queryQuestionList()
|
||||||
}
|
}
|
||||||
}, [labelList, pageIndex, secondCategoryId])
|
}, [labelList, pageIndex, secondCategoryId, difficulty])
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 更多分类切换
|
* 更多分类切换
|
||||||
@@ -120,10 +129,34 @@ const QuestionBank = () => {
|
|||||||
setTotal(0)
|
setTotal(0)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const scrollHandler = e => {
|
||||||
|
let scrollTop = e.target.scrollTop; // listBox 滚动条向上卷曲出去的长度,随滚动变化
|
||||||
|
let clientHeight = e.target.clientHeight; // listBox 的视口可见高度,固定不变
|
||||||
|
let scrollHeight = e.target.scrollHeight; // listBox 的整体高度,随数据加载变化
|
||||||
|
let saveHeight = 30; // 安全距离,距离底部XX时,触发加载
|
||||||
|
let tempVal = scrollTop + clientHeight + saveHeight;
|
||||||
|
// 如果不加入 saveHeight 安全距离,在 scrollTop + clientHeight == scrollHeight 时,触发加载
|
||||||
|
// 加入安全距离,相当于在 scrollTop + clientHeight >= scrollHeight - 30 时,触发加载,比前者更早触发
|
||||||
|
if (tempVal >= scrollHeight) {
|
||||||
|
if (!finished && !switchFlag) {
|
||||||
|
// 数据加载未结束 && 未加锁
|
||||||
|
setPageIndex(pageIndex + 1)
|
||||||
|
}
|
||||||
|
setSwitchFlag(true)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const changeDifficuty = cur => {
|
||||||
|
if (cur === difficulty) return
|
||||||
|
setPageIndex(1)
|
||||||
|
setDiffculty(cur)
|
||||||
|
setQuestionList([])
|
||||||
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="question-bank-box">
|
<div className="question-bank-box">
|
||||||
<Spin spinning={isShowSpin}>
|
<div className='mask-box' onScroll={scrollHandler}>
|
||||||
<div className="question-box">
|
<div className="question-box" >
|
||||||
<div className="category-list-box">
|
<div className="category-list-box">
|
||||||
{firstCategoryList?.length > 0 && (
|
{firstCategoryList?.length > 0 && (
|
||||||
<CategoryList
|
<CategoryList
|
||||||
@@ -141,15 +174,20 @@ const QuestionBank = () => {
|
|||||||
pageIndex={pageIndex}
|
pageIndex={pageIndex}
|
||||||
total={total}
|
total={total}
|
||||||
questionList={questionList}
|
questionList={questionList}
|
||||||
// handleChangeSelect={this.handleChangeSelect}
|
changeDifficuty={changeDifficuty}
|
||||||
// onChangePagination={this.onChangePagination}
|
|
||||||
difficulty={difficulty}
|
|
||||||
// primaryCategoryId={this.primaryCategoryId}
|
|
||||||
labelList={labelList}
|
labelList={labelList}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div className='loading-more'>{
|
||||||
|
questionList.length == 0
|
||||||
|
? "暂无数据"
|
||||||
|
: loading && !finished
|
||||||
|
? "努力加载中..."
|
||||||
|
: "我是有底线的(:"
|
||||||
|
}</div>
|
||||||
</div>
|
</div>
|
||||||
</Spin>
|
</div>
|
||||||
<div className="ranking-box">
|
<div className="ranking-box">
|
||||||
<RankingList />
|
<RankingList />
|
||||||
<ContributionList />
|
<ContributionList />
|
||||||
@@ -157,4 +195,5 @@ const QuestionBank = () => {
|
|||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
export default memo(QuestionBank)
|
export default memo(QuestionBank)
|
||||||
|
@@ -1,93 +1,117 @@
|
|||||||
import { useState } from 'react'
|
|
||||||
import { Form, Row, Col, Input, Button, Card, Radio, DatePicker, ConfigProvider, Upload } from 'antd'
|
|
||||||
import Head from '@/imgs/head.jpg'
|
import Head from '@/imgs/head.jpg'
|
||||||
import { LoadingOutlined, PlusOutlined } from '@ant-design/icons'
|
import { LoadingOutlined, PlusOutlined } from '@ant-design/icons'
|
||||||
|
import { Button, Card, Col, Form, Input, Radio, Row } from 'antd'
|
||||||
|
import { memo, useState } from 'react'
|
||||||
import './index.less'
|
import './index.less'
|
||||||
|
|
||||||
const { TextArea } = Input
|
const { TextArea } = Input
|
||||||
|
|
||||||
const layout = {
|
const layout = {
|
||||||
labelCol: { span: 4 },
|
labelCol: { span: 4 },
|
||||||
wrapperCol: { span: 10, offset: 1 }
|
wrapperCol: { span: 10, offset: 1 }
|
||||||
}
|
}
|
||||||
|
|
||||||
const UserInfo = () => {
|
const UserInfo = () => {
|
||||||
const [form] = Form.useForm()
|
const [form] = Form.useForm()
|
||||||
const [editFlag, setEditFlag] = useState(false)
|
const [editFlag, setEditFlag] = useState(false)
|
||||||
const [loading, setLoading] = useState(false)
|
const [loading, setLoading] = useState(false)
|
||||||
|
|
||||||
const onFinish = (values) => {
|
const onFinish = values => {
|
||||||
console.log(values)
|
console.log(values)
|
||||||
}
|
}
|
||||||
|
|
||||||
const uploadButton = (
|
const uploadButton = (
|
||||||
<div>
|
<div>
|
||||||
{loading ? <LoadingOutlined /> : <PlusOutlined />}
|
{loading ? <LoadingOutlined /> : <PlusOutlined />}
|
||||||
<div style={{ marginTop: 8 }}>点击上传</div>
|
<div style={{ marginTop: 8 }}>点击上传</div>
|
||||||
</div>
|
|
||||||
);
|
|
||||||
|
|
||||||
return <div className='user-info-box'>
|
|
||||||
<Card title='基本信息'>
|
|
||||||
<Form {...layout} colon={false} onFinish={onFinish} form={form}>
|
|
||||||
<Row>
|
|
||||||
<Col span={16}>
|
|
||||||
<Form.Item label='用户头像' name='upload' valuePropName="fileList">
|
|
||||||
{editFlag ? <Upload listType="picture-card" name="avatar">
|
|
||||||
{/* {imageUrl ? <img src={imageUrl} alt="avatar" style={{ width: '100%' }} /> : uploadButton} */}
|
|
||||||
{uploadButton}
|
|
||||||
</Upload> : <>
|
|
||||||
<img className='user-info_header' src={Head} />
|
|
||||||
</>}
|
|
||||||
</Form.Item>
|
|
||||||
</Col>
|
|
||||||
<Col span={16}>
|
|
||||||
<Form.Item label='用户昵称' name='nickName'>
|
|
||||||
{editFlag ? <Input placeholder='请输入昵称' /> : <>
|
|
||||||
暂无
|
|
||||||
</>}
|
|
||||||
</Form.Item>
|
|
||||||
</Col>
|
|
||||||
<Col span={16}>
|
|
||||||
<Form.Item label='性 别' name='gender'>
|
|
||||||
{editFlag ? <Radio.Group>
|
|
||||||
<Radio value={1}>男</Radio>
|
|
||||||
<Radio value={2}>女</Radio>
|
|
||||||
</Radio.Group> : <>
|
|
||||||
未知
|
|
||||||
</>}
|
|
||||||
</Form.Item>
|
|
||||||
</Col>
|
|
||||||
<Col span={16}>
|
|
||||||
<Form.Item label='邮 箱' name='email'>
|
|
||||||
{editFlag ? <Input placeholder='请输入邮箱' /> : <>
|
|
||||||
暂无
|
|
||||||
</>}
|
|
||||||
</Form.Item>
|
|
||||||
</Col>
|
|
||||||
<Col span={16}>
|
|
||||||
<Form.Item label='个人简介' name='introduce'>
|
|
||||||
{editFlag ? <TextArea placeholder='请输入个人简介' maxLength={500} showCount /> : <>
|
|
||||||
这个人很懒,什么也没有留下。。。。
|
|
||||||
</>}
|
|
||||||
</Form.Item>
|
|
||||||
</Col>
|
|
||||||
|
|
||||||
<Col span={16}>
|
|
||||||
<Form.Item wrapperCol={{ offset: 5 }}>
|
|
||||||
{
|
|
||||||
editFlag ? <>
|
|
||||||
<Button type='primary' htmlType='submit' style={{ marginRight: '20px' }}>保存</Button>
|
|
||||||
<Button onClick={() => setEditFlag(false)}>取消</Button>
|
|
||||||
</> : <Button type='primary' onClick={() => setEditFlag(true)}>编辑</Button>
|
|
||||||
}
|
|
||||||
</Form.Item>
|
|
||||||
</Col>
|
|
||||||
</Row>
|
|
||||||
</Form>
|
|
||||||
</Card>
|
|
||||||
</div>
|
</div>
|
||||||
|
)
|
||||||
|
|
||||||
|
return (
|
||||||
|
<div className='user-info-box'>
|
||||||
|
<Card title='基本信息'>
|
||||||
|
<Form {...layout} colon={false} form={form}>
|
||||||
|
<Row>
|
||||||
|
<Col span={16}>
|
||||||
|
<Form.Item label='用户头像'>
|
||||||
|
<img className='user-info_header' src={Head} />
|
||||||
|
</Form.Item>
|
||||||
|
</Col>
|
||||||
|
<Col span={16}>
|
||||||
|
{editFlag ? (
|
||||||
|
<Form.Item label='用户昵称' name='nickName'>
|
||||||
|
<Input placeholder='请输入昵称' />
|
||||||
|
</Form.Item>
|
||||||
|
) : (
|
||||||
|
<Form.Item label='用户昵称'>
|
||||||
|
<>暂无</>
|
||||||
|
</Form.Item>
|
||||||
|
)}
|
||||||
|
</Col>
|
||||||
|
<Col span={16}>
|
||||||
|
{editFlag ? (
|
||||||
|
<Form.Item
|
||||||
|
label='性 别'
|
||||||
|
name='gender'
|
||||||
|
>
|
||||||
|
<Radio.Group>
|
||||||
|
<Radio value={1}>男</Radio>
|
||||||
|
<Radio value={2}>女</Radio>
|
||||||
|
</Radio.Group>
|
||||||
|
</Form.Item>
|
||||||
|
) : (
|
||||||
|
<Form.Item label='性 别'>
|
||||||
|
<>未知</>
|
||||||
|
</Form.Item>
|
||||||
|
)}
|
||||||
|
</Col>
|
||||||
|
<Col span={16}>
|
||||||
|
{editFlag ? (
|
||||||
|
<Form.Item
|
||||||
|
label='邮 箱'
|
||||||
|
name='email'
|
||||||
|
>
|
||||||
|
<Input placeholder='请输入邮箱' />
|
||||||
|
</Form.Item>
|
||||||
|
) : (
|
||||||
|
<Form.Item label='邮 箱'>
|
||||||
|
<>暂无</>
|
||||||
|
</Form.Item>
|
||||||
|
)}
|
||||||
|
</Col>
|
||||||
|
<Col span={16}>
|
||||||
|
{editFlag ? (
|
||||||
|
<Form.Item label='个人简介' name='introduce'>
|
||||||
|
<TextArea placeholder='请输入个人简介' maxLength={500} showCount />
|
||||||
|
</Form.Item>
|
||||||
|
) : (
|
||||||
|
<Form.Item label='个人简介'>
|
||||||
|
<>这个人很懒,什么也没有留下。。。。</>
|
||||||
|
</Form.Item>
|
||||||
|
)}
|
||||||
|
</Col>
|
||||||
|
|
||||||
|
<Col span={16}>
|
||||||
|
<Form.Item wrapperCol={{ offset: 5 }}>
|
||||||
|
{editFlag ? (
|
||||||
|
<>
|
||||||
|
<Button type='primary' style={{ marginRight: '20px' }} onClick={onFinish}>
|
||||||
|
保存
|
||||||
|
</Button>
|
||||||
|
<Button onClick={() => setEditFlag(false)}>取消</Button>
|
||||||
|
</>
|
||||||
|
) : (
|
||||||
|
<Button type='primary' onClick={() => setEditFlag(true)}>
|
||||||
|
编辑
|
||||||
|
</Button>
|
||||||
|
)}
|
||||||
|
</Form.Item>
|
||||||
|
</Col>
|
||||||
|
</Row>
|
||||||
|
</Form>
|
||||||
|
</Card>
|
||||||
|
</div>
|
||||||
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
export default UserInfo
|
export default memo(UserInfo)
|
||||||
|
Reference in New Issue
Block a user