reghao 9 месяцев назад
Родитель
Сommit
0df0570084
4 измененных файлов с 61 добавлено и 57 удалено
  1. 17 26
      src/api/map.js
  2. 4 4
      src/views/map/AMap.vue
  3. 38 25
      src/views/map/PhotoMap.vue
  4. 2 2
      src/views/map/TrailMap.vue

+ 17 - 26
src/api/map.js

@@ -1,43 +1,34 @@
 import { get, post } from '@/utils/request'
 
 const mapAPI = {
-  center: '/api/geo/map/center',
-  markers: '/api/geo/map/markers',
-  markerInfoApi: '/api/geo/map/marker',
-  location: '/api/geo/map/location',
-  mainland: '/api/geo/map/cn',
-  geoItemApi: '/api/geo/map/item',
-  addGeoPointApi: '/api/geo/map/point'
+  photoMarks: '/api/geo/photo/marks',
+  photoMarkInfo: '/api/geo/photo/mark/info',
+  photoItemApi: '/api/geo/photo/item',
+  addPositionAPi: '/api/geo/map/position',
+  mapMarks: '/api/geo/map/marks',
+  trailPathApi: '/api/geo/map/trail'
 }
 
-export function getMapCenter() {
-  return get(mapAPI.center)
+export function getMapMarks() {
+  return get(mapAPI.mapMarks)
 }
 
-export function getMarkerInfo(id) {
-  return get(mapAPI.markerInfoApi + '?id=' + id)
-}
-
-export function getMapMarkers(type) {
-  return get(mapAPI.markers + '?type=' + type)
+export function getPhotoMarks(type) {
+  return get(mapAPI.photoMarks + '?type=' + type)
 }
 
-export function sendClickedLocation(loc) {
-  return post(mapAPI.location, loc)
-}
-
-export function getMainLand() {
-  return get(mapAPI.mainland)
+export function getMarkerInfo(id) {
+  return get(mapAPI.photoMarkInfo + '?id=' + id)
 }
 
-export function getGeoItems() {
-  return get(mapAPI.geoItemApi)
+export function getPhotoItems() {
+  return get(mapAPI.photoItemApi)
 }
 
-export function addGeoPoint(data) {
-  return post(mapAPI.addGeoPointApi, data)
+export function addGeoPosition(data) {
+  return post(mapAPI.addPositionAPi, data)
 }
 
 export function getGeoPoint() {
-  return get(mapAPI.addGeoPointApi)
+  return get(mapAPI.trailPathApi)
 }

+ 4 - 4
src/views/map/AMap.vue

@@ -16,7 +16,7 @@
 
 <script>
 import AMapLoader from '@amap/amap-jsapi-loader'
-import { addGeoPoint, getMapMarkers } from '@/api/map'
+import { addGeoPosition, getMapMarks } from '@/api/map'
 
 export default {
   name: 'Map',
@@ -78,7 +78,7 @@ export default {
           this.showPositionDialog = true
         })
 
-        getMapMarkers(1).then(res => {
+        getMapMarks().then(res => {
           if (res.code === 0) {
             this.$notify({
               message: '加载了 ' + res.data.length + ' 条数据',
@@ -94,7 +94,7 @@ export default {
               }))
             }
 
-            // this.map.add(this.markers)
+            this.map.add(this.markers)
           } else {
             this.$notify({
               message: res.msg,
@@ -117,7 +117,7 @@ export default {
     },
     onSavePosition() {
       this.showPositionDialog = false
-      addGeoPoint(this.positionForm).then(resp => {
+      addGeoPosition(this.positionForm).then(resp => {
         if (resp.code !== 0) {
           this.$message.info('添加坐标失败')
         }

+ 38 - 25
src/views/map/PhotoMap.vue

@@ -56,22 +56,35 @@
         </div>
         <div class="text item">
           <el-image v-if="markerInfo.photoUrl !== null" :src="markerInfo.photoUrl" min-width="40" height="30" />
-          <br>
-          <label>
-            商品 <span v-text="markerInfo.itemId" />
-          </label>
-          <br>
-          <label>
-            SKU <span v-text="markerInfo.sku" />
-          </label>
-          <br>
-          <label>
-            评论 <span style="color: blue" v-text="markerInfo.replyContent" />
-          </label>
-          <br>
-          <!--          <label v-if="markerInfo.appendContent !== undefined || markerInfo.appendContent !== null">
-                      追加 <span style="color: blue" v-text="markerInfo.appendContent"/>
-                    </label>-->
+          <div v-if="markerInfo.type === 2">
+            <el-row>
+              <el-row>
+                ID
+                <a style="text-decoration-line: none" target="_blank" :href="`https://item.taobao.com/item.htm?id=${markerInfo.itemId}`">
+                  <span style="color: blue">{{ markerInfo.itemId }}</span>
+                </a>
+              </el-row>
+              <el-row>
+                SKU <span style="color: blue" v-text="markerInfo.sku" />
+              </el-row>
+              <el-row>
+                评论 <span style="color: blue" v-text="markerInfo.replyContent" />
+              </el-row>
+              <el-row v-if="markerInfo.appendContent !== undefined || markerInfo.appendContent !== null">
+                追评 <span style="color: blue" v-text="markerInfo.appendContent" />
+              </el-row>
+            </el-row>
+          </div>
+          <div v-if="markerInfo.type === 4">
+            <el-row>
+              <el-row>
+                ID
+                <router-link style="text-decoration-line: none" target="_blank" :to="`/image/${markerInfo.itemId}`">
+                  <span style="color: blue">{{ markerInfo.itemId }}</span>
+                </router-link>
+              </el-row>
+            </el-row>
+          </div>
         </div>
       </el-card>
     </el-dialog>
@@ -79,7 +92,7 @@
 </template>
 
 <script>
-import { getGeoItems, getMapMarkers, getMarkerInfo } from '@/api/map'
+import { getPhotoItems, getPhotoMarks, getMarkerInfo } from '@/api/map'
 
 import Vue from 'vue'
 import VueAMap from 'vue-amap'
@@ -156,7 +169,7 @@ export default {
   },
   methods: {
     getItems() {
-      getGeoItems().then(resp => {
+      getPhotoItems().then(resp => {
         if (resp.code === 0) {
           this.selectOptions = resp.data
         }
@@ -187,16 +200,16 @@ export default {
         })
         this.massMarks = massMarks
 
-        this.getMapMarkersWrapper(this.selectedOption)
-        // this.getMapMarkersWrapper1(type)
+        this.getPhotoMarksWrapper(this.selectedOption)
+        // this.getPhotoMarksWrapper1(type)
       })
     },
     zoomchange(e) {
       console.log('当前缩放级别: ' + this.amap.getZoom())
     },
-    getMapMarkersWrapper(type) {
+    getPhotoMarksWrapper(type) {
       this.markers = []
-      getMapMarkers(type).then(res => {
+      getPhotoMarks(type).then(res => {
         if (res.code === 0) {
           this.$notify({
             message: '加载了 ' + res.data.length + ' 条数据',
@@ -227,9 +240,9 @@ export default {
       })
     },
     // 渲染海量点
-    getMapMarkersWrapper1(type) {
+    getPhotoMarksWrapper1(type) {
       this.massMarks.setData([])
-      getMapMarkers(type).then(res => {
+      getPhotoMarks(type).then(res => {
         if (res.code === 0) {
           this.$notify({
             message: '加载了 ' + res.data.length + ' 条数据',
@@ -305,7 +318,7 @@ export default {
       })
     },
     onChange() {
-      this.getMapMarkersWrapper(this.selectedOption)
+      this.getPhotoMarksWrapper(this.selectedOption)
     }
   }
 }

+ 2 - 2
src/views/map/TrailMap.vue

@@ -24,7 +24,7 @@
 
 <script>
 import AMapLoader from '@amap/amap-jsapi-loader'
-import { addGeoPoint, getGeoPoint } from '@/api/map'
+import { addGeoPosition, getGeoPoint } from '@/api/map'
 
 export default {
   name: 'Map',
@@ -239,7 +239,7 @@ export default {
     },
     onSavePosition() {
       this.showPositionDialog = false
-      addGeoPoint(this.positionForm).then(resp => {
+      addGeoPosition(this.positionForm).then(resp => {
         if (resp.code !== 0) {
           this.$message.info('添加坐标失败')
         }