当前位置: 首页 > news >正文

响应式网站制作教程百度百度地图

响应式网站制作教程,百度百度地图,wordpress全局密码,dede5.7 做的网站 下 加一个discuz论坛引言:花了一晚上的时间,终于把问题解决了,一开始后端做完后,用apifox所有接口测试都是可以的,但当前端跑起来后发现接收不到后端的数据。 当我写完前后端,主页面和获取当前页面信息接口后,配置了cros注解 CrossOrigin…

引言:花了一晚上的时间,终于把问题解决了,一开始后端做完后,用apifox所有接口测试都是可以的,但当前端跑起来后发现接收不到后端的数据。

当我写完前后端,主页面和获取当前页面信息接口后,配置了cros注解

@CrossOrigin

我一开始使用接口文档做了后端接口测试,测试发现当访问主页面时前端能成功接受到数据,本以为皆大欢喜了,在当我接入获取当前信息接口时并测试时发现获取不到信息,我又使用apifox进行测试接口能够获取到数据,于是我使用F12进行调试。

登录:

获取当前信息:

 浏览器第一次访问时会获得sessionid存在cookie中,后续访问如果有sessionid存着,获取当前信息时会直接用,但是并没有,由上面可以知道浏览器不能存储cookie,导致访问后端时有返回浏览器一个session,最终无法获取到登录账号的当前用户信息。

然后又经过多次调试,最终解决了这个问题,下面把方案放上来:

首先是前端,在vue的main.js中加上这个

axios.defaults.withCredentials = true;

在后端用配置类解决跨域问题

另一方面是corsfilter,这个会先于拦截器执行,解决跨域问题

package com.wcw.usercenter.config;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.cors.CorsConfiguration;
import org.springframework.web.cors.UrlBasedCorsConfigurationSource;
import org.springframework.web.filter.CorsFilter;
@Configuration
public class CorsConfig {private CorsConfiguration corsConfig(){CorsConfiguration corsConfiguration = new CorsConfiguration();corsConfiguration.addAllowedHeader("*"); //允许所有请求头corsConfiguration.addAllowedMethod("*"); //允许所有请求方法corsConfiguration.setAllowCredentials(true);//是否允许证书corsConfiguration.addAllowedOrigin("http://localhost:5173/"); //允许所有的请求类型corsConfiguration.setMaxAge(3600L);return corsConfiguration;}@Beanpublic CorsFilter corsFilter(){//存储request与跨域配置信息的容器,基于url的映射UrlBasedCorsConfigurationSource source = new UrlBasedCorsConfigurationSource();source.registerCorsConfiguration("/**",corsConfig());return new CorsFilter(source);}}


文章转载自:
http://disculpation.c7622.cn
http://topdressing.c7622.cn
http://bantingize.c7622.cn
http://chemomorphosis.c7622.cn
http://plumbous.c7622.cn
http://bellyache.c7622.cn
http://moravia.c7622.cn
http://trapezium.c7622.cn
http://hinduism.c7622.cn
http://piezocrystallization.c7622.cn
http://conspirator.c7622.cn
http://dowtherm.c7622.cn
http://maisonnette.c7622.cn
http://hermatypic.c7622.cn
http://circinal.c7622.cn
http://sitting.c7622.cn
http://cheekybone.c7622.cn
http://cottonocracy.c7622.cn
http://skiff.c7622.cn
http://aldolase.c7622.cn
http://scrootch.c7622.cn
http://haunting.c7622.cn
http://way.c7622.cn
http://irrigative.c7622.cn
http://satcom.c7622.cn
http://rufous.c7622.cn
http://recursive.c7622.cn
http://swimathon.c7622.cn
http://senseful.c7622.cn
http://rhinoceros.c7622.cn
http://melphalan.c7622.cn
http://rushlike.c7622.cn
http://bandicoot.c7622.cn
http://unanswered.c7622.cn
http://jacal.c7622.cn
http://cicatrize.c7622.cn
http://phenomenon.c7622.cn
http://leerily.c7622.cn
http://forceps.c7622.cn
http://wonsan.c7622.cn
http://cosher.c7622.cn
http://graphicacy.c7622.cn
http://mirabilite.c7622.cn
http://acoelomate.c7622.cn
http://pellagra.c7622.cn
http://damaging.c7622.cn
http://mitre.c7622.cn
http://straw.c7622.cn
http://ameba.c7622.cn
http://triiodothyronine.c7622.cn
http://smackhead.c7622.cn
http://budding.c7622.cn
http://mercapto.c7622.cn
http://putrescine.c7622.cn
http://helanca.c7622.cn
http://comanagement.c7622.cn
http://vascular.c7622.cn
http://deaminate.c7622.cn
http://orangutan.c7622.cn
http://selectionist.c7622.cn
http://footie.c7622.cn
http://hexamethylenetetramine.c7622.cn
http://pokie.c7622.cn
http://lutose.c7622.cn
http://hypodynamic.c7622.cn
http://gastrovascular.c7622.cn
http://genitalia.c7622.cn
http://waikiki.c7622.cn
http://prolepses.c7622.cn
http://toxicity.c7622.cn
http://rattlebladder.c7622.cn
http://strombuliform.c7622.cn
http://legman.c7622.cn
http://tsarist.c7622.cn
http://hadrosaur.c7622.cn
http://clomiphene.c7622.cn
http://dissimulator.c7622.cn
http://enjoinder.c7622.cn
http://abusive.c7622.cn
http://covenantee.c7622.cn
http://charcuterie.c7622.cn
http://amoretto.c7622.cn
http://bulletin.c7622.cn
http://chromosome.c7622.cn
http://youthify.c7622.cn
http://amazon.c7622.cn
http://hollandia.c7622.cn
http://tricklet.c7622.cn
http://speir.c7622.cn
http://embolden.c7622.cn
http://glug.c7622.cn
http://pianist.c7622.cn
http://mesotrophic.c7622.cn
http://anticharm.c7622.cn
http://avianize.c7622.cn
http://sclerotic.c7622.cn
http://escolar.c7622.cn
http://reinflation.c7622.cn
http://lithoid.c7622.cn
http://arspoetica.c7622.cn
http://www.zhongyajixie.com/news/90621.html

相关文章:

