|
@@ -11,30 +11,41 @@
|
|
|
|
|
|
<div class="form-item">
|
|
|
<img
|
|
|
- class=""
|
|
|
+ :class="{
|
|
|
+ animate__animated: ifTipUserName,
|
|
|
+ animate__headShake: ifTipUserName
|
|
|
+ }"
|
|
|
src="@/assets/images/username-icon.png"
|
|
|
alt=""
|
|
|
draggable="false"
|
|
|
>
|
|
|
<input
|
|
|
+ v-model.trim="userName"
|
|
|
type="text"
|
|
|
placeholder="请输入账号..."
|
|
|
>
|
|
|
</div>
|
|
|
<div class="form-item">
|
|
|
<img
|
|
|
- class=""
|
|
|
+ :class="{
|
|
|
+ animate__animated: ifTipPassword,
|
|
|
+ animate__headShake: ifTipPassword
|
|
|
+ }"
|
|
|
src="@/assets/images/password-icon.png"
|
|
|
alt=""
|
|
|
draggable="false"
|
|
|
>
|
|
|
<input
|
|
|
- type="text"
|
|
|
+ v-model="password"
|
|
|
+ type="password"
|
|
|
placeholder="请输入密码..."
|
|
|
>
|
|
|
</div>
|
|
|
|
|
|
- <button class="login">
|
|
|
+ <button
|
|
|
+ class="login"
|
|
|
+ @click="submit"
|
|
|
+ >
|
|
|
<div class="text-wrapper">
|
|
|
登录
|
|
|
</div>
|
|
@@ -59,6 +70,12 @@ export default {
|
|
|
yingZaoZhuanJiaNum: 56,
|
|
|
liShiDaRen: 424,
|
|
|
huShuShiZhe: 32,
|
|
|
+
|
|
|
+ userName: '',
|
|
|
+ password: '',
|
|
|
+
|
|
|
+ ifTipUserName: false,
|
|
|
+ ifTipPassword: false,
|
|
|
}
|
|
|
},
|
|
|
mounted() {
|
|
@@ -66,6 +83,30 @@ export default {
|
|
|
},
|
|
|
beforeDestroy() {
|
|
|
window.ifPreventKeyOperationInScene = false
|
|
|
+ },
|
|
|
+ methods: {
|
|
|
+ // todo: debounce
|
|
|
+ submit: globalUtils.throttle(function() {
|
|
|
+ if (this.userName.length === 0) {
|
|
|
+ this.ifTipUserName = true
|
|
|
+ setTimeout(() => {
|
|
|
+ this.ifTipUserName = false
|
|
|
+ }, 1000)
|
|
|
+ return
|
|
|
+ }
|
|
|
+ if (this.password.length === 0) {
|
|
|
+ this.ifTipPassword = true
|
|
|
+ setTimeout(() => {
|
|
|
+ this.ifTipPassword = false
|
|
|
+ }, 1000)
|
|
|
+ return
|
|
|
+ }
|
|
|
+ globalApi.login(this.userName, this.password).then((res) => {
|
|
|
+ this.$router.go(-1)
|
|
|
+ }).catch(error => {
|
|
|
+ window.alert('登录失败')
|
|
|
+ })
|
|
|
+ }, 1500),
|
|
|
}
|
|
|
}
|
|
|
</script>
|