张延森 4 年前
父节点
当前提交
61bb017fe5

+ 1
- 2
src/actions/user.js 查看文件

16
   API_QUERY_DOCUMENTVERIFY
16
   API_QUERY_DOCUMENTVERIFY
17
 } from '@/constants/api'
17
 } from '@/constants/api'
18
 
18
 
19
-import { createAction,createActionNormal } from '@/utils/redux'
19
+import { createAction, createActionNormal } from '@/utils/redux'
20
 
20
 
21
 /**
21
 /**
22
  * 获取用户信息
22
  * 获取用户信息
83
   payload,
83
   payload,
84
   method: 'GET'
84
   method: 'GET'
85
 })
85
 })
86
-

+ 1
- 1
src/components/Modal/index.jsx 查看文件

11
       <View className='yz-modal'>
11
       <View className='yz-modal'>
12
         <View className='yz-modal-header'>
12
         <View className='yz-modal-header'>
13
           <View className='yz-modal-header-title'>{title}</View>
13
           <View className='yz-modal-header-title'>{title}</View>
14
-          <View className='yz-modal-header-action' onClose={onClose}>X</View>
14
+          <View className='yz-modal-header-action' onClick={onClose}>×</View>
15
         </View>
15
         </View>
16
         <View className='yz-modal-body'>
16
         <View className='yz-modal-body'>
17
           {props.children}
17
           {props.children}

+ 1
- 0
src/components/Modal/style.scss 查看文件

18
       flex: none;
18
       flex: none;
19
       width: 48rpx;
19
       width: 48rpx;
20
       text-align: right;
20
       text-align: right;
21
+      font-size: 60rpx;
21
     }
22
     }
22
   }
23
   }
23
 
24
 

+ 17
- 0
src/components/Spin/Spin2.jsx 查看文件

1
+import React from 'react'
2
+import { View } from '@tarojs/components'
3
+import Spin from '.'
4
+
5
+import './style.scss'
6
+
7
+export default (props) => {
8
+  const { spinning, style, ...leftProps } = props
9
+
10
+  return spinning ? (
11
+    <View className='spin2box' style={style}>
12
+      <View className='spin2'>
13
+        {spinning && <Spin {...leftProps} />}
14
+      </View>
15
+    </View>
16
+  ) : null
17
+}

+ 7
- 6
src/components/Spin/index.jsx 查看文件

1
 import './style.scss'
1
 import './style.scss'
2
 
2
 
3
 export default (props) => {
3
 export default (props) => {
4
-  const { size = '160rpx' } = props
4
+  const { size = '160rpx', background = 'transparent' } = props
5
   const wrapperStyle = {
5
   const wrapperStyle = {
6
     width: size,
6
     width: size,
7
     height: size,
7
     height: size,
8
+    background,
8
   }
9
   }
9
 
10
 
10
   const leftBarStyle = {
11
   const leftBarStyle = {
18
   }
19
   }
19
 
20
 
20
   return (
21
   return (
21
-    <view className="spin" style={wrapperStyle}>
22
-      <view className="mask-left">
23
-        <view className="spin-bar" style={leftBarStyle}></view>
22
+    <view className='spin' style={wrapperStyle}>
23
+      <view className='mask-left'>
24
+        <view className='spin-bar' style={leftBarStyle}></view>
24
       </view>
25
       </view>
25
-      <view className="mask-right">
26
-        <view className="spin-bar" style={rightBarStyle}></view>
26
+      <view className='mask-right'>
27
+        <view className='spin-bar' style={rightBarStyle}></view>
27
       </view>
28
       </view>
28
     </view>
29
     </view>
29
   )
30
   )

+ 20
- 1
src/components/Spin/style.scss 查看文件

109
   80%, 90% {
109
   80%, 90% {
110
     border-color: #ffa700;
110
     border-color: #ffa700;
111
   }
111
   }
112
-}
112
+}
113
+
114
+.spin2box {
115
+  width: 100%;
116
+  height: 100%;
117
+  position: absolute;
118
+  top: 0;
119
+  left: 0;
120
+  z-index: 100;
121
+  text-align: center;
122
+  background: rgba(255, 255, 255, .75);
123
+
124
+  .spin2 {
125
+    display: inline-block;
126
+    margin: auto;
127
+    position: absolute;
128
+    top: 50%;
129
+    transform: translateY(-50%);
130
+  }
131
+}

+ 0
- 24
src/layout/Basic/index.jsx 查看文件

1
-import React, { useEffect, useState } from 'react'
2
-import { connect } from 'react-redux'
3
-import Loading from '@/components/Loading'
4
-import Overlay from '@/components/Overlay'
5
-
6
-const BasicLayout = (props) => {
7
-  const {person, children, onProps, ...leftProps} = props
8
-  const loading = !person || !person.personId
9
-
10
-  if (onProps) {
11
-    onProps({person, ...leftProps})
12
-  }
13
-
14
-  return (
15
-    <>
16
-      <Overlay visible={loading} style={{background: '#fff'}}>
17
-        <Loading />
18
-      </Overlay>
19
-      {children}
20
-    </>
21
-  )
22
-}
23
-
24
-export default connect(({ user }) => ({...user.userInfo || {}}))(BasicLayout)

+ 12
- 0
src/layout/WrapperPerson.jsx 查看文件

1
+import React from 'react'
2
+import { useSelector } from 'react-redux'
3
+import { useRouter } from '@tarojs/taro'
4
+
5
+export default (props) => {
6
+  const { person, ...extInfo } = useSelector(s => s.user.userInfo)
7
+  const router = useRouter()
8
+
9
+  return person && person.personId
10
+    ? React.cloneElement(props.children, { person, router, ...extInfo })
11
+    : null
12
+}

+ 30
- 28
src/layout/index.js 查看文件

1
 import React, { useState, useEffect } from 'react'
1
 import React, { useState, useEffect } from 'react'
2
-import { useRouter } from '@tarojs/taro'
2
+import { useSelector } from 'react-redux'
3
 import { View } from '@tarojs/components'
3
 import { View } from '@tarojs/components'
4
 import Overlay from '@/components/Overlay'
4
 import Overlay from '@/components/Overlay'
5
+import Loading from '@/components/Loading'
5
 import AuthAvatar from '@/components/Auth/AuthAvatar'
6
 import AuthAvatar from '@/components/Auth/AuthAvatar'
6
 import AuthPhone from '@/components/Auth/AuthPhone'
7
 import AuthPhone from '@/components/Auth/AuthPhone'
7
-import BasicLayout from './Basic'
8
+import Spin from '@/components/Spin/Spin2'
9
+import WrapperPerson from './WrapperPerson'
8
 import useAuth from './useAuth'
10
 import useAuth from './useAuth'
9
 
11
 
10
 import './style.scss'
12
 import './style.scss'
11
 
13
 
12
-export default (Child) => (props) => {
13
-  // ext 里面包含的人员等基本信息
14
-  const [info, setInfo] = useState({})
15
-  // 路由信息
16
-  const router = useRouter()
14
+export default (ChildComponent) => (props) => {
15
+  const { person } = useSelector(s => s.user.userInfo)
16
+  const { spinning } = useSelector(s => s.user)
17
 
17
 
18
-  const [authPhone, authAvatar] = useAuth(info?.person)
18
+  const [loading, setLoading] = useState(false)
19
+  const [authPhone, authAvatar] = useAuth(person)
19
 
20
 
20
-  // 是否完成登录
21
-  const isLoged = !!info?.person?.personId
21
+  useEffect(() => {
22
+    setLoading(!person || !person.personId)
23
+  // eslint-disable-next-line react-hooks/exhaustive-deps
24
+  }, [person])
22
 
25
 
23
   return (
26
   return (
24
     <>
27
     <>
25
-      <BasicLayout onProps={setInfo} />
26
-      {
27
-        isLoged && (
28
-          <>
29
-            <Overlay visible={authPhone} aligin='bottom'>
30
-              <View className='auth-wrapper'>
31
-                <AuthPhone />
32
-              </View>
33
-            </Overlay>
34
-            <Overlay visible={!authPhone && authAvatar} aligin='bottom'>
35
-              <View className='auth-wrapper'>
36
-                <AuthAvatar />
37
-              </View>
38
-            </Overlay>
39
-            <Child {...info} {...props} router={router} />
40
-          </>
41
-        )
42
-      }
28
+      <Overlay visible={loading} style={{background: '#fff'}}>
29
+        <Loading />
30
+      </Overlay>
31
+      <Overlay visible={authPhone} aligin='bottom'>
32
+        <View className='auth-wrapper'>
33
+          <AuthPhone />
34
+        </View>
35
+      </Overlay>
36
+      <Overlay visible={!authPhone && authAvatar} aligin='bottom'>
37
+        <View className='auth-wrapper'>
38
+          <AuthAvatar />
39
+        </View>
40
+      </Overlay>
41
+      <Spin size={32} spinning={spinning} />
42
+      <WrapperPerson>
43
+        <ChildComponent />
44
+      </WrapperPerson>
43
     </>
45
     </>
44
   )
46
   )
45
 }
47
 }

+ 5
- 9
src/pages/index/buildingDetail/components/BasicInfo/index.jsx 查看文件

1
 import { useState } from 'react'
1
 import { useState } from 'react'
2
+import Taro from '@tarojs/taro'
2
 import { ScrollView, Image } from '@tarojs/components'
3
 import { ScrollView, Image } from '@tarojs/components'
3
 import classNames from 'classnames'
4
 import classNames from 'classnames'
4
-import Modal from '@/components/Modal'
5
-import BuildingInfo from '@/pages/index/buildingInfo'
6
 import useFavor from '@/utils/hooks/useFavor'
5
 import useFavor from '@/utils/hooks/useFavor'
7
 import '@/assets/css/iconfont.css'
6
 import '@/assets/css/iconfont.css'
8
 import './index.scss'
7
 import './index.scss'
13
   const { buildingId, isSave } = Info
12
   const { buildingId, isSave } = Info
14
 
13
 
15
   const [isSaved, handleFavor] = useFavor(isSave)
14
   const [isSaved, handleFavor] = useFavor(isSave)
16
-  const [showMore, setShowMore] = useState(false)
15
+
16
+  const goto = (url) => Taro.navigateTo({ url })
17
 
17
 
18
   return (
18
   return (
19
     <view className='components BasicInfo'>
19
     <view className='components BasicInfo'>
160
 
160
 
161
       {/* 互动 */}
