123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475 |
- "use strict";
- function _instanceof(left, right) { if (right != null && typeof Symbol !== "undefined" && right[Symbol.hasInstance]) { return !!right[Symbol.hasInstance](left); } else { return left instanceof right; } }
- var imgUrl = 'https://cmcoa.oss-cn-shanghai.aliyuncs.com/';
- var apiUrl = 'http://api.inet.cmcinc.cn/';
- var service = axios.create({
- baseURL: apiUrl,
- timeout: 90000
- });
- service.interceptors.request.use(function (config) {
-
-
-
-
-
-
- var data = {
- 'from': 0,
- 'page': 1,
- 'rows': 10,
- 'userId': Cookies.get('userId'),
- 'sidx': '',
- 'sord': '',
- 'token': '',
- 'reqdata': {}
- };
- _instanceof(config.data, FormData) || (config.data = Object.assign(data, config.data));
-
- return config;
- }, function (error) {
- Promise.reject(error);
- });
- service.interceptors.response.use(function (res) {
- console.log(res);
- return new Promise(function (resolve, reject) {
- if (res.data.state === 206) {
-
- alert(206);
- reject(res.data.msg);
- } else if (res.status === 200) {
-
- if (res.data.state !== 100) {
- reject(res.data.msg);
- } else {
- resolve(res.data);
- }
- } else {
-
-
-
-
-
-
-
- reject(res);
- }
- });
- }, function (error) {
- console.log(error);
-
-
-
-
-
-
-
-
-
-
- });
|