sheldon 2 месяцев назад
Родитель
Сommit
3b815558e2
2 измененных файлов с 12 добавлено и 1 удалено
  1. 7 1
      src/api/index.ts
  2. 5 0
      src/views/role-management/index.vue

+ 7 - 1
src/api/index.ts

@@ -82,7 +82,13 @@ api.interceptors.response.use(
      * 请求出错时 error 会返回错误信息
      */
     const { code, msg } = response.data
-    console.log(code, msg)
+    console.log(code, msg, 444444)
+    if(code === -90){
+      toast.error('Error', {
+        description: '克隆服务异常,请联系管理员',
+      })
+      return Promise.reject(response.data)
+    }
     // if (typeof response.data === 'object') {
     //   console.log(response.data,3333444)
     //   if (response.data.status === 1) {

+ 5 - 0
src/views/role-management/index.vue

@@ -16,6 +16,7 @@ import SearchForm from './components/SearchForm.vue'
 import type { TAgent } from '@/types/role'
 import { anycallPage, updateTopFlag, type TRole } from '@/api/modules/anycallService'
 import { formatDateGeneral } from '@/utils'
+import { toast } from 'vue-sonner'
 
 const tableRef = ref()
 
@@ -120,7 +121,11 @@ function handleUploadSuccess(res:any, file: any) {
   if(res.code === 0){
     importedResult.value = res.data as {name: string, msg: string}[]
     importedResultDialogVisible.value = true
+    return
   }
+  toast.error('Error', {
+    description: res.msg || '导入失败',
+  })
 }