瀏覽代碼

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

zlisen 4 年之前
父節點
當前提交
ad974cea3f
共有 3 個文件被更改,包括 52 次插入9 次删除
  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 查看文件

@@ -0,0 +1,16 @@
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 查看文件

@@ -0,0 +1,17 @@
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 查看文件

@@ -1,7 +1,9 @@
1 1
 import React, { useEffect, useState } from 'react'
2 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 7
 import Layout from '../../layout/index'
6 8
 import Tab from '../../compents/tab/index'
7 9
 import Container from '../../compents/container/index'
@@ -36,6 +38,8 @@ const Index = () => {
36 38
         // eslint-disable-next-line react-hooks/exhaustive-deps
37 39
     }, [])
38 40
 
41
+    const [showShareLoading, setShowShareLoading] = useState(false)
42
+    
39 43
     const onTimeChange = (e) => {
40 44
         setStartTime(e.detail.value)
41 45
     }
@@ -48,10 +52,8 @@ const Index = () => {
48 52
             startDate: startTime,
49 53
             endDate: endTime
50 54
         }
51
-
52
-        Taro.showLoading({
53
-            title: '正在生成分享内容,请稍后...'
54
-        })
55
+        
56
+        setShowShareLoading(true)
55 57
 
56 58
         return request({ url: '/taHouseSetting', method: 'post', data }).then(res => {
57 59
             const { data } = res.data
@@ -67,11 +69,11 @@ const Index = () => {
67 69
                     }
68 70
 
69 71
                     setShareObj(share)
70
-                    Taro.hideLoading()
72
+                    setShowShareLoading(false)
71 73
                     setShowShareModal(true)
72 74
                 })
73 75
             } else {
74
-                Taro.hideLoading()
76
+                setShowShareLoading(false)
75 77
                 Taro.showModal({
76 78
                     title: '输入信息有误',
77 79
                     content: '请重新输入',
@@ -127,11 +129,19 @@ const Index = () => {
127 129
             </View>
128 130
         </Layout>
129 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 140
         <AtModal isOpened={showShareModal}>
131 141
             <AtModalHeader>分享到微信</AtModalHeader>
132 142
             <AtModalAction>
133 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 145
             </AtModalAction>
136 146
         </AtModal>
137 147
     </View>