鲍张超 3 years ago
parent
commit
b332aecbca

+ 20623
- 29
package-lock.json
File diff suppressed because it is too large
View File


+ 7
- 5
package.json View File

42
     "@tarojs/taro": "3.3.6",
42
     "@tarojs/taro": "3.3.6",
43
     "react": "^17.0.0",
43
     "react": "^17.0.0",
44
     "react-dom": "^17.0.0",
44
     "react-dom": "^17.0.0",
45
+    "react-redux": "^7.2.6",
46
+    "redux": "^4.1.2",
45
     "weui-miniprogram": "^1.2.3"
47
     "weui-miniprogram": "^1.2.3"
46
   },
48
   },
47
   "devDependencies": {
49
   "devDependencies": {
48
-    "@types/webpack-env": "^1.13.6",
49
-    "@types/react": "^17.0.2",
50
-    "@tarojs/mini-runner": "3.3.6",
51
     "@babel/core": "^7.8.0",
50
     "@babel/core": "^7.8.0",
51
+    "@tarojs/mini-runner": "3.3.6",
52
     "@tarojs/webpack-runner": "3.3.6",
52
     "@tarojs/webpack-runner": "3.3.6",
53
+    "@types/react": "^17.0.2",
54
+    "@types/webpack-env": "^1.13.6",
53
     "babel-preset-taro": "3.3.6",
55
     "babel-preset-taro": "3.3.6",
54
-    "eslint-config-taro": "3.3.6",
55
     "eslint": "^6.8.0",
56
     "eslint": "^6.8.0",
56
-    "eslint-plugin-react": "^7.8.2",
57
+    "eslint-config-taro": "3.3.6",
57
     "eslint-plugin-import": "^2.12.0",
58
     "eslint-plugin-import": "^2.12.0",
59
+    "eslint-plugin-react": "^7.8.2",
58
     "eslint-plugin-react-hooks": "^4.2.0",
60
     "eslint-plugin-react-hooks": "^4.2.0",
59
     "stylelint": "9.3.0"
61
     "stylelint": "9.3.0"
60
   }
62
   }

+ 10
- 0
src/app.js View File

1
 import { Component } from 'react'
1
 import { Component } from 'react'
2
 import Taro from '@tarojs/taro'
2
 import Taro from '@tarojs/taro'
3
 import { login } from '@/services/login'
3
 import { login } from '@/services/login'
4
+
5
+import store from './store'
6
+
4
 import './app.less'
7
 import './app.less'
5
 
8
 
9
+
6
 class App extends Component {
10
 class App extends Component {
7
 
11
 
8
   componentDidMount () { }
12
   componentDidMount () { }
14
       success: (res) => {
18
       success: (res) => {
15
         const { code } = res;
19
         const { code } = res;
16
         // login({ code })
20
         // login({ code })
21
+
22
+
23
+        const action = { type: "SET_VISIBILITY_FILTER", state: { cookis: 'a1sd54a5wd654s' } }
24
+        store.dispatch(action)
25
+
26
+        console.log(store.getState());
17
       }
27
       }
18
     })
28
     })
19
 
29
 

+ 0
- 1
src/pages/CheckDetails/index.jsx View File

6
 import ButtontWX from "@/components/ButtontWX"
6
 import ButtontWX from "@/components/ButtontWX"
7
 import decorate from "@/assets/icons/comm/decorate.png"
7
 import decorate from "@/assets/icons/comm/decorate.png"
8
 import addresss from '@/assets/mineImgaes/addresss.png'//地址
8
 import addresss from '@/assets/mineImgaes/addresss.png'//地址
9
-
10
 import './style.less'
9
 import './style.less'
11
 
10
 
12
 
11
 

+ 6
- 1
src/pages/OrderInfo/index.jsx View File

2
 import { useState } from "react"
2
 import { useState } from "react"
3
 import CustomNav from '@/components/CustomNav'
3
 import CustomNav from '@/components/CustomNav'
4
 import ButtontWX from '@/components/ButtontWX'
4
 import ButtontWX from '@/components/ButtontWX'
5
+import store from "@/store"
5
 // import BottomMoadl from '@/components/BottomMoadl/index'
6
 // import BottomMoadl from '@/components/BottomMoadl/index'
6
 
7
 
7
 
8
 
18
   //   setShowFrame(!showFrame)
19
   //   setShowFrame(!showFrame)
19
   // }
20
   // }
20
 
21
 
22
+  const pay = () => {
23
+
24
+  }
25
+
21
 
26
 
