/*
* author: Lin Xiao Dong <1071322670@qq.com>
* update: 2018.07.16
* website: http://www.openwbs.com/
*/
function UC_Class(){this.ctl="",this.act="",this.init=function(){var a=$("#header"),b=$("#top-account"),c=$("#top-account-sub");$sidebar=$("#sidebar"),fromId=0,"form"==UC.ctl?(fromId=OW.getParaValue(OW.currentURL(),"form_id"),$sidebar.find("li[name='"+UC.ctl+"-"+fromId+"']").addClass("current")):$sidebar.find("li[name='"+UC.ctl+"']").addClass("current"),$("#sidebar").css("height",OW.webScreenHeight()-a.height()),b.hover(function(){$(this).addClass("hover"),c.show()},function(){$(this).removeClass("hover"),c.hide()})},this.avatarUpload=function(){},this.dialogPosting=function(){return OWDialog({id:"d_owdialog_posting",content:'<div class="posting">正在提交保存，请稍候...</div>'})},this.runDisplay=function(){var a=$("div[name='display']").attr("result"),b=$("div[name='buttons']").find("a:first"),c=10;b.attr("default_text",b.html()),"success"==a&&(c=3),UC.runDisplayTimeout(c)},this.runDisplayTimeout=function(a){var b=$("div[name='buttons']").find("a:first"),c=b.attr("default_text")+' <i class="font-10 font-normal">('+a+")<i>";null!==a&&(3>=a&&b.html(c),a=parseInt(a-1),a>0?window.setTimeout(function(){UC.runDisplayTimeout(a)},1e3):window.location.href=b.attr("href"))},this.commentInit=function(a){var b=a.gid,c=a.pid,d=a.orderId,e=a.form,f=a.verifycode,g=a.vcodeValue,h=a.submit,i=e.find("textarea[name='cmt_content']"),j=e.find("span[name='t_cmt_content']");OW.verifyCodeValueFocus(g,f),OW.verifyCodeValueBlur(g),OW.enterClick(function(){h.click()}),h.click(function(){var o,p,a=!0,h=OW.trim(i.val()),k=OW.int(e.find("input[name='cmt_type']:checked").val()),l=OW.trim(f.find("input[name='verifycode_name']").val()),m=OW.trim(g.val()),n=0;1==e.find("input[name='is_anonymous']").attr("checked")&&(n=1),i.val(h),OW.isNull(h)?(a=!1,i.addClass("textarea-err").focus(),j.addClass("t-err").html("请填写评价内容")):(i.removeClass("textarea-err"),j.removeClass("t-err").html("")),a&&(OW.isNull(m)?(a=!1,g.addClass("text-err").focus()):g.removeClass("text-err")),a&&(o=OW.sitePath+"ow-includes/ow.ajax.shop.asp?ctl=goods&act=comment_post",p="order_id="+d+"&gid="+b+"&pid="+c+"&cmt_type="+escape(k)+"&cmt_content="+escape(h)+"&is_anonymous="+n+"&verifycode_name="+l+"&verifycode_value="+m,$dialog=OWDialog().posting().follow(i),OW.ajax({url:o,data:p,success:function(){$dialog.success("亲，恭喜，评论提交成功！").timeout(2),OW.delay(2100,function(){i.val("").focus(),f.html(""),g.val(""),OW.refresh()})},failed:function(a){$dialog.error("亲，很抱歉，评论提交失败，请刷新页面再试试！",a).timeout(4),g.val("").focus(),OW.verifyCode({boxer:f})}}))})},this.mobileAndPasswordSet=function(a){var b=a.form,c=b.find("input[name='mobile']"),d=b.find("input[name='mobile_code']"),e=b.find("button[name='get_mobile_code']"),f=b.find("input[name='password']");$btn=b.find("#submit"),$vv=b.find("input[name='verifycode_value']"),$vc=b.find("span[name='set_verifycode']"),vcodeOpen=b.attr("vcode_open"),OW.verifyCode({boxer:$vc}),OW.verifyCodeValueFocus($vv,$vc),OW.verifyCodeValueBlur($vv),OW.objExist(c)&&OW.getMobileCode({mb:c,mc:d,getmc:e,url:OW.sitePath+"ow-includes/ow.ajax.member.asp?ctl=member&act=get_mobile_set_mobile_code",vcodeOpen:vcodeOpen,vc:$vc,vv:$vv,isHide:!0}),OW.enterClick(function(){$btn.click()}),$btn.click(function(){var a=OW.sitePath+"ow-includes/ow.ajax.member.asp?ctl=member&act=mobile_and_password_set",b=!0,e=!0,g=OWDialog().posting(),h=$vc.find("input[name='verifycode_name']"),i=OW.parseMobile(OW.trim(c.val())),j=OW.trim(d.val()),k=OW.trim(f.val());OW.parseVerifyCode($vv.val()),OW.trim(h.val()),!OW.isValidMobile(i)&&b?(b=!1,c.addClass("text-err").focus()):c.removeClass("text-err"),""==j&&b?(b=!1,d.addClass("text-err").focus()):d.removeClass("text-err"),""==k&&b?(b=!1,f.addClass("text-err").focus()):f.removeClass("text-err"),b?OW.ajax({url:a,data:"mobile="+OW.encrypt.encode(i)+"&mobile_code="+OW.encrypt.encode(j)+"&password="+OW.encrypt.encode(k),success:function(){g.success("成功设置！").position().timeout(2),OW.delay(1500,function(){OW.openPage(OW.sitePath+"ow-ucenter/")})},failed:function(a){OW.verifyCode({boxer:$vc}),OW.setDisabled($btn,!1),$vv.val("").focus(),g.error("亲，设置失败，请查看以下错误信息",a).position().timeout(2)}}):(e&&g.close(),OW.setDisabled($btn,!1))})}}var UC=new UC_Class;