Przeglądaj źródła

uas手机版
订阅管理接口对接
订阅数据刷新功能

RaoMeng 5 lat temu
rodzic
commit
76b5f0211c

+ 2 - 2
uas-office-web/uas-mobile/src/components/common/func/FuncItem.jsx

@@ -51,9 +51,9 @@ export default class FuncItem extends Component {
     let { funcObj, operation, sup, lineCount } = this.props
     let funcTextStyle = {
       height: 20 * lineCount + 'px',
-      webkitLineClamp: lineCount,
+      // webkitLineClamp: lineCount,
     }
-    funcTextStyle['-webkit-line-clamp'] = lineCount
+    // funcTextStyle['-webkit-line-clamp'] = lineCount
     return (
       funcObj &&
       <div

+ 7 - 5
uas-office-web/uas-mobile/src/components/common/refreshLayout/RefreshLayout.jsx

@@ -4,6 +4,7 @@
  */
 
 import React, { Component } from 'react'
+import ReactDOM from 'react-dom'
 import { PullToRefresh } from 'antd-mobile'
 import PropTypes from 'prop-types'
 
@@ -22,7 +23,7 @@ export default class RefreshLayout extends Component {
   static defaultProps = {
     direction: 'up',
     damping: 120,
-    distanceToRefresh: 30,
+    distanceToRefresh: 50,
   }
 
   constructor () {
@@ -40,10 +41,11 @@ export default class RefreshLayout extends Component {
           height: this.props.height,
         })
       } else {
-        // const hei = this.state.height - ReactDOM.findDOMNode(this.ptr).offsetTop;
-        // this.setState({
-        //     height: hei
-        // })
+        const hei = this.state.height -
+          ReactDOM.findDOMNode(this.ptr).getBoundingClientRect().top
+        this.setState({
+          height: hei,
+        })
       }
     }, 0)
   }

+ 3 - 0
uas-office-web/uas-mobile/src/configs/api.config.js

@@ -40,4 +40,7 @@ export const API = {
   //获取已订阅类别
   SUBSCRIBE_GETMYSUBSCRIBEDLIST: _baseURL +
     '/mobile/appweb/subscribe/getMySubscribedList.action',
+  //获取订阅推送列表
+  SUBSCRIBE_SUBSCRIBETOPUSH: _baseURL +
+    '/mobile/appweb/subscribe/subscribeToPush.action',
 }

+ 1 - 1
uas-office-web/uas-mobile/src/configs/theme.config.less

@@ -44,7 +44,7 @@
   .com-column-flex;
   overflow-y: scroll;
   overflow-x: hidden;
