|
|
@ -8,44 +8,56 @@ function isValidMobile(p) {
|
|
|
|
|
|
|
|
|
|
|
|
document.addEventListener('DOMContentLoaded', function () {
|
|
|
|
document.addEventListener('DOMContentLoaded', function () {
|
|
|
|
document.querySelector('#send-auth-code')?.addEventListener('click', async function () {
|
|
|
|
document.querySelector('#send-auth-code')?.addEventListener('click', async function () {
|
|
|
|
let url = this.getAttribute('data-route');
|
|
|
|
try {
|
|
|
|
let tel = document.querySelector('#tel').value;
|
|
|
|
let url = this.getAttribute('data-route');
|
|
|
|
if (tel.length < 11 || !isValidMobile(tel)){
|
|
|
|
let tel = document.querySelector('#tel').value;
|
|
|
|
window.$toast.error('Invalid mobile');
|
|
|
|
if (tel.length < 11 || !isValidMobile(tel)) {
|
|
|
|
return;
|
|
|
|
window.$toast.error('Invalid mobile');
|
|
|
|
}
|
|
|
|
return;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
let resp = await axios.get(url+'?tel='+tel);
|
|
|
|
let resp = await axios.get(url + '?tel=' + tel);
|
|
|
|
if (resp.data.OK){
|
|
|
|
if (resp.data.OK) {
|
|
|
|
window.$toast.success(resp.data.message);
|
|
|
|
window.$toast.success(resp.data.message);
|
|
|
|
document.querySelector('#tel').setAttribute('readonly','');
|
|
|
|
document.querySelector('#tel').setAttribute('readonly', '');
|
|
|
|
document.querySelector('.not-send').style.display = 'block';
|
|
|
|
document.querySelector('.not-send').style.display = 'block';
|
|
|
|
document.querySelector('.sent').style.display = 'none';
|
|
|
|
document.querySelector('.sent').style.display = 'none';
|
|
|
|
}else{
|
|
|
|
} else {
|
|
|
|
window.$toast.error(resp.data.message);
|
|
|
|
window.$toast.error(resp.data.message);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
} catch (e) {
|
|
|
|
|
|
|
|
window.$toast.error(e.message);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
});
|
|
|
|
});
|
|
|
|
document.querySelector('#send-auth-check')?.addEventListener('click', async function () {
|
|
|
|
document.querySelector('#send-auth-check')?.addEventListener('click', async function () {
|
|
|
|
let url = this.getAttribute('data-route');
|
|
|
|
try {
|
|
|
|
let tel = document.querySelector('#tel').value;
|
|
|
|
|
|
|
|
let code = document.querySelector('#auth').value;
|
|
|
|
|
|
|
|
if (tel.length < 11 || !isValidMobile(tel)){
|
|
|
|
let url = this.getAttribute('data-route');
|
|
|
|
window.$toast.error('Invalid mobile');
|
|
|
|
let tel = document.querySelector('#tel').value;
|
|
|
|
return;
|
|
|
|
let code = document.querySelector('#auth').value;
|
|
|
|
}
|
|
|
|
if (tel.length < 11 || !isValidMobile(tel)) {
|
|
|
|
if (code.length != 5 ){
|
|
|
|
window.$toast.error('Invalid mobile');
|
|
|
|
window.$toast.error('Invalid code');
|
|
|
|
return;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (code.length != 5) {
|
|
|
|
|
|
|
|
window.$toast.error('Invalid code');
|
|
|
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
let resp = await axios.get(url + '?tel=' + tel + '&code=' + code);
|
|
|
|
|
|
|
|
if (resp.data.OK) {
|
|
|
|
|
|
|
|
window.$toast.success(resp.data.message);
|
|
|
|
|
|
|
|
setTimeout(() => {
|
|
|
|
|
|
|
|
window.location.href = this.getAttribute('data-profile');
|
|
|
|
|
|
|
|
}, 5000);
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
window.$toast.error(resp.data.message);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
} catch (e) {
|
|
|
|
|
|
|
|
window.$toast.error(e.message);
|
|
|
|
|
|
|
|
|
|
|
|
let resp = await axios.get(url+'?tel='+tel+'&code='+code);
|
|
|
|
|
|
|
|
if (resp.data.OK){
|
|
|
|
|
|
|
|
window.$toast.success(resp.data.message);
|
|
|
|
|
|
|
|
setTimeout( () => {
|
|
|
|
|
|
|
|
window.location.href = this.getAttribute('data-profile');
|
|
|
|
|
|
|
|
},5000);
|
|
|
|
|
|
|
|
}else{
|
|
|
|
|
|
|
|
window.$toast.error(resp.data.message);
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|
|
|
|