Skip to content

Commit

Permalink
[fix]bug
Browse files Browse the repository at this point in the history
  • Loading branch information
piupuer committed Oct 16, 2024
1 parent 47707f7 commit e692367
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 21 deletions.
2 changes: 1 addition & 1 deletion src/api/model/userModel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ export interface UserStatusReply {
id: string;
img: string;
};
locked: string;
locked: boolean;
lockExpire: string;
}

Expand Down
17 changes: 4 additions & 13 deletions src/pages/login/components/Login.vue
Original file line number Diff line number Diff line change
Expand Up @@ -49,15 +49,10 @@
</t-input>
<t-image class="captcha-wrapper" :src="captchaImg" :style="{ height: '40px' }" @click="refreshCaptcha" />
</t-form-item>

<div class="check-container remember-pwd">
<t-checkbox>记住账号</t-checkbox>
<span class="tip">忘记账号?</span>
</div>
</template>

<t-form-item v-if="type !== 'qrcode'" class="btn-container">
<t-button v-if="disableLogin" block size="large" theme="default" :disabled="disableLogin"> 账户已锁定 </t-button>
<t-button v-if="disableLogin" block size="large" theme="default" :disabled="disableLogin"> 账户已锁定, 请过会儿再试 </t-button>
<t-button v-else block size="large" type="submit"> 登录 </t-button>
</t-form-item>

Expand All @@ -73,6 +68,7 @@ import { useRouter } from 'vue-router';
import { FormInstanceFunctions, MessagePlugin } from 'tdesign-vue-next';
import { useUserStore } from '@/store';
import { captcha, userStatus } from '@/api/user';
import {BOOL} from "@/constants";
const userStore = useUserStore();
Expand Down Expand Up @@ -119,6 +115,7 @@ const onSubmit = async ({ validateResult }) => {
if (e.response && e.response.data && e.response.data.message) {
MessagePlugin.error(e.response.data.message);
}
await getUserStatus();
await refreshCaptcha();
}
}
Expand All @@ -129,12 +126,6 @@ const saveOldUsername = async () => {
};
const getUserStatus = async () => {
if (oldUsername.value === formData.value.username) {
return;
}
if (formData.value.username.length < 5) {
return;
}
try {
const data = await userStatus({ username: formData.value.username });
if (data.captcha) {
Expand All @@ -148,7 +139,7 @@ const getUserStatus = async () => {
} else {
showCaptcha.value = false;
}
if (data.locked === '1') {
if (data.locked === BOOL.TRUE) {
disableLogin.value = true;
} else {
disableLogin.value = false;
Expand Down
8 changes: 1 addition & 7 deletions src/pages/login/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -6,20 +6,14 @@
<div class="title-container">
<h1 class="title margin-no">登录到</h1>
<h1 class="title">TDesign Starter</h1>
<div class="sub-title">
<p class="tip">{{ type == 'register' ? '已有账号?' : '没有账号吗?' }}</p>
<p class="tip" @click="switchType(type == 'register' ? 'login' : 'register')">
{{ type == 'register' ? '登录' : '注册新账号' }}
</p>
</div>
</div>

<login v-if="type === 'login'" />
<register v-else @register-success="switchType('login')" />
<tdesign-setting />
</div>

<footer class="copyright">Copyright @ 2021-2022 Tencent. All Rights Reserved</footer>
<footer class="copyright">Copyright @ 2024 Go Cinch. All Rights Reserved</footer>
</div>
</template>
<script lang="ts">
Expand Down

0 comments on commit e692367

Please sign in to comment.