Parcourir la source

搜索交通导航

xyg il y a 2 ans
Parent
commit
43d20b879a
3 fichiers modifiés avec 49 ajouts et 10 suppressions
  1. 32 5
      nnzwminiapp/pages/map/map.js
  2. 5 3
      nnzwminiapp/pages/map/map.wxml
  3. 12 2
      nnzwminiapp/pages/map/quert.wxml

+ 32 - 5
nnzwminiapp/pages/map/map.js

@@ -65,11 +65,14 @@ Page({
       { value: 'right', text: '右侧弹出' },
     ],
     showIndex: false,
-    isSearch: false,
+    showTraffic: true,
     height: 0,
     searchVal: '',
-    trafficStart:'',
-    trafficEnd:'',
+    trafficStart: '',
+    trafficEnd: '',
+    navigateArr: ['百度地图导航', '高德地图导航'],
+    showSection: true,
+    index: 0,
   },
   
   onLoad: function () {
@@ -138,6 +141,7 @@ Page({
     },
 
     searchTap(e) {
+        const that = this;
         let searchVal = this.data.searchVal;
         if (!searchVal) {
             wx.showToast({
@@ -147,6 +151,10 @@ Page({
             return;
         }
         console.info(searchVal)
+        // 搜索结果
+        that.setData({
+            showTraffic: false
+        });
     },
 
     getTrafficStart(e) {
@@ -161,14 +169,33 @@ Page({
     },
 
     searchTrafficTap(e) {
+        const that = this;
         let trafficStart = this.data.trafficStart;
         let trafficEnd = this.data.trafficEnd;
         if (!trafficStart || !trafficEnd) {
+            that.setData({
+                showSection: true
+            });
             wx.showToast({
                 title: '请输入起点和终点',
                 icon: 'none'
-            })
+            });
             return;
+        } else {
+            that.setData({
+                showSection: false
+            });
         }
-    }
+        console.info(trafficStart, trafficEnd);
+    },
+
+    searchResultBack(e) {
+        this.setData({
+            showTraffic: true
+        });
+    },
+
+    bindPickerChange(e){
+        console.info(e)
+    },
 })

+ 5 - 3
nnzwminiapp/pages/map/map.wxml

@@ -22,7 +22,8 @@
     <view class="right-map" id="right-map">
       <map id="map" longitude="{{longitude}}" latitude="{{latitude}}" scale="14" show-location="true" markers="{{markers}}" bindmarkertap="makertap" class="map"></map>
     </view>
-    <view wx:if="{{false}}">
+
+    <view wx:if="{{showTraffic}}">
       <view class="right-search" style="position: absolute; left: 22rpx; top: 257px; width: 708rpx; height: 300rpx; display: block; box-sizing: border-box; padding-top: 10rpx;">
         <t-tabs defaultValue="{{0}}" theme="tag" style="height: 292rpx; ">
           <t-tab-panel label="公交" value="0" style=" height: 180rpx; ">
@@ -33,6 +34,7 @@
           </t-tab-panel>
         </t-tabs>
       </view>
+
       <view class="left-map">
         <view class="bttom-tab show-first">
           <t-grid wx:for="{{type}}" wx:index="{{index}}" wx:for-item="typeitem" wx:key="index" class="block">
@@ -46,7 +48,7 @@
       <view class="wrap_result">
           <view class="title-second" style="border-radius: 30rpx; position: absolute; left: 22rpx; top: 330px; width: 708rpx; height: 120rpx;">
             <text style="font-size: 16px;font-weight: 400;color: #2775CC;">搜索结果</text>
-            <button type="button" class="back_btn">返回</button>
+            <button type="button" class="back_btn" bindtap="searchResultBack">返回</button>
           </view>
           <view class="pad_box">
             <include wx:if="{{fasle}}" src="./item"></include>
@@ -70,4 +72,4 @@
       </scroll-view>
     </view>
   </view>
-</view>
+</view>

+ 12 - 2
nnzwminiapp/pages/map/quert.wxml

@@ -16,5 +16,15 @@
       <input class="go_input" placeholder="请输入终点" value="{{trafficEnd}}" bindinput="getTrafficEnd" />
     </view>
   </view>
-  <view><image src="{{imgUrl}}/ss3.png" class="inp-icon1" bindtap="searchTrafficTap"></image></view>
-</view>
+  <!-- <view><image src="{{imgUrl}}/ss3.png" class="inp-icon1" bindtap="searchTrafficTap"></image></view> -->
+ 
+    <view class="section">
+        <picker mode="selector" bindchange="bindPickerChange" value="{{index}}" range="{{navigateArr}}" disabled="{{showSection}}">
+            <view class="picker">
+                <image src="{{imgUrl}}/ss3.png" class="inp-icon1" bindtap="searchTrafficTap"></image>
+            </view>
+        </picker>
+    </view>
+
+</view>
+