- 0
- 0
- 约小于1千字
- 约 7页
- 2026-06-02 发布于北京
- 举报
讲师:军军君第九章与前端实例对接与前端实例的系统消息功能对接
本节目标1.异常时中文乱码的问题。2.前端系统退出时添加拦截,并自动转入登录界面3.编辑个人信息功能实现。4.与前端实例的系统消息功能对接
中文乱码com.junadmin.security.exception.AuthenticationEntryPointHandler中添加如下代码:response.setCharacterEncoding(utf-8);response.setContentType(application/json;charset=UTF-8);
登录失败拦截前端api.js中添加如下拦截://添加响应拦截器api.interceptors.response.use(function(response){ if(responseresponse.dataresponse.data.coderesponse.data.code==401){ 转到登录界面 } //对响应数据做点什么 returnresponse;},function(error){ //对响应错误做点什么 if(error.response){ switch(error.response.status){ caseappConfig.authNoCode: 转到登录界面
原创力文档

文档评论(0)