vela-h5-sdk 0.0.21 → 0.0.23
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -6981,14 +6981,14 @@ var $ = class extends Ne {
|
|
|
6981
6981
|
<div class="field-group">
|
|
6982
6982
|
<label class="input-label" for="reg-passcode">Old Password:</label>
|
|
6983
6983
|
<input class="pwd input-underline" id="reg-passcode" type="password" placeholder="กรุณากรอกรหัสผ่าน"
|
|
6984
|
-
.value="${this.reset_password}" @input="${(e) => this.
|
|
6984
|
+
.value="${this.reset_password}" @input="${(e) => this.reset_password = e.target.value}">
|
|
6985
6985
|
</div>
|
|
6986
6986
|
<div class="input-line"></div>
|
|
6987
6987
|
|
|
6988
6988
|
<div class="field-group">
|
|
6989
6989
|
<label class="input-label" for="reg-passcode">New Password:</label>
|
|
6990
6990
|
<input class="pwd input-underline" id="reg-passcode" type="password" placeholder="กรุณากรอกรหัสผ่าน"
|
|
6991
|
-
.value="${this.reset_new_password}" @input="${(e) => this.
|
|
6991
|
+
.value="${this.reset_new_password}" @input="${(e) => this.reset_new_password = e.target.value}">
|
|
6992
6992
|
</div>
|
|
6993
6993
|
<div class="input-line"></div>
|
|
6994
6994
|
|
|
@@ -6996,7 +6996,7 @@ var $ = class extends Ne {
|
|
|
6996
6996
|
<div class="field-group">
|
|
6997
6997
|
<label class="input-label" for="confirm-passcode">Confirm New Password:</label>
|
|
6998
6998
|
<input class="pwd input-underline" id="confirm-passcode" type="password" placeholder="กรุณากรอกรหัสผ่านอีกครั้ง"
|
|
6999
|
-
.value="${this.reset_new_confirm_password}" @input="${(e) => this.
|
|
6999
|
+
.value="${this.reset_new_confirm_password}" @input="${(e) => this.reset_new_confirm_password = e.target.value}">
|
|
7000
7000
|
</div>
|
|
7001
7001
|
<div class="input-line"></div>
|
|
7002
7002
|
|
|
@@ -7178,7 +7178,7 @@ var $ = class extends Ne {
|
|
|
7178
7178
|
this._isLoading = !1, console.log("退出登录");
|
|
7179
7179
|
}
|
|
7180
7180
|
async handleResetPasswordSubmit(e) {
|
|
7181
|
-
if (e.preventDefault(), this.reset_new_password !== this.reset_new_confirm_password) {
|
|
7181
|
+
if (e.preventDefault(), console.log("执行重置密码...", this.reset_password, this.reset_new_password), this.reset_new_password !== this.reset_new_confirm_password) {
|
|
7182
7182
|
alert("รหัสผ่านไม่ตรงกัน (两次输入的密码不一致)");
|
|
7183
7183
|
return;
|
|
7184
7184
|
}
|
|
@@ -7188,7 +7188,6 @@ var $ = class extends Ne {
|
|
|
7188
7188
|
}
|
|
7189
7189
|
this._isLoading = !0;
|
|
7190
7190
|
let t = fa.default.MD5(this.reset_password).toString(), n = fa.default.MD5(this.reset_new_password).toString();
|
|
7191
|
-
console.log("执行重置密码...", this.reset_password, this.reset_new_password);
|
|
7192
7191
|
try {
|
|
7193
7192
|
let e = await Z.request.post(Z.urls.url_web_reset_password, {
|
|
7194
7193
|
app_id: this.appId,
|
|
@@ -523,14 +523,14 @@
|
|
|
523
523
|
<div class="field-group">
|
|
524
524
|
<label class="input-label" for="reg-passcode">Old Password:</label>
|
|
525
525
|
<input class="pwd input-underline" id="reg-passcode" type="password" placeholder="กรุณากรอกรหัสผ่าน"
|
|
526
|
-
.value="${this.reset_password}" @input="${e=>this.
|
|
526
|
+
.value="${this.reset_password}" @input="${e=>this.reset_password=e.target.value}">
|
|
527
527
|
</div>
|
|
528
528
|
<div class="input-line"></div>
|
|
529
529
|
|
|
530
530
|
<div class="field-group">
|
|
531
531
|
<label class="input-label" for="reg-passcode">New Password:</label>
|
|
532
532
|
<input class="pwd input-underline" id="reg-passcode" type="password" placeholder="กรุณากรอกรหัสผ่าน"
|
|
533
|
-
.value="${this.reset_new_password}" @input="${e=>this.
|
|
533
|
+
.value="${this.reset_new_password}" @input="${e=>this.reset_new_password=e.target.value}">
|
|
534
534
|
</div>
|
|
535
535
|
<div class="input-line"></div>
|
|
536
536
|
|
|
@@ -538,7 +538,7 @@
|
|
|
538
538
|
<div class="field-group">
|
|
539
539
|
<label class="input-label" for="confirm-passcode">Confirm New Password:</label>
|
|
540
540
|
<input class="pwd input-underline" id="confirm-passcode" type="password" placeholder="กรุณากรอกรหัสผ่านอีกครั้ง"
|
|
541
|
-
.value="${this.reset_new_confirm_password}" @input="${e=>this.
|
|
541
|
+
.value="${this.reset_new_confirm_password}" @input="${e=>this.reset_new_confirm_password=e.target.value}">
|
|
542
542
|
</div>
|
|
543
543
|
<div class="input-line"></div>
|
|
544
544
|
|
|
@@ -587,4 +587,4 @@
|
|
|
587
587
|
</div>
|
|
588
588
|
<div class="input-line"></div>
|
|
589
589
|
</div>
|
|
590
|
-
`}loadAppleSDK(){let e=document.createElement(`script`);e.src=`https://appleid.cdn-apple.com/appleauth/static/jsapi/appleid/1/en_US/appleid.auth.js`,e.onload=()=>{window.AppleID.auth.init({clientId:this.appleClientId,scope:this.appleScope,redirectURI:this.appleRedirectURI,state:this.appleState,nonce:this.appleNonce,usePopup:this.appleUsePopup}),document.addEventListener(`AppleIDSignInOnSuccess`,e=>{let t=e.detail.authorization.id_token;this.handleThirdLogin(`3`,t)}),document.addEventListener(`AppleIDSignInOnFailure`,e=>{console.error(e.detail.error)})},document.head.appendChild(e)}handleAppleClick(){window.AppleID.auth.signIn()}loadGoogleSDK(){let e=document.createElement(`script`);e.src=`https://accounts.google.com/gsi/client`,e.async=!0,e.onload=()=>{window.handleGoogleSignIn=e=>{console.log(`Google JWT: `,e.credential),this.handleThirdLogin(`2`,e.credential)}},document.head.appendChild(e)}loadFacebookSDK(){let e=document.createElement(`script`);e.src=`https://connect.facebook.net/en_US/sdk.js`,e.async=!0,e.defer=!0,e.crossOrigin=`anonymous`,e.onload=()=>{window.FB.init({appId:this.facebookAppId,cookie:!0,xfbml:!0,version:`v20.0`})},document.head.appendChild(e)}handleFacebookClick(){if(!window.FB){console.warn(`Facebook SDK not loaded`);return}window.FB.getLoginStatus(e=>{e.authResponse?this.handleThirdLogin(`1`,e.authResponse.userID):window.FB.login(e=>{e.authResponse?this.handleThirdLogin(`1`,e.authResponse.userID):console.log(`Facebook login cancelled`)},{scope:`public_profile`})})}handleLoginResult(e){console.log(`SDK接收到的数据类型是:`,typeof e,e),e.code===0?(this.dispatchEvent(new CustomEvent(`vela-login-out`,{detail:[]})),setTimeout(()=>{this.dispatchEvent(new CustomEvent(`vela-login-success`,{detail:e.data})),this.uid=e.data.uid,this.visible=!1},1e3)):alert(e.msg)}handleLoginOutResult(e){console.log(`SDK接收到的数据类型是:`,typeof e,e),e.code===0?(this.dispatchEvent(new CustomEvent(`vela-login-out`,{detail:e.data})),this.uid=``,this.switchToLogin()):alert(e.msg)}handleResetPasswordResult(e){console.log(`SDK接收到的数据类型是:`,typeof e,e),e.code===0||alert(e.msg)}handleBindWaysResult(e){console.log(`SDK接收到的数据类型是:`,typeof e,e),e.code===0||alert(e.msg)}async handleAccountLoginSubmit(e){if(e.preventDefault(),!this.accountName||!this.passcode){alert(`账号和密码不能为空!`);return}this._isLoading=!0;let t=fa.default.MD5(this.accountName).toString(),n=fa.default.MD5(this.passcode).toString();console.log(`执行登录...`,this.accountName,this.passcode);try{let e=await Z.request.post(Z.urls.url_web_account_login,{app_id:this.appId,channel_id:this.channelId,name:t,name2:this.accountName,password:n,password2:this.passcode,type:3});this.handleLoginResult(e)}catch(e){console.error(e)}this._isLoading=!1}async handleAccountRegisterSubmit(e){if(e.preventDefault(),this.passcode!==this.confirmPasscode){alert(`รหัสผ่านไม่ตรงกัน (两次输入的密码不一致)`);return}if(!this.accountName||!this.passcode){alert(`账号和密码不能为空!`);return}this._isLoading=!0;let t=fa.default.MD5(this.accountName).toString(),n=fa.default.MD5(this.passcode).toString();console.log(`执行注册...`,this.accountName,this.passcode);try{let e=await Z.request.post(Z.urls.url_web_account_login,{app_id:this.appId,channel_id:this.channelId,name:t,name2:this.accountName,password:n,password2:this.passcode,type:1});this.handleLoginResult(e)}catch(e){console.error(e)}this._isLoading=!1}async handleLogoutClick(e){e.preventDefault(),this._isLoading=!0,console.log(`执行退出登录...`);try{let e=await Z.request.post(Z.urls.url_web_login_out,{});this.handleLoginOutResult(e)}catch(e){console.error(e)}this._isLoading=!1,console.log(`退出登录`)}async handleResetPasswordSubmit(e){if(e.preventDefault(),this.reset_new_password!==this.reset_new_confirm_password){alert(`รหัสผ่านไม่ตรงกัน (两次输入的密码不一致)`);return}if(!this.reset_password||!this.reset_new_password){alert(`密码不能为空!`);return}this._isLoading=!0;let t=fa.default.MD5(this.reset_password).toString(),n=fa.default.MD5(this.reset_new_password).toString();
|
|
590
|
+
`}loadAppleSDK(){let e=document.createElement(`script`);e.src=`https://appleid.cdn-apple.com/appleauth/static/jsapi/appleid/1/en_US/appleid.auth.js`,e.onload=()=>{window.AppleID.auth.init({clientId:this.appleClientId,scope:this.appleScope,redirectURI:this.appleRedirectURI,state:this.appleState,nonce:this.appleNonce,usePopup:this.appleUsePopup}),document.addEventListener(`AppleIDSignInOnSuccess`,e=>{let t=e.detail.authorization.id_token;this.handleThirdLogin(`3`,t)}),document.addEventListener(`AppleIDSignInOnFailure`,e=>{console.error(e.detail.error)})},document.head.appendChild(e)}handleAppleClick(){window.AppleID.auth.signIn()}loadGoogleSDK(){let e=document.createElement(`script`);e.src=`https://accounts.google.com/gsi/client`,e.async=!0,e.onload=()=>{window.handleGoogleSignIn=e=>{console.log(`Google JWT: `,e.credential),this.handleThirdLogin(`2`,e.credential)}},document.head.appendChild(e)}loadFacebookSDK(){let e=document.createElement(`script`);e.src=`https://connect.facebook.net/en_US/sdk.js`,e.async=!0,e.defer=!0,e.crossOrigin=`anonymous`,e.onload=()=>{window.FB.init({appId:this.facebookAppId,cookie:!0,xfbml:!0,version:`v20.0`})},document.head.appendChild(e)}handleFacebookClick(){if(!window.FB){console.warn(`Facebook SDK not loaded`);return}window.FB.getLoginStatus(e=>{e.authResponse?this.handleThirdLogin(`1`,e.authResponse.userID):window.FB.login(e=>{e.authResponse?this.handleThirdLogin(`1`,e.authResponse.userID):console.log(`Facebook login cancelled`)},{scope:`public_profile`})})}handleLoginResult(e){console.log(`SDK接收到的数据类型是:`,typeof e,e),e.code===0?(this.dispatchEvent(new CustomEvent(`vela-login-out`,{detail:[]})),setTimeout(()=>{this.dispatchEvent(new CustomEvent(`vela-login-success`,{detail:e.data})),this.uid=e.data.uid,this.visible=!1},1e3)):alert(e.msg)}handleLoginOutResult(e){console.log(`SDK接收到的数据类型是:`,typeof e,e),e.code===0?(this.dispatchEvent(new CustomEvent(`vela-login-out`,{detail:e.data})),this.uid=``,this.switchToLogin()):alert(e.msg)}handleResetPasswordResult(e){console.log(`SDK接收到的数据类型是:`,typeof e,e),e.code===0||alert(e.msg)}handleBindWaysResult(e){console.log(`SDK接收到的数据类型是:`,typeof e,e),e.code===0||alert(e.msg)}async handleAccountLoginSubmit(e){if(e.preventDefault(),!this.accountName||!this.passcode){alert(`账号和密码不能为空!`);return}this._isLoading=!0;let t=fa.default.MD5(this.accountName).toString(),n=fa.default.MD5(this.passcode).toString();console.log(`执行登录...`,this.accountName,this.passcode);try{let e=await Z.request.post(Z.urls.url_web_account_login,{app_id:this.appId,channel_id:this.channelId,name:t,name2:this.accountName,password:n,password2:this.passcode,type:3});this.handleLoginResult(e)}catch(e){console.error(e)}this._isLoading=!1}async handleAccountRegisterSubmit(e){if(e.preventDefault(),this.passcode!==this.confirmPasscode){alert(`รหัสผ่านไม่ตรงกัน (两次输入的密码不一致)`);return}if(!this.accountName||!this.passcode){alert(`账号和密码不能为空!`);return}this._isLoading=!0;let t=fa.default.MD5(this.accountName).toString(),n=fa.default.MD5(this.passcode).toString();console.log(`执行注册...`,this.accountName,this.passcode);try{let e=await Z.request.post(Z.urls.url_web_account_login,{app_id:this.appId,channel_id:this.channelId,name:t,name2:this.accountName,password:n,password2:this.passcode,type:1});this.handleLoginResult(e)}catch(e){console.error(e)}this._isLoading=!1}async handleLogoutClick(e){e.preventDefault(),this._isLoading=!0,console.log(`执行退出登录...`);try{let e=await Z.request.post(Z.urls.url_web_login_out,{});this.handleLoginOutResult(e)}catch(e){console.error(e)}this._isLoading=!1,console.log(`退出登录`)}async handleResetPasswordSubmit(e){if(e.preventDefault(),console.log(`执行重置密码...`,this.reset_password,this.reset_new_password),this.reset_new_password!==this.reset_new_confirm_password){alert(`รหัสผ่านไม่ตรงกัน (两次输入的密码不一致)`);return}if(!this.reset_password||!this.reset_new_password){alert(`密码不能为空!`);return}this._isLoading=!0;let t=fa.default.MD5(this.reset_password).toString(),n=fa.default.MD5(this.reset_new_password).toString();try{let e=await Z.request.post(Z.urls.url_web_reset_password,{app_id:this.appId,old_password:t,password:n});this.handleResetPasswordResult(e)}catch(e){console.error(e)}this._isLoading=!1}async fetchBindWays(){this._isLoading=!0;try{let e=await Z.request.post(Z.urls.url_web_bind_ways,{app_id:this.appId});this.handleBindWaysResult(e)}catch(e){console.error(e)}this._isLoading=!1}async handleUnbind(e){if(e===`Account`)this.switchToBindingResetPassword();else if(confirm(`您確定要解綁 ${e} 帳戶嗎?`))try{this._isLoading=!0,console.log(`正在請求解綁: ${e}`);let t=await Z.request.post(Z.urls.url_web_unbind,{app_id:this.appId,type:e});this.handleBindWaysResult(t),alert(`${e} 帳戶解綁成功!`)}catch(e){console.error(e),alert(`操作失敗,請稍後再試`)}finally{this._isLoading=!1}}async handleThirdLogin(e,t){console.log(`执行三方登录...`,this.accountName,this.passcode);try{let n=await Z.request.post(Z.urls.url_web_third_login,{app_id:this.appId,type:e,open_id:t});alert(`สมัครสมาชิกสำเร็จ! (注册成功)`),this.handleLoginResult(n)}catch(e){console.error(e)}}async handleThirdBind(e,t){console.log(`执行三方登录...`,this.accountName,this.passcode);try{let n=await Z.request.post(Z.urls.url_web_third_bind,{app_id:this.appId,type:e,open_id:t});alert(`สมัครสมาชิกสำเร็จ! (注册成功)`),this.handleLoginResult(n)}catch(e){console.error(e)}}};Q([Re({type:Boolean,reflect:!0})],$.prototype,`visible`,void 0),Q([Re({type:String})],$.prototype,`appId`,void 0),Q([Re({type:String})],$.prototype,`channelId`,void 0),Q([Re({type:String})],$.prototype,`uid`,void 0),Q([Re({type:String,attribute:`apple-client-id`})],$.prototype,`appleClientId`,void 0),Q([Re({type:String,attribute:`apple-scope`})],$.prototype,`appleScope`,void 0),Q([Re({type:String,attribute:`apple-state`})],$.prototype,`appleState`,void 0),Q([Re({type:String,attribute:`apple-nonce`})],$.prototype,`appleNonce`,void 0),Q([Re({type:Boolean,attribute:`apple-use-popup`})],$.prototype,`appleUsePopup`,void 0),Q([Re({type:String,attribute:`apple-redirect-uri`})],$.prototype,`appleRedirectURI`,void 0),Q([Re({type:String,attribute:`facebook-app-id`})],$.prototype,`facebookAppId`,void 0),Q([Re({type:String,attribute:`view-mode`})],$.prototype,`currentView`,void 0),Q([ze()],$.prototype,`_isLoading`,void 0),Q([ze()],$.prototype,`accountName`,void 0),Q([ze()],$.prototype,`passcode`,void 0),Q([ze()],$.prototype,`confirmPasscode`,void 0),Q([ze()],$.prototype,`reset_password`,void 0),Q([ze()],$.prototype,`reset_new_password`,void 0),Q([ze()],$.prototype,`reset_new_confirm_password`,void 0),$=Q([Fe(`vela-login`)],$),Object.defineProperty(e,"VelaLogin",{enumerable:!0,get:function(){return $}})});
|