feat: 补充记住密码功能
This commit is contained in:
@@ -34,24 +34,6 @@ export const appConfig = {
|
||||
|
||||
// customUpdatePwd: () => import('/@/view/updatePassword/updatePassword.vue'),
|
||||
|
||||
// userInfoApi: () => {
|
||||
// return {
|
||||
// code: 200,
|
||||
// success: true,
|
||||
// data: {
|
||||
// accountCode: '1305107806187376793',
|
||||
// accountName: 'adm*n',
|
||||
// accountType: 'admin',
|
||||
// accountStatus: 1,
|
||||
// accountRealName: 'admin',
|
||||
// organizationCode: 'dingcloud',
|
||||
// authConfigList: [],
|
||||
// organizeResCode: [],
|
||||
// leadDepartmentUuidList: [],
|
||||
// },
|
||||
// };
|
||||
// },
|
||||
|
||||
headerSlotConfig: {
|
||||
component: 'NsSelectApi',
|
||||
componentProps: {
|
||||
|
@@ -41,11 +41,9 @@
|
||||
<ns-verify @get-code="onGetCode" />
|
||||
</template>
|
||||
</a-input>
|
||||
<a-button
|
||||
@click="submit"
|
||||
:loading="loading"
|
||||
type="primary"
|
||||
style="margin-top: 30px; width: 100%; height: 53px"
|
||||
<!-- 记住密码 -->
|
||||
<a-checkbox v-model:checked="isRemember" class="loginInfo">记住密码</a-checkbox>
|
||||
<a-button @click="submit" :loading="loading" type="primary" class="loginInfo"
|
||||
>登录</a-button
|
||||
>
|
||||
</div>
|
||||
@@ -56,7 +54,7 @@
|
||||
</template>
|
||||
|
||||
<script lang="ts">
|
||||
import { defineComponent, ref } from 'vue';
|
||||
import { defineComponent, onMounted, ref } from 'vue';
|
||||
import { useRouter } from 'vue-router';
|
||||
import { appConfigStore } from '/nerv-lib/saas/store/modules/app-config';
|
||||
import { authorizationService } from '/nerv-base/store/modules/authorization-service';
|
||||
@@ -78,6 +76,7 @@
|
||||
const initUrl = ref('');
|
||||
const verifyCode = ref('');
|
||||
const code = ref();
|
||||
const isRemember = ref(false);
|
||||
title.value = '账号登录';
|
||||
// title.value = appConfig.title ? appConfig.title : '账号登录';
|
||||
const loading = ref<boolean>(false);
|
||||
@@ -87,6 +86,19 @@
|
||||
const { getThemeConfig: themeConfig, projectName } = storeToRefs(configStore);
|
||||
|
||||
const useAuthorization = authorizationService();
|
||||
const rememberFunc = (data) => {
|
||||
console.log(isRemember.value);
|
||||
if (!isRemember.value) return;
|
||||
localStorage.setItem('LOGIN_INFO', data);
|
||||
};
|
||||
onMounted(() => {
|
||||
const data = localStorage.getItem('LOGIN_INFO');
|
||||
if (data) {
|
||||
const { accountNo, password: pwd } = JSON.parse(data);
|
||||
userName.value = accountNo;
|
||||
password.value = pwd;
|
||||
}
|
||||
});
|
||||
const submit = (): void => {
|
||||
if (password.value === '') {
|
||||
errorMsg.value = '请输入密码';
|
||||
@@ -114,13 +126,14 @@
|
||||
accountNo: userName.value.trim(),
|
||||
password: password.value.trim(),
|
||||
});
|
||||
// Cookies.set('nervsid', 'mockdata');
|
||||
// router.replace({ name: 'root' });
|
||||
|
||||
// 记住密码
|
||||
rememberFunc(data);
|
||||
loading.value = true;
|
||||
async function logins() {
|
||||
try {
|
||||
const res = await configStore.userLogin(JSON.parse(data));
|
||||
|
||||
if (res.data?.token) {
|
||||
if (res.data?.token) {
|
||||
Cookies.set('nervsid', res.data?.token);
|
||||
@@ -213,6 +226,7 @@
|
||||
checkoutBg,
|
||||
errorShow,
|
||||
configStore,
|
||||
isRemember,
|
||||
};
|
||||
},
|
||||
created() {
|
||||
@@ -291,13 +305,13 @@
|
||||
|
||||
.lg_card {
|
||||
width: 500px;
|
||||
height: 570px;
|
||||
background: #fff;
|
||||
box-shadow: 0 2px 2px 0 rgb(0 0 0 / 5%), 0 0 18px 0 rgb(0 0 0 / 8%);
|
||||
height: fit-content;
|
||||
background: #e4f5ff;
|
||||
box-shadow: 0 2px 18px 0 rgba(124, 184, 254, 1), 0 0 32px 0 rgba(124, 184, 254, 1),
|
||||
0px 14px 60px rgba(64, 210, 252, 0.12), inset -7.07px -8.43px 38px rgba(73, 105, 255, 0.25);
|
||||
border-radius: 6px;
|
||||
padding: 50px;
|
||||
border-radius: 10px;
|
||||
// background: ;
|
||||
|
||||
border: 3px solid rgba(255, 255, 255, 1);
|
||||
|
||||
@@ -309,7 +323,9 @@
|
||||
.loginInfo {
|
||||
height: 48px;
|
||||
width: 100%;
|
||||
margin-bottom: 31px;
|
||||
margin-bottom: 24px;
|
||||
font-size: 16px !important;
|
||||
|
||||
:deep(.ant-input) {
|
||||
font-size: 16px !important;
|
||||
}
|
||||
@@ -323,6 +339,12 @@
|
||||
}
|
||||
}
|
||||
}
|
||||
.loginInfo:last-child {
|
||||
margin-bottom: 16px;
|
||||
}
|
||||
.loginInfo:nth-child(5n + 2) {
|
||||
margin-bottom: 0px;
|
||||
}
|
||||
}
|
||||
|
||||
.lg_card .lg_card_title {
|
||||
|
Reference in New Issue
Block a user