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

vue单点登录异步执行请求https://xxx.com获取并处理数据

一、请求一个加密地址获取access_token再拼接字符串再次请求

接口返回数据

异步执行请求该地址获取数据并处理

二、请求代码第二步使用 access_token 获取 auth_key

// 第二步:使用 access_token 获取 auth_keyconst access_token = tokenData.access_token;const authKeyResponse = await fetch(`https://xxxx.com:8888/v2/user/authkey?access_token=${access_token}&account=xcykadmin`, {method: 'GET',headers: {'Content-Type': 'application/json'}});if (!authKeyResponse.ok) {throw new Error(`HTTP error! status: ${authKeyResponse.status}`);}const authKeyData = await authKeyResponse.json();console.log('获取到的auth_key:', authKeyData);

三、拼成finalUrl在弹框中打开单点页面

<j-modal :footer="null" title="" :width="modelStyle.width" :height="modelStyle.fullScreen ? '100%' : '590px'":visible="isChatBoxOpen" :bodyStyle="bodyStyle" switchFullscreen @cancel="closeChatBox"@update:fullscreen="isFullscreen"><iframe id="" :src="finalUrl" frameborder="0" width="100%" :height="modelStyle.fullscreen ? '100%' : '98%'"scrolling="auto" style="background-color: #fff;"></iframe></j-modal>

注:iframe似乎不支持放大动态高度:height="modelStyle.fullscreen ? '100%' : '98%'不生效值有改变待改进


http://www.mrgr.cn/news/37550.html

相关文章:

  • Map和Set,TreeMap和TreeSet,HashMap和HashSet
  • MongoDB简介
  • AOT源码解析4.1-对输入数据和mask进行处理(Associating Objects with Transformers for Video Object Segmentation)
  • C++系列-STL容器中算法中的最大最小
  • 数据分析powerbi DAX日常笔记(一)
  • 演示:基于WPF的DrawingVisual开发的Chart图表和表格绘制
  • MySQL | 窗口函数
  • 实习前学一学git
  • 【python】循环中断:break 和 continue
  • C#中的Modbus Ascii报文
  • C#_运算符重载详细解析
  • 贴片式TF卡(SD NAND)参考设计
  • 解读: 火山引擎自研vSwitch技术
  • SRM透视供应链质量,智助企业决策
  • 三维扫描 | 解锁低成本、高效率的工作秘籍
  • 漏洞挖掘 | 发现隐藏子域的虚拟主机
  • 使用 vue-seamless-scroll 组件时部分数据的点击事件失效
  • 20个数字经济创新发展试验区建设案例【2024年发布】
  • Flink基本概念和算子使用
  • 如何使用BERT模型进行实体名称识别与实体链指