소스 검색

高德api 逆向解析获取地址

hjr 3 달 전
부모
커밋
b45059a507

+ 1 - 1
src/pages/book-content/index.ux

@@ -449,7 +449,7 @@ export default {
   .flex-box-mixins(column, flex-start, flex-start);
   .book-title {
     .title;
-    margin: 60px 0 @gap-4 0;
+    margin: 30px 0 @gap-3 0;
   }
   .g22kjdgy{
     color: #ffffff;

+ 2 - 2
src/pages/commonModule/exchangeList/index.ux

@@ -1,6 +1,6 @@
 <template>
   <div class="wrapper">
-     <!-- <reader-div  id="readerdiv"
+     <reader-div  id="readerdiv"
         sectionbreak='","'
         style="font-size: {{fontsize}}px;color: {{fontColor}};background-color: {{backgroundcolor}}" movemode="{{movemode}}"
         onpagechange="pagechange" onchapterend="chapterend" onchapterstart="chapterstart"
@@ -9,7 +9,7 @@
           <div class="ad-container" style="background-color: {{backgroundcolor}}" >
              <text>单div的广,告容器</text>
           </div>
-    </reader-div> -->
+    </reader-div>
   </div>
 </template>
 

+ 3 - 1
src/pages/tools/shengBoChuChen/index.ux

@@ -57,6 +57,8 @@ export default {
         this.open = true;
         this.firstClick = false;
         this.startCleaning();
+      }else{
+        this.cleaningComplete();
       }
     },
 
@@ -73,7 +75,7 @@ export default {
         } else {
           this.cleaningComplete();
         }
-      }, 100);
+      }, 200);
     },
 
     cleaningComplete() {

+ 5 - 4
src/pages/tools/shouJiCeJu/index.ux

@@ -17,12 +17,13 @@ export default {
 <style>
 .wrapper {
   flex-direction: column;
-  justify-content: center;
-  align-items: center;
+  justify-content: flex-end;
+  align-items: flex-end;;
+  background: linear-gradient(to bottom, #a9d4ff, #edf5fc);
 }
 image{
-  width: 100%;
-  height: 3300px;
+  width: 720px;
+  height: 2976px;
 }
 .title {
   text-align: center;

+ 28 - 35
src/pages/tools/wangLuoXinXi/index.ux

@@ -3,19 +3,19 @@
     <div class="box">
 			<div class="item" style="justify-content: space-between;">
 				<text>国家</text>
-				<text>中国</text>
+				<text>{{ info.country }}</text>
 			</div>
 			<div class="item">
 				<text>省份</text>
-				<text>福建省</text>
+				<text>{{ info.province }}</text>
 			</div>
 			<div class="item">
 				<text>城市</text>
-				<text>厦门市</text>
+				<text>{{ info.city }}</text>
 			</div>
 			<div class="item">
 				<text>地区</text>
-				<text>湖里区</text>
+				<text>{{ info.district }}</text>
 			</div>
 			<div class="item">
 				<text>运营商</text>
@@ -42,23 +42,26 @@ import network from '@system.network'
 import device from '@system.device' 
 import telecom from '@system.telecom'
 import geolocation from '@system.geolocation'
+import fetch from '@system.fetch'
 export default {
   private: {
     title: '欢迎体验快应用开发',
     location:{longitude: 114.060682, latitude: 22.5606468},
+    info:{
+      country: "中国",
+      province: "福建省",
+      city: "厦门市",
+      district:'湖里区',
+    }
   },
 
   onInit() {
-    network.getType({
-      success: function(data) {
-        console.log(`handling success: ${data.type}`)
-      }
-    })
     device.getInfo({
       success: function(ret) {
-        console.log(`handling success, brand = ${ret.brand}`)
+        console.log(`handling success, brand = ${JSON.stringify(ret)}`)
       }
     })
+    var that = this
     geolocation.getLocation({
       success: function(data) {
         console.log(
@@ -66,6 +69,21 @@ export default {
             data.latitude
           }`
         )
+        var key = '948b7da20bd04112e259c809fca83671' // 个人高德web服务 key
+        fetch.fetch({
+          url: `https://restapi.amap.com/v3/geocode/regeo?output=JSON&location=${data.longitude},${data.latitude}&key=${key}&extensions=base`,
+          header:{
+            'Content-Type':'application/json',
+          },
+          success: function(response) {
+            const info = JSON.parse(response.data)
+            that.info = info.regeocode.addressComponent // info.regeocode.formatted_address
+            console.log('info',info.regeocode)
+          },
+          fail: function(data, code) {
+            console.log(`handling fail, errMsg = ${data}`)
+          }
+        })
         console.log('data',data)
         
       },
@@ -73,31 +91,6 @@ export default {
         console.log(`handling fail, code = ${code}, errorMsg=${data}`)
       }
     })
-    // https://restapi.amap.com/v3/geocode/regeo?output=xml&location=116.310003,39.991957&key=<用户的key>&radius=1000&extensions=all 
-    geolocation.reverseGeocodeQuery({
-        latitude: 30.513070973744515,
-        longitude: 114.41322124959942,
-        coordType: "gcj02",
-        includePoiInfo:true,
-        success: function (ret) {
-          console.info(`### geolocation.reverseGeocodeQuery ###` + JSON.stringify(ret))
-        },
-        fail: function (erromsg, errocode) {
-          console.info(`### geolocation.reverseGeocodeQuery ### ${errocode}: ${erromsg}`)
-        }
-      })
-    // var that = this
-    // geolocation.reverseGeocodeQuery({
-    //     latitude: that.location.latitude,
-    //     longitude: that.location.longitude,
-    //     coordType: "wgs84",
-    //     success: function (ret) {
-    //       console.info(`### geolocation.reverseGeocodeQuery ###` + JSON.stringify(ret))
-    //     },
-    //     fail: function (erromsg, errocode) {
-    //       console.info(`### geolocation.reverseGeocodeQuery ### ${errocode}: ${erromsg}`)
-    //     }
-    //   })
   }
 }
 </script>