Commit 195ea91a authored by superman's avatar superman

修改IE9 BUG

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