From d8d3157e87af00b886a5981fbdff7c30f601002d Mon Sep 17 00:00:00 2001 From: smallwei <1634566606@qq.com> Date: Fri, 15 Feb 2019 15:43:41 +0800 Subject: [PATCH] feat axios config --- build.sh | 7 +++++++ src/config/website.js | 2 +- src/router/axios.js | 4 ++-- 3 files changed, 10 insertions(+), 3 deletions(-) create mode 100755 build.sh diff --git a/build.sh b/build.sh new file mode 100755 index 0000000..193884a --- /dev/null +++ b/build.sh @@ -0,0 +1,7 @@ +#!/bin/bash + +echo "打包文件" +yarn build +echo "传输文件" +scp -r ./dist/** pig@139.224.200.249:/data/avue/sword +echo "部署成功" \ No newline at end of file diff --git a/src/config/website.js b/src/config/website.js index 325e918..56571d0 100644 --- a/src/config/website.js +++ b/src/config/website.js @@ -9,7 +9,7 @@ export default { lockPage: '/lock', tokenTime: 6000, //http的status默认放行不才用统一处理的, - statusWhiteList: [400], + statusWhiteList: [], //配置首页不可关闭 isFirstPage: false, fistPage: { diff --git a/src/router/axios.js b/src/router/axios.js index 0774561..75ee549 100644 --- a/src/router/axios.js +++ b/src/router/axios.js @@ -44,9 +44,9 @@ axios.interceptors.request.use(config => { //HTTPresponse拦截 axios.interceptors.response.use(res => { NProgress.done(); - const status = Number(res.status) || 200; + const status = res.data.code || 200 const statusWhiteList = website.statusWhiteList || []; - const message = res.data.message || '未知错误'; + const message = res.data.msg || '未知错误'; //如果在白名单里则自行catch逻辑处理 if (statusWhiteList.includes(status)) return Promise.reject(res); //如果是401则跳转到登录页面