Commit bfa30b89 authored by hanfeng zhang's avatar hanfeng zhang

Merge branch 'main' of gitlab.33.cn:HF_web/NFT

parents 4ff1271e 16883482
...@@ -84,6 +84,7 @@ ...@@ -84,6 +84,7 @@
<LoginButton <LoginButton
text="注册" text="注册"
:disabled="getRegisterDisableStatus" :disabled="getRegisterDisableStatus"
:loading="loading"
@click="handleClickRegister" @click="handleClickRegister"
></LoginButton> ></LoginButton>
</div> </div>
...@@ -91,6 +92,7 @@ ...@@ -91,6 +92,7 @@
<LoginButton <LoginButton
text="登录" text="登录"
:disabled="getLoginBtnDisableStatus" :disabled="getLoginBtnDisableStatus"
:loading="loading"
@click="handleClickLogin" @click="handleClickLogin"
></LoginButton> ></LoginButton>
<div v-if="loginByPwdFunc"> <div v-if="loginByPwdFunc">
...@@ -206,9 +208,9 @@ export default Vue.extend({ ...@@ -206,9 +208,9 @@ export default Vue.extend({
pwd: "", pwd: "",
overlayShow: false, overlayShow: false,
rememberPwdChecked: false, rememberPwdChecked: false,
btnLoading: false,
slideConfirmed: false, slideConfirmed: false,
randomNum: Math.random(), randomNum: Math.random(),
loading: false,
}; };
}, },
methods: { methods: {
...@@ -240,16 +242,15 @@ export default Vue.extend({ ...@@ -240,16 +242,15 @@ export default Vue.extend({
if (this.getRegisterDisableStatus) return; if (this.getRegisterDisableStatus) return;
const { phone, code } = this; const { phone, code } = this;
// 调用注册接口 // 调用注册接口
this.btnLoading = true; this.loading = true;
try { try {
const regResult = await this.registerFunc(phone, code); const regResult = await this.registerFunc(phone, code);
} catch (err) {} } catch (err) {}
this.btnLoading = false; this.loading = false;
}, },
async handleClickLogin() { async handleClickLogin() {
if (this.getLoginBtnDisableStatus) return;
const { phone, code, pwd } = this; const { phone, code, pwd } = this;
this.btnLoading = true; this.loading = true;
try { try {
if (this.loginWay === eLoginWay.PWD) { if (this.loginWay === eLoginWay.PWD) {
// 调用登录接口 // 调用登录接口
...@@ -266,7 +267,7 @@ export default Vue.extend({ ...@@ -266,7 +267,7 @@ export default Vue.extend({
await this.loginByCodeFunc(phone, code); await this.loginByCodeFunc(phone, code);
} }
} catch (err) {} } catch (err) {}
this.btnLoading = false; this.loading = false;
this.randomNum = Math.random(); this.randomNum = Math.random();
this.slideConfirmed = false; this.slideConfirmed = false;
}, },
...@@ -327,22 +328,17 @@ export default Vue.extend({ ...@@ -327,22 +328,17 @@ export default Vue.extend({
return pwdConfig.validate(this.pwd); return pwdConfig.validate(this.pwd);
}, },
getRegisterDisableStatus(): boolean { getRegisterDisableStatus(): boolean {
return ( return !(this.codeValid && this.checkStatusValid && this.phoneValid);
!(this.codeValid && this.checkStatusValid && this.phoneValid) ||
this.btnLoading
);
}, },
getLoginBtnDisableStatus(): boolean { getLoginBtnDisableStatus(): boolean {
if (this.loginWay === eLoginWay.CODE) { if (this.loginWay === eLoginWay.CODE) {
return ( return (
!(this.codeValid && this.phoneValid && this.checkStatusValid) || !(this.codeValid && this.phoneValid && this.checkStatusValid) ||
this.btnLoading ||
!this.slideConfirmed !this.slideConfirmed
); );
} else if (this.loginWay === eLoginWay.PWD) { } else if (this.loginWay === eLoginWay.PWD) {
return ( return (
!(this.pwdValid && this.phoneValid && this.checkStatusValid) || !(this.pwdValid && this.phoneValid && this.checkStatusValid) ||
this.btnLoading ||
!this.slideConfirmed !this.slideConfirmed
); );
} }
......
...@@ -9,21 +9,29 @@ ...@@ -9,21 +9,29 @@
:class="[ :class="[
disabled ? 'darkBtn' : 'bg-font-blue', disabled ? 'darkBtn' : 'bg-font-blue',
disabled ? 'darkBtn' : ' text-white ', disabled ? 'darkBtn' : ' text-white ',
loading ? 'opacity-75': '',
]" ]"
> >
<template #icon-right> <template #icon-right>
<img <div>
v-if="!disabled" <div v-if="!loading">
class="ml-2" <img
src="@/assets/icons/arrow-right.png" v-if="!disabled"
alt="arrow-right" class="ml-2"
/> src="@/assets/icons/arrow-right.png"
<img alt="arrow-right"
v-else />
class="ml-2" <img
src="@/assets/icons/arrow-right-dark.png" v-else
alt="arrow-right" class="ml-2"
/> src="@/assets/icons/arrow-right-dark.png"
alt="arrow-right"
/>
</div>
<div v-else>
<Loading class="w-4 ml-2" />
</div>
</div>
</template> </template>
</Button> </Button>
</transition> </transition>
...@@ -31,18 +39,25 @@ ...@@ -31,18 +39,25 @@
<script lang="ts"> <script lang="ts">
import Button from "@/components/common/Btn.vue"; import Button from "@/components/common/Btn.vue";
import { Loading } from "vant";
import Vue from "vue"; import Vue from "vue";
export default Vue.extend({ export default Vue.extend({
components: { components: {
Button, Button,
Loading,
}, },
props: { props: {
text: String, text: String,
disabled: Boolean, disabled: Boolean,
loading: {
type: Boolean,
default: false,
},
}, },
methods: { methods: {
handleCliCkBtn(e: MouseEvent) { handleCliCkBtn(e: MouseEvent) {
if (this.disabled) return; if (this.disabled) return;
if (this.loading) return;
this.$emit("click", e); this.$emit("click", e);
}, },
}, },
......
...@@ -37,6 +37,7 @@ ...@@ -37,6 +37,7 @@
text="确定" text="确定"
:disabled="getConfirmDisabled" :disabled="getConfirmDisabled"
@click="handleClickConfirm" @click="handleClickConfirm"
:loading="loading"
></LoginButton> ></LoginButton>
</div> </div>
</template> </template>
...@@ -80,6 +81,7 @@ export default Vue.extend({ ...@@ -80,6 +81,7 @@ export default Vue.extend({
phone: "", phone: "",
code: "", code: "",
pwd: "", pwd: "",
loading: false,
}; };
}, },
methods: { methods: {
......
...@@ -38,6 +38,7 @@ ...@@ -38,6 +38,7 @@
class="mt-20" class="mt-20"
text="确定" text="确定"
:disabled="getConfirmDisabled" :disabled="getConfirmDisabled"
:loading="loading"
@click="handleClickConfirm" @click="handleClickConfirm"
></LoginButton> ></LoginButton>
<div class="mt-5 text-center text-font-blue text-sm"> <div class="mt-5 text-center text-font-blue text-sm">
......
...@@ -27,6 +27,7 @@ ...@@ -27,6 +27,7 @@
<LoginButton <LoginButton
class="mt-20" class="mt-20"
text="确定" text="确定"
:loading="loading"
:disabled="getConfirmDisabled" :disabled="getConfirmDisabled"
@click="handleClickConfirm" @click="handleClickConfirm"
></LoginButton> ></LoginButton>
...@@ -67,6 +68,7 @@ export default Vue.extend({ ...@@ -67,6 +68,7 @@ export default Vue.extend({
pwdConfig, pwdConfig,
code: "", code: "",
pwd: "", pwd: "",
loading: false,
}; };
}, },
computed: { computed: {
...@@ -81,9 +83,13 @@ export default Vue.extend({ ...@@ -81,9 +83,13 @@ export default Vue.extend({
}, },
}, },
methods: { methods: {
handleClickConfirm() { async handleClickConfirm() {
const { phone, code, pwd } = this; const { phone, code, pwd } = this;
this.setPwdFunc(phone, code, pwd); this.loading = true;
try {
await this.setPwdFunc(phone, code, pwd);
} catch (err) {}
this.loading = false;
}, },
handleCodeChange(v: string) { handleCodeChange(v: string) {
this.code = v; this.code = v;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment