talent/tmpl/profile.html

89 lines
2.6 KiB
HTML

<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>修改基本資料</title>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bulma@0.9.3/css/bulma.min.css">
</head>
<body>
<section class="hero is-fullheight" style="background-color:#d70c18;" id="loader">
<div class="hero-body">
<div class="container">
<h1 class="has-text-white has-text-weight-bold has-text-centered is-size-2">身分檢核中</h1>
<br>
<progress class="progress is-large is-info" max="100">60%</progress>
</div>
</div>
</section>
<div id="err" class="notification is-danger is-light is-hidden"
style="position: absolute;width: 100%;">
<button class="delete" onclick="close()"></button>
電子郵件地址格式錯誤
</div>
<section class="hero is-danger is-fullheight is-hidden"
style="background-color:#d70c18;" id="form">
<div class="hero-body">
<div class="container">
<div class="field">
<label class="label has-text-white">Email</label>
<div class="control">
<input id="email" class="input is-danger" type="email" placeholder="請輸入電子郵件">
</div>
</div>
<div class="buttons is-right">
<button id="save" class="button" onclick="save()">送出</button>
</div>
</div>
</div>
</section>
</body>
<script>
setTimeout(function(){
let loader = document.getElementById('loader');
loader.classList.add("is-hidden")
let form = document.getElementById('form');
form.classList.remove("is-hidden")
},3000)
function save(){
let btn = document.getElementById('save');
btn.classList.add("is-loading")
let el = document.getElementById('email');
// get uid
let parts = window.location.href.split('/');
let uid = parts.pop() || parts.pop();
fetch("/api/email", {
method: 'POST',
body: JSON.stringify({id: uid,email: el.value}),
headers: new Headers({
'Content-Type': 'application/json'
})
})
.then(function(res){
if (res.status != 200){
let err = document.getElementById('err');
err.classList.remove("is-hidden")
} else {
setTimeout(function(){
window.location = "https://line.me/R/oaMessage/@565zednv/?"
},500)
}
})
.catch(function(){})
.finally(function() {
btn.classList.remove("is-loading")
})
}
function close(){
let err = document.getElementById('err');
err.classList.add("is-hidden")
}
</script>
</html>