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%'不生效值有改变待改进

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值