Commit 46ef3e60 by liguokang

feat: 🎨

parent 58976512
import Vue from 'vue';
import axios from 'axios'; import axios from 'axios';
import User from '../core/user'; import { load as cookieLoad, save as cookieSave } from 'react-cookies';
// 创建axios实例 // 创建axios实例
let serverPath = window.CONFIG.server; let serverPath = window.CONFIG.server;
...@@ -16,7 +16,7 @@ const service = axios.create({ ...@@ -16,7 +16,7 @@ const service = axios.create({
// request拦截器 // request拦截器
service.interceptors.request.use( service.interceptors.request.use(
(config) => { (config) => {
if (config.url.indexOf('public/') === -1 && User.token()) { if (config.url.indexOf('public/') === -1 && cookieLoad('token')) {
return config; return config;
} else if (config.headers.module) { } else if (config.headers.module) {
const url = JSON.parse(JSON.stringify(config.url)); const url = JSON.parse(JSON.stringify(config.url));
...@@ -118,9 +118,5 @@ function processHttpError(response) { ...@@ -118,9 +118,5 @@ function processHttpError(response) {
errorInfo: message, errorInfo: message,
path: response.config.url, path: response.config.url,
}); });
Vue.$wheatToast({
message: message,
position: 'middle',
});
} }
export default service; export default service;
...@@ -2,13 +2,14 @@ ...@@ -2,13 +2,14 @@
* @Author: liguokang * @Author: liguokang
* @Date: 2021-07-14 20:36:28 * @Date: 2021-07-14 20:36:28
* @LastEditors: liguokang * @LastEditors: liguokang
* @LastEditTime: 2021-07-27 20:57:22 * @LastEditTime: 2021-07-29 14:43:14
* @Description: * @Description:
* @Copyrigh: ©2021 杭州杰竞科技有限公司 版权所有 * @Copyrigh: ©2021 杭州杰竞科技有限公司 版权所有
*/ */
const withLessExcludeAntd = require('./next-less.config.js'); const withLessExcludeAntd = require('./next-less.config.js');
const path = require('path'); const path = require('path');
const webpack = require('webpack');
if (typeof require !== 'undefined') { if (typeof require !== 'undefined') {
require.extensions['.less'] = (file) => {}; require.extensions['.less'] = (file) => {};
...@@ -32,6 +33,13 @@ module.exports = withLessExcludeAntd({ ...@@ -32,6 +33,13 @@ module.exports = withLessExcludeAntd({
config.resolve.alias['@'] = path.join(__dirname, 'common'); config.resolve.alias['@'] = path.join(__dirname, 'common');
config.resolve.alias['components'] = path.join(__dirname, 'components'); config.resolve.alias['components'] = path.join(__dirname, 'components');
config.resolve.alias['static'] = path.join(__dirname, 'static'); config.resolve.alias['static'] = path.join(__dirname, 'static');
config.plugins.push(
new webpack.DefinePlugin({
'process.env': {
DEPLOY_ENV: JSON.stringify(process.env.DEPLOY_ENV),
},
}),
);
return config; return config;
}, },
}); });
...@@ -2256,25 +2256,23 @@ ...@@ -2256,25 +2256,23 @@
} }
}, },
"cross-env": { "cross-env": {
"version": "5.2.1", "version": "7.0.3",
"resolved": "https://registry.nlark.com/cross-env/download/cross-env-5.2.1.tgz", "resolved": "https://registry.nlark.com/cross-env/download/cross-env-7.0.3.tgz",
"integrity": "sha1-ssdsHKet1m3IdNEXmEZglPVRs00=", "integrity": "sha1-hlJkspZ33AFbqEGJGJZd0jL8VM8=",
"dev": true, "dev": true,
"requires": { "requires": {
"cross-spawn": "^6.0.5" "cross-spawn": "^7.0.1"
} }
}, },
"cross-spawn": { "cross-spawn": {
"version": "6.0.5", "version": "7.0.3",
"resolved": "https://registry.nlark.com/cross-spawn/download/cross-spawn-6.0.5.tgz", "resolved": "https://registry.nlark.com/cross-spawn/download/cross-spawn-7.0.3.tgz",
"integrity": "sha1-Sl7Hxk364iw6FBJNus3uhG2Ay8Q=", "integrity": "sha1-9zqFudXUHQRVUcF34ogtSshXKKY=",
"dev": true, "dev": true,
"requires": { "requires": {
"nice-try": "^1.0.4", "path-key": "^3.1.0",
"path-key": "^2.0.1", "shebang-command": "^2.0.0",
"semver": "^5.5.0", "which": "^2.0.1"
"shebang-command": "^1.2.0",
"which": "^1.2.9"
} }
}, },
"crypto-browserify": { "crypto-browserify": {
...@@ -5256,12 +5254,6 @@ ...@@ -5256,12 +5254,6 @@
} }
} }
}, },
"nice-try": {
"version": "1.0.5",
"resolved": "https://registry.nlark.com/nice-try/download/nice-try-1.0.5.tgz",
"integrity": "sha1-ozeKdpbOfSI+iPybdkvX7xCJ42Y=",
"dev": true
},
"node-fetch": { "node-fetch": {
"version": "2.6.1", "version": "2.6.1",
"resolved": "https://registry.nlark.com/node-fetch/download/node-fetch-2.6.1.tgz?cache=0&other_urls=https%3A%2F%2Fregistry.nlark.com%2Fnode-fetch%2Fdownload%2Fnode-fetch-2.6.1.tgz", "resolved": "https://registry.nlark.com/node-fetch/download/node-fetch-2.6.1.tgz?cache=0&other_urls=https%3A%2F%2Fregistry.nlark.com%2Fnode-fetch%2Fdownload%2Fnode-fetch-2.6.1.tgz",
...@@ -5775,9 +5767,9 @@ ...@@ -5775,9 +5767,9 @@
"dev": true "dev": true
}, },
"path-key": { "path-key": {
"version": "2.0.1", "version": "3.1.1",
"resolved": "https://registry.nlark.com/path-key/download/path-key-2.0.1.tgz", "resolved": "https://registry.nlark.com/path-key/download/path-key-3.1.1.tgz",
"integrity": "sha1-QRyttXTFoUDTpLGRDUDYDMn0C0A=", "integrity": "sha1-WB9q3mWMu6ZaDTOA3ndTKVBU83U=",
"dev": true "dev": true
}, },
"path-parse": { "path-parse": {
...@@ -7323,18 +7315,18 @@ ...@@ -7323,18 +7315,18 @@
"integrity": "sha1-GI1SHelbkIdAT9TctosT3wrk5/g=" "integrity": "sha1-GI1SHelbkIdAT9TctosT3wrk5/g="
}, },
"shebang-command": { "shebang-command": {
"version": "1.2.0", "version": "2.0.0",
"resolved": "https://registry.nlark.com/shebang-command/download/shebang-command-1.2.0.tgz", "resolved": "https://registry.nlark.com/shebang-command/download/shebang-command-2.0.0.tgz",
"integrity": "sha1-RKrGW2lbAzmJaMOfNj/uXer98eo=", "integrity": "sha1-zNCvT4g1+9wmW4JGGq8MNmY/NOo=",
"dev": true, "dev": true,
"requires": { "requires": {
"shebang-regex": "^1.0.0" "shebang-regex": "^3.0.0"
} }
}, },
"shebang-regex": { "shebang-regex": {
"version": "1.0.0", "version": "3.0.0",
"resolved": "https://registry.npm.taobao.org/shebang-regex/download/shebang-regex-1.0.0.tgz", "resolved": "https://registry.npm.taobao.org/shebang-regex/download/shebang-regex-3.0.0.tgz",
"integrity": "sha1-2kL0l0DAtC2yypcoVxyxkMmO/qM=", "integrity": "sha1-rhbxZE2HPsrYQ7AwexQzYtTEIXI=",
"dev": true "dev": true
}, },
"shell-quote": { "shell-quote": {
...@@ -8732,9 +8724,9 @@ ...@@ -8732,9 +8724,9 @@
} }
}, },
"which": { "which": {
"version": "1.3.1", "version": "2.0.2",
"resolved": "https://registry.nlark.com/which/download/which-1.3.1.tgz", "resolved": "https://registry.nlark.com/which/download/which-2.0.2.tgz",
"integrity": "sha1-pFBD1U9YBTFtqNYvn1CRjT2nCwo=", "integrity": "sha1-fGqN0KY2oDJ+ELWckobu6T8/UbE=",
"dev": true, "dev": true,
"requires": { "requires": {
"isexe": "^2.0.0" "isexe": "^2.0.0"
......
...@@ -6,6 +6,10 @@ ...@@ -6,6 +6,10 @@
"build": "next build", "build": "next build",
"export": "npm run build && next export", "export": "npm run build && next export",
"start": "next start", "start": "next start",
"build:dev": "cross-env DEPLOY_ENV=dev npm run build",
"build:rc": "cross-env DEPLOY_ENV=rc npm run build",
"build:gray": "cross-env DEPLOY_ENV=gray npm run build",
"build:prod": "cross-env DEPLOY_ENV=prod npm run build",
"prepare": "husky install", "prepare": "husky install",
"precommit": "pretty-quick --staged" "precommit": "pretty-quick --staged"
}, },
...@@ -32,11 +36,12 @@ ...@@ -32,11 +36,12 @@
"@commitlint/config-conventional": "^13.1.0", "@commitlint/config-conventional": "^13.1.0",
"@types/react": "^17.0.9", "@types/react": "^17.0.9",
"commitlint-config-cz": "^0.13.2", "commitlint-config-cz": "^0.13.2",
"cross-env": "^5.2.0", "cross-env": "^7.0.2",
"husky": "^7.0.1", "husky": "^7.0.1",
"lint-staged": "^11.1.1", "lint-staged": "^11.1.1",
"prettier": "2.3.2", "prettier": "2.3.2",
"pretty-quick": "^3.1.1", "pretty-quick": "^3.1.1",
"react-cookies": "^0.1.1",
"typescript": "^4.3.2", "typescript": "^4.3.2",
"webpack": "^4.37.0", "webpack": "^4.37.0",
"webpack-bundle-analyzer": "^3.3.2" "webpack-bundle-analyzer": "^3.3.2"
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment