소스 검색

style feature perf

[baozhangchao] 3 년 전
부모
커밋
1d238d83d7

+ 76
- 0
src/components/CarsListContent/index.jsx 파일 보기

@@ -0,0 +1,76 @@
1
+
2
+import { View, Swiper, Image, SwiperItem, Text, Input } from "@tarojs/components"
3
+import { useEffect, useState, useMemo } from "react"
4
+import Taro, { useReachBottom } from "@tarojs/taro"
5
+import ButtontWX from '@/components/ButtontWX'
6
+import addresss from '@/assets/mineImgaes/addresss.png'//地址
7
+
8
+import { getMachinery, } from "@/services/homes"
9
+
10
+
11
+import './style.less'
12
+
13
+export default (props) => {
14
+  const location = Taro.getStorageSync('location')
15
+  // const { carsList } = props
16
+
17
+  const [carsList, setCarsList] = useState([])
18
+
19
+
20
+  useEffect(() => {
21
+    getMachinery(location).then((e) => {
22
+      setCarsList(e.records)
23
+    })
24
+
25
+  }, [location])
26
+
27
+
28
+
29
+
30
+  const startReserve = () => {
31
+    Taro.navigateTo({ url: `/pages/OrderInfo/index?id${1}` })
32
+
33
+  }
34
+  const goCarsInfo = (res) => {
35
+    Taro.navigateTo({ url: `/pages/CheckDetails/index?id=${res}&location=${location}` })
36
+
37
+  }
38
+  const goMapInfo = (res) => {
39
+    Taro.navigateTo({ url: `/pages/CheckMap/index?mapId=${res + 111}` })
40
+
41
+  }
42
+
43
+
44
+  return (
45
+
46
+
47
+    <>
48
+      {
49
+        carsList.map((item, index) => {
50
+          return (
51
+            <View key={index} className='carsListImga-bottom-box'>
52
+              <Image src={item.thumb} onClick={() => goCarsInfo(item.machineryId)} />
53
+              <View className='carsListImga-bottom-box-flaxBox'>
54
+                <View className='carsListImga-bottom-box-flaxBox-liftText'>
55
+                  <View className='carsListImga-bottom-box-flaxBox-liftText-Titles'>{item.name}</View>
56
+                  <View className='carsListImga-bottom-box-flaxBox-liftText-price'>{item.price}/<Text>公顷</Text></View>
57
+                </View>
58
+                <View className='carsListImga-bottom-box-flaxBox-rightBut'>
59
+                  <ButtontWX onClick={startReserve} butText='预约' butWidth={80} butHeight={34} butFontSize={19} butBorderRadius={0} />
60
+                </View>
61
+              </View>
62
+              <View className='content-header-box-map' onClick={() => goMapInfo(item.machineryId)}>
63
+                <View className='content-header-box-map-liftCentent'>
64
+                  <Image src={addresss} />
65
+                  <View>距离当前位置公里</View>
66
+                </View>
67
+                <View className='content-header-box-map-rightCentent'>进入地图&gt;&gt;</View>
68
+              </View>
69
+            </View>
70
+          )
71
+        })
72
+      }
73
+
74
+    </>
75
+  )
76
+}

+ 75
- 0
src/components/CarsListContent/style.less 파일 보기

