Commit ece19fdf by crushh

update: dist

parent 5596d8fa
......@@ -15,4 +15,4 @@
document.write('<script src="//' + host + src + '"><\/script>');
})();
}</script><link href=/marketing/static/css/main.653b25b4495f23c4142d74090348791a.css rel=stylesheet></head><body><div id=app><div class=el-loading-spinner style="width: 98%;"><svg viewBox="25 25 50 50" class=circular><circle cx=50 cy=50 r=20 fill=none class=path></circle></svg></div></div><script src=//web-1251519181.file.myqcloud.com/components/pagination.1.0.8.js></script><script src=//web-1251519181.file.myqcloud.com/components/upload-file.1.0.10.js></script><script src=//web-1251519181.file.myqcloud.com/components/steps.1.0.1.js></script><script>console.log('marketing===>')
console.log(window)</script><script type=text/javascript src=/marketing/static/js/manifest.56ccb196d885fa915c4f.js></script><script type=text/javascript src=/marketing/static/js/vendor.b56ea0537cd15d963984.js></script><script type=text/javascript src=/marketing/static/js/main.7f750de37819ccb298e9.js></script></body></html>
\ No newline at end of file
console.log(window)</script><script type=text/javascript src=/marketing/static/js/manifest.067c9b63ce834fb6d67c.js></script><script type=text/javascript src=/marketing/static/js/vendor.f17f3d28b64b648f6606.js></script><script type=text/javascript src=/marketing/static/js/main.bdb1d54faf12f641a938.js></script></body></html>
\ No newline at end of file
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
!function(e){var n=window.webpackJsonp_marketing;window.webpackJsonp_marketing=function(r,a,o){for(var d,f,i,b=0,u=[];b<r.length;b++)f=r[b],t[f]&&u.push(t[f][0]),t[f]=0;for(d in a)Object.prototype.hasOwnProperty.call(a,d)&&(e[d]=a[d]);for(n&&n(r,a,o);u.length;)u.shift()();if(o)for(b=0;b<o.length;b++)i=c(c.s=o[b]);return i};var r={},t={24:0};function c(n){if(r[n])return r[n].exports;var t=r[n]={i:n,l:!1,exports:{}};return e[n].call(t.exports,t,t.exports,c),t.l=!0,t.exports}c.e=function(e){var n=t[e];if(0===n)return new Promise(function(e){e()});if(n)return n[2];var r=new Promise(function(r,c){n=t[e]=[r,c]});n[2]=r;var a=document.getElementsByTagName("head")[0],o=document.createElement("script");o.type="text/javascript",o.charset="utf-8",o.async=!0,o.timeout=12e4,c.nc&&o.setAttribute("nonce",c.nc),o.src=c.p+"static/js/"+({0:"card",1:"game",2:"wechat",3:"ecm",4:"message",5:"ewash",6:"scan",7:"recharge",8:"activity",9:"signIn",10:"evaluation",11:"cdKey",12:"popup",13:"msg",15:"calllog"}[e]||e)+"."+{0:"d2e66d7741b8f38c8558",1:"4cfd835d75d2c639d1f8",2:"e9c5839d7edcbaf2df0c",3:"ea6786113019e1d2c839",4:"2d43047a94aef3fd92d9",5:"3b8ece3c446bdb1e29ae",6:"9a995f0cdff670d4f8d3",7:"b1e91d850a61d38e523d",8:"8d9c6b1eac82ed1a52b3",9:"83c93bebb990c9076c7b",10:"da8008653f8c25addc3a",11:"7c2067b1ba786ef1b65c",12:"f1227cca53669d779b78",13:"3bd01eeb6f1b6fb0828d",14:"be1cafe3ca2469fe9bd5",15:"410d734e15e42bc183a8",16:"bae52ba46f4627791dd0",17:"c07a4f80838f39828899",18:"06bff57b96446d6498dc",19:"3e3263b6a2d044879e2b",20:"5dbfdb8d97c0910fdde0",21:"ad98c8e9d3749f2f1097"}[e]+".js";var d=setTimeout(f,12e4);function f(){o.onerror=o.onload=null,clearTimeout(d);var n=t[e];0!==n&&(n&&n[1](new Error("Loading chunk "+e+" failed.")),t[e]=void 0)}return o.onerror=o.onload=f,a.appendChild(o),r},c.m=e,c.c=r,c.d=function(e,n,r){c.o(e,n)||Object.defineProperty(e,n,{configurable:!1,enumerable:!0,get:r})},c.n=function(e){var n=e&&e.__esModule?function(){return e.default}:function(){return e};return c.d(n,"a",n),n},c.o=function(e,n){return Object.prototype.hasOwnProperty.call(e,n)},c.p="/marketing/",c.oe=function(e){throw console.error(e),e}}([]);
\ No newline at end of file
!function(e){var n=window.webpackJsonp_marketing;window.webpackJsonp_marketing=function(a,c,f){for(var o,d,i,u=0,s=[];u<a.length;u++)d=a[u],r[d]&&s.push(r[d][0]),r[d]=0;for(o in c)Object.prototype.hasOwnProperty.call(c,o)&&(e[o]=c[o]);for(n&&n(a,c,f);s.length;)s.shift()();if(f)for(u=0;u<f.length;u++)i=t(t.s=f[u]);return i};var a={},r={24:0};function t(n){if(a[n])return a[n].exports;var r=a[n]={i:n,l:!1,exports:{}};return e[n].call(r.exports,r,r.exports,t),r.l=!0,r.exports}t.e=function(e){var n=r[e];if(0===n)return new Promise(function(e){e()});if(n)return n[2];var a=new Promise(function(a,t){n=r[e]=[a,t]});n[2]=a;var c=document.getElementsByTagName("head")[0],f=document.createElement("script");f.type="text/javascript",f.charset="utf-8",f.async=!0,f.timeout=12e4,t.nc&&f.setAttribute("nonce",t.nc),f.src=t.p+"static/js/"+({0:"card",1:"game",2:"wechat",3:"ecm",4:"message",5:"ewash",6:"scan",7:"recharge",8:"activity",9:"signIn",10:"evaluation",11:"cdKey",12:"popup",14:"msg",15:"calllog"}[e]||e)+"."+{0:"68562117bf087859142c",1:"4d7ede94df31d8aad759",2:"77ec4e4917875503864a",3:"e0982f8f8d31394f5933",4:"aa94e46f21f4abae5525",5:"504c9c1e61b3136d44de",6:"08a8f648d3eb6cdfd809",7:"f799cdb668d061d63ef2",8:"452fe5d59ab4a2255618",9:"38c22467146bbe0e517d",10:"978eacfdb93a378af9a0",11:"00eaf68e0fd1f8a7a953",12:"87c77618589dac4ad187",13:"71d20c04b34d358c5266",14:"fa384b412906079f1fab",15:"4f45412cfff65d6206c2",16:"ed5f342f0a5aea18b61f",17:"acdd151cfa812d489179",18:"8db0cfec59f17b3d6b01",19:"f0bf9f86d20f3585f995",20:"31c63be331f438b34df2",21:"ad98c8e9d3749f2f1097"}[e]+".js";var o=setTimeout(d,12e4);function d(){f.onerror=f.onload=null,clearTimeout(o);var n=r[e];0!==n&&(n&&n[1](new Error("Loading chunk "+e+" failed.")),r[e]=void 0)}return f.onerror=f.onload=d,c.appendChild(f),a},t.m=e,t.c=a,t.d=function(e,n,a){t.o(e,n)||Object.defineProperty(e,n,{configurable:!1,enumerable:!0,get:a})},t.n=function(e){var n=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(n,"a",n),n},t.o=function(e,n){return Object.prototype.hasOwnProperty.call(e,n)},t.p="/marketing/",t.oe=function(e){throw console.error(e),e}}([]);
\ No newline at end of file
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
import config from '@/config';
import { log } from '@/utils';
import qs from 'qs';
import axios from 'axios';
// eslint-disable-next-line
......@@ -13,6 +13,8 @@ import Vue from 'vue';
*
*/
// 加载最小时间
const MINI_TIME = 300;
// 超时时间
// 环境value
// eslint-disable-next-line
......@@ -20,15 +22,39 @@ let _isDev = process.env.NODE_ENV === 'development';
// 请求接口host
let _apiHost = config.api;
// 请求组(判断当前请求数)
let _requests = [];
axios.defaults.baseURL = _apiHost;
// 创建一个请求实例
/**
* 添加请求,显示loading
* @param {请求配置} config
*/
function pushRequest(config) {
log(`${config.url}--begin`);
_requests.push(config);
}
/**
* 移除请求,无请求时关闭loading
* @param {请求配置} config
*/
function popRequest(config) {
log(`${config.url}--end`);
let _index = _requests.findIndex(r => {
return r === config;
});
if (_index > -1) {
_requests.splice(_index, 1);
}
}
/**
* 错误的处理
* @param {*} code
* @param {string} [message='请求错误']
*/
function handlerErr(code, message = '请求错误') {
function handlerErr(code, message = '请求错误', alertError = true) {
switch (code) {
// case 404:
// message = '404,错误请求';
......@@ -61,16 +87,20 @@ function handlerErr(code, message = '请求错误') {
message = '网关错误';
break;
}
Vue.prototype.$tips({ type: 'warning', message: message });
if (alertError) {
// eslint-disable-next-line
Vue.prototype.$tips({ type: 'warning', message: message });
}
}
const pendingRequest = new Map();
/**
* 请求地址,请求数据,是否静默,请求方法
*/
const requests = (url, data = {}, contentTypeIsJSON = false, isSilence = false, method = 'POST', urlData) => {
const requests = (url, data = {}, contentTypeIsJSON = false, isSilence = false, method = 'POST', alertError = true) => {
let _opts = { method, url };
let _timer = null;
// 如果用户没有开启权限 从参数中删除showSelfFlag
if (!store.state.marketing.openFlag) {
delete data.showSelfFlag;
......@@ -79,26 +109,52 @@ const requests = (url, data = {}, contentTypeIsJSON = false, isSilence = false,
if (contentTypeIsJSON) {
_opts.data = data;
_opts.headers = { 'Content-Type': 'application/json' };
_opts.url += urlData ? '?requestProject=marketing' + urlData : '?requestProject=marketing';
_opts.url += '?requestProject=marketing';
} else {
_opts.data = qs.stringify(Object.assign({ requestProject: 'gic-web' }, data));
}
} else {
_opts.params = Object.assign({ requestProject: 'gic-web' }, data);
}
let key = JSON.stringify(_opts);
if (!pendingRequest.has(key)) {
pendingRequest.set(key, Date.now());
} else if (Date.now() - pendingRequest.get(key) > 1000) {
pendingRequest.delete(key);
} else {
return Promise.reject();
}
return new Promise((resolve, reject) => {
let _random = { stamp: Date.now(), url: `${_apiHost + url}` };
if (!isSilence) {
_timer = setTimeout(() => {
pushRequest(_random);
}, MINI_TIME);
}
_opts.headers = Object.assign({}, _opts.headers || {}, { sign: localStorage.getItem('sign') }); // 加入自定义请求头
axios(_opts)
.then(res => {
if (res.data.code != 0 && res.data.errorCode !== 0) {
clearTimeout(_timer);
popRequest(_random);
if (res.data.errorCode !== 0 && res.data.code != 0) {
reject(res);
if (res.data.message.indexOf('抱歉') >= 0) {
Vue.prototype.$alert(res.data.message, '提示');
} else {
handlerErr(res.data.errorCode, res.data.message, alertError);
}
} else {
resolve(res.data);
}
})
.catch(res => {
clearTimeout(_timer);
popRequest(_random);
pendingRequest.delete(key);
if (res) {
handlerErr('接口异常');
handlerErr(res.response.status, '接口异常', alertError);
}
reject(res);
});
......
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