22
   return (
27
   return (
23
     <View className='page-index'>
28
     <View className='page-index'>
37
         </View>
42
         </View>
38
       </View>
43
       </View>
39
       <View className='BottomtBut' >
44
       <View className='BottomtBut' >
40
-        <ButtontWX butText='支付' butWidth={345} butHeight={49} butFontSize={16} butBorderRadius={49} />
45
+        <ButtontWX butText='支付' onClick={pay} butWidth={345} butHeight={49} butFontSize={16} butBorderRadius={49} />
41
       </View>
46
       </View>
42
     </View>
47
     </View>
43
   )
48
   )

+ 15
- 1
src/pages/index/tabs/Homes.jsx View File

7
 import carsListImga from '@/assets/homesImgaes/carsListImga.png'//农机列表图片
7
 import carsListImga from '@/assets/homesImgaes/carsListImga.png'//农机列表图片
8
 
8
 
9
 
9
 
10
+import store from '@/store'
11
+
10
 import './HomesCss/style.less'
12
 import './HomesCss/style.less'
11
 
13
 
12
 export default (props) => {
14
 export default (props) => {
35
   }
37
   }
36
 
38
 
37
   const goToCarsList = () => {//更多
39
   const goToCarsList = () => {//更多
38
-    Taro.navigateTo({ url: '/pages/MoreCars/index' })
40
+    let value = store.getState()
41
+    console.log('value-Home里面取值', store.getState());
42
+    if (value.appid == '') {
43
+      Taro.showToast({
44
+        title: '成功',
45
+        icon: 'success',
46
+        duration: 2000
47
+      })
48
+    } else {
49
+      Taro.navigateTo({ url: '/pages/MoreCars/index' })
50
+
51
+    }
52
+
39
   }
53
   }
40
 
54
 
41
   const startReserve = () => {
55
   const startReserve = () => {

+ 6
- 1
src/pages/index/tabs/Mine.jsx View File

9
 import helpCenter from '@/assets/mineImgaes/helpCenter.png'//帮助中心
9
 import helpCenter from '@/assets/mineImgaes/helpCenter.png'//帮助中心
10
 import versionUpdate from '@/assets/mineImgaes/versionUpdate.png'//版本更新
10
 import versionUpdate from '@/assets/mineImgaes/versionUpdate.png'//版本更新
11
 import userRight from '@/assets/mineImgaes/userRight.png'//版本更新
11
 import userRight from '@/assets/mineImgaes/userRight.png'//版本更新
12
+import store from "@/store"
12
 import './MineCss/style.less'
13
 import './MineCss/style.less'
13
 
14
 
14
 
15
 
28
   }
29
   }
29
 
30
 
30
   const userLoginnow = () => {
31
   const userLoginnow = () => {
32
+    const action = { type: "SET_VISIBILITY_FILTER", state: { appid: '55555555555' } }
33
+    store.dispatch(action)
34
+    console.log(store.getState());
31
 
35
 
32
-    Taro.navigateTo({ url: `/pages/UserLogin/index?id` })
36
+
37
+    // Taro.navigateTo({ url: `/pages/UserLogin/index?id` })
33
     // setIsLoginBox(true)
38
     // setIsLoginBox(true)
34
   }
39
   }
35
   const goToPages = (res) => {
40
   const goToPages = (res) => {

+ 8
- 0
src/store/index.js View File

1
+import { createStore } from 'redux'
2
+import reducer from './reducers'
3
+
4
+
5
+const store = createStore(reducer) // 创建数据存储仓库
6
+
7
+
8
+export default store   

+ 43
- 0
src/store/reducers.js View File

1
+const defaultState = {
2
+  appid: '',
3
+  cookis: ''
4
+}
5
+console.log(defaultState, 'defaultState');
6
+
7
+
8
+function todoApp (state = defaultState, action) {
9
+  state = JSON.parse(JSON.stringify(state)) //深度
10
+  switch (action.type) {
11
+    case 'SET_VISIBILITY_FILTER':
12
+      state = {
13
+        ...defaultState,
14
+        ...action.state
15
+      }
16
+      return state;
17
+    default:
18
+      return state;
19
+
20
+
21
+
22
+  }
23
+}
24
+
25
+
26
+// function fn (state = defaultState, action) {
27
+//   state = JSON.parse(JSON.stringify(state)) //深度
28
+
29
+//   switch (action.type) {
30
+//     case "setVisibilityFilter":
31
+//       state = {
32
+//         ...defaultState,
33
+//         ...action.state
34
+//       }
35
+//       return state;
36
+//     default:
37
+//       return state;
38
+//   }
39
+
40
+// }
41
+
42
+const state = todoApp
43
+export default state

+ 1521
- 1532
yarn.lock
File diff suppressed because it is too large
View File