Forráskód Böngészése

feat: 给登录添加不同情况错误提示

zhouyuhao 1 éve
szülő
commit
79aa93f43d

+ 0 - 12
src/views/Layout/src/components/Menu/MenuView.vue

@@ -96,18 +96,6 @@ onUnmounted(() => {
 const activeMenu = ref()
 activeMenu.value = (route.meta?.activeMenu as string) || route.path
 
-const getAllMenuPaths = (menuList: any) => {
-  let paths: any = []
-  menuList.forEach((item: any) => {
-    paths.push(item.path) // 添加主菜单路径
-    if (item.children && item.children.length > 0) {
-      // 递归添加子菜单路径
-      paths = paths.concat(getAllMenuPaths(item.children))
-    }
-  })
-  return paths
-}
-
 // 未登录白名单
 const whiteList = ['/login', '/public-tracking', '/public-tracking/detail', '/reset-password']
 

+ 23 - 3
src/views/Login/src/loginView.vue

@@ -158,14 +158,34 @@ const handleLogin = () => {
         userStore.setUsername(res.data.uname || '')
         router.push('/')
       } else if (res.code === 400) {
+        const { data } = res
         // 验证码错误
-        if (res.data.msg === 'password_error') {
+        if (data.msg === 'password_error') {
           loginError.value.password = true
-        } else if (res.data.msg === 'verifcation_error') {
+        } else if (data.msg === 'verifcation_error') {
           loginError.value.code = true
-        } else if (res.data.msg === 'error_times') {
+        } else if (data.msg === 'error_times') {
           errorTipsRef.value.openDialog()
         }
+      } else if (res.code === 500) {
+        const { data } = res
+        if (data.msg === 'passwordExpires') {
+          ElMessageBox.alert('Password expired, please change your password', 'Prompt', {
+            confirmButtonText: 'OK',
+            type: 'warning',
+            confirmButtonClass: 'el-button--dark'
+          })
+          userStore.setUsername(res.data.uname || '')
+          router.push({
+            name: 'Reset Password'
+          })
+        } else {
+          ElMessageBox.alert(data.desc, {
+            confirmButtonText: 'OK',
+            type: 'warning',
+            confirmButtonClass: 'el-button--dark'
+          })
+        }
       }
     })
     .finally(() => {

+ 0 - 1
src/views/Tracking/src/components/TrackingDetail/src/components/AMS&ISF.vue

@@ -29,7 +29,6 @@ const handleColumns = (columns: any) => {
   return newColumns
 }
 const getData = (pageData: any) => {
-  console.log(pageData)
   loading.value = true
   $api
     .getTrackingAmsIsf({

+ 15 - 14
src/views/Tracking/src/components/TrackingDetail/src/components/MapView.vue

@@ -140,21 +140,22 @@ const getMarker = () => {
     .then((res) => {
       if (res.code === 200) {
         const { data } = res
-        data.forEach((item) => {
-          const iconColorList = {
-            Destination: { color: '#24ca5a', icon: destinationIcon },
-            Origin: { color: '#ED6D00', icon: originIcon },
-            Transfer: { color: '#ed0000', icon: transferIcon }
-          }
-          markerPositions.value.push({
-            lat: item.lat,
-            lng: item.lng,
-            city: item.infor,
-            label: item.label,
-            icon: iconColorList[item.label].icon,
-            iconColor: iconColorList[item.label].color
+        data &&
+          data.forEach((item) => {
+            const iconColorList = {
+              Destination: { color: '#24ca5a', icon: destinationIcon },
+              Origin: { color: '#ED6D00', icon: originIcon },
+              Transfer: { color: '#ed0000', icon: transferIcon }
+            }
+            markerPositions.value.push({
+              lat: item.lat,
+              lng: item.lng,
+              city: item.infor,
+              label: item.label,
+              icon: iconColorList[item.label].icon,
+              iconColor: iconColorList[item.label].color
+            })
           })
-        })
         // 请求成功后添加标记,并动态添加重置按钮
         addMarkersToMap()
       }

+ 1 - 1
src/views/Tracking/src/components/TrackingDetail/src/components/TransportStep.vue

@@ -3,7 +3,7 @@ const props = defineProps({
   data: Object
 })
 
-const activeName = ref('containerStatus')
+const activeName = ref('shipmentStatus')
 
 const handleTabClick = (name: string) => {
   activeName.value = name