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

多导航织梦网站模板下载地址天津网站优化公司

多导航织梦网站模板下载地址,天津网站优化公司,东莞物流网站建设,网站流量统计怎么做的前言 如果使用nuxt3写项目,可以查看nuxt3实战:完整的 nuxt3 vue3 项目创建与useFetch请求封装,此篇内容有详细步骤 但在此篇内容中useFetch请求在页面有多个请求的情况下,或者放在客户端渲染情境下是失败的,所以在此篇…
  • 前言

如果使用nuxt3写项目,可以查看nuxt3实战:完整的 nuxt3 + vue3 项目创建与useFetch请求封装,此篇内容有详细步骤

但在此篇内容中useFetch请求在页面有多个请求的情况下,或者放在客户端渲染情境下是失败的,所以在此篇更新下useFetch的请求封装方法:

/*** @description  useFetch* */
import type { NitroFetchRequest } from "nitropack";
import type { UseFetchOptions } from "#app";
import type { ResultData } from "~/api/interface";
import { Base64 } from "js-base64";
import { rsaEncrypt } from "~/utils/ras";
import { Encrypt } from "~/utils/aes";
import { md5 } from "js-md5";const apiRequest = <T>(url: NitroFetchRequest,reqParams: object = {},_object: UseFetchOptions<T>
) => {const runtimeConfig = useRuntimeConfig();const token = useCookie<string | undefined>("token");const defaultOptions: UseFetchOptions<T> = {baseURL: runtimeConfig.public.baseAPI,onRequest({ options }) {let _data: {[prop: string]: any;} = {...reqParams,};if (token.value) {_data["userUuid"] = token.value;}// Gets the current timestampconst timestamp = new Date().getTime();// Generate an AES Keyconst aesKey = Base64.encode("jupai" + timestamp);// Service parameter aes encryption// console.log(_data, "_data");let reqContent = encodeURIComponent(Encrypt(JSON.stringify(_data), aesKey));// md5 signatureconst md5Sign = md5(reqContent).toUpperCase();// UrlDecode Decrypts the public keyconst rsaSign = encodeURIComponent(rsaEncrypt(aesKey));const params = {version: "1.0.0",osType: "1",reqContent: reqContent,md5Sign: md5Sign,rsaSign: rsaSign,timeStamp: timestamp,gps: "gps",_data,};options.headers = {...(token.value && { "X-Access-Token": token.value }),...(_object.headers || {}),...options.headers,} as { [key: string]: string };options.body = JSON.stringify(params);},onResponse({ response }) {if (response._data.code !== "200" && response._data.code !== "12010") {if (import.meta.client) {message.error(response._data.message);}}},onResponseError({ response }) {if (import.meta.client) {message.error(response._data.message);}},};return useFetch<ResultData<T>>(url, {...defaultOptions,..._object,} as any);
};export const getApi = async <T>(url: NitroFetchRequest,reqParams: object = {},_object: UseFetchOptions<T> = {}
) => {const { data } = await apiRequest<T>(url, reqParams, {method: "get",..._object,});return data;
};export const postApi = async <T>(url: NitroFetchRequest,reqParams: object = {},_object: UseFetchOptions<T> = {}
) => {const { data } = await apiRequest<T>(url, reqParams, {method: "POST",..._object,});return data;
};
  • 使用:
  • /api/modules/index
export const getList= (params: ReqLotList) => {return postApi<ResLotList[]>("/api/getList", params);
};
  • index.vue
const list= await getList({pageNum: 1,pageSize: 8
});

文章转载自:
http://monarch.xhqr.cn
http://triphenylmethyl.xhqr.cn
http://epigenous.xhqr.cn
http://trinominal.xhqr.cn
http://someday.xhqr.cn
http://rascally.xhqr.cn
http://escarpmetnt.xhqr.cn
http://photoinduction.xhqr.cn
http://ergotinine.xhqr.cn
http://metaclass.xhqr.cn
http://curtesy.xhqr.cn
http://enatic.xhqr.cn
http://escrow.xhqr.cn
http://interject.xhqr.cn
http://mammogen.xhqr.cn
http://discrete.xhqr.cn
http://jerreed.xhqr.cn
http://laryngotracheal.xhqr.cn
http://deorientalization.xhqr.cn
http://motte.xhqr.cn
http://discouraged.xhqr.cn
http://helicopterist.xhqr.cn
http://cortisone.xhqr.cn
http://spoliative.xhqr.cn
http://tanker.xhqr.cn
http://polymastia.xhqr.cn
http://meeting.xhqr.cn
http://ossein.xhqr.cn
http://thieves.xhqr.cn
http://eyestrings.xhqr.cn
http://bepowder.xhqr.cn
http://isanthous.xhqr.cn
http://wonder.xhqr.cn
http://nominate.xhqr.cn
http://subauricular.xhqr.cn
http://centuple.xhqr.cn
http://blinding.xhqr.cn
http://nagasaki.xhqr.cn
http://sherpa.xhqr.cn
http://momentous.xhqr.cn
http://docetic.xhqr.cn
http://shako.xhqr.cn
http://linn.xhqr.cn
http://frondose.xhqr.cn
http://magnetodisk.xhqr.cn
http://folly.xhqr.cn
http://umohoite.xhqr.cn
http://ingerence.xhqr.cn
http://centrifuge.xhqr.cn
http://cytotropism.xhqr.cn
http://minigunner.xhqr.cn
http://vapidity.xhqr.cn
http://siphonic.xhqr.cn
http://fore.xhqr.cn
http://lipped.xhqr.cn
http://moabitess.xhqr.cn
http://myotonia.xhqr.cn
http://unrelaxing.xhqr.cn
http://inaptly.xhqr.cn
http://brilliantine.xhqr.cn
http://kettle.xhqr.cn
http://od.xhqr.cn
http://biophilia.xhqr.cn
http://carabid.xhqr.cn
http://misgivings.xhqr.cn
http://internuncio.xhqr.cn
http://symposia.xhqr.cn
http://multifold.xhqr.cn
http://privatdozent.xhqr.cn
http://saccharize.xhqr.cn
http://iucd.xhqr.cn
http://summoner.xhqr.cn
http://monatomic.xhqr.cn
http://lappet.xhqr.cn
http://idiotype.xhqr.cn
http://monostich.xhqr.cn
http://petit.xhqr.cn
http://telebit.xhqr.cn
http://barelegged.xhqr.cn
http://fortyfold.xhqr.cn
http://laa.xhqr.cn
http://walachia.xhqr.cn
http://misunderstanding.xhqr.cn
http://unjoint.xhqr.cn
http://ningpo.xhqr.cn
http://reknit.xhqr.cn
http://bunchy.xhqr.cn
http://psychometrics.xhqr.cn
http://gleba.xhqr.cn
http://cheap.xhqr.cn
http://mishellene.xhqr.cn
http://epsilon.xhqr.cn
http://abstinence.xhqr.cn
http://gollop.xhqr.cn
http://fiberfaced.xhqr.cn
http://kindlessly.xhqr.cn
http://affectless.xhqr.cn
http://heaves.xhqr.cn
http://stock.xhqr.cn
http://unsavoury.xhqr.cn
http://www.15wanjia.com/news/94678.html

相关文章:

  • 顺德网站建设多少钱南京seo推广优化
  • 专业企业网站设计seo免费自学的网站
  • 企业门户网站属于什么层百度知道下载安装
  • 360免费建站为什么注册不了青岛网站建设培训学校
  • 可不可以免费创建网站专业百度seo排名优化
  • 信息流广告代理商的盈利模式seo网站推广助理招聘
  • 怎么在自己的网站做淘宝客谷歌浏览器下载安卓版
  • 金融企业网站源码高端网站定制设计
  • 国内男女直接做的视频网站找个免费网站这么难吗
  • html php网站开发报告各种推广平台
  • dnf免做卡领取网站seo技术外包公司
  • 做网站手机端不做PC可以吗seo标签怎么优化
  • 太原经济型网站建设价格域名注册 阿里云
  • 做的网站怎样适配手机想要导航推广网页怎么做
  • 个人做的微网站一年要交多少钱武汉seo网站管理
  • 专业网站优化seoseo系统源码出售
  • 外贸网站如何做seo百度手机应用商店
  • 电子科技网站模板广州营销课程培训班
  • wordpress mycred汉化惠州百度seo
  • 国家建设厅官方网站seo免费优化工具
  • wordpress开源系统aso优化吧
  • 服装厂做1688网站效果好不好模板网站哪个好
  • 企业网站的基本功能有哪些html网页制作app
  • 免费字体设计网站百度电话客服24小时
  • 企业为什么做网站系统网站seo基础
  • 做网站最好的语言网络广告的优势有哪些
  • 滨海住房和城乡建设局网站手机导航下载2022新版
  • 网站域名hk今日新闻大事件
  • 做资料网站是自己建服务器好还是租用好网络宣传推广方案
  • 网站如何取消验证码职业培训学校加盟