@@ -0,0 +1,75 @@
1
+.carsListImga-bottom-box {
2
+  margin: 30px auto 0 auto;
3
+  background: #f2f2f2;
4
+  width: 93vw;
5
+  > Image {
6
+    width: 100%;
7
+    margin: 0 auto;
8
+  }
9
+  &-flaxBox {
10
+    width: 94%;
11
+    display: flex;
12
+    align-items: center;
13
+    margin: 0 auto;
14
+    margin-top: 40px;
15
+    margin-bottom: 38px;
16
+    &-liftText {
17
+      width: 95%;
18
+
19
+      &-Titles {
20
+        width: 95%;
21
+
22
+        text-overflow: ellipsis; //显示...
23
+        white-space: nowrap; //不换行
24
+        overflow: hidden;
25
+        font-size: 36px;
26
+        font-weight: bold;
27
+        color: #222222;
28
+      }
29
+      &-price {
30
+        margin-top: 44px;
31
+        font-size: 44px;
32
+        font-weight: 800;
33
+        color: #666666;
34
+        background: linear-gradient(180deg, #fa7878 0%, #b61515 100%);
35
+        -webkit-background-clip: text;
36
+        -webkit-text-fill-color: transparent;
37
+        > Text {
38
+          font-size: 25px;
39
+        }
40
+      }
41
+    }
42
+    &-rightBut {
43
+      align-items: center;
44
+      margin: 0 auto;
45
+    }
46
+  }
47
+  .content-header-box-map {
48
+    width: 94%;
49
+
50
+    margin: 0 auto;
51
+    display: flex;
52
+    align-items: center;
53
+    justify-content: space-between;
54
+    padding-bottom: 60px;
55
+    &-liftCentent {
56
+      display: flex;
57
+      align-items: center;
58
+      > Image {
59
+        width: 22px;
60
+        height: 27px;
61
+      }
62
+      > View {
63
+        padding-left: 15px;
64
+        font-size: 30px;
65
+        font-weight: 800;
66
+        color: #222222;
67
+      }
68
+    }
69
+    &-rightCentent {
70
+      font-size: 30px;
71
+      font-weight: 500;
72
+      color: #666666;
73
+    }
74
+  }
75
+}

+ 148
- 0
src/components/tabs/index.js 파일 보기

@@ -0,0 +1,148 @@
1
+module.exports =
2
+/******/ (function(modules) { // webpackBootstrap
3
+/******/ 	// The module cache
4
+/******/ 	var installedModules = {};
5
+/******/
6
+/******/ 	// The require function
7
+/******/ 	function __webpack_require__(moduleId) {
8
+/******/
9
+/******/ 		// Check if module is in cache
10
+/******/ 		if(installedModules[moduleId]) {
11
+/******/ 			return installedModules[moduleId].exports;
12
+/******/ 		}
13
+/******/ 		// Create a new module (and put it into the cache)
14
+/******/ 		var module = installedModules[moduleId] = {
15
+/******/ 			i: moduleId,
16
+/******/ 			l: false,
17
+/******/ 			exports: {}
18
+/******/ 		};
19
+/******/
20
+/******/ 		// Execute the module function
21
+/******/ 		modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
22
+/******/
23
+/******/ 		// Flag the module as loaded
24
+/******/ 		module.l = true;
25
+/******/
26
+/******/ 		// Return the exports of the module
27
+/******/ 		return module.exports;
28
+/******/ 	}
29
+/******/
30
+/******/
31
+/******/ 	// expose the modules object (__webpack_modules__)
32
+/******/ 	__webpack_require__.m = modules;
33
+/******/
34
+/******/ 	// expose the module cache
35
+/******/ 	__webpack_require__.c = installedModules;
36
+/******/
37
+/******/ 	// define getter function for harmony exports
38
+/******/ 	__webpack_require__.d = function(exports, name, getter) {
39
+/******/ 		if(!__webpack_require__.o(exports, name)) {
40
+/******/ 			Object.defineProperty(exports, name, { enumerable: true, get: getter });
41
+/******/ 		}
42
+/******/ 	};
43
+/******/
44
+/******/ 	// define __esModule on exports
45
+/******/ 	__webpack_require__.r = function(exports) {
46
+/******/ 		if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
47
+/******/ 			Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
48
+/******/ 		}
49
+/******/ 		Object.defineProperty(exports, '__esModule', { value: true });
50
+/******/ 	};
51
+/******/
52
+/******/ 	// create a fake namespace object
53
+/******/ 	// mode & 1: value is a module id, require it
54
+/******/ 	// mode & 2: merge all properties of value into the ns
55
+/******/ 	// mode & 4: return value when already ns object
56
+/******/ 	// mode & 8|1: behave like require
57
+/******/ 	__webpack_require__.t = function(value, mode) {
58
+/******/ 		if(mode & 1) value = __webpack_require__(value);
59
+/******/ 		if(mode & 8) return value;
60
+/******/ 		if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;
61
+/******/ 		var ns = Object.create(null);
62
+/******/ 		__webpack_require__.r(ns);
63
+/******/ 		Object.defineProperty(ns, 'default', { enumerable: true, value: value });
64
+/******/ 		if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));
65
+/******/ 		return ns;
66
+/******/ 	};
67
+/******/
68
+/******/ 	// getDefaultExport function for compatibility with non-harmony modules
69
+/******/ 	__webpack_require__.n = function(module) {
70
+/******/ 		var getter = module && module.__esModule ?
71
+/******/ 			function getDefault() { return module['default']; } :
72
+/******/ 			function getModuleExports() { return module; };
73
+/******/ 		__webpack_require__.d(getter, 'a', getter);
74
+/******/ 		return getter;
75
+/******/ 	};
76
+/******/
77
+/******/ 	// Object.prototype.hasOwnProperty.call
78
+/******/ 	__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
79
+/******/
80
+/******/ 	// __webpack_public_path__
81
+/******/ 	__webpack_require__.p = "";
82
+/******/
83
+/******/
84
+/******/ 	// Load entry module and return exports
85
+/******/ 	return __webpack_require__(__webpack_require__.s = 5);
86
+/******/ })
87
+/************************************************************************/
88
+/******/ ({
89
+
90
+/***/ 5:
91
+/***/ (function(module, exports, __webpack_require__) {
92
+
93
+"use strict";
94
+
95
+
96
+Component({
97
+    options: {
98
+        addGlobalClass: true,
99
+        pureDataPattern: /^_/,
100
+        multipleSlots: true
101
+    },
102
+    properties: {
103
+        tabs: { type: Array, value: [] },
104
+        tabClass: { type: String, value: '' },
105
+        swiperClass: { type: String, value: '' },
106
+        activeClass: { type: String, value: '' },
107
+        tabUnderlineColor: { type: String, value: '#07c160' },
108
+        tabActiveTextColor: { type: String, value: '#000000' },
109
+        tabInactiveTextColor: { type: String, value: '#000000' },
110
+        tabBackgroundColor: { type: String, value: '#ffffff' },
111
+        activeTab: { type: Number, value: 0 },
112
+        swipeable: { type: Boolean, value: true },
113
+        animation: { type: Boolean, value: true },
114
+        duration: { type: Number, value: 500 }
115
+    },
116
+    data: {
117
+        currentView: 0
118
+    },
119
+    observers: {
120
+        activeTab: function activeTab(_activeTab) {
121
+            var len = this.data.tabs.length;
122
+            if (len === 0) return;
123
+            var currentView = _activeTab - 1;
124
+            if (currentView < 0) currentView = 0;
125
+            if (currentView > len - 1) currentView = len - 1;
126
+            this.setData({ currentView: currentView });
127
+        }
128
+    },
129
+    lifetimes: {
130
+        created: function created() {}
131
+    },
132
+    methods: {
133
+        handleTabClick: function handleTabClick(e) {
134
+            var index = e.currentTarget.dataset.index;
135
+            this.setData({ activeTab: index });
136
+            this.triggerEvent('tabclick', { index: index });
137
+        },
138
+        handleSwiperChange: function handleSwiperChange(e) {
139
+            var index = e.detail.current;
140
+            this.setData({ activeTab: index });
141
+            this.triggerEvent('change', { index: index });
142
+        }
143
+    }
144
+});
145
+
146
+/***/ })
147
+
148
+/******/ });

+ 4
- 0
src/components/tabs/index.json 파일 보기

@@ -0,0 +1,4 @@
1
+{
2
+    "component": true,
3
+    "usingComponents": {}
4
+}

+ 20
- 0
src/components/tabs/index.wxml 파일 보기

