张延森 преди 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,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/",

+ 1
- 4
src/app.js Целия файл

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

+ 9
- 9
src/pages/index/index.jsx Целия файл

@@ -17,22 +17,23 @@ const index = (props) => {
17 17
   const { houseId ,orderId} = router.params
18 18
   const user = useSelector(state => state.user)
19 19
 
20
+  console.log(user)
21
+
20 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 27
   const [visible, setVisible] = useState(false)
26 28
 
27 29
   useEffect(() => {
28
-    console.log(user,houseId, 'indexuser')
29 30
     if (user.personId && !user.phone) {
30 31
       setVisible(true)
31 32
     }
32 33
     if (user.personId && user.phone) {
33 34
       setVisible(false)
34 35
     }
35
-  }, [user.phone])
36
+  }, [user.phone, user.personId])
36 37
 
37 38
 
38 39
   const onOk = (res) => {
@@ -44,14 +45,13 @@ const index = (props) => {
44 45
   const onCancel = (e) => {
45 46
     setVisible(false)
46 47
   }
47
-  console.log(user.role == roleList.landlord, 'indexuser')
48 48
 
49 49
   return <View className='index'>
50 50
 
51 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 55
     </View>}
56 56
 
57 57
 

+ 3
- 8
src/reducers/user.js Целия файл

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

+ 1
- 1
src/util/request.js Целия файл

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

+ 13969
- 0
yarn.lock
Файловите разлики са ограничени, защото са твърде много
Целия файл