Commit 3446cf24 authored by 熊成伟's avatar 熊成伟

debug

parent 58cb6dd0
Pipeline #15281 failed with stages
in 31 seconds
This diff is collapsed.
...@@ -9543,6 +9543,11 @@ ...@@ -9543,6 +9543,11 @@
"resolved": "https://registry.npm.taobao.org/q/download/q-1.5.1.tgz", "resolved": "https://registry.npm.taobao.org/q/download/q-1.5.1.tgz",
"integrity": "sha1-fjL3W0E4EpHQRhHxvxQQmsAGUdc=" "integrity": "sha1-fjL3W0E4EpHQRhHxvxQQmsAGUdc="
}, },
"qs": {
"version": "6.9.4",
"resolved": "https://registry.npm.taobao.org/qs/download/qs-6.9.4.tgz",
"integrity": "sha1-kJCykNH5FyjTwi5UhDykSupatoc="
},
"query-string": { "query-string": {
"version": "4.3.4", "version": "4.3.4",
"resolved": "https://registry.npm.taobao.org/query-string/download/query-string-4.3.4.tgz", "resolved": "https://registry.npm.taobao.org/query-string/download/query-string-4.3.4.tgz",
...@@ -9793,6 +9798,11 @@ ...@@ -9793,6 +9798,11 @@
"dotenv": "^4.0.0" "dotenv": "^4.0.0"
} }
}, },
"react-content-loader": {
"version": "5.0.4",
"resolved": "https://registry.npm.taobao.org/react-content-loader/download/react-content-loader-5.0.4.tgz",
"integrity": "sha1-FJNJHS9rMJ0oHYQUSmVUF+pzRIY="
},
"react-dev-utils": { "react-dev-utils": {
"version": "4.2.3", "version": "4.2.3",
"resolved": "https://registry.npm.taobao.org/react-dev-utils/download/react-dev-utils-4.2.3.tgz?cache=0&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Freact-dev-utils%2Fdownload%2Freact-dev-utils-4.2.3.tgz", "resolved": "https://registry.npm.taobao.org/react-dev-utils/download/react-dev-utils-4.2.3.tgz?cache=0&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Freact-dev-utils%2Fdownload%2Freact-dev-utils-4.2.3.tgz",
......
...@@ -10,7 +10,9 @@ ...@@ -10,7 +10,9 @@
"http-proxy-middleware": "^1.0.4", "http-proxy-middleware": "^1.0.4",
"lib-flexible": "^0.3.2", "lib-flexible": "^0.3.2",
"postcss-px2rem": "^0.3.0", "postcss-px2rem": "^0.3.0",
"qs": "^6.9.4",
"react": "^16.8.4", "react": "^16.8.4",
"react-content-loader": "^5.0.4",
"react-document-title": "^2.0.3", "react-document-title": "^2.0.3",
"react-dom": "^16.8.4", "react-dom": "^16.8.4",
"react-router-dom": "^5.2.0", "react-router-dom": "^5.2.0",
......
...@@ -15,10 +15,7 @@ const Index = (props) => { ...@@ -15,10 +15,7 @@ const Index = (props) => {
</div> </div>
{item.childrenUser && item.childrenUser.map((child, index) => ( {item.childrenUser && item.childrenUser.map((child, index) => (
<Item key={child.XM} className="sub-checkbox" onChange={(val) => setName(child.XM, val.target.checked)}> <Item key={child.XM} className="sub-checkbox" onChange={(val) => setName(child.XM, val.target.checked)}>
<div>
<img alt="" src="" className=""/>
{child.XM || ''} {child.XM || ''}
</div>
<div className="address-user"> <div className="address-user">
<img alt="" className='smallIco mr-5' src='/img/tel.png' /> <img alt="" className='smallIco mr-5' src='/img/tel.png' />
{child.YDDH || '无'} {child.YDDH || '无'}
......
import React from 'react';
import ContentLoader, { Facebook } from 'react-content-loader'
import './index.less'
const Index = () => {
return (
<div className="skeleton">
<ContentLoader viewBox="0 0 350 211" className="skeleton-content">
<rect x="0" y="0" rx="4" ry="4" width="350" height="25" />
<rect x="0" y="30" rx="3" ry="3" width="300" height="25" />
<rect x="0" y="60" rx="4" ry="4" width="270" height="25" />
<rect x="0" y="90" rx="3" ry="3" width="350" height="25" />
<rect x="0" y="120" rx="4" ry="4" width="300" height="25" />
<rect x="0" y="150" rx="3" ry="3" width="250" height="25" />
<rect x="0" y="180" rx="4" ry="4" width="200" height="25" />
</ContentLoader>
</div>
);
};
export default Index;
.skeleton {
display: flex;
align-items: center;
height: 211px;
padding: 10px;
background: #ffffff;
border-radius: 7px;
z-index: -1;
}
.skeleton-content{
width: 320px;
height: 211px;
}
...@@ -21,9 +21,9 @@ const Index = (props) => { ...@@ -21,9 +21,9 @@ const Index = (props) => {
</div> </div>
<div className="pos-center">{item.SENDDATE}</div> <div className="pos-center">{item.SENDDATE}</div>
</div> </div>
{item.result && ( {item.BLYJ && (
<div className="auto-step-content-result"> <div className="auto-step-content-result">
11111 {item.BLYJ}
</div> </div>
)} )}
</div> </div>
......
...@@ -2,35 +2,25 @@ import React, {useState, useEffect} from 'react'; ...@@ -2,35 +2,25 @@ import React, {useState, useEffect} from 'react';
import {WhiteSpace, WingBlank, ActivityIndicator} from 'antd-mobile' import {WhiteSpace, WingBlank, ActivityIndicator} from 'antd-mobile'
import TodoCard from '../../components/LogCard' import TodoCard from '../../components/LogCard'
import TopSearch from '../../components/TopSearch'; import TopSearch from '../../components/TopSearch';
import Skeleton from '../../components/Skeleton'
import axiosRequest from '../../utils/request'; import axiosRequest from '../../utils/request';
import Document from 'react-document-title' import Document from 'react-document-title'
import Empty from '../Empty' import Empty from '../Empty'
import './index.less'
const Backlog = (props) => { const Backlog = (props) => {
const [start, setStart] = useState(true); const [start, setStart] = useState(true);
const [end, setEnd] = useState(true)
const [endT, setEndT] = useState(false); const [endT, setEndT] = useState(false);
const [t, setT] = useState(false)
useEffect(() => { useEffect(() => {
setT(true) //回到顶部
axiosRequest({ window.scrollTo(0, 0)
method: 'post', getData()
url: '/idtAppServiceV6/oApp/getUnDone',
body: {nowPage: 1, pageSize: 10},
}).then(res => {
setT(false);
setStart(false)
let result = end && res.rows ? data.concat(res.rows) : data;
res.rows && res.rows.length >= 10 && setCurrent(1);
setEnd(res.rows && res.rows.length >= 10)
setData(result);
});
}, []) }, [])
const [current, setCurrent] = useState(0); const [current, setCurrent] = useState(0);
const [searchWord, setSearchWord] = useState(); const [searchWord, setSearchWord] = useState();
const [loading, setLoading] = useState(false); const [loading, setLoading] = useState(false);
const [data, setData] = useState([]); const [data, setData] = useState([]);
const checkLog = (OPERATEID, UUID) => { const checkLog = (OPERATEID, UUID) => {
...@@ -38,63 +28,54 @@ const Backlog = (props) => { ...@@ -38,63 +28,54 @@ const Backlog = (props) => {
}; };
const getData = () => { const getData = () => {
const pageMap ={searchWord, nowPage: current + 1, pageSize: 10}; const pageMap ={searchWord, nowPage: current + 1, pageSize: 10};
setLoading(true) setLoading(true);
axiosRequest({ axiosRequest({
method: 'post', method: 'post',
url: '/idtAppServiceV6/oApp/getUnDone', url: '/idtAppServiceV6/oApp/getUnDone',
body: pageMap, body: pageMap,
}).then(res => { }).then(res => {
setLoading(false); setStart(false);
let result = end && res.rows ? data.concat(res.rows) : data;
res.rows && res.rows.length >= 10 ? setCurrent(current + 1) : setEndT(true);
setEnd(res.rows && res.rows.length >= 10) setEnd(res.rows && res.rows.length >= 10)
let result = end && res.rows ? data.concat(res.rows) : data;
res.rows && res.rows.length >= 10 && setCurrent(1);
setData(result); setData(result);
setLoading(false);
}); });
}; };
//下拉加载 //下拉加载
const [end, setEnd] = useState(true);
const handleScroll =() => { const handleScroll =() => {
let scrollTop = document.documentElement.scrollTop || document.body.scrollTop; let scrollTop = document.documentElement.scrollTop || document.body.scrollTop;
let clientHeight = document.documentElement.clientHeight || document.body.clientHeight; let clientHeight = document.documentElement.clientHeight || document.body.clientHeight;
let scrollHeight = document.documentElement.scrollHeight || document.body.scrollHeight; let scrollHeight = document.documentElement.scrollHeight || document.body.scrollHeight;
console.log(scrollTop, scrollHeight, clientHeight, scrollTop + clientHeight === scrollHeight)
if(scrollHeight > clientHeight && scrollTop + clientHeight === scrollHeight) { if(scrollHeight > clientHeight && scrollTop + clientHeight === scrollHeight) {
current > 0 && window.scrollTo(0, document.body.scrollHeight);
getData() getData()
} }
} }
useEffect(() => { useEffect(() => {
window.addEventListener('touchmove', handleScroll, true); window.addEventListener('touchend', handleScroll, true);
return () => window.removeEventListener('touchmove', handleScroll, true); return () => window.removeEventListener('touchend', handleScroll, true);
}, [data]); }, [data]);
//回到顶部
useEffect(() => {
window.scrollTo(0, 0)
}, [])
const wordSearch = val => { const wordSearch = val => {
setCurrent(0)
setSearchWord(val); setSearchWord(val);
getData()
}; };
useEffect(() => { useEffect(() => {
setStart(true);
setEndT(false)
setData([])
!start && getData() !start && getData()
}, [searchWord]); }, [searchWord]);
console.log(loading)
return ( return (
<Document title="待办"> <Document title="待办">
<WingBlank> <WingBlank>
<ActivityIndicator
toast
text="加载中..."
animating={t}
/>
<WhiteSpace/> <WhiteSpace/>
<TopSearch onSearch={wordSearch}/> <TopSearch onSearch={wordSearch}/>
{ <WhiteSpace/>
!start && ( {start ? <div> <WhiteSpace/><Skeleton/><WhiteSpace/><Skeleton/><WhiteSpace/><Skeleton/></div> : (!start && (
data.length > 0 ? data.map((item, index) => ( data.length > 0 ? data.map((item, index) => (
<div key={index}> <div key={index}>
<WhiteSpace/> <WhiteSpace/>
...@@ -102,16 +83,20 @@ const Backlog = (props) => { ...@@ -102,16 +83,20 @@ const Backlog = (props) => {
</div> </div>
)) : <Empty/> )) : <Empty/>
) ))}
}
<WhiteSpace/> <WhiteSpace/>
{loading && endT && ( {loading && (
<div className="pos-line mb-10"> <div className="pos-line content-loading">
<ActivityIndicator/> <ActivityIndicator/>
<WhiteSpace/> <WhiteSpace/>
</div> </div>
)} )}
{!loading && !end && data.length > 0 && (
<div className="content-end">
—————— 我是有底线的 ——————
</div>
)}
</WingBlank> </WingBlank>
</Document> </Document>
......
.content-end{
width: 100%;
text-align: center;
color: rgba(67, 67, 67, 0.2);
margin-top: 20px;
}
.content-loading{
margin-top: 15px;
}
...@@ -2,7 +2,7 @@ import React, {useState, useEffect} from 'react'; ...@@ -2,7 +2,7 @@ import React, {useState, useEffect} from 'react';
import Document from 'react-document-title' import Document from 'react-document-title'
import AddressList from '../../components/AddressList'; import AddressList from '../../components/AddressList';
import axiosRequest from '../../utils/request'; import axiosRequest from '../../utils/request';
import {ActivityIndicator} from "antd-mobile"; import Skeleton from '../../components/Skeleton'
import './index.less' import './index.less'
import Empty from '../Empty' import Empty from '../Empty'
...@@ -38,15 +38,10 @@ const AddressBook = (props) => { ...@@ -38,15 +38,10 @@ const AddressBook = (props) => {
return ( return (
<Document title="通讯录"> <Document title="通讯录">
<div> <div>
<ActivityIndicator
toast
text="加载中..."
animating={loading}
/>
<div className='adMainBox'> <div className='adMainBox'>
{ !start && ( data.length > 0 ? ( {loading ? <Skeleton/> : (!start && ( data.length > 0 ? (
<AddressList data={data} onCLick={treeClick}/> <AddressList data={data} onCLick={treeClick}/>
): <Empty/>)} ): <Empty/>))}
</div> </div>
</div> </div>
......
import React, { useEffect} from 'react'; import React from 'react';
import {Modal} from 'antd-mobile' import {Modal} from 'antd-mobile'
import './index.less'; import './index.less';
// import axiosRequest from '../../utils/request';
const operation = Modal.operation; const operation = Modal.operation;
const Option = (props) => { const Option = (props) => {
const onChange = () => { const onChange = () => {
const input = document.getElementsByClassName("option-text"); const input = document.getElementsByClassName("option-text");
...@@ -15,14 +13,6 @@ const Option = (props) => { ...@@ -15,14 +13,6 @@ const Option = (props) => {
const input = document.getElementsByClassName("option-text"); const input = document.getElementsByClassName("option-text");
input[0].value = val input[0].value = val
}; };
useEffect(() => {
// axiosRequest({
// method: 'post',
// url: '/dgbg/mobileGetListOptionKey.view?userName=2012012099&clientFlag=123456',
// }).then(res => {
// console.log(res)
// });
}, [])
return ( return (
<div> <div>
<div className="option-card"> <div className="option-card">
......
...@@ -2,17 +2,22 @@ import React, {useState, useEffect} from 'react'; ...@@ -2,17 +2,22 @@ import React, {useState, useEffect} from 'react';
import Document from 'react-document-title' import Document from 'react-document-title'
import {WingBlank, WhiteSpace, ActionSheet, ActivityIndicator} from 'antd-mobile' import {WingBlank, WhiteSpace, ActionSheet, ActivityIndicator} from 'antd-mobile'
import axiosRequest from '../../utils/request'; import axiosRequest from '../../utils/request';
import './index.less'
import TopTabs from '../../components/BlankTabs' import TopTabs from '../../components/BlankTabs'
// import Skeleton from '../../components/Skeleton'
import Basic from './Basic' import Basic from './Basic'
import Adjunct from './Adjunct' import Adjunct from './Adjunct'
import Flow from './Flow'; import Flow from './Flow';
import Option from './Option'; import Option from './Option';
import './index.less'
const Process = (props) => { const Process = (props) => {
const {uuid} = props.match.params;
const [templateId, setTemplateId] = useState(); const [templateId, setTemplateId] = useState();
const [tableId, setTableId] = useState(); const [tableId, setTableId] = useState();
const [nodeId, setNodeId] = useState(); const [nodeId, setNodeId] = useState();
const [operateId, setOperateId] = useState()
//回到顶部 //回到顶部
useEffect(() => { useEffect(() => {
...@@ -30,6 +35,7 @@ const Process = (props) => { ...@@ -30,6 +35,7 @@ const Process = (props) => {
setTableId(res.table && res.table.tableId); setTableId(res.table && res.table.tableId);
setTemplateId(res.property && res.property.templateId) setTemplateId(res.property && res.property.templateId)
setNodeId(res.property && res.property.curNodeId) setNodeId(res.property && res.property.curNodeId)
setOperateId(res.property && res.property.operateId)
}); });
}, []); }, []);
...@@ -72,15 +78,15 @@ const Process = (props) => { ...@@ -72,15 +78,15 @@ const Process = (props) => {
setAdjunctData(res) setAdjunctData(res)
}); });
}; };
// const [button, setButton] = useState([]) const [button, setButton] = useState([])
const getButton= uuid => { const getButton= uuid => {
axiosRequest({ axiosRequest({
method: 'post', method: 'post',
url: `/idtAppServiceV6/oApp/nextNodeList`, url: `/idtAppServiceV6/oApp/nextNodeList`,
body: {curNodeId: nodeId} body: {curNodeId: nodeId}
}).then(res => { }).then(res => {
console.log(res) const result = res ? res.map(item => ({button: item.name, target: item.special})) : []
// setButton(res) setButton(result)
}); });
}; };
useEffect(() => { useEffect(() => {
...@@ -109,7 +115,9 @@ const Process = (props) => { ...@@ -109,7 +115,9 @@ const Process = (props) => {
return () => option.removeEventListener('focus', optionBlur, true); return () => option.removeEventListener('focus', optionBlur, true);
}, []); }, []);
const [blyj, setBlyj] = useState()
const optionChange = val => { const optionChange = val => {
setBlyj(val)
setDisabled(!(val != null && val !== '')) setDisabled(!(val != null && val !== ''))
}; };
...@@ -142,11 +150,29 @@ const Process = (props) => { ...@@ -142,11 +150,29 @@ const Process = (props) => {
wrapProps = { wrapProps = {
onTouchStart: e => e.preventDefault(), onTouchStart: e => e.preventDefault(),
}; };
};
const beforeSubmit = () => {
axiosRequest({
method: 'post',
url: `/idtAppServiceV6/oApp/save`,
body: {
tableId,
templateId,
dealInfo: {"BLYJ": blyj},
params: {uuid},
curNodeId: nodeId,
operateId
} }
}).then(res => {
console.log(res)
});
}
const showActionSheet = () => { const showActionSheet = () => {
// const but = button.map(item => (`${item.showname}`)); const BUTTON = []
// console.log(but) button.map(item => BUTTON.push(item.button));
const BUTTONS = ['送部门领导审核', '送办公室分管主任审批', '办结', '取消']; const BUTTONS = BUTTON.concat(['取消']);
ActionSheet.showActionSheetWithOptions({ ActionSheet.showActionSheetWithOptions({
options: BUTTONS, options: BUTTONS,
cancelButtonIndex: BUTTONS.length - 1, cancelButtonIndex: BUTTONS.length - 1,
...@@ -159,8 +185,9 @@ const Process = (props) => { ...@@ -159,8 +185,9 @@ const Process = (props) => {
}); });
}; };
const subUrl = key => { const subUrl = key => {
const url = key === 0 ? 2 : 10 beforeSubmit()
props.history.push(`/blank/submit/${url}`) // const url = button[key].target;
// props.history.push(`/blank/submit/${url}`)
} }
const handleScroll = () => { const handleScroll = () => {
......
...@@ -8,10 +8,10 @@ const SubmitDetail = (props) => { ...@@ -8,10 +8,10 @@ const SubmitDetail = (props) => {
// const [title, setTitle] = useState([]); // const [title, setTitle] = useState([]);
const [disabled, setDisabled] = useState(true); const [disabled, setDisabled] = useState(true);
useEffect(() => { useEffect(() => {
// const {type} = props.match.params const {type} = props.match.params
axiosRequest({ axiosRequest({
method: 'post', method: 'post',
url: `/idtAppServiceV6/oApp/getLeaders?mobileUse=true&nType=1`, url: `/idtAppServiceV6/oApp/getLeaders?nType=${type}`,
}).then(res => { }).then(res => {
setData(res) setData(res)
}); });
......
...@@ -3,30 +3,16 @@ import {ActivityIndicator, Toast, WhiteSpace, WingBlank} from 'antd-mobile' ...@@ -3,30 +3,16 @@ import {ActivityIndicator, Toast, WhiteSpace, WingBlank} from 'antd-mobile'
import TodoCard from '../../components/LogCard' import TodoCard from '../../components/LogCard'
import TopNotice from '../../components/NoticeTab' import TopNotice from '../../components/NoticeTab'
import axiosRequest from '../../utils/request'; import axiosRequest from '../../utils/request';
import Skeleton from '../../components/Skeleton'
import Document from 'react-document-title' import Document from 'react-document-title'
import Empty from '../Empty' import Empty from '../Empty'
// import useDebounce from '../../useHooks/useDebounce' // import useDebounce from '../../useHooks/useDebounce'
const Notice = (props) => { const Notice = (props) => {
const [start, setStart] = useState(true); const [start, setStart] = useState(true);
const [end, setEnd] = useState(true)
const [endT, setEndT] = useState(false); const [endT, setEndT] = useState(false);
const [t, setT] = useState(false)
useEffect(() => {
setT(true)
axiosRequest({
method: 'post',
url: '/idtAppServiceV6/oApp/getUnDone',
body: {nowPage: 1, pageSize: 10},
}).then(res => {
setT(false);
setStart(false)
let result = end && res.rows ? data.concat(res.rows) : data;
res.rows && res.rows.length >= 10 && setCurrent(1);
setEnd(res.rows && res.rows.length >= 10)
setData(result);
});
}, [])
const [current, setCurrent] = useState(0); const [current, setCurrent] = useState(0);
const [searchWord, setSearchWord] = useState(); const [searchWord, setSearchWord] = useState();
...@@ -35,35 +21,36 @@ const Notice = (props) => { ...@@ -35,35 +21,36 @@ const Notice = (props) => {
const [data, setData] = useState([]); const [data, setData] = useState([]);
const getData = () => { const getData = () => {
const pageMap ={searchWord, nowPage: current + 1, pageSize: 10}; const pageMap ={searchWord, nowPage: current + 1, pageSize: 10, FLAG: tab};
setLoading(true) setLoading(true);
axiosRequest({ axiosRequest({
method: 'post', method: 'post',
url: '/idtAppServiceV6/oApp/getUnDone', url: '/idtAppServiceV6/oApp/getUnDone',
body: pageMap, body: pageMap,
}).then(res => { }).then(res => {
setLoading(false); setStart(false);
let result = end && res.rows ? data.concat(res.rows) : data;
res.rows && res.rows.length >= 10 ? setCurrent(current + 1) : setEndT(true);
setEnd(res.rows && res.rows.length >= 10) setEnd(res.rows && res.rows.length >= 10)
let result = end && res.rows ? data.concat(res.rows) : data;
res.rows && res.rows.length >= 10 && setCurrent(1);
setData(result); setData(result);
setLoading(false);
}); });
}; };
//下拉加载 //下拉加载
const [end, setEnd] = useState(true)
const handleScroll = () => { const handleScroll = () => {
let scrollTop = document.documentElement.scrollTop || document.body.scrollTop; let scrollTop = document.documentElement.scrollTop || document.body.scrollTop;
let clientHeight = document.documentElement.clientHeight || document.body.clientHeight; let clientHeight = document.documentElement.clientHeight || document.body.clientHeight;
let scrollHeight = document.documentElement.scrollHeight || document.body.scrollHeight; let scrollHeight = document.documentElement.scrollHeight || document.body.scrollHeight;
if(scrollHeight > clientHeight && scrollTop + clientHeight === scrollHeight) { if(scrollHeight > clientHeight && scrollTop + clientHeight === scrollHeight) {
current > 0 && window.scrollTo(0, document.body.scrollHeight)
getData() getData()
} }
} }
useEffect(() => { useEffect(() => {
window.addEventListener('touchmove', handleScroll, true); window.addEventListener('touchend', handleScroll, true);
return () => window.removeEventListener('touchmove', handleScroll, true); return () => window.removeEventListener('touchend', handleScroll, true);
}, [data]); }, [data]);
const checkLog = (OPERATEID, UUID) => { const checkLog = (OPERATEID, UUID) => {
...@@ -77,41 +64,47 @@ const Notice = (props) => { ...@@ -77,41 +64,47 @@ const Notice = (props) => {
//tab已读未读切换 //tab已读未读切换
const [tab, setTab] = useState('N'); const [tab, setTab] = useState('N');
const tabData = () => { // const tabData = () => {
const pageMap ={searchWord, nowPage: current + 1, pageSize: 10, FLAG: tab}; // const pageMap ={searchWord, nowPage: current + 1, pageSize: 10, FLAG: tab};
setLoading(true) // setLoading(true);
axiosRequest({ // axiosRequest({
method: 'post', // method: 'post',
url: '/idtAppServiceV6/oApp/getUnDone', // url: '/idtAppServiceV6/oApp/getUnDone',
body: pageMap, // body: pageMap,
}).then(res => { // }).then(res => {
setLoading(false); // setLoading(false);
let result = end && res.rows ? [].concat(res.rows) : []; // let result = start && res.rows ? [].concat(res.rows) : [];
res.rows && res.rows.length >= 10 ? setCurrent(current + 1) : Toast.info('当前是最后一页', 1); // res.rows && res.rows.length >= 10 ? setCurrent(current + 1) : setEndT(true);
setEnd(res.rows && res.rows.length >= 10) // setData(result);
setData(result); // });
}); // };
};
const tabChange = val => { const tabChange = val => {
setCurrent(0)
setTab(val); setTab(val);
tabData()
}; };
const tabSearch = val => {
setCurrent(0)
setSearchWord(val)
}
useEffect(() => {
//回到顶部
window.scrollTo(0, 0)
getData()
}, [])
useEffect(() => { useEffect(() => {
setStart(true);
setEndT(false)
setData([])
setCurrent(0)
getData() getData()
}, [searchWord, tab]) }, [searchWord, tab]);
console.log(current)
return ( return (
<Document title="通知"> <Document title="通知">
<WingBlank> <WingBlank>
<ActivityIndicator
toast
text="加载中..."
animating={t}
/>
<WhiteSpace/> <WhiteSpace/>
<TopNotice onSearch={setSearchWord} tabChange={tabChange}/> <TopNotice onSearch={tabSearch} tabChange={tabChange}/>
{ { start ? <div> <WhiteSpace/><Skeleton/><WhiteSpace/><Skeleton/><WhiteSpace/><Skeleton/></div> : ( !start && (
!start && (
data.length > 0 ? data.map((item, index) => ( data.length > 0 ? data.map((item, index) => (
<div key={index}> <div key={index}>
<WhiteSpace/> <WhiteSpace/>
...@@ -119,15 +112,19 @@ const Notice = (props) => { ...@@ -119,15 +112,19 @@ const Notice = (props) => {
</div> </div>
)) : <Empty/> )) : <Empty/>
) ))}
}
<WhiteSpace/> <WhiteSpace/>
{loading && endT && ( {loading && (
<div className="pos-line mb-10"> <div className="pos-line content-loading">
<ActivityIndicator/> <ActivityIndicator/>
<WhiteSpace/> <WhiteSpace/>
</div> </div>
)} )}
{!loading && !end && data.length > 0 && (
<div className="content-end">
—————— 我是有底线的 ——————
</div>
)}
</WingBlank> </WingBlank>
</Document> </Document>
......
.content-end{
width: 100%;
text-align: center;
color: rgba(67, 67, 67, 0.2);
margin-top: 20px;
}
.content-loading{
margin-top: 15px;
}
import React, { useState, useEffect } from 'react'; import React, { useState, useEffect } from 'react';
import {ActivityIndicator, WhiteSpace, WingBlank} from "antd-mobile"; import {WhiteSpace, WingBlank} from "antd-mobile";
import axiosRequest from '../../utils/request'; import axiosRequest from '../../utils/request';
import TopSearch from '../../components/TopSearch' import TopSearch from '../../components/TopSearch'
import WorkCard from '../../components/WorkCard'; import WorkCard from '../../components/WorkCard';
import Skeleton from '../../components/Skeleton'
import Document from 'react-document-title' import Document from 'react-document-title'
import Empty from '../Empty' import Empty from '../Empty'
...@@ -61,15 +62,10 @@ const Work = (props) => { ...@@ -61,15 +62,10 @@ const Work = (props) => {
return ( return (
<Document title="工作"> <Document title="工作">
<WingBlank> <WingBlank>
<ActivityIndicator
toast
text="加载中..."
animating={loading}
/>
<WhiteSpace/> <WhiteSpace/>
<TopSearch onSearch={ workSearch }/> <TopSearch onSearch={ workSearch }/>
<WhiteSpace/> <WhiteSpace/>
{ !start && (data.length > 0 ? ( {loading ? <Skeleton/> : (!start && (data.length > 0 ? (
<WorkCard <WorkCard
title="工作详情" title="工作详情"
addCommon={ commonEdit } addCommon={ commonEdit }
...@@ -78,8 +74,7 @@ const Work = (props) => { ...@@ -78,8 +74,7 @@ const Work = (props) => {
workUrl={workUrl} workUrl={workUrl}
iconAction={ itemAdd } iconAction={ itemAdd }
/> />
) : <Empty/>)} ) : <Empty/>))}
</WingBlank> </WingBlank>
</Document> </Document>
); );
......
...@@ -5,7 +5,7 @@ import TopNotice from '../../components/NoticeTab' ...@@ -5,7 +5,7 @@ import TopNotice from '../../components/NoticeTab'
import axiosRequest from '../../utils/request'; import axiosRequest from '../../utils/request';
import './index.less' import './index.less'
import Empty from '../Empty' import Empty from '../Empty'
import useDebounce from '../../useHooks/useDebounce' // import useDebounce from '../../useHooks/useDebounce'
const WorkDetail = (props) => { const WorkDetail = (props) => {
const [start, setStart] = useState(true); const [start, setStart] = useState(true);
...@@ -49,7 +49,7 @@ const WorkDetail = (props) => { ...@@ -49,7 +49,7 @@ const WorkDetail = (props) => {
//下拉加载 //下拉加载
const [end, setEnd] = useState(true) const [end, setEnd] = useState(true)
const handleScroll = useDebounce(() => { const handleScroll = () => {
let scrollTop = document.documentElement.scrollTop || document.body.scrollTop; let scrollTop = document.documentElement.scrollTop || document.body.scrollTop;
let clientHeight = document.documentElement.clientHeight || document.body.clientHeight; let clientHeight = document.documentElement.clientHeight || document.body.clientHeight;
let scrollHeight = document.documentElement.scrollHeight || document.body.scrollHeight; let scrollHeight = document.documentElement.scrollHeight || document.body.scrollHeight;
...@@ -57,10 +57,10 @@ const WorkDetail = (props) => { ...@@ -57,10 +57,10 @@ const WorkDetail = (props) => {
if(scrollHeight > clientHeight && scrollTop + clientHeight === scrollHeight) { if(scrollHeight > clientHeight && scrollTop + clientHeight === scrollHeight) {
getData() getData()
} }
}, 500) }
useEffect(() => { useEffect(() => {
window.addEventListener('scroll', handleScroll, true); window.addEventListener('touchend', handleScroll, true);
return () => window.removeEventListener('scroll', handleScroll, true); return () => window.removeEventListener('touchend', handleScroll, true);
}, [data]); }, [data]);
const checkLog = () => { const checkLog = () => {
......
import {useRef, useCallback, useEffect} from 'react';
const UseDebounce = (fn, delay, dep = []) => {
const {current} = useRef({fn, timer: null});
useEffect(() => {
current.fn = fn
}, [fn])
return useCallback((...args) => {
if (current.timer) {
clearTimeout(current.timer)
}
current.timer = setTimeout(() => {
current.fn.call(this, ...args)
}, delay)
})
};
export default UseDebounce;
import {useRef, useCallback, useEffect} from 'react';
const UseThrottle = (fn, delay, dep = []) => {
const {current} = useRef({fn, timer: null});
useEffect(() => {
current.fn = fn
}, [fn])
return useCallback((...args) => {
if (!current.timer) {
current.timer = setTimeout(() => {
delete current.timer
}, delay);
current.fn.call(this, ...args)
}
}, dep)
};
export default UseThrottle;
import axios from 'axios'; import axios from 'axios';
import { Toast } from 'antd-mobile'; import { Toast } from 'antd-mobile';
var qs = require('qs')
const instance = axios.create(); const instance = axios.create();
const token = localStorage.getItem("token"); const token = localStorage.getItem("token");
...@@ -31,37 +32,27 @@ export const createAPI = (baseURL) => { ...@@ -31,37 +32,27 @@ export const createAPI = (baseURL) => {
let opts = conf.opts || {}; let opts = conf.opts || {};
let body = conf.body || {}; let body = conf.body || {};
let urlParams = ''; let urlParams = '';
console.log(conf)
let headers = { ...defaultHeaders, ...opts.headers }; let headers = { ...defaultHeaders, ...opts.headers };
if (conf.opts) { if (conf.opts) {
urlParams = "?"; urlParams = "?";
let keys = Object.keys(conf.opts); urlParams += qs.stringify(conf.opts)
keys.map(item => {
let value = conf.opts[item];
if (value !== null && value !== undefined && value !== '') {
urlParams += `${item}=${conf.opts[item]}&`
} }
return null
});
urlParams = urlParams.substr(0, urlParams.length - 1)
}
// if (conf.queryType === 'query') {
// urlParams = conf.body ? "?" + stringify(conf.body) : '';
// }
return instance(Object.assign({}, { return instance(Object.assign({}, {
url: conf.url + urlParams, url: conf.url + urlParams,
baseURL: baseURL, baseURL: baseURL,
method: conf.method, method: conf.method,
data: body, // data: body,
headers, headers,
}, conf.opts)) }))
.then(function (response) { .then(function (response) {
response = response.data; response = response.data;
console.log(response) // console.log(response)
if (!response || !response.data) { if (!response || !response.data) {
window.location.href = '/login' // response.code === 'idt-core-505' && (window.location.href = '/login')
console.log('response出错, 无返回数据!', response); return false; console.log('response出错, 无返回数据!', response); return false;
}; };
if (response.data && response.data.errorMessage) { if (response.data && response.data.errorMessage) {
......
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