161
       {/* 互动 */}
162
       <view className='Interact flex-h'>
162
       <view className='Interact flex-h'>
163
-        <text className='flex-item' onClick={() => setShowMore(true)}>更多楼盘信息</text>
163
+        <text className='flex-item' onClick={() => goto(`/pages/index/buildingInfo/index?id=${buildingId}`)}>更多楼盘信息</text>
164
         <text className='flex-item active'>订阅活动通知</text>
164
         <text className='flex-item active'>订阅活动通知</text>
165
       </view>
165
       </view>
166
 
166
 
167
       {/* 提示 */}
167
       {/* 提示 */}
168
       <view className='Tips'>
168
       <view className='Tips'>
169
         <text className='iconfont icon-bangzhu'></text>
169
         <text className='iconfont icon-bangzhu'></text>
170
-        <text>查看报备规则?</text>
170
+        <text onClick={() => goto(`/pages/index/buildingRules/index?buildingId=${buildingId}`)}>查看报备规则?</text>
171
       </view>
171
       </view>
172
-
173
-      <Modal title='楼盘信息' visible={showMore} onClose={() => setShowMore(false)}>
174
-        <BuildingInfo />
175
-      </Modal>
176
     </view>
172
     </view>
177
   )
173
   )
178
 }
174
 }