@@ -0,0 +1,20 @@
1
+<view class="weui-tabs">
2
+  <view class="weui-tabs-bar__wrp">
3
+    <scroll-view scroll-x scroll-into-view="item_{{currentView}}" scroll-with-animation="{{animation}}">
4
+      <view class="weui-tabs-bar__content">
5
+        <block wx:for="{{tabs}}" wx:key="title">
6
+          <view id="item_{{index}}" class="weui-tabs-bar__item" style="background-color: {{tabBackgroundColor}}; color: {{activeTab === index ? tabActiveTextColor : tabInactiveTextColor}};" bindtap="handleTabClick" data-index="{{index}}">
7
+            <view class="weui-tabs-bar__title {{tabClass}} {{activeTab === index ? activeClass : ''}}" style="border-bottom-color: {{activeTab === index ? tabUnderlineColor : 'transparent'}}">
8
+              <text class="">{{item.title}}</text>
9
+            </view>
10
+          </view>
11
+        </block>
12
+      </view>
13
+    </scroll-view>
14
+  </view>
15
+  <swiper class="{{swiperClass}}" current="{{activeTab}}" duration="{{duration}}" bindchange="handleSwiperChange">
16
+    <swiper-item wx:for="{{tabs}}" wx:key="title">
17
+      <slot name="tab-content-{{index}}"></slot>
18
+    </swiper-item>
19
+  </swiper>
20
+</view>

+ 20
- 0
src/components/tabs/index.wxss 파일 보기

@@ -0,0 +1,20 @@
1
+.weui-tabs {
2
+  width: 100%;
3
+}
4
+.weui-tabs-bar__wrp {
5
+  width: 100%;
6
+  background: #fff;
7
+}
8
+.weui-tabs-bar__content {
9
+  width: 100%;
10
+  white-space: nowrap;
11
+}
12
+.weui-tabs-bar__item {
13
+  display: inline-block;
14
+}
15
+.weui-tabs-bar__title {
16
+  display: inline-block;
17
+  border-bottom-width: 2px;
18
+  border-bottom-style: solid;
19
+  border-bottom-color: transparent;
20
+}

+ 15
- 0
src/pages/CheckDetails/TextContent.jsx 파일 보기

@@ -0,0 +1,15 @@
1
+import { Image } from "@tarojs/components"
2
+import './TextContent.less'
3
+
4
+export default (props) => {
5
+  const { item } = props
6
+  return (
7
+    <view className='cardext'>
8
+      {
9
+        item.contentType == 'image' ?
10
+          <Image key={item.extId} style={{ width: '100%' }} src={item.content} /> :
11
+          <view className='storezn'>{item.content}</view>
12
+      }
13
+    </view>
14
+  )
15
+}

+ 5
- 0
src/pages/CheckDetails/TextContent.less 파일 보기

@@ -0,0 +1,5 @@
1
+.cardext {
2
+  .storezn {
3
+    text-indent: 2em;
4
+  }
5
+}

+ 20
- 7
src/pages/CheckDetails/index.jsx 파일 보기

@@ -7,6 +7,7 @@ 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 9
 import { getMachineryInfo } from "@/services/homes"
10
+import TextContent from "./TextContent"
10 11
 
11 12
 
12 13
 import './style.less'
