Browse Source

uas手机版
细节优化

RaoMeng 5 years ago
parent
commit
ba465ca65e

+ 1 - 1
uas-office-web/uas-mobile/src/components/common/currencyList/CurrencyList.jsx

@@ -126,8 +126,8 @@ class CurrencyList extends Component {
     const {
       listDataSource,
       height,
-      hasNextPage,
       filterOpen,
+      hasNextPage,
       isEmpty,
     } = this.state
 

+ 2 - 1
uas-office-web/uas-mobile/src/components/common/loading/PageLoading.jsx

@@ -26,9 +26,10 @@ export default class PageLoading extends Component {
         flexDirection: 'column',
         alignItems: 'center',
         justifyContent: 'center',
+        padding: '24px',
       }}>
         <ActivityIndicator size="large"/>
-        <span style={{ marginTop: 8 }}>页面加载中</span>
+        {/*<span style={{ marginTop: 8 }}>数据加载中</span>*/}
       </div>
     )
   }

+ 9 - 8
uas-office-web/uas-mobile/src/pages/private/homePage/DocRoot.jsx

@@ -8,12 +8,10 @@ import { connect } from 'react-redux'
 import { isObjEmpty } from '../../../utils/common/common.util'
 import FuncGroup from '../../../components/common/func/FuncGroup'
 import { requestServices } from '../../../utils/private/services.util'
-import RefreshLayout
-  from '../../../components/common/refreshLayout/RefreshLayout'
 import { PullToRefresh } from 'antd-mobile'
-import { GlobalEvent } from '../../../utils/common/eventbus/eventbus'
-import { EVENT_DOC_FUNC_COUNT } from '../../../utils/common/eventbus/events.types'
 import { refreshDocList } from '../../../redux/actions/docState'