+ 6
- 4
src/pages/index/buildingDetail/index.jsx 查看文件

2
 import withLayout from '@/layout'
2
 import withLayout from '@/layout'
3
 import { ScrollView } from '@tarojs/components'
3
 import { ScrollView } from '@tarojs/components'
4
 import '@/assets/css/iconfont.css'
4
 import '@/assets/css/iconfont.css'
5
-import { useSelector } from 'react-redux'
5
+import Spin from '@/components/Spin/Spin2'
6
 import { fetch } from '@/utils/request'
6
 import { fetch } from '@/utils/request'
7
 import { API_ITEMS_DETAIL, API_PROJECT_TREND_LIST, API_ACTIVITY_GROUP, API_LIVE_LIST, API_NEWS_LIST } from '@/constants/api'
7
 import { API_ITEMS_DETAIL, API_PROJECT_TREND_LIST, API_ACTIVITY_GROUP, API_LIVE_LIST, API_NEWS_LIST } from '@/constants/api'
8
-import './index.scss'
9
 import DetailBottom from './components/DetailBottom/index'
8
 import DetailBottom from './components/DetailBottom/index'
10
 import Banner from './components/Banner/index'
9
 import Banner from './components/Banner/index'
11
 import BasicInfo from './components/BasicInfo/index'
