Commit 195ea91a authored by superman's avatar superman

修改IE9 BUG

parent 1378803d
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
function fetch(query, panel) { function fetch(query, panel) {
const data = {...query, p: (parseInt(query.p, 10) || 1) - 1}; const data = {...query, p: (parseInt(query.p, 10) || 1) - 1};
request('/api/1.0/prod/hList.json', data).then(({hasNext, items})=> { request('/api/1.0/prod/hList.json', data).done(({hasNext, items})=> {
if (items && items.length) { if (items && items.length) {
let html = items.map(item=> { let html = items.map(item=> {
return `<li data-id="${item.id}" class="product-item status-${item.status}"> return `<li data-id="${item.id}" class="product-item status-${item.status}">
...@@ -49,13 +49,13 @@ function fetch(query, panel) { ...@@ -49,13 +49,13 @@ function fetch(query, panel) {
$('.pagination', panel).html(pagination.join('')); $('.pagination', panel).html(pagination.join(''));
history.replaceState && history.replaceState(null, null, location.pathname + '?' + serialize(query)); history.replaceState && history.replaceState(null, null, location.pathname + '?' + serialize(query));
} }
}).catch(err=> { }).fail(err=> {
console.log(err); console.log(err);
}); });
} }
function fetchCates(query) { function fetchCates(query) {
request('/api/1.0/cate/cates.json').then(({pCates})=> { request('/api/1.0/cate/cates.json').done(({pCates})=> {
const cates = []; const cates = [];
pCates.unshift({ pCates.unshift({
name: '全部', name: '全部',
......
...@@ -63,9 +63,9 @@ ...@@ -63,9 +63,9 @@
request('/api/1.0/proj/add.json', { request('/api/1.0/proj/add.json', {
mobile, mobile,
description description
}, 'POST').then(()=> { }, 'POST').done(()=> {
$successDialog.fadeIn(300); $successDialog.fadeIn(300);
}).catch(()=> { }).fail(()=> {
alert('提交失败, 请稍后再试!'); alert('提交失败, 请稍后再试!');
}); });
$introducerMobile.val(''); $introducerMobile.val('');
......
function request(url, data, method = 'GET') { function request(url, data, method = 'GET') {
return new Promise((resolve, reject)=> { let promise = $.Deferred();
$.ajax(url, { $.ajax(url, {
type: method, type: method,
dataType: 'json', dataType: 'json',
data, data,
success: res=> { success: res=> {
if (res && res.status == 1) { if (res && res.status == 1) {
resolve(res.result); promise.resolve(res.result);
} else { } else {
reject({ promise.reject({
code: res && res.code || 0, code: res && res.code || 0,
message: res && res.msg || res.message || '系统错误,请稍后再试!' message: res && res.msg || res.message || '系统错误,请稍后再试!'
}); });
...@@ -16,15 +16,17 @@ function request(url, data, method = 'GET') { ...@@ -16,15 +16,17 @@ function request(url, data, method = 'GET') {
}, },
error: (xhr, status, text)=> { error: (xhr, status, text)=> {
console.log(xhr, status, text); console.log(xhr, status, text);
reject({ promise.reject({
code: xhr && xhr.status || status, code: xhr && xhr.status || status,
message: text message: text
}); });
} }
}); });
}); return promise;
} }
function formatMoney(money = 0) { function formatMoney(money = 0) {
let ret; let ret;
if (isNaN(money)) { if (isNaN(money)) {
......
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