diff --git a/src/api/order/order.js b/src/api/order/order.js
new file mode 100644
index 0000000..8fb7409
--- /dev/null
+++ b/src/api/order/order.js
@@ -0,0 +1,13 @@
+import request from "@/router/axios";
+//查询物流信息
+export const getWuliuInfo = (param) => {
+ return request({
+ url: "/pollApi/poll/query.do",
+ // url: "https://poll.kuaidi100.com/poll/query.do",
+ method: "post",
+ headers: {
+ "Content-Type": "application/x-www-form-urlencoded",
+ },
+ params: param,
+ });
+};
diff --git a/src/router/axios.js b/src/router/axios.js
index c2b9f7b..c58f770 100644
--- a/src/router/axios.js
+++ b/src/router/axios.js
@@ -5,18 +5,18 @@
* isSerialize是否开启form表单提交
* isToken是否需要token
*/
-import axios from 'axios';
-import store from '@/store/';
-import router from '@/router/router';
-import {serialize} from '@/util/util';
-import {getToken} from '@/util/auth';
-import {Message} from 'element-ui';
-import {isURL} from "@/util/validate";
-import website from '@/config/website';
-import {Base64} from 'js-base64';
-import { baseUrl } from '@/config/env';
-import NProgress from 'nprogress';
-import 'nprogress/nprogress.css';
+import axios from "axios";
+import store from "@/store/";
+import router from "@/router/router";
+import { serialize } from "@/util/util";
+import { getToken } from "@/util/auth";
+import { Message } from "element-ui";
+import { isURL } from "@/util/validate";
+import website from "@/config/website";
+import { Base64 } from "js-base64";
+import { baseUrl } from "@/config/env";
+import NProgress from "nprogress";
+import "nprogress/nprogress.css";
//默认超时时间
axios.defaults.timeout = 10000;
@@ -28,63 +28,73 @@ axios.defaults.validateStatus = function (status) {
axios.defaults.withCredentials = true;
// NProgress 配置
NProgress.configure({
- showSpinner: false
+ showSpinner: false,
});
//http request拦截
-axios.interceptors.request.use(config => {
- //开启 progress bar
- NProgress.start();
- //地址为已经配置状态则不添加前缀
- if (!isURL(config.url) && !config.url.startsWith(baseUrl)) {
- config.url = baseUrl + config.url
+axios.interceptors.request.use(
+ (config) => {
+ //开启 progress bar
+ NProgress.start();
+ //地址为已经配置状态则不添加前缀
+ console.log(baseUrl);
+ // if (!isURL(config.url) && !config.url.startsWith(baseUrl)) {
+ // config.url = baseUrl + config.url;
+ // }
+ //headers判断是否需要
+ const authorization = config.authorization === false;
+ if (!authorization) {
+ config.headers["Authorization"] = `Basic ${Base64.encode(
+ `${website.clientId}:${website.clientSecret}`
+ )}`;
+ }
+ //让每个请求携带token
+ const meta = config.meta || {};
+ const isToken = meta.isToken === false;
+ if (getToken() && !isToken) {
+ config.headers[website.tokenHeader] = "bearer " + getToken();
+ }
+ //headers中配置text请求
+ if (config.text === true) {
+ config.headers["Content-Type"] = "text/plain";
+ }
+ //headers中配置serialize为true开启序列化
+ if (config.method === "post" && meta.isSerialize === true) {
+ config.data = serialize(config.data);
+ }
+ return config;
+ },
+ (error) => {
+ return Promise.reject(error);
}
- //headers判断是否需要
- const authorization = config.authorization === false;
- if (!authorization) {
- config.headers['Authorization'] = `Basic ${Base64.encode(`${website.clientId}:${website.clientSecret}`)}`;
- }
- //让每个请求携带token
- const meta = (config.meta || {});
- const isToken = meta.isToken === false;
- if (getToken() && !isToken) {
- config.headers[website.tokenHeader] = 'bearer ' + getToken()
- }
- //headers中配置text请求
- if (config.text === true) {
- config.headers["Content-Type"] = "text/plain";
- }
- //headers中配置serialize为true开启序列化
- if (config.method === 'post' && meta.isSerialize === true) {
- config.data = serialize(config.data);
- }
- return config
-}, error => {
- return Promise.reject(error)
-});
+);
//http response 拦截
-axios.interceptors.response.use(res => {
- //关闭 progress bar
- NProgress.done();
- //获取状态码
- const status = res.data.code || res.status;
- const statusWhiteList = website.statusWhiteList || [];
- const message = res.data.msg || res.data.error_description || '未知错误';
- //如果在白名单里则自行catch逻辑处理
- if (statusWhiteList.includes(status)) return Promise.reject(res);
- //如果是401则跳转到登录页面
- if (status === 401) store.dispatch('FedLogOut').then(() => router.push({path: '/login'}));
- // 如果请求为非200否者默认统一处理
- if (status !== 200) {
- Message({
- message: message,
- type: 'error'
- });
- return Promise.reject(new Error(message))
+axios.interceptors.response.use(
+ (res) => {
+ //关闭 progress bar
+ NProgress.done();
+ //获取状态码
+ const status = res.data.code || res.status;
+ const statusWhiteList = website.statusWhiteList || [];
+ const message = res.data.msg || res.data.error_description || "未知错误";
+ //如果在白名单里则自行catch逻辑处理
+ if (statusWhiteList.includes(status)) return Promise.reject(res);
+ //如果是401则跳转到登录页面
+ if (status === 401)
+ store.dispatch("FedLogOut").then(() => router.push({ path: "/login" }));
+ // 如果请求为非200否者默认统一处理
+ if (status !== 200) {
+ Message({
+ message: message,
+ type: "error",
+ });
+ return Promise.reject(new Error(message));
+ }
+ return res;
+ },
+ (error) => {
+ NProgress.done();
+ return Promise.reject(new Error(error));
}
- return res;
-}, error => {
- NProgress.done();
- return Promise.reject(new Error(error));
-});
+);
export default axios;
diff --git a/src/views/order/index.vue b/src/views/order/index.vue
new file mode 100644
index 0000000..6603b8a
--- /dev/null
+++ b/src/views/order/index.vue
@@ -0,0 +1,906 @@
+
+
+ 请选择快递公司: 请输入快递单号: 物流信息: 查看物流信息 {{activity.status == '揽收' ? '已揽件' : activity.status == '运输中' ? '运输中' : activity.status == '派件' ? '派件中' : activity.status == '投柜或驿站' ? '投柜或驿站' : ''}} {{activity.context}}