From dcacdc49792a3998bead7489fdfc2a26b2345036 Mon Sep 17 00:00:00 2001 From: jinna Date: Fri, 18 Aug 2023 16:10:32 +0800 Subject: [PATCH] =?UTF-8?q?=E8=AE=A2=E5=8D=95=E7=AE=A1=E7=90=86=E4=B8=8E?= =?UTF-8?q?=E6=8A=A5=E5=90=8D=E5=8D=95=E7=AE=A1=E7=90=86=E9=A1=B5=E9=9D=A2?= =?UTF-8?q?=E5=BC=80=E5=8F=91=EF=BC=8C=E5=AF=B9=E6=8E=A5=E5=BF=AB=E9=80=92?= =?UTF-8?q?100=E6=8E=A5=E5=8F=A3=E6=9F=A5=E7=9C=8B=E5=BF=AB=E9=80=92?= =?UTF-8?q?=E8=BF=9B=E5=BA=A6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/order/order.js | 13 + src/router/axios.js | 140 ++-- src/views/order/index.vue | 906 +++++++++++++++++++++++++ src/views/statistics/index.vue | 1130 ++++++++++++------------------- src/views/statistics/index1.vue | 984 +++++++++++++++++++++++++++ vue.config.js | 8 + 6 files changed, 2436 insertions(+), 745 deletions(-) create mode 100644 src/api/order/order.js create mode 100644 src/views/order/index.vue create mode 100644 src/views/statistics/index1.vue 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 @@ + + + + + + diff --git a/src/views/statistics/index.vue b/src/views/statistics/index.vue index e056959..1ee13cd 100644 --- a/src/views/statistics/index.vue +++ b/src/views/statistics/index.vue @@ -16,7 +16,7 @@ @size-change="sizeChange" @refresh-change="refreshChange" > - + + + - +
{{(scope.row.province ? scope.row.province : '') + (scope.row.city ? scope.row.city : '') + (scope.row.district ? scope.row.district : '') + (scope.row.detail ? scope.row.detail : '')}}
+ -
{{ checkaccept.username }}
+
{{checkaccept.username}}
@@ -151,119 +159,71 @@ -
{{ checkaccept.height }}
+
{{ checkaccept.height }}
-
{{ checkaccept.weight }}
+
{{ checkaccept.weight }}
{{ checkaccept.position }}
-
- {{ - checkaccept.sleepingPosture == 1 - ? "仰睡" - : checkaccept.sleepingPosture == 2 - ? "侧睡" - : "" - }} +
+ {{ checkaccept.sleepingPosture == 1 ? '仰睡' : checkaccept.sleepingPosture == 2 ? '侧睡' : '' }}
-
-
- {{ - checkaccept.pillowHardness == 1 - ? "偏硬" - : checkaccept.pillowHardness == 2 - ? "适中" - : checkaccept.pillowHardness == 3 - ? "偏软" - : "" - }} -
+
+
{{ checkaccept.pillowHardness == 1 ? '偏硬' : checkaccept.pillowHardness == 2 ? '适中' : checkaccept.pillowHardness == 3 ? '偏软' : '' }}
-
-
- {{ - checkaccept.pillowMaterial == 1 - ? "羽丝绒枕" - : checkaccept.pillowMaterial == 2 - ? "草本植物枕(荞麦、决明子等)" - : checkaccept.pillowMaterial == 3 - ? "乳胶枕" - : checkaccept.pillowMaterial == 4 - ? "慢回弹记忆枕" - : checkaccept.pillowMaterial == 5 - ? "软管枕" - : checkaccept.pillowMaterial == 6 - ? "其他" - : "" - }} -
+
+
{{ checkaccept.pillowMaterial == 1 ? '羽丝绒枕' : checkaccept.pillowMaterial == 2 ? '草本植物枕(荞麦、决明子等)' : checkaccept.pillowMaterial == 3 ? '乳胶枕' : checkaccept.pillowMaterial == 4 ? '慢回弹记忆枕' : checkaccept.pillowMaterial == 5 ? '软管枕' : checkaccept.pillowMaterial == 6 ? '其他' : '' }}
-
-
- {{ - checkaccept.neckShoulderWidth == "-1" - ? "" - : checkaccept.neckShoulderWidth - }} -
+
+
{{ checkaccept.neckShoulderWidth == '-1' ? '' : checkaccept.neckShoulderWidth }}
-
-
- {{ checkaccept.neckLength == "-1" ? "" : checkaccept.neckLength }} -
+
+
{{ checkaccept.neckLength == '-1' ? '' : checkaccept.neckLength }}
-
+
{{ checkaccept.ageRange }}
-
+
{{ checkaccept.sleepLength }}
-
-
- {{ - checkaccept.cervicalVertebra == 1 - ? "是" - : checkaccept.cervicalVertebra == 0 - ? "否" - : "" - }} -
+
+
{{ checkaccept.cervicalVertebra == 1 ? '是' : checkaccept.cervicalVertebra == 0 ? '否' : '' }}
-
+
{{ checkaccept.otherNeed }}
@@ -275,19 +235,19 @@ - diff --git a/src/views/statistics/index1.vue b/src/views/statistics/index1.vue new file mode 100644 index 0000000..e056959 --- /dev/null +++ b/src/views/statistics/index1.vue @@ -0,0 +1,984 @@ + + + + + + diff --git a/vue.config.js b/vue.config.js index 134f6f4..ec32c70 100644 --- a/vue.config.js +++ b/vue.config.js @@ -36,6 +36,14 @@ module.exports = { "^/api": "/", }, }, + "/pollApi": { + //本地服务接口地址 + target: "https://poll.kuaidi100.com", + ws: true, + pathRewrite: { + "/pollApi": "/", + }, + }, }, }, };