1let baseUrl = "https://wcweb.gigadevice.com"; 2let bUrl = "https://wcweb.gigadevice.com"; 3 4// é¢åå¸ç¯å¢ 5// let baseUrl = "https://wcwebtest.gigadevice.com"; 6// let bUrl = "https://wcwebtest.gigadevice.com"; 7 8if(['adminui2en.bju-pro.com','zhaoyi.test3.yongsy.net','enzhaoyi.test3.yongsy.net'].includes(location.host)) { 9 baseUrl = "http://zycxweb.bju-pro.com"; //ç¨äºæ¼æ¥ä¹å请æ±çurl 10 bUrl = "https://enzhaoyi.test3.yongsy.net" 11} else if (['test_subscription.gigadevice.com'].includes(location.host)) { 12 baseUrl = "https://wcwebtest.gigadevice.com"; 13 bUrl = "https://wcwebtest.gigadevice.com"; 14} 15export { baseUrl, bUrl }; 16export default (params,header = {}) => { 17 const { url, data, method = 'GET', type='wc' } = params; 18 let requestData = data; 19 let headers = { 20 'X-TOKEN': $.cookie('token'), // èªå®ä¹è¯·æ±å¤´ 21 'X-LANG': 'en', // 䏿zh,è±æen 22 "Content-Type": "application/json;charset=utf8", 23 }; 24 let dataType = "json"; 25 let newUrl = baseUrl+url; 26 if(type === 'wc') { 27 // æ ¹æ®è¯·æ±æ¹æ³å¤çæ°æ® 28 requestData = method === 'GET' ? data : JSON.stringify(data); 29 } 30 if(type === 'yongxi') { 31 newUrl = bUrl+url; 32 headers = { 33 "Content-Type": "application/x-www-form-urlencoded;charset=utf8", 34 }; 35 // æ ¹æ®è¯·æ±æ¹æ³å¤çæ°æ® 36 requestData = data; 37 } 38 headers = { 39 ...headers, 40 ...header 41 } 42 43 return new Promise((resolve, reject) => { 44 $.ajax({
45 url: newUrl, 46 type: method, 47 async: true, // å§ç»å¼æ¥ 48 dataType, 49 data: requestData, 50 headers, 51 success: function (ret) { 52 if (ret.code === 200) { 53 resolve(ret); 54 } else if(ret.code === 401 || ret.code === 40101) { 55 // å¤çæªç»å½ 56 setTimeout(() => { 57 $.removeCookie('token', { path: '/' }); 58 $.removeCookie('loginEmail', { path: '/' }); 59 $.removeCookie('userName', { path: '/' }); 60 $.removeCookie('token'); 61 $.removeCookie('loginEmail'); 62 var loginPath = location.pathname.indexOf('/EN/') === 0 ? '/EN/mygd/login.html' : '/mygd/login.html'; 63 window.location.href = loginPath + '?redirect=' + encodeURIComponent(location.pathname); 64 }, 500); 65 // reject(new Error('Please log in first!')); 66 } else { 67 resolve(ret); 68 // reject(new Error('æå¡å¨è¿åé误代ç : ' + ret.code)); 69 } 70 }, 71 error: function (jqXHR, textStatus, errorThrown) { 72 // HTTP 401 æªç»å½æ token è¿æï¼è·³è½¬ç»å½ 73 if (jqXHR.status === 401) { 74 setTimeout(() => { 75 $.removeCookie('token', { path: '/' }); 76 $.removeCookie('loginEmail', { path: '/' }); 77 $.removeCookie('userName', { path: '/' }); 78 $.removeCookie('token'); 79 $.removeCookie('loginEmail'); 80 var loginPath = location.pathname.indexOf('/EN/') === 0 ? '/EN/mygd/login.html' : '/mygd/login.html'; 81 window.location.href = loginPath + '?redirect=' + encodeURIComponent(location.pathname); 82 }, 300); 83 reject(new Error('Not logged in or login expired, please log in again')); 84 } else if (jqXHR.status === 0) { 85 reject(new Error('Network error or CORS issue')); 86 } else { 87 reject(new Error('HTTP ERROR: ' + jqXHR.status + ' - ' + errorThrown)); 88 } 89 }, 90 }); 91 }); 92}
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.