Browse Source

🎈 perf: 进行了若干优化

Pchen. 8 months ago
parent
commit
c2db86d9f9

+ 0 - 0
src/components/Map/mark/begin.png → public/mark/begin.png


+ 0 - 0
src/components/Map/mark/daka.png → public/mark/daka.png


+ 0 - 0
src/components/Map/mark/end.png → public/mark/end.png


+ 0 - 0
src/components/Map/mark/log.png → public/mark/log.png


+ 4 - 4
src/components/Map/MapContainer.vue

@@ -57,13 +57,13 @@ onMounted(() => {
         const beginMarker = new AMap.Marker({
         const beginMarker = new AMap.Marker({
           position: props.pathData[0],
           position: props.pathData[0],
           offset: new AMap.Pixel(-24, -48),
           offset: new AMap.Pixel(-24, -48),
-          icon: "./mark/begin.png",
+          icon: "/mark/begin.png",
           title: "起始点"
           title: "起始点"
         })
         })
         const endMarker = new AMap.Marker({
         const endMarker = new AMap.Marker({
           position: props.pathData[props.pathData.length - 1],
           position: props.pathData[props.pathData.length - 1],
           offset: new AMap.Pixel(-24, -48),
           offset: new AMap.Pixel(-24, -48),
-          icon: "./mark/end.png",
+          icon: "/mark/end.png",
           title: "终点"
           title: "终点"
         })
         })
         map.add([beginMarker, endMarker])
         map.add([beginMarker, endMarker])
@@ -75,7 +75,7 @@ onMounted(() => {
           const marker = new AMap.Marker({
           const marker = new AMap.Marker({
             position: [point.longtitude, point.latitude],
             position: [point.longtitude, point.latitude],
             offset: new AMap.Pixel(-15, -28),
             offset: new AMap.Pixel(-15, -28),
-            icon: "./mark/daka.png",
+            icon: "/mark/daka.png",
             title: `打卡点${index + 1}`
             title: `打卡点${index + 1}`
           })
           })
           map.add(marker)
           map.add(marker)
@@ -89,7 +89,7 @@ onMounted(() => {
           const marker = new AMap.Marker({
           const marker = new AMap.Marker({
             position: markerLocation,
             position: markerLocation,
             offset: new AMap.Pixel(-15, -28),
             offset: new AMap.Pixel(-15, -28),
-            icon: "./mark/log.png",
+            icon: "/mark/log.png",
             title: point.address
             title: point.address
           })
           })
 
 

+ 4 - 8
src/utils/request.js

@@ -1,7 +1,7 @@
 import axios from 'axios'
 import axios from 'axios'
 import { useUserStore } from '@/store'
 import { useUserStore } from '@/store'
 import storage from 'store'
 import storage from 'store'
-import { Notification } from '@arco-design/web-vue';
+import { Notification, Message } from '@arco-design/web-vue';
 import { VueAxios } from './axios'
 import { VueAxios } from './axios'
 import { v4 as uuidv4 } from 'uuid'
 import { v4 as uuidv4 } from 'uuid'
 import { LRUCache } from 'lru-cache'
 import { LRUCache } from 'lru-cache'
@@ -27,10 +27,7 @@ const errorHandler = (error) => {
 
 
   if (error.response) {
   if (error.response) {
     if (error.response.status === 401) {
     if (error.response.status === 401) {
-      Notification.error({
-        title: '登录失效',
-        content: '请重新登录'
-      })
+      Message.error('登录失效,请重新登录')
       if (user) {
       if (user) {
         userStore.logout()  // 调用 Pinia store 中的 logout 方法
         userStore.logout()  // 调用 Pinia store 中的 logout 方法
         setTimeout(() => {
         setTimeout(() => {
@@ -41,10 +38,9 @@ const errorHandler = (error) => {
   } else {
   } else {
     console.error('无法连接到服务器,请检查网络')
     console.error('无法连接到服务器,请检查网络')
 
 
-
     Notification.error({
     Notification.error({
-      title: '服务器维护中',
-      content: '服务器停机维护中,请耐心等待'
+      title: '请求失败',
+      content: '网络不畅或服务器停机维护中,请耐心等待'
     })
     })
   }
   }
 }
 }