Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
谢斯
Model_Library_Front_End
提交
524cdffb
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 搜索 >>
提交
524cdffb
编写于
6月 26, 2021
作者:
X
xiesi
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
axios的重新使用
Signed-off-by:
N
xiesi
<
305492881@qq.com
>
上级
149b04f8
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
56 addition
and
10 deletion
+56
-10
src/api/api.js
src/api/api.js
+23
-0
src/router/index.js
src/router/index.js
+1
-1
src/utils/request.js
src/utils/request.js
+23
-0
src/views/Home.vue
src/views/Home.vue
+7
-8
vue.config.js
vue.config.js
+2
-1
未找到文件。
src/api/api.js
0 → 100644
浏览文件 @
524cdffb
/**
* 得到登录状态
*/
import
service
from
"
../utils/request
"
;
export
function
isLogin
()
{
return
service
.
request
({
method
:
'
get
'
,
url
:
'
/login
'
,
withCredentials
:
true
});
}
export
function
Login
(
data
=
{})
{
return
service
.
request
({
method
:
'
post
'
,
url
:
'
/login
'
,
withCredentials
:
true
,
data
})
}
\ No newline at end of file
src/router/index.js
浏览文件 @
524cdffb
...
...
@@ -9,7 +9,7 @@ const routes = [{
name
:
"
Home
"
,
component
:
Home
,
meta
:
{
needLogin
:
tru
e
,
needLogin
:
fals
e
,
}
},
{
...
...
src/utils/request.js
0 → 100644
浏览文件 @
524cdffb
import
axios
from
"
axios
"
;
const
service
=
axios
.
create
();
// 添加请求拦截器
service
.
interceptors
.
request
.
use
(
function
(
config
)
{
// 在发送请求之前做些什么
return
config
;
},
function
(
error
)
{
// 对请求错误做些什么
return
Promise
.
reject
(
error
);
});
// 添加响应拦截器
service
.
interceptors
.
response
.
use
(
function
(
response
)
{
// 对响应数据做点什么
return
response
;
},
function
(
error
)
{
// 对响应错误做点什么
return
Promise
.
reject
(
error
);
});
export
default
service
;
\ No newline at end of file
src/views/Home.vue
浏览文件 @
524cdffb
...
...
@@ -40,8 +40,8 @@
<el-button
@
click=
"onclickaxios"
>
login_post
</el-button>
<el-button
@
click=
"havelogin"
>
login_get
</el-button>
<el-button
@
click=
"logout"
>
logout
</el-button>
<br>
<br>
<br
/
>
<br
/
>
<el-button
@
click=
"gotologin11"
>
gotologin
</el-button>
<router-link
to=
"/Login"
>
gotologin
</router-link>
</el-main>
...
...
@@ -60,6 +60,7 @@
</template>
<
script
>
import
{
isLogin
}
from
"
@/api/api.js
"
;
import
LoadFBX
from
"
@/components/LoadFBX.vue
"
;
import
qs
from
"
qs
"
;
//import { useRouter } from "vue-router";
...
...
@@ -89,17 +90,15 @@ export default {
remember
:
"
on
"
,
});
this
.
axios
.
post
(
"
http://localhost:8070
/login
"
,
fdata
,
{
withCredentials
:
true
})
.
post
(
"
/login
"
,
fdata
,
{
withCredentials
:
true
})
.
then
((
response
)
=>
{
console
.
log
(
response
.
data
);
});
},
havelogin
()
{
this
.
axios
.
get
(
"
http://localhost:8070/login
"
,
{
withCredentials
:
true
})
.
then
((
response
)
=>
{
console
.
log
(
response
.
data
);
});
isLogin
().
then
((
response
)
=>
{
console
.
log
(
response
.
data
);
});
},
logout
()
{
this
.
axios
...
...
vue.config.js
浏览文件 @
524cdffb
module
.
exports
=
{
devServer
:
{
https
:
false
,
proxy
:
'
http://localhost:8070
'
},
};
};
\ No newline at end of file
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录