Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
谢斯
Model_Library_Front_End
提交
149b04f8
M
Model_Library_Front_End
项目概览
谢斯
/
Model_Library_Front_End
通知
2
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
M
Model_Library_Front_End
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
提交
149b04f8
编写于
6月 20, 2021
作者:
谢
谢斯
提交者:
xiesi
6月 20, 2021
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
当没有登录信息的时候 需要跳到登录界面
Signed-off-by:
N
xiesi
<
305492881@qq.com
>
上级
518a52b7
变更
2
显示空白变更内容
内联
并排
Showing
2 changed file
with
9 addition
and
8 deletion
+9
-8
src/main.js
src/main.js
+5
-6
src/views/Home.vue
src/views/Home.vue
+4
-2
未找到文件。
src/main.js
浏览文件 @
149b04f8
...
@@ -14,22 +14,21 @@ createApp(App).use(store).use(router).use(ElementPlus).use(VueAxios, axios).moun
...
@@ -14,22 +14,21 @@ createApp(App).use(store).use(router).use(ElementPlus).use(VueAxios, axios).moun
router
.
beforeEach
((
to
,
from
,
next
)
=>
{
router
.
beforeEach
((
to
,
from
,
next
)
=>
{
// to and from are both route objects. must call `next`.
// to and from are both route objects. must call `next`.
if
(
to
.
meta
.
needLogin
)
{
if
(
to
.
meta
.
needLogin
)
{
console
.
log
(
"
hello
"
);
axios
.
get
(
"
http://localhost:8070/login
"
,
{
axios
.
get
(
"
http://localhost:8070/login
"
,
{
withCredentials
:
true
withCredentials
:
true
})
})
.
then
((
response
)
=>
{
.
then
((
response
)
=>
{
if
(
response
.
data
.
usertype
==
'
用户
'
)
{
console
.
log
(
response
.
data
);
if
(
response
.
data
.
Code
==
0
)
{
//显示用户名
//显示用户名
console
.
log
(
response
.
data
.
data
.
name
);
console
.
log
(
response
.
data
.
data
.
name
);
next
();
next
();
}
else
{
}
else
{
//当前为有课,不允许登录
//当前为有课,不允许登录
console
.
log
(
"
需要跳转到登录页面
"
);
router
.
push
(
"
Login
"
);
next
({
next
({
name
:
"
Login
"
,
path
:
"
Login
"
,
query
:
{
redirect
:
to
.
meta
.
redirect
}
});
});
}
}
});
});
...
...
src/views/Home.vue
浏览文件 @
149b04f8
...
@@ -37,9 +37,11 @@
...
@@ -37,9 +37,11 @@
</el-header>
</el-header>
<el-main>
<el-main>
<el-button
@
click=
"onclickaxios"
>
hello
</el-button>
<el-button
@
click=
"onclickaxios"
>
login_post
</el-button>
<el-button
@
click=
"havelogin"
>
havelogin
</el-button>
<el-button
@
click=
"havelogin"
>
login_get
</el-button>
<el-button
@
click=
"logout"
>
logout
</el-button>
<el-button
@
click=
"logout"
>
logout
</el-button>
<br>
<br>
<el-button
@
click=
"gotologin11"
>
gotologin
</el-button>
<el-button
@
click=
"gotologin11"
>
gotologin
</el-button>
<router-link
to=
"/Login"
>
gotologin
</router-link>
<router-link
to=
"/Login"
>
gotologin
</router-link>
</el-main>
</el-main>
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录