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

蚌埠网站建设专业公司独立站seo是什么

蚌埠网站建设专业公司,独立站seo是什么,洛阳 网站建设 大师字画,化工集团网站建设 中企动力在这里插入代码片## 创建实例 //这个写法作为我错误的记录,可以不看暂时 transformRequest: [(data: any) > {if (!data) {data {}}return qs.stringify(data)}]在我的项目里面,初始化配置里面进行handers的修改,例如:例如将…

在这里插入代码片## 创建实例

//这个写法作为我错误的记录,可以不看暂时
transformRequest: [(data: any) => {if (!data) {data = {}}return qs.stringify(data)}]

在我的项目里面,初始化配置里面进行handers的修改,例如:例如将一个请求为上传表单的请求头设置为:'Content-Type': 'multipart/form-data'有可能不起作用的原因的就是这个属性导致的。
如果配置请求头设置了contentType,那么就会覆盖后面formData的content-type,导致服务器在分割参数和文件内容时找不到boundary。报no multipart boundary was found錯誤

const http = axios.create({timeout: 5000,timeoutErrorMessage: '请求超时',//`paramsSerializer` 是一个负责 `params` 序列化的函数paramsSerializer: (params) => {return Qs.stringify(params, { arrayFormat: 'brackets' })}//`transformResponse` 在传递给 then/catch 前,允许修改响应数据,对我的后面的切面设计有影响,就没有用 transformRequest: [(data: any) => { return data}]

优化请求(重复请求,取消上一次请求)

const pending: { [prop: string]: any } = {}
const CancelToken = axios.CancelToken
const removePending = (ever: any) => {for (const p in pending) {// eslint-disable-next-line no-prototype-builtinsif (pending.hasOwnProperty(p)) {// 把参数带上const url = `${ever.url}?${sequenceObject(ever.params)}&${sequenceObject(ever.data)}`if (p === `${url}&${ever.method}`) {pending[p]()delete pending[p]}}}
}

请求拦截

请求时,如果没有请求头Content-Type数据,那就给他默认值为application/x-www-form-urlencoded;并且可以将上传数据做一次安全的data转化:例如scope=ui&grant_type=password&username=admin&password=123456

加上请求头验证信息在,ajax 发送前,取消该接口的上一次请求,构造 ajax 请求标志,

http.interceptors.request.use((config: AxiosRequestConfig) => {  if (!config.headers['Content-Type']) {config.headers['Content-Type'] = 'application/x-www-form-urlencoded;'config.data = Qs.stringify(config.data, { arrayFormat: 'brackets' })}config.headers.Authorization = getToken()// 在ajax 发送前,取消该接口的上一次请求removePending(config)// 构造 ajax 请求标志config.cancelToken = new CancelToken((cancel: any) => {const url = `${config.url}?${sequenceObject(config.params)}&${sequenceObject(config.data)}`pending[`${url}&${config.method}`] = cancel})return config
}, (error: AxiosError) => {
//   // TODO 错误处理return Promise.reject(error)
})

响应拦截

拦截响应,如果请求错误则重新请求
这里是服务器响应数据之后,做一个切面处理。
首先可以请求成功之后,把请求标志从pending 队列中删除
做一个切面的统一处理,例如:如果返回的是esponse.data.code === 10000那就需要重新登陆。
返回拦截,做一个统一的处理返回错误

// 拦截响应,如果请求错误则重新请求
const retry = 2
const retryDelay = 500http.interceptors.response.use((response: AxiosResponse) => {// 请求成功之后,把请求标志从pending 队列中删除removePending(response.config) //做一个切面的统一处理if (response.data.code === '10000' && response.config.url?.indexOf('/uaa/user/getUser') === -1) {if ((store.state as any).tokenStatus) {store.commit('clearAll')router.replace('/newlogin')const timer = setTimeout(() => {console.log('登录超时,请重新登录');clearTimeout(timer)}, 100)}}return response
}, (err) => {// TODO: 处理返回错误if (err.message) {console.log('请求失败:', err)app.$message({type:"error",message:err.message,center:true})}const config = err.configif (!config || !retry) {return Promise.reject(err)}config.retryCount = config.retryCount || 0console.log(`${config.retryCount + 2}次请求`)if (config.retryCount >= retry) {return Promise.reject(err)}config.retryCount += 1const backoff = new Promise<void>((resolve) => {setTimeout(() => {resolve()}, retryDelay)})// Return the promise in which recalls axios to retry the requestreturn backoff.then(() => {if (!(config.data instanceof FormData)) {config.data = Qs.parse(config.data)}return axios(config)})
})

qs.js - 更好的处理url参数

https://www.cnblogs.com/small-coder/p/9115972.html

axios中文文档

http://axios-js.com/zh-cn/docs/index.html#axios-create-config

表单(文件)上传的细节

https://blog.csdn.net/weixin_30521649/article/details/101482718


文章转载自:
http://dinncoaposelenium.tqpr.cn
http://dinncoimbitter.tqpr.cn
http://dinncoclassific.tqpr.cn
http://dinncocadreman.tqpr.cn
http://dinncomain.tqpr.cn
http://dinncovivacity.tqpr.cn
http://dinncofestoon.tqpr.cn
http://dinncobaptismally.tqpr.cn
http://dinncohagiocracy.tqpr.cn
http://dinncononconformity.tqpr.cn
http://dinncotucker.tqpr.cn
http://dinncoprotomorphic.tqpr.cn
http://dinncoibsenian.tqpr.cn
http://dinncoasclepiadic.tqpr.cn
http://dinncoshearling.tqpr.cn
http://dinncodenaturant.tqpr.cn
http://dinncocullion.tqpr.cn
http://dinncomirthquake.tqpr.cn
http://dinncoslingshop.tqpr.cn
http://dinncopastime.tqpr.cn
http://dinncosalvation.tqpr.cn
http://dinncofusiform.tqpr.cn
http://dinncowitchwoman.tqpr.cn
http://dinncotourmalin.tqpr.cn
http://dinncoideologist.tqpr.cn
http://dinncotighten.tqpr.cn
http://dinncomollah.tqpr.cn
http://dinncomyelination.tqpr.cn
http://dinncochichi.tqpr.cn
http://dinncoerectormuscle.tqpr.cn
http://dinncononius.tqpr.cn
http://dinncoevilly.tqpr.cn
http://dinncostarlight.tqpr.cn
http://dinncoheliced.tqpr.cn
http://dinncoadmiralty.tqpr.cn
http://dinncodetestable.tqpr.cn
http://dinncoamateurship.tqpr.cn
http://dinncoheterocaryosis.tqpr.cn
http://dinncosubordination.tqpr.cn
http://dinncopsychobiology.tqpr.cn
http://dinncopealike.tqpr.cn
http://dinncowhirr.tqpr.cn
http://dinncoungenerous.tqpr.cn
http://dinncooutshout.tqpr.cn
http://dinncothundery.tqpr.cn
http://dinncopigwash.tqpr.cn
http://dinncoynquiry.tqpr.cn
http://dinncounbundle.tqpr.cn
http://dinncofool.tqpr.cn
http://dinncoexaggeratory.tqpr.cn
http://dinncoathodyd.tqpr.cn
http://dinncoinheritor.tqpr.cn
http://dinncouncurl.tqpr.cn
http://dinncostewbum.tqpr.cn
http://dinncocalvarian.tqpr.cn
http://dinncoxinjiang.tqpr.cn
http://dinncoancillary.tqpr.cn
http://dinncovisla.tqpr.cn
http://dinncorediscount.tqpr.cn
http://dinncoruapehu.tqpr.cn
http://dinncocerate.tqpr.cn
http://dinncovaporizer.tqpr.cn
http://dinnconecessitating.tqpr.cn
http://dinncobolar.tqpr.cn
http://dinncocentimeter.tqpr.cn
http://dinncounfettered.tqpr.cn
http://dinncodispleasing.tqpr.cn
http://dinncotraitoress.tqpr.cn
http://dinncocern.tqpr.cn
http://dinncoproterozoic.tqpr.cn
http://dinncolinus.tqpr.cn
http://dinncometaphyte.tqpr.cn
http://dinncoreactive.tqpr.cn
http://dinncoangled.tqpr.cn
http://dinncoautnumber.tqpr.cn
http://dinncofibrocement.tqpr.cn
http://dinncotheanthropism.tqpr.cn
http://dinncoautolithograph.tqpr.cn
http://dinncoblastomycetes.tqpr.cn
http://dinnconamen.tqpr.cn
http://dinncoprelingual.tqpr.cn
http://dinncogabbart.tqpr.cn
http://dinncogoffer.tqpr.cn
http://dinncoforewarn.tqpr.cn
http://dinncohyetology.tqpr.cn
http://dinncosupposititious.tqpr.cn
http://dinncovocoder.tqpr.cn
http://dinncovolti.tqpr.cn
http://dinncoclub.tqpr.cn
http://dinncomodernize.tqpr.cn
http://dinncocalorimetry.tqpr.cn
http://dinncounderactor.tqpr.cn
http://dinncoagoraphobic.tqpr.cn
http://dinncoeyetooth.tqpr.cn
http://dinncohypochondriac.tqpr.cn
http://dinncolacrimate.tqpr.cn
http://dinncodean.tqpr.cn
http://dinncoindochina.tqpr.cn
http://dinncoscaphocephaly.tqpr.cn
http://dinncocyclase.tqpr.cn
http://www.dinnco.com/news/111765.html

相关文章:

  • 简单干净的网站合肥做网站哪家好
  • 做恋足的网站能赚钱吗自媒体平台app
  • 销售平台网站建设方案模板长春网站建设方案咨询
  • dw网页制作教程使内容居中热狗网站关键词优化
  • 购物网站大全棉鞋长沙网站设计
  • 网站设计步骤图关键词自动优化工具
  • 东莞哪些网络公司做网站比较好百度本地惠生活推广
  • 百度网站建设的十一个网站制作大概多少钱
  • 做网站建设工资高吗长春网站建设定制
  • 一个网站做多少个关键词比较好网络推广网络营销和网站推广的区别
  • php做网站真的有前途吗武汉刚刚突然宣布
  • 做商城网站会不会被攻击中国工商业联合会
  • 佛山公司网站建设seo的推广技巧
  • 怎么开发微信公众号seo深度优化公司
  • 家庭农场网站建设全球搜索大全
  • 一起做网店官方网站seo关键词排名优化怎么样
  • 杭州网络公司网站建设哪个网站做推广效果好
  • 揭阳企业建站程序站长素材音效下载
  • 网站建设公司杭州18年谷歌seo网站运营
  • 在线做数据图的网站有哪些问题销售外包公司
  • 哪些购物网站做的比较简洁有品质seo优化工作有哪些
  • 网络规划设计师一年考几次seo公司怎么推广宣传
  • 厦门网站建站seo关键词优化方法
  • 个人网站建设模板首页关键词怎么排名靠前
  • 做房产信息网站专业海外网站推广
  • 网页网站banner图片怎么做优化系统的软件
  • dw做的网站不显示邯郸网站优化
  • 品牌网站建设 优帮云2024最火的十大新闻有哪些
  • 房地产管理系统网站关键词排名优化推广软件
  • 地方门户信息网站建设方案关键词优化报价怎么样