@@ -21,12 +22,16 @@ export default (props) => {
21 22
 
22 23
   const [carsInfo, setCarsInfo] = useState({})
23 24
   const [imagesList, setImagesList] = useState([])
25
+  const [contentList, setContentList] = useState([])
26
+
24 27
 
25 28
   useEffect(() => {
26 29
 
27 30
     getMachineryInfo(id, { location: location, attached: true }).then((e) => {
28 31
       setImagesList(e.imagesList)
32
+      setContentList(e.contentList)
29 33
       setCarsInfo(e)
34
+
30 35
       console.log('e', e);
31 36
     })
32 37
 
@@ -82,17 +87,25 @@ export default (props) => {
82 87
             <View className='startReserve-centent'>
83 88
               <View className='articleTitle-box-Details'>
84 89
                 <Image src={decorate} />
85
-                <View>作业详情</View>
90
+                <View>农机详情</View>
86 91
                 <Image src={decorate} />
87 92
               </View>
88
-              <Image style={{ width: '100%' }} src='http://img3.jc001.cn/img/001/1/1512/15566fd0311736f.jpg' />
89
-              <Image style={{ width: '100%' }} src='http://img3.jc001.cn/img/001/1/1512/15566fd0311736f.jpg' />
90
-              <Image style={{ width: '100%' }} src='http://img3.jc001.cn/img/001/1/1512/15566fd0311736f.jpg' />
93
+              {
94
+                contentList.map((item, index) => {
91 95
 
92
-              <View className='startReserve-Bottom'>
93
-                <ButtontWX butText='预约' onClick={startReserve} butWidth={300} butHeight={49} butFontSize={16} butBorderRadius={49} />
96
+                  return (
97
+                    <TextContent item={item} />
98
+                  )
99
+
100
+
101
+                })
102
+              }
103
+
104
+
105
+            </View>
106
+            <View className='startReserve-Bottom-oen'>
107
+              <ButtontWX butText='预约' onClick={startReserve} butWidth={300} butHeight={49} butFontSize={16} butBorderRadius={49} />
94 108
 
95
-              </View>
96 109
             </View>
97 110
 
98 111
 

+ 3
- 3
src/pages/CheckDetails/style.less 파일 보기

@@ -86,9 +86,9 @@
86 86
     }
87 87
   }
88 88
 
89
-  .startReserve-Bottom {
90
-    position: absolute;
91
-    bottom: -3vh;
89
+  .startReserve-Bottom-oen {
90
+    position: relative;
92 91
     width: 92vw;
92
+    margin: 2em 0;
93 93
   }
94 94
 }

+ 1
- 0
src/pages/CheckMap/style.less 파일 보기

@@ -77,6 +77,7 @@
77 77
         align-items: center;
78 78
         justify-content: center;
79 79
         margin-top: 32px;
80
+        margin-bottom: 2em;
80 81
         > Image {
81 82
           width: 33px;
82 83
           height: 33px;

+ 4
- 0
src/pages/MoreCars/index.config.js 파일 보기

@@ -4,6 +4,10 @@ export default {
4 4
   navigationStyle: 'custom',
5 5
   disableScroll: true,
6 6
   usingComponents: {
7
+    "mp-tabbar": "weui-miniprogram/tabbar/tabbar",
8
+    "mp-tabs": "../../components/tabs/index",
9
+
10
+
7 11
   }
8 12
 
9 13
 

+ 39
- 69
src/pages/MoreCars/index.jsx 파일 보기

@@ -8,48 +8,46 @@ import {
8 8
 import { useState } from "react"
9 9
 import CustomNav from "@/components/CustomNav"
10 10
 import searchs from '@/assets/homesImgaes/searchs.png'//搜索图片
11
-import ButtontWX from '@/components/ButtontWX'
12
-import addresss from '@/assets/mineImgaes/addresss.png'//地址
11
+import { getMachineryType } from "@/services/homes"
12
+import CarsListContent from "@/components/CarsListContent"
13 13
 
14 14
 import './style.less'
15 15
 
16 16
 
17 17
 
18
+
18 19
 export default (props) => {
20
+  const [activeTab, setActiveTab] = useState(1)
19 21
 
20
-  const carsList = [
21
-    { carsName: '联合收割机', carsUrl: 'http://img3.jc001.cn/img/001/1/1512/15566fd0311736f.jpg', jiage: '300', carsLocation: '3.9' },
22
-    { carsName: '水稻播种机', carsUrl: 'http://img3.jc001.cn/img/001/1/1512/15566fd031719b1.jpg', jiage: '300', carsLocation: '3.9' },
23
-    { carsName: '秸秆统一处理 型号:GB2312', carsUrl: 'http://img3.jc001.cn/img/001/1/1512/15566fd03201503.jpg', jiage: '免费', carsLocation: '3.9' },
24
-    { carsName: '花生稻子小麦收割一体机', carsUrl: 'http://img3.jc001.cn/img/001/1/1512/15566fd0324f649.jpg', jiage: '550', carsLocation: '3.9' },
25
-    { carsName: '拖拉机', carsUrl: 'https://image.cnhnb.com/image/jpg/miniapp/2020/03/26/ef945970d2cc4948b61d45ce57ac1179.jpg', jiage: '180', carsLocation: '3.9' },
26
-    { carsName: '自行车', carsUrl: 'https://image.cnhnb.com/image/jpg/miniapp/2020/03/26/e8745759793d48398f82e6658186686a.jpg', jiage: '20', carsLocation: '3.9' },
27
-  ]
28 22
 
29 23
   const handleSearch = (e) => {
30 24
     console.log(e.detail.value)
31 25
   }
32 26
 
33
-  const [distanceValue, setDistanceValue] = useState('距离')
34
-  const distanceValueState = {
35
-    selector: ['由近到远', '由远到近'],
36
-    selectorChecked: distanceValue,
37
-  }
38
-  const onChangeDistance = e => {
39
-    setDistanceValue(distanceValueState.selector[e.detail.value])
40
-  }
41
-
42
-
27
+  const tabs = [
28
+    {
29
+      title: '全部',
30
+    },
31
+    {
32
+      title: '收割机',
33
+    },
34
+    {
35
+      title: '水稻机',
36
+    },
37
+    {
38
+      title: '战斗机',
39
+    },
40
+    {
41
+      title: '清障机',
42
+    },
43
+  ]
43 44
 
44
-  const [selectValueType, setselectValueType] = useState('类型')
45
-  const selectValueTypeState = {
46
-    selector: ['收割机', '水稻机', '清障机', '战斗机', '公鸡'],
47
-    selectorChecked: selectValueType,
48
-  }
49 45
 
50 46
 
51
-  const onChangeType = e => {
52
-    setselectValueType(selectValueTypeState.selector[e.detail.value])
47
+  const handleTabChange = (e) => {
48
+    console.log('e', e.detail.index);
49
+    const { index } = e.detail
50
+    setActiveTab(index)
53 51
   }
54 52
 
55 53
 
@@ -59,53 +57,25 @@ export default (props) => {
59 57
         <CustomNav title='更多' />
60 58
       </View>
61 59
       <scroll-view scrollY style='height: 100%;' >
62
-
63 60
         <View className='heads-content-searchClass-abcc'>
64 61
           <Input type='text' className='heads-content-searchClass-abcc-searchInput' onBlur={handleSearch} placeholder='搜索关键字查询订单' />
65 62
           <Image src={searchs} className='heads-content-searchClass-abcc-searchInput-searchImg' />
66 63
         </View>
67
-        <View className='pick-box'>
68
-
69
-          <Picker className='picker-box' mode='selector' range={distanceValueState.selector} onChange={onChangeDistance}>
70
-            <View className='picker-text'>
71
-              {distanceValueState.selectorChecked}
72
-              <View className='heads-top-box-left-addresssImg-DownIcon-Picker' />
73
-            </View>
74
-          </Picker>
75
-          <Picker className='picker-box' mode='selector' range={selectValueTypeState.selector} onChange={onChangeType}>
76
-            <View className='picker-text'>
77
-              {selectValueTypeState.selectorChecked}
78
-              <View className='heads-top-box-left-addresssImg-DownIcon-Picker' />
79
-            </View>
80
-          </Picker>
81
-        </View>
82
-        {/* 内容区域 */}
64
+        <mp-tabs
65
+          tabClass='tabs-Unselected'
66
+          swiperClass='tabs-swiper'
67
+          activeClass='tabs-Selected'
68
+          current={activeTab}
69
+          activeTab={activeTab}
70
+          tabs={tabs}
71
+          onChange={handleTabChange}
72
+        ></mp-tabs>
83 73
 
84
-        {
85
-          carsList.map((item, index) => {
86
-            return (
87
-              <View key={index} className='carsListImga-bottom-box-copyStyleless'>
88
-                <Image src={item.carsUrl} />
89
-                <View className='carsListImga-bottom-box-copyStyleless-flaxBox'>
90
-                  <View className='carsListImga-bottom-box-copyStyleless-flaxBox-liftText'>
91
-                    <View className='carsListImga-bottom-box-copyStyleless-flaxBox-liftText-Titles'>{item.carsName}</View>
92
-                    <View className='carsListImga-bottom-box-copyStyleless-flaxBox-liftText-price'>{item.jiage}/<Text>公顷</Text></View>
93
-                  </View>
94
-                  <View className='carsListImga-bottom-box-copyStyleless-flaxBox-rightBut'>
95
-                    <ButtontWX butText='预约' butWidth={80} butHeight={34} butFontSize={19} butBorderRadius={0} />
96
-                  </View>
97
-                </View>
98
-                <View className='content-header-box-map-copyStyleless'>
99
-                  <View className='content-header-box-map-copyStyleless-liftCentent'>
100
-                    <Image src={addresss} />
101
-                    <View>距离当前位置{item.carsLocation}公里</View>
102
-                  </View>
103
-                  <View className='content-header-box-map-copyStyleless-rightCentent'>进入地图&gt;&gt;</View>
104
-                </View>
105
-              </View>
106
-            )
107
-          })
108
-        }
74
+
75
+        {/* 内容区域 */}
76
+        <View className='cententText'>
77
+          <CarsListContent />
78
+        </View>
109 79
       </scroll-view>
110 80
     </View>
111 81
   )

+ 23
- 110
src/pages/MoreCars/style.less 파일 보기

@@ -22,117 +22,30 @@
22 22
     top: 19px;
23 23
   }
24 24
 }
25
-
26
-.pick-box {
27
-  width: 93vw;
28
-  margin: 0 auto;
25
+.tabs-Unselected {
26
+  color: #c0c8d3;
29 27
   text-align: center;
30
-  border-bottom: 1px solid rgba(0, 0, 0, 0.2);
31
-  margin: 29px auto 32px auto;
32
-  padding-bottom: 18px;
33
-
34
-  .picker-box {
35
-    display: inline-block;
36
-    .picker-text {
37
-      line-height: 73px;
38
-      text-align: center;
39
-      border-radius: 42px;
40
-      font-size: 30px;
41
-      font-weight: 700;
42
-      // position: relative;
43
-      top: 34px;
44
-      height: 9.9vw;
45
-      left: 12px;
46
-      padding-right: 40px;
47
-      display: flex;
48
-      align-items: center;
49
-      justify-content: center;
50
-      .picker-text-line {
51
-        color: #808080;
52
-        padding-left: 6px;
53
-        font-weight: 100;
54
-      }
55
-      .heads-top-box-left-addresssImg-DownIcon-Picker {
56
-        border-top: 7px solid #000;
57
-        border-left: 7px solid transparent;
58
-        border-right: 7px solid transparent;
59
-        margin-left: 15px;
60
-      }
61
-    }
62
-  }
28
+  font-size: 28px;
29
+  line-height: 91px;
30
+  box-sizing: border-box;
31
+  padding: 0 32px;
32
+  letter-spacing: 2px;
33
+}
34
+.tabs-swiper {
35
+  max-height: 0;
36
+}
37
+.tabs-Selected {
38
+  box-sizing: border-box;
39
+  font-size: 32px;
40
+  color: #4c4c4c;
41
+  // width: 25vw;
42
+  font-weight: bold;
43
+  text-align: center;
44
+  border-bottom: 6px solid #4c4c4c;
45
+  padding: 0 32px;
46
+  letter-spacing: 2px;
63 47
 }
64 48
 
65
-.carsListImga-bottom-box-copyStyleless {
66
-  margin: 30px auto 0 auto;
67
-  background: #f2f2f2;
68
-  width: 93vw;
69
-  > Image {
70
-    width: 100%;
71
-    margin: 0 auto;
72
-  }
73
-  &-flaxBox {
74
-    width: 94%;
75
-    display: flex;
76
-    align-items: center;
77
-    margin: 0 auto;
78
-    margin-top: 40px;
79
-    margin-bottom: 38px;
80
-    &-liftText {
81
-      width: 95%;
82
-
83
-      &-Titles {
84
-        width: 95%;
85
-
86
-        text-overflow: ellipsis; //显示...
87
-        white-space: nowrap; //不换行
88
-        overflow: hidden;
89
-        font-size: 36px;
90
-        font-weight: bold;
91
-        color: #222222;
92
-      }
93
-      &-price {
94
-        margin-top: 44px;
95
-        font-size: 44px;
96
-        font-weight: 800;
97
-        color: #666666;
98
-        background: linear-gradient(180deg, #fa7878 0%, #b61515 100%);
99
-        -webkit-background-clip: text;
100
-        -webkit-text-fill-color: transparent;
101
-        > Text {
102
-          font-size: 25px;
103
-        }
104
-      }
105
-    }
106
-    &-rightBut {
107
-      align-items: center;
108
-      margin: 0 auto;
109
-    }
110
-  }
111
-  .content-header-box-map-copyStyleless {
112
-    width: 94%;
113
-    margin: 0 auto;
114
-    display: flex;
115
-    align-items: center;
116
-    justify-content: space-between;
117
-    padding-bottom: 60px;
118
-    &-liftCentent {
119
-      display: flex;
120
-      align-items: center;
121
-      > Image {
122
-        width: 22px;
123
-        height: 27px;
124
-      }
125
-      > View {
126
-        padding-left: 15px;
127
-        font-size: 30px;
128
-        font-weight: 800;
129
-        color: #222222;
130
-      }
131
-    }
132
-    &-rightCentent {
133
-      font-size: 30px;
134
-      font-weight: 500;
135
-      color: #666666;
136
-    }
137
-  }
49
+.cententText {
50
+  padding-bottom: 6em;
138 51
 }

+ 0
- 52
src/pages/MyAddressInfo/index.jsx 파일 보기

@@ -1,52 +0,0 @@
1
-import { View, Form, Input, Button } from "@tarojs/components"
2
-import CustomNav from "@/components/CustomNav"
3
-import ButtontWX from '@/components/ButtontWX'
4
-
5
-
6
-import './style.less'
7
-
8
-
9
-
10
-
11
-export default (props) => {
12
-  const formSubmit = e => {
13
-    console.log(e.detail.value)
14
-  }
15
-
16
-  const formReset = e => {
17
-    console.log(e)
18
-  }
19
-  return (
20
-    <View className='page-index'>
21
-      <View className='index-navbar'>
22
-        <CustomNav title='我的地址' />
23
-      </View>
24
-      <scroll-view scrollY style='height: 100%;' >
25
-        <View className='form-content'>
26
-          <Form onSubmit={formSubmit} onReset={formReset} >
27
-            <View className='example-body'>
28
-              <View>姓名:</View>
29
-              <Input name='name' placeholder='请输入姓名' />
30
-            </View>
31
-            <View className='example-body'>
32
-              <View>手机号:</View>
33
-              <Input name='phone' placeholder='请输入手机号' />
34
-            </View>
35
-            <View className='example-body'>
36
-              <View>定位信息:</View>
37
-              <Input name='locast' placeholder='请输入定位信息' />
38
-            </View>
39
-            <View className='example-body'>
40
-              <View>地址信息:</View>
41
-              <Input name='locastInfo' placeholder='请输入地址信息' />
42
-            </View>
43
-            <View className='buton-bottom'>
44
-              <ButtontWX onClick={() => { }} formType='submit' butText='保存' butWidth={315} butHeight={49} butFontSize={16} butBorderRadius={49} />
45
-            </View>
46
-          </Form>
47
-
48
-        </View>
49
-      </scroll-view>
50
-    </View >
51
-  )
52
-}

+ 50
- 0
src/pages/MyAddressList/AddressInfos/index.jsx 파일 보기

@@ -0,0 +1,50 @@
1
+import { View, Form, Input, Switch, Textarea } from "@tarojs/components"
2
+import Taro from "@tarojs/taro"
3
+import CustomNav from "@/components/CustomNav"
4
+import ButtontWX from '@/components/ButtontWX'
5
+
6
+import './style.less'
7
+import { useEffect } from "react"
8
+
9
+
10
+
11
+
12
+export default (props) => {
13
+  const formSubmit = e => {
14
+    const value = e.detail.value
15
+    console.log(value)
16
+
17
+  }
18
+
19
+  const formReset = e => {
20
+    console.log(e)
21
+  }
22
+  const handelSwitch = (e) => {
23
+    const { value } = e.detail
24
+    console.log('e', value);
25
+
26
+  }
27
+  return (
28
+
29
+    <View className='form-content'>
30
+      <Form onSubmit={formSubmit} onReset={formReset} >
31
+        <View className='example-body'>
32
+          <View>详细地址:</View>
33
+          <Textarea name='locastInfo' className='aTextareaCentent' placeholder='请输入地址信息' />
34
+        </View>
35
+        <View className='example-body'>
36
+          <View>是否设为默认地址:</View>
37
+          {/* <Textarea name='locastInfo' className='aTextareaCentent' placeholder='请输入地址信息' /> */}
38
+
39
+
40
+          <Switch name='Switch' onChange={handelSwitch} />
41
+        </View>
42
+        <View className='buton-bottom'>
43
+          <ButtontWX onClick={formSubmit} formType='submit' butText='保存' butWidth={315} butHeight={49} butFontSize={16} butBorderRadius={49} />
44
+        </View>
45
+      </Form>
46
+
47
+    </View>
48
+
49
+  )
50
+}

src/pages/MyAddressInfo/style.less → src/pages/MyAddressList/AddressInfos/style.less 파일 보기

@@ -19,6 +19,15 @@
19 19
       padding-bottom: 30px;
20 20
       border-bottom: 1px solid rgba(0, 0, 0, 0.12);
21 21
     }
22
+    .aTextareaCentent {
23
+      // width: 85%;
24
+      background: #fefefe;
25
+      border: 2px solid rgba(0, 0, 0, 0.2);
26
+      border-radius: 20px;
27
+      // min-height: 25vh;
28
+      // margin: 1em auto;
29
+      padding: 10px 37px;
30
+    }
22 31
   }
23 32
   .buton-bottom {
24 33
     width: 100%;

src/pages/MyAddressInfo/index.config.js → src/pages/MyAddressList/index.config.js 파일 보기


+ 33
- 0
src/pages/MyAddressList/index.jsx 파일 보기

@@ -0,0 +1,33 @@
1
+import { View, Form, Input, Button, Textarea } from "@tarojs/components"
2
+import Taro from "@tarojs/taro"
3
+import CustomNav from "@/components/CustomNav"
4
+import ButtontWX from '@/components/ButtontWX'
5
+import { useEffect } from "react"
6
+
7
+import './style.less'
8
+
9
+
10
+
11
+
12
+export default (props) => {
13
+
14
+  const addAddress = () => {
15
+    Taro.navigateTo({ url: `/pages/MyAddressList/AddressInfos/index?id=${1}` })
16
+  }
17
+
18
+  useEffect(() => {
19
+
20
+  })
21
+  return (
22
+    <View className='page-index'>
23
+      <View className='index-navbar'>
24
+        <CustomNav title='我的地址' />
25
+      </View>
26
+      <scroll-view scrollY style='height: 100%;' >
27
+        <ButtontWX onClick={addAddress} formType='submit' butText='+新增收货地址' butWidth={315} butHeight={49} butFontSize={16} butBorderRadius={49} />
28
+      </scroll-view>
29
+    </View >
30
+  )
31
+}
32
+
33
+

+ 0
- 0
src/pages/MyAddressList/style.less 파일 보기


+ 4
- 87
src/pages/index/tabs/Homes.jsx 파일 보기

@@ -2,15 +2,12 @@
2 2
 import { View, Swiper, Image, SwiperItem, Text, Input } from "@tarojs/components"
3 3
 import { useEffect, useState, useMemo } from "react"
4 4
 import Taro, { useReachBottom } from "@tarojs/taro"
5
-import ButtontWX from '@/components/ButtontWX'
6 5
 import addresss from '@/assets/mineImgaes/addresss.png'//地址
7 6
 import searchs from '@/assets/homesImgaes/searchs.png'//搜索图片
8 7
 import carsListImga from '@/assets/homesImgaes/carsListImga.png'//农机列表图片
9
-
8
+import CarsListContent from "@/components/CarsListContent"
10 9
 import { getHomeBanner, getMachinery, } from "@/services/homes"
11 10
 
12
-
13
-
14 11
 import './HomesCss/style.less'
15 12
 
16 13
 export default (props) => {
@@ -18,61 +15,22 @@ export default (props) => {
18 15
   const [bannerHome, setBannerHome] = useState([])
19 16
   const [carsList, setCarsList] = useState([])
20 17
 
21
-  let pageSize = 10;//每页加载的数据量
22
-  let pageNum = 1;//当前页
23
-  let totalPage = 0;//总页数
24
-  let resultData = [];
18
+
25 19
 
26 20
   useEffect(() => {
27 21
     getHomeBanner({ position: 'banner' }).then((e) => {
28 22
       console.log('e', e);
29
-      // let bame = e.filter(ele => ele.position == "banner")
30 23
       setBannerHome(e)
31 24
     })
32
-    getMachinery(location, {
33
-      pageSize: 3,
34
-      pageNum: 1,
35
-    }).then((e) => {
25
+    getMachinery(location).then((e) => {
36 26
       setCarsList(e.records)
37 27
     })
38 28
 
39 29
   }, [])
40 30
 
41 31
 
42
-  useReachBottom(() => {
43
-    console.log('chufa',);
44
-
45
-    if (pageNum < totalPage) {
46
-      pageNum += 1;
47
-      //加载下一页
48
-      loadData()
49
-      console.log('chufa',);
50
-    } else {
51
-      Taro.showToast({
52
-        icon: "none",
53
-        title: '没有更多数据了',
54
-      })
55
-    }
56
-  }, [1])
57
-
58
-
59
-
60
-
61
-  const loadData = () => {
62
-    getMachinery(location, {
63
-      pageSize: pageSize,
64
-      pageNum: pageNum,
65
-    }).then((e) => {
66
-      pageNum = e.data.content.pageNum;
67
-      totalPage = e.data.content.totalPageNum;
68
-      resultData = e.data.content.rows;
69
-
70
-      setCarsList(e.records)
71
-    })
72
-  }
73 32
 
74 33
 
75
-  console.log("🚀 ~ file: Homes.jsx ~ line 36 ~ imglist ~ imglist", bannerHome)
76 34
 
77 35
 
78 36
 
@@ -85,23 +43,8 @@ export default (props) => {
85 43
 
86 44
   }
87 45
 
88
-  const startReserve = () => {
89
-    Taro.navigateTo({ url: `/pages/OrderInfo/index?id${1}` })
90
-
91
-  }
92
-  const goCarsInfo = (res) => {
93
-    Taro.navigateTo({ url: `/pages/CheckDetails/index?id=${res}&location=${location}` })
94
-
95
-  }
96
-  const goMapInfo = (res) => {
97
-    Taro.navigateTo({ url: `/pages/CheckMap/index?mapId=${res + 111}` })
98
-
99
-  }
100
-
101 46
 
102 47
   return (
103
-
104
-
105 48
     <scroll-view className='scrollView' scrollY style='height: 100%;' >
106 49
       <View className='heads-top-box'>
107 50
         <View className='heads-top-box-left'>
@@ -132,33 +75,7 @@ export default (props) => {
132 75
         </View>
133 76
         <View onClick={goToCarsList} className='content-header-box-rightCentent'>更多&gt;&gt;</View>
134 77
       </View>
135
-
136
-      {
137
-        carsList.map((item, index) => {
138
-          return (
139
-            <View key={index} className='carsListImga-bottom-box'>
140
-              <Image src={item.thumb} onClick={() => goCarsInfo(item.machineryId)} />
141
-              <View className='carsListImga-bottom-box-flaxBox'>
142
-                <View className='carsListImga-bottom-box-flaxBox-liftText'>
143
-                  <View className='carsListImga-bottom-box-flaxBox-liftText-Titles'>{item.name}</View>
144
-                  <View className='carsListImga-bottom-box-flaxBox-liftText-price'>{item.price}/<Text>公顷</Text></View>
145
-                </View>
146
-                <View className='carsListImga-bottom-box-flaxBox-rightBut'>
147
-                  <ButtontWX onClick={startReserve} butText='预约' butWidth={80} butHeight={34} butFontSize={19} butBorderRadius={0} />
148
-                </View>
149
-              </View>
150
-              <View className='content-header-box-map' onClick={() => goMapInfo(item.machineryId)}>
151
-                <View className='content-header-box-map-liftCentent'>
152
-                  <Image src={addresss} />
153
-                  <View>距离当前位置公里</View>
154
-                </View>
155
-                <View className='content-header-box-map-rightCentent'>进入地图&gt;&gt;</View>
156
-              </View>
157
-            </View>
158
-          )
159
-        })
160
-      }
161
-
78
+      <CarsListContent carsList={carsList} />
162 79
     </scroll-view>
163 80
   )
164 81
 }

+ 0
- 76
src/pages/index/tabs/HomesCss/style.less 파일 보기

@@ -81,79 +81,3 @@
81 81
     color: #666666;
82 82
   }
83 83
 }
84
-
85
-.carsListImga-bottom-box {
86
-  margin: 30px auto 0 auto;
87
-  background: #f2f2f2;
88
-  width: 93vw;
89
-  > Image {
90
-    width: 100%;
91
-    margin: 0 auto;
92
-  }
93
-  &-flaxBox {
94
-    width: 94%;
95
-    display: flex;
96
-    align-items: center;
97
-    margin: 0 auto;
98
-    margin-top: 40px;
99
-    margin-bottom: 38px;
100
-    &-liftText {
101
-      width: 95%;
102
-
103
-      &-Titles {
104
-        width: 95%;
105
-
106
-        text-overflow: ellipsis; //显示...
107
-        white-space: nowrap; //不换行
108
-        overflow: hidden;
109
-        font-size: 36px;
110
-        font-weight: bold;
111
-        color: #222222;
112
-      }
113
-      &-price {
114
-        margin-top: 44px;
115
-        font-size: 44px;
116
-        font-weight: 800;
117
-        color: #666666;
118
-        background: linear-gradient(180deg, #fa7878 0%, #b61515 100%);
119
-        -webkit-background-clip: text;
120
-        -webkit-text-fill-color: transparent;
121
-        > Text {
122
-          font-size: 25px;
123
-        }
124
-      }
125
-    }
126
-    &-rightBut {
127
-      align-items: center;
128
-      margin: 0 auto;
129
-    }
130
-  }
131
-  .content-header-box-map {
132
-    width: 94%;
133
-
134
-    margin: 0 auto;
135
-    display: flex;
136
-    align-items: center;
137
-    justify-content: space-between;
138
-    padding-bottom: 60px;
139
-    &-liftCentent {
140
-      display: flex;
141
-      align-items: center;
142
-      > Image {
143
-        width: 22px;
144
-        height: 27px;
145
-      }
146
-      > View {
147
-        padding-left: 15px;
148
-        font-size: 30px;
149
-        font-weight: 800;
150
-        color: #222222;
151
-      }
152
-    }
153
-    &-rightCentent {
154
-      font-size: 30px;
155
-      font-weight: 500;
156
-      color: #666666;
157
-    }
158
-  }
159
-}

+ 6
- 3
src/pages/index/tabs/Mine.jsx 파일 보기

@@ -30,16 +30,19 @@ export default (props) => {
30 30
 
31 31
 
32 32
   const userInfo = useMemo(() => {
33
-    console.log($instance.router.params)
33
+    console.log($instance.router.params, '$instance.router.params路由')
34 34
     if ($instance.router.params.userOk || person.phone) {
35 35
       setIsLoginBox(true)
36 36
       return { phone: person.phone, nickName: person.nickName }
37 37
     }
38
+
38 39
   }, [$instance.router.params, person])
39 40
 
40 41
 
42
+
43
+
41 44
   const setAddress = (dd) => {
42
-    Taro.navigateTo({ url: `/pages/MyAddressInfo/index?id${dd}` })
45
+    Taro.navigateTo({ url: `/pages/MyAddressList/index?id${dd}` })
43 46
 
44 47
   }
45 48
 
@@ -87,7 +90,7 @@ export default (props) => {
87 90
             :
88 91
             <>
89 92
               <View style={{ backgroundImage: "url(" + require("@/assets/mineImgaes/mineBack.png") + ")" }} className='User-Avatar-background-trueBox'>
90
-                <View className='setPassword'>修改密码</View>
93
+                <View className='setPassword'>修改个人信息</View>
91 94
                 <Image className='User-Avatar-background-trueBox-userImg' src='https://profile.csdnimg.cn/3/1/5/0_qq_42551866' />
92 95
                 <View className='User-Avatar-background-trueBox-name'>
93 96
                   <View >{userInfo.nickName}</View>

+ 1
- 1
src/pages/index/tabs/MineCss/style.less 파일 보기

@@ -80,7 +80,7 @@
80 80
   .setPassword {
81 81
     position: absolute;
82 82
     right: 2.5vw;
83
-    width: 158px;
83
+    width: 178px;
84 84
     height: 54px;
85 85
     background: #000000;
86 86
     opacity: 0.3;

+ 7
- 2
src/routes.js 파일 보기

@@ -15,9 +15,14 @@ const Pages = [
15 15
     page: 'pages/UserLogin/index',
16 16
   },
17 17
   {
18
-    title: '我的地址',
19
-    page: 'pages/MyAddressInfo/index',
18
+    title: '我的地址列表',
19
+    page: 'pages/MyAddressList/index',
20 20
   },
21
+  {
22
+    title: '我的详细地址',
23
+    page: 'pages/MyAddressList/AddressInfos/index',
24
+  },
25
+
21 26
   {
22 27
     title: '关于我们',
23 28
     page: 'pages/AboutUsPage/index',

+ 11
- 0
src/services/address.js 파일 보기

@@ -0,0 +1,11 @@
1
+
2
+import request from '@/utils/request'
3
+
4
+
5
+
6
+/**
7
+ * banner轮播图
8
+ * @param {*} data 
9
+ * @returns 
10
+ */
11
+export const getHomeBanner = (data) => request(`/banner`, { data, method: 'get' })

+ 14
- 0
src/services/homes.js 파일 보기

@@ -1,5 +1,8 @@
1 1
 
2 2
 import request from '@/utils/request'
3
+
4
+
5
+
3 6
 /**
4 7
  * banner轮播图
5 8
  * @param {*} data 
@@ -23,3 +26,14 @@ export const getMachinery = (pram, data) => request(`/machinery?location=${pram}
23 26
  */
24 27
 export const getMachineryInfo = (pram, data) => request(`/machinery-summary/${pram}`, { data, method: 'get' })
25 28
 
29
+
30
+
31
+/**
32
+ * 农机分类Tab列查询
33
+ * @param {*} data 
34
+ * @returns 
35
+ */
36
+export const getMachineryType = (pram, data) => request(`/machinery-type`, { data, method: 'get' })
37
+
38
+
39
+

+ 1
- 1
src/utils/request.js 파일 보기

@@ -13,7 +13,7 @@ export default (url, options) => {
13 13
   }
14 14
 
15 15
   const urlWithParams = queryStr ? `${url}?${queryStr}` : url;
16
-  const nwUrl = `${HOST}/api/wx/${appid}${urlWithParams}`
16
+  const nwUrl = `${HOST}/api/wx/farmer${urlWithParams}`
17 17
 
18 18
   const authToken = Taro.getStorageSync('token')
19 19
   const tokenHeader = authToken ? { Authorization: authToken } : {}