瀏覽代碼

finish around

张延森 5 年之前
父節點
當前提交
373420fe19

+ 2
- 2
config/dev.js 查看文件

@@ -9,8 +9,8 @@ module.exports = {
9 9
     // WSS_HOST: '"wss://dev.jinchengjiaye.com"',
10 10
     // HOST: '"https://lt.pawoma.cn"',
11 11
     // WSS_HOST: '"wss://lt.pawoma.cn"',
12
-    HOST: '"http://192.168.0.84:8080"',
13
-    WSS_HOST: '"ws://192.168.0.84:8080"',
12
+    HOST: '"http://127.0.0.1:8080"',
13
+    WSS_HOST: '"ws://127.0.0.1:8080"',
14 14
   },
15 15
   weapp: {},
16 16
   h5: {}

+ 1
- 1
project.config.json 查看文件

@@ -2,7 +2,7 @@
2 2
 	"miniprogramRoot": "dist/",
3 3
 	"projectname": "mini-chengjiao",
4 4
 	"description": "知与行",
5
-	"appid": "wxda1f84b79b3edeb3",
5
+	"appid": "wxd9ee3a9480a4e544",
6 6
 	"setting": {
7 7
 		"urlCheck": false,
8 8
 		"es6": false,

二進制
src/assets/icons/amap/position.png 查看文件


+ 0
- 1
src/lib/amap-wx.js
文件差異過大導致無法顯示
查看文件


+ 6
- 1
src/pages/project/detail/Around/Pannel.js 查看文件

@@ -2,6 +2,8 @@ import Taro from '@tarojs/taro'
2 2
 import { View } from '@tarojs/components'
3 3
 import './style.scss'
4 4
 
5
+const posIcon = require('@assets/icons/amap/position.png')
6
+
5 7
 export default function Pannel(props) {
6 8
   const { data = [], manualData = [] } = props.dataset || {}
7 9
   const activeKey = props.active
@@ -17,7 +19,10 @@ export default function Pannel(props) {
17 19
           return (
18 20
             <View className={`around-cell ${active ? 'active' : ''}`} key={`auto-${id}`}>
19 21
               <View className="around-cell__body">{`${index + 1}、${name}`}</View>
20
-              <View className="around-cell__action">{dist}</View>
22
+              <View className="around-cell__action">
23
+                <Image className="icon" src={posIcon} />
24
+                {dist}
25
+              </View>
21 26
             </View>
22 27
           )
23 28
         })

+ 11
- 1
src/pages/project/detail/Around/style.scss 查看文件

@@ -91,7 +91,17 @@
91 91
 
92 92
   &__action {
93 93
     flex: none;
94
-    width: 200px;
94
+    width: 160px;
95
+    font-size: 30px;
96
+    line-height: 42px;
97
+    vertical-align: middle;
98
+
99
+    .icon {
100
+      width: 26px;
101
+      height: 26px;
102
+      display: inline-block;
103
+      margin: 0 10px;
104
+    }
95 105
   }
96 106
 }
97 107
 

+ 14
- 37
src/pages/project/detail/index.js
文件差異過大導致無法顯示
查看文件


+ 0
- 99
src/utils/amap.js 查看文件

@@ -1,99 +0,0 @@
1
-/**
2
- * 高德地图
3
- * 
4
- * POI 类型下载 https://lbs.amap.com/api/webservice/guide/api/search/#around
5
- * 
6
- */
7
-const amapLib = require('../lib/amap-wx');
8
-const myAmapKey = '766411323b66f7e876f428d8a23aa83c'
9
-const amap = new amapLib.AMapWX({ key: myAmapKey })
10
-
11
-// key 值会被拿到 building 表中 组合为字段名
12
-const POI_TYPES = [
13
-  {
14
-    key: 'Transport',
15
-    label: '交通',
16
-    types: ['150100', '150200', '150300', '150400', '150500', '150600'],
17
-  },
18
-  {
19
-    key: 'Mall',
20
-    label: '商业',
21
-    types: ['060100', '060200', '060300', '060400', '060500', '060600',
22
-            '060700', '060800', '060900', '061000', '061100', '061200',
23
-            '061300', '061400', '080100', '080200', '080300', '080400',
24
-            '080500', '080600'],
25
-  },
26
-  {
27
-    key: 'Edu',
28
-    label: '学校',
29
-    types: ['141200'],
30
-  },
31
-  {
32
-    key: 'Hospital',
33
-    label: '医院',
34
-    types: ['090100', '090200', '090300', '090400', '090500', '090600', '090700'],
35
-  },
36
-  {
37
-    key: 'Bank',
38
-    label: '银行',
39
-    types: ['160100'],
40
-  },
41
-  {
42
-    key: 'Restaurant',
43
-    label: '餐饮',
44
-    types: ['050100', '050200', '050300', '050400', '050500', '050600',
45
-            '050700', '050800', '050900'],
46
-  },
47
-]
48
-
49
-const getPrefix = str => str.substr(0, 4)
50
-
51
-export function getPoiAround(params) {
52
-  const {
53
-    lng,
54
-    lat
55
-  } = params || {}
56
-
57
-  return new Promise((resolve, reject) => {
58
-    const querytypes = POI_TYPES.reduce((acc, item) => ([ ...acc, ...item.types ]), []).join('|')
59
-    const location = `${lng},${lat}`
60
-    const iconPath = undefined
61
-    const iconPathSelected = undefined
62
-    const resultList = []
63
-
64
-    // 成功回调
65
-    // https://lbs.amap.com/api/webservice/guide/api/search/#around
66
-    const successCall = poiType => res => {
67
-      resultList.push({
68
-        key: poiType.key,
69
-        label: poiType.label,
70
-        poisData: res.poisData,
71
-        markers: res.markers
72
-      })
73
-
74
-      if (resultList.length === POI_TYPES.length) {
75
-        resolve(resultList)
76
-      }
77
-    }
78
-
79
-    // 失败回调
80
-    // https://lbs.amap.com/api/webservice/guide/tools/info/
81
-    const failCall = poiType => info => {
82
-      console.error(poiType, info)
83
-      reject(info)
84
-    }
85
-
86
-    POI_TYPES.forEach((pt) => {
87
-      const querytypes = pt.types.join('|')
88
-
89
-      amap.getPoiAround({
90
-        querytypes,
91
-        location,
92
-        iconPath,
93
-        iconPathSelected,
94
-        success: successCall(pt),
95
-        fail: failCall(pt),
96
-      })
97
-    })
98
-  })
99
-}