From 693c63dd4ea80db16f97c569df851a0f6fcf7906 Mon Sep 17 00:00:00 2001 From: Surpriseplus <845948745@qq.com> Date: 星期六, 03 十二月 2022 17:37:50 +0800 Subject: [PATCH] bug修改 --- src/components/login.vue | 15 ++++++++++++++- 1 files changed, 14 insertions(+), 1 deletions(-) diff --git a/src/components/login.vue b/src/components/login.vue index 9957012..0588ded 100644 --- a/src/components/login.vue +++ b/src/components/login.vue @@ -155,6 +155,7 @@ import { getPerms } from '../api/api'; import validCode from './verificationCode.vue'; import { mapActions } from 'vuex'; +import moment from 'moment'; export default { components: { validCode }, @@ -208,16 +209,18 @@ getCode(data) { this.validCode = data; //鍦╠ata涓畾涔変竴涓� validCode:'',鐢ㄦ潵璁板綍楠岃瘉鐮併�� }, + submitForm(formName) { this.$refs[formName].validate((valid) => { if (valid) { this.loading = true; - this.login(this.loginForm) .then((response) => { + this.setCookies(response); getPerms().then((res) => { if (res.code == 200) { this.$store.commit('getPermsEntity', res.result); + if (res.result.length != 0) { this.$router.push('/'); } @@ -241,6 +244,16 @@ } }); }, + setCookies(res) { + var timeData = moment(res.result.expire).format('YYYY-MM-DD HH:mm:ss'); + var LfPrems = { + token: res.result.token, + uname: res.result.uname, + time: timeData, + }; + LfPrems = JSON.stringify(LfPrems); + localStorage.setItem('LFToken', LfPrems); + }, }, created() {}, }; -- Gitblit v1.9.3