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