Commit 14cc0372 authored by liaili's avatar liaili

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

# Conflicts:
#	public/javascripts/main.js
#	public/javascripts/project.js.map
parents deb883ed 154aa487
0 info it worked if it ends with ok
1 verbose cli [ '/usr/local/bin/node', '/usr/local/bin/npm', 'start' ]
2 info using npm@3.8.3
3 info using node@v5.10.1
4 verbose run-script [ 'prestart', 'start', 'poststart' ]
5 info lifecycle www.fudou6.com@0.0.0~prestart: www.fudou6.com@0.0.0
6 silly lifecycle www.fudou6.com@0.0.0~prestart: no script for prestart, continuing
7 info lifecycle www.fudou6.com@0.0.0~start: www.fudou6.com@0.0.0
8 verbose lifecycle www.fudou6.com@0.0.0~start: unsafe-perm in lifecycle true
9 verbose lifecycle www.fudou6.com@0.0.0~start: PATH: /usr/local/lib/node_modules/npm/bin/node-gyp-bin:/Users/liaili/Work/www.fudou6.com/node_modules/.bin:/usr/local/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin
10 verbose lifecycle www.fudou6.com@0.0.0~start: CWD: /Users/liaili/Work/www.fudou6.com
11 silly lifecycle www.fudou6.com@0.0.0~start: Args: [ '-c', 'pm2 start ./bin/www --name=www.fudou6.com' ]
12 silly lifecycle www.fudou6.com@0.0.0~start: Returned: code: 1 signal: null
13 info lifecycle www.fudou6.com@0.0.0~start: Failed to exec start script
14 verbose stack Error: www.fudou6.com@0.0.0 start: `pm2 start ./bin/www --name=www.fudou6.com`
14 verbose stack Exit status 1
14 verbose stack at EventEmitter.<anonymous> (/usr/local/lib/node_modules/npm/lib/utils/lifecycle.js:239:16)
14 verbose stack at emitTwo (events.js:100:13)
14 verbose stack at EventEmitter.emit (events.js:185:7)
14 verbose stack at ChildProcess.<anonymous> (/usr/local/lib/node_modules/npm/lib/utils/spawn.js:24:14)
14 verbose stack at emitTwo (events.js:100:13)
14 verbose stack at ChildProcess.emit (events.js:185:7)
14 verbose stack at maybeClose (internal/child_process.js:850:16)
14 verbose stack at Process.ChildProcess._handle.onexit (internal/child_process.js:215:5)
15 verbose pkgid www.fudou6.com@0.0.0
16 verbose cwd /Users/liaili/Work/www.fudou6.com
17 error Darwin 15.6.0
18 error argv "/usr/local/bin/node" "/usr/local/bin/npm" "start"
19 error node v5.10.1
20 error npm v3.8.3
21 error code ELIFECYCLE
22 error www.fudou6.com@0.0.0 start: `pm2 start ./bin/www --name=www.fudou6.com`
22 error Exit status 1
23 error Failed at the www.fudou6.com@0.0.0 start script 'pm2 start ./bin/www --name=www.fudou6.com'.
23 error Make sure you have the latest version of node.js and npm installed.
23 error If you do, this is most likely a problem with the www.fudou6.com package,
23 error not with npm itself.
23 error Tell the author that this fails on your system:
23 error pm2 start ./bin/www --name=www.fudou6.com
23 error You can get information on how to open an issue for this project with:
23 error npm bugs www.fudou6.com
23 error Or if that isn't available, you can get their info via:
23 error npm owner ls www.fudou6.com
23 error There is likely additional logging output above.
24 verbose exit [ 1, true ]
......@@ -3,9 +3,10 @@
"version": "0.0.0",
"private": true,
"scripts": {
"start": "pm2 start ./bin/www --name=www.fudou6.com",
"start": "NODE_ENV=production pm2 start ./bin/www --name=www.fudou6.com",
"stop": "pm2 stop www.fudou6.com",
"restart": "pm2 restart www.fudou6.com"
"restart": "pm2 restart www.fudou6.com",
"test": "node ./bin/www"
},
"dependencies": {
"babel-plugin-transform-es2015-sticky-regex": "^6.8.0",
......
This diff is collapsed.
!function(e, t) {
"use strict";
"function" == typeof define && define.amd ? define(t) : "object" == typeof exports ? module.exports = t() : e.returnExports = t();
}(this, function() {
var e, t, n, r, o = Function.call, c = Object.prototype, i = o.bind(c.hasOwnProperty), f = o.bind(c.propertyIsEnumerable), u = o.bind(c.toString), l = i(c, "__defineGetter__");
l && (e = o.bind(c.__defineGetter__), t = o.bind(c.__defineSetter__), n = o.bind(c.__lookupGetter__),
r = o.bind(c.__lookupSetter__)), Object.getPrototypeOf || (Object.getPrototypeOf = function(e) {
var t = e.__proto__;
return t || null === t ? t : "[object Function]" === u(e.constructor) ? e.constructor.prototype : e instanceof Object ? c : null;
});
var b = function(e) {
try {
return e.sentinel = 0, 0 === Object.getOwnPropertyDescriptor(e, "sentinel").value;
} catch (e) {
return !1;
}
};
if (Object.defineProperty) {
var p = b({}), a = "undefined" == typeof document || b(document.createElement("div"));
if (!a || !p) var O = Object.getOwnPropertyDescriptor;
}
if (!Object.getOwnPropertyDescriptor || O) {
var j = "Object.getOwnPropertyDescriptor called on a non-object: ";
Object.getOwnPropertyDescriptor = function(e, t) {
if ("object" != typeof e && "function" != typeof e || null === e) throw new TypeError(j + e);
if (O) try {
return O.call(Object, e, t);
} catch (e) {}
var o;
if (!i(e, t)) return o;
if (o = {
enumerable: f(e, t),
configurable: !0
}, l) {
var u = e.__proto__, b = e !== c;
b && (e.__proto__ = c);
var p = n(e, t), a = r(e, t);
if (b && (e.__proto__ = u), p || a) return p && (o.get = p), a && (o.set = a), o;
}
return o.value = e[t], o.writable = !0, o;
};
}
if (Object.getOwnPropertyNames || (Object.getOwnPropertyNames = function(e) {
return Object.keys(e);
}), !Object.create) {
var s, d = !({
__proto__: null
} instanceof Object), y = function() {
if (!document.domain) return !1;
try {
return !!new ActiveXObject("htmlfile");
} catch (e) {
return !1;
}
}, _ = function() {
var e, t;
return t = new ActiveXObject("htmlfile"), t.write("<script></script>"), t.close(),
e = t.parentWindow.Object.prototype, t = null, e;
}, w = function() {
var e, t = document.createElement("iframe"), n = document.body || document.documentElement;
return t.style.display = "none", n.appendChild(t), t.src = "javascript:", e = t.contentWindow.Object.prototype,
n.removeChild(t), t = null, e;
};
s = d || "undefined" == typeof document ? function() {
return {
__proto__: null
};
} : function() {
var e = y() ? _() : w();
delete e.constructor, delete e.hasOwnProperty, delete e.propertyIsEnumerable, delete e.isPrototypeOf,
delete e.toLocaleString, delete e.toString, delete e.valueOf;
var t = function() {};
return t.prototype = e, s = function() {
return new t();
}, new t();
}, Object.create = function(e, t) {
var n, r = function() {};
if (null === e) n = s(); else {
if ("object" != typeof e && "function" != typeof e) throw new TypeError("Object prototype may only be an Object or null");
r.prototype = e, n = new r(), n.__proto__ = e;
}
return void 0 !== t && Object.defineProperties(n, t), n;
};
}
var v = function(e) {
try {
return Object.defineProperty(e, "sentinel", {}), "sentinel" in e;
} catch (e) {
return !1;
}
};
if (Object.defineProperty) {
var m = v({}), h = "undefined" == typeof document || v(document.createElement("div"));
if (!m || !h) var E = Object.defineProperty, P = Object.defineProperties;
}
if (!Object.defineProperty || E) {
var g = "Property description must be an object: ", T = "Object.defineProperty called on non-object: ", x = "getters & setters can not be defined on this javascript engine";
Object.defineProperty = function(o, i, f) {
if ("object" != typeof o && "function" != typeof o || null === o) throw new TypeError(T + o);
if ("object" != typeof f && "function" != typeof f || null === f) throw new TypeError(g + f);
if (E) try {
return E.call(Object, o, i, f);
} catch (e) {}
if ("value" in f) if (l && (n(o, i) || r(o, i))) {
var u = o.__proto__;
o.__proto__ = c, delete o[i], o[i] = f.value, o.__proto__ = u;
} else o[i] = f.value; else {
if (!l && ("get" in f || "set" in f)) throw new TypeError(x);
"get" in f && e(o, i, f.get), "set" in f && t(o, i, f.set);
}
return o;
};
}
Object.defineProperties && !P || (Object.defineProperties = function(e, t) {
if (P) try {
return P.call(Object, e, t);
} catch (e) {}
return Object.keys(t).forEach(function(n) {
"__proto__" !== n && Object.defineProperty(e, n, t[n]);
}), e;
}), Object.seal || (Object.seal = function(e) {
if (Object(e) !== e) throw new TypeError("Object.seal can only be called on Objects.");
return e;
}), Object.freeze || (Object.freeze = function(e) {
if (Object(e) !== e) throw new TypeError("Object.freeze can only be called on Objects.");
return e;
});
try {
Object.freeze(function() {});
} catch (e) {
Object.freeze = function(e) {
return function(t) {
return "function" == typeof t ? t : e(t);
};
}(Object.freeze);
}
Object.preventExtensions || (Object.preventExtensions = function(e) {
if (Object(e) !== e) throw new TypeError("Object.preventExtensions can only be called on Objects.");
return e;
}), Object.isSealed || (Object.isSealed = function(e) {
if (Object(e) !== e) throw new TypeError("Object.isSealed can only be called on Objects.");
return !1;
}), Object.isFrozen || (Object.isFrozen = function(e) {
if (Object(e) !== e) throw new TypeError("Object.isFrozen can only be called on Objects.");
return !1;
}), Object.isExtensible || (Object.isExtensible = function(e) {
if (Object(e) !== e) throw new TypeError("Object.isExtensible can only be called on Objects.");
for (var t = ""; i(e, t); ) t += "?";
e[t] = !0;
var n = i(e, t);
return delete e[t], n;
});
});
\ No newline at end of file
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
!function(e, t) {
function n(e, t) {
var n = e.createElement("p"), r = e.getElementsByTagName("head")[0] || e.documentElement;
return n.innerHTML = "x<style>" + t + "</style>", r.insertBefore(n.lastChild, r.firstChild);
}
function r() {
var e = E.elements;
return "string" == typeof e ? e.split(" ") : e;
}
function a(e, t) {
var n = E.elements;
"string" != typeof n && (n = n.join(" ")), "string" != typeof e && (e = e.join(" ")),
E.elements = n + " " + e, m(t);
}
function o(e) {
var t = y[e[g]];
return t || (t = {}, v++, e[g] = v, y[v] = t), t;
}
function c(e, n, r) {
if (n || (n = t), s) return n.createElement(e);
r || (r = o(n));
var a;
return a = r.cache[e] ? r.cache[e].cloneNode() : p.test(e) ? (r.cache[e] = r.createElem(e)).cloneNode() : r.createElem(e),
!a.canHaveChildren || h.test(e) || a.tagUrn ? a : r.frag.appendChild(a);
}
function i(e, n) {
if (e || (e = t), s) return e.createDocumentFragment();
n = n || o(e);
for (var a = n.frag.cloneNode(), c = 0, i = r(), l = i.length; c < l; c++) a.createElement(i[c]);
return a;
}
function l(e, t) {
t.cache || (t.cache = {}, t.createElem = e.createElement, t.createFrag = e.createDocumentFragment,
t.frag = t.createFrag()), e.createElement = function(n) {
return E.shivMethods ? c(n, e, t) : t.createElem(n);
}, e.createDocumentFragment = Function("h,f", "return function(){var n=f.cloneNode(),c=n.createElement;h.shivMethods&&(" + r().join().replace(/[\w\-:]+/g, function(e) {
return t.createElem(e), t.frag.createElement(e), 'c("' + e + '")';
}) + ");return n}")(E, t.frag);
}
function m(e) {
e || (e = t);
var r = o(e);
return !E.shivCSS || u || r.hasCSS || (r.hasCSS = !!n(e, "article,aside,dialog,figcaption,figure,footer,header,hgroup,main,nav,section{display:block}mark{background:#FF0;color:#000}template{display:none}")),
s || l(e, r), e;
}
var u, s, d = "3.7.3", f = e.html5 || {}, h = /^<|^(?:button|map|select|textarea|object|iframe|option|optgroup)$/i, p = /^(?:a|b|code|div|fieldset|h1|h2|h3|h4|h5|h6|i|label|li|ol|p|q|span|strong|style|table|tbody|td|th|tr|ul)$/i, g = "_html5shiv", v = 0, y = {};
!function() {
try {
var e = t.createElement("a");
e.innerHTML = "<xyz></xyz>", u = "hidden" in e, s = 1 == e.childNodes.length || function() {
t.createElement("a");
var e = t.createDocumentFragment();
return "undefined" == typeof e.cloneNode || "undefined" == typeof e.createDocumentFragment || "undefined" == typeof e.createElement;
}();
} catch (e) {
u = !0, s = !0;
}
}();
var E = {
elements: f.elements || "abbr article aside audio bdi canvas data datalist details dialog figcaption figure footer header hgroup main mark meter nav output picture progress section summary template time video",
version: d,
shivCSS: f.shivCSS !== !1,
supportsUnknownElements: s,
shivMethods: f.shivMethods !== !1,
type: "default",
shivDocument: m,
createElement: c,
createDocumentFragment: i,
addElements: a
};
e.html5 = E, m(t), "object" == typeof module && module.exports && (module.exports = E);
}("undefined" != typeof window ? window : this, document);
\ No newline at end of file
This diff is collapsed.
(function(){var $form=$("#form");var $userName=$('input[name="userName"]',$form);var $userTel=$('input[name="userTel"]',$form);var $errorName=$(".appointment .errorName");var $errorTel=$(".appointment .errorTel");var $modalBox=$(".modal-box");var balance=$(".balance").html();var total=$(".total").html();var progress=$(".progress-bar i");progress.width(progress.data("width"));function valiUserName(userName){$errorName.html(userName?"":"请输入您的姓名!");return!userName}function filterNotNumber(mobile){if(/[^\d]/g.test(mobile)){$userTel.val(mobile.replace(/[^\d]/g,""));return false}return true}function valiMobile(mobile){if(/^[\d]{11}$/g.test(mobile)){$errorTel.html("");return false}$errorTel.html("手机号有误,请重新输入!");return true}$userName.on("keyup",function(){valiUserName($.trim($userName.val()+""))});$userTel.on("keyup",function(){var mobile=$userTel.val();filterNotNumber(mobile);valiMobile(mobile)});$form.on("submit",function(e){e.preventDefault();if(valiUserName($.trim($userName.val()+""))){$userName.focus();return}if(valiMobile($.trim($userTel.val()+""))){$userTel.focus();return}request();$modalBox.fadeIn(300)});$("#modalBoxHidden").click(function(e){e.preventDefault();$modalBox.fadeOut(300)})})();
\ No newline at end of file
!function() {
function t(t) {
return u.html(t ? "" : "请输入您的姓名!"), !t;
}
function n(t) {
return !/[^\d]/g.test(t) || (a.val(t.replace(/[^\d]/g, "")), !1);
}
function e(t) {
return /^[\d]{11}$/g.test(t) ? (i.html(""), !1) : (i.html("手机号有误,请重新输入!"), !0);
}
var r = $("#form"), o = $('input[name="userName"]', r), a = $('input[name="userTel"]', r), u = $(".appointment .errorName"), i = $(".appointment .errorTel"), l = $(".modal-box"), m = ($(".balance").html(),
$(".total").html(), $(".progress-bar i"));
m.width(m.data("width")), o.on("keyup", function() {
t($.trim(o.val() + ""));
}), a.on("keyup", function() {
var t = a.val();
n(t), e(t);
}), r.on("submit", function(n) {
return n.preventDefault(), t($.trim(o.val() + "")) ? void o.focus() : e($.trim(a.val() + "")) ? void a.focus() : (request(),
void l.fadeIn(300));
}), $("#modalBoxHidden").click(function(t) {
t.preventDefault(), l.fadeOut(300);
});
}();
\ No newline at end of file
This diff is collapsed.
......@@ -89,16 +89,3 @@ function fetchCates(query) {
}
fetchCates(deserialize());
"use strict";var _extends=Object.assign||function(target){for(var i=1;i<arguments.length;i++){var source=arguments[i];for(var key in source){if(Object.prototype.hasOwnProperty.call(source,key)){target[key]=source[key]}}}return target};function fetch(query,panel){var data=_extends({},query,{p:(parseInt(query.p,10)||1)-1});request("/api/1.0/prod/hList.json",data).then(function(_ref){var hasNext=_ref.hasNext;var items=_ref.items;if(items&&items.length){var html=items.map(function(item){return'<li data-id="'+item.id+'" class="product-item status-'+item.status+'">\n <i class="seal">'+(item.status==11&&item.fundRaisedTarget-item.fundRaisedOver>0?"<span>"+formatMoney(item.fundRaisedTarget-item.fundRaisedOver)+"</span>":"")+'</i>\n <div class="clear">\n <div>\n <h2>'+item.itemShortTitle+"</h2>\n <h3>"+formatMoney(item.fundRaisedTarget)+'</h3>\n <div class="clear">\n <span>\n <p>'+item.commissionMaxDur+"</p>\n </span>\n <span>\n <p>"+formatMoney(item.minimumAmount)+"</p>\n </span>\n <span>\n <p>"+item.duration+"</p>\n </span>\n </div>\n </div>\n <div>\n <div>\n <h4>项目亮点</h4>\n <p>"+item.summary+'</p>\n </div>\n </div>\n </div>\n <i class="corner"></i>\n </li>'}).join("");$(".products",panel).html(html);var pagination=[];if(hasNext){pagination.push('<a data-cate-id="'+data.cateId+'" data-p="'+(data.p+2)+'" data-s="'+data.s+'" href="javascript:void(\'下一页\');">下一页</a>')}if(data.p>=1){pagination.unshift('<a data-cate-id="'+data.cateId+'" data-p="'+data.p+'" data-s="'+data.s+'" href="javascript:void(\'上一页\');">上一页</a>')}$(".pagination",panel).html(pagination.join(""));history.replaceState&&history.replaceState(null,null,location.pathname+"?"+serialize(query))}}).catch(function(err){console.log(err)})}function fetchCates(query){request("/api/1.0/cate/cates.json").then(function(_ref2){var pCates=_ref2.pCates;var cates=[];pCates.unshift({name:"全部",id:"all"});pCates.forEach(function(cate){!cate.selfPick&&cates.push(cate.name)});var tabs=new Tabs({container:".tabs",headers:cates,initializePanel:function initializePanel(index,header,panel){var cate=pCates[index];var fetchQuery=cate.id==query.cateId?query:{cateId:cate.id,p:1,s:query.s||10};panel.html('<ul class="products"><li class="loading">正在努力加载中...</li></ul><ul class="pagination"></ul>');fetch(fetchQuery,panel)}});tabs.initialize();tabs.element.on("click",".pagination a",function(e){e.preventDefault();var data=$(this).data();fetch(data,tabs.findPanel(tabs.activeIndex));$(this).text("加载中...")}).on("click",".product-item",function(e){e.preventDefault();var id=$(this).data("id");location.href=location.pathname+"/"+id})})}fetchCates(deserialize());
\ No newline at end of file
"use strict";
function fetch(a, n) {
var t = _extends({}, a, {
p: (parseInt(a.p, 10) || 1) - 1
});
request("/api/1.0/prod/hList.json", t).then(function(i) {
var e = i.hasNext, s = i.items;
if (s && s.length) {
var r = s.map(function(a) {
return '<li data-id="' + a.id + '" class="product-item status-' + a.status + '">\n <i class="seal">' + (11 == a.status && a.fundRaisedTarget - a.fundRaisedOver > 0 ? "<span>" + formatMoney(a.fundRaisedTarget - a.fundRaisedOver) + "</span>" : "") + '</i>\n <div class="clear">\n <div>\n <h2>' + a.itemShortTitle + "</h2>\n <h3>" + formatMoney(a.fundRaisedTarget) + '</h3>\n <div class="clear">\n <span>\n <p>' + a.commissionMaxDur + "</p>\n </span>\n <span>\n <p>" + formatMoney(a.minimumAmount) + "</p>\n </span>\n <span>\n <p>" + a.duration + "</p>\n </span>\n </div>\n </div>\n <div>\n <div>\n <h4>项目亮点</h4>\n <p>" + a.summary + '</p>\n </div>\n </div>\n </div>\n <i class="corner"></i>\n </li>';
}).join("");
$(".products", n).html(r);
var c = [];
e && c.push('<a data-cate-id="' + t.cateId + '" data-p="' + (t.p + 2) + '" data-s="' + t.s + '" href="javascript:void(\'下一页\');">下一页</a>'),
t.p >= 1 && c.unshift('<a data-cate-id="' + t.cateId + '" data-p="' + t.p + '" data-s="' + t.s + '" href="javascript:void(\'上一页\');">上一页</a>'),
$(".pagination", n).html(c.join("")), history.replaceState && history.replaceState(null, null, location.pathname + "?" + serialize(a));
}
}).catch(function(a) {
console.log(a);
});
}
function fetchCates(a) {
request("/api/1.0/cate/cates.json").then(function(n) {
var t = n.pCates, i = [];
t.unshift({
name: "全部",
id: "all"
}), t.forEach(function(a) {
!a.selfPick && i.push(a.name);
});
var e = new Tabs({
container: ".tabs",
headers: i,
initializePanel: function(n, i, e) {
var s = t[n], r = s.id == a.cateId ? a : {
cateId: s.id,
p: 1,
s: a.s || 10
};
e.html('<ul class="products"><li class="loading">正在努力加载中...</li></ul><ul class="pagination"></ul>'),
fetch(r, e);
}
});
e.initialize(), e.element.on("click", ".pagination a", function(a) {
a.preventDefault();
var n = $(this).data();
fetch(n, e.findPanel(e.activeIndex)), $(this).text("加载中...");
}).on("click", ".product-item", function(a) {
a.preventDefault();
var n = $(this).data("id");
location.href = location.pathname + "/" + n;
});
});
}
var _extends = Object.assign || function(a) {
for (var n = 1; n < arguments.length; n++) {
var t = arguments[n];
for (var i in t) Object.prototype.hasOwnProperty.call(t, i) && (a[i] = t[i]);
}
return a;
};
fetchCates(deserialize());
\ No newline at end of file
......@@ -150,43 +150,4 @@
});
})();
// (function () {
//
//
//
//
//
// var $modalBoxProject = $('.modal-box-project');
// var $modalBoxSuccess = $('.modal-box-success');
//
//
//
//
// /**
// * 地图项目地址弹框
// */
// $('.hot-project-address a').click(function (e) {
// e.preventDefault();
// $modalBox.fadeIn(300);
// });
// $('#modalBoxHidden').click(function (e) {
// e.preventDefault();
// $modalBox.fadeOut(300);
// });
//
// /**
// * 项目提交弹框
// */
// $submit.on('click',function(e){
// e.preventDefault();
// $modalBoxSuccess.fadeIn(300);
// });
// $('.modal-box-success a').on('click',function(e){
// e.preventDefault();
// $modalBoxSuccess.fadeOut(300);
// });
//
//
// })();
//# sourceMappingURL=project.js.map
\ No newline at end of file
This diff is collapsed.
......@@ -129,7 +129,7 @@
];
const template = ({projectName, projectTime, projectType, projectInfo})=>{
return `<h4>${projectName}</h4><h3>${projectTime}</h3><h6>${projectType}</h6><p>${projectInfo}</p>
return `<h4>${projectName}</h4><h3>${projectTime}</h3><h6>${projectType}</h6><p>${projectInfo}</p>
<img src="https://res.fudou6.com/c/4/20160801/zupNy5waWNfaGQ=_257x423.jpg">
<a href="javascript:void('close');" class="modal-dialog-close">×</a>`;
};
......@@ -157,43 +157,3 @@
})();
// (function () {
//
//
//
//
//
// var $modalBoxProject = $('.modal-box-project');
// var $modalBoxSuccess = $('.modal-box-success');
//
//
//
//
// /**
// * 地图项目地址弹框
// */
// $('.hot-project-address a').click(function (e) {
// e.preventDefault();
// $modalBox.fadeIn(300);
// });
// $('#modalBoxHidden').click(function (e) {
// e.preventDefault();
// $modalBox.fadeOut(300);
// });
//
// /**
// * 项目提交弹框
// */
// $submit.on('click',function(e){
// e.preventDefault();
// $modalBoxSuccess.fadeIn(300);
// });
// $('.modal-box-success a').on('click',function(e){
// e.preventDefault();
// $modalBoxSuccess.fadeOut(300);
// });
//
//
// })();
\ No newline at end of file
"use strict";(function(){var $form=$("#container .introducer");var $submit=$('input[type="submit"]',$form);var $introducerMobile=$("#introducerMobile",$form);var $projectDescription=$("#projectDescription",$form);var $errorPhone=$(".error-phone",$form);var $errorDescription=$(".error-description",$form);var $successDialog=$(".modal-box-success");var filterMobileInput=function filterMobileInput($mobile){$mobile.val(($mobile.val()+"").replace(/[^\d]/g,""))};var validateMobile=function validateMobile(){var mobile=$.trim($introducerMobile.val()+"");if(/^[\d]{11}$/g.test(mobile)){$errorPhone.empty();return mobile}else{$errorPhone.html("手机号输入错误!");return false}};var validateDescription=function validateDescription(){var description=$.trim($projectDescription.val()+"");if(description.length){$errorDescription.empty();return description}else{$errorDescription.html("请输入项目描述内容!");return false}};$introducerMobile.on("keyup",function(e){filterMobileInput($introducerMobile)}).on("change blur",function(e){validateMobile()}).on("focus",function(e){$errorPhone.empty()});$projectDescription.on("change blur",function(e){validateDescription()}).on("focus",function(e){$errorDescription.empty()});$successDialog.on("click",".modal-dialog-close",function(e){$successDialog.fadeOut(300)});$form.on("submit",function(e){e.preventDefault();var mobile=validateMobile();var description=validateDescription();if(mobile&&description){request("/api/1.0/proj/add.json",{mobile:mobile,description:description},"POST").then(function(){$successDialog.fadeIn(300)}).catch(function(){alert("提交失败, 请稍后再试!")})}})})();(function(){var $modalBox=$(".modal-box");$(".hot-project-address").on("click","a",function(e){e.preventDefault();$modalBox.fadeIn(300)});$modalBox.on("click",".modal-dialog-close",function(e){e.preventDefault();$modalBox.fadeOut(300)})})();
\ No newline at end of file
"use strict";
!function() {
var e = $("#container .introducer"), o = ($('input[type="submit"]', e), $("#introducerMobile", e)), t = $("#projectDescription", e), c = $(".error-phone", e), r = $(".error-description", e), n = $(".modal-box-success"), p = function(e) {
e.val((e.val() + "").replace(/[^\d]/g, ""));
}, a = function() {
var e = $.trim(o.val() + "");
return /^[\d]{11}$/g.test(e) ? (c.empty(), e) : (c.html("手机号输入错误!"), !1);
}, i = function() {
var e = $.trim(t.val() + "");
return e.length ? (r.empty(), e) : (r.html("请输入项目描述内容!"), !1);
};
o.on("keyup", function(e) {
p(o);
}).on("change blur", function(e) {
a();
}).on("focus", function(e) {
c.empty();
}), t.on("change blur", function(e) {
i();
}).on("focus", function(e) {
r.empty();
}), n.on("click", ".modal-dialog-close", function(e) {
n.fadeOut(300);
}), e.on("submit", function(e) {
e.preventDefault();
var o = a(), t = i();
o && t && request("/api/1.0/proj/add.json", {
mobile: o,
description: t
}, "POST").then(function() {
n.fadeIn(300);
}).catch(function() {
alert("提交失败, 请稍后再试!");
});
});
}(), function() {
var e = $(".modal-box"), o = [ {
projectName: "中电投天津",
projectType: "保障房建设",
projectTime: "2年",
projectInfo: "用于补充公司现金流,承载天津市保障房建设。"
}, {
projectName: "中电投西安",
projectType: "基础建设项目",
projectTime: "2年",
projectInfo: "用于认购光大信托计划,用于向“绿源公司”发放信托贷款,用于建设西安绿源农产品批发市场项目。"
}, {
projectName: "金元百利海安",
projectType: "企业流贷",
projectTime: "3年",
projectInfo: "用于受让南通新沿海对海安经济技术开发区管委会的应收账款债 权,资金最终用于补充南通新沿海的流动资金。"
}, {
projectName: "中电投金堂",
projectType: "基础建设项目",
projectTime: "2年",
projectInfo: "用于认购光大信托先融锐金1号集合资金信托计划,补充公司流动资金,用于基础建设项目"
}, {
projectName: "国信巴中",
projectType: "基础建设项目",
projectTime: "2年",
projectInfo: "用于通江县壁州大道二期(高速连接道)建设项目用款。"
}, {
projectName: "枢纽铜仁",
projectType: "保障房建设项目",
projectTime: "18个月",
projectInfo: "用于贵州省铜仁市碧江区城市棚户区改造安置房项目"
}, {
projectName: "枢纽余庆",
projectType: "基础建设项目",
projectTime: "1年",
projectInfo: "用于贵州遵义市余庆县敖溪镇至关兴镇道路工程建设"
}, {
projectName: "中电投黔南州",
projectType: "基础建设项目",
projectTime: "2年",
projectInfo: "用于认购光大信托先融黔南1号集合资金信托计划,补充公司流 动资金,用于基础建设项目 "
} ], t = function(e) {
var o = e.projectName, t = e.projectTime, c = e.projectType, r = e.projectInfo;
return "<h4>" + o + "</h4><h3>" + t + "</h3><h6>" + c + "</h6><p>" + r + '</p>\n <img src="https://res.fudou6.com/c/4/20160801/zupNy5waWNfaGQ=_257x423.jpg">\n <a href="javascript:void(\'close\');" class="modal-dialog-close">×</a>';
}, c = $(".modal-dialog", e);
$(".hot-project-address").on("click", "a", function(r) {
r.preventDefault();
var n = r.target, p = "", a = $(n).data(a).index, i = o[a];
i && (p = t(i), c.html(p), e.fadeIn(300));
}), e.on("click", ".modal-dialog-close", function(o) {
o.preventDefault(), e.fadeOut(300);
});
}();
\ No newline at end of file
(function(global){
//
// Check for native Promise and it has correct interface
//
var NativePromise = global['Promise'];
var nativePromiseSupported =
NativePromise &&
// Some of these methods are missing from
// Firefox/Chrome experimental implementations
'resolve' in NativePromise &&
'reject' in NativePromise &&
'all' in NativePromise &&
'race' in NativePromise &&
// Older version of the spec had a resolver object
// as the arg rather than a function
(function(){
var resolve;
new NativePromise(function(r){ resolve = r; });
return typeof resolve === 'function';
})();
//
// export if necessary
//
if (typeof exports !== 'undefined' && exports)
{
// node.js
exports.Promise = nativePromiseSupported ? NativePromise : Promise;
exports.Polyfill = Promise;
}
else
{
// AMD
if (typeof define == 'function' && define.amd)
{
define(function(){
return nativePromiseSupported ? NativePromise : Promise;
});
}
else
{
// in browser add to global
if (!nativePromiseSupported)
global['Promise'] = Promise;
}
}
//
// Polyfill
//
var PENDING = 'pending';
var SEALED = 'sealed';
var FULFILLED = 'fulfilled';
var REJECTED = 'rejected';
var NOOP = function(){};
function isArray(value) {
return Object.prototype.toString.call(value) === '[object Array]';
}
// async calls
var asyncSetTimer = typeof setImmediate !== 'undefined' ? setImmediate : setTimeout;
var asyncQueue = [];
var asyncTimer;
function asyncFlush(){
// run promise callbacks
for (var i = 0; i < asyncQueue.length; i++)
asyncQueue[i][0](asyncQueue[i][1]);
// reset async asyncQueue
asyncQueue = [];
asyncTimer = false;
}
function asyncCall(callback, arg){
asyncQueue.push([callback, arg]);
if (!asyncTimer)
{
asyncTimer = true;
asyncSetTimer(asyncFlush, 0);
}
}
function invokeResolver(resolver, promise) {
function resolvePromise(value) {
resolve(promise, value);
}
function rejectPromise(reason) {
reject(promise, reason);
}
try {
resolver(resolvePromise, rejectPromise);
} catch(e) {
rejectPromise(e);
}
}
function invokeCallback(subscriber){
var owner = subscriber.owner;
var settled = owner.state_;
var value = owner.data_;
var callback = subscriber[settled];
var promise = subscriber.then;
if (typeof callback === 'function')
{
settled = FULFILLED;
try {
value = callback(value);
} catch(e) {
reject(promise, e);
}
}
if (!handleThenable(promise, value))
{
if (settled === FULFILLED)
resolve(promise, value);
if (settled === REJECTED)
reject(promise, value);
}
}
function handleThenable(promise, value) {
var resolved;
try {
if (promise === value)
throw new TypeError('A promises callback cannot return that same promise.');
if (value && (typeof value === 'function' || typeof value === 'object'))
{
var then = value.then; // then should be retrived only once
if (typeof then === 'function')
{
then.call(value, function(val){
if (!resolved)
{
resolved = true;
if (value !== val)
resolve(promise, val);
else
fulfill(promise, val);
}
}, function(reason){
if (!resolved)
{
resolved = true;
reject(promise, reason);
}
});
return true;
}
}
} catch (e) {
if (!resolved)
reject(promise, e);
return true;
}
return false;
}
function resolve(promise, value){
if (promise === value || !handleThenable(promise, value))
fulfill(promise, value);
}
function fulfill(promise, value){
if (promise.state_ === PENDING)
{
promise.state_ = SEALED;
promise.data_ = value;
asyncCall(publishFulfillment, promise);
}
}
function reject(promise, reason){
if (promise.state_ === PENDING)
{
promise.state_ = SEALED;
promise.data_ = reason;
asyncCall(publishRejection, promise);
}
}
function publish(promise) {
var callbacks = promise.then_;
promise.then_ = undefined;
for (var i = 0; i < callbacks.length; i++) {
invokeCallback(callbacks[i]);
}
}
function publishFulfillment(promise){
promise.state_ = FULFILLED;
publish(promise);
}
function publishRejection(promise){
promise.state_ = REJECTED;
publish(promise);
}
/**
* @class
*/
function Promise(resolver){
if (typeof resolver !== 'function')
throw new TypeError('Promise constructor takes a function argument');
if (this instanceof Promise === false)
throw new TypeError('Failed to construct \'Promise\': Please use the \'new\' operator, this object constructor cannot be called as a function.');
this.then_ = [];
invokeResolver(resolver, this);
}
Promise.prototype = {
constructor: Promise,
state_: PENDING,
then_: null,
data_: undefined,
then: function(onFulfillment, onRejection){
var subscriber = {
owner: this,
then: new this.constructor(NOOP),
fulfilled: onFulfillment,
rejected: onRejection
};
if (this.state_ === FULFILLED || this.state_ === REJECTED)
{
// already resolved, call callback async
asyncCall(invokeCallback, subscriber);
}
else
{
// subscribe
this.then_.push(subscriber);
}
return subscriber.then;
},
'catch': function(onRejection) {
return this.then(null, onRejection);
}
};
Promise.all = function(promises){
var Class = this;
if (!isArray(promises))
throw new TypeError('You must pass an array to Promise.all().');
return new Class(function(resolve, reject){
var results = [];
var remaining = 0;
function resolver(index){
remaining++;
return function(value){
results[index] = value;
if (!--remaining)
resolve(results);
};
}
for (var i = 0, promise; i < promises.length; i++)
{
promise = promises[i];
if (promise && typeof promise.then === 'function')
promise.then(resolver(i), reject);
else
results[i] = promise;
}
if (!remaining)
resolve(results);
});
};
Promise.race = function(promises){
var Class = this;
if (!isArray(promises))
throw new TypeError('You must pass an array to Promise.race().');
return new Class(function(resolve, reject) {
for (var i = 0, promise; i < promises.length; i++)
{
promise = promises[i];
if (promise && typeof promise.then === 'function')
promise.then(resolve, reject);
else
resolve(promise);
}
});
};
Promise.resolve = function(value){
var Class = this;
if (value && typeof value === 'object' && value.constructor === Class)
return value;
return new Class(function(resolve){
resolve(value);
});
};
Promise.reject = function(reason){
var Class = this;
return new Class(function(resolve, reject){
reject(reason);
});
};
})(typeof window != 'undefined' ? window : typeof global != 'undefined' ? global : typeof self != 'undefined' ? self : this);
\ No newline at end of file
!function(t) {
function n(t) {
return "[object Array]" === Object.prototype.toString.call(t);
}
function e() {
for (var t = 0; t < P.length; t++) P[t][0](P[t][1]);
P = [], w = !1;
}
function o(t, n) {
P.push([ t, n ]), w || (w = !0, j(e, 0));
}
function r(t, n) {
function e(t) {
c(n, t);
}
function o(t) {
a(n, t);
}
try {
t(e, o);
} catch (t) {
o(t);
}
}
function i(t) {
var n = t.owner, e = n.state_, o = n.data_, r = t[e], i = t.then;
if ("function" == typeof r) {
e = _;
try {
o = r(o);
} catch (t) {
a(i, t);
}
}
f(i, o) || (e === _ && c(i, o), e === b && a(i, o));
}
function f(t, n) {
var e;
try {
if (t === n) throw new TypeError("A promises callback cannot return that same promise.");
if (n && ("function" == typeof n || "object" == typeof n)) {
var o = n.then;
if ("function" == typeof o) return o.call(n, function(o) {
e || (e = !0, n !== o ? c(t, o) : u(t, o));
}, function(n) {
e || (e = !0, a(t, n));
}), !0;
}
} catch (n) {
return e || a(t, n), !0;
}
return !1;
}
function c(t, n) {
t !== n && f(t, n) || u(t, n);
}
function u(t, n) {
t.state_ === v && (t.state_ = m, t.data_ = n, o(h, t));
}
function a(t, n) {
t.state_ === v && (t.state_ = m, t.data_ = n, o(l, t));
}
function s(t) {
var n = t.then_;
t.then_ = void 0;
for (var e = 0; e < n.length; e++) i(n[e]);
}
function h(t) {
t.state_ = _, s(t);
}
function l(t) {
t.state_ = b, s(t);
}
function p(t) {
if ("function" != typeof t) throw new TypeError("Promise constructor takes a function argument");
if (this instanceof p == !1) throw new TypeError("Failed to construct 'Promise': Please use the 'new' operator, this object constructor cannot be called as a function.");
this.then_ = [], r(t, this);
}
var d = t.Promise, y = d && "resolve" in d && "reject" in d && "all" in d && "race" in d && function() {
var t;
return new d(function(n) {
t = n;
}), "function" == typeof t;
}();
"undefined" != typeof exports && exports ? (exports.Promise = y ? d : p, exports.Polyfill = p) : "function" == typeof define && define.amd ? define(function() {
return y ? d : p;
}) : y || (t.Promise = p);
var w, v = "pending", m = "sealed", _ = "fulfilled", b = "rejected", g = function() {}, j = "undefined" != typeof setImmediate ? setImmediate : setTimeout, P = [];
p.prototype = {
constructor: p,
state_: v,
then_: null,
data_: void 0,
then: function(t, n) {
var e = {
owner: this,
then: new this.constructor(g),
fulfilled: t,
rejected: n
};
return this.state_ === _ || this.state_ === b ? o(i, e) : this.then_.push(e), e.then;
},
catch: function(t) {
return this.then(null, t);
}
}, p.all = function(t) {
var e = this;
if (!n(t)) throw new TypeError("You must pass an array to Promise.all().");
return new e(function(n, e) {
function o(t) {
return f++, function(e) {
i[t] = e, --f || n(i);
};
}
for (var r, i = [], f = 0, c = 0; c < t.length; c++) r = t[c], r && "function" == typeof r.then ? r.then(o(c), e) : i[c] = r;
f || n(i);
});
}, p.race = function(t) {
var e = this;
if (!n(t)) throw new TypeError("You must pass an array to Promise.race().");
return new e(function(n, e) {
for (var o, r = 0; r < t.length; r++) o = t[r], o && "function" == typeof o.then ? o.then(n, e) : n(o);
});
}, p.resolve = function(t) {
var n = this;
return t && "object" == typeof t && t.constructor === n ? t : new n(function(n) {
n(t);
});
}, p.reject = function(t) {
var n = this;
return new n(function(n, e) {
e(t);
});
};
}("undefined" != typeof window ? window : "undefined" != typeof global ? global : "undefined" != typeof self ? self : this);
\ No newline at end of file
This diff is collapsed.
function request(url, data, method = 'GET') {
function request(url, data, method = 'GET') {
return new Promise((resolve, reject)=> {
$.ajax(url, {
type: method,
......@@ -25,7 +25,7 @@
});
}
function formatMoney(money = 0) {
function formatMoney(money = 0) {
let ret;
if (isNaN(money)) {
ret = '0';
......@@ -39,7 +39,7 @@
return ret;
}
function deserialize(str = location.search) {
function deserialize(str = location.search) {
const query = {};
(str + '').replace(/^\?/g, '').split('&').forEach(item=> {
let tmp = (item + '').split('=');
......@@ -50,7 +50,7 @@
return query;
}
function serialize(obj, prefix) {
function serialize(obj, prefix) {
var str = [];
Object.keys(obj).map(p=> {
let v = obj[p];
......@@ -69,7 +69,7 @@
return str.length ? str.join("&") : '';
}
class Tabs {
class Tabs {
constructor(options) {
this.options = {activeClass: 'active', ...options};
}
......@@ -147,4 +147,4 @@
}
}
\ No newline at end of file
}
"use strict";var _extends=Object.assign||function(target){for(var i=1;i<arguments.length;i++){var source=arguments[i];for(var key in source){if(Object.prototype.hasOwnProperty.call(source,key)){target[key]=source[key]}}}return target};var _createClass=function(){function defineProperties(target,props){for(var i=0;i<props.length;i++){var descriptor=props[i];descriptor.enumerable=descriptor.enumerable||false;descriptor.configurable=true;if("value"in descriptor)descriptor.writable=true;Object.defineProperty(target,descriptor.key,descriptor)}}return function(Constructor,protoProps,staticProps){if(protoProps)defineProperties(Constructor.prototype,protoProps);if(staticProps)defineProperties(Constructor,staticProps);return Constructor}}();var _typeof=typeof Symbol==="function"&&typeof Symbol.iterator==="symbol"?function(obj){return typeof obj}:function(obj){return obj&&typeof Symbol==="function"&&obj.constructor===Symbol?"symbol":typeof obj};function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor)){throw new TypeError("Cannot call a class as a function")}}function request(url,data){var method=arguments.length<=2||arguments[2]===undefined?"GET":arguments[2];return new Promise(function(resolve,reject){$.ajax(url,{type:method,dataType:"json",data:data,success:function success(res){if(res&&res.status==1){resolve(res.result)}else{reject({code:res&&res.code||0,message:res&&res.msg||res.message||"系统错误,请稍后再试!"})}},error:function error(xhr,status,text){console.log(xhr,status,text);reject({code:xhr&&xhr.status||status,message:text})}})})}function formatMoney(){var money=arguments.length<=0||arguments[0]===undefined?0:arguments[0];var ret=void 0;if(isNaN(money)){ret="0"}else if(money>=1e10){ret=money/1e10+"亿"}else if(money>=1e6){ret=money/1e6+"万"}else{ret=money/100}return ret}function deserialize(){var str=arguments.length<=0||arguments[0]===undefined?location.search:arguments[0];var query={};(str+"").replace(/^\?/g,"").split("&").forEach(function(item){var tmp=(item+"").split("=");if(tmp.length){query[decodeURIComponent(tmp[0])]=decodeURIComponent(tmp[1])}});return query}function serialize(obj,prefix){var str=[];Object.keys(obj).map(function(p){var v=obj[p];if(p&&typeof v!=="undefined"){var k=prefix?prefix+"."+p:p;if((typeof v==="undefined"?"undefined":_typeof(v))=="object"){v=serialize(v,k);if(v){str.push(v)}}else{str.push(encodeURIComponent(k)+"="+encodeURIComponent(v))}}});return str.length?str.join("&"):""}var Tabs=function(){function Tabs(options){_classCallCheck(this,Tabs);this.options=_extends({activeClass:"active"},options)}_createClass(Tabs,[{key:"initialize",value:function initialize(){this.container=$(this.options.container||"body").empty();this.render();return this}},{key:"findHeader",value:function findHeader(index){return this.element.find(".tabs-headers-item:eq("+index+")")}},{key:"findPanel",value:function findPanel(index){return this.element.find(".tabs-panels-item:eq("+index+")")}},{key:"selectIndex",value:function selectIndex(index){var header=this.findHeader(this.activeIndex);var panel=this.findPanel(this.activeIndex);if(typeof index==="number"&&index!==this.activeIndex){var _options=this.options;var activeClass=_options.activeClass;var initializePanel=_options.initializePanel;header.removeClass(activeClass);panel.removeClass(activeClass);this.activeIndex=index;header=this.findHeader(index).addClass(activeClass);panel=this.findPanel(index).addClass(activeClass);if(!panel.attr("initialized")){if(typeof initializePanel==="function"){initializePanel.call(this,index,header,panel)}panel.attr("initialized",true)}}return{header:header,panel:panel}}},{key:"render",value:function render(){var headers=[];var panels=[];var self=this;this.options.headers.forEach(function(item,index){headers.push('<a class="tabs-headers-item" data-index="'+index+'" href="javascript:void(\''+item+"')\">"+item+"</a>");panels.push('<div class="tabs-panels-item" data-index="'+index+'"></div>')});var html='<div class="tabs">\n <header class="tabs-header">\n <div class="clear">\n '+headers.join("")+"\n </div>\n </header>\n <section>\n "+panels.join("")+"\n </section>\n </div>";this.element=$(html).appendTo(this.container);this.selectIndex(this.options.defaultIndex||0);this.element.on("click",".tabs-headers-item",function(e){e.preventDefault();var tabHeader=$(this);var index=tabHeader.data("index");if(index!=self.activeIndex){self.selectIndex(index)}});return this}}]);return Tabs}();
\ No newline at end of file
"use strict";
function _classCallCheck(e, t) {
if (!(e instanceof t)) throw new TypeError("Cannot call a class as a function");
}
function request(e, t) {
var n = arguments.length <= 2 || void 0 === arguments[2] ? "GET" : arguments[2];
return new Promise(function(i, a) {
$.ajax(e, {
type: n,
dataType: "json",
data: t,
success: function(e) {
e && 1 == e.status ? i(e.result) : a({
code: e && e.code || 0,
message: e && e.msg || e.message || "系统错误,请稍后再试!"
});
},
error: function(e, t, n) {
console.log(e, t, n), a({
code: e && e.status || t,
message: n
});
}
});
});
}
function formatMoney() {
var e = arguments.length <= 0 || void 0 === arguments[0] ? 0 : arguments[0], t = void 0;
return t = isNaN(e) ? "0" : e >= 1e10 ? e / 1e10 + "亿" : e >= 1e6 ? e / 1e6 + "万" : e / 100;
}
function deserialize() {
var e = arguments.length <= 0 || void 0 === arguments[0] ? location.search : arguments[0], t = {};
return (e + "").replace(/^\?/g, "").split("&").forEach(function(e) {
var n = (e + "").split("=");
n.length && (t[decodeURIComponent(n[0])] = decodeURIComponent(n[1]));
}), t;
}
function serialize(e, t) {
var n = [];
return Object.keys(e).map(function(i) {
var a = e[i];
if (i && "undefined" != typeof a) {
var s = t ? t + "." + i : i;
"object" == ("undefined" == typeof a ? "undefined" : _typeof(a)) ? (a = serialize(a, s),
a && n.push(a)) : n.push(encodeURIComponent(s) + "=" + encodeURIComponent(a));
}
}), n.length ? n.join("&") : "";
}
var _extends = Object.assign || function(e) {
for (var t = 1; t < arguments.length; t++) {
var n = arguments[t];
for (var i in n) Object.prototype.hasOwnProperty.call(n, i) && (e[i] = n[i]);
}
return e;
}, _createClass = function() {
function e(e, t) {
for (var n = 0; n < t.length; n++) {
var i = t[n];
i.enumerable = i.enumerable || !1, i.configurable = !0, "value" in i && (i.writable = !0),
Object.defineProperty(e, i.key, i);
}
}
return function(t, n, i) {
return n && e(t.prototype, n), i && e(t, i), t;
};
}(), _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(e) {
return typeof e;
} : function(e) {
return e && "function" == typeof Symbol && e.constructor === Symbol ? "symbol" : typeof e;
}, Tabs = function() {
function e(t) {
_classCallCheck(this, e), this.options = _extends({
activeClass: "active"
}, t);
}
return _createClass(e, [ {
key: "initialize",
value: function() {
return this.container = $(this.options.container || "body").empty(), this.render(),
this;
}
}, {
key: "findHeader",
value: function(e) {
return this.element.find(".tabs-headers-item:eq(" + e + ")");
}
}, {
key: "findPanel",
value: function(e) {
return this.element.find(".tabs-panels-item:eq(" + e + ")");
}
}, {
key: "selectIndex",
value: function(e) {
var t = this.findHeader(this.activeIndex), n = this.findPanel(this.activeIndex);
if ("number" == typeof e && e !== this.activeIndex) {
var i = this.options, a = i.activeClass, s = i.initializePanel;
t.removeClass(a), n.removeClass(a), this.activeIndex = e, t = this.findHeader(e).addClass(a),
n = this.findPanel(e).addClass(a), n.attr("initialized") || ("function" == typeof s && s.call(this, e, t, n),
n.attr("initialized", !0));
}
return {
header: t,
panel: n
};
}
}, {
key: "render",
value: function() {
var e = [], t = [], n = this;
this.options.headers.forEach(function(n, i) {
e.push('<a class="tabs-headers-item" data-index="' + i + '" href="javascript:void(\'' + n + "')\">" + n + "</a>"),
t.push('<div class="tabs-panels-item" data-index="' + i + '"></div>');
});
var i = '<div class="tabs">\n <header class="tabs-header">\n <div class="clear">\n ' + e.join("") + "\n </div>\n </header>\n <section>\n " + t.join("") + "\n </section>\n </div>";
return this.element = $(i).appendTo(this.container), this.selectIndex(this.options.defaultIndex || 0),
this.element.on("click", ".tabs-headers-item", function(e) {
e.preventDefault();
var t = $(this), i = t.data("index");
i != n.activeIndex && n.selectIndex(i);
}), this;
}
} ]), e;
}();
\ No newline at end of file
This diff is collapsed.
......@@ -8,6 +8,7 @@ router.get('/', function (req, res) {
res.render('index', {
navIndex:'active',
styles: ['index'],
env: process.env.NODE_ENV === 'production' ? 'production': '',
scripts:[],
character: [
{
......@@ -84,6 +85,7 @@ router.get('/about', function (req, res) {
res.render('about', {
navAbout:'active',
styles: ['about'],
env: process.env.NODE_ENV === 'production' ? 'production': '',
});
});
......@@ -92,6 +94,7 @@ router.get('/project', function (req, res) {
navProject:'active',
styles: ['project'],
scripts:['utils','project'],
env: process.env.NODE_ENV === 'production' ? 'production': '',
});
});
......@@ -104,6 +107,7 @@ router.get('/products', function (req, res) {
navProducts:'active',
styles: ['products'],
scripts:['utils','products'],
env: process.env.NODE_ENV === 'production' ? 'production': '',
});
});
router.get('/products/:id', product);
......
......@@ -138,7 +138,8 @@ module.exports = function (req, res, next) {
res.render('product', _extends({
navProducts: 'active',
styles: ['product'],
scripts: ['utils', 'product']
scripts: ['utils', 'product'],
env: process.env.NODE_ENV === 'production' ? 'production': '',
}, item));
}).catch(function (err) {
console.log(err);
......
This diff is collapsed.
{"version":3,"sources":["xFetch.jsx"],"names":[],"mappings":";;2BAAqB,kB;;iCAAA,kB;;;;;;;;4BAAjB,K;;;;;;;;;;;;;;;;;;;;;AACJ;;AAEA,QAAM,gBAAgB,SAAhB,aAAgB,CAAC,GAAD;AAAA,eAAY,IAAI,MAAhB,SAA0B,IAAI,UAA9B;AAAA,KAAtB;;AAEA,aAAS,QAAT,CAAkB,GAAlB,EAAuB;AACnB,YAAI,IAAI,MAAJ,KAAe,GAAnB,EAAwB;AACpB;AACA,oBAAQ,GAAR,CAAY,KAAZ;AACH;AACD,eAAO,GAAP;AACH;;AAED,aAAS,QAAT,CAAkB,GAAlB,EAAuB;AACnB,YAAI,IAAI,MAAJ,KAAe,GAAnB,EAAwB;AACpB;AACA,mBAAO,QAAQ,MAAR,CAAe,cAAc,GAAd,CAAf,CAAP;AACH;AACD,eAAO,GAAP;AACH;;AAGD,aAAS,SAAT,CAAmB,GAAnB,EAAwB;AACpB,eAAO,IAAI,IAAJ,GAAW,IAAX,CAAgB;AAAA,gCAAa,GAAb,IAAkB,UAAlB;AAAA,SAAhB,EAA0C,KAA1C,CAAgD;AAAA,gCAAW,GAAX,IAAgB,MAAK,EAAC,QAAO,CAAR,EAAW,SAAS,SAApB,EAArB;AAAA,SAAhD,CAAP;AACH;;AAED,aAAS,iBAAT,CAA2B,GAA3B,EAAgC;AAAA,wBACW,IAAI,IADf;AAAA,YACrB,MADqB,aACrB,MADqB;AAAA,YACb,GADa,aACb,GADa;AAAA,YACR,OADQ,aACR,OADQ;AAAA,YACC,MADD,aACC,MADD;;AAE5B,YAAI,UAAU,CAAd,EAAiB;AACb,mBAAO,QAAQ,MAAR,CAAe,OAAO,OAAtB,CAAP;AACH;AACD,eAAO,MAAP;AACH;;AAED,aAAS,MAAT,CAAgB,GAAhB,EAAqB,OAArB,EAA8B;AAC1B,YAAM,oBAAW,OAAX,CAAN;;AAEA,YAAI,KAAK,MAAL,IAAe,KAAnB,EAA0B;AACtB,iBAAK,OAAL,gBACO,KAAK,OADZ;AAEI,gCAAgB;AAFpB;AAIH;;AAED,eAAO,MAAM,GAAN,EAAW,IAAX,EACF,IADE,CACG,QADH,EAEF,IAFE,CAEG,QAFH,EAGF,IAHE,CAGG,SAHH,EAIF,IAJE,CAIG,iBAJH,CAAP;AAMH;;sBAEc,M","file":"xFetch.js","sourcesContent":["var fetch = require('isomorphic-fetch');\n// import cookie from 'js-cookie';\n\nconst errorMessages = (res) => `${res.status} ${res.statusText}`;\n\nfunction check401(res) {\n if (res.status === 401) {\n // location.href = '/login';\n console.log('401');\n }\n return res;\n}\n\nfunction check404(res) {\n if (res.status === 404) {\n // location.href='/404';\n return Promise.reject(errorMessages(res));\n }\n return res;\n}\n\n\nfunction jsonParse(res) {\n return res.json().then(json => ({...res, json})).catch(err=> ({...res, json:{status:0, message: '数据加载错误!'}}));\n}\n\nfunction errorMessageParse(res) {\n const {status, msg, message, result} = res.json;\n if (status != 1) {\n return Promise.reject(msg || message);\n }\n return result;\n}\n\nfunction xFetch(url, options) {\n const opts = {...options};\n\n if (opts.method != 'GET') {\n opts.headers = {\n ...opts.headers,\n 'content-type': 'application/x-www-form-urlencoded'\n }\n }\n\n return fetch(url, opts)\n .then(check401)\n .then(check404)\n .then(jsonParse)\n .then(errorMessageParse);\n\n}\n\nexport default xFetch;\n"]}
\ No newline at end of file
{"version":3,"sources":["xFetch.jsx"],"names":[],"mappings":";;;;;;;;AAAA,IAAI,QAAS,QAAQ,kBAAR,CAAb;AACA;;AAEA,IAAM,gBAAgB,SAAhB,aAAgB,CAAC,GAAD;AAAA,WAAY,IAAI,MAAhB,SAA0B,IAAI,UAA9B;AAAA,CAAtB;;AAEA,SAAS,QAAT,CAAkB,GAAlB,EAAuB;AACnB,QAAI,IAAI,MAAJ,KAAe,GAAnB,EAAwB;AACpB;AACA,gBAAQ,GAAR,CAAY,KAAZ;AACH;AACD,WAAO,GAAP;AACH;;AAED,SAAS,QAAT,CAAkB,GAAlB,EAAuB;AACnB,QAAI,IAAI,MAAJ,KAAe,GAAnB,EAAwB;AACpB;AACA,eAAO,QAAQ,MAAR,CAAe,cAAc,GAAd,CAAf,CAAP;AACH;AACD,WAAO,GAAP;AACH;;AAGD,SAAS,SAAT,CAAmB,GAAnB,EAAwB;AACpB,WAAO,IAAI,IAAJ,GAAW,IAAX,CAAgB;AAAA,4BAAa,GAAb,IAAkB,UAAlB;AAAA,KAAhB,EAA0C,KAA1C,CAAgD;AAAA,4BAAW,GAAX,IAAgB,MAAK,EAAC,QAAO,CAAR,EAAW,SAAS,SAApB,EAArB;AAAA,KAAhD,CAAP;AACH;;AAED,SAAS,iBAAT,CAA2B,GAA3B,EAAgC;AAAA,oBACW,IAAI,IADf;AAAA,QACrB,MADqB,aACrB,MADqB;AAAA,QACb,GADa,aACb,GADa;AAAA,QACR,OADQ,aACR,OADQ;AAAA,QACC,MADD,aACC,MADD;;AAE5B,QAAI,UAAU,CAAd,EAAiB;AACb,eAAO,QAAQ,MAAR,CAAe,OAAO,OAAtB,CAAP;AACH;AACD,WAAO,MAAP;AACH;;AAED,SAAS,MAAT,CAAgB,GAAhB,EAAqB,OAArB,EAA8B;AAC1B,QAAM,oBAAW,OAAX,CAAN;;AAEA,QAAI,KAAK,MAAL,IAAe,KAAnB,EAA0B;AACtB,aAAK,OAAL,gBACO,KAAK,OADZ;AAEI,4BAAgB;AAFpB;AAIH;;AAED,WAAO,MAAM,GAAN,EAAW,IAAX,EACF,IADE,CACG,QADH,EAEF,IAFE,CAEG,QAFH,EAGF,IAHE,CAGG,SAHH,EAIF,IAJE,CAIG,iBAJH,CAAP;AAMH;;kBAEc,M","file":"xFetch.js","sourcesContent":["var fetch = require('isomorphic-fetch');\n// import cookie from 'js-cookie';\n\nconst errorMessages = (res) => `${res.status} ${res.statusText}`;\n\nfunction check401(res) {\n if (res.status === 401) {\n // location.href = '/login';\n console.log('401');\n }\n return res;\n}\n\nfunction check404(res) {\n if (res.status === 404) {\n // location.href='/404';\n return Promise.reject(errorMessages(res));\n }\n return res;\n}\n\n\nfunction jsonParse(res) {\n return res.json().then(json => ({...res, json})).catch(err=> ({...res, json:{status:0, message: '数据加载错误!'}}));\n}\n\nfunction errorMessageParse(res) {\n const {status, msg, message, result} = res.json;\n if (status != 1) {\n return Promise.reject(msg || message);\n }\n return result;\n}\n\nfunction xFetch(url, options) {\n const opts = {...options};\n\n if (opts.method != 'GET') {\n opts.headers = {\n ...opts.headers,\n 'content-type': 'application/x-www-form-urlencoded'\n }\n }\n\n return fetch(url, opts)\n .then(check401)\n .then(check404)\n .then(jsonParse)\n .then(errorMessageParse);\n\n}\n\nexport default xFetch;\n"]}
\ No newline at end of file
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