ソースを参照

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

zlisen 4 年 前
コミット
febae6e3bd
共有5 個のファイルを変更した13983 個の追加22 個の削除を含む
  1. 1
    4
      src/app.js
  2. 9
    9
      src/pages/index/index.jsx
  3. 3
    8
      src/reducers/user.js
  4. 1
    1
      src/util/request.js
  5. 13969
    0
      yarn.lock

+ 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
ファイル差分が大きすぎるため省略します
ファイルの表示