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

+ 10
- 0
src/app.js View File

@@ -1,8 +1,12 @@
1 1
 import { Component } from 'react'
2 2
 import Taro from '@tarojs/taro'
3 3
 import { login } from '@/services/login'
4
+
5
+import store from './store'
6
+
4 7
 import './app.less'
5 8
 
9
+
6 10
 class App extends Component {
7 11
 
8 12
   componentDidMount () { }
@@ -14,6 +18,12 @@ class App extends Component {
14 18
       success: (res) => {
15 19
         const { code } = res;
16 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,7 +6,6 @@ import CustomNav from "@/components/CustomNav"
6 6
 import ButtontWX from "@/components/ButtontWX"
7 7
 import decorate from "@/assets/icons/comm/decorate.png"
8 8
 import addresss from '@/assets/mineImgaes/addresss.png'//地址
9
-
10 9
 import './style.less'
11 10
 
12 11
 

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

@@ -2,6 +2,7 @@ import { View, Text } from "@tarojs/components"
2 2
 import { useState } from "react"
3 3
 import CustomNav from '@/components/CustomNav'
4 4
 import ButtontWX from '@/components/ButtontWX'
5
+import store from "@/store"
5 6
 // import BottomMoadl from '@/components/BottomMoadl/index'
6 7
 
7 8
 
@@ -18,6 +19,10 @@ export default (props) => {
18 19
   //   setShowFrame(!showFrame)
19 20
   // }
20 21
 
22
+  const pay = () => {
23
+
24
+  }
25
+
21 26
 
22 27
   return (
23 28
     <View className='page-index'>
@@ -37,7 +42,7 @@ export default (props) => {
37 42
         </View>
38 43
       </View>
39 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 46
       </View>
42 47
     </View>
43 48
   )

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

@@ -7,6 +7,8 @@ import searchs from '@/assets/homesImgaes/searchs.png'//搜索图片
7 7
 import carsListImga from '@/assets/homesImgaes/carsListImga.png'//农机列表图片
8 8
 
9 9
 
10
+import store from '@/store'
11
+
10 12
 import './HomesCss/style.less'
11 13
 
12 14
 export default (props) => {
@@ -35,7 +37,19 @@ export default (props) => {
35 37
   }
36 38
 
37 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 55
   const startReserve = () => {

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

@@ -9,6 +9,7 @@ import feedbacks from '@/assets/mineImgaes/feedbacks.png'//意见反馈
9 9
 import helpCenter from '@/assets/mineImgaes/helpCenter.png'//帮助中心
10 10
 import versionUpdate from '@/assets/mineImgaes/versionUpdate.png'//版本更新
11 11
 import userRight from '@/assets/mineImgaes/userRight.png'//版本更新
12
+import store from "@/store"
12 13
 import './MineCss/style.less'
13 14
 
14 15
 
@@ -28,8 +29,12 @@ export default (props) => {
28 29
   }
29 30
 
30 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 38
     // setIsLoginBox(true)
34 39
   }
35 40
   const goToPages = (res) => {

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

@@ -0,0 +1,8 @@
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

@@ -0,0 +1,43 @@
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