.
This commit is contained in:
File diff suppressed because one or more lines are too long
Binary file not shown.
File diff suppressed because one or more lines are too long
Before Width: | Height: | Size: 44 KiB After Width: | Height: | Size: 142 KiB |
Binary file not shown.
Binary file not shown.
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@@ -1,2 +1,2 @@
|
||||
/** layui-v1.0.9_rls MIT License By http://www.layui.com */
|
||||
html #layuicss-skincodecss{display:none;position:absolute;width:1989px}.layui-code-h3,.layui-code-view{position:relative;font-size:12px}.layui-code-view{display:block;margin:10px 0;padding:0;border:1px solid #ddd;border-left-width:6px;background-color:#F2F2F2;color:#333;font-family:Courier New}.layui-code-h3{padding:0 10px;height:30px;line-height:30px;border-bottom:1px solid #ddd}.layui-code-h3 a{position:absolute;right:10px;top:0;color:#999}.layui-code-view .layui-code-ol{position:relative;overflow:auto}.layui-code-view .layui-code-ol li{position:relative;margin-left:45px;line-height:20px;padding:0 5px;border-left:1px solid #ddd;list-style-type:decimal-leading-zero;*list-style-type:decimal;background-color:#fff}.layui-code-view pre{margin:0}.layui-code-notepad{border:1px solid #0C0C0C;border-left-color:#3F3F3F;background-color:#0C0C0C;color:#C2BE9E}.layui-code-notepad .layui-code-h3{border-bottom:none}.layui-code-notepad .layui-code-ol li{background-color:#3F3F3F;border-left:none}
|
||||
/** layui-v2.2.3 MIT License By http://www.layui.com */
|
||||
html #layuicss-skincodecss{display:none;position:absolute;width:1989px}.layui-code-h3,.layui-code-view{position:relative;font-size:12px}.layui-code-view{display:block;margin:10px 0;padding:0;border:1px solid #e2e2e2;border-left-width:6px;background-color:#F2F2F2;color:#333;font-family:Courier New}.layui-code-h3{padding:0 10px;height:32px;line-height:32px;border-bottom:1px solid #e2e2e2}.layui-code-h3 a{position:absolute;right:10px;top:0;color:#999}.layui-code-view .layui-code-ol{position:relative;overflow:auto}.layui-code-view .layui-code-ol li{position:relative;margin-left:45px;line-height:20px;padding:0 5px;border-left:1px solid #e2e2e2;list-style-type:decimal-leading-zero;*list-style-type:decimal;background-color:#fff}.layui-code-view pre{margin:0}.layui-code-notepad{border:1px solid #0C0C0C;border-left-color:#3F3F3F;background-color:#0C0C0C;color:#C2BE9E}.layui-code-notepad .layui-code-h3{border-bottom:none}.layui-code-notepad .layui-code-ol li{background-color:#3F3F3F;border-left:none}
|
2
root/res/layui/css/modules/laydate/default/laydate.css
Normal file
2
root/res/layui/css/modules/laydate/default/laydate.css
Normal file
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
2
root/res/layui/lay/modules/carousel.js
Normal file
2
root/res/layui/lay/modules/carousel.js
Normal file
@@ -0,0 +1,2 @@
|
||||
/** layui-v2.2.3 MIT License By http://www.layui.com */
|
||||
;layui.define("jquery",function(e){"use strict";var i=layui.$,n=(layui.hint(),layui.device(),{config:{},set:function(e){var n=this;return n.config=i.extend({},n.config,e),n},on:function(e,i){return layui.onevent.call(this,t,e,i)}}),t="carousel",a="layui-this",l=">*[carousel-item]>*",o="layui-carousel-left",r="layui-carousel-right",d="layui-carousel-prev",s="layui-carousel-next",u="layui-carousel-arrow",c="layui-carousel-ind",m=function(e){var t=this;t.config=i.extend({},t.config,n.config,e),t.render()};m.prototype.config={width:"600px",height:"280px",full:!1,arrow:"hover",indicator:"inside",autoplay:!0,interval:3e3,anim:"",trigger:"click",index:0},m.prototype.render=function(){var e=this,n=e.config;n.elem=i(n.elem),n.elem[0]&&(e.elemItem=n.elem.find(l),n.index<0&&(n.index=0),n.index>=e.elemItem.length&&(n.index=e.elemItem.length-1),n.interval<800&&(n.interval=800),n.full?n.elem.css({position:"fixed",width:"100%",height:"100%",zIndex:9999}):n.elem.css({width:n.width,height:n.height}),n.elem.attr("lay-anim",n.anim),e.elemItem.eq(n.index).addClass(a),e.elemItem.length<=1||(e.indicator(),e.arrow(),e.autoplay(),e.events()))},m.prototype.reload=function(e){var n=this;clearInterval(n.timer),n.config=i.extend({},n.config,e),n.render()},m.prototype.prevIndex=function(){var e=this,i=e.config,n=i.index-1;return n<0&&(n=e.elemItem.length-1),n},m.prototype.nextIndex=function(){var e=this,i=e.config,n=i.index+1;return n>=e.elemItem.length&&(n=0),n},m.prototype.addIndex=function(e){var i=this,n=i.config;e=e||1,n.index=n.index+e,n.index>=i.elemItem.length&&(n.index=0)},m.prototype.subIndex=function(e){var i=this,n=i.config;e=e||1,n.index=n.index-e,n.index<0&&(n.index=i.elemItem.length-1)},m.prototype.autoplay=function(){var e=this,i=e.config;i.autoplay&&(e.timer=setInterval(function(){e.slide()},i.interval))},m.prototype.arrow=function(){var e=this,n=e.config,t=i(['<button class="layui-icon '+u+'" lay-type="sub">'+("updown"===n.anim?"":"")+"</button>",'<button class="layui-icon '+u+'" lay-type="add">'+("updown"===n.anim?"":"")+"</button>"].join(""));n.elem.attr("lay-arrow",n.arrow),n.elem.find("."+u)[0]&&n.elem.find("."+u).remove(),n.elem.append(t),t.on("click",function(){var n=i(this),t=n.attr("lay-type");e.slide(t)})},m.prototype.indicator=function(){var e=this,n=e.config,t=e.elemInd=i(['<div class="'+c+'"><ul>',function(){var i=[];return layui.each(e.elemItem,function(e){i.push("<li"+(n.index===e?' class="layui-this"':"")+"></li>")}),i.join("")}(),"</ul></div>"].join(""));n.elem.attr("lay-indicator",n.indicator),n.elem.find("."+c)[0]&&n.elem.find("."+c).remove(),n.elem.append(t),"updown"===n.anim&&t.css("margin-top",-(t.height()/2)),t.find("li").on("hover"===n.trigger?"mouseover":n.trigger,function(){var t=i(this),a=t.index();a>n.index?e.slide("add",a-n.index):a<n.index&&e.slide("sub",n.index-a)})},m.prototype.slide=function(e,i){var n=this,l=n.elemItem,u=n.config,c=u.index,m=u.elem.attr("lay-filter");n.haveSlide||("sub"===e?(n.subIndex(i),l.eq(u.index).addClass(d),setTimeout(function(){l.eq(c).addClass(r),l.eq(u.index).addClass(r)},50)):(n.addIndex(i),l.eq(u.index).addClass(s),setTimeout(function(){l.eq(c).addClass(o),l.eq(u.index).addClass(o)},50)),setTimeout(function(){l.removeClass(a+" "+d+" "+s+" "+o+" "+r),l.eq(u.index).addClass(a),n.haveSlide=!1},300),n.elemInd.find("li").eq(u.index).addClass(a).siblings().removeClass(a),n.haveSlide=!0,layui.event.call(this,t,"change("+m+")",{index:u.index,prevIndex:c,item:l.eq(u.index)}))},m.prototype.events=function(){var e=this,i=e.config;i.elem.data("haveEvents")||(i.elem.on("mouseenter",function(){clearInterval(e.timer)}).on("mouseleave",function(){e.autoplay()}),i.elem.data("haveEvents",!0))},n.render=function(e){var i=new m(e);return i},e(t,n)});
|
@@ -1,2 +1,2 @@
|
||||
/** layui-v1.0.9_rls MIT License By http://www.layui.com */
|
||||
;layui.define("jquery",function(e){"use strict";var a=layui.jquery,l="http://www.layui.com/doc/modules/code.html";e("code",function(e){var t=[];e=e||{},e.elem=a(e.elem||".layui-code"),e.about=!("about"in e)||e.about,e.elem.each(function(){t.push(this)}),layui.each(t.reverse(),function(t,i){var c=a(i),o=c.html();(c.attr("lay-encode")||e.encode)&&(o=o.replace(/&(?!#?[a-zA-Z0-9]+;)/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/'/g,"'").replace(/"/g,""")),c.html('<ol class="layui-code-ol"><li>'+o.replace(/[\r\t\n]+/g,"</li><li>")+"</li></ol>"),c.find(">.layui-code-h3")[0]||c.prepend('<h3 class="layui-code-h3">'+(c.attr("lay-title")||e.title||"code")+(e.about?'<a href="'+l+'" target="_blank">layui.code</a>':"")+"</h3>");var d=c.find(">.layui-code-ol");c.addClass("layui-box layui-code-view"),(c.attr("lay-skin")||e.skin)&&c.addClass("layui-code-"+(c.attr("lay-skin")||e.skin)),(d.find("li").length/100|0)>0&&d.css("margin-left",(d.find("li").length/100|0)+"px"),(c.attr("lay-height")||e.height)&&d.css("max-height",c.attr("lay-height")||e.height)})})}).addcss("modules/code.css","skincodecss");
|
||||
/** layui-v2.2.3 MIT License By http://www.layui.com */
|
||||
;layui.define("jquery",function(e){"use strict";var a=layui.$,l="http://www.layui.com/doc/modules/code.html";e("code",function(e){var t=[];e=e||{},e.elem=a(e.elem||".layui-code"),e.about=!("about"in e)||e.about,e.elem.each(function(){t.push(this)}),layui.each(t.reverse(),function(t,i){var c=a(i),o=c.html();(c.attr("lay-encode")||e.encode)&&(o=o.replace(/&(?!#?[a-zA-Z0-9]+;)/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/'/g,"'").replace(/"/g,""")),c.html('<ol class="layui-code-ol"><li>'+o.replace(/[\r\t\n]+/g,"</li><li>")+"</li></ol>"),c.find(">.layui-code-h3")[0]||c.prepend('<h3 class="layui-code-h3">'+(c.attr("lay-title")||e.title||"code")+(e.about?'<a href="'+l+'" target="_blank">layui.code</a>':"")+"</h3>");var d=c.find(">.layui-code-ol");c.addClass("layui-box layui-code-view"),(c.attr("lay-skin")||e.skin)&&c.addClass("layui-code-"+(c.attr("lay-skin")||e.skin)),(d.find("li").length/100|0)>0&&d.css("margin-left",(d.find("li").length/100|0)+"px"),(c.attr("lay-height")||e.height)&&d.css("max-height",c.attr("lay-height")||e.height)})})}).addcss("modules/code.css","skincodecss");
|
File diff suppressed because one or more lines are too long
@@ -1,2 +1,2 @@
|
||||
/** layui-v1.0.9_rls MIT License By http://www.layui.com */
|
||||
;layui.define("jquery",function(e){"use strict";var l=layui.jquery,o=function(e){},t='<i class="layui-anim layui-anim-rotate layui-anim-loop layui-icon "></i>';o.prototype.load=function(e){var o,i,n,r,a=this,c=0;e=e||{};var u=l(e.elem);if(u[0]){var f=l(e.scrollElem||document),m=e.mb||50,s=!("isAuto"in e)||e.isAuto,y=e.end||"没有更多了",v=e.scrollElem&&e.scrollElem!==document,d="<cite>加载更多</cite>",h=l('<div class="layui-flow-more"><a href="javascript:;">'+d+"</a></div>");u.find(".layui-flow-more")[0]||u.append(h);var p=function(e,t){e=l(e),h.before(e),t=0==t||null,t?h.html(y):h.find("a").html(d),i=t,o=null,n&&n()},g=function(){o=!0,h.find("a").html(t),"function"==typeof e.done&&e.done(++c,p)};if(g(),h.find("a").on("click",function(){l(this);i||o||g()}),e.isLazyimg)var n=a.lazyimg({elem:e.elem+" img",scrollElem:e.scrollElem});return s?(f.on("scroll",function(){var e=l(this),t=e.scrollTop();r&&clearTimeout(r),i||(r=setTimeout(function(){var i=v?e.height():l(window).height(),n=v?e.prop("scrollHeight"):document.documentElement.scrollHeight;n-t-i<=m&&(o||g())},100))}),a):a}},o.prototype.lazyimg=function(e){var o,t=this,i=0;e=e||{};var n=l(e.scrollElem||document),r=e.elem||"img",a=e.scrollElem&&e.scrollElem!==document,c=function(e,l){var o=n.scrollTop(),r=o+l,c=a?function(){return e.offset().top-n.offset().top+o}():e.offset().top;if(c>=o&&c<=r&&!e.attr("src")){var f=e.attr("lay-src");layui.img(f,function(){var l=t.lazyimg.elem.eq(i);e.attr("src",f).removeAttr("lay-src"),l[0]&&u(l),i++})}},u=function(e,o){var u=a?(o||n).height():l(window).height(),f=n.scrollTop(),m=f+u;if(t.lazyimg.elem=l(r),e)c(e,u);else for(var s=0;s<t.lazyimg.elem.length;s++){var y=t.lazyimg.elem.eq(s),v=a?function(){return y.offset().top-n.offset().top+f}():y.offset().top;if(c(y,u),i=s,v>m)break}};if(u(),!o){var f;n.on("scroll",function(){var e=l(this);f&&clearTimeout(f),f=setTimeout(function(){u(null,e)},50)}),o=!0}return u},e("flow",new o)});
|
||||
/** layui-v2.2.3 MIT License By http://www.layui.com */
|
||||
;layui.define("jquery",function(e){"use strict";var l=layui.$,o=function(e){},t='<i class="layui-anim layui-anim-rotate layui-anim-loop layui-icon "></i>';o.prototype.load=function(e){var o,i,n,r,a=this,c=0;e=e||{};var f=l(e.elem);if(f[0]){var m=l(e.scrollElem||document),u=e.mb||50,s=!("isAuto"in e)||e.isAuto,v=e.end||"没有更多了",y=e.scrollElem&&e.scrollElem!==document,d="<cite>加载更多</cite>",h=l('<div class="layui-flow-more"><a href="javascript:;">'+d+"</a></div>");f.find(".layui-flow-more")[0]||f.append(h);var p=function(e,t){e=l(e),h.before(e),t=0==t||null,t?h.html(v):h.find("a").html(d),i=t,o=null,n&&n()},g=function(){o=!0,h.find("a").html(t),"function"==typeof e.done&&e.done(++c,p)};if(g(),h.find("a").on("click",function(){l(this);i||o||g()}),e.isLazyimg)var n=a.lazyimg({elem:e.elem+" img",scrollElem:e.scrollElem});return s?(m.on("scroll",function(){var e=l(this),t=e.scrollTop();r&&clearTimeout(r),i||(r=setTimeout(function(){var i=y?e.height():l(window).height(),n=y?e.prop("scrollHeight"):document.documentElement.scrollHeight;n-t-i<=u&&(o||g())},100))}),a):a}},o.prototype.lazyimg=function(e){var o,t=this,i=0;e=e||{};var n=l(e.scrollElem||document),r=e.elem||"img",a=e.scrollElem&&e.scrollElem!==document,c=function(e,l){var o=n.scrollTop(),r=o+l,c=a?function(){return e.offset().top-n.offset().top+o}():e.offset().top;if(c>=o&&c<=r&&!e.attr("src")){var m=e.attr("lay-src");layui.img(m,function(){var l=t.lazyimg.elem.eq(i);e.attr("src",m).removeAttr("lay-src"),l[0]&&f(l),i++})}},f=function(e,o){var f=a?(o||n).height():l(window).height(),m=n.scrollTop(),u=m+f;if(t.lazyimg.elem=l(r),e)c(e,f);else for(var s=0;s<t.lazyimg.elem.length;s++){var v=t.lazyimg.elem.eq(s),y=a?function(){return v.offset().top-n.offset().top+m}():v.offset().top;if(c(v,f),i=s,y>u)break}};if(f(),!o){var m;n.on("scroll",function(){var e=l(this);m&&clearTimeout(m),m=setTimeout(function(){f(null,e)},50)}),o=!0}return f},e("flow",new o)});
|
File diff suppressed because one or more lines are too long
4
root/res/layui/lay/modules/jquery.js
vendored
4
root/res/layui/lay/modules/jquery.js
vendored
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@@ -1,2 +1,2 @@
|
||||
/** layui-v1.0.9_rls MIT License By http://www.layui.com */
|
||||
;layui.define(function(a){"use strict";function t(a){new p(a)}var e=document,r="getElementById",n="getElementsByTagName",s=0,p=function(a){var t=this,e=t.config=a||{};e.item=s++,t.render(!0)};p.on=function(a,t,e){return a.attachEvent?a.attachEvent("on"+t,function(){e.call(a,window.even)}):a.addEventListener(t,e,!1),p},p.prototype.type=function(){var a=this.config;if("object"==typeof a.cont)return void 0===a.cont.length?2:3},p.prototype.view=function(){var a=this,t=a.config,e=[],r={};if(t.pages=0|t.pages,t.curr=0|t.curr||1,t.groups="groups"in t?0|t.groups:5,t.first="first"in t?t.first:"首页",t.last="last"in t?t.last:"末页",t.prev="prev"in t?t.prev:"上一页",t.next="next"in t?t.next:"下一页",t.pages<=1)return"";for(t.groups>t.pages&&(t.groups=t.pages),r.index=Math.ceil((t.curr+(t.groups>1&&t.groups!==t.pages?1:0))/(0===t.groups?1:t.groups)),t.curr>1&&t.prev&&e.push('<a href="javascript:;" class="layui-laypage-prev" data-page="'+(t.curr-1)+'">'+t.prev+"</a>"),r.index>1&&t.first&&0!==t.groups&&e.push('<a href="javascript:;" class="laypage_first" data-page="1" title="首页">'+t.first+"</a><span>…</span>"),r.poor=Math.floor((t.groups-1)/2),r.start=r.index>1?t.curr-r.poor:1,r.end=r.index>1?function(){var a=t.curr+(t.groups-r.poor-1);return a>t.pages?t.pages:a}():t.groups,r.end-r.start<t.groups-1&&(r.start=r.end-t.groups+1);r.start<=r.end;r.start++)r.start===t.curr?e.push('<span class="layui-laypage-curr"><em class="layui-laypage-em" '+(/^#/.test(t.skin)?'style="background-color:'+t.skin+';"':"")+"></em><em>"+r.start+"</em></span>"):e.push('<a href="javascript:;" data-page="'+r.start+'">'+r.start+"</a>");return t.pages>t.groups&&r.end<t.pages&&t.last&&0!==t.groups&&e.push('<span>…</span><a href="javascript:;" class="layui-laypage-last" title="尾页" data-page="'+t.pages+'">'+t.last+"</a>"),r.flow=!t.prev&&0===t.groups,(t.curr!==t.pages&&t.next||r.flow)&&e.push(function(){return r.flow&&t.curr===t.pages?'<span class="layui-laypage-nomore" title="已没有更多">'+t.next+"</span>":'<a href="javascript:;" class="layui-laypage-next" data-page="'+(t.curr+1)+'">'+t.next+"</a>"}()),'<div class="layui-box layui-laypage layui-laypage-'+(t.skin?function(a){return/^#/.test(a)?"molv":a}(t.skin):"default")+'" id="layui-laypage-'+a.config.item+'">'+e.join("")+function(){return t.skip?'<span class="layui-laypage-total">到第 <input type="number" min="1" onkeyup="this.value=this.value.replace(/\\D/, \'\');" value="'+t.curr+'" class="layui-laypage-skip"> 页 <button type="button" class="layui-laypage-btn">确定</button></span>':""}()+"</div>"},p.prototype.jump=function(a){if(a){for(var t=this,e=t.config,r=a.children,s=a[n]("button")[0],i=a[n]("input")[0],u=0,o=r.length;u<o;u++)"a"===r[u].nodeName.toLowerCase()&&p.on(r[u],"click",function(){var a=0|this.getAttribute("data-page");e.curr=a,t.render()});s&&p.on(s,"click",function(){var a=0|i.value.replace(/\s|\D/g,"");a&&a<=e.pages&&(e.curr=a,t.render())})}},p.prototype.render=function(a){var t=this,n=t.config,s=t.type(),p=t.view();2===s?n.cont.innerHTML=p:3===s?n.cont.html(p):e[r](n.cont).innerHTML=p,n.jump&&n.jump(n,a),t.jump(e[r]("layui-laypage-"+n.item)),n.hash&&!a&&(location.hash="!"+n.hash+"="+n.curr)},a("laypage",t)});
|
||||
/** layui-v2.2.3 MIT License By http://www.layui.com */
|
||||
;layui.define(function(e){"use strict";var a=document,t="getElementById",n="getElementsByTagName",i="laypage",r="layui-disabled",u=function(e){var a=this;a.config=e||{},a.config.index=++s.index,a.render(!0)};u.prototype.type=function(){var e=this.config;if("object"==typeof e.elem)return void 0===e.elem.length?2:3},u.prototype.view=function(){var e=this,a=e.config,t=a.groups="groups"in a?0|a.groups:5;a.layout="object"==typeof a.layout?a.layout:["prev","page","next"],a.count=0|a.count,a.curr=0|a.curr||1,a.limits="object"==typeof a.limits?a.limits:[10,20,30,40,50],a.limit=0|a.limit||10,a.pages=Math.ceil(a.count/a.limit)||1,a.curr>a.pages&&(a.curr=a.pages),t<0?t=1:t>a.pages&&(t=a.pages),a.prev="prev"in a?a.prev:"上一页",a.next="next"in a?a.next:"下一页";var n=a.pages>t?Math.ceil((a.curr+(t>1?1:0))/(t>0?t:1)):1,i={prev:function(){return a.prev?'<a href="javascript:;" class="layui-laypage-prev'+(1==a.curr?" "+r:"")+'" data-page="'+(a.curr-1)+'">'+a.prev+"</a>":""}(),page:function(){var e=[];if(a.count<1)return"";n>1&&a.first!==!1&&0!==t&&e.push('<a href="javascript:;" class="layui-laypage-first" data-page="1" title="首页">'+(a.first||1)+"</a>");var i=Math.floor((t-1)/2),r=n>1?a.curr-i:1,u=n>1?function(){var e=a.curr+(t-i-1);return e>a.pages?a.pages:e}():t;for(u-r<t-1&&(r=u-t+1),a.first!==!1&&r>2&&e.push('<span class="layui-laypage-spr">…</span>');r<=u;r++)r===a.curr?e.push('<span class="layui-laypage-curr"><em class="layui-laypage-em" '+(/^#/.test(a.theme)?'style="background-color:'+a.theme+';"':"")+"></em><em>"+r+"</em></span>"):e.push('<a href="javascript:;" data-page="'+r+'">'+r+"</a>");return a.pages>t&&a.pages>u&&a.last!==!1&&(u+1<a.pages&&e.push('<span class="layui-laypage-spr">…</span>'),0!==t&&e.push('<a href="javascript:;" class="layui-laypage-last" title="尾页" data-page="'+a.pages+'">'+(a.last||a.pages)+"</a>")),e.join("")}(),next:function(){return a.next?'<a href="javascript:;" class="layui-laypage-next'+(a.curr==a.pages?" "+r:"")+'" data-page="'+(a.curr+1)+'">'+a.next+"</a>":""}(),count:'<span class="layui-laypage-count">共 '+a.count+" 条</span>",limit:function(){var e=['<span class="layui-laypage-limits"><select lay-ignore>'];return layui.each(a.limits,function(t,n){e.push('<option value="'+n+'"'+(n===a.limit?"selected":"")+">"+n+" 条/页</option>")}),e.join("")+"</select></span>"}(),skip:function(){return['<span class="layui-laypage-skip">到第','<input type="text" min="1" value="'+a.curr+'" class="layui-input">','页<button type="button" class="layui-laypage-btn">确定</button>',"</span>"].join("")}()};return['<div class="layui-box layui-laypage layui-laypage-'+(a.theme?/^#/.test(a.theme)?"molv":a.theme:"default")+'" id="layui-laypage-'+a.index+'">',function(){var e=[];return layui.each(a.layout,function(a,t){i[t]&&e.push(i[t])}),e.join("")}(),"</div>"].join("")},u.prototype.jump=function(e,a){if(e){var t=this,i=t.config,r=e.children,u=e[n]("button")[0],l=e[n]("input")[0],p=e[n]("select")[0],c=function(){var e=0|l.value.replace(/\s|\D/g,"");e&&(i.curr=e,t.render())};if(a)return c();for(var o=0,y=r.length;o<y;o++)"a"===r[o].nodeName.toLowerCase()&&s.on(r[o],"click",function(){var e=0|this.getAttribute("data-page");e<1||e>i.pages||(i.curr=e,t.render())});p&&s.on(p,"change",function(){var e=this.value;i.curr*e>i.count&&(i.curr=Math.ceil(i.count/e)),i.limit=e,t.render()}),u&&s.on(u,"click",function(){c()})}},u.prototype.skip=function(e){if(e){var a=this,t=e[n]("input")[0];t&&s.on(t,"keyup",function(t){var n=this.value,i=t.keyCode;/^(37|38|39|40)$/.test(i)||(/\D/.test(n)&&(this.value=n.replace(/\D/,"")),13===i&&a.jump(e,!0))})}},u.prototype.render=function(e){var n=this,i=n.config,r=n.type(),u=n.view();2===r?i.elem&&(i.elem.innerHTML=u):3===r?i.elem.html(u):a[t](i.elem)&&(a[t](i.elem).innerHTML=u),i.jump&&i.jump(i,e);var s=a[t]("layui-laypage-"+i.index);n.jump(s),i.hash&&!e&&(location.hash="!"+i.hash+"="+i.curr),n.skip(s)};var s={render:function(e){var a=new u(e);return a.index},index:layui.laypage?layui.laypage.index+1e4:0,on:function(e,a,t){return e.attachEvent?e.attachEvent("on"+a,function(a){a.target=a.srcElement,t.call(e,a)}):e.addEventListener(a,t,!1),this}};e(i,s)});
|
@@ -1,2 +1,2 @@
|
||||
/** layui-v1.0.9_rls MIT License By http://www.layui.com */
|
||||
;layui.define(function(e){"use strict";var r={open:"{{",close:"}}"},n={exp:function(e){return new RegExp(e,"g")},query:function(e,n,t){var o=["#([\\s\\S])+?","([^{#}])*?"][e||0];return c((n||"")+r.open+o+r.close+(t||""))},escape:function(e){return String(e||"").replace(/&(?!#?[a-zA-Z0-9]+;)/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/'/g,"'").replace(/"/g,""")},error:function(e,r){var n="Laytpl Error:";return"object"==typeof console&&console.error(n+e+"\n"+(r||"")),n+e}},c=n.exp,t=function(e){this.tpl=e};t.pt=t.prototype,window.errors=0,t.pt.parse=function(e,t){var o=this,p=e,a=c("^"+r.open+"#",""),l=c(r.close+"$","");e=e.replace(/\s+|\r|\t|\n/g," ").replace(c(r.open+"#"),r.open+"# ").replace(c(r.close+"}"),"} "+r.close).replace(/\\/g,"\\\\").replace(/(?="|')/g,"\\").replace(n.query(),function(e){return e=e.replace(a,"").replace(l,""),'";'+e.replace(/\\/g,"")+';view+="'}).replace(n.query(1),function(e){var n='"+(';return e.replace(/\s/g,"")===r.open+r.close?"":(e=e.replace(c(r.open+"|"+r.close),""),/^=/.test(e)&&(e=e.replace(/^=/,""),n='"+_escape_('),n+e.replace(/\\/g,"")+')+"')}),e='"use strict";var view = "'+e+'";return view;';try{return o.cache=e=new Function("d, _escape_",e),e(t,n.escape)}catch(u){return delete o.cache,n.error(u,p)}},t.pt.render=function(e,r){var c,t=this;return e?(c=t.cache?t.cache(e,n.escape):t.parse(t.tpl,e),r?void r(c):c):n.error("no data")};var o=function(e){return"string"!=typeof e?n.error("Template not found"):new t(e)};o.config=function(e){e=e||{};for(var n in e)r[n]=e[n]},o.v="1.2.0",e("laytpl",o)});
|
||||
/** layui-v2.2.3 MIT License By http://www.layui.com */
|
||||
;layui.define(function(e){"use strict";var r={open:"{{",close:"}}"},c={exp:function(e){return new RegExp(e,"g")},query:function(e,c,t){var o=["#([\\s\\S])+?","([^{#}])*?"][e||0];return n((c||"")+r.open+o+r.close+(t||""))},escape:function(e){return String(e||"").replace(/&(?!#?[a-zA-Z0-9]+;)/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/'/g,"'").replace(/"/g,""")},error:function(e,r){var c="Laytpl Error:";return"object"==typeof console&&console.error(c+e+"\n"+(r||"")),c+e}},n=c.exp,t=function(e){this.tpl=e};t.pt=t.prototype,window.errors=0,t.pt.parse=function(e,t){var o=this,p=e,a=n("^"+r.open+"#",""),l=n(r.close+"$","");e=e.replace(/\s+|\r|\t|\n/g," ").replace(n(r.open+"#"),r.open+"# ").replace(n(r.close+"}"),"} "+r.close).replace(/\\/g,"\\\\").replace(n(r.open+"!(.+?)!"+r.close),function(e){return e=e.replace(n("^"+r.open+"!"),"").replace(n("!"+r.close),"").replace(n(r.open+"|"+r.close),function(e){return e.replace(/(.)/g,"\\$1")})}).replace(/(?="|')/g,"\\").replace(c.query(),function(e){return e=e.replace(a,"").replace(l,""),'";'+e.replace(/\\/g,"")+';view+="'}).replace(c.query(1),function(e){var c='"+(';return e.replace(/\s/g,"")===r.open+r.close?"":(e=e.replace(n(r.open+"|"+r.close),""),/^=/.test(e)&&(e=e.replace(/^=/,""),c='"+_escape_('),c+e.replace(/\\/g,"")+')+"')}),e='"use strict";var view = "'+e+'";return view;';try{return o.cache=e=new Function("d, _escape_",e),e(t,c.escape)}catch(u){return delete o.cache,c.error(u,p)}},t.pt.render=function(e,r){var n,t=this;return e?(n=t.cache?t.cache(e,c.escape):t.parse(t.tpl,e),r?void r(n):n):c.error("no data")};var o=function(e){return"string"!=typeof e?c.error("Template not found"):new t(e)};o.config=function(e){e=e||{};for(var c in e)r[c]=e[c]},o.v="1.2.0",e("laytpl",o)});
|
File diff suppressed because one or more lines are too long
2
root/res/layui/lay/modules/table.js
Normal file
2
root/res/layui/lay/modules/table.js
Normal file
File diff suppressed because one or more lines are too long
@@ -1,2 +1,2 @@
|
||||
/** layui-v1.0.9_rls MIT License By http://www.layui.com */
|
||||
;layui.define("jquery",function(e){"use strict";var o=layui.jquery,a=layui.hint(),r="layui-tree-enter",i=function(e){this.options=e},t={arrow:["",""],checkbox:["",""],radio:["",""],branch:["",""],leaf:""};i.prototype.init=function(e){var o=this;e.addClass("layui-box layui-tree"),o.options.skin&&e.addClass("layui-tree-skin-"+o.options.skin),o.tree(e),o.on(e)},i.prototype.tree=function(e,a){var r=this,i=r.options,n=a||i.nodes;layui.each(n,function(a,n){var l=n.children&&n.children.length>0,c=o('<ul class="'+(n.spread?"layui-show":"")+'"></ul>'),s=o(["<li "+(n.spread?'data-spread="'+n.spread+'"':"")+">",function(){return l?'<i class="layui-icon layui-tree-spread">'+(n.spread?t.arrow[1]:t.arrow[0])+"</i>":""}(),function(){return i.check?'<i class="layui-icon layui-tree-check">'+("checkbox"===i.check?t.checkbox[0]:"radio"===i.check?t.radio[0]:"")+"</i>":""}(),function(){return'<a href="'+(n.href||"javascript:;")+'" '+(i.target&&n.href?'target="'+i.target+'"':"")+">"+('<i class="layui-icon layui-tree-'+(l?"branch":"leaf")+'">'+(l?n.spread?t.branch[1]:t.branch[0]:t.leaf)+"</i>")+("<cite>"+(n.name||"未命名")+"</cite></a>")}(),"</li>"].join(""));l&&(s.append(c),r.tree(c,n.children)),e.append(s),"function"==typeof i.click&&r.click(s,n),r.spread(s,n),i.drag&&r.drag(s,n)})},i.prototype.click=function(e,o){var a=this,r=a.options;e.children("a").on("click",function(e){layui.stope(e),r.click(o)})},i.prototype.spread=function(e,o){var a=this,r=(a.options,e.children(".layui-tree-spread")),i=e.children("ul"),n=e.children("a"),l=function(){e.data("spread")?(e.data("spread",null),i.removeClass("layui-show"),r.html(t.arrow[0]),n.find(".layui-icon").html(t.branch[0])):(e.data("spread",!0),i.addClass("layui-show"),r.html(t.arrow[1]),n.find(".layui-icon").html(t.branch[1]))};i[0]&&(r.on("click",l),n.on("dblclick",l))},i.prototype.on=function(e){var a=this,i=a.options,t="layui-tree-drag";e.find("i").on("selectstart",function(e){return!1}),i.drag&&o(document).on("mousemove",function(e){var r=a.move;if(r.from){var i=(r.to,o('<div class="layui-box '+t+'"></div>'));e.preventDefault(),o("."+t)[0]||o("body").append(i);var n=o("."+t)[0]?o("."+t):i;n.addClass("layui-show").html(r.from.elem.children("a").html()),n.css({left:e.pageX+10,top:e.pageY+10})}}).on("mouseup",function(){var e=a.move;e.from&&(e.from.elem.children("a").removeClass(r),e.to&&e.to.elem.children("a").removeClass(r),a.move={},o("."+t).remove())})},i.prototype.move={},i.prototype.drag=function(e,a){var i=this,t=(i.options,e.children("a")),n=function(){var t=o(this),n=i.move;n.from&&(n.to={item:a,elem:e},t.addClass(r))};t.on("mousedown",function(){var o=i.move;o.from={item:a,elem:e}}),t.on("mouseenter",n).on("mousemove",n).on("mouseleave",function(){var e=o(this),a=i.move;a.from&&(delete a.to,e.removeClass(r))})},e("tree",function(e){var r=new i(e=e||{}),t=o(e.elem);return t[0]?void r.init(t):a.error("layui.tree 没有找到"+e.elem+"元素")})});
|
||||
/** layui-v2.2.3 MIT License By http://www.layui.com */
|
||||
;layui.define("jquery",function(e){"use strict";var o=layui.$,a=layui.hint(),i="layui-tree-enter",r=function(e){this.options=e},t={arrow:["",""],checkbox:["",""],radio:["",""],branch:["",""],leaf:""};r.prototype.init=function(e){var o=this;e.addClass("layui-box layui-tree"),o.options.skin&&e.addClass("layui-tree-skin-"+o.options.skin),o.tree(e),o.on(e)},r.prototype.tree=function(e,a){var i=this,r=i.options,n=a||r.nodes;layui.each(n,function(a,n){var l=n.children&&n.children.length>0,c=o('<ul class="'+(n.spread?"layui-show":"")+'"></ul>'),s=o(["<li "+(n.spread?'data-spread="'+n.spread+'"':"")+">",function(){return l?'<i class="layui-icon layui-tree-spread">'+(n.spread?t.arrow[1]:t.arrow[0])+"</i>":""}(),function(){return r.check?'<i class="layui-icon layui-tree-check">'+("checkbox"===r.check?t.checkbox[0]:"radio"===r.check?t.radio[0]:"")+"</i>":""}(),function(){return'<a href="'+(n.href||"javascript:;")+'" '+(r.target&&n.href?'target="'+r.target+'"':"")+">"+('<i class="layui-icon layui-tree-'+(l?"branch":"leaf")+'">'+(l?n.spread?t.branch[1]:t.branch[0]:t.leaf)+"</i>")+("<cite>"+(n.name||"未命名")+"</cite></a>")}(),"</li>"].join(""));l&&(s.append(c),i.tree(c,n.children)),e.append(s),"function"==typeof r.click&&i.click(s,n),i.spread(s,n),r.drag&&i.drag(s,n)})},r.prototype.click=function(e,o){var a=this,i=a.options;e.children("a").on("click",function(e){layui.stope(e),i.click(o)})},r.prototype.spread=function(e,o){var a=this,i=(a.options,e.children(".layui-tree-spread")),r=e.children("ul"),n=e.children("a"),l=function(){e.data("spread")?(e.data("spread",null),r.removeClass("layui-show"),i.html(t.arrow[0]),n.find(".layui-icon").html(t.branch[0])):(e.data("spread",!0),r.addClass("layui-show"),i.html(t.arrow[1]),n.find(".layui-icon").html(t.branch[1]))};r[0]&&(i.on("click",l),n.on("dblclick",l))},r.prototype.on=function(e){var a=this,r=a.options,t="layui-tree-drag";e.find("i").on("selectstart",function(e){return!1}),r.drag&&o(document).on("mousemove",function(e){var i=a.move;if(i.from){var r=(i.to,o('<div class="layui-box '+t+'"></div>'));e.preventDefault(),o("."+t)[0]||o("body").append(r);var n=o("."+t)[0]?o("."+t):r;n.addClass("layui-show").html(i.from.elem.children("a").html()),n.css({left:e.pageX+10,top:e.pageY+10})}}).on("mouseup",function(){var e=a.move;e.from&&(e.from.elem.children("a").removeClass(i),e.to&&e.to.elem.children("a").removeClass(i),a.move={},o("."+t).remove())})},r.prototype.move={},r.prototype.drag=function(e,a){var r=this,t=(r.options,e.children("a")),n=function(){var t=o(this),n=r.move;n.from&&(n.to={item:a,elem:e},t.addClass(i))};t.on("mousedown",function(){var o=r.move;o.from={item:a,elem:e}}),t.on("mouseenter",n).on("mousemove",n).on("mouseleave",function(){var e=o(this),a=r.move;a.from&&(delete a.to,e.removeClass(i))})},e("tree",function(e){var i=new r(e=e||{}),t=o(e.elem);return t[0]?void i.init(t):a.error("layui.tree 没有找到"+e.elem+"元素")})});
|
File diff suppressed because one or more lines are too long
@@ -1,2 +1,2 @@
|
||||
/** layui-v1.0.9_rls MIT License By http://www.layui.com */
|
||||
;layui.define("jquery",function(l){"use strict";var o=layui.jquery,i={fixbar:function(l){l=l||{},l.bgcolor=l.bgcolor?"background-color:"+l.bgcolor:"";var i,a,c="layui-fixbar-top",t=[l.bar1===!0?"":l.bar1,l.bar2===!0?"":l.bar2,""],r=o(['<ul class="layui-fixbar">',l.bar1?'<li class="layui-icon" lay-type="bar1" style="'+l.bgcolor+'">'+t[0]+"</li>":"",l.bar2?'<li class="layui-icon" lay-type="bar2" style="'+l.bgcolor+'">'+t[1]+"</li>":"",'<li class="layui-icon '+c+'" lay-type="top" style="'+l.bgcolor+'">'+t[2]+"</li>","</ul>"].join("")),e=r.find("."+c),s=function(){var i=o(document).scrollTop();i>=(l.showHeight||200)?a||(e.show(),a=1):a&&(e.hide(),a=0)};o(".layui-fixbar")[0]||("object"==typeof l.css&&r.css(l.css),o("body").append(r),s(),r.find("li").on("click",function(){var i=o(this),a=i.attr("lay-type");"top"===a&&o("html,body").animate({scrollTop:0},200),l.click&&l.click.call(this,a)}),o(document).on("scroll",function(){i&&clearTimeout(i),i=setTimeout(function(){s()},100)}))}};l("util",i)});
|
||||
/** layui-v2.2.3 MIT License By http://www.layui.com */
|
||||
;layui.define("jquery",function(e){"use strict";var t=layui.$,i={fixbar:function(e){var i,o,a="layui-fixbar",r="layui-fixbar-top",n=t(document),l=t("body");e=t.extend({showHeight:200},e),e.bar1=e.bar1===!0?"":e.bar1,e.bar2=e.bar2===!0?"":e.bar2,e.bgcolor=e.bgcolor?"background-color:"+e.bgcolor:"";var c=[e.bar1,e.bar2,""],g=t(['<ul class="'+a+'">',e.bar1?'<li class="layui-icon" lay-type="bar1" style="'+e.bgcolor+'">'+c[0]+"</li>":"",e.bar2?'<li class="layui-icon" lay-type="bar2" style="'+e.bgcolor+'">'+c[1]+"</li>":"",'<li class="layui-icon '+r+'" lay-type="top" style="'+e.bgcolor+'">'+c[2]+"</li>","</ul>"].join("")),s=g.find("."+r),u=function(){var t=n.scrollTop();t>=e.showHeight?i||(s.show(),i=1):i&&(s.hide(),i=0)};t("."+a)[0]||("object"==typeof e.css&&g.css(e.css),l.append(g),u(),g.find("li").on("click",function(){var i=t(this),o=i.attr("lay-type");"top"===o&&t("html,body").animate({scrollTop:0},200),e.click&&e.click.call(this,o)}),n.on("scroll",function(){clearTimeout(o),o=setTimeout(function(){u()},100)}))},countdown:function(e,t,i){var o=this,a="function"==typeof t,r=new Date(e).getTime(),n=new Date(!t||a?(new Date).getTime():t).getTime(),l=r-n,c=[Math.floor(l/864e5),Math.floor(l/36e5)%24,Math.floor(l/6e4)%60,Math.floor(l/1e3)%60];a&&(i=t);var g=setTimeout(function(){o.countdown(e,n+1e3,i)},1e3);return i&&i(l>0?c:[0,0,0,0],t,g),l<=0&&clearTimeout(g),g},timeAgo:function(e,t){var i=this,o=[[],[]],a=(new Date).getTime()-new Date(e).getTime();return a>6912e5?(a=new Date(e),o[0][0]=i.digit(a.getFullYear(),4),o[0][1]=i.digit(a.getMonth()+1),o[0][2]=i.digit(a.getDate()),t||(o[1][0]=i.digit(a.getHours()),o[1][1]=i.digit(a.getMinutes()),o[1][2]=i.digit(a.getSeconds())),o[0].join("-")+" "+o[1].join(":")):a>=864e5?(a/1e3/60/60/24|0)+"天前":a>=36e5?(a/1e3/60/60|0)+"小时前":a>=12e4?(a/1e3/60|0)+"分钟前":a<0?"未来":"刚刚"},digit:function(e,t){var i="";e=String(e),t=t||2;for(var o=e.length;o<t;o++)i+="0";return e<Math.pow(10,t)?i+(0|e):e},toDateString:function(e,t){var i=this,o=new Date(e||new Date),a=[i.digit(o.getFullYear(),4),i.digit(o.getMonth()+1),i.digit(o.getDate())],r=[i.digit(o.getHours()),i.digit(o.getMinutes()),i.digit(o.getSeconds())];return t=t||"yyyy-MM-dd HH:mm:ss",t.replace(/yyyy/g,a[0]).replace(/MM/g,a[1]).replace(/dd/g,a[2]).replace(/HH/g,r[0]).replace(/mm/g,r[1]).replace(/ss/g,r[2])}};e("util",i)});
|
5
root/res/layui/layui.all.js
Normal file
5
root/res/layui/layui.all.js
Normal file
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
165
root/res/mods/case.js
Normal file
165
root/res/mods/case.js
Normal file
@@ -0,0 +1,165 @@
|
||||
/**
|
||||
|
||||
@Name: 案例
|
||||
|
||||
*/
|
||||
|
||||
layui.define(['laypage', 'fly'], function(exports){
|
||||
|
||||
var $ = layui.jquery;
|
||||
var layer = layui.layer;
|
||||
var util = layui.util;
|
||||
var laytpl = layui.laytpl;
|
||||
var form = layui.form;
|
||||
var laypage = layui.laypage;
|
||||
var upload = layui.upload;
|
||||
var fly = layui.fly;
|
||||
var device = layui.device();
|
||||
|
||||
|
||||
//求解管理
|
||||
var active = {
|
||||
//提交案例
|
||||
push: function(div){
|
||||
layer.open({
|
||||
type: 1
|
||||
,id: 'LAY_pushcase'
|
||||
,title: '提交案例'
|
||||
,area: (device.ios || device.android) ? ($(window).width() + 'px') : '660px'
|
||||
,content: ['<ul class="layui-form" style="margin: 20px;">'
|
||||
,'<li class="layui-form-item">'
|
||||
,'<label class="layui-form-label">案例名称</label>'
|
||||
,'<div class="layui-input-block">'
|
||||
,'<input required name="title" lay-verify="required" placeholder="一般为网站名称" value="" class="layui-input">'
|
||||
,'</div>'
|
||||
,'</li>'
|
||||
,'<li class="layui-form-item">'
|
||||
,'<label class="layui-form-label">案例网址</label>'
|
||||
,'<div class="layui-input-block">'
|
||||
,'<input required name="link" lay-verify="url" placeholder="必须是自己或自己参与过的项目" value="" class="layui-input">'
|
||||
,'</div>'
|
||||
,'</li>'
|
||||
,'<li class="layui-form-item layui-form-text">'
|
||||
,'<label class="layui-form-label">案例描述</label>'
|
||||
,'<div class="layui-input-block layui-form-text">'
|
||||
,'<textarea required name="desc" lay-verify="required" autocomplete="off" placeholder="大致介绍你的项目,也可以阐述你在该项目中使用 layui 的感受\n10-60个字" class="layui-textarea"></textarea>'
|
||||
,'</div>'
|
||||
,'</li>'
|
||||
,'<li class="layui-form-item">'
|
||||
,'<label class="layui-form-label">案例封面</label>'
|
||||
,'<div class="layui-input-inline" style="width:auto;">'
|
||||
,'<input type="hidden" name="cover" lay-verify="required" class="layui-input fly-case-image">'
|
||||
,'<button type="button" class="layui-btn layui-btn-primary" id="caseUpload">'
|
||||
,'<i class="layui-icon"></i>上传图片'
|
||||
,'</button>'
|
||||
,'</div>'
|
||||
,'<div class="layui-form-mid layui-word-aux" id="preview">推荐尺寸:478*300,大小不能超过 30kb</div>'
|
||||
,'</li>'
|
||||
,'<li class="layui-form-item">'
|
||||
,'<label class="layui-form-label"> </label>'
|
||||
,'<div class="layui-input-block">'
|
||||
,'<input type="checkbox" name="agree" id="agree" title="我同意(如果你进行了刷赞行为,你的案例将被立马剔除)" lay-skin="primary">'
|
||||
,'</div>'
|
||||
,'</li>'
|
||||
,'<li class="layui-form-item">'
|
||||
,'<div class="layui-input-block">'
|
||||
,'<button type="button" lay-submit lay-filter="pushCase" class="layui-btn">提交案例</button>'
|
||||
,'</div>'
|
||||
,'</li>'
|
||||
,'</ul>'].join('')
|
||||
,success: function(layero, index){
|
||||
var image = layero.find('.fly-case-image')
|
||||
,preview = $('#preview');
|
||||
|
||||
upload.render({
|
||||
url: '/api/upload/case/'
|
||||
,elem: '#caseUpload'
|
||||
,size: 30
|
||||
,done: function(res){
|
||||
if(res.status == 0){
|
||||
image.val(res.url);
|
||||
preview.html('<a href="'+ res.url +'" target="_blank" style="color: #5FB878;">封面已上传,点击可预览</a>');
|
||||
} else {
|
||||
layer.msg(res.msg, {icon: 5});
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
form.render('checkbox').on('submit(pushCase)', function(data){
|
||||
if(!data.field.agree){
|
||||
return layer.tips('你需要同意才能提交', $('#agree').next(), {tips: 1});
|
||||
}
|
||||
|
||||
fly.json('/case/push/', data.field, function(res){
|
||||
layer.close(index);
|
||||
layer.alert(res.msg, {
|
||||
icon: 1
|
||||
})
|
||||
});
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
//点赞
|
||||
,praise: function(othis){
|
||||
var li = othis.parents('li')
|
||||
,PRIMARY = 'layui-btn-primary'
|
||||
,unpraise = !othis.hasClass(PRIMARY)
|
||||
,numElem = li.find('.fly-case-nums')
|
||||
|
||||
fly.json('/case/praise/', {
|
||||
id: li.data('id')
|
||||
,unpraise: unpraise ? true : null
|
||||
}, function(res){
|
||||
numElem.html(res.praise);
|
||||
if(unpraise){
|
||||
othis.addClass(PRIMARY).html('点赞');
|
||||
layer.tips('少了个赞囖', numElem, {
|
||||
tips: 1
|
||||
});
|
||||
} else {
|
||||
othis.removeClass(PRIMARY).html('已赞');
|
||||
layer.tips('成功获得个赞', numElem, {
|
||||
tips: [1, '#FF5722']
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
//查看点赞用户
|
||||
,showPraise: function(othis){
|
||||
var li = othis.parents('li');
|
||||
if(othis.html() == 0) return layer.tips('该项目还没有收到赞', othis, {
|
||||
tips: 1
|
||||
});
|
||||
fly.json('/case/praise_user/', {
|
||||
id: li.data('id')
|
||||
}, function(res){
|
||||
var html = '';
|
||||
layer.open({
|
||||
type: 1
|
||||
,title: '项目【'+ res.title + '】获得的赞'
|
||||
,id: 'LAY_showPraise'
|
||||
,shade: 0.8
|
||||
,shadeClose: true
|
||||
,area: '305px'
|
||||
,skin: 'layer-ext-case'
|
||||
,content: function(){
|
||||
layui.each(res.data, function(_, item){
|
||||
html += '<li><a href="/u/'+ 168*item.id +'/" target="_blank" title="'+ item.username +'"><img src="'+ item.avatar +'"></a></li>'
|
||||
});
|
||||
return '<ul class="layer-ext-ul">' + html + '</ul>';
|
||||
}()
|
||||
})
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
$('body').on('click', '.fly-case-active', function(){
|
||||
var othis = $(this), type = othis.data('type');
|
||||
active[type] && active[type].call(this, othis);
|
||||
});
|
||||
|
||||
exports('case', {});
|
||||
});
|
@@ -5,18 +5,22 @@
|
||||
*/
|
||||
|
||||
|
||||
layui.define(['layer', 'laytpl', 'form', 'upload', 'util', 'upload','face','element'], function(exports){
|
||||
layui.define(['layer', 'laytpl', 'form', 'element', 'upload', 'util', 'face'], function(exports){
|
||||
|
||||
var $ = layui.jquery
|
||||
,layer = layui.layer
|
||||
,laytpl = layui.laytpl
|
||||
,form = layui.form()
|
||||
,form = layui.form
|
||||
,element = layui.element
|
||||
,upload = layui.upload
|
||||
,util = layui.util
|
||||
,device = layui.device()
|
||||
|
||||
,DISABLED = 'layui-btn-disabled';
|
||||
|
||||
//阻止IE7以下访问
|
||||
if(device.ie && device.ie < 8){
|
||||
layer.alert('如果您非得使用ie浏览Fly社区,那么请使用ie8+');
|
||||
layer.alert('如果您非得使用 IE 浏览器访问社区,那么请使用 IE8+');
|
||||
}
|
||||
|
||||
layui.focusInsert = function(obj, str){
|
||||
@@ -32,50 +36,55 @@ layui.define(['layer', 'laytpl', 'form', 'upload', 'util', 'upload','face','elem
|
||||
obj.value = result.join('');
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
//数字前置补零
|
||||
layui.laytpl.digit = function(num, length, end){
|
||||
var str = '';
|
||||
num = String(num);
|
||||
length = length || 2;
|
||||
for(var i = num.length; i < length; i++){
|
||||
str += '0';
|
||||
}
|
||||
return num < Math.pow(10, length) ? str + (num|0) : num;
|
||||
};
|
||||
|
||||
var gather = {
|
||||
|
||||
var fly = {
|
||||
|
||||
//Ajax
|
||||
json: function(url, data, success, options){
|
||||
var that = this;
|
||||
var that = this, type = typeof data === 'function';
|
||||
|
||||
if(type){
|
||||
options = success
|
||||
success = data;
|
||||
data = {};
|
||||
}
|
||||
|
||||
options = options || {};
|
||||
data = data || {};
|
||||
|
||||
return $.ajax({
|
||||
type: options.type || 'post',
|
||||
dataType: options.dataType || 'json',
|
||||
data: data,
|
||||
url: url,
|
||||
success: function(res){
|
||||
if(res.status === 0) {
|
||||
if(typeof res === 'string'){
|
||||
res = JSON.parse(res);
|
||||
}
|
||||
if(res.retcode === 0) {
|
||||
success && success(res);
|
||||
} else {
|
||||
layer.msg(res.msg||res.code, {shift: 6});
|
||||
layer.msg(res.retinfo || res.code, {shift: 6});
|
||||
options.error && options.error();
|
||||
}
|
||||
}, error: function(e){
|
||||
options.error || layer.msg('请求异常,请重试', {shift: 6});
|
||||
layer.msg('请求异常,请重试', {shift: 6});
|
||||
options.error && options.error(e);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
//将普通对象按某个key排序
|
||||
,sort: function(data, key, asc){
|
||||
var obj = JSON.parse(JSON.stringify(data));
|
||||
var compare = function (obj1, obj2) {
|
||||
var value1 = obj1[key];
|
||||
var value2 = obj2[key];
|
||||
if (value2 < value1) {
|
||||
return -1;
|
||||
} else if (value2 > value1) {
|
||||
return 1;
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
};
|
||||
obj.sort(compare);
|
||||
if(asc) obj.reverse();
|
||||
return obj;
|
||||
}
|
||||
|
||||
//计算字符长度
|
||||
,charLen: function(val){
|
||||
var arr = val.split(''), len = 0;
|
||||
@@ -89,60 +98,18 @@ layui.define(['layer', 'laytpl', 'form', 'upload', 'util', 'upload','face','elem
|
||||
|
||||
//简易编辑器
|
||||
,layEditor: function(options){
|
||||
var html = '<div class="fly-edit">'
|
||||
+'<span type="face" title="插入表情"><i class="iconfont icon-biaoqing"></i>表情</span>'
|
||||
+'<span type="picture" title="插入图片:img[src]"><i class="iconfont icon-tupian"></i>图片</span>'
|
||||
+'<span type="href" title="超链接格式:a(href)[text]"><i class="iconfont icon-lianjie"></i>链接</span>'
|
||||
+'<span type="code" title="插入代码"><i class="iconfont icon-daima"></i>代码</span>'
|
||||
+'<span type="yulan" title="预览"><i class="iconfont icon-yulan"></i>预览</span>'
|
||||
+'</div>';
|
||||
var html = ['<div class="layui-unselect fly-edit">'
|
||||
,'<span type="face" title="插入表情"><i class="iconfont icon-yxj-expression" style="top: 1px;"></i></span>'
|
||||
,'<span type="picture" title="插入图片:img[src]"><i class="iconfont icon-tupian"></i></span>'
|
||||
,'<span type="href" title="超链接格式:a(href)[text]"><i class="iconfont icon-lianjie"></i></span>'
|
||||
,'<span type="code" title="插入代码或引用"><i class="iconfont icon-emwdaima" style="top: 1px;"></i></span>'
|
||||
,'<span type="hr" title="插入水平线">hr</span>'
|
||||
,'<span type="yulan" title="预览"><i class="iconfont icon-yulan1"></i></span>'
|
||||
,'</div>'].join('');
|
||||
|
||||
var log = {}, mod = {
|
||||
picture: function(editor){ //插入图片
|
||||
layer.open({
|
||||
type: 1
|
||||
,id: 'fly-jie-upload'
|
||||
,title: '插入图片'
|
||||
,area: 'auto'
|
||||
,shade: false
|
||||
,area: '465px'
|
||||
,skin: 'layui-layer-border'
|
||||
,content: ['<ul class="layui-form layui-form-pane" style="margin: 20px;">'
|
||||
,'<li class="layui-form-item">'
|
||||
,'<label class="layui-form-label">URL</label>'
|
||||
,'<div class="layui-input-inline">'
|
||||
,'<input required name="image" placeholder="支持直接粘贴远程图片地址" value="" class="layui-input">'
|
||||
,'</div>'
|
||||
,'<input required type="file" name="file" class="layui-upload-file" value="">'
|
||||
,'</li>'
|
||||
,'<li class="layui-form-item" style="text-align: center;">'
|
||||
,'<button type="button" lay-submit lay-filter="uploadImages" class="layui-btn">确认</button>'
|
||||
,'</li>'
|
||||
,'</ul>'].join('')
|
||||
,success: function(layero, index){
|
||||
var image = layero.find('input[name="image"]');
|
||||
layui.upload({
|
||||
url: '/os/file/upload'
|
||||
,elem: '#fly-jie-upload .layui-upload-file'
|
||||
,success: function(res){
|
||||
if(res.retcode == 0){
|
||||
image.val(res.retinfo);
|
||||
} else {
|
||||
layer.msg(res.msg, {icon: 5});
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
form.on('submit(uploadImages)', function(data){
|
||||
var field = data.field;
|
||||
if(!field.image) return image.focus();
|
||||
layui.focusInsert(editor[0], 'img['+ field.image + '] ');
|
||||
layer.close(index);
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
,face: function(editor, self){ //插入表情
|
||||
var str = '', ul, face = gather.faces;
|
||||
face: function(editor, self){ //插入表情
|
||||
var str = '', ul, face = fly.faces;
|
||||
for(var key in face){
|
||||
str += '<li title="'+ key +'"><img src="'+ face[key] +'"></li>';
|
||||
}
|
||||
@@ -160,10 +127,68 @@ layui.define(['layer', 'laytpl', 'form', 'upload', 'util', 'upload','face','elem
|
||||
layui.focusInsert(editor[0], 'face' + title);
|
||||
});
|
||||
}
|
||||
,picture: function(editor){ //插入图片
|
||||
layer.open({
|
||||
type: 1
|
||||
,id: 'fly-jie-upload'
|
||||
,title: '插入图片'
|
||||
,area: 'auto'
|
||||
,shade: false
|
||||
,area: '465px'
|
||||
,fixed: false
|
||||
,offset: [
|
||||
editor.offset().top - $(window).scrollTop() + 'px'
|
||||
,editor.offset().left + 'px'
|
||||
]
|
||||
,skin: 'layui-layer-border'
|
||||
,content: ['<ul class="layui-form layui-form-pane" style="margin: 20px;">'
|
||||
,'<li class="layui-form-item">'
|
||||
,'<label class="layui-form-label">URL</label>'
|
||||
,'<div class="layui-input-inline">'
|
||||
,'<input required name="image" placeholder="支持直接粘贴远程图片地址" value="" class="layui-input">'
|
||||
,'</div>'
|
||||
,'<button type="button" class="layui-btn layui-btn-primary" id="uploadImg"><i class="layui-icon"></i>上传图片</button>'
|
||||
,'</li>'
|
||||
,'<li class="layui-form-item" style="text-align: center;">'
|
||||
,'<button type="button" lay-submit lay-filter="uploadImages" class="layui-btn">确认</button>'
|
||||
,'</li>'
|
||||
,'</ul>'].join('')
|
||||
,success: function(layero, index){
|
||||
var image = layero.find('input[name="image"]');
|
||||
|
||||
//执行上传实例
|
||||
upload.render({
|
||||
elem: '#uploadImg'
|
||||
,url: '/os/file/upload'
|
||||
,size: 200
|
||||
,done: function(res){
|
||||
if(res.retcode == 0){
|
||||
image.val(res.retinfo);
|
||||
} else {
|
||||
layer.msg(res.msg, {icon: 5});
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
form.on('submit(uploadImages)', function(data){
|
||||
var field = data.field;
|
||||
if(!field.image) return image.focus();
|
||||
layui.focusInsert(editor[0], 'img['+ field.image + '] ');
|
||||
layer.close(index);
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
,href: function(editor){ //超链接
|
||||
layer.prompt({
|
||||
title: '请输入合法链接'
|
||||
,shade: false
|
||||
,fixed: false
|
||||
,id: 'LAY_flyedit_href'
|
||||
,offset: [
|
||||
editor.offset().top - $(window).scrollTop() + 'px'
|
||||
,editor.offset().left + 'px'
|
||||
]
|
||||
}, function(val, index, elem){
|
||||
if(!/^http(s*):\/\/[\S]/.test(val)){
|
||||
layer.tips('这根本不是个链接,不要骗我。', elem, {tips:1})
|
||||
@@ -175,26 +200,31 @@ layui.define(['layer', 'laytpl', 'form', 'upload', 'util', 'upload','face','elem
|
||||
}
|
||||
,code: function(editor){ //插入代码
|
||||
layer.prompt({
|
||||
title: '请贴入代码'
|
||||
title: '请贴入代码或任意文本'
|
||||
,formType: 2
|
||||
,maxlength: 10000
|
||||
,shade: false
|
||||
,area: ['830px', '390px']
|
||||
,id: 'LAY_flyedit_code'
|
||||
,area: ['800px', '360px']
|
||||
}, function(val, index, elem){
|
||||
layui.focusInsert(editor[0], '[pre]\n'+ val + '\n[/pre]');
|
||||
layer.close(index);
|
||||
});
|
||||
}
|
||||
,hr: function(editor){ //插入水平分割线
|
||||
layui.focusInsert(editor[0], '[hr]');
|
||||
}
|
||||
,yulan: function(editor){ //预览
|
||||
var content = editor.val();
|
||||
|
||||
content = /^\{html\}/.test(content)
|
||||
? content.replace(/^\{html\}/, '')
|
||||
: gather.content(content);
|
||||
: fly.content(content);
|
||||
|
||||
layer.open({
|
||||
type: 1
|
||||
,title: '预览'
|
||||
,shade: false
|
||||
,area: ['100%', '100%']
|
||||
,scrollbar: false
|
||||
,content: '<div class="detail-body" style="margin:20px;">'+ content +'</div>'
|
||||
@@ -204,7 +234,7 @@ layui.define(['layer', 'laytpl', 'form', 'upload', 'util', 'upload','face','elem
|
||||
|
||||
layui.use('face', function(face){
|
||||
options = options || {};
|
||||
gather.faces = face;
|
||||
fly.faces = face;
|
||||
$(options.elem).each(function(index){
|
||||
var that = this, othis = $(that), parent = othis.parent();
|
||||
parent.prepend(html);
|
||||
@@ -229,100 +259,278 @@ layui.define(['layer', 'laytpl', 'form', 'upload', 'util', 'upload','face','elem
|
||||
,content: function(content){
|
||||
//支持的html标签
|
||||
var html = function(end){
|
||||
return new RegExp('\\['+ (end||'') +'(pre|div|table|thead|th|tbody|tr|td|ul|li|ol|li|dl|dt|dd|h2|h3|h4|h5)\\]\\n*', 'g');
|
||||
return new RegExp('\\n*\\['+ (end||'') +'(pre|hr|div|span|p|table|thead|th|tbody|tr|td|ul|li|ol|li|dl|dt|dd|h2|h3|h4|h5)([\\s\\S]*?)\\]\\n*', 'g');
|
||||
};
|
||||
content = gather.escape(content||'') //XSS
|
||||
content = fly.escape(content||'') //XSS
|
||||
.replace(/img\[([^\s]+?)\]/g, function(img){ //转义图片
|
||||
return '<img src="' + img.replace(/(^img\[)|(\]$)/g, '') + '">';
|
||||
}).replace(/@(\S+)(\s+?|$)/g, '@<a href="javascript:;" class="fly-aite">$1</a>$2') //转义@
|
||||
.replace(/face\[([^\s\[\]]+?)\]/g, function(face){ //转义表情
|
||||
var alt = face.replace(/^face/g, '');
|
||||
return '<img alt="'+ alt +'" title="'+ alt +'" src="' + gather.faces[alt] + '">';
|
||||
return '<img alt="'+ alt +'" title="'+ alt +'" src="' + fly.faces[alt] + '">';
|
||||
}).replace(/a\([\s\S]+?\)\[[\s\S]*?\]/g, function(str){ //转义链接
|
||||
var href = (str.match(/a\(([\s\S]+?)\)\[/)||[])[1];
|
||||
var text = (str.match(/\)\[([\s\S]*?)\]/)||[])[1];
|
||||
if(!href) return str;
|
||||
var rel = /^(http(s)*:\/\/)\b(?!(\w+\.)*(sentsin.com|layui.com))\b/.test(href.replace(/\s/g, ''));
|
||||
return '<a href="'+ href +'" target="_blank"'+ (rel ? ' rel="nofollow"' : '') +'>'+ (text||href) +'</a>';
|
||||
}).replace(html(), '\<$1\>').replace(html('/'), '\</$1\>') //转移代码
|
||||
}).replace(html(), '\<$1 $2\>').replace(html('/'), '\</$1\>') //转移HTML代码
|
||||
.replace(/\n/g, '<br>') //转义换行
|
||||
return content;
|
||||
}
|
||||
|
||||
//新消息通知
|
||||
,newmsg: function(){
|
||||
if(layui.cache.user.uid !== -1){
|
||||
gather.json('/message/nums/', {
|
||||
var elemUser = $('.fly-nav-user');
|
||||
if(layui.cache.user.uid !== -1 && elemUser[0]){
|
||||
fly.json('/message/nums/', {
|
||||
_: new Date().getTime()
|
||||
}, function(res){
|
||||
if(res.status === 0 && res.count > 0){
|
||||
var msg = $('<a class="nav-message" href="javascript:;" title="您有'+ res.count +'条未阅读的消息">'+ res.count +'</a>');
|
||||
$('.nav-user').append(msg);
|
||||
var msg = $('<a class="fly-nav-msg" href="javascript:;">'+ res.count +'</a>');
|
||||
elemUser.append(msg);
|
||||
msg.on('click', function(){
|
||||
gather.json('/message/read', {}, function(res){
|
||||
fly.json('/message/read', {}, function(res){
|
||||
if(res.status === 0){
|
||||
location.href = '/user/message/';
|
||||
}
|
||||
});
|
||||
});
|
||||
layer.tips('你有 '+ res.count +' 条未读消息', msg, {
|
||||
tips: 3
|
||||
,tipsMore: true
|
||||
,fixed: true
|
||||
});
|
||||
msg.on('mouseenter', function(){
|
||||
layer.closeAll('tips');
|
||||
})
|
||||
}
|
||||
});
|
||||
}
|
||||
return arguments.callee;
|
||||
}
|
||||
|
||||
,cookie: function(e,o,t){
|
||||
e=e||"";var n,i,r,a,c,p,s,d,u;if("undefined"==typeof o){if(p=null,document.cookie&&""!=document.cookie)for(s=document.cookie.split(";"),d=0;d<s.length;d++)if(u=$.trim(s[d]),u.substring(0,e.length+1)==e+"="){p=decodeURIComponent(u.substring(e.length+1));break}return p}t=t||{},null===o&&(o="",t.expires=-1),n="",t.expires&&("number"==typeof t.expires||t.expires.toUTCString)&&("number"==typeof t.expires?(i=new Date,i.setTime(i.getTime()+864e5*t.expires)):i=t.expires,n="; expires="+i.toUTCString()),r=t.path?"; path="+t.path:"",a=t.domain?"; domain="+t.domain:"",c=t.secure?"; secure":"",document.cookie=[e,"=",encodeURIComponent(o),n,r,a,c].join("");
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
//相册
|
||||
/* layer.photos({
|
||||
photos: '.photos'
|
||||
,zIndex: 9999999999
|
||||
,anim: -1
|
||||
});*/
|
||||
//签到
|
||||
var tplSignin = ['{{# if(d.signed){ }}'
|
||||
,'<button class="layui-btn layui-btn-disabled">今日已签到</button>'
|
||||
,'<span>获得了<cite>{{ d.experience }}</cite>飞吻</span>'
|
||||
,'{{# } else { }}'
|
||||
,'<button class="layui-btn layui-btn-danger" id="LAY_signin">今日签到</button>'
|
||||
,'<span>可获得<cite>{{ d.experience }}</cite>飞吻</span>'
|
||||
,'{{# } }}'].join('')
|
||||
,tplSigninDay = '已连续签到<cite>{{ d.days }}</cite>天'
|
||||
|
||||
//相册
|
||||
if($(window).width() > 750){
|
||||
layer.photos({
|
||||
photos: '.photos'
|
||||
,zIndex: 9999999999
|
||||
,anim: -1
|
||||
,signRender = function(data){
|
||||
laytpl(tplSignin).render(data, function(html){
|
||||
elemSigninMain.html(html);
|
||||
});
|
||||
laytpl(tplSigninDay).render(data, function(html){
|
||||
elemSigninDays.html(html);
|
||||
});
|
||||
}
|
||||
|
||||
,elemSigninHelp = $('#LAY_signinHelp')
|
||||
,elemSigninTop = $('#LAY_signinTop')
|
||||
,elemSigninMain = $('.fly-signin-main')
|
||||
,elemSigninDays = $('.fly-signin-days');
|
||||
|
||||
if(elemSigninMain[0]){
|
||||
/*
|
||||
fly.json('/sign/status', function(res){
|
||||
if(!res.data) return;
|
||||
signRender.token = res.data.token;
|
||||
signRender(res.data);
|
||||
});
|
||||
*/
|
||||
}
|
||||
$('body').on('click', '#LAY_signin', function(){
|
||||
var othis = $(this);
|
||||
if(othis.hasClass(DISABLED)) return;
|
||||
|
||||
fly.json('/sign/in', {
|
||||
token: signRender.token || 1
|
||||
}, function(res){
|
||||
signRender(res.data);
|
||||
}, {
|
||||
error: function(){
|
||||
othis.removeClass(DISABLED);
|
||||
}
|
||||
});
|
||||
|
||||
othis.addClass(DISABLED);
|
||||
});
|
||||
|
||||
//签到说明
|
||||
elemSigninHelp.on('click', function(){
|
||||
layer.open({
|
||||
type: 1
|
||||
,title: '签到说明'
|
||||
,area: '300px'
|
||||
,shade: 0.8
|
||||
,shadeClose: true
|
||||
,content: ['<div class="layui-text" style="padding: 20px;">'
|
||||
,'<blockquote class="layui-elem-quote">“签到”可获得社区飞吻,规则如下</blockquote>'
|
||||
,'<table class="layui-table">'
|
||||
,'<thead>'
|
||||
,'<tr><th>连续签到天数</th><th>每天可获飞吻</th></tr>'
|
||||
,'</thead>'
|
||||
,'<tbody>'
|
||||
,'<tr><td><5</td><td>5</td></tr>'
|
||||
,'<tr><td>≥5</td><td>10</td></tr>'
|
||||
,'<tr><td>≥15</td><td>15</td></tr>'
|
||||
,'<tr><td>≥30</td><td>20</td></tr>'
|
||||
,'</tbody>'
|
||||
,'</table>'
|
||||
,'<ul>'
|
||||
,'<li>中间若有间隔,则连续天数重新计算</li>'
|
||||
,'<li style="color: #FF5722;">不可利用程序自动签到,否则飞吻清零</li>'
|
||||
,'</ul>'
|
||||
,'</div>'].join('')
|
||||
});
|
||||
});
|
||||
|
||||
//签到活跃榜
|
||||
var tplSigninTop = ['{{# layui.each(d.data, function(index, item){ }}'
|
||||
,'<li>'
|
||||
,'<a href="/u/{{item.uid}}" target="_blank">'
|
||||
,'<img src="{{item.user.avatar}}">'
|
||||
,'<cite class="fly-link">{{item.user.username}}</cite>'
|
||||
,'</a>'
|
||||
,'{{# var date = new Date(item.time); if(d.index < 2){ }}'
|
||||
,'<span class="fly-grey">签到于 {{ layui.laytpl.digit(date.getHours()) + ":" + layui.laytpl.digit(date.getMinutes()) + ":" + layui.laytpl.digit(date.getSeconds()) }}</span>'
|
||||
,'{{# } else { }}'
|
||||
,'<span class="fly-grey">已连续签到 <i>{{ item.days }}</i> 天</span>'
|
||||
,'{{# } }}'
|
||||
,'</li>'
|
||||
,'{{# }); }}'
|
||||
,'{{# if(d.data.length === 0) { }}'
|
||||
,'{{# if(d.index < 2) { }}'
|
||||
,'<li class="fly-none fly-grey">今天还没有人签到</li>'
|
||||
,'{{# } else { }}'
|
||||
,'<li class="fly-none fly-grey">还没有签到记录</li>'
|
||||
,'{{# } }}'
|
||||
,'{{# } }}'].join('');
|
||||
|
||||
elemSigninTop.on('click', function(){
|
||||
var loadIndex = layer.load(1, {shade: 0.8});
|
||||
fly.json('../json/signin.js', function(res){ //实际使用,请将 url 改为真实接口
|
||||
var tpl = $(['<div class="layui-tab layui-tab-brief" style="margin: 5px 0 0;">'
|
||||
,'<ul class="layui-tab-title">'
|
||||
,'<li class="layui-this">最新签到</li>'
|
||||
,'<li>今日最快</li>'
|
||||
,'<li>总签到榜</li>'
|
||||
,'</ul>'
|
||||
,'<div class="layui-tab-content fly-signin-list" id="LAY_signin_list">'
|
||||
,'<ul class="layui-tab-item layui-show"></ul>'
|
||||
,'<ul class="layui-tab-item">2</ul>'
|
||||
,'<ul class="layui-tab-item">3</ul>'
|
||||
,'</div>'
|
||||
,'</div>'].join(''))
|
||||
,signinItems = tpl.find('.layui-tab-item');
|
||||
|
||||
layer.close(loadIndex);
|
||||
|
||||
layui.each(signinItems, function(index, item){
|
||||
var html = laytpl(tplSigninTop).render({
|
||||
data: res.data[index]
|
||||
,index: index
|
||||
});
|
||||
} else {
|
||||
$('body').on('click', '.photos img', function(){
|
||||
window.open(this.src);
|
||||
});
|
||||
}
|
||||
$(item).html(html);
|
||||
});
|
||||
|
||||
layer.open({
|
||||
type: 1
|
||||
,title: '签到活跃榜 - TOP 20'
|
||||
,area: '300px'
|
||||
,shade: 0.8
|
||||
,shadeClose: true
|
||||
,id: 'layer-pop-signintop'
|
||||
,content: tpl.prop('outerHTML')
|
||||
});
|
||||
|
||||
}, {type: 'get'});
|
||||
});
|
||||
|
||||
|
||||
//回帖榜
|
||||
var tplReply = ['{{# layui.each(d.data, function(index, item){ }}'
|
||||
,'<dd>'
|
||||
,'<a href="/u/{{item.uid}}">'
|
||||
,'<img src="{{item.user.avatar}}">'
|
||||
,'<cite>{{item.user.username}}</cite>'
|
||||
,'<i>{{item["count(*)"]}}次回答</i>'
|
||||
,'</a>'
|
||||
,'</dd>'
|
||||
,'{{# }); }}'].join('')
|
||||
,elemReply = $('#LAY_replyRank');
|
||||
|
||||
if(elemReply[0]){
|
||||
/*
|
||||
fly.json('/top/reply/', {
|
||||
limit: 20
|
||||
}, function(res){
|
||||
var html = laytpl(tplReply).render(res);
|
||||
elemReply.find('dl').html(html);
|
||||
});
|
||||
*/
|
||||
};
|
||||
|
||||
//相册
|
||||
if($(window).width() > 750){
|
||||
layer.photos({
|
||||
photos: '.photos'
|
||||
,zIndex: 9999999999
|
||||
,anim: -1
|
||||
});
|
||||
} else {
|
||||
$('body').on('click', '.photos img', function(){
|
||||
window.open(this.src);
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
//搜索
|
||||
$('.fly-search').submit(function(){
|
||||
var input = $(this).find('input'), val = input.val();
|
||||
if(val.replace(/\s/g, '') === ''){
|
||||
return false;
|
||||
}
|
||||
input.val(/*'site:1216.top '+ */input.val());
|
||||
});
|
||||
$('.icon-sousuo').on('click', function(){
|
||||
$('.fly-search').submit();
|
||||
});
|
||||
$('.fly-search').on('click', function(){
|
||||
layer.open({
|
||||
type: 1
|
||||
,title: false
|
||||
,closeBtn: false
|
||||
//,shade: [0.1, '#fff']
|
||||
,shadeClose: true
|
||||
,maxWidth: 10000
|
||||
,skin: 'fly-layer-search'
|
||||
,content: ['<form action="http://cn.bing.com/search">'
|
||||
,'<input autocomplete="off" placeholder="搜索内容,回车跳转" type="text" name="q">'
|
||||
,'</form>'].join('')
|
||||
,success: function(layero){
|
||||
var input = layero.find('input');
|
||||
input.focus();
|
||||
|
||||
//退出登录
|
||||
$(".logout").on('click', function () {
|
||||
$.post("/os/user/logout",{},function (data) {
|
||||
location.reload();
|
||||
layero.find('form').submit(function(){
|
||||
var val = input.val();
|
||||
if(val.replace(/\s/g, '') === ''){
|
||||
return false;
|
||||
}
|
||||
input.val('site:layui.com '+ input.val());
|
||||
});
|
||||
}
|
||||
})
|
||||
});
|
||||
//退出登录
|
||||
$(".logout").on('click', function () {
|
||||
$.post("/os/user/logout",{},function (data) {
|
||||
location.reload();
|
||||
});
|
||||
});
|
||||
|
||||
//新消息通知
|
||||
gather.newmsg();
|
||||
//新消息通知
|
||||
fly.newmsg();
|
||||
|
||||
//发送激活邮件
|
||||
gather.activate = function(email){
|
||||
gather.json('/api/activate/', {}, function(res){
|
||||
fly.activate = function(email){
|
||||
fly.json('/api/activate/', {}, function(res){
|
||||
if(res.status === 0){
|
||||
layer.alert('已成功将激活链接发送到了您的邮箱,接受可能会稍有延迟,请注意查收。', {
|
||||
icon: 1
|
||||
@@ -331,7 +539,7 @@ layui.define(['layer', 'laytpl', 'form', 'upload', 'util', 'upload','face','elem
|
||||
});
|
||||
};
|
||||
$('#LAY-activate').on('click', function(){
|
||||
gather.activate($(this).attr('email'));
|
||||
fly.activate($(this).attr('email'));
|
||||
});
|
||||
|
||||
//点击@
|
||||
@@ -342,20 +550,20 @@ layui.define(['layer', 'laytpl', 'form', 'upload', 'util', 'upload','face','elem
|
||||
}
|
||||
text = text.replace(/^@|([\s\S]+?)/g, '');
|
||||
othis.attr({
|
||||
href: '/user/nick?nickname='+ text
|
||||
href: '/user/nick?nickname='+ text
|
||||
,target: '_blank'
|
||||
});
|
||||
});
|
||||
|
||||
//表单提交
|
||||
//表单提交
|
||||
form.on('submit(*)', function(data){
|
||||
var action = $(data.form).attr('action'), button = $(data.elem);
|
||||
gather.json(action, data.field, function(res){
|
||||
fly.json(action, data.field, function(res){
|
||||
var end = function(){
|
||||
if(res.action){
|
||||
location.href = res.action;
|
||||
} else {
|
||||
gather.form[action||button.attr('key')](data.field, data.form);
|
||||
fly.form[action||button.attr('key')](data.field, data.form);
|
||||
}
|
||||
};
|
||||
if(res.status == 0){
|
||||
@@ -383,20 +591,10 @@ layui.define(['layer', 'laytpl', 'form', 'upload', 'util', 'upload','face','elem
|
||||
}
|
||||
|
||||
//加载编辑器
|
||||
gather.layEditor({
|
||||
fly.layEditor({
|
||||
elem: '.fly-editor'
|
||||
});
|
||||
|
||||
//右下角固定Bar
|
||||
util.fixbar({
|
||||
bar1: false
|
||||
,click: function(type){
|
||||
if(type === 'bar1'){
|
||||
layer.msg('bar1');
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
//手机设备的简单适配
|
||||
var treeMobile = $('.site-tree-mobile')
|
||||
,shadeMobile = $('.site-mobile-shade')
|
||||
@@ -409,14 +607,27 @@ layui.define(['layer', 'laytpl', 'form', 'upload', 'util', 'upload','face','elem
|
||||
$('body').removeClass('site-mobile');
|
||||
});
|
||||
|
||||
//图片懒加载
|
||||
|
||||
layui.use('flow', function(flow){
|
||||
flow.lazyimg();
|
||||
//获取统计数据
|
||||
$('.fly-handles').each(function(){
|
||||
var othis = $(this);
|
||||
$.get('/api/handle?alias='+ othis.data('alias'), function(res){
|
||||
othis.html('(下载量:'+ res.number +')');
|
||||
})
|
||||
});
|
||||
|
||||
//固定Bar
|
||||
util.fixbar({
|
||||
bar1: ''
|
||||
,bgcolor: '#009688'
|
||||
,click: function(type){
|
||||
if(type === 'bar1'){
|
||||
//layer.msg('打开 index.js,开启发表新帖的路径');
|
||||
location.href = '/jie/add';
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
exports('fly', gather);
|
||||
exports('fly', fly);
|
||||
|
||||
});
|
||||
|
||||
|
@@ -4,35 +4,56 @@
|
||||
|
||||
*/
|
||||
|
||||
layui.define(['laypage', 'fly', 'form'], function(exports){
|
||||
layui.define('fly', function(exports){
|
||||
|
||||
var $ = layui.jquery;
|
||||
var layer = layui.layer;
|
||||
var util = layui.util;
|
||||
var laytpl = layui.laytpl;
|
||||
var form = layui.form();
|
||||
var form = layui.form;
|
||||
var fly = layui.fly;
|
||||
var laypage = layui.laypage;
|
||||
|
||||
|
||||
var gather = {}, dom = {
|
||||
jieda: $('#jieda')
|
||||
,content: $('#L_content')
|
||||
,jiedaCount: $('#jiedaCount')
|
||||
};
|
||||
|
||||
//监听专栏选择
|
||||
form.on('select(column)', function(obj){
|
||||
var value = obj.value
|
||||
,elemQuiz = $('#LAY_quiz')
|
||||
,tips = {
|
||||
tips: 1
|
||||
,maxWidth: 250
|
||||
,time: 10000
|
||||
};
|
||||
elemQuiz.addClass('layui-hide');
|
||||
if(value === '0'){
|
||||
layer.tips('下面的信息将便于您获得更好的答案', obj.othis, tips);
|
||||
elemQuiz.removeClass('layui-hide');
|
||||
} else if(value === '99'){
|
||||
layer.tips('系统会对【分享】类型的帖子予以飞吻奖励,但我们需要审核,通过后方可展示', obj.othis, tips);
|
||||
}
|
||||
});
|
||||
|
||||
//提交回答
|
||||
fly.form['/jie/reply/'] = function(data, required){
|
||||
var tpl = '<li>\
|
||||
<div class="detail-about detail-about-reply">\
|
||||
<a class="jie-user" href="/user/">\
|
||||
<a class="fly-avatar" href="/u/{{ layui.cache.mine.userId }}" target="_blank">\
|
||||
<img src="{{= d.user.avatar}}" alt="{{= d.user.username}}">\
|
||||
<cite>{{d.user.username}}</cite>\
|
||||
</a>\
|
||||
<div class="fly-detail-user">\
|
||||
<a href="/u/{{ layui.cache.user.uid }}" target="_blank" class="fly-link">\
|
||||
<cite>{{d.user.username}}</cite>\
|
||||
</a>\
|
||||
</div>\
|
||||
<div class="detail-hits">\
|
||||
<span>刚刚</span>\
|
||||
</div>\
|
||||
</div>\
|
||||
<div class="detail-body jieda-body">\
|
||||
<div class="detail-body jieda-body photos">\
|
||||
{{ d.content}}\
|
||||
</div>\
|
||||
</li>'
|
||||
@@ -84,41 +105,35 @@ layui.define(['laypage', 'fly', 'form'], function(exports){
|
||||
//收藏
|
||||
,collect: function(div){
|
||||
var othis = $(this), type = othis.data('type');
|
||||
$.post('/os/content/collect', {
|
||||
contentId: div.data('id')
|
||||
,ok: type === 'add'? 1:-1
|
||||
fly.json('/os/content/collect', {
|
||||
contentId: div.data('id')
|
||||
,ok: type === 'add'? 1:-1
|
||||
}, function(res){
|
||||
res = JSON.parse(res);
|
||||
console.log(res);
|
||||
if(res.retcode == 0){
|
||||
if(type === 'add'){
|
||||
othis.data('type', 'remove').html('取消收藏').addClass('layui-btn-danger');
|
||||
layer.msg("收藏成功");
|
||||
othis.data('type', 'remove').html('取消收藏').addClass('layui-btn-danger');
|
||||
layer.msg("收藏成功");
|
||||
} else if(type === 'remove'){
|
||||
othis.data('type', 'add').html('收藏').removeClass('layui-btn-danger');
|
||||
layer.msg("已取消收藏");
|
||||
othis.data('type', 'add').html('收藏').removeClass('layui-btn-danger');
|
||||
layer.msg("已取消收藏");
|
||||
}
|
||||
}else {
|
||||
layer.msg(res.retinfo);
|
||||
}
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
$('body').on('click', '.jie-admin', function(){
|
||||
var othis = $(this), type = othis.attr('type');
|
||||
gather.jieAdmin[type].call(this, othis.parent());
|
||||
gather.jieAdmin[type] && gather.jieAdmin[type].call(this, othis.parent());
|
||||
});
|
||||
|
||||
//异步渲染
|
||||
var asyncRender = function(){
|
||||
var div = $('.fly-detail-hint'), jieAdmin = $('#LAY_jieAdmin');
|
||||
var div = $('.fly-admin-box'), jieAdmin = $('#LAY_jieAdmin');
|
||||
//查询帖子是否收藏
|
||||
if(jieAdmin[0] && layui.cache.user.uid != -1){
|
||||
fly.json('/collection/find/', {
|
||||
cid: div.data('id')
|
||||
}, function(res){
|
||||
jieAdmin.append('<span class="layui-btn layui-btn-mini jie-admin '+ (res.data.collection ? 'layui-btn-danger' : '') +'" type="collect" data-type="'+ (res.data.collection ? 'remove' : 'add') +'">'+ (res.data.collection ? '取消收藏' : '收藏') +'</span>');
|
||||
jieAdmin.append('<span class="layui-btn layui-btn-xs jie-admin '+ (res.data.collection ? 'layui-btn-danger' : '') +'" type="collect" data-type="'+ (res.data.collection ? 'remove' : 'add') +'">'+ (res.data.collection ? '取消收藏' : '收藏') +'</span>');
|
||||
});
|
||||
}
|
||||
}();
|
||||
@@ -127,24 +142,18 @@ layui.define(['laypage', 'fly', 'form'], function(exports){
|
||||
gather.jiedaActive = {
|
||||
zan: function(li){ //赞
|
||||
var othis = $(this), ok = othis.hasClass('zanok');
|
||||
$.post('/os/comment/support', {
|
||||
ok: ok?-1:1
|
||||
,commentId: li.data('id')
|
||||
fly.json('/os/comment/support', {
|
||||
commentId: li.data('id')
|
||||
,ok: ok?-1:1
|
||||
}, function(res){
|
||||
res = JSON.parse(res);
|
||||
console.log(res);
|
||||
if(res.retcode === 0){
|
||||
var zans = othis.find('em').html()|0;
|
||||
othis[ok ? 'removeClass' : 'addClass']('zanok');
|
||||
othis.find('em').html(ok ? (--zans) : (++zans));
|
||||
} else {
|
||||
layer.msg(res.retinfo);
|
||||
}
|
||||
});
|
||||
}
|
||||
,reply: function(li){ //回复
|
||||
var val = dom.content.val();
|
||||
var aite = '@'+ li.find('.jie-user cite i').text().replace(/\s/g, '');
|
||||
var aite = '@'+ li.find('.fly-detail-user cite').text().replace(/\s/g, '');
|
||||
dom.content.focus()
|
||||
if(val.indexOf(aite) !== -1) return;
|
||||
dom.content.val(aite +' ' + val);
|
||||
@@ -173,9 +182,16 @@ layui.define(['laypage', 'fly', 'form'], function(exports){
|
||||
}, function(res){
|
||||
var data = res.rows;
|
||||
layer.prompt({
|
||||
formType: 2
|
||||
,value: data.content
|
||||
,maxlength: 100000
|
||||
formType: 2
|
||||
,value: data.content
|
||||
,maxlength: 100000
|
||||
,title: '编辑回帖'
|
||||
,area: ['728px', '300px']
|
||||
,success: function(layero){
|
||||
fly.layEditor({
|
||||
elem: layero.find('textarea')
|
||||
});
|
||||
}
|
||||
}, function(value, index){
|
||||
fly.json('/jie/updateDa/', {
|
||||
id: li.data('id')
|
||||
@@ -208,11 +224,13 @@ layui.define(['laypage', 'fly', 'form'], function(exports){
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
$('.jieda-reply span').on('click', function(){
|
||||
var othis = $(this), type = othis.attr('type');
|
||||
gather.jiedaActive[type].call(this, othis.parents('li'));
|
||||
});
|
||||
|
||||
|
||||
form.on('submit(jie-add)', function(data){
|
||||
var bean = {};
|
||||
["contentId","title", "content", "cate"].forEach(function (value) {
|
||||
@@ -220,17 +238,11 @@ layui.define(['laypage', 'fly', 'form'], function(exports){
|
||||
});
|
||||
console.log(bean);
|
||||
|
||||
$.post("/os/content/save",{
|
||||
fly.json("/os/content/save",{
|
||||
bean:JSON.stringify(bean)
|
||||
},function (res) {
|
||||
res = JSON.parse(res);
|
||||
if(res.retcode != 0){
|
||||
layer.msg(res.retinfo);
|
||||
return false;
|
||||
}
|
||||
|
||||
layer.msg("发布成功",{time:2000},function () {
|
||||
location.href = "/";
|
||||
location.href = "/";
|
||||
});
|
||||
});
|
||||
return false; //阻止表单跳转。如果需要表单跳转,去掉这段即可。
|
||||
@@ -242,18 +254,12 @@ layui.define(['laypage', 'fly', 'form'], function(exports){
|
||||
});
|
||||
console.log(bean);
|
||||
|
||||
$.post("/os/comment/save",{
|
||||
fly.json("/os/comment/save",{
|
||||
bean:JSON.stringify(bean)
|
||||
},function (res) {
|
||||
res = JSON.parse(res);
|
||||
if(res.retcode != 0){
|
||||
layer.msg(res.retinfo);
|
||||
return false;
|
||||
}
|
||||
|
||||
layer.msg("回复成功",{time:2000},function () {
|
||||
//location.href = "/";
|
||||
location.reload();
|
||||
//location.href = "/";
|
||||
location.reload();
|
||||
});
|
||||
});
|
||||
return false; //阻止表单跳转。如果需要表单跳转,去掉这段即可。
|
||||
@@ -272,7 +278,7 @@ layui.define(['laypage', 'fly', 'form'], function(exports){
|
||||
location.href=layui.cache.url+"?curr="+curr;
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
exports('jie', null);
|
||||
exports('jie', null);
|
||||
});
|
@@ -3,17 +3,19 @@
|
||||
@Name: 用户模块
|
||||
|
||||
*/
|
||||
|
||||
layui.define(['laypage', 'fly','form', 'element'], function(exports){
|
||||
|
||||
layui.define(['laypage', 'fly', 'element', 'flow'], function(exports){
|
||||
|
||||
var $ = layui.jquery;
|
||||
var layer = layui.layer;
|
||||
var util = layui.util;
|
||||
var laytpl = layui.laytpl;
|
||||
var form = layui.form();
|
||||
var form = layui.form;
|
||||
var laypage = layui.laypage;
|
||||
var fly = layui.fly;
|
||||
var element = layui.element();
|
||||
var flow = layui.flow;
|
||||
var element = layui.element;
|
||||
var upload = layui.upload;
|
||||
|
||||
var gather = {}, dom = {
|
||||
mine: $('#LAY_mine')
|
||||
@@ -31,21 +33,26 @@ layui.define(['laypage', 'fly','form', 'element'], function(exports){
|
||||
'{{# for(var i = 0; i < d.rows.length; i++){ }}\
|
||||
<li>\
|
||||
{{# if(d.rows[i].collection_time){ }}\
|
||||
<a class="jie-title" href="/jie/{{d.rows[i].id}}.html" target="_blank">{{= d.rows[i].title}}</a>\
|
||||
<i>收藏于{{ d.rows[i].collection_time }}</i>\
|
||||
<a class="jie-title" href="/jie/{{d.rows[i].id}}/" target="_blank">{{= d.rows[i].title}}</a>\
|
||||
<i>{{ d.rows[i].collection_time }} 收藏</i>\
|
||||
{{# } else { }}\
|
||||
{{# if(d.rows[i].status == 1){ }}\
|
||||
<span class="fly-jing">精</span>\
|
||||
<span class="fly-jing layui-hide-xs">精</span>\
|
||||
{{# } }}\
|
||||
{{# if(d.rows[i].accept >= 0){ }}\
|
||||
<span class="jie-status jie-status-ok">已解决</span>\
|
||||
<span class="jie-status jie-status-ok">已结</span>\
|
||||
{{# } else { }}\
|
||||
<span class="jie-status">未结</span>\
|
||||
{{# } }}\
|
||||
<a class="jie-title" href="/jie/{{d.rows[i].id}}.html" target="_blank">{{= d.rows[i].title}}</a>\
|
||||
<i>{{new Date(d.rows[i].time).toLocaleString()}}</i>\
|
||||
{{# if(d.rows[i].status == -1){ }}\
|
||||
<span class="jie-status">审核中</span>\
|
||||
{{# } }}\
|
||||
<a class="jie-title" href="/jie/{{d.rows[i].id}}/" target="_blank">{{= d.rows[i].title}}</a>\
|
||||
<i class="layui-hide-xs">{{ layui.util.timeAgo(d.rows[i].time, 1) }}</i>\
|
||||
{{# if(d.rows[i].accept == -1){ }}\
|
||||
<a class="mine-edit" href="/jie/edit/{{d.rows[i].id}}">编辑</a>\
|
||||
<a class="mine-edit layui-hide-xs" href="/jie/edit/{{d.rows[i].id}}" target="_blank">编辑</a>\
|
||||
{{# } }}\
|
||||
<em>{{d.rows[i].hits}}阅/{{d.rows[i].comment}}答</em>\
|
||||
<em class="layui-hide-xs">{{d.rows[i].hits}}阅/{{d.rows[i].comment}}答</em>\
|
||||
{{# } }}\
|
||||
</li>\
|
||||
{{# } }}'
|
||||
@@ -68,14 +75,14 @@ layui.define(['laypage', 'fly','form', 'element'], function(exports){
|
||||
fly.json(url, {}, function(res){
|
||||
res.count = res.rows.length;
|
||||
|
||||
var rows = fly.sort(res.rows, 'collection_timestamp')
|
||||
var rows = layui.sort(res.rows, 'collection_timestamp', 'desc')
|
||||
,render = function(curr){
|
||||
var data = []
|
||||
,start = curr*nums - nums
|
||||
,last = start + nums - 1;
|
||||
|
||||
if(last >= rows.length){
|
||||
last = curr > 1 ? rows.length - (last - rows.length) : rows.length - 1;
|
||||
last = curr > 1 ? start + (rows.length - start - 1) : rows.length - 1;
|
||||
}
|
||||
|
||||
for(var i = start; i <= last; i++){
|
||||
@@ -83,17 +90,16 @@ layui.define(['laypage', 'fly','form', 'element'], function(exports){
|
||||
}
|
||||
|
||||
res.rows = data;
|
||||
|
||||
|
||||
view(res);
|
||||
};
|
||||
|
||||
render(curr)
|
||||
gather.minelog['collect-page-' + curr] = res;
|
||||
|
||||
now || laypage({
|
||||
cont: 'LAY_page1'
|
||||
,pages: Math.ceil(rows.length/nums) //得到总页数
|
||||
,skin: 'fly'
|
||||
now || laypage.render({
|
||||
elem: 'LAY_page1'
|
||||
,count: rows.length
|
||||
,curr: curr
|
||||
,jump: function(e, first){
|
||||
if(!first){
|
||||
@@ -108,10 +114,9 @@ layui.define(['laypage', 'fly','form', 'element'], function(exports){
|
||||
}, function(res){
|
||||
view(res);
|
||||
gather.minelog['mine-jie-page-' + curr] = res;
|
||||
now || laypage({
|
||||
cont: 'LAY_page'
|
||||
,pages: res.pages
|
||||
,skin: 'fly'
|
||||
now || laypage.render({
|
||||
elem: 'LAY_page'
|
||||
,count: res.count
|
||||
,curr: curr
|
||||
,jump: function(e, first){
|
||||
if(!first){
|
||||
@@ -136,19 +141,22 @@ layui.define(['laypage', 'fly','form', 'element'], function(exports){
|
||||
});
|
||||
}
|
||||
|
||||
//Hash地址的定位
|
||||
var layid = location.hash.replace(/^#/, '');
|
||||
element.tabChange('user', layid);
|
||||
//显示当前tab
|
||||
if(location.hash){
|
||||
element.tabChange('user', location.hash.replace(/^#/, ''));
|
||||
}
|
||||
|
||||
element.on('tab(user)', function(elem){
|
||||
location.hash = ''+ $(this).attr('lay-id');
|
||||
element.on('tab(user)', function(){
|
||||
var othis = $(this), layid = othis.attr('lay-id');
|
||||
if(layid){
|
||||
location.hash = layid;
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
//根据ip获取城市
|
||||
if($('#L_city').val() === ''){
|
||||
$.getScript('http://int.dpool.sina.com.cn/iplookup/iplookup.php?format=js', function(){
|
||||
$('#L_city').val(remote_ip_info.city);
|
||||
$('#L_city').val(remote_ip_info.city||'');
|
||||
});
|
||||
}
|
||||
|
||||
@@ -156,26 +164,21 @@ layui.define(['laypage', 'fly','form', 'element'], function(exports){
|
||||
if($('.upload-img')[0]){
|
||||
layui.use('upload', function(upload){
|
||||
var avatarAdd = $('.avatar-add');
|
||||
layui.upload({
|
||||
elem: '.upload-img input'
|
||||
,method: 'post'
|
||||
|
||||
upload.render({
|
||||
elem: '.upload-img'
|
||||
,url: '/os/file/upload'
|
||||
,size: 50
|
||||
,before: function(){
|
||||
avatarAdd.find('.loading').show();
|
||||
}
|
||||
,success: function(res){
|
||||
//res = JSON.parse(res);
|
||||
,done: function(res){
|
||||
if(res.retcode == 0){
|
||||
$.post('/os/user/update', {
|
||||
fly.json('/os/user/update', {
|
||||
bean:JSON.stringify({avatar: res.retinfo})
|
||||
,columns:JSON.stringify(["avatar"])
|
||||
}, function(res){
|
||||
res = JSON.parse(res);
|
||||
if(res.retcode != 0){
|
||||
layer.msg(res.retinfo);
|
||||
return false;
|
||||
}
|
||||
location.reload();
|
||||
location.reload();
|
||||
});
|
||||
} else {
|
||||
layer.msg(res.msg, {icon: 5});
|
||||
@@ -189,6 +192,73 @@ layui.define(['laypage', 'fly','form', 'element'], function(exports){
|
||||
});
|
||||
}
|
||||
|
||||
//合作平台
|
||||
if($('#LAY_coop')[0]){
|
||||
|
||||
//资源上传
|
||||
$('#LAY_coop .uploadRes').each(function(index, item){
|
||||
var othis = $(this);
|
||||
upload.render({
|
||||
elem: item
|
||||
,url: '/os/file/upload?filename='+ othis.data('filename')
|
||||
,accept: 'file'
|
||||
,exts: 'zip'
|
||||
,size: 30*1024
|
||||
,before: function(){
|
||||
layer.msg('正在上传', {
|
||||
icon: 16
|
||||
,time: -1
|
||||
,shade: 0.7
|
||||
});
|
||||
}
|
||||
,done: function(res){
|
||||
if(res.code == 0){
|
||||
layer.msg(res.msg, {icon: 6})
|
||||
} else {
|
||||
layer.msg(res.msg)
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
//成效展示
|
||||
var effectTpl = ['{{# layui.each(d.data, function(index, item){ }}'
|
||||
,'<tr>'
|
||||
,'<td><a href="/u/{{ item.uid }}" target="_blank" style="color: #01AAED;">{{ item.uid }}</a></td>'
|
||||
,'<td>{{ item.authProduct }}</td>'
|
||||
,'<td>¥{{ item.rmb }}</td>'
|
||||
,'<td>{{ item.create_time }}</td>'
|
||||
,'</tr>'
|
||||
,'{{# }); }}'].join('');
|
||||
|
||||
var effectView = function(res){
|
||||
var html = laytpl(effectTpl).render(res);
|
||||
$('#LAY_coop_effect').html(html);
|
||||
$('#LAY_effect_count').html('你共有 <strong style="color: #FF5722;">'+ (res.count||0) +'</strong> 笔合作授权订单');
|
||||
};
|
||||
|
||||
var effectShow = function(page){
|
||||
fly.json('/cooperation/effect', {
|
||||
page: page||1
|
||||
}, function(res){
|
||||
effectView(res);
|
||||
laypage.render({
|
||||
elem: 'LAY_effect_page'
|
||||
,count: res.count
|
||||
,curr: page
|
||||
,jump: function(e, first){
|
||||
if(!first){
|
||||
effectShow(e.curr);
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
effectShow();
|
||||
|
||||
}
|
||||
|
||||
//提交成功后刷新
|
||||
fly.form['set-mine'] = function(data, required){
|
||||
layer.msg('修改成功', {
|
||||
@@ -198,7 +268,7 @@ layui.define(['laypage', 'fly','form', 'element'], function(exports){
|
||||
}, function(){
|
||||
location.reload();
|
||||
});
|
||||
};
|
||||
}
|
||||
|
||||
//表单验证
|
||||
form.verify({
|
||||
@@ -328,7 +398,7 @@ layui.define(['laypage', 'fly','form', 'element'], function(exports){
|
||||
{{# for(var i = 0; i < len; i++){ }}\
|
||||
<li data-id="{{d.rows[i].id}}">\
|
||||
<blockquote class="layui-elem-quote">{{ d.rows[i].content}}</blockquote>\
|
||||
<p><span>{{d.rows[i].time}}</span><a href="javascript:;" class="layui-btn layui-btn-small layui-btn-danger fly-delete">删除</a></p>\
|
||||
<p><span>{{d.rows[i].time}}</span><a href="javascript:;" class="layui-btn layui-btn-sm layui-btn-danger fly-delete">删除</a></p>\
|
||||
</li>\
|
||||
{{# } }}\
|
||||
</ul>\
|
||||
@@ -338,16 +408,18 @@ layui.define(['laypage', 'fly','form', 'element'], function(exports){
|
||||
dom.minemsg.html('<div class="fly-none">您暂时没有最新消息</div>');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// fly.json('/message/find/', {}, function(res){
|
||||
// var html = laytpl(tpl).render(res);
|
||||
// dom.minemsg.html(html);
|
||||
// if(res.rows.length > 0){
|
||||
// delAll.removeClass('layui-hide');
|
||||
// }
|
||||
// });
|
||||
|
||||
|
||||
|
||||
/*
|
||||
fly.json('/message/find/', {}, function(res){
|
||||
var html = laytpl(tpl).render(res);
|
||||
dom.minemsg.html(html);
|
||||
if(res.rows.length > 0){
|
||||
delAll.removeClass('layui-hide');
|
||||
}
|
||||
});
|
||||
*/
|
||||
|
||||
//阅读后删除
|
||||
dom.minemsg.on('click', '.mine-msg li .fly-delete', function(){
|
||||
var othis = $(this).parents('li'), id = othis.data('id');
|
||||
@@ -384,5 +456,5 @@ layui.define(['laypage', 'fly','form', 'element'], function(exports){
|
||||
dom.minemsg[0] && gather.minemsg();
|
||||
|
||||
exports('user', null);
|
||||
|
||||
|
||||
});
|
Reference in New Issue
Block a user