登录退出

zhangtao
laozt 1 year ago
parent 72eea2f713
commit c1f0505fb9

@ -18,7 +18,7 @@ VUE_APP_BASE_API = 'http://180.108.205.123:13002'
# 政务网
# VUE_APP_LOCATION = 'http://2.46.4.197:8090'
# 外网
VUE_APP_LOCATION = 'http://180.108.205.123:8090'
VUE_APP_LOCATION = 'http://180.108.205.123:8090/sso-server/oauth2/sso?aid=17847210&cbu=http%3A%2F%2F180.108.205.123%3A13001%2F&response_type=code'
# 路由懒加载

@ -9,7 +9,7 @@ ENV = 'production'
# VUE_APP_BASE_API = 'http://39.101.188.84:9033'
VUE_APP_BASE_API = 'http://180.108.205.123:13002'
VUE_APP_LOCATION = 'http://2.46.4.197:8090'
VUE_APP_LOCATION = 'http://2.46.4.197:8090/sso-server/oauth2/sso?aid=77434376&cbu=http%3A%2F%2F180.108.205.123%3A13001%2F&response_type=code'
# 路由懒加载

@ -51,23 +51,6 @@
</el-dropdown-menu>
</el-dropdown>
</header>
<!-- <el-dropdown
class="avatar-container right-menu-item hover-effect"
trigger="click"
>
<el-dropdown-menu slot="dropdown">
<router-link to="/user/profile">
<el-dropdown-item>个人中心</el-dropdown-item>
</router-link>
<el-dropdown-item @click.native="setting = true">
<span>布局设置</span>
</el-dropdown-item>
<el-dropdown-item divided @click.native="logout">
<span>退出登录</span>
</el-dropdown-item>
</el-dropdown-menu>
</el-dropdown> -->
</div>
</div>
</template>
@ -138,23 +121,13 @@ export default {
})
.then(() => {
this.$store.dispatch("LogOut").then(() => {
// location.href = process.env.NODE_ENV === "production"
// ? "/demo/suzhouyingjiPC/"
// : "/";
let isGovernmentAffairsNetwork = localStorage.getItem(
"isGovernmentAffairsNetwork"
);
if (process.env.NODE_ENV === "production") {
if (isGovernmentAffairsNetwork == "1") {
location.href =
process.env.VUE_APP_LOCATION +
"/sso-server/oauth2/sso?aid=17847210&cbu=http%3A%2F%2F180.108.205.123%3A13001%2F&response_type=code";
} else {
location.href = "/login";
}
location.href = process.env.VUE_APP_LOCATION;
} else {
location.href = "/";
location.href = "/login?redirect=%2Findex";
}
});
})

@ -51,13 +51,13 @@
<el-dropdown-item @click.native="logout">退出登录</el-dropdown-item>
</el-dropdown-menu>
</el-dropdown>
<div
<!-- <div
class="showGLstyle"
v-if="roles && roles[0] == 'admin'"
@click="toNewPage"
>
进入管理平台
</div>
</div> -->
</header>
<div class="bottom-view">
<router-view></router-view>
@ -112,24 +112,14 @@ export default {
})
.then(() => {
this.$store.dispatch("LogOut").then(() => {
// location.href = process.env.NODE_ENV === "production"
// ? "/demo/suzhouyingjiPC/"
// : "/";
let isGovernmentAffairsNetwork = localStorage.getItem(
"isGovernmentAffairsNetwork"
);
if (process.env.NODE_ENV === "production") {
console.log("production");
if (isGovernmentAffairsNetwork == "1") {
console.log("进入跳转政务网的登录页");
location.href =
process.env.VUE_APP_LOCATION +
"/sso-server/oauth2/sso?aid=17847210&cbu=http%3A%2F%2F180.108.205.123%3A13001%2F&response_type=code";
} else {
location.href = "/login";
}
// console.log("");
location.href = process.env.VUE_APP_LOCATION;
} else {
location.href = "/";
location.href = "/login?redirect=%2Findex";
}
});
})

@ -30,7 +30,7 @@ router.beforeEach((to, from, next) => {
isRelogin.show = false;
store.dispatch("GenerateRoutes").then((accessRoutes) => {
// 根据roles权限生成可访问的路由表
console.log(res);
// console.log(res);
router.addRoutes(accessRoutes); // 动态添加可访问路由表
//刷新之后,要去的路由肯定是自己已经保存过的新路由
let refresh = "";
@ -83,21 +83,16 @@ router.beforeEach((to, from, next) => {
});
})
.catch((err) => {
location.href =
process.env.VUE_APP_LOCATION +
"/sso-server/oauth2/sso?aid=17847210&cbu=http%3A%2F%2F180.108.205.123%3A13001%2F&response_type=code";
location.href = process.env.VUE_APP_LOCATION;
});
} else {
// console.log('没code')
// location.href = process.env.VUE_APP_LOCATION + '/sso-server/oauth2/sso?aid=17847210&cbu=http%3A%2F%2F180.108.205.123%3A13001%2F'
if (whiteList.indexOf(to.path) !== -1) {
// 在免登录白名单,直接进入
next();
NProgress.done();
} else {
location.href =
process.env.VUE_APP_LOCATION +
"/sso-server/oauth2/sso?aid=17847210&cbu=http%3A%2F%2F180.108.205.123%3A13001%2F&response_type=code";
location.href = process.env.VUE_APP_LOCATION;
NProgress.done();
}
}

Loading…
Cancel
Save