添加银行政府后端接口
This commit is contained in:
@@ -4,7 +4,7 @@ import axios from 'axios'
|
||||
|
||||
// 创建axios实例
|
||||
const instance = axios.create({
|
||||
baseURL: '/api',
|
||||
baseURL: 'http://localhost:5352/api',
|
||||
timeout: 10000,
|
||||
headers: {
|
||||
'Content-Type': 'application/json'
|
||||
@@ -43,26 +43,40 @@ instance.interceptors.response.use(
|
||||
const userStore = useUserStore()
|
||||
userStore.logout()
|
||||
window.location.href = '/login'
|
||||
message.error('登录已过期,请重新登录')
|
||||
import('ant-design-vue').then(({ message }) => {
|
||||
message.error('登录已过期,请重新登录')
|
||||
})
|
||||
break
|
||||
case 403:
|
||||
message.error('没有权限执行此操作')
|
||||
import('ant-design-vue').then(({ message }) => {
|
||||
message.error('没有权限执行此操作')
|
||||
})
|
||||
break
|
||||
case 404:
|
||||
message.error('请求的资源不存在')
|
||||
import('ant-design-vue').then(({ message }) => {
|
||||
message.error('请求的资源不存在')
|
||||
})
|
||||
break
|
||||
case 500:
|
||||
message.error('服务器内部错误')
|
||||
import('ant-design-vue').then(({ message }) => {
|
||||
message.error('服务器内部错误')
|
||||
})
|
||||
break
|
||||
default:
|
||||
message.error(error.response.data.message || '请求失败')
|
||||
import('ant-design-vue').then(({ message }) => {
|
||||
message.error(error.response.data.message || '请求失败')
|
||||
})
|
||||
}
|
||||
} else if (error.request) {
|
||||
// 请求发出但没有收到响应
|
||||
message.error('网络错误,请检查网络连接')
|
||||
import('ant-design-vue').then(({ message }) => {
|
||||
message.error('网络错误,请检查网络连接')
|
||||
})
|
||||
} else {
|
||||
// 请求配置出错
|
||||
message.error('请求配置错误')
|
||||
import('ant-design-vue').then(({ message }) => {
|
||||
message.error('请求配置错误')
|
||||
})
|
||||
}
|
||||
return Promise.reject(error)
|
||||
}
|
||||
@@ -217,6 +231,35 @@ const api = {
|
||||
updateSettings: (data) => instance.put('/system/settings', data),
|
||||
// 获取日志列表
|
||||
getLogs: (params) => instance.get('/system/logs', { params })
|
||||
},
|
||||
|
||||
// 政府管理相关API
|
||||
government: {
|
||||
// 行政人员管理
|
||||
adminStaff: {
|
||||
// 获取行政人员列表
|
||||
getList: (params) => instance.get('/government/admin-staff', { params }),
|
||||
// 创建行政人员
|
||||
create: (data) => instance.post('/government/admin-staff', data),
|
||||
// 更新行政人员
|
||||
update: (id, data) => instance.put(`/government/admin-staff/${id}`, data),
|
||||
// 删除行政人员
|
||||
delete: (id) => instance.delete(`/government/admin-staff/${id}`),
|
||||
// 重置行政人员密码
|
||||
resetPassword: (id) => instance.post(`/government/admin-staff/${id}/reset-password`)
|
||||
},
|
||||
|
||||
// 部门管理
|
||||
departments: {
|
||||
// 获取部门列表
|
||||
getList: (params) => instance.get('/government/departments', { params })
|
||||
},
|
||||
|
||||
// 岗位管理
|
||||
positions: {
|
||||
// 获取岗位列表
|
||||
getList: (params) => instance.get('/government/positions', { params })
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user