zlisen 4 年前
父节点
当前提交
cff432ee24
共有 2 个文件被更改,包括 23 次插入23 次删除
  1. 2
    2
      config/dev.js
  2. 21
    21
      src/pages/share/index.jsx

+ 2
- 2
config/dev.js 查看文件

@@ -4,9 +4,9 @@ module.exports = {
4 4
     NODE_ENV: '"development"'
5 5
   },
6 6
   defineConstants: {
7
-    HOST: '"http://localhost:7080"',
7
+    // HOST: '"http://localhost:7080"',
8 8
     // HOST: '"https://sgl.ycjcjy.com"',
9
-    // HOST: '"http://192.168.31.68:7080"',
9
+    HOST: '"http://192.168.31.68:7080"',
10 10
     // HOST: '"http://192.168.211.181:7080"',
11 11
  
12 12
     // OSS_PATH: "https://njcj.oss-cn-shanghai.aliyuncs.com/",

+ 21
- 21
src/pages/share/index.jsx 查看文件

@@ -1,12 +1,10 @@
1
-import React, { useEffect, useMemo, useState } from 'react'
1
+import React, { useEffect, useState } from 'react'
2 2
 import Taro, { useShareAppMessage, useRouter } from "@tarojs/taro";
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"
3
+import { View, Input, Text, Picker, Button } from '@tarojs/components'
4
+import { AtModal, AtModalHeader, AtModalAction } from "taro-ui"
6 5
 import Layout from '../../layout/index'
7 6
 import Tab from '../../compents/tab/index'
8 7
 import Container from '../../compents/container/index'
9
-import locationicon from '../../assets/locationicon.png'
10 8
 import './index.scss'
11 9
 import request from '../../util/request';
12 10
 
@@ -17,38 +15,40 @@ import request from '../../util/request';
17 15
 //     }
18 16
 // })
19 17
 
20
-const index = (props) => {
21
-
22
-
23
-
18
+const Index = () => {
24 19
     const router = useRouter()
25
-
26 20
     const { houseId } = router.params
27
-
28
-    const user = useSelector(state => state.user)
29
-
30
-    const [userRole, setUserRole] = useState('1')
31
-    const [pageState, setPageState] = useState('1')
32
-    const [list, setList] = useState([])
33 21
     const [personNum, setPersonNum] = useState()
34 22
     const [startTime, setStartTime] = useState('')
35 23
     const [endTime, setEndTime] = useState('')
24
+    // const [data,setData] = useState({})
36 25
     const [shareObj, setShareObj] = useState()
37 26
     const [showShareModal, setShowShareModal] = useState(false)
38
-    
27
+
28
+    useEffect(() => {
29
+        request({ url: "/taHouseSetting/last", params: { houseId } }).then((res) => {
30
+            if (res.data.data) {
31
+                setPersonNum(res.data.data.personNum)
32
+                setStartTime(res.data.data.startDate)
33
+                setEndTime(res.data.data.endDate)
34
+            }
35
+        })
36
+        // eslint-disable-next-line react-hooks/exhaustive-deps
37
+    }, [])
38
+
39 39
     const onTimeChange = (e) => {
40 40
         setStartTime(e.detail.value)
41 41
     }
42 42
 
43 43
     const handleShareReady = () => {
44
-        
44
+
45 45
         const data = {
46 46
             houseId,
47 47
             personNum,
48 48
             startDate: startTime,
49 49
             endDate: endTime
50 50
         }
51
-        
51
+
52 52
         Taro.showLoading({
53 53
             title: '正在生成分享内容,请稍后...'
54 54
         })
@@ -90,7 +90,7 @@ const index = (props) => {
90 90
 
91 91
     }
92 92
 
93
-    useShareAppMessage(() => {   
93
+    useShareAppMessage(() => {
94 94
         return shareObj
95 95
     })
96 96
 
@@ -137,4 +137,4 @@ const index = (props) => {
137 137
     </View>
138 138
 }
139 139
 
140
-export default index
140
+export default Index