张延森 4 年之前
父節點
當前提交
852269c854

+ 3
- 0
src/pages/WoDe/YeZhuBaoXiu/index.config.js 查看文件

@@ -0,0 +1,3 @@
1
+export default {
2
+  navigationBarTitleText: '业主报修'
3
+}

+ 46
- 0
src/pages/WoDe/YeZhuBaoXiu/index.jsx 查看文件

@@ -0,0 +1,46 @@
1
+import React, { useState } from 'react'
2
+import ScrollPageRefresh from '@/components/ScrollPageRefresh'
3
+import WuYeBaoXiuItem from '@/components/WuYeBaoXiuItem'
4
+import { useModel } from '@/store'
5
+import Page from '@/layouts'
6
+import '@/assets/css/reset.less'
7
+import '@/assets/css/iconfont.less'
8
+import './index.less'
9
+
10
+export default function WoDeGongDan () {
11
+
12
+  const { user } = useModel('user')
13
+  const [PageList, setPageList] = useState([])
14
+  const [IsEmpty, setIsEmpty] = useState(false)
15
+
16
+  const Refresh = (e) => { // 下拉刷新
17
+    if (e.length > 0) {
18
+      setIsEmpty(false)
19
+      setPageList(e)
20
+    } else {
21
+      setIsEmpty(true)
22
+    }
23
+  }
24
+
25
+  const Push = (e) => { // 上拉加载
26
+    setPageList(PageList.concat(e))
27
+  }
28
+
29
+  return (
30
+    <Page>
31
+      <view className='WoDeGongDan'>
32
+        <ScrollPageRefresh IsEmpty={IsEmpty} ApiName={`getGongDanList`} ListName={`pagelist`} RequestUrlData={{ orgId: user.orgId }} RequestParams={{ type: 2 }} Refresh={Refresh} Push={Push}>
33
+          <view className='Content Activity'>
34
+            {
35
+              PageList.map((item, index) => (
36
+                <view className='ListItem' key={`ActivityItem-${index}`}>
37
+                  <WuYeBaoXiuItem Data={item}></WuYeBaoXiuItem>
38
+                </view>
39
+              ))
40
+            }
41
+          </view>
42
+        </ScrollPageRefresh>
43
+      </view>
44
+    </Page>
45
+  )
46
+}

+ 22
- 0
src/pages/WoDe/YeZhuBaoXiu/index.less 查看文件

@@ -0,0 +1,22 @@
1
+.WoDeGongDan {
2
+  width: 100%;
3
+  height: 100%;
4
+  position: relative;
5
+  background: #f8f8f8;
6
+  overflow: hidden;
7
+
8
+  .Content {
9
+    padding: 0 30px;
10
+    position: relative;
11
+    overflow: hidden;
12
+
13
+    >.ListItem {
14
+      position: relative;
15
+      overflow: hidden;
16
+      margin-bottom: 30px;
17
+      &:first-child {
18
+        margin-top: 30px;
19
+      }
20
+    }
21
+  }
22
+}

+ 44
- 30
src/pages/WoDe/index.jsx 查看文件

@@ -1,29 +1,44 @@
1
-import React, { useState, useEffect } from 'react'
1
+import React, { useState, useEffect, useMemo } from 'react'
2 2
 import NavHeader from '@/components/NavHeader/index'
3 3
 import Taro from '@tarojs/taro'
4
+import { Block } from '@tarojs/components'
4 5
 import request, { apis } from '@/utils/request'
5 6
 import { useModel } from '@/store'
6 7
 import Page from '@/layouts'
8
+import { PERSON_TYPE } from '@/utils/constants'
7 9
 import '@/assets/css/reset.less'
8 10
 import '@/assets/css/iconfont.less'
9 11
 import './index.less'
10 12
 
