;/*!aipage:static/js/lib/login.js*/ !function(e){"use strict";e.fn.phoneLogin=function(t){function i(){return 0===h?(d.removeClass("disabled"),d.text("發送"),h=a.interval,!1):(d.addClass("disabled"),d.text("重新發送("+h+"s)"),h--,void setTimeout(function(){i()},1e3))}function n(){var t=e.trim(o.val());/^1(3|4|5|6|7|8|9)\d{9}$/.test(t)?(o.removeClass("error"),f.hide(),e.ajax({type:"POST",url:a.codeAPI,data:{phone:t},headers:r?{"csrf-token":r}:{},success:function(e){0===+e.status?(f.hide(),i()):f.text("獲取驗證碼失敗:"+e.msg||"未知錯誤").show()},error:function(){f.text("獲取驗證碼失敗,請刷新重試").show()}})):(o.addClass("error"),f.text(a.tip.invalidPhone).show())}var r=e('meta[name="csrf-token"]').attr("content"),a=e.extend({loginAPI:"/api/login/phone",codeAPI:"/api/login/verifyCode",redirectUri:"",interval:60,tip:{invalidPhone:"手機号格式錯誤",emptyPhone:"請填寫手機号",emptyCode:"請填寫驗證碼"}},t),o=this.find('[name="phone"]'),s=this.find('[name="code"]'),d=this.find(".send-code-btn"),c=this.find("button.submit"),f=this.find("span.error"),l=this.find(".close"),u=this,h=a.interval;d.off("click").on("click",function(){var t=e(this);return t.hasClass("disabled")?!1:void n()}),l.on("click",function(){return u.hide(),f.text(""),!1}),c.off("click").on("click",function(){var t=e.trim(o.val()),i=e.trim(s.val());""===t?(o.addClass("error"),f.text(a.tip.emptyPhone).show()):/^1(3|4|5|6|7|8|9)\d{9}$/.test(t)?""===i?(s.addClass("error"),f.text(a.tip.emptyCode).show()):(f.hide(),o.removeClass("error"),s.removeClass("error"),e.ajax({type:"POST",url:a.loginAPI,headers:r?{"csrf-token":r}:{},data:{phone:t,code:i},success:function(t){if(0===+t.status){var i=t.data||{};if(a.callback)return u.hide(),a.callback(i);c.text("登錄成功,即将跳轉..."),setTimeout(function(){var t=a.redirectUri||e.getUrlParam("redirectUri")||document.referrer;urls=t?t:"/usercenter"},1e3)}else f.text("登錄失敗"+t.msg).show()}})):(o.addClass("error"),f.text(a.tip.invalidPhone).show())})},e.fn.appLogin=function(t){function i(){f++,e.ajax({type:"POST",url:"/openapi/member/checkScanLogin",data:{id:l},success:function(t){if(0===+t.status&&t.data&&t.data.id){var n=r.redirectUri||e.getUrlParam("redirectUri")||document.referrer;urls=n?n:"/usercenter"}return f>c?void s.show().find("button").text("二維碼過期,請點擊刷新"):void setTimeout(function(){i()},3e3)}})}function n(){s.hide(),f=0;var t=o.find("img.active").attr("data-type"),n=window.aipage.env.siteId;e.ajax({type:"GET",url:r.qrcodeAPI+"?siteId="+n+"&type="+t,success:function(e){0===+e.status&&e.data?(s.hide(),a.removeClass("loading").attr("src",e.data.qrcode),l=e.data.id,i()):UIkit.notification("獲取驗證碼失敗:"+e.msg)},error:function(){UIkit.notification("獲取登錄二維碼網絡出錯,請重試")}})}var r=e.extend({qrcodeAPI:"/openapi/smartapp/scanLoginQrcode",checkAPI:"/openapi/member/checkScanLogin",redirectUri:"",expireMinute:3},t),a=this.find(".qrcode-img"),o=this.find(".app-switch"),s=this.find(".expire-tip"),d=this.find(".qrcode-help"),c=20*r.expireMinute,f=0,l="";n(),o.on("click","img",function(){e(this).addClass("active").siblings().removeClass("active");var t=e(this).attr("alt");d.find("b").text(t),n()}),this.find(".expire-tip").on("click",function(){n()})}}(jQuery); ;/*!aipage:static/js/lib/oauth.js*/ window.oauth=function(e){var t=e.aipage.env.serviceUrl||"http://aipage.bce.baidu.com",n=t+"/openapi/oauth";return{getInfo:function(){return $.ajax({url:n+"/userinfo",type:"GET",xhrFields:{withCredentials:!0},crossDomain:!0})},login:function(){return new Promise(function(t){function o(n){"oauth"===n.data.type&&(e.removeEventListener("message",o),document.body.removeChild(i),t({status:0,data:n.data.data}))}var i=document.createElement("iframe");i.style.position="fixed",i.style.background="#fff",i.style.width="100%",i.style.height="100%",i.style.left=0,i.style.top=0,i.style.zIndex=9999999,e.addEventListener("message",o),e.UIkit.modal.confirm("使用百度賬号登錄?",{labels:{ok:"确定",cancel:"取消"}}).then(function(){document.body.appendChild(i),i.src=n+"/login?platform=baidu&serviceUrl="+n},function(){e.removeEventListener("message",o)})})},logout:function(){return new Promise(function(t){e.UIkit.modal.confirm("是否退出當前賬号?",{labels:{ok:"确定",cancel:"取消"}}).then(function(){return $.ajax({url:n+"/logout",type:"GET",xhrFields:{withCredentials:!0},crossDomain:!0,success:t})},function(){})})}}}(this); ;/*!aipage:static/js/lib/comment.js*/ window.ApComment=function(){function t(t,e){void 0===t&&(t={});var o=n.aipage.env;this.options=Object.assign({loginType:"anonymous",siteId:o.siteId,dataId:String(o.dataId).length>5?o.dataId:o.pageId,api:"/openapi/comment",contentLimit:1e3,language:"zh"},t),this.$root=e,this.siteId=this.options.siteId,this.dataId=this.options.dataId,this.isLogin=!1,this.pn=1,this.hasMore=!1,this.init()}var n=window,e={zh:{commentTitleText:"發表評論",listTitleText:"評論區",noLoginTipText:"登錄後才能參與評論哦...",placeholder:"發表我的評論",noLoginBtnText:"登錄",noLoginBtnTipText:"後參與讨論",submitText:"提交評論",loadMoreText:"加載更多",loadingText:"加載中",commentPrefix:"發表于",noMoreText:"沒有更多評論了",unpublish:"審核中",anonymous:"匿名評論,需審核",tooShort:"留言太短啦!最少五個字",submitSuccess:"發表成功",submitFail:"提交失敗",just:"剛剛",reply:"回複"},en:{commentTitleText:"POST COMMENT",listTitleText:"Comment List",noLoginTipText:"Login required",placeholder:"Post my comments",noLoginBtnText:"Sign in",noLoginBtnTipText:"to comment",submitText:"Submit",loadMoreText:"Load more",loadingText:"Loading",commentPrefix:"at",noMoreText:"No more",unpublish:"to be reviewed",anonymous:"anonymous, need review",tooShort:"content too short!",submitSuccess:"comment success!",submitFail:"comment fail",just:"just now",reply:"reply to"}};return[{name:"list",method:"GET"},{name:"save",method:"POST"},{name:"reply",method:"POST"}].forEach(function(n){t.prototype[n.name]=function(t){return t.siteId=this.siteId,t.id=this.dataId,t.dataId=this.dataId,$.ajax(this.options.api,{type:n.method,data:t,dataType:"json"})}}),t.prototype.init=function(){this.$root&&this.$root.length&&(this.initComment(),this.initEventHandler())},t.prototype.getLocale=function(t){var n=this.options,o=e[n.language]||e.en,i=Object.assign({},o,n);return t?i[t]||"":i},t.prototype.initComment=function(){var t=this.$root,n=this,e=this.getLocale(),o=this.options.loginType,i='\n
\n
\n
'+e.commentTitleText+'
\n
\n
\n \n \n
\n
\n \n \n
\n 0/'+n.options.contentLimit+'\n '+e.submitText+'\n
\n
\n
\n
\n
\n
'+e.listTitleText+'
\n
\n
\n\n
\n
\n
\n
\n ';t.html(i),APSdk.getUserInfo(function(t){t&&n.updateUserInfo(t)}),this.getCommentList()},t.prototype.renderComments=function(t,n){0===this.pn&&this.$root.find(".comment-list-title").show();var e=[];Array.isArray(t)||(t=[t]);var o=this.getLocale();t.forEach(function(t){var n="";t.reply&&t.reply.uname&&(n='\n
\n @'+t.reply.uname+": "+t.reply.content+"\n
\n ");var i='\n
\n
\n \n
\n\n
\n \n\n
\n '+n+"\n "+t.content+"\n
\n
\n
\n ";e.push(i)});var i=e.join("");"prepend"===n?this.$root.find(".comment-list").prepend(i):this.$root.find(".comment-list").append(i)},t.prototype.getCommentList=function(){var t=this,n=this.pn,e=this.getLocale(),o=t.$root.find(".comment-more");n>1&&o.text(e.loadingText).show(),this.list({pn:n,ps:20}).then(function(i){if(0===+i.status){var s=i.data;if(s&&s.rows.length){var a=i.data.more?e.loadMoreText:e.noMoreText;t.renderComments(s.rows),o.text(a).show(),t.pn++,t.hasMore=!0}else t.hasMore=!1,0===n?o.text("").hide():o.text(e.noMoreText).show()}else o.text(e.loadMoreText).show(),UIkit.modal.alert(i.msg)})},t.prototype.updateUserInfo=function(t){var n=this.$root,e=t&&(t.nickname||t.name);e?(this.isLogin=!0,n.find(".ap-comment-wrap").removeClass("no-login").addClass("login"),n.find(".comment-user .avatar img").attr("src",t.portrait||"/themes/temp745/resources/sys/img/author.png"),n.find(".comment-user .avatar span").text(e)):(this.isLogin=!1,n.find(".ap-comment-wrap").removeClass("login").addClass("no-login"),n.find(".comment-user .avatar img").attr("src",""))},t.prototype.initEventHandler=function(){var t=this.$root,e=this,o=e.options.loginType,i=this.getLocale();t.on("click",".comment-control .comment-login-btn",function(){return e.isLogin?!1:(APSdk.login({title:"登錄發表評論",submitText:"一鍵登錄"}).then(function(t){t&&e.updateUserInfo(t)}),!1)}),t.on("click",".comment-control .comment-submit-btn",function(){if(!e.isLogin&&"anonymous"!==o)return n.oauth.login().then(function(t){e.updateUserInfo(t.data)}),!1;var s=$.trim(t.find("textarea").val());if(s.length<5)return UIkit.notification(i.tooShort),!1;var a=e.$root.find(".comment-control .reply-info"),m=a.length?a.attr("data-id"):"",r={content:s,replyId:m};e.save(r).then(function(n){0===+n.status?(n.data.timeago=i.just,e.renderComments(n.data,"prepend"),t.find("textarea").val("").change()):UIkit.notification(i.submitFail+":"+n.msg)})}),t.on("click",".comment-list .comment-reply",function(){if($([document.documentElement,document.body]).animate({scrollTop:e.$root.offset().top},500),!e.isLogin&&"anonymous"!==o)return void APSdk.login({title:"登錄發表評論",submitText:"一鍵登錄"}).then(function(t){t&&e.updateUserInfo(t)});e.$root.find(".reply-info").remove();var t=$(this).closest(".comment-item").attr("data-id"),n=$(this).closest(".comment-item").find(".comment-username").text(),s='\n
\n '+i.reply+": "+n+'\n \n
\n ';$(s).insertAfter(e.$root.find(".comment-control .comment-user"))}),t.on("click",".comment-control .close-reply",function(){return $(this).closest(".reply-info").remove(),!1}),t.on("click",".comment-more",function(){e.hasMore&&e.getCommentList()}),t.on("change keyup paste","textarea",function(){var t=$.trim($(this).val()),n=t.length,o=e.options.contentLimit;n>o&&(n=o,$(this).val(t.slice(0,o)));var i=e.$root.find(".comment-submit-btn");n>=5?i.removeClass("disable"):i.addClass("disable"),e.$root.find(".length-limit").text(n+"/"+o)})},t}(); ;/*!aipage:static/js/lib/lottery.js*/ window.ApLottery=function(){function t(t){for(var e=t.concat(),i=e.length;i;)e.push(e.splice(0|Math.random()*i,1)[0]),i--;return e}function e(t){this.siteId=t.siteId,this.id=t.id,this.platform=t.platform}var i=window,n=i.aipage.env.siteId,a="/openapi/lottery",s="/openapi/member";return e.prototype.draw=function(){return $.ajax({url:s+"/drawLottery",method:"POST",data:{id:this.id,siteId:this.siteId,appPlatform:this.platform}})},e.initLoginLottery=function(){if("/login"!==location.pathname){var e=san.defineComponent({template:'\n
\n
\n \n
\n \n \n
\n ',initData:function(){return{type:"",icon:!1,data:{}}},attached:function(){var e=this;this.fetchLotteryByScene(1).then(function(i){if(i){for(var n=t(i.bonus).slice(0,3),a=0;3>a;a++)n[a]||(n[a]=i.bonus[a%i.bonus.length]);e.checkLoginGuide()?e.data.set("type","loginGuide"):e.data.set("icon",!0),e.data.set("data.loginLottery",i),e.data.set("data.viewBonus",n)}})},login:function(){var t=this;APSdk.getUserInfo(function(e){e?t.data.set("type","loginLottery"):location.href="/login"})},openModal:function(){localStorage.loginLotteryDisabled=!1,this.data.set("type","loginGuide"),this.data.set("icon",!1)},hideModal:function(){this.data.set("icon",!0)},closeModal:function(){localStorage.loginLotteryDisabled=!0,this.data.set("icon",!0)},complete:function(){localStorage.loginLotteryDisabled=!0,this.data.set("type",""),this.data.set("icon",!1)},fetchLotteryByScene:function(t){var e=this;return $.ajax({url:a+"/sceneLottery?scene="+t,method:"GET",data:{id:e.id,siteId:e.siteId}}).then(function(t){if(t.status)throw new Error(t.msg);return e.lottery=t.data,t.data})},roll:function(){var t=this,e=setInterval(function(){for(var e=t.data.get("data.loginLottery.bonus"),i=[],n=0;3>n;n++)i.push(e[parseInt(Math.random()*e.length,10)]);t.data.set("data.rolling",!0),t.data.set("data.viewBonus",i)},100);return function(){t.data.set("data.rolling",!1),clearInterval(e)}},draw:function(){var e=this,i=this.roll(),a=e.data.get("data.loginLottery.id");return $.ajax({url:s+"/drawLottery",method:"POST",data:{id:a,siteId:n}}).then(function(n){0===+n.status?setTimeout(function(){localStorage.loginLotteryDisabled=!0,e.completeGlobalLottery(a),n.data&&0===n.data.type?e.data.set("data.viewBonus",t(e.data.get("data.loginLottery.bonus")).slice(0,3)):e.data.set("data.viewBonus",new Array(3).fill(n.data)),e.data.set("data.result",n.data),i()},3e3):(e.data.set("data.result",{message:n.msg}),i())}).catch(function(n){e.data.set("data.viewBonus",t(e.data.get("data.loginLottery.bonus")).slice(0,3)),i(),localStorage.loginLotteryDisabled=!0,e.completeGlobalLottery(a),e.data.set("data.result",{message:n.message})})},completeGlobalLottery:function(t){var e=localStorage.globalLotteries||"{}",i=JSON.parse(e);i[t]=!0,localStorage.globalLotteries=JSON.stringify(i)},checkLoginGuide:function(){return!localStorage.loginLotteryDisabled},checkLoginLottery:function(t){var e=localStorage.globalLotteries||"{}",i=JSON.parse(e);return!!i[t]}}),i=new e;i.attach(document.body)}},e}(),function(t,e){var i=function(e,i){this.$elem=e,this.defaults={mode:"nine",defaultCover:"/resources/sys/img/lottery/smile.png"},this.items=[],this.options=t.extend({},this.defaults,i),this.instance=null,this.init()};i.prototype={initLottery:function(){var t=this,e=t.$elem;if("nine"===this.options.mode){this.$elem.html('\n
\n
\n
\n
\n
\n \n
\n \n
\n
很遺憾未中獎
\n
\n
\n
\n
\n ');var i=t.$elem.find(".lottery-mask");this.instance={running:!1,index:-1,count:0,timer:0,speed:20,times:0,cycle:50,prize:-1,items:[],init:function(){e.find(".lottery-unit").length>0&&($units=e.find(".lottery-unit"),this.count=$units.length,e.find(".lottery-unit.lottery-unit-"+this.index).addClass("active"));var i=0,n=t.$elem.find(".lottery-light");n.attr("class",function(){setInterval(function(){i++,i%2===0?n.addClass("light-2"):n.removeClass("light-2")},600)})},start:function(){this.result={},this.speed=100,this.running=!0,i.find(".code").empty().hide(),i.find(".submit").show()},roll:function(){var t=this.index,i=this.count;return e.find(".lottery-unit.lottery-unit-"+t).removeClass("active"),t+=1,t>i-1&&(t=0),e.find(".lottery-unit.lottery-unit-"+t).addClass("active"),this.index=t,!1},stop:function(t){return this.prize=t,!1},fail:function(){this.result&&setTimeout(function(){i.fadeIn()},500)},win:function(){var e=this.result,n=t.$elem.find(".feedback"),a=t.$elem.find(".fail");0===+e.type?(this.prize=this.emptyIndex,n.hide(),a.show().find(".fail-tip").text(e.message||"留點運氣也不錯呦~")):(n.show(),a.hide(),n.find(".prize-title span").text(e.title),n.find(".prize-tip").text(e.message||"請聯系客服領取獎品"),e.feedback&&2===+e.type&&n.find(".code").text(e.feedback),n.find("img").attr("src",e.cover),2===+e.type&&e.feedback?i.find(".code").text("券碼:"+e.feedback).show():i.find(".code").empty().hide())}}}},renderLotteryItem:function(t,e){var i=this.options.defaultCover,n='
'+(t&&t.type>0?t.title:"謝謝參與")+"
";return n},renderLottery:function(){var t="",e=this.options.mode,i=this.items;"nine"===e&&(t=""+this.renderLotteryItem(i[0],0)+''+this.renderLotteryItem(i[1],1)+''+this.renderLotteryItem(i[2],2)+''+this.renderLotteryItem(i[7],7)+''+this.renderLotteryItem(i[3],3)+''+this.renderLotteryItem(i[6],6)+''+this.renderLotteryItem(i[5],5)+''+this.renderLotteryItem(i[4],4)+"
",this.$elem.find(".lottery-inner").html(t),this.instance.init())},drawLottery:function(){var e=-1,i=this.instance,n=this.items,a=this.options,s=a.siteId,o=a.id;i.result=null;for(var r=0;re&&(e=n.length-1),i.emptyIndex=e,t.ajax({url:"/openapi/member/drawLottery",method:"POST",data:{id:o,siteId:s}}).then(function(t){if(0===+t.status){var a=t.data||{};i.result=a;for(var s=0;se.cycle+10&&e.prize==e.index?(clearTimeout(e.timer),e.prize=-1,e.times=0,e.running=!1,e.fail()):(e.timese.cycle+10&&(0==e.prize&&7==e.index||e.prize==e.index+1)?110:20,e.speed<40&&(e.speed=40),e.timer=setTimeout(function(){return t.roll()},e.speed)),!1},getLotteryInfo:function(){return this.lotteryDetail},init:function(){var i=this,n=this.options,a=n.siteId,s=n.id,o=n.mode,r=n.defaultCover,d=n.callback,l=n.forceLogin;this.initLottery();var c=this.$elem.find(".lottery-mask");t.get("/openapi/lottery?siteId="+a+"&id="+s).then(function(t){if(0===+t.status){var e=t.data&&t.data.bonus||[];if(e.length<8&&"nine"===o)for(var n=1;e.length<8;n+=2)e.splice(n,0,{id:n,cover:r});i.lotteryDetail=t.data,i.items=e,i.renderLottery(),d&&d(i.lotteryDetail)}else UIkit.notification({message:"獲取抽獎信息失敗,請刷新重試",status:"warning",timeout:3e3})}),this.$elem.on("click",".lottery-close",function(){c.hide()}),this.$elem.on("click",".draw-btn",function(){return!i.instance||i.instance.running?!1:(l?APSdk.login({title:"輸入驗證碼即可抽獎",submitText:"立即抽獎"}).then(function(t){i.instance.start(),i.roll(),t&&t.isNew&&e.aps&&aps("send","event","web","lottery-member","marketing")}):(i.instance.start(),i.roll()),!1)}),c.on("click",".feed-btn",function(){var e=c.find(".remark").val(),n=i.instance;return e?t.ajax({url:"/openapi/member/lotteryFeedback",method:"POST",data:{id:n.result?n.result.logId:"",remark:e,siteId:a}}).then(function(t){0===+t.status?(UIkit.notification({message:"領取成功!請等待處理",status:"success",timeout:3e3}),c.hide()):UIkit.notification({message:t.msg||"反饋出錯,請重試",status:"warning",timeout:3e3})}).catch(function(){UIkit.notification({message:"網絡錯誤,請聯系站長管理員",status:"warning",timeout:3e3})}):UIkit.notification({message:"獲取抽獎信息失敗,請刷新重試",status:"warning",timeout:3e3}),!1})},constructor:i},t.fn.Lottery=function(t){var e=new i(this,t);return e}}(jQuery,window); ;/*!aipage:static/js/lib/form.js*/ window.form=function(){function e(e){for(var a={},t=e.split("&"),i=0;i\n
'+(a+1)+'
\n
'+e+"
\n \n "}),t='\n
\n
\n
\n\n
    \n '+a.join("")+"\n
\n
\n ";return t}function i(e,a){var i='\n
\n \n
\n ",n=[],s=[],o=[];a.fields.forEach(function(e,t){"Step"!==e.type?t===a.fields.length-1?(s.push(o),n.push("完成提交")):o.push(e):(n.push(e.label),s.push(o),o=[])});var c=t(n),u="";a.enableCaptcha!==!1&&(u+=l(e)),a.enablePhoneVerify!==!1&&(u+=d());var f=s.map(function(e,a){return'\n
\n '+e.map(function(e){return r(e)}).join("")+"\n "+(a===s.length-1?u:"")+"\n
\n "}),m="";return a.enableAgreement&&(m='\n
'+a.agreePrefix+"\n \n "+a.agreeName+"\n \n
\n "),"\n "+c+'\n\n
\n '+f.join("")+'\n
\n\n
\n \n '+(y.SUBMIT_SUCCESS||"提交成功")+'\n
\n\n \n "+m+"\n "+i+"\n "}function n(e,a){var t="",n='
",s=a.fields||[];return w[e]||(w[e]=a.fields||[]),s.find(function(e){return"Step"===e.type})?i(e,a):(s.forEach(function(e){t+=r(e)}),a.enableCaptcha!==!1&&(t+=l(e)),a.enablePhoneVerify!==!1&&(t+=d()),a.enableAgreement&&(t+='\n
'+a.agreePrefix+"\n \n "+a.agreeName+"\n \n
\n "),a.submitText===!1?t:t+n)}function r(e){switch(e.type){case"Header":return o(e);case"Paragraph":return c(e);case"Dropdown":return v(e);case"TextInput":case"DateTime":return f(e);case"TextArea":return h(e);case"Checkboxes":return g(e);case"Radios":return b(e);case"LineBreak":return u(e);case"File":return m(e);case"Image":return p(e);case"Address":return s(e);default:return""}}function s(e){var a=e.format||"all",t=e.required?"uk-form-label ap-form-required":"uk-form-label",i='';return"all"===a&&(i+=''),'
'+i+"
"}function l(e){var a=y.CAPTCHA||"captcha",t=y.CHANEG_CAPTCHA||"click to change verification code";return'
'+a+'
'}function d(){return'
'}function o(e){return'

'+e.content+"

"}function c(e){return'

'+e.content+"

"}function u(){return'

'}function f(e){var a=e.required?"uk-form-label ap-form-required":"uk-form-label";return'
'}function m(e){var a=e.required?"uk-form-label ap-form-required":"uk-form-label";return'\n
\n \n
\n \n \n\n
\n \n '+(y.FILE_UPLOAD||"文件上傳")+"\n
\n
\n
\n "}function p(e){var a=e.required?"uk-form-label ap-form-required":"uk-form-label";return'\n
\n \n
\n
\n \n \n
\n '+(e.placeholder||"點擊上傳圖片")+"\n
\n
\n
\n
\n "}function v(e){var a=e.required?"uk-form-label ap-form-required":"uk-form-label";return'
"}function h(e){var a=e.required?"uk-form-label ap-form-required":"uk-form-label";return'
'}function g(e){var a=e.required?"uk-form-label ap-form-required":"uk-form-label";return'
'+e.options.map(function(a){return'"}).join("")+"
"}function b(e){var a=e.required?"uk-form-label ap-form-required":"uk-form-label";return'
'+e.options.map(function(a){return'"}).join("")+"
"}var k="/openapi/form",w={},y={},x={},C={mobile:function(e){return/^(0|86|17951)?1(3|4|5|6|7|8|9)\d{9}$/.test(e)},tel:function(e){return/^\d3,4|\d{3,4}-\d{7,8}$/.test(e)},qq:function(e){return/^[1-9][0-9]{4,10}$/.test(e)},email:function(e){return/^([A-Za-z0-9_\-.])+@([A-Za-z0-9_\-.])+\.([A-Za-z]{2,4})$/.test(e)},url:function(e){return/^https?:\/\/(([a-zA-Z0-9_-])+(\.)?)*(:\d+)?(\/((\.)?(\?)?=?&?[a-zA-Z0-9_-](\?)?)*)*$/i.test(e)},id:function(e){return/^(^[1-9]\d{7}((0\d)|(1[0-2]))(([0|1|2]\d)|3[0-1])\d{3}$)|(^[1-9]\d{5}[1-9]\d{3}((0\d)|(1[0-2]))(([0|1|2]\d)|3[0-1])((\d{4})|\d{3}[Xx])$)$/.test(e)},number:function(e){return/^[0-9]+(.[0-9]+)?$/.test(e)},postCode:function(e){return/^[1-9]\d{5}$/.test(e)},chinese:function(e){return/^[\u4e00-\u9fa5]+$/.test(e)},english:function(e){return/^[a-zA-Z]+$/.test(e)}};return{init:function(){this.render();var e={},t=window.aipage.env,i=window.aipage.env.siteId,n=window.aipage.env.pageId,r=window.aipage.env.language||"zh";y=window.i18n[r]||window.i18n.en,x=y.FORM_TIP||window.i18n.en.FORM_TIP,$(".ele-form").on("click",".send-code",function(){var e=$(this),a=$.trim(e.closest(".ele-form").find("input.phone").val());return C.mobile(a)?(e.text("發送中"),$.ajax({url:"/openapi/form/sendPhoneVerify",method:"POST",data:{siteId:i,phone:a},success:function(a){0===+a.status?e.text("已發送"):(e.text("發送"),UIkit.notification("驗證碼發送失敗:"+a.msg))}}),!1):(UIkit.notification("請填寫正确的手機号"),!1)}),$(document).off("submit").on("submit","form[data-form-id], .ap-search-form",function(r){r.preventDefault();var s=$(this),l=s.data("form-id"),d=$(this).closest("[data-id]").attr("data-id"),o=$(this).data("form-config"),c=s.data("redirect"),u=s.hasAttr("data-close-popup"),f=s.data("submitTip"),m=s.find("button"),p=document.title,v=encodeURIComponent(document.location.href),h="formId="+l+"&siteId="+i+"&elementId="+d+"&pageId="+n+"&"+$(this).serialize()+"&pageName="+p+"&pageUrl="+v+"&formConfig="+encodeURIComponent(o||"");if(h.indexOf("language=")<0&&(h+="&language="+(t.language||"zh")),h.indexOf("deviceType=")<0&&(h+="&deviceType="+(t.deviceType||"pc")),m.prop("disabled",!1),s.hasClass("ap-search-form")){var g=s.attr("data-url"),b=s.attr("data-type"),k=s.attr("data-category"),C=s.find(".search-input").val();s.find(".search-type").length&&(b=s.find(".search-type li.active").data("type")||100,g=s.find(".search-type li.active").data("value")),g?(b>0&&(g=APSdk.setUrlParam(g,"type",b)),k&&(g=APSdk.setUrlParam(g,"categoryId",k)),$.setUrlParam("wd",C,g)):UIkit.notification("網站尚未配置搜索結果頁")}else{var I=a(h,w[l]),T=!0;s.find(".error").remove();for(var P=0;P'+S+"");break}A.addClass("uk-form-success")}if(!T||e[l])return!1;if(s.find(".captcha-code").length&&!s.find(".captcha-code").val())return UIkit.notification(y.CAPTCHA_TIP||"請輸入驗證碼"),!1;e[l]=!0,$.ajax({url:"/openapi/feedback/addPageFeedback",method:"POST",data:h,success:function(a){if(e[l]=!1,0===+a.status){s.find(".step-success").length?(s.find(".step-form-content").hide(),s.find(".step-success").show()):UIkit.notification(f||y.SUBMIT_SUCCESS||"提交成功"),s[0].reset();for(var t=0;ta)return UIkit.notification(x.fileTooLarge),void $(this).val("");var n=$(this),r=n.next("input"),s=t.find(".add-image").length?"image":"file";if("image"===s){var l='\n
\n \n \n
\n \n 上傳中\n
\n
';t.find(".img-preview").remove(),t.find(".add-image").append(l)}var d=new FormData;d.append("file",n.get(0).files[0]),d.append("siteId",i),$.ajax({url:"/openapi/upload",type:"POST",data:d,cache:!1,contentType:!1,processData:!1,beforeSend:function(){t.addClass("uploading")},success:function(e){t.removeClass("uploading"),0===+e.status?(r.val(e.data.url),"file"===s&&UIkit.notification(y.FILE_UPLOAD_SUCCESS||"文件上傳成功")):(UIkit.notification((y.FILE_UPLOAD_FAIL||"文件上傳失敗,請重試:")+e.msg),n.val(""))}})}),$(document).on("click","form .step-btns a",function(){var t=$(this).closest("form"),i=t.find(".ui-step.active").last().index(),n=t.find(".prev-step"),r=t.find(".next-step"),s=t.find(".ui-step").length,l=$(this).hasClass("prev-step"),d=t.find(".ui-step-wrap").width(),o=d/s;if(!l){var c=t.serialize(),u=t.attr("data-form-id"),f=a(c,w[u]),m=!0;t.find(".error").remove();for(var p=0;p'+g+"");break}h.addClass("uk-form-success")}}if(!m||e[u])return!1}i=l?i-1:i+1,0>=i?(n.hide(),r.show()):i>=s-1?(r.hide(),n.show()):(n.show(),r.show()),0>i&&(i=0),i>s-1&&(i=s-1),t.find(".step-success").hide(),t.find(".step-bg-progress").animate({width:o*(i+1)},300,function(){t.find(".ui-step").each(function(e){e>i?$(this).removeClass("active"):$(this).addClass("active")})}),t.find(".step-form-content:eq("+i+")").show().siblings().hide(),i===s-1?(t.find(".submit-wrap").show(),t.find(".form-agree").show()):(t.find(".submit-wrap").hide(),t.find(".form-agree").hide())})},validateForm:a,renderForm:n,initForm:function(e){if(e.find(".address-select").length){var a=e.find(".address-select");a.addressSelect(),e.find(".address-select select").on("change",function(){var e=a.find(".province-select").find("option:selected").text(),t=a.find(".city-select").find("option:selected").text(),i=a.find(".area-select").find("option:selected").text();a.find("input").val(e+t+i)})}if(e.find(".step").length){var t=e.find(".ui-step-wrap").width(),i=e.find(".ui-step").length,n=t/i;e.find(".step-bg-progress").css({width:n+"px"})}},render:function(){var e=this,a=window.aipage.env.siteId,t=$('form[data-item="formId"], .ele-form');t.each(function(){var t=$(this);t.html("");var i="true"===t.data("formCaptcha")||t.data("formCaptcha")===!0,r="true"===t.data("phoneVerify")||t.data("phoneVerify")===!0,s="true"===t.data("agreement")||t.data("agreement")===!0,l=t.data("agreementPrefix"),d=t.data("agreementLink"),o=t.data("agreementName"),c=t.data("formId"),u=t.data("submitText")||"提交",f=t.data("formTheme");c&&$.ajax(k+"/"+c,{type:"GET",data:{siteId:a,theme:f,submitText:u,enableCaptcha:i,enablePhoneVerify:r},dataType:"json"}).then(function(a){if(0===+a.status){var f=a.data;w[c]=f;var m=a.html||n(c,{fields:f,submitText:u,enableCaptcha:i,enablePhoneVerify:r,enableAgreement:s,agreePrefix:l,agreeName:o,agreeLink:d});t.html(m),e.initForm(t),t.trigger("loaded"),$("body").trigger("form-render")}})})}}}(); ;/*!aipage:static/js/lib/shop/imageZoom.js*/ !function(i,t){var o=function(i){this.$elem=i,this.$smallBox=this.$elem.find(".preview-box"),this.$videoBox=this.$elem.find(".video-box"),this.$smallBoxPic=this.$smallBox.find("img"),this.$smallBoxMask=this.$smallBox.find(".zoom-hover"),this.$thumbnailBox=this.$elem.find(".thumb-box"),this.$thumbnailBoxPrev=this.$thumbnailBox.find(".btn-prev"),this.$thumbnailBoxNext=this.$thumbnailBox.find(".btn-next"),this.$thumbnailBoxWrapper=this.$thumbnailBox.find("ul"),this.$thumbnailBoxItem=this.$thumbnailBox.find(".thumb-item"),this.$thumbnailBoxPic=this.$thumbnailBox.find("img"),this.$bigBox=this.$elem.find(".zoom-box"),this.$bigBoxPic=this.$bigBox.find("img")};o.prototype={moveBigPic:function(){var i=this.$smallBoxMask.position().left/(this.$smallBox.width()-this.$smallBoxMask.width()),t=this.$smallBoxMask.position().top/(this.$smallBox.height()-this.$smallBoxMask.height()),o=i*(this.$bigBoxPic.width()-this.$bigBox.width()),s=t*(this.$bigBoxPic.height()-this.$bigBox.height());this.$bigBox.scrollLeft(o).scrollTop(s)},changeSrouce:function(i,t){this.$smallBox.show(),this.$videoBox.hide(),this.$videoBox.find("video").trigger("pause"),this.$smallBoxPic.attr("src")!==i&&this.$smallBoxPic.attr("src",i),this.$bigBoxPic.attr("src",t)},showVideo:function(){this.$smallBox.hide(),this.$videoBox.show(),this.$videoBox.find("video").trigger("play")},init:function(){var o=this;this.$thumbnailBoxNext.click(function(){var i=o.$thumbnailBoxItem.length-5,t=78*i;i>0&&o.$thumbnailBoxWrapper.animate({marginLeft:-t})}),this.$thumbnailBoxPrev.click(function(){o.$thumbnailBoxWrapper.animate({marginLeft:0})}),this.$thumbnailBoxItem.mouseover(function(){var t=i(this).attr("data-origin"),s=i(this).attr("data-pic"),h=i(this).attr("data-type");o.$thumbnailBoxItem.removeClass("active"),i(this).addClass("active"),"video"===h?o.showVideo():o.changeSrouce(s,t)}),this.$smallBox.mousemove(function(s){if(o.$smallBoxMask.length){var h=s||t.event,l={left:h.clientX-i(this).offset().left-o.$smallBoxMask.width()/2,top:h.clientY-i(this).offset().top-o.$smallBoxMask.height()/2+i(t).scrollTop()};l.left<0?l.left=0:l.left>i(this).width()-o.$smallBoxMask.width()&&(l.left=i(this).width()-o.$smallBoxMask.width()),l.top<0?l.top=0:l.top>i(this).height()-o.$smallBoxMask.height()&&(l.top=i(this).height()-o.$smallBoxMask.height()),o.$smallBoxMask.css(l),o.moveBigPic()}}).hover(function(){o.$bigBox.show(),o.$smallBoxMask.show()},function(){o.$smallBoxMask.hide(),o.$bigBox.hide()})},constructor:o},i.fn.ImageZoom=function(){var i=new o(this);return i.init()}}(jQuery,window); ;/*!aipage:static/js/lib/shop/selectNum.js*/ !function(t){var i=function(t){this.$elem=t,this.$lessBtn=this.$elem.find(".less"),this.$moreBtn=this.$elem.find(".more"),this.$input=this.$elem.find("input")};i.prototype={getNum:function(){return parseInt(this.$input.val(),10)},setNum:function(t){t=parseInt(t,10);var i=parseInt(this.options.max,10),s=parseInt(this.options.stock,10),n=parseInt(this.options.min,10)||1,e=i;s>=0&&(e=s),e>=0&&(e>t?this.$moreBtn.removeClass("disable"):(this.$moreBtn.addClass("disable"),t=e),0===+e)||(t>=n&&this.$input.val(t).change(),t===n?this.$lessBtn.addClass("disable"):this.$lessBtn.removeClass("disable"))},init:function(t){var i=this;this.options=t||{};var s=this.options.max,n=this.options.min||1,e=this.options.stock;this.$lessBtn.removeClass("disable"),this.$moreBtn.removeClass("disable");var o=i.getNum();s>=0&&o>=s&&this.setNum(s),n>0&&n>o&&this.setNum(n),0===+s&&this.$moreBtn.addClass("disable"),1>=o&&this.$lessBtn.addClass("disable"),this.$lessBtn.off().on("click",function(){var t=i.getNum();return 1===t?void UIkit.notification("不能再少啦~",{timeout:1e3}):t==n?void UIkit.notification("最少購買"+n+"個",{timeout:1e3}):void(t>1&&i.setNum(t-1))}),this.$moreBtn.off().on("click",function(){var t=i.getNum();return t===s&&s>0?void UIkit.notification("限購"+s+"個",{timeout:1e3}):t===e&&e>=0?void UIkit.notification("庫存不足",{timeout:1e3}):void i.setNum(t+1)}),this.$input.off().on("keyup",function(){var t=i.getNum();(isNaN(t)||1>t)&&(t=1),i.setNum(t)})},constructor:i},t.fn.SelectNum=function(s){return t(this).each(function(){var n=new i(t(this));return n.init(s)})}}(jQuery,window); ;/*!aipage:static/js/lib/shop/addressSelect.js*/ !function(t){var i=function(i,e){this.$elem=i,this.$province=this.$elem.find(".province-select"),this.$city=this.$elem.find(".city-select"),this.$area=this.$elem.find(".area-select"),this.defaults={cityAPI:"/openapi/express/city",areaAPI:"/openapi/express/area",defaultProvince:'',defaultCity:'',defaultArea:''},this.options=t.extend({},this.defaults,e),this.data={},this.province={11e4:"北京市",12e4:"天津市",13e4:"河北省",14e4:"山西省",15e4:"内蒙古自治區",21e4:"遼甯省",22e4:"吉林省",23e4:"黑龍江省",31e4:"上海市",32e4:"江蘇省",33e4:"浙江省",34e4:"安徽省",35e4:"福建省",36e4:"江西省",37e4:"山東省",41e4:"河南省",42e4:"湖北省",43e4:"湖南省",44e4:"廣東省",45e4:"廣西壯族自治區",46e4:"海南省",5e5:"重慶市",51e4:"四川省",52e4:"貴州省",53e4:"雲南省",54e4:"西藏自治區",61e4:"陝西省",62e4:"甘肅省",63e4:"青海省",64e4:"甯夏回族自治區",65e4:"新疆維吾爾自治區",71e4:"台灣省",81e4:"香港特别行政區",82e4:"澳門特别行政區"}};i.prototype={initSelect:function(){var t=this.options,i=t.defaultArea,e=t.defaultCity,a=t.defaultProvince;this.renderSelect(this.$province,this.province,a),this.$city.html(e).val(""),this.$area.html(i).val("")},renderSelect:function(t,i,e){var a=e,n=Object.keys(i);n.forEach(function(t){a+='