Commit f1fe3797 authored by 罗超's avatar 罗超

提交新登录方式

parent 26c498ea
......@@ -3,7 +3,8 @@
*/
import request from '../utils/request'
export function login({ Account, Password }) {
export function login({ Account, Password, AutoLoginId}) {
AutoLoginId=AutoLoginId?AutoLoginId:0
// headers: {
// 'Content-Type': 'application/json;charset=UTF-8'
// }, 申明Headers信息,不包含token ,token通过注入添加
......@@ -14,7 +15,8 @@ export function login({ Account, Password }) {
data: {
Account,
Password,
AccountType: 1
AccountType: 1,
AutoLoginId
}
});
}
......
......@@ -8,7 +8,7 @@ LoadingBar.setDefaults({
position: "bottom"
});
let loadAsyncRouter = false;
const whiteList = ["/login", "/", "/contractConfirm","/contractPay","/contractView","/contractSign","/noticeView"]; // 不重定向白名单
const whiteList = ["/login", "/", "/contractConfirm","/contractPay","/contractView","/contractSign","/noticeView","/autologin"]; // 不重定向白名单
router.beforeEach((to, from, next) => {
localStorage.setItem("routerBefore", from.path);
LoadingBar.start();
......
<template>
<div class="full-width window-height bg-grey-3 flex items-center justify-center">
<div class=" flex column items-center justify-center" v-if="!isError">
<q-spinner-bars
color="primary"
size="6em"
/>
<div class="q-mt-lg f12 text-grey-6">正在自动登录中,请稍后...</div>
</div>
<div class=" flex column items-center justify-center" v-if="isError">
<q-spinner-bars
color="primary"
size="6em"
/>
<div class="q-mt-lg f12 text-red-6">
<span>登录异常,请重新打开连接,或</span>
<router-link :to="{ path: 'login' }">
返回登录页
</router-link>
</div>
</div>
</div>
</template>
<script>
export default {
meta: {
title: '自动登录中...',
},
data() {
return {
target:"",
id:0,
isError:false
}
},
mounted() {
if(this.$route.query.loginId){
this.id=this.$route.query.loginId
}
if(this.$route.query.target){
this.target=this.$route.query.target
}
if(this.id!=0&&this.target!=""){
this.$store
.dispatch('Login', {
Account: '',
Password: '',
AutoLoginId:this.id
})
.then(res => {
this.$router.push({
path: this.target
})
})
.catch(() => {
this.isError = true
})
}else{
this.isError = true
}
},
}
</script>
<style>
</style>
\ No newline at end of file
......@@ -129,6 +129,7 @@ export default {
.dispatch('Login', {
Account: this.account,
Password: this.pwd,
AutoLoginId:0
})
.then(res => {
this.$router.push({
......
......@@ -8,6 +8,11 @@ const routes = [{
component: () =>
import("pages/user/login.vue")
},
{
path: "/autologin",
component: () =>
import("pages/auto-login.vue")
},
{
path: "/home",
component: () =>
......
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