李志伟 3 years ago
parent
commit
b3a6bc7155
1 changed files with 4 additions and 10 deletions
  1. 4
    10
      src/subpackages/pages/marketing/sureVisit/index.jsx

+ 4
- 10
src/subpackages/pages/marketing/sureVisit/index.jsx View File

@@ -23,6 +23,7 @@ export default withLayout((props) => {
23 23
   const [imageUrl, setImageUrl] = useState()
24 24
   const [remark, setRemark] = useState()
25 25
   const [channelCustomerId, setChannelCustomerId] = useState(null)
26
+  const [imgLoading,setImgLoading]=useState(false)
26 27
 
27 28
   const openAlbum = (e) => {
28 29
     e.stopPropagation()
@@ -32,18 +33,11 @@ export default withLayout((props) => {
32 33
       // sizeType: ['original', 'compressed'],  //可选择原图或压缩后的图片
33 34
       sourceType: ['album', 'camera'], //可选择性开放访问相册、相机
34 35
       success: res => {
35
-        Taro.showLoading({
36
-          title: '加载中',
37
-        })
36
+        setImgLoading(true)
38 37
         uploadFiles(res.tempFilePaths).then(data => {
39 38
           setImageUrl(data[0])
40
-          Taro.hideLoading()
41
-        }).catch(() => {
42
-          Taro.hideLoading()
39
+          setImgLoading(false)
43 40
         })
44
-      },
45
-      complete: () => {
46
-        Taro.hideLoading()
47 41
       }
48 42
     })
49 43
   }
@@ -157,7 +151,7 @@ export default withLayout((props) => {
157 151
               {/* <view className='UploadImg'>
158 152
                 <text className='iconfont icon-xiangji centerLabel'></text>
159 153
               </view> */}
160
-              <Image src={imageUrl} className='UploadImg' onClick={openAlbum} mode="aspectFill"></Image>
154
+              <Image loading={imgLoading} src={imageUrl} className='UploadImg' onClick={openAlbum} mode="aspectFill"></Image>
161 155
             </view>
162 156
           </view>
163 157