修改小程序,前端,官网跳转路径
This commit is contained in:
@@ -1,5 +1,4 @@
|
||||
import axios from 'axios'
|
||||
import { message } from 'ant-design-vue'
|
||||
|
||||
// 创建axios实例
|
||||
const instance = axios.create({
|
||||
@@ -41,26 +40,26 @@ instance.interceptors.response.use(
|
||||
// 未授权,清除token并跳转到登录页面
|
||||
localStorage.removeItem('token')
|
||||
window.location.href = '/login'
|
||||
message.error('登录已过期,请重新登录')
|
||||
console.error('登录已过期,请重新登录')
|
||||
break
|
||||
case 403:
|
||||
message.error('没有权限执行此操作')
|
||||
console.error('没有权限执行此操作')
|
||||
break
|
||||
case 404:
|
||||
message.error('请求的资源不存在')
|
||||
console.error('请求的资源不存在')
|
||||
break
|
||||
case 500:
|
||||
message.error('服务器内部错误')
|
||||
console.error('服务器内部错误')
|
||||
break
|
||||
default:
|
||||
message.error(error.response.data.message || '请求失败')
|
||||
console.error(error.response.data.message || '请求失败')
|
||||
}
|
||||
} else if (error.request) {
|
||||
// 请求发出但没有收到响应
|
||||
message.error('网络错误,请检查网络连接')
|
||||
console.error('网络错误,请检查网络连接')
|
||||
} else {
|
||||
// 请求配置出错
|
||||
message.error('请求配置错误')
|
||||
console.error('请求配置错误')
|
||||
}
|
||||
return Promise.reject(error)
|
||||
}
|
||||
@@ -321,6 +320,40 @@ const api = {
|
||||
// 删除智能主机
|
||||
delete: (id) => instance.delete(`/smart-host/${id}`)
|
||||
}
|
||||
},
|
||||
|
||||
// 屠宰场管理相关API
|
||||
slaughter: {
|
||||
// 获取屠宰场列表
|
||||
getList: (params) => instance.get('/slaughter/slaughterhouses', { params }),
|
||||
// 获取单个屠宰场详情
|
||||
getDetail: (id) => instance.get(`/slaughter/slaughterhouses/${id}`),
|
||||
// 创建屠宰场
|
||||
create: (data) => instance.post('/slaughter/slaughterhouses', data),
|
||||
// 更新屠宰场
|
||||
update: (id, data) => instance.put(`/slaughter/slaughterhouses/${id}`, data),
|
||||
// 删除屠宰场
|
||||
delete: (id) => instance.delete(`/slaughter/slaughterhouses/${id}`),
|
||||
// 切换屠宰场状态
|
||||
toggleStatus: (id) => instance.patch(`/slaughter/slaughterhouses/${id}/status`)
|
||||
},
|
||||
|
||||
// 无害化登记管理相关API
|
||||
harmlessRegistration: {
|
||||
getList: (params) => instance.get('/harmless/list', { params }),
|
||||
getDetail: (id) => instance.get(`/harmless/detail/${id}`),
|
||||
create: (data) => instance.post('/harmless/create', data),
|
||||
update: (id, data) => instance.put(`/harmless/update/${id}`, data),
|
||||
delete: (id) => instance.delete(`/harmless/delete/${id}`)
|
||||
},
|
||||
|
||||
// 无害化场所管理相关API
|
||||
harmlessPlace: {
|
||||
getList: (params) => instance.get('/harmless-place/list', { params }),
|
||||
getDetail: (id) => instance.get(`/harmless-place/detail/${id}`),
|
||||
create: (data) => instance.post('/harmless-place/create', data),
|
||||
update: (id, data) => instance.put(`/harmless-place/update/${id}`, data),
|
||||
delete: (id) => instance.delete(`/harmless-place/delete/${id}`)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user