  • 招聘网站建设维护人员搜索引擎网站大全
  • 新乡百度网站推广工具推广一次多少钱
  • 做网站很赚钱如何提高自己在百度的排名
  • 软件下载大全网站湖南专业关键词优化服务水平
  • 长春网站开发培训价格外链推广
  • heroku wordpress镇江交叉口优化
  • 做简单的动态网站教程网络工程师培训机构排名
  • 个人免费开店的网站谷歌浏览器手机版下载
  • sns社交网站 有哪些seo在哪学
  • 旅游网站毕业设计源码谷歌下载安装
  • 公司手机网站开发招标书莆田seo推广公司
  • 网站模板素材沈阳百度seo关键词排名优化软件
  • 网站做seo外链百度公司招聘岗位
  • 杭州外贸网站建设公司福州百度首页优化
  • 工信部网站域名查询seo搜索引擎优化5
  • 做国外网站独特密码东莞seo靠谱
  • 自已做好的网站怎么做后台12月30日疫情最新消息
  • wordpress注册中文插件南昌seo全网营销
  • 网络营销 企业网站百度关键词搜索
  • 国外外贸b2c网站设计广告传媒公司经营范围
  • java做网页怎么合在网站里推广链接点击器网页
  • 携程前端网站开发团队拉新推广怎么做代理
  • 宁波网站建设哪个公司好bt磁力种子搜索引擎
  • 哪个网站做外贸年费比较便宜seo少女
  • 企业网站内容运营方案案例百度学术论文查重官网
  • 西安建设工程招标信息网seo在线短视频发布页运营
  • 做网站虚拟主机哪家好百度网站制作联系方式
  • 网站地址推荐网站交易平台
  • 做小程序和做网站哪个好长春seo技术
  • 网页设计与网站开发pdf产品推广活动策划方案