From baa138145100f841d440e36b72d7b821f939828e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BC=A0=E5=90=8C=E6=B5=B7?= <963808678@qq.com> Date: Tue, 5 Dec 2023 16:42:04 +0800 Subject: [PATCH] 12/5 --- src/api/modular/main/ApplyJoinOperate.js | 28 +++++ src/utils/requestTOjava.js | 93 ++++++++++++++++ src/views/main/ApplyJoinOperate/index.vue | 116 ++++++++++++++++++++ src/views/main/ApplyJoinOperate/initData.js | 19 ++++ vue.config.js | 22 ++-- 5 files changed, 269 insertions(+), 9 deletions(-) create mode 100644 src/api/modular/main/ApplyJoinOperate.js create mode 100644 src/utils/requestTOjava.js create mode 100644 src/views/main/ApplyJoinOperate/index.vue create mode 100644 src/views/main/ApplyJoinOperate/initData.js diff --git a/src/api/modular/main/ApplyJoinOperate.js b/src/api/modular/main/ApplyJoinOperate.js new file mode 100644 index 0000000..fe595c4 --- /dev/null +++ b/src/api/modular/main/ApplyJoinOperate.js @@ -0,0 +1,28 @@ +import { axios } from '@/utils/requestTOjava' + +// 查询待审核企业列表(运营使用) +export function tenantWaitAuditTenantList(parameter) { + return axios({ + url: '/bookingAip/tenant/waitAuditTenantList', + method: 'get', + params: parameter + }) +} + +// 审核企业(运营使用) +export function TenantAudit(parameter) { + return axios({ + url: '/bookingAip/tenant/audit', + method: 'post', + data: parameter + }) +} +// 查询状态日志列表 +export function bookingCustomStatusLogList(parameter) { + return axios({ + url: '/bookingAip/bookingCustom/statusLogList', + method: 'get', + params: parameter + }) +} +// diff --git a/src/utils/requestTOjava.js b/src/utils/requestTOjava.js new file mode 100644 index 0000000..de7c217 --- /dev/null +++ b/src/utils/requestTOjava.js @@ -0,0 +1,93 @@ +import Vue from 'vue' +import axios from 'axios' +import store from '@/store' +import { message, Modal, notification } from 'ant-design-vue' /// es/notification +import { VueAxios } from './axios' +import { ACCESS_TOKEN } from '@/store/mutation-types' + +// 创建 axios 实例 +const service = axios.create({ + baseURL: '/api', // api base_url + // baseURL: 'http://47.104.222.4:8210/api', // 不用代理就用这个 + timeout: 18000 // 请求超时时间 +}) + +const err = error => { + if (error.response) { + const data = error.response.data + const token = Vue.ls.get(ACCESS_TOKEN) + + if (error.response.status === 403) { + console.log('服务器403啦,要重新登录!') + notification.error({ + message: 'Forbidden', + description: data.message + }) + } + if (error.response.status === 500) { + if (data.message.length > 0) { + message.error(data.message) + } + } + if (error.response.status === 401 && !(data.result && data.result.isLogin)) { + notification.error({ + message: 'Unauthorized', + description: 'Authorization verification failed' + }) + if (token) { + store.dispatch('Logout').then(() => { + setTimeout(() => { + window.location.reload() + }, 1500) + }) + } + } + } + return Promise.reject(error) +} + +// request interceptor +service.interceptors.request.use(config => { + const token = Vue.ls.get(ACCESS_TOKEN) + if (token) { + config.headers['Authorization'] = 'Bearer ' + token + } + return config +}, err) + +/** + * response interceptor + * 所有请求统一返回 + */ +service.interceptors.response.use(response => { + console.log(response) + if (response.request.responseType === 'blob') { + return response + } + const code = response.data.code + if (code === 1011006 || code === 1011007 || code === 1011008 || code === 1011009 || code === 401) { + Modal.error({ + title: '提示:', + content: response.data.message, + okText: '重新登录', + onOk: () => { + Vue.ls.remove(ACCESS_TOKEN) + window.location.reload() + } + }) + } else if (code === 1013002 || code === 1016002 || code === 1015002) { + message.error(response.data.message) + return response.data + } else { + return response.data + } +}, err) + +const installer = { + vm: {}, + install(Vue) { + Vue.use(VueAxios, service) + } +} + +export { installer as VueAxios, service as axios } diff --git a/src/views/main/ApplyJoinOperate/index.vue b/src/views/main/ApplyJoinOperate/index.vue new file mode 100644 index 0000000..ed12cab --- /dev/null +++ b/src/views/main/ApplyJoinOperate/index.vue @@ -0,0 +1,116 @@ + + + diff --git a/src/views/main/ApplyJoinOperate/initData.js b/src/views/main/ApplyJoinOperate/initData.js new file mode 100644 index 0000000..74f93c2 --- /dev/null +++ b/src/views/main/ApplyJoinOperate/initData.js @@ -0,0 +1,19 @@ +let cargoIdData = [ + { + name: "S 普通货", + code: "S", + }, + { + name: "R 冻柜", + code: "R", + }, + { + name: "D 危险品", + code: "D", + }, + { + name: "O 超限箱", + code: "O", + }, +]; +export { cargoIdData }; diff --git a/vue.config.js b/vue.config.js index 0bc1b0f..8fa49ce 100644 --- a/vue.config.js +++ b/vue.config.js @@ -47,9 +47,8 @@ const vueConfig = { externals: isProd ? assetsCDN.externals : {} }, - chainWebpack: (config) => { - config.resolve.alias - .set('@$', resolve('src')) + chainWebpack: config => { + config.resolve.alias.set('@$', resolve('src')) const svgRule = config.module.rule('svg') svgRule.uses.clear() @@ -94,14 +93,19 @@ const vueConfig = { devServer: { port: 82, proxy: { + // '/api': { + // target: process.env.VUE_APP_API_BASE_URL, + // ws: false, + // changeOrigin: true, + // pathRewrite: { + // '^/api': '' // 需要rewrite的, + // } + // }, '/api': { - target: process.env.VUE_APP_API_BASE_URL, - ws: false, - changeOrigin: true, - pathRewrite: { - '^/api': '' // 需要rewrite的, - } + target: 'http://47.104.222.4:8210', + changeOrigin: true }, + '/hubs': { target: process.env.VUE_APP_SOCKET_BASE_URL, ws: true,