11
-export default function WoDe () {
12
-
13
-  const { user, setUser } = useModel('user')
14
-  const [UserTab] = useState([
13
+// 二维数组用于页面美化加分隔栏
14
+// personTypes 用于指定人员身份
15
+const menuGroup = [
16
+  [
15 17
     { icon: 'iconrenzheng1', name: '业主认证', id: 1, router: '/pages/WoDe/WoDeRenZheng/index' },
16 18
     { icon: 'iconjifenguize', name: '积分明细', id: 2, router: '/pages/FuLi/JiFenMingXi/index' },
17 19
     { icon: 'iconjiaofei', name: '物业缴费', id: 3, router: '/pages/WoDe/WoDeJiaoFei/index' },
18
-    { icon: 'iconfuwu1', name: '物业报修', id: 4, router: '/pages/WoDe/WoDeGongDan/index' }
19
-  ])
20
-  const [MoreUserTab] = useState([
20
+    { icon: 'iconfuwu1', name: '物业报修', id: 4, router: '/pages/WoDe/WoDeGongDan/index' },
21
+    // { icon: 'iconfuwu1', name: '业主工单', id: 4, router: '/pages/WoDe/WoDeGongDan/index', personTypes: [PERSON_TYPE.LIFE_CONSULTANT] },
22
+    { icon: 'iconfuwu1', name: '业主报修', id: 4, router: '/pages/WoDe/WoDeGongDan/index' },
23
+  ],
24
+  [
21 25
     { icon: 'iconerweima', name: '推荐二维码', id: 5, router: '/pages/WoDe/TuiJianErWeiMa/index' },
22 26
     // { icon: 'iconfenxiang', name: '推荐分享', id: 6, router: '/pages/WoDe/TuiJianFenXiang/index' },
23 27
     { icon: 'iconhuodong', name: '参与活动', id: 7, router: '/pages/WoDe/WoDeHuoDong/index' }
24
-  ])
28
+  ]
29
+]
30
+
31
+export default function WoDe () {
32
+
33
+  const { user, setUser } = useModel('user')
25 34
   const [DataLock, setDataLock] = useState(false)
26 35
 
36
+  const menuList = useMemo(() => {
37
+    return menuGroup.map(menus => menus.filter(menu => {
38
+      return (!menu.personTypes || !menu.personTypes.length || menu.personTypes.indexOf(user.personType) > -1)
39
+    })).filter(menus => menus && menus.length)
40
+  }, [user.personType])
41
+
27 42
   useEffect(() => {
28 43
     if (user !== null) {
29 44
       request({ ...apis.getUserInfo }).then((res) => {
@@ -74,27 +89,26 @@ export default function WoDe () {
74 89
           {/* 用户选项 */}
75 90
           <view className='UserTab'>
76 91
             {
77
-              UserTab.map((item, index) => (
78
-                <view key={`UserTab-${index}`} className='flex-h' onClick={() => { Taro.navigateTo({ url: item.router }) }}>
79
-                  <text className={`iconfont ${item.icon}`}></text>
80
-                  <view className='flex-h flex-item'>
81
-                    <text className='flex-item'>{item.name}</text>
82
-                    <text className='iconfont iconjiantouright'></text>
83
-                  </view>
84
-                </view>
85
-              ))
86
-            }
87
-            <view className='Line'></view>
88
-            {
89
-              MoreUserTab.map((item, index) => (
90
-                <view key={`UserTab-${index}`} className='flex-h' onClick={() => { Taro.navigateTo({ url: item.router }) }}>
91
-                  <text className={`iconfont ${item.icon}`}></text>
92
-                  <view className='flex-h flex-item'>
93
-                    <text className='flex-item'>{item.name}</text>
94
-                    <text className='iconfont iconjiantouright'></text>
95
-                  </view>
96
-                </view>
97
-              ))
92
+              menuList.map((menus, inx) => {
93
+                return (
94
+                  <Block key={inx}>
95
+                    {
96
+                      inx > 0 && <view className='Line'></view>
97
+                    }
98
+                    {
99
+                      menus.map((item, index) => (
100
+                        <view key={`UserTab-${index}`} className='flex-h' onClick={() => { Taro.navigateTo({ url: item.router }) }}>
101
+                          <text className={`iconfont ${item.icon}`}></text>
102
+                          <view className='flex-h flex-item'>
103
+                            <text className='flex-item'>{item.name}</text>
104
+                            <text className='iconfont iconjiantouright'></text>
105
+                          </view>
106
+                        </view>
107
+                      ))
108
+                    }
109
+                  </Block>
110
+                )
111
+              })
98 112
             }
99 113
           </view>
100 114
 

+ 6
- 0
src/utils/constants.js 查看文件

@@ -0,0 +1,6 @@
1
+
2
+export const PERSON_TYPE = {
3
+  LIFE_CONSULTANT: 'life-consultant', // 生活管家
4
+  PROP: 'prop', // 物业相关
5
+  WORKER: 'worker', // 维修工
6
+}