10
 import BasicInfo from './components/BasicInfo/index'
19
 import News from './components/News/index'
18
 import News from './components/News/index'
20
 import Pictures from './components/Pictures/index'
19
 import Pictures from './components/Pictures/index'
21
 
20
 
21
+import './index.scss'
22
+
22
 export default withLayout((props) => {
23
 export default withLayout((props) => {
23
   const { id } = props.router.params
24
   const { id } = props.router.params
24
 
25
 
32
 
33
 
33
   useEffect(() => {
34
   useEffect(() => {
34
     // 获取楼盘信息
35
     // 获取楼盘信息
35
-    fetch({ url: `${API_ITEMS_DETAIL}/${id}` }).then((res) => {
36
+    fetch({ url: `${API_ITEMS_DETAIL}/${id}`, spin: true }).then((res) => {
36
       setDetailInfo(res || {})
37
       setDetailInfo(res || {})
37
       
38
       
38
       if (res?.buildingApartment) {
39
       if (res?.buildingApartment) {
39
         const List = res.buildingApartment.filter(item => item.apartmentType === 'photo')
40
         const List = res.buildingApartment.filter(item => item.apartmentType === 'photo')
40
         setPictureList(List.filter(item => item.buildingImgList.length > 0))
41
         setPictureList(List.filter(item => item.buildingImgList.length > 0))
41
       }
42
       }
43
+    }).catch((err) => {
44
+      console.error(err)
42
     })
45
     })
43
 
46
 
44
     // 获取资讯列表
47
     // 获取资讯列表
70
 
73
 
71
   return (
74
   return (
72
     <view className='Page buildingDetail flex-v'>
75
     <view className='Page buildingDetail flex-v'>
73
-
74
       <view className='flex-item'>
76
       <view className='flex-item'>
75
         <view>
77
         <view>
76
           <ScrollView scroll-y refresher-enabled={false} refresher-triggered={IsPull} onrefresherrefresh={PageRefresh} refresher-background='#f8f8f8'>
78
           <ScrollView scroll-y refresher-enabled={false} refresher-triggered={IsPull} onrefresherrefresh={PageRefresh} refresher-background='#f8f8f8'>

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

1
+export default {
2
+  navigationBarTitleText: '楼盘详情'
3
+}

+ 41
- 24
src/pages/index/buildingInfo/index.jsx 查看文件

1
 import { useState, useEffect } from 'react'
1
 import { useState, useEffect } from 'react'
2
+import withLayout from '@/layout'
2
 import { ScrollView } from '@tarojs/components'
3
 import { ScrollView } from '@tarojs/components'
4
+import { fetch } from '@/utils/request'
5
+import { API_ITEMS_DETAIL } from '@/constants/api'
3
 import '@/assets/css/iconfont.css'
6
 import '@/assets/css/iconfont.css'
4
 import './index.scss'
7
 import './index.scss'
5
 
8
 
6
-export default (props) => {
9
+const formateDate = dt => dt ? dt.substring(0, 10) : undefined
7
 
10
 
8
-  const [InfoList, setInfoList] = useState([
11
+export default withLayout((props) => {
12
+  const { router } = props
13
+  const { id } = router.params
14
+
15
+  const [Info, setInfo] = useState({})
16
+
17
+  const InfoList = [
9
     [
18
     [
10
-      { name: '项目名称', value: '葛洲坝·南京中国府', key: '' },
11
-      { name: '开发商', value: '暂无', key: '' },
12
-      { name: '均价', value: '待定', key: '' },
13
-      { name: '销售状态', value: '待定', key: '' },
14
-      { name: '开盘日期', value: '2019-08-05', key: '' },
15
-      { name: '楼盘地址', value: '南京建邺区友谊街交汇处南京建邺区友谊街交汇处', key: '' },
19
+      { name: '项目名称', value: Info.buildingName, key: '' },
20
+      { name: '开发商', value: Info.brandName || Info.serviceCompany || '暂无', key: '' },
21
+      { name: '均价', value: Info.price || '待定', key: '' },
22
+      { name: '销售状态', value: Info.marketStatus || '待定', key: '' },
23
+      { name: '开盘日期', value: formateDate(Info.openingDate) || '待定', key: '' },
24
+      { name: '楼盘地址', value: Info.address || '暂无', key: '' },
16
     ],
25
     ],
17
     [
26
     [
18
-      { name: '装修标准', value: '精装', key: '' },
19
-      { name: '物业公司', value: '葛洲坝物业', key: '' },
20
-      { name: '物业费', value: '2.0元/㎡/月', key: '' },
27
+      { name: '装修标准', value: Info.decoration || '暂无', key: '' },
28
+      { name: '物业公司', value: Info.propertyDeveloper || '暂无', key: '' },
29
+      { name: '物业费', value: Info.serviceFee || '暂无', key: '' },
21
     ],
30
     ],
22
     [
31
     [
23
-      { name: '容积率', value: '2.75', key: '' },
24
-      { name: '供水', value: '民水', key: '' },
25
-      { name: '供电', value: '民电', key: '' },
26
-      { name: '供暖方式', value: '自采暖', key: '' },
27
-      { name: '人车分流', value: '-', key: '' },
28
-      { name: '车位数量', value: '约1000', key: '' },
29
-      { name: '规划户数', value: '300', key: '' },
30
-      { name: '楼栋总数', value: '25', key: '' },
31
-      { name: '绿化率', value: '35.31%', key: '' },
32
-      { name: '项目说明', value: '南京建邺区友谊街交汇处南京建邺区友谊街交汇处', key: '' },
33
-      { name: '备案名', value: '暂无', key: '' },
32
+      { name: '容积率', value: Info.volumeRate || '暂无', key: '' },
33
+      { name: '供水', value: Info.waterSupply || '暂无', key: '' },
34
+      { name: '供电', value: Info.powerSupply || '暂无', key: '' },
35
+      { name: '供暖方式', value: Info.heatingSupply || '暂无', key: '' },
36
+      { name: '车位数量', value: Info.parkingRate || '待定', key: '' },
37
+      { name: '规划户数', value: Info.familyNum || '待定', key: '' },
38
+      { name: '楼栋总数', value: Info.buildingNum || '待定', key: '' },
39
+      { name: '绿化率', value: Info.greeningRate || '待定', key: '' },
40
+      { name: '项目说明', value: Info.dynamic || '暂无', key: '' },
41
+      { name: '备案名', value: Info.recordName || '暂无', key: '' },
34
     ]
42
     ]
35
-  ])
43
+  ]
44
+
45
+  useEffect(() => {
46
+    // 获取楼盘信息
47
+    fetch({ url: `${API_ITEMS_DETAIL}/${id}`, spin: true }).then((res) => {
48
+      setInfo(res || {})
49
+    }).catch((err) => {
50
+      console.error(err)
51
+    })
52
+  }, [id])
36
 
53
 
37
   return (
54
   return (
38
     <view className='Page buildingInfo'>
55
     <view className='Page buildingInfo'>
58
       </ScrollView>
75
       </ScrollView>
59
     </view>
76
     </view>
60
   )
77
   )
61
-}
78
+})

+ 2
- 3
src/pages/index/buildingInfo/index.scss 查看文件

1
 .Page.buildingInfo {
1
 .Page.buildingInfo {
2
   background: #f8f8f8;
2
   background: #f8f8f8;
3
-  width: 90vw;
4
-  height: 90vh;
5
-  max-height: 90vh;
3
+  width: 100%;
4
+  height: 100%;
6
   > scroll-view {
5
   > scroll-view {
7
     width: 100%;
6
     width: 100%;
8
     height: 100%;
7
     height: 100%;

+ 1
- 1
src/reducers/system.js 查看文件

7
   orgInfo: {},
7
   orgInfo: {},
8
   userInfo: {},
8
   userInfo: {},
9
   settings: [],
9
   settings: [],
10
-  systemInfo: {}
10
+  systemInfo: {},
11
 };
11
 };
12
 
12
 
13
 export default function(state = INITIAL_STATE, action) {
13
 export default function(state = INITIAL_STATE, action) {

+ 8
- 1
src/reducers/user.js 查看文件

16
     extraInfo: {},
16
     extraInfo: {},
17
     miniApp: {},
17
     miniApp: {},
18
   },
18
   },
19
-  unRead: true
19
+  unRead: true,
20
+  spinning: false,
20
 }
21
 }
21
 
22
 
22
 export default function user(state = INITIAL_STATE, action) {
23
 export default function user(state = INITIAL_STATE, action) {
120
         unReadNum,
121
         unReadNum,
121
       }
122
       }
122
     }
123
     }
124
+    case 'SET_SPINNING': {
125
+      return {
126
+        ...state,
127
+        spinning: action.payload
128
+      };
129
+    }
123
     default:
130
     default:
124
       return state
131
       return state
125
   }
132
   }

+ 6
- 6
src/routes.js 查看文件

67
     pkg: 'main',
67
     pkg: 'main',
68
     type: 'building',
68
     type: 'building',
69
   },
69
   },
70
-  // {
71
-  //   name: '楼盘信息',
72
-  //   page: 'pages/index/buildingInfo/index',
73
-  //   pkg: 'main',
74
-  //   type: 'building',
75
-  // },
70
+  {
71
+    name: '楼盘信息',
72
+    page: 'pages/index/buildingInfo/index',
73
+    pkg: 'main',
74
+    type: 'building',
75
+  },
76
   {
76
   {
77
     name: '围观记录',
77
     name: '围观记录',
78
     page: 'pages/index/buildingViewsRecords/index',
78
     page: 'pages/index/buildingViewsRecords/index',

+ 7
- 7
src/utils/chatDate.js 查看文件

44
 export default function getDateFormat(timestamp, mustIncludeTime,format='yyyy-M-d') {
44
 export default function getDateFormat(timestamp, mustIncludeTime,format='yyyy-M-d') {
45
 
45
 
46
   // 当前时间
46
   // 当前时间
47
-  var currentDate = new Date();
47
+  // var currentDate = new Date();
48
   // 目标判断时间
48
   // 目标判断时间
49
   var srcDate = new Date(parseInt(timestamp));
49
   var srcDate = new Date(parseInt(timestamp));
50
 
50
 
51
-  var currentYear = currentDate.getFullYear();
52
-  var currentMonth = (currentDate.getMonth() + 1);
53
-  var currentDateD = currentDate.getDate();
51
+  // var currentYear = currentDate.getFullYear();
52
+  // var currentMonth = (currentDate.getMonth() + 1);
53
+  // var currentDateD = currentDate.getDate();
54
 
54
 
55
-  var srcYear = srcDate.getFullYear();
56
-  var srcMonth = (srcDate.getMonth() + 1);
57
-  var srcDateD = srcDate.getDate();
55
+  // var srcYear = srcDate.getFullYear();
56
+  // var srcMonth = (srcDate.getMonth() + 1);
57
+  // var srcDateD = srcDate.getDate();
58
 
58
 
59
   var ret = "";
59
   var ret = "";
60
 
60
 

+ 23
- 4
src/utils/request.js 查看文件

1
 import Taro from '@tarojs/taro'
1
 import Taro from '@tarojs/taro'
2
 import * as apis from '@/constants/api'
2
 import * as apis from '@/constants/api'
3
 // import login from '@/utils/login'
3
 // import login from '@/utils/login'
4
+import store from '@/store'
4
 import rtLog from './rtLog'
5
 import rtLog from './rtLog'
5
 
6
 
6
 const CODE_SUCCESS = 1000
7
 const CODE_SUCCESS = 1000
8
 const CODE_AUTH_EXPIRED = 1002
9
 const CODE_AUTH_EXPIRED = 1002
9
 const accountInfo = wx.getAccountInfoSync();
10
 const accountInfo = wx.getAccountInfoSync();
10
 const appId = accountInfo.miniProgram.appId
11
 const appId = accountInfo.miniProgram.appId
12
+const { dispatch } = store
13
+const updateSpin = spinning => dispatch({ type: 'SET_SPINNING', payload: spinning })
11
 
14
 
12
 export { apis };
15
 export { apis };
13
 
16
 
27
 export const fetch = async (options) => {
30
 export const fetch = async (options) => {
28
   const opts = optionBuilder(options)
31
   const opts = optionBuilder(options)
29
 
32
 
33
+  const { spin } = opts[1]
34
+
35
+  if (spin) {
36
+    updateSpin(true)
37
+  }
30
   return Taro.request(opts[0])
38
   return Taro.request(opts[0])
31
-    .then((res) => reqSuccess(res, opts))
32
-    .catch((err) => reqFail(err, opts))
39
+    .then((res) => {
40
+      if (spin) {
41
+        updateSpin(false)
42
+      }
43
+      return reqSuccess(res, opts)
44
+    })
45
+    .catch((err) => {
46
+      if (spin) {
47
+        updateSpin(false)
48
+      }
49
+      return reqFail(err, opts)
50
+    })
33
 }
51
 }
34
 
52
 
35
 export const uploadFiles = async (files) => {
53
 export const uploadFiles = async (files) => {
67
 }
85
 }
68
 
86
 
69
 export function optionBuilder(options) {
87
 export function optionBuilder(options) {
70
-  const { url, params = {}, payload = {}, method = 'GET', showToast = true, autoLogin = true, header } = options
88
+  const { url, params = {}, payload = {}, method = 'GET', showToast = true, autoLogin = true, header, spin = false } = options
71
   const showMessage = Object.prototype.hasOwnProperty.call(payload, 'showToast') ? payload.showToast : showToast
89
   const showMessage = Object.prototype.hasOwnProperty.call(payload, 'showToast') ? payload.showToast : showToast
72
   const consultant = Taro.getStorageSync('consultantId') || ''
90
   const consultant = Taro.getStorageSync('consultantId') || ''
73
   const recommender = Taro.getStorageSync('recommender') || ''
91
   const recommender = Taro.getStorageSync('recommender') || ''
92
     },
110
     },
93
     {
111
     {
94
       showMessage,
112
       showMessage,
95
-      autoLogin
113
+      autoLogin,
114
+      spin,
96
     }
115
     }
97
   ]
116
   ]
98
 }
117
 }