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

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

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

接口返回数据

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

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

// 第二步:使用 access_token 获取 auth_key
        const 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.kler.cn/news/330736.html

相关文章:

  • 博文汇总目录
  • C语言自定义类型结构体
  • 茴香豆 + Qwen-7B-Chat-Int8
  • 高级架构师面试题
  • 第24天sql注入(小迪安全学习)
  • GPT与大模型行业落地实践探索
  • OpenCV视频I/O(13)视频采集类VideoCapture之等待多个视频流中的任意一个变为可用状态函数waitAny()的使用
  • HKMG工艺为什么要用金属栅极?
  • 【Android】浅析六大设计原则
  • C++中的类型推导:auto 和 decltype 介绍
  • 如何理解矩阵的复数特征值和特征向量?
  • 【60天备战2024年11月软考高级系统架构设计师——第35天:系统安全设计——安全设计模式】
  • quiz: python网络爬虫之规则1
  • 【H2O2|全栈】关于CSS(8)CSS3扩充了哪些新鲜的东西?
  • ISP下载,IAP,ICP,USB转TTL下载SWIM、DAP-link、CMSIS-DAP、ST-LINK,SPI(通信方式),
  • 计算机视觉学习--目标检测Java开发案例
  • 【ios】---swift开发从入门到放弃
  • 【AIGC】AI时代的数据安全:使用ChatGPT时的自查要点
  • 【MySQL 07】内置函数
  • Pikachu-Sql Inject-搜索型注入