Commit 7e72117f authored by superman's avatar superman

Merge branch 'express' of gitlab.yanky.cn:liaili/www.fudou6.com into express

parents ddd8fbb3 4bef85d6
...@@ -7,7 +7,7 @@ var _extends = Object.assign || function (target) { for (var i = 1; i < argument ...@@ -7,7 +7,7 @@ var _extends = Object.assign || function (target) { for (var i = 1; i < argument
function fetch(query, panel) { function fetch(query, panel) {
var data = _extends({}, query, { p: (parseInt(query.p, 10) || 1) - 1 }); var data = _extends({}, query, { p: (parseInt(query.p, 10) || 1) - 1 });
request('/api/1.0/prod/hList.json', data).then(function (_ref) { request('/api/1.0/prod/hList.json', data).done(function (_ref) {
var hasNext = _ref.hasNext; var hasNext = _ref.hasNext;
var items = _ref.items; var items = _ref.items;
...@@ -27,13 +27,13 @@ function fetch(query, panel) { ...@@ -27,13 +27,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(function (err) { }).fail(function (err) {
console.log(err); console.log(err);
}); });
} }
function fetchCates(query) { function fetchCates(query) {
request('/api/1.0/cate/cates.json').then(function (_ref2) { request('/api/1.0/cate/cates.json').done(function (_ref2) {
var pCates = _ref2.pCates; var pCates = _ref2.pCates;
var cates = []; var cates = [];
......
This diff is collapsed.
...@@ -64,9 +64,9 @@ ...@@ -64,9 +64,9 @@
request('/api/1.0/proj/add.json', { request('/api/1.0/proj/add.json', {
mobile: mobile, mobile: mobile,
description: description description: description
}, 'POST').then(function () { }, 'POST').done(function () {
$successDialog.fadeIn(300); $successDialog.fadeIn(300);
}).catch(function () { }).fail(function () {
alert('提交失败, 请稍后再试!'); alert('提交失败, 请稍后再试!');
}); });
$introducerMobile.val(''); $introducerMobile.val('');
......
This diff is collapsed.
...@@ -11,16 +11,16 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons ...@@ -11,16 +11,16 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons
function request(url, data) { function request(url, data) {
var method = arguments.length <= 2 || arguments[2] === undefined ? 'GET' : arguments[2]; var method = arguments.length <= 2 || arguments[2] === undefined ? 'GET' : arguments[2];
return new Promise(function (resolve, reject) { var promise = $.Deferred();
$.ajax(url, { $.ajax(url, {
type: method, type: method,
dataType: 'json', dataType: 'json',
data: data, data: data,
success: function success(res) { success: function 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 || '系统错误,请稍后再试!'
}); });
...@@ -28,13 +28,13 @@ function request(url, data) { ...@@ -28,13 +28,13 @@ function request(url, data) {
}, },
error: function error(xhr, status, text) { error: function 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() { function formatMoney() {
......
This diff is collapsed.
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