(function(v,w,d,q,_self){ q(function(q){ class Login{ constructor(...params) { try{ this.pageData = pageData }catch(e){ this.pageData = {} } this.translate = this.pageData.translate ? this.pageData.translate : {} this.lang = this.pageData.lang ? this.pageData.lang : '' this.name = this.pageData.name ? this.pageData.name : '' this.two_factor_send_email_code = this.pageData.two_factor_send_email_code ? this.pageData.two_factor_send_email_code : '' this.two_send_email_url = this.pageData.two_send_email_url ? this.pageData.two_send_email_url : '' this.check_two_send_email_url = this.pageData.check_two_send_email_url ? this.pageData.check_two_send_email_url : '' this.two_factor_authentication_submit = this.pageData.two_factor_authentication_submit ? this.pageData.two_factor_authentication_submit : '' this.link = this.pageData.link ? this.pageData.link : [] this.forgoturl = this.pageData.forgoturl ? this.pageData.forgoturl : [] this.ordersList = this.pageData.ordersList ? this.pageData.ordersList : [] this.countryList = this.pageData.countryList ? this.pageData.countryList : [] this.industryList = this.pageData.industryList ? this.pageData.industryList : [] this.api = this.pageData.api ? this.pageData.api : '' this.email = this.pageData.email ? this.pageData.email : '' this.loading = false this.bigPage = this.pageData.bigPage ? true : false this.googleRecaptcheClientKey = this.pageData.gc_client_key ? this.pageData.gc_client_key : '' return this.initApp() } initApp(){ _self = this this.registeredApp() this.app = new v({el : "#app",}) return false } registeredApp(){ this.registered() v.component("App",{ template:`
`, data(){ return { name : _self.name, loading : false, bigPage : _self.bigPage, logoArr: [ '//s.trackingmore.com/B-revised/img/icon/ilmakiage.svg', 'http://s.trackingmore.com/B-revised/img/icon/dhgate.svg', 'http://s.trackingmore.com/B-revised/img/icon/bamko.svg', 'http://s.trackingmore.com/B-revised/img/icon/shein.svg', 'http://s.trackingmore.com/B-revised/img/icon/digitec.svg', 'http://s.trackingmore.com/B-revised/img/icon/banggood.svg', 'http://s.trackingmore.com/B-revised/img/icon/kaufland.svg', 'http://s.trackingmore.com/B-revised/img/icon/ebanx.svg', 'http://s.trackingmore.com/B-revised/img/icon/dji.svg', 'http://s.trackingmore.com/B-revised/img/icon/printify.svg', ] } }, mounted(){ w.addEventListener('keydown',this.keyDown); }, methods:{ keyDown(e){ if(e.keyCode != 13) return false if(!this.$refs[this.name]) return false if(!this.$refs[this.name].handleSubmit) return false return this.$refs[this.name].handleSubmit() }, showLoading(a){ this.loading = a }, } }) } registered(){ this.registeredLogo(); this.registeredLogoV1(); this.registeredInputStyle(); this.registeredSeleteStyle(); this.registeredButtonStyle(); this.registeredLinkList(); this.registeredVerifyCodeInputBtnStyle(); this.registeredNameInputStyle(); this.registeredRoleTableTitle(); switch(_self.name) { case 'login': this.registeredLogin(); break; case "two-factor-authentication" : this.twoFactorAuthentication(); break; case 'login-manage': this.registeredLoginManage(); break; case 'login-auth': this.registeredLoginAuth(); break; case 'login-qrcode': this.registeredLoginQRcode(); break; case 'signup': this.registeredSignup(); break; case 'forgot-password': this.registeredForgotPassword(); break; case 'sent-email': this.registeredSentEmail(); break; case 'sent-password': this.registeredSentPassword(); break; case 'signup-information': this.registeredSignupInformation(); break; case 'change-password': this.registeredChangePassword(); break; case 'check-verify-code': this.registeredSentEmailCode(); break; case 'set-account-role': this.registeredSetAccountRole(); break; case 'write-role-info': this.registeredWriteRoleInfo(); break; case 'third-auth': this.registeredThirdAuth(); break; default : break; } } registeredLogo(){ v.component("Logo",{ template:`
${_self.translate.t6}
${_self.translate.t61}
${_self.translate.t2} ${_self.translate.t2}
{{email}}
{{ explain }}
`, props:{ explain : String, shopify : Boolean, introduce : Boolean, email: String, line: Boolean, isShowback: { type: Boolean, default: false }, typeName: Boolean }, methods: { previousPage() { history.go(-1) } } }) } registeredLogoV1(){ v.component("LogoV1",{ template:`
{{ explain }}
${_self.translate.t6}
${_self.translate.t61}
${_self.translate.t3}
${_self.translate.t2}
{{email}}
`, props:{ explain : String, shopify : Boolean, introduce : Boolean, email: String, line: Boolean, isShowback: { type: Boolean, default: false }, typeName: Boolean, google: Boolean, }, methods: { previousPage() { history.go(-1) }, googleAuth(){ if (_self.translate.google_auth) { window.google.accounts.oauth2.initCodeClient( JSON.parse(_self.translate.google_auth) ).requestCode(); } }, } }) } registeredInputStyle(){ v.component("InputStyle",{ template:`
{{ error }}
${_self.translate.t1123?_self.translate.t1123:'Contains 8 - 20 characters'}
${_self.translate.t1122?_self.translate.t1122:'Includes numbers, uppercase and lowercase letters'}
`, props : { type : { type : String, default : 'text', }, placeholder : String, name : { type : String, default : '', }, showPass : { type : Boolean, default : false, }, disabled : { type : Boolean, default : false, }, value : { type : String | Number, default : '', }, optional : { type : Boolean, default : false, }, autocomplete : { type : String, default : 'on', }, maxlength: { type: Number, default: null, }, }, data(){ return { error : null, errorName : _self.translate.name, inputValue : this.value, inputType : this.type, roleShow: false, role1: 2, role2: 2 } }, methods:{ focusFunc() { if(this.name === 'newPassword') this.roleShow = true }, showError(message){ this.error = message }, changeType(){ this.inputType = this.inputType == 'password' ? 'text' : 'password' }, inputBlur(){ if(this.name != 'password') this.inputValue = this.inputValue.trim() return this.checkValue(this.inputValue,false) }, checkValue(value,bool){ if(!value) return this.showError(null) switch(this.name){ case 'email' : if(this.checkEmailFormat(value)) return this.showError(null) return bool ? false : this.showError(_self.translate.t111) break case 'password' : if(this.checkPasswordFormat(value)) return this.showError(null) return bool ? false : this.showError(_self.translate.t112) break case 'username' : if(this.checkUsernameFormat(value)) return this.showError(null) return bool ? false : this.showError(_self.translate.t115) break case 'company' : if(this.checkCompanyFormat(value)) return this.showError(null) return bool ? false : this.showError(_self.translate.t111) break case 'website' : if(this.checkWebsiteFormat(value)) return this.showError(null) return bool ? false : this.showError(_self.translate.t112) break case 'firstname' : if(this.checkFirstnameFormat(value)) return this.showError(null) if(!this.checkFirstnameFormat(value)) return this.showError(_self.translate.t119) return bool ? false : this.showError(_self.translate.t117) break case 'lastname' : if(this.checkLastnameFormat(value)) return this.showError(null) if(!this.checkLastnameFormat(value)) return this.showError(_self.translate.t119) return bool ? false : this.showError(_self.translate.t118) break case 'newPassword' : this.checkNewPassword(value) break case 'verifycode': this.handleVerifycode(value) if(this.checkVerifyCode(value)) return this.showError(null) return bool ? false : this.showError(_self.translate.t214) break } }, checkPasswordFormat(password){ if (_self.translate.name1 || _self.pageData.isManage) { return password.length >= 16 && password.length <= 20 } else { return password.length >= 6 && password.length <= 20 } }, checkUsernameFormat(username){ return username.length >= 3 && username.length <= 100 }, checkCompanyFormat(company){ return company.length >= 3 && company.length <= 100 }, checkWebsiteFormat(website){ if(this.optional && !website) return true return /[0-9a-z-_]+\.[0-9a-z-_]+/i.test(website) }, checkEmailFormat(email){ let patternEmail = new RegExp("(^\\w+([-+.]\\w+)*@\\w+([-.]\\w+)*\\.\\w+([-.]\\w+)*$)") let forbidEmail = /nwytg\.net$/i if(forbidEmail.test(email)) return false if(patternEmail.test(email)) return true return false }, checkFirstnameFormat(username){ return username.length >= 1 && username.length <= 32 }, checkLastnameFormat(username){ return username.length >= 1 && username.length <= 32 }, checkNewPassword(pwd){ // this.error = false let reg2 = /(?=.*\d)(?=.*[a-z])(?=.*[A-Z])/ if (_self.translate.name1) { this.role1 = pwd.length > 15 && pwd.length < 21 ? 1 : 2 }else{ this.role1 = pwd.length > 7 && pwd.length < 21 ? 1 : 2 } this.role2 = reg2.test(pwd) ? 1 : 2 this.error = (this.role1 === 2 || this.role2 === 2) }, cCheckNewPassword(pwd){ let reg = /^(?=.*\d)(?=.*[a-z])(?=.*[A-Z]).{8,20}$/ return reg.test(pwd) }, checkVerifyCode(verifycode){ let pattern = new RegExp("(^[0-9]{6}$)") if (pattern.test(verifycode)) return true return false }, handleVerifycode(val) { this.inputValue = val.replace(/[^\d]{6}/g,''); }, handleFocus() { const el = this.$el.querySelector('input') if (el) el.focus() }, }, watch:{ inputValue(value,oldValue){ this.checkValue(value,true) this.$emit('changeValue', value) if(this.$listeners['change']) return this.$emit('change', value, oldValue) return false; } }, model:{ prop: 'value', event: 'changeValue', } }) } registeredButtonStyle() { v.component("ButtonStyle",{ template:`
`, data(){ return { loading : false, success : '', } }, props:{ text : String, disable: { type: Boolean, default: false, }, }, methods:{ handleSubmit(e){ if(this.$listeners["click"]) this.$emit("click",e) return false } } }) } registeredSeleteStyle() { v.component("SeleteStyle",{ template:`
`, data(){ return { error : null, inputValue : '', } }, props:{ option : { type : Array, default : [], }, name : { type : String, default : '', }, value : { type : String | Number, default : 0, }, placeholder : String, }, methods:{ showError(message){ this.error = message }, select(value){ if(this.error) this.error = null this.inputValue = value.name ? value.name : '' if(value.value){ this.$emit('changeValue', value.value) if(this.$listeners['change']) return this.$emit('change', value.value) } } }, model:{ prop: 'value', event: 'changeValue', } }) } registeredLinkList() { v.component("LinkList",{ template:` `, props:{ link : { type : Array, default : [], } } }) } registeredSignup(){ v.component("Signup",{ template:`
{{ errorMessage }}
${_self.translate.clause}
${_self.translate.nocheck_message}
${_self.link[0].value}
`, data(){ return { link : _self.link, email : _self.email, // username : '', password : '', firstname : '', lastname : '', errorMessage : '', isSendCode : false, second : 60, verifycode: '', emailError: '', emailUrl: '', isFirst: true, verifycodeError: false, cftoken: '', isChecked: true, } }, computed: { disable() { if(!this.firstname) return true; if(!this.$refs.firstname.checkFirstnameFormat(this.firstname)) return true; if(!this.lastname) return true; if(!this.$refs.lastname.checkLastnameFormat(this.lastname)) return true; if(!this.email) return true; if(!this.$refs.email.checkEmailFormat(this.email)) return true; if(!this.password) return true; if(!this.$refs.newPassword.cCheckNewPassword(this.password)) return true; // 验证cf的token if(!this.cftoken) return true; if(!this.isChecked){ return true; } return false; }, }, watch: { email(val, old) { if (val !== old) this.emailUrl = '' }, // verifycode(val, old) { // if (val !== old) this.verifycodeError = false // }, }, mounted() { this.$refs.firstname.handleFocus() // CF Turnstile turnstile.ready(() => { turnstile.render('#cf-turnstile-container', { sitekey: '0x4AAAAAAAgo2PH-EZFDzaTA', // sitekey: '1x00000000000000000000AA', callback: (token) => { this.cftoken = token; }, }); }); }, methods:{ setCheck:function(){ this.check = !this.check console.log(this.check) }, showError(message){ this.errorMessage = message }, handleSubmit(e){ this.errorMessage = '' if(e) e.stopPropagation() if(!this.firstname) return this.$refs.firstname.showError(_self.translate.t113) if(!this.$refs.firstname.checkFirstnameFormat(this.firstname)) return this.$refs.firstname.showError(_self.translate.t119) if(!this.lastname) return this.$refs.lastname.showError(_self.translate.t113) if(!this.$refs.lastname.checkLastnameFormat(this.lastname)) return this.$refs.lastname.showError(_self.translate.t119) if(!this.email) return this.$refs.email.showError(_self.translate.t113) if(!this.$refs.email.checkEmailFormat(this.email)) return this.$refs.email.showError(_self.translate.t111) if(!this.password) return this.$refs.newPassword.error = true if(!this.$refs.newPassword.cCheckNewPassword(this.password)) return this.$refs.newPassword.error = true this.$refs.button.loading = true let _that = this _self.sendRequest({ type : _self.name, email : _that.email, password : _that.password, firstname : _that.firstname, lastname : _that.lastname, verifycode: _that.verifycode, token: _that.cftoken, }, _that.handleResponse) // let _that = this // grecaptcha.ready(function() { // grecaptcha.execute(_self.googleRecaptcheClientKey, {action: 'submit'}).then(function(token) { // _self.sendRequest({ // type : _self.name, // email : _that.email, // password : _that.password, // firstname : _that.firstname, // lastname : _that.lastname, // verifycode: _that.verifycode, // // username : this.username, // token: token, // },_that.handleResponse) // }); // }); }, handleResponse(code,message,data){ if (data?.name) this.verifycodeError = true return _self.handleResponse(this,code,message,data) }, getVerifycode(e){ if(e) e.stopPropagation() if(!this.email) return this.$refs.email.showError(_self.translate.t113) if(!this.$refs.email.checkEmailFormat(this.email)) return this.$refs.email.showError(_self.translate.t111) this.isSendCode = true _self.sendRequest({ type : 'get-verify-code', name : _self.name, email : this.email, }, this.handleCodeRespone) this.isFirst = false this.$refs.verifycode.handleFocus() }, handleCodeRespone(code, message, data){ if (code !== 200) { this.isSendCode = false if ([4005, 4006, 4007].includes(code)) return this.handleResponse(code,message,data) return this.$refs.verifycode.showError(message) } if (data['email_url']) { this.emailUrl = data['email_url'] } const st = setInterval(() => { this.second -- if (this.second <= 0) { clearInterval(st) this.isSendCode = false this.second = 60 } }, 1000) }, cleanCode(){ this.inputValue = '' }, }, }) } registeredLogin(){ //
// ${_self.translate.clause} //
//
// {{ value.value ? value.value : '' }} // //
v.component("Login",{ template:`
{{ errorMessage }}
${_self.link[0].value}
`, data(){ return { link : _self.link, errorMessage : '', email : _self.email, password : '', loading : false, line: true, cftoken: '', } }, computed: { disable() { // check cf token if(this.cftoken) return false; if(!this.email) return true if(this.$refs.email && !this.$refs.email.checkEmailFormat(this.email)) return true if(!this.password) return true if(!this.$refs.password.checkPasswordFormat(this.password)) return true return false } }, created(){ // CF Turnstile let _this = this turnstile.ready(() => { turnstile.render('#cf-turnstile-container', { sitekey: '0x4AAAAAAAgo2PH-EZFDzaTA', // sitekey: '1x00000000000000000000AA', callback: (token) => { _this.cftoken = token; }, }); }); }, methods:{ showError(message){ this.errorMessage = message }, handleSubmit(e){ this.errorMessage = '' if(e) e.stopPropagation() if(!this.email) return this.$refs.email.showError(_self.translate.t113) if(!this.$refs.email.checkEmailFormat(this.email)) return this.$refs.email.showError(_self.translate.t111) if(!this.password) return this.$refs.password.showError(_self.translate.t113) if(!this.$refs.password.checkPasswordFormat(this.password)) return this.$refs.password.showError(_self.translate.t112) this.$refs.button.loading = true _self.sendRequest({ type : _self.name, email : this.email, password : this.password, forward : _self.pageData.forward, token: this.cftoken, },this.handleResponse) }, handleResponse(code,message,data){ if (code !== 200) { turnstile.reset("#cf-turnstile-container") } return _self.handleResponse(this,code,message,data) } } }) } registeredLoginManage(){ v.component("LoginManage",{ template:`
${_self.translate.t1}
{{ errorMessage }}
`, data(){ return { link : _self.link, errorMessage : '', error : '', email : _self.email, password : '', loading : false, line: false, cftoken: '', } }, created(){ // CF Turnstile turnstile.ready(() => { turnstile.render('#cf-turnstile-container', { sitekey: '0x4AAAAAAAgo2PH-EZFDzaTA', // sitekey: '1x00000000000000000000AA', callback: (token) => { this.cftoken = token; }, }); }); }, methods:{ showError(message){ this.errorMessage = message }, handleSubmit(e){ this.errorMessage = '' if(e) e.stopPropagation() if(!this.email) return this.$refs.email.showError(_self.translate.t113) if(!this.$refs.email.checkEmailFormat(this.email)) return this.$refs.email.showError(_self.translate.t111) if(!this.password) return this.$refs.password.showError(_self.translate.t113) if(!this.$refs.password.checkPasswordFormat(this.password)) return this.$refs.password.showError(_self.translate.t112) this.$refs.button.loading = true _self.sendRequest({ type : _self.name, email : this.email, password : this.password, forward : _self.pageData.forward, token: this.cftoken, },this.handleResponse) }, handleResponse(code,message,data){ if (code !== 200) { turnstile.reset("#cf-turnstile-container") } return _self.handleResponse(this,code,message,data) } } }) } registeredLoginAuth(){ v.component("LoginAuth",{ template:`
{{email}}
{{ errorMessage }}
`, data(){ return { link : _self.link, errorMessage : '', email : _self.email, password : '', code : '', loading : false, title : _self.translate.t1, sendText : _self.pageData.sendText, line: true } }, methods:{ previousPage() { history.go(-1) }, showError(message){ this.errorMessage = message }, handleSubmit(e){ this.errorMessage = '' if(e) e.stopPropagation() if (!this.code) return this.$refs.code.showError(_self.translate.t113) if (this.code.length !== 6) return this.$refs.code.showError(_self.translate.t115) this.$refs.button.loading = true _self.sendRequest({ type : _self.name, email : this.email, code : this.code, },this.handleResponse) }, handleResponse(code,message,data){ return _self.handleResponse(this,code,message,data) } } }) } registeredSentEmailCode1(){ v.component("SentEmailCode",{ template:`
{{email}}
`, data(){ return { title : _self.pageData.translate.t1, sendText : _self.pageData.sendText, verifycode : '', email : _self.email, } }, methods:{ previousPage() { history.go(-1) }, handleSubmit(e, s){ if(e) e.stopPropagation() if(s) return this.handleConfirm() if(!this.email) return this.$refs.email.showError(_self.translate.t112) if(!this.$refs.verifycode.subCheckVerifyCode(this.verifycode)) return this.$refs.verifycode.showError(_self.translate.t111) this.$refs.button.loading = true _self.sendRequest({ type : _self.name, email : this.email, verifycode : this.verifycode, },this.handleResponse) }, handleResponse(code,message,data){ this.verifycode = '' return _self.handleResponse(this,code,message,data) } } }) } registeredLoginAuth1(){ v.component("LoginAuth",{ template:`
{{ errorMessage }}
`, data(){ return { link : _self.link, errorMessage : '', email : _self.email, password : '', code : '', loading : false, line: true } }, methods:{ showError(message){ this.errorMessage = message }, handleSubmit(e){ this.errorMessage = '' if(e) e.stopPropagation() if (!this.code) return this.$refs.code.showError(_self.translate.t113) if (this.code.length !== 6) return this.$refs.code.showError(_self.translate.t115) this.$refs.button.loading = true _self.sendRequest({ type : _self.name, email : this.email, code : this.code, },this.handleResponse) }, handleResponse(code,message,data){ return _self.handleResponse(this,code,message,data) } } }) } registeredLoginQRcode(){ v.component("LoginQRcode",{ template:`
第一步:

登录手机应用,通过搜索关键词 “ Authenticator ” 下载任意一款两步验证应用

第二步:

打开两步验证应用,然后扫描下方二维码获取应用授权,最后在两步验证页面,输入两步验证码即可提交登录

{{ errorMessage }}
`, data(){ return { link : _self.link, // errorMessage : '', errorMsg : _self.pageData.status, errorMessage : _self.translate.t116, email : _self.email, password : '', code : '', qrsrc: _self.pageData.qrsrc, status: _self.pageData.status, loading : false, line: true } }, methods:{ showError(message){ this.errorMessage = message }, handleSubmit(e){ this.errorMessage = '' if(e) e.stopPropagation() if (!this.code) return this.$refs.code.showError(_self.translate.t113) if (this.code.length !== 6) return this.$refs.code.showError(_self.translate.t115) this.$refs.button.loading = true _self.sendRequest({ type : _self.name, email : this.email, code : this.code, },this.handleResponse) }, handleResponse(code,message,data){ return _self.handleResponse(this,code,message,data) } } }) } twoFactorAuthentication(){ v.component("TwoFactorAuthentication",{ template:`
{{email}}
${_self.translate.t5}
${_self.translate.describe}

{{showErrorMassge}}

`, created(){ this.resetVerifyCode() }, mounted(){ this.isSendCode = true }, beforeDestroy() { clearInterval(this.countdownTwoAuthId) }, data(){ return { link : _self.link, email : _self.email, isManage : _self.pageData.isManage, verifycode : "", check_two_send_email_url :_self.pageData.check_two_send_email_url, two_send_email_url :_self.pageData.two_send_email_url, isSendCode : false, second : 60, showErrorMassge : "", countdownTwoAuthId: "", } }, methods:{ previousPage() { history.go(-1) }, //倒计时 countdownTwoAuth(){ this.countdownTwoAuthId = setInterval(() => { this.second -- if (this.second <= 0) { clearInterval(this.countdownTwoAuthId) this.isSendCode = false setTimeout(()=>{ $('.rest-verify').text(_self.translate.t41) },10) } $(".rest-sended").text(this.second) }, 1000) }, // 重发二次验证邮件验证码 resetVerifyCode(e){ if(e) e.stopPropagation() let _that = this this.countdownTwoAuth() this.isSendCode = true _self.sendRequestRestCode(this.two_send_email_url,{ type : _self.two_factor_send_email_code, email : _self.email, isManage : _that.isManage, },_that.handleResponse); }, handleSubmitVerifyCode(e){ if(e) e.stopPropagation() _self.verifycode = this.verifycode if(!this.subCheckVerifyCode(this.verifycode)) return this.$refs.verifycode.showError(_self.translate.t111) this.$refs.button.loading = true let _that = this try { //校验验证码 _self.sendRequestRestCode(this.check_two_send_email_url,{ type : _self.check_two_send_email_url, email : _self.email, verify : this.verifycode, isManage : _that.isManage, },_that.handleResponseSubmit); } catch (error) { this.showErrorMassge = error.message || ""; } }, handleResponse(code,message,data){ if (code != 200) { this.showErrorMassge = message } else { let url = data.location ? data.location : '' url = decodeURIComponent(url) if(url) w.location.href = url } }, handleResponseSubmit(code,message,data){ if (code != 200) { this.showErrorMassge = message } else { // 提交并登录 console.log(_self.two_factor_authentication_submit) console.log(_self.verifycode) console.log(_self.email) _self.sendRequest({ type : _self.two_factor_authentication_submit, verifycode : _self.verifycode, email : _self.email, lang : _self.lang, },this.handleResponse); } }, subCheckVerifyCode(verifycode){ let pattern = new RegExp("(^[0-9]{6}$)") if (pattern.test(verifycode)) return true this.inputValue = '' return false }, } }) } registeredForgotPassword(){ v.component("ForgotPassword",{ template:`
${_self.translate.t5}
${_self.translate.describe}
`, data(){ return { link : _self.link, email : '', isManage : _self.pageData.isManage, } }, methods:{ handleSubmit(e){ if(e) e.stopPropagation() if(!this.email) return this.$refs.email.showError(_self.translate.t113) if(!this.$refs.email.checkEmailFormat(this.email)) return this.$refs.email.showError(_self.translate.t111) this.$refs.button.loading = true let _that = this grecaptcha.ready(function() { grecaptcha.execute(_self.googleRecaptcheClientKey, {action: 'submit'}).then(function(token) { _self.sendRequest({ type : _self.name, email : _that.email, isManage : _that.isManage, token: token, },_that.handleResponse) }); }); }, handleResponse(code,message,data){ return _self.handleResponse(this,code,message,data) } } }) } registeredChangePassword(){ v.component("ChangePassword",{ template:`
${_self.translate.t5}
{{ t1 }}
`, data(){ return { link : _self.link, password1 : '', password2 : '', isManage : _self.pageData.isManage, t1 : _self.translate.t1, } }, watch: { password2() { this.$refs.password2.showError(null) } }, methods:{ handleSubmit(e){ if(e) e.stopPropagation() if(!this.password1) return this.$refs.newPassword.error = true if(!this.$refs.newPassword.cCheckNewPassword(this.password1)) return this.$refs.newPassword.error = true if(!this.password2) return this.$refs.password2.showError(_self.translate.t114) if(this.password1 !== this.password2) return this.$refs.password2.showError(_self.translate.t6) this.$refs.button.loading = true _self.sendRequest({ type : _self.name, password1 : this.password1, password2 : this.password2, isManage : this.isManage, encrypt : _self.pageData.encrypt, },this.handleResponse) }, handleResponse(code,message,data){ return _self.handleResponse(this,code,message,data) } } }) } registeredSentEmail(){ v.component("SentEmail",{ template:`
`, data(){ return { sendText : _self.pageData.sendText, } }, }) } registeredSentPassword(){ v.component("SentPassword",{ template:`
Reset Instructions
`, data(){ return { sendText : _self.pageData.sendText, } }, }) } registeredSignupInformation(){ v.component('vue-multiselect', w.VueMultiselect.default) v.component('vue-phone-number-input', w['vue-phone-number-input']); v.component("SignupInformation",{ template:`
No country found

{{ errorMessage }}
`, data(){ return { email : _self.email, errorMessage : null, company : '', website : '', mobile: '', optionCountry : _self.countryList, optionCountryValue: [], optionOrdersList : _self.ordersList, OrdersListValue : [], optionIndustry : _self.industryList, optionIndustryValue: [], translations: { countrySelectorLabel: null, phoneNumberLabel: _self.translate.t118, }, results: null, error: { Orders: false, Country: false, Industry: false }, } }, props: { defaultCountryCode: { type: String, }, clearable : { type : Boolean, default : true, }, showCodeOnList: { type: Boolean, default: true, }, }, watch: { optionCountryValue(val) { if(val) this.error.Country = false }, OrdersListValue(val) { if(val) this.error.Orders = false }, optionIndustryValue(val) { if(val) this.error.Industry = false }, }, created() { if (_self.translate.t2000) { this.optionCountryValue = {"name": _self.translate.t2000, "value": _self.translate.t2000} } }, methods:{ showError(message){ this.errorMessage = message }, setError(key, value = null) { this.error[key] = value return false }, handleData(data) { let dataArr = [] if(data.length > 0) { data.map((v) => { if(v) dataArr.push(v.value) }) } return dataArr.join(',') }, handleSubmit(e){ if(e) e.stopPropagation() if(!this.company) return this.$refs.company.showError(_self.translate.t315) if(!this.$refs.company.checkCompanyFormat(this.company)) return this.$refs.company.showError(_self.translate.t111) if(!this.optionCountryValue.length === 0) return this.setError('Country', _self.translate.t315) this.setError('Country') if(!this.website) return this.$refs.website.showError(_self.translate.t315) if(this.website.length > 100) return this.$refs.website.showError(_self.translate.t114) if(!this.$refs.website.checkWebsiteFormat(this.website)) return this.$refs.website.showError(_self.translate.t112) if(this.optionIndustryValue.length === 0) return this.setError('Industry', _self.translate.t116) this.setError('Industry') if(this.OrdersListValue.length === 0) return this.setError('Orders', _self.translate.t115) this.setError('Orders') let phoneCode = this.results ? (this.results.countryCallingCode != undefined ? this.results.countryCallingCode : '') : '' let nationalNumber = this.results ? (this.results.nationalNumber != undefined ? this.results.nationalNumber : '') : '' let phone = phoneCode + " " + nationalNumber if(this.mobile){ if(!phone){ return $('.mobileerrormsg').html(_self.translate.t314).show() } if(this.results.isValid == false) return $('.mobileerrormsg').html(_self.translate.t314).show() phone = "+" + phone } this.$refs.button.loading = true _self.sendRequest({ email: this.email, type: _self.name, company: this.company, country: this.handleData([this.optionCountryValue]), website: this.website, industry: this.handleData(this.optionIndustryValue), order_quantity: this.handleData([this.OrdersListValue]), phone: phone, encrypt: _self.pageData.encrypt, acticode: _self.pageData.acticode, auth_source: _self.translate.t_source, },this.handleResponse) }, handleResponse(code,message,data){ return _self.handleResponse(this,code,message,data) } } }) } registeredNameInputStyle(){ v.component("NameInputStyle",{ template:` {{ error }} `, props : { type : { type : String, default : 'text', }, placeholder : String, name : { type : String, default : '', }, showPass : { type : Boolean, default : false, }, disabled : { type : Boolean, default : false, }, value : { type : String | Number, default : '', }, optional : { type : Boolean, default : false, }, autocomplete : { type : String, default : 'on', }, }, data(){ return { error : null, inputValue : this.value, inputType : this.type, } }, methods:{ showError(message){ this.error = message }, changeType(){ this.inputType = 'text' }, inputBlur(){ this.inputValue = this.inputValue.trim() return this.checkValue(this.inputValue,false) }, checkValue(value,bool){ if(!value) return this.showError(null) switch(this.name){ case 'firstname' : if(this.checkFirstnameFormat(value)) return this.showError(null) return bool ? false : this.showError(_self.translate.t117) break case 'lastname' : if(this.checkLastnameFormat(value)) return this.showError(null) return bool ? false : this.showError(_self.translate.t118) break } }, checkFirstnameFormat(username){ return username.length >= 1 && username.length <= 32 }, checkLastnameFormat(username){ return username.length >= 1 && username.length <= 32 }, }, watch:{ inputValue(value,oldValue){ this.checkValue(value,true) this.$emit('changeValue', value) if(this.$listeners['change']) return this.$emit('change', value, oldValue) return false; } }, model:{ prop: 'value', event: 'changeValue', } }) } registeredSentEmailCode(){ v.component("SentEmailCode",{ template:`
{{email}}
`, data(){ return { title : _self.pageData.translate.t1, sendText : _self.pageData.sendText, verifycode : '', email : _self.email, } }, methods:{ previousPage() { history.go(-1) }, handleSubmit(e, s){ if(e) e.stopPropagation() if(s) return this.handleConfirm() if(!this.email) return this.$refs.email.showError(_self.translate.t112) if(!this.$refs.verifycode.subCheckVerifyCode(this.verifycode)) return this.$refs.verifycode.showError(_self.translate.t111) this.$refs.button.loading = true _self.sendRequest({ type : _self.name, email : this.email, verifycode : this.verifycode, },this.handleResponse) }, handleResponse(code,message,data){ this.verifycode = '' return _self.handleResponse(this,code,message,data) } } }) } registeredVerifyCodeInputBtnStyle(){ v.component("VerifyCodeInputBtnStyle",{ template:`
${_self.translate.t211} {{second}} S
{{ error }}
`, props : { type : { type : String, default : 'text', }, placeholder : String, name : { type : String, default : '', }, disabled : { type : Boolean, default : false, }, value : { type : String | Number, default : '', }, optional : { type : Boolean, default : false, }, autocomplete : { type : String, default : 'on', }, }, data(){ return { error : null, inputValue : this.value, isSendCode : false, second : 60, email : _self.email, } }, mounted(){ this.isSendCode = true this.handleCodeRespone(200) }, methods:{ showError(message){ this.error = message }, checkValue(value,bool){ // if(!value) return this.showError(null) switch(this.name){ case 'verifycode' : if(this.checkVerifyCode(value)) return this.showError(null) return bool ? false : this.showError(_self.translate.t111) break } }, checkVerifyCode(verifycode){ let pattern = new RegExp("(^[0-9]{6}$)") if (pattern.test(verifycode)) return true return false }, subCheckVerifyCode(verifycode){ let pattern = new RegExp("(^[0-9]{6}$)") if (pattern.test(verifycode)) return true this.inputValue = '' return false }, getVerifycode(e){ if(e) e.stopPropagation() if(!this.email) return this.$refs.email.showError(_self.translate.t112) this.isSendCode = true _self.sendRequest({ type : 'get-verify-code', name : _self.name, email : this.email, }, this.handleCodeRespone) }, handleCodeRespone(code, message, data){ if (code !== 200) { this.isSendCode = false return this.showError(message) } const st = setInterval(() => { this.second -- if (this.second <= 0) { clearInterval(st) this.isSendCode = false this.second = 60 setTimeout(()=>{ $('.input-link-verify').text(_self.translate.t211) },10) } $(".verify-sended>.verify-sended-time").text(this.second) }, 1000) }, cleanCode(){ this.inputValue = '' } }, watch:{ inputValue(value,oldValue){ this.checkValue(value,true) this.$emit('changeValue', value) if(this.$listeners['change']) return this.$emit('change', value, oldValue) return false; }, value(value){ if(value === '') this.cleanCode() } }, model:{ prop: 'value', event: 'changeValue', } }) } registeredSetAccountRole(){ v.component("SetAccountRole",{ template:`

{{ item.name }}

{{ item.describe }}

`, data(){ return { title : _self.pageData.translate.t1, sub_title : _self.pageData.translate.t2, email : _self.email, errorMessage : '', roleList : _self.pageData.role_list, } }, methods:{ showError(message){ this.errorMessage = message }, confirmRole(e){ this.errorMessage = '' if(!this.email) return this.$refs.email.showError(_self.translate.t112) _self.sendRequest({ type : _self.name, email : this.email, role_type : e, }, this.handleRespone) }, handleRespone(code, message, data){ if (code !== 200) { return this.showError(message) } let url = data.location ? data.location : '' url = decodeURIComponent(url) if(url) w.location.href = url }, } }) } registeredRoleTableTitle(){ v.component("RoleTableTitle",{ template:`
`, props:{ title : { type : String, default : '', }, }, }) } registeredWriteRoleInfo(){ v.component('vue-phone-number-input', w['vue-phone-number-input']); v.component("WriteRoleInfo",{ template:`
I'm a ${_self.pageData.role_name}
What is the monthly order quantity of your store?

{{item.name}}

{{ errorMessage }}
`, data(){ return { t2: _self.translate.t2, t3: _self.translate.t3, t4: _self.translate.t4, t5: _self.translate.t5, t6: _self.translate.t6, t7: _self.translate.t7, email : _self.email, roleType : _self.pageData.role_type, errorMessage: '', platformsList: _self.pageData.platforms, orderNumList: _self.pageData.order_quantity, bussinessList: _self.pageData.bussiness, company_name: '', website: '', mobile: '', results: null, bussinessValue: 0, orderQuantityValue: '', rSelect: [], } }, props:{ clearable : { type : Boolean, default : true, }, title : { type : String, default : '', }, defaultCountryCode: { type: String, default: 'US', }, showCodeOnList: { type: Boolean, default: true, }, }, methods:{ showError(message){ this.errorMessage = message }, checkedBox(e) { if (this.rSelect.indexOf(e) !== -1) { this.rSelect.splice(this.rSelect.indexOf(e), 1); } else { this.rSelect.push(e); } }, checkWebsiteFormat(website){ if(this.optional && !website) return true return /[0-9a-z-_]+\.[0-9a-z-_]+/i.test(website) }, handleSubmit(e){ this.errorMessage = '' if(e) e.stopPropagation() $('.ordererrormsg,.platformserrormsg,.bussinesserrormsg,.mobileerrormsg').hide(); switch (this.roleType){ case 1: if(this.rSelect.length <= 0) return $('.platformserrormsg').html(_self.translate.t316).show() break case 2: if(!this.orderQuantityValue) return $('.ordererrormsg').html(_self.translate.t312).show() if(this.rSelect.length <= 0) return $('.platformserrormsg').html(_self.translate.t311).show() if(this.website && this.website.length > 100) return this.$refs.website.showError(_self.translate.t315) break case 3: if(!this.bussinessValue) return $('.bussinesserrormsg').html(_self.translate.t313).show() break default: return this.showError(_self.translate.t310) break } let phoneCode = this.results ? (this.results.countryCallingCode != undefined ? this.results.countryCallingCode : '') : ''; let nationalNumber = this.results ? (this.results.nationalNumber != undefined ? this.results.nationalNumber : '') : ''; let phone = phoneCode + " " + nationalNumber if(this.mobile){ if(!phone){ return $('.mobileerrormsg').html(_self.translate.t314).show() } if(this.results.isValid == false) return $('.mobileerrormsg').html(_self.translate.t314).show() phone = "+" + phone } this.$refs.button.loading = true _self.sendRequest({ type : _self.name, email : this.email, acticode : _self.pageData.acticode, phone : phone, role_type : this.roleType, order_quantity : this.orderQuantityValue, bussiness : this.bussinessValue, platforms : this.rSelect ? this.rSelect.toString() : "", company : this.company_name, website : this.website, },this.handleResponse) }, handleResponse(code,message,data){ return _self.handleResponse(this,code,message,data) } } }) } registeredThirdAuth(){ v.component("ThirdAuth",{ template:`
${_self.translate.auth_type_name}
{{email}}
convert
tm-logo
{{email}}
We've sent a 6-character code to
{{email}}
Please enter it below to verify your identity.
Didn't receive it? Check your spam folder, or resend email.
{{ errorMessage }}
`, data(){ return { errorMessage : '', email : _self.email, verifycode : '', loading : false, } }, created(){ this.sendAuthCode(true) }, methods:{ showError(message){ this.errorMessage = message }, subCheckVerifyCode(verifycode){ let pattern = new RegExp("(^[0-9]{6}$)") if (pattern.test(verifycode)) return true this.verifycode = '' return false }, sendAuthCode(hideTip = false){ _self.sendRequest({ type : 'auth-send-code', email : this.email, }, (code, message, data) => { if (!hideTip) { return UIkit.notification({message: message , pos: 'top-center',timeout: 3000}) } }) }, handleSubmit(e){ this.errorMessage = '' if(e) e.stopPropagation() if(!this.subCheckVerifyCode(this.verifycode)) return this.$refs.verifycode.showError(_self.translate.t111) this.$refs.button.loading = true _self.sendRequest({ type : _self.name, email : this.email, auth_type : _self.translate.auth_type_name, verifycode : this.verifycode, },this.handleResponse) }, handleResponse(code,message,data){ return _self.handleResponse(this,code,message,data) } } }) } sendRequestRestCode(url, data,callback){ if(_self.loading) return false _self.loading = true q.ajax({ url : url, type : 'post', data : data, success : function(r){ _self.loading = false let result = r if (typeof r == "string") { result = JSON.parse(r) } let code = result.code ? parseInt(result.code) : 0 let message = result.message ? result.message : 0 console.log(result) try{ let data = result.data ? result.data : {} if(callback) callback(code,message,data) }catch(e){ if(callback) callback(code,message,{}) } } }) } sendRequest(data,callback){ if(_self.loading) return false _self.loading = true q.ajax({ url : this.api, type : 'post', data : data, success : function(r){ _self.loading = false let result = r if (typeof r == "string") { result = JSON.parse(r) } let code = result.code ? parseInt(result.code) : 0 let message = result.message ? result.message : 0 try{ let data = result.data ? result.data : {} if(callback) callback(code,message,data) }catch(e){ if(callback) callback(code,message,{}) } } }) } handleResponse(_this,code,message,data){ _this.$refs.button.loading = false try{ if(code !== 200) { if(code === 302){ let url = data.location ? data.location : '' url = decodeURIComponent(url) let time = data.time ? data.time : 0 if(url) time > 0 ? setTimeout(() => { w.location.href = url },time) : w.location.href = url } let name = data.name ? data.name : '' if(!name || !_this.$refs[name] || !_this.$refs[name].showError){ switch (name) { case 'Orders': { return _this.error.Orders = message } case 'Country': { return _this.error.Country = message } case 'Industry': { return _this.error.Industry = message } default: { return _this.showError(message) } } } return _this.$refs[name].showError(message) } _this.$parent.showLoading(true) let url = data.location ? data.location : '' url = decodeURIComponent(url) let time = data.time ? data.time : 0 if(url) time > 0 ? setTimeout(() => { w.location.href = url },time) : w.location.href = url }catch(e){ return e } } } let ln = new Login() }) }(Vue,window,document,$,{}))