|
@@ -2,11 +2,10 @@ import { Alert, Checkbox, Input, Spin, Tabs } from 'antd';
|
|
|
import React, { useEffect, useState } from 'react';
|
|
|
import './global.less';
|
|
|
import { businessPlanData } from '../../page/businessPlan/create/const';
|
|
|
-import { useAjax } from '@/Hook/useAjax';
|
|
|
-import { getAllBookApi, getBookPlatInfoAllApi } from '../../API/global';
|
|
|
import { CheckCircleOutlined } from '@ant-design/icons';
|
|
|
import useNewToken from '@/Hook/useNewToken';
|
|
|
-
|
|
|
+import weComTaskStore from '@/pages/weComTask/store'
|
|
|
+import { toJS } from 'mobx';
|
|
|
|
|
|
interface Props {
|
|
|
isSetTag?: boolean
|
|
@@ -23,26 +22,27 @@ interface Props {
|
|
|
const MindTags: React.FC<Props> = ({ value, onChange, id, isSetTag }) => {
|
|
|
|
|
|
/*****************************************/
|
|
|
+ const { bookPlatForm, bookList } = toJS(weComTaskStore.data)
|
|
|
const { token } = useNewToken()
|
|
|
const [mindTagValue, setMindTagValue] = useState<{ [x: string]: any }>(value || {})
|
|
|
- const [books, setBooks] = useState<{ id: number, bookName: string, platformId: number }[]>([])
|
|
|
- const [oldBooks, setOldBooks] = useState<{ id: number, bookName: string, platformId: number }[]>([])
|
|
|
+ const [books, setBooks] = useState<{ id: number, bookName: string, platformId: number }[]>(bookList || [])
|
|
|
+ const [oldBooks] = useState<{ id: number, bookName: string, platformId: number }[]>(bookList || [])
|
|
|
const [book, setBook] = useState<string>()
|
|
|
|
|
|
- const getBookPlatInfoAll = useAjax(() => getBookPlatInfoAllApi()) //书城
|
|
|
- const getAllBook = useAjax(() => getAllBookApi()) //书
|
|
|
+ // const getBookPlatInfoAll = useAjax(() => getBookPlatInfoAllApi()) //书城
|
|
|
+ // const getAllBook = useAjax(() => getAllBookApi()) //书
|
|
|
/*****************************************/
|
|
|
|
|
|
- useEffect(() => {
|
|
|
- getBookPlatInfoAll.run()
|
|
|
- getAllBook.run().then(res => {
|
|
|
- console.log(res);
|
|
|
- if (res?.data) {
|
|
|
- setOldBooks(res.data)
|
|
|
- setBooks(res.data)
|
|
|
- }
|
|
|
- })
|
|
|
- }, [])
|
|
|
+ // useEffect(() => {
|
|
|
+ // getBookPlatInfoAll.run()
|
|
|
+ // getAllBook.run().then(res => {
|
|
|
+ // console.log(res);
|
|
|
+ // if (res?.data) {
|
|
|
+ // setOldBooks(res.data)
|
|
|
+ // setBooks(res.data)
|
|
|
+ // }
|
|
|
+ // })
|
|
|
+ // }, [])
|
|
|
|
|
|
useEffect(() => {
|
|
|
if (value && JSON.stringify(value) !== JSON.stringify(mindTagValue)) {
|
|
@@ -60,7 +60,8 @@ const MindTags: React.FC<Props> = ({ value, onChange, id, isSetTag }) => {
|
|
|
}, [mindTagValue?.bookCity])
|
|
|
|
|
|
return <div id={id}>
|
|
|
- <Spin spinning={getBookPlatInfoAll.loading || getAllBook.loading}>
|
|
|
+ {/* <Spin spinning={getBookPlatInfoAll.loading || getAllBook.loading}> */}
|
|
|
+ <Spin spinning={false}>
|
|
|
<Tabs
|
|
|
defaultActiveKey="1"
|
|
|
tabPosition='left'
|
|
@@ -96,7 +97,7 @@ const MindTags: React.FC<Props> = ({ value, onChange, id, isSetTag }) => {
|
|
|
<Alert message="勾选默认打上模板选择的书城类型" type="warning" />
|
|
|
</div>}
|
|
|
<div className='mindTags_content_scroll'>
|
|
|
- {getBookPlatInfoAll?.data?.data?.map(item => <div key={item.id} style={{ padding: '5px 0' }}>
|
|
|
+ {bookPlatForm?.map(item => <div key={item.id} style={{ padding: '5px 0' }}>
|
|
|
<Checkbox onChange={(e) => {
|
|
|
const newValue = { ...mindTagValue, bookCity: item.id, product: e.target.checked ? undefined : mindTagValue?.product }
|
|
|
if (!e.target.checked) {
|
|
@@ -151,4 +152,4 @@ const MindTags: React.FC<Props> = ({ value, onChange, id, isSetTag }) => {
|
|
|
</div>
|
|
|
};
|
|
|
|
|
|
-export default MindTags;
|
|
|
+export default React.memo(MindTags);
|