+import { Empty } from 'antd'
+import PageLoading from '../../../components/common/loading/PageLoading'
 
 class DocRoot extends Component {
 
@@ -35,10 +33,10 @@ class DocRoot extends Component {
   }
 
   render () {
-    const { docState } = this.props
+    const { docState: { docFuncGroupList, docEmpty } } = this.props
     const funcGroupItems = []
-    if (!isObjEmpty(docState, docState.docFuncGroupList)) {
-      docState.docFuncGroupList.forEach((item, index) => {
+    if (!isObjEmpty(docFuncGroupList)) {
+      docFuncGroupList.forEach((item, index) => {
         funcGroupItems.push(
           <FuncGroup
             funcGroup={item}
@@ -58,7 +56,10 @@ class DocRoot extends Component {
         refreshing={this.state.refreshing}
         onRefresh={this.refreshFunc}
         className='doc-root'>
-        {funcGroupItems}
+        {funcGroupItems.length > 0 ?
+          funcGroupItems :
+          docEmpty ? <Empty image={Empty.PRESENTED_IMAGE_SIMPLE}/> :
+            this.state.refreshing ? '' : <PageLoading/>}
       </PullToRefresh>
     )
   }

+ 9 - 4
uas-office-web/uas-mobile/src/pages/private/homePage/ReportRoot.jsx

@@ -8,8 +8,10 @@ import { withRouter } from 'react-router-dom'
 import { connect } from 'react-redux'
 import FuncGroup from '../../../components/common/func/FuncGroup'
 import { isObjEmpty } from '../../../utils/common/common.util'
-import { SearchBar, PullToRefresh } from 'antd-mobile'
+import { SearchBar, PullToRefresh, ActivityIndicator } from 'antd-mobile'
 import { requestReportFunc } from '../../../utils/private/report.util'
+import { Empty } from 'antd'
+import PageLoading from '../../../components/common/loading/PageLoading'
 
 class ReportRoot extends Component {
 
@@ -30,8 +32,8 @@ class ReportRoot extends Component {
   }
 
   render () {
-    const { reportState: { reportFuncGroupList, recentUse } } = this.props
-    const funcGroupItems = []
+    const { reportState: { reportFuncGroupList, recentUse, reportEmpty } } = this.props
+    let funcGroupItems = []
     if (!isObjEmpty(recentUse)) {
       const recentItem = {
         groupTitle: '最近查询',
@@ -73,7 +75,10 @@ class ReportRoot extends Component {
           onRefresh={this.refreshFunc}
           className='report-func-root'
         >
-          {funcGroupItems}
+          {funcGroupItems.length > 0 ?
+            funcGroupItems :
+            reportEmpty ? <Empty image={Empty.PRESENTED_IMAGE_SIMPLE}/> :
+              this.state.refreshing ? '' : <PageLoading/>}
         </PullToRefresh>
       </div>
     )

+ 35 - 17
uas-office-web/uas-mobile/src/pages/private/subscribe/SubscribeList.jsx

@@ -12,8 +12,8 @@ import { isObjEmpty } from '../../../utils/common/common.util'
 import SubscribeGroup
   from '../../../components/private/subscribe/SubscribeGroup'
 import { fetchPostObj } from '../../../utils/common/fetchRequest'
-import { _baseURL, _host, API } from '../../../configs/api.config'
-import { message } from 'antd'
+import { API } from '../../../configs/api.config'
+import { Empty, message } from 'antd'
 import { saveListState } from '../../../redux/actions/listState'
 import { LIST_PAGE_SIZE } from '../../../configs/constans.config'
 
@@ -27,7 +27,8 @@ class SubscribeList extends Component {
 
     this.state = {
       refreshing: true,
-      // hasNextPage: true,
+      hasNextPage: true,
+      isEmpty: false,
       height: document.documentElement.clientHeight,
       subscribeDataSource: new ListView.DataSource({
         rowHasChanged: (row1, row2) => row1 !== row2,
@@ -41,6 +42,7 @@ class SubscribeList extends Component {
     this.setState({
       height: hei,
       refreshing: false,
+      isEmpty: false,
     })
     if (this.props.listState && !isObjEmpty(this.props.listState.listData)) {
       mPageIndex = this.props.listState.pageIndex
@@ -48,14 +50,14 @@ class SubscribeList extends Component {
       this.setState({
           subscribeDataSource: this.state.subscribeDataSource.cloneWithRows(
             mSubscribeList),
-          // hasNextPage: this.props.listState.hasNextPage,
+          hasNextPage: this.props.listState.hasNextPage,
         },
         () => {
           ReactDOM.findDOMNode(
             this.lv).scrollTop = this.props.listState.scrollTop
-          // if (this.state.hasNextPage) {
-          this.loadSubscribeList()
-          // }
+          if (this.state.hasNextPage) {
+            this.loadSubscribeList()
+          }
         },
       )
     } else {
@@ -70,7 +72,13 @@ class SubscribeList extends Component {
   }
 
   render () {
-    const { subscribeDataSource, height } = this.state
+    const {
+      subscribeDataSource,
+      height,
+      hasNextPage,
+      isEmpty,
+    } = this.state
+
     const refreshLayout = this.getRefreshLayout()
     return (
       <div className='com-column-flex'>
@@ -79,7 +87,10 @@ class SubscribeList extends Component {
           dataSource={subscribeDataSource}
           initialListSize={LIST_PAGE_SIZE}
           renderFooter={() => {
-            return <LoadingMore/>
+            return (
+              hasNextPage ? <LoadingMore/> :
+                (isEmpty ? <Empty image={Empty.PRESENTED_IMAGE_SIMPLE}/> : '')
+            )
           }}
           renderRow={(rowData, sectionID, rowID) => {
             return <SubscribeGroup
@@ -105,6 +116,8 @@ class SubscribeList extends Component {
       onRefresh={() => {
         this.setState({
           refreshing: true,
+          isEmpty: false,
+          hasNextPage: true,
         })
         mPageIndex = 0
         mSubscribeList = []
@@ -145,11 +158,19 @@ class SubscribeList extends Component {
         this.setState({
           subscribeDataSource: this.state.subscribeDataSource.cloneWithRows(
             mSubscribeList),
-          refreshing: false,
+          hasNextPage: response.data.list.length >= LIST_PAGE_SIZE,
+          isEmpty: false,
         })
       } else {
         mPageIndex--
+        this.setState({
+          hasNextPage: false,
+          isEmpty: mPageIndex === 0,
+        })
       }
+      this.setState({
+        refreshing: false,
+      })
     }).catch(error => {
       mPageIndex--
       if (typeof error === 'string') {
@@ -178,14 +199,11 @@ class SubscribeList extends Component {
         scrollTop: ReactDOM.findDOMNode(this.lv).scrollTop,
         pageIndex: mPageIndex,
         listData: mSubscribeList,
+        hasNextPage: this.state.hasNextPage,
       })
-      // window.open(
-      //   _baseURL + '/common/charts/mobileCharts.action?numId=' + subObj.NUM_ID_
-      //   + '&mainId=' + subObj.INSTANCE_ID_
-      //   + '&insId=' + subObj.ID_
-      //   + '&title=' + subObj.TITLE_, '_self',
-      // )
-      this.props.history.push('/subscribeChart/' + subObj.ID_ + '/' + subObj.NUM_ID_ + '/' + subObj.INSTANCE_ID_)
+      this.props.history.push(
+        '/subscribeChart/' + subObj.ID_ + '/' + subObj.NUM_ID_ + '/' +
+        subObj.INSTANCE_ID_)
     }
   }
 }

+ 1 - 0
uas-office-web/uas-mobile/src/redux/reducers/redDocState.js

@@ -11,6 +11,7 @@ import { isObjEmpty } from '../../utils/common/common.util'
 
 const initDocState = {
   docFuncGroupList: [],
+  docEmpty: false,
 }
 
 const redDocState = (state = initDocState, action) => {

+ 1 - 0
uas-office-web/uas-mobile/src/redux/reducers/redReportState.js

@@ -11,6 +11,7 @@ import {
 const initReportState = {
   reportFuncGroupList: [],//报表菜单
   recentUse: [],//最近使用
+  reportEmpty: false,
 }
 
 const redReportState = (state = initReportState, action) => {

+ 4 - 0
uas-office-web/uas-mobile/src/utils/private/report.util.js

@@ -18,6 +18,9 @@ import { FUNC_TYPE_REPORT } from '../../configs/constans.config'
  * 获取报表菜单
  */
 export function requestReportFunc () {
+  refreshReportList({
+    reportEmpty: false,
+  })
   return fetchGet(API.REPORT_QUERYREPORTLIST).then(response => {
     Toast.hide()
     analysisReportList(response)
@@ -88,6 +91,7 @@ export const analysisReportList = (response) => {
   refreshReportList({
     reportFuncGroupList,
     recentUse,
+    reportEmpty: isObjEmpty(reportFuncGroupList) && isObjEmpty(recentUse),
   })
 }
 

+ 4 - 0
uas-office-web/uas-mobile/src/utils/private/services.util.js

@@ -15,6 +15,9 @@ import { FUNC_TYPE_DOC } from '../../configs/constans.config'
  * 获取应用列表
  */
 export function requestServices () {
+  refreshDocList({
+    docEmpty: false,
+  })
   return fetchPostObj(API.APPCOMMON_GETSERVICE, {
     kind: 'uasapp',
   }).then(response => {
@@ -92,5 +95,6 @@ export const analysisDocList = (response) => {
 
   refreshDocList({
     docFuncGroupList,
+    docEmpty: isObjEmpty(docFuncGroupList),
   })
 }