张延森 4 年前
父节点
当前提交
56f860e6b5
共有 6 个文件被更改,包括 13985 次插入24 次删除
  1. 2
    2
      config/dev.js
  2. 1
    4
      src/app.js
  3. 9
    9
      src/pages/index/index.jsx
  4. 3
    8
      src/reducers/user.js
  5. 1
    1
      src/util/request.js
  6. 13969
    0
      yarn.lock

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

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

+ 1
- 4
src/app.js 查看文件

16
 const store = configStore()
16
 const store = configStore()
17
 
17
 
18
 class App extends Component {
18
 class App extends Component {
19
-  componentDidMount() {
20
-console.log(this.props,'this.props')
21
-   
22
-  }
19
+  componentDidMount() {}
23
 
20
 
24
   onLaunch () {
21
   onLaunch () {
25
     wx.login({
22
     wx.login({

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

17
   const { houseId ,orderId} = router.params
17
   const { houseId ,orderId} = router.params
18
   const user = useSelector(state => state.user)
18
   const user = useSelector(state => state.user)
19
 
19
 
20
+  console.log(user)
21
+
20
   const dispatch = useDispatch()
22
   const dispatch = useDispatch()
21
 
23
 
22
-  const [userRole, setUserRole] = useState('1')
23
-  const [pageState, SetPageState] = useState('1')
24
-  const [list, setList] = useState([])
24
+  // const [userRole, setUserRole] = useState('1')
25
+  // const [pageState, SetPageState] = useState('1')
26
+  // const [list, setList] = useState([])
25
   const [visible, setVisible] = useState(false)
27
   const [visible, setVisible] = useState(false)
26
 
28
 
27
   useEffect(() => {
29
   useEffect(() => {
28
-    console.log(user,houseId, 'indexuser')
29
     if (user.personId && !user.phone) {
30
     if (user.personId && !user.phone) {
30
       setVisible(true)
31
       setVisible(true)
31
     }
32
     }
32
     if (user.personId && user.phone) {
33
     if (user.personId && user.phone) {
33
       setVisible(false)
34
       setVisible(false)
34
     }
35
     }
35
-  }, [user.phone])
36
+  }, [user.phone, user.personId])
36
 
37
 
37
 
38
 
38
   const onOk = (res) => {
39
   const onOk = (res) => {
44
   const onCancel = (e) => {
45
   const onCancel = (e) => {
45
     setVisible(false)
46
     setVisible(false)
46
   }
47
   }
47
-  console.log(user.role == roleList.landlord, 'indexuser')
48
 
48
 
49
   return <View className='index'>
49
   return <View className='index'>
50
 
50
 
51
     {user.personId && <View>
51
     {user.personId && <View>
52
-      {visible && <GetPhone visible={true} onOk={onOk} onCancel={onCancel} ></GetPhone>}
53
-      {!visible && user.role == roleList.customer && <Customer houseId={houseId} orderId={orderId}></Customer>}
54
-      {!visible && user.role == roleList.landlord && <Landlord ></Landlord>}
52
+      <GetPhone visible={visible} onOk={onOk} onCancel={onCancel} ></GetPhone>
53
+      {user.role == roleList.customer && <Customer houseId={houseId} orderId={orderId}></Customer>}
54
+      {user.role == roleList.landlord && <Landlord ></Landlord>}
55
     </View>}
55
     </View>}
56
 
56
 
57
 
57
 

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

23
 
23
 
24
 // 异步的action
24
 // 异步的action
25
 export function asyncLogina() {
25
 export function asyncLogina() {
26
-  console.log('asyncLogin22')
27
   return dispatch => {
26
   return dispatch => {
28
     dispatch({
27
     dispatch({
29
       type: 'LOGIN',
28
       type: 'LOGIN',
34
 }
33
 }
35
 
34
 
36
 export default function user(state = INITIAL_STATE, action) {
35
 export default function user(state = INITIAL_STATE, action) {
37
-  console.log(state, 'state33')
38
   switch (action.type) {
36
   switch (action.type) {
39
     case 'LOGIN': {
37
     case 'LOGIN': {
40
 
38
 
41
-      if (action.user.shopKeeperList.length > 0) {
39
+      if (action.user.shopKeeperList && action.user.shopKeeperList.length) {
42
         return {
40
         return {
43
           ...state,
41
           ...state,
44
           ...action.user,
42
           ...action.user,
45
-          // role: 'landlord',
46
-          role: 'customer',
43
+          role: 'landlord',
44
+          // role: 'customer',
47
         }
45
         }
48
       } else {
46
       } else {
49
         return {
47
         return {
50
           ...state,
48
           ...state,
51
           ...action.user,
49
           ...action.user,
52
           role: 'customer',
50
           role: 'customer',
53
-      
54
-          
55
-          
56
         }
51
         }
57
       }
52
       }
58
 
53
 

+ 1
- 1
src/util/request.js 查看文件

39
   }
39
   }
40
   // user.user?.token||
40
   // user.user?.token||
41
   const token = Taro.getStorageSync('token')||''
41
   const token = Taro.getStorageSync('token')||''
42
-  console.log(token,'token')
42
+  // console.log(token,'token')
43
   return [{
43
   return [{
44
       url: `${baseURL}${api}`,
44
       url: `${baseURL}${api}`,
45
       method,
45
       method,

+ 13969
- 0
yarn.lock
文件差异内容过多而无法显示
查看文件