-  -webkit-overflow-scrolling: touch;
+  //-webkit-overflow-scrolling: touch;
 
   &::-webkit-scrollbar {
     display: none;

+ 24 - 18
uas-office-web/uas-mobile/src/pages/private/subscribe/SubscribeAlready.jsx

@@ -7,9 +7,10 @@ import React, { Component } from 'react'
 import { connect } from 'react-redux'
 import SubAlreadyItem
   from '../../../components/private/subscribe/SubAlreadyItem'
-import { PullToRefresh } from 'antd-mobile'
 import { requestMySubscribe } from '../../../utils/private/subscribe.util'
 import { isObjEmpty } from '../../../utils/common/common.util'
+import RefreshLayout
+  from '../../../components/common/refreshLayout/RefreshLayout'
 
 class SubscribeAlready extends Component {
 
@@ -35,33 +36,38 @@ class SubscribeAlready extends Component {
     let subAlreadyItems = []
     if (!isObjEmpty(listData2)) {
       listData2.forEach((item, index) => {
-        subAlreadyItems.push(<SubAlreadyItem subObj={item}/>)
+        subAlreadyItems.push(<SubAlreadyItem
+          subObj={item}
+          key={'subAlready' + index}/>)
       })
     }
 
     return (
-      <PullToRefresh
+      <RefreshLayout
         className='subscribe-already-root'
+        direction={'down'}
         refreshing={refreshing}
-        onRefresh={() => {
-          this.setState({
-            refreshing: true,
-          })
-          requestMySubscribe().then(() => {
-            this.setState({
-              refreshing: false,
-            })
-          }).catch(() => {
-            this.setState({
-              refreshing: false,
-            })
-          })
-        }}
+        onRefresh={this.refreshData}
       >
         {subAlreadyItems}
-      </PullToRefresh>
+      </RefreshLayout>
     )
   }
+
+  refreshData = () => {
+    this.setState({
+      refreshing: true,
+    })
+    requestMySubscribe().then(() => {
+      this.setState({
+        refreshing: false,
+      })
+    }).catch(() => {
+      this.setState({
+        refreshing: false,
+      })
+    })
+  }
 }
 
 let mapStateToProps = (state) => ({

+ 2 - 2
uas-office-web/uas-mobile/src/pages/private/subscribe/SubscribeManage.jsx

@@ -71,14 +71,14 @@ class SubscribeManage extends Component {
              ref={el => {
                this.contain = el
              }}>
-          <pu className="swiper-wrapper">
+          <div className="swiper-wrapper">
             <div className="swiper-slide swiper-no-swiping">
               <SubscribeNot/>
             </div>
             <div className="swiper-slide swiper-no-swiping">
               <SubscribeAlready/>
             </div>
-          </pu>
+          </div>
         </div>
       </div>
     )

+ 33 - 158
uas-office-web/uas-mobile/src/pages/private/subscribe/SubscribeNot.jsx

@@ -11,171 +11,24 @@ import { SUBSCRIBE_ITEM_NOT } from '../../../configs/constans.config'
 import SubLeftMenu from '../../../components/private/subscribe/SubLeftMenu'
 import { saveListState } from '../../../redux/actions/listState'
 import { isObjEmpty } from '../../../utils/common/common.util'
-import { requestSubscribeConfig } from '../../../utils/private/subscribe.util'
-
-const subMenuList = [
-  {
-    className: '财务管理',
-    subList: [
-      {
-        'img': null,
-        'kind': 'private',
-        'id': 3126,
-        'title': '我的事业部应收款统计(华商龙)',
-        'status': 2,
-      },
-      {
-        'img': null,
-        'kind': 'public',
-        'id': 3140,
-        'title': '风控周报',
-        'status': 2,
-      },
-      {
-        'img': null,
-        'kind': 'private',
-        'id': 3107,
-        'title': '上月利润统计(华商龙)',
-        'status': 2,
-      },
-      {
-        'img': null,
-        'kind': 'private',
-        'id': 3127,
-        'title': '我的事业部逾期应收统计(华商龙)',
-        'status': 2,
-      },
-      {
-        'img': null,
-        'kind': 'private',
-        'id': 3102,
-        'title': '应收款统计(华商龙)',
-        'status': 3,
-      },
-      {
-        'img': '',
-        'kind': 'private',
-        'id': 8806,
-        'title': '逾期应收统计(英唐集团)',
-        'status': 3,
-      },
-      {
-        'img': '',
-        'kind': 'private',
-        'id': 8809,
-        'title': '应付款统计(英唐集团)',
-        'status': 3,
-      },
-    ],
-  },
-  {
-    className: '数据统计',
-    subList: [
-      {
-        'img': null,
-        'kind': 'public',
-        'id': 17143,
-        'title': '优软云流量统计',
-        'status': 3,
-      },
-    ],
-  },
-  {
-    className: '销售管理',
-    subList: [
-      {
-        'img': null,
-        'kind': 'private',
-        'id': 3080,
-        'title': '当月毛利润统计(华商龙)',
-        'status': 3,
-      },
-      {
-        'img': null,
-        'kind': 'private',
-        'id': 3122,
-        'title': '我的事业部当月销售额统计(华商龙)',
-        'status': 3,
-      },
-      {
-        'img': '',
-        'kind': 'private',
-        'id': 8811,
-        'title': '当月毛利润统计(英唐集团)',
-        'status': 3,
-      },
-      {
-        'img': '',
-        'kind': 'private',
-        'id': 8812,
-        'title': '当月销售额统计(英唐集团)',
-        'status': 3,
-      },
-      {
-        'img': null,
-        'kind': 'private',
-        'id': 3100,
-        'title': '当月销售额统计(华商龙)',
-        'status': 3,
-      },
-    ],
-  },
-  {
-    className: '库存管理',
-    subList: [
-      {
-        'img': '',
-        'kind': 'private',
-        'id': 8810,
-        'title': '总库存统计(英唐集团)',
-        'status': 3,
-      },
-      {
-        'img': null,
-        'kind': 'private',
-        'id': 3124,
-        'title': '我的事业部呆滞库存统计(华商龙)',
-        'status': 3,
-      },
-      {
-        'img': null,
-        'kind': 'private',
-        'id': 3123,
-        'title': '我的事业部总库存统计(华商龙)',
-        'status': 3,
-      },
-      {
-        'img': null,
-        'kind': 'private',
-        'id': 3120,
-        'title': '呆滞库存统计(华商龙)',
-        'status': 3,
-      },
-      {
-        'img': null,
-        'kind': 'private',
-        'id': 3125,
-        'title': '我的事业部死库存统计(华商龙)',
-        'status': 3,
-      },
-    ],
-  },
-]
+import {
+  requestMySubscribe,
+  requestSubscribeConfig,
+} from '../../../utils/private/subscribe.util'
+import RefreshLayout
+  from '../../../components/common/refreshLayout/RefreshLayout'
 
 class SubscribeNot extends Component {
 
   constructor () {
     super()
 
-    this.state = {}
+    this.state = {
+      refreshing: false,
+    }
   }
 
   componentDidMount () {
-    // saveListState({
-    //   listData: subMenuList,
-    //   leftSelect: 0,
-    //   scrollTop: 0,
-    // })
     requestSubscribeConfig()
   }
 
@@ -214,12 +67,19 @@ class SubscribeNot extends Component {
     }
     return (
       <div className='subscribe-not-root'>
-        <div className='subscribe-not-left-menu'>
+        <div
+          className='subscribe-not-left-menu'>
           {leftItems}
         </div>
         <div className='subscribe-not-right-list'>
-          {rightItems}
+          <RefreshLayout
+            refreshing={this.state.refreshing}
+            direction={'down'}
+            onRefresh={this.refreshData}>
+            {rightItems}
+          </RefreshLayout>
         </div>
+
       </div>
     )
   }
@@ -230,6 +90,21 @@ class SubscribeNot extends Component {
       scrollTop: 0,
     })
   }
+
+  refreshData = () => {
+    this.setState({
+      refreshing: true,
+    })
+    requestSubscribeConfig().then(() => {
+      this.setState({
+        refreshing: false,
+      })
+    }).catch(() => {
+      this.setState({
+        refreshing: false,
+      })
+    })
+  }
 }
 
 let mapStateToProps = (state) => ({

+ 2 - 0
uas-office-web/uas-mobile/src/redux/reducers/redListState.js

@@ -11,6 +11,8 @@ const initListState = {
   listData2: [],
   pageIndex2: 1,
   itemIndex2: -1,
+
+  leftSelect: 0,
 }
 
 const redListState = (state = initListState, action) => {

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

@@ -15,7 +15,6 @@ import { FUNC_TYPE_REPORT } from '../../configs/constans.config'
  * 获取报表菜单
  */
 export function requestReportFunc () {
-  Toast.loading('正在获取报表列表', 0)
   return fetchGet(API.REPORT_QUERYREPORTLIST).then(response => {
     Toast.hide()
     analysisReportList(response)

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

@@ -15,7 +15,6 @@ import { FUNC_TYPE_DOC } from '../../configs/constans.config'
  * 获取应用列表
  */
 export function requestServices () {
-  Toast.loading('正在获取应用列表', 0)
   return fetchPostObj(API.APPCOMMON_GETSERVICE, {
     kind: 'uasapp',
   }).then(response => {

+ 23 - 10
uas-office-web/uas-mobile/src/utils/private/subscribe.util.js

@@ -19,7 +19,7 @@ import {
  */
 export function requestSubscribeConfig () {
   Toast.loading('数据请求中', 0)
-  fetchPostObj(API.SUBSCRIBE_GETSUBSCRIBELIST).then(response => {
+  return fetchPostObj(API.SUBSCRIBE_GETSUBSCRIBELIST).then(response => {
     Toast.hide()
     analysisSubscribeConfig(response)
   }).catch(error => {
@@ -64,19 +64,32 @@ export const analysisSubscribeConfig = (response) => {
   let subscribeConfigList = []
   if (!isObjEmpty(response.data, response.data.list)) {
     const responseList = response.data.list
-    responseList.forEach((item, index) => {
-      subscribeConfigList.push({
-        id: item.id,
-        title: item.title,
-        img: item.img,
-        kind: item.kind,
-        status: item.status,
-        itemType: SUBSCRIBE_ITEM_NOT,
-      })
+    responseList.forEach((groupItem, groupIndex) => {
+      const subscribeConfig = {
+        className: groupItem.groupName,
+      }
+      const subList = []
+      if (!isObjEmpty(groupItem.list)) {
+        groupItem.list.forEach((childItem, childIndex) => {
+          subList.push({
+            id: childItem.ID_,
+            title: childItem.TITLE_,
+            img: childItem.IMG_,
+            kind: childItem.KIND_,
+            type: childItem.TYPE_,
+            status: childItem.STATUS_,
+            itemType: SUBSCRIBE_ITEM_NOT,
+          })
+        })
+      }
+      subscribeConfig.subList = subList
+
+      subscribeConfigList.push(subscribeConfig)
     })
   }
   saveListState({
     scrollTop: 0,
+    leftSelect: 0,
     listData: subscribeConfigList,
   })
 }