Browse Source

Merge branch 'master' of http://git.ycjcjy.com/shigongli/client-miniapp into master

zlisen 4 years ago
parent
commit
ad974cea3f
3 changed files with 52 additions and 9 deletions
  1. 16
    0
      src/compents/Loading/index.jsx
  2. 17
    0
      src/compents/Loading/style.scss
  3. 19
    9
      src/pages/share/index.jsx

+ 16
- 0
src/compents/Loading/index.jsx View File

1
+import React from 'react'
2
+import { View } from '@tarojs/components'
3
+import './style.scss'
4
+
5
+export default props => {
6
+
7
+  const loadingStyle = {
8
+    width: props.size || '64px',
9
+    height: props.size || '64px',
10
+    borderTopColor: props.color || '#fed12f'
11
+  }
12
+
13
+  return (
14
+    <View className="cust-loading" style={loadingStyle}></View>
15
+  )
16
+}

+ 17
- 0
src/compents/Loading/style.scss View File

1
+
2
+.cust-loading {
3
+  display: inline-block;
4
+  border: 3px solid #f3f3f3;
5
+  border-top: 3px solid #fed12f;
6
+  border-radius: 50%;
7
+  animation: loading-360 1s infinite linear;
8
+}
9
+
10
+@keyframes loading-360 {
11
+  0% {
12
+      transform: rotate(0deg); /*动画起始的时候旋转了0度*/
13
+  }
14
+  100% {
15
+      transform: rotate(360deg); /*动画结束的时候旋转了360度*/
16
+  }
17
+}

+ 19
- 9
src/pages/share/index.jsx View File

1
 import React, { useEffect, useState } from 'react'
1
 import React, { useEffect, useState } from 'react'
2
 import Taro, { useShareAppMessage, useRouter } from "@tarojs/taro";
2
 import Taro, { useShareAppMessage, useRouter } from "@tarojs/taro";
3
-import { View, Input, Text, Picker, Button } from '@tarojs/components'
4
-import { AtModal, AtModalHeader, AtModalAction } from "taro-ui"
3
+import { useSelector, } from 'react-redux'
4
+import { View, Input, Text, Image, Picker, Button } from '@tarojs/components'
5
+import { AtModal, AtModalHeader, AtModalContent, AtModalAction } from "taro-ui"
6
+import Loading from '@/compents/Loading'
5
 import Layout from '../../layout/index'
7
 import Layout from '../../layout/index'
6
 import Tab from '../../compents/tab/index'
8
 import Tab from '../../compents/tab/index'
7
 import Container from '../../compents/container/index'
9
 import Container from '../../compents/container/index'
36
         // eslint-disable-next-line react-hooks/exhaustive-deps
38
         // eslint-disable-next-line react-hooks/exhaustive-deps
37
     }, [])
39
     }, [])
38
 
40
 
41
+    const [showShareLoading, setShowShareLoading] = useState(false)
42
+    
39
     const onTimeChange = (e) => {
43
     const onTimeChange = (e) => {
40
         setStartTime(e.detail.value)
44
         setStartTime(e.detail.value)
41
     }
45
     }
48
             startDate: startTime,
52
             startDate: startTime,
49
             endDate: endTime
53
             endDate: endTime
50
         }
54
         }
51
-
52
-        Taro.showLoading({
53
-            title: '正在生成分享内容,请稍后...'
54
-        })
55
+        
56
+        setShowShareLoading(true)
55
 
57
 
56
         return request({ url: '/taHouseSetting', method: 'post', data }).then(res => {
58
         return request({ url: '/taHouseSetting', method: 'post', data }).then(res => {
57
             const { data } = res.data
59
             const { data } = res.data
67
                     }
69
                     }
68
 
70
 
69
                     setShareObj(share)
71
                     setShareObj(share)
70
-                    Taro.hideLoading()
72
+                    setShowShareLoading(false)
71
                     setShowShareModal(true)
73
                     setShowShareModal(true)
72
                 })
74
                 })
73
             } else {
75
             } else {
74
-                Taro.hideLoading()
76
+                setShowShareLoading(false)
75
                 Taro.showModal({
77
                 Taro.showModal({
76
                     title: '输入信息有误',
78
                     title: '输入信息有误',
77
                     content: '请重新输入',
79
                     content: '请重新输入',
127
             </View>
129
             </View>
128
         </Layout>
130
         </Layout>
129
         <Tab className='addhousetab' color='#ffffff' pageState='3' onClick={handleShareReady} value={['分享到微信']} ></Tab>
131
         <Tab className='addhousetab' color='#ffffff' pageState='3' onClick={handleShareReady} value={['分享到微信']} ></Tab>
132
+        <AtModal isOpened={showShareLoading} closeOnClickOverlay={false}>
133
+            <AtModalContent>
134
+                <View style={{textAlign: 'center'}}>
135
+                    <Loading size='48px' />
136
+                </View>
137
+                <View style={{marginTop: '2em', textAlign: 'center'}}>正在生成分享内容, 请稍后...</View>
138
+            </AtModalContent>
139
+        </AtModal>
130
         <AtModal isOpened={showShareModal}>
140
         <AtModal isOpened={showShareModal}>
131
             <AtModalHeader>分享到微信</AtModalHeader>
141
             <AtModalHeader>分享到微信</AtModalHeader>
132
             <AtModalAction>
142
             <AtModalAction>
133
                 <Button onClick={() => setShowShareModal(false)}>取消</Button>
143
                 <Button onClick={() => setShowShareModal(false)}>取消</Button>
134
-                <Button open-type="share" onClick={() => setShowShareModal(false)}>确定</Button>
144
+                <Button open-type='share' onClick={() => setShowShareModal(false)}>确定</Button>
135
             </AtModalAction>
145
             </AtModalAction>
136
         </AtModal>
146
         </AtModal>
137
     </View>
147
     </View>