完成调用

This commit is contained in:
luyuan 2020-11-12 17:43:45 +08:00
parent bc46dde11c
commit 3b2c47e0ec
Signed by: theluyuan
GPG Key ID: A7972FD973317FF3
4 changed files with 66 additions and 46 deletions

View File

@ -23,41 +23,51 @@ function genTestUserSig(userID) {
* 进入腾讯云实时音视频[控制台](https://console.cloud.tencent.com/rav ) 创建应用,即可看到 SDKAppId * 进入腾讯云实时音视频[控制台](https://console.cloud.tencent.com/rav ) 创建应用,即可看到 SDKAppId
* 它是腾讯云用于区分客户的唯一标识 * 它是腾讯云用于区分客户的唯一标识
*/ */
const SDKAPPID = 1400435767; // const SDKAPPID = 1400435767;
/** // /**
* 签名过期时间建议不要设置的过短 // * 签名过期时间,建议不要设置的过短
* <p> // * <p>
* 时间单位 // * 时间单位:秒
* 默认时间7 x 24 x 60 x 60 = 604800 = 7 // * 默认时间7 x 24 x 60 x 60 = 604800 = 7 天
*/ // */
const EXPIRETIME = 604800; // const EXPIRETIME = 604800;
/** // /**
* 计算签名用的加密密钥获取步骤如下 // * 计算签名用的加密密钥,获取步骤如下:
* // *
* step1. 进入腾讯云实时音视频[控制台](https://console.cloud.tencent.com/rav ),如果还没有应用就创建一个, // * step1. 进入腾讯云实时音视频[控制台](https://console.cloud.tencent.com/rav ),如果还没有应用就创建一个,
* step2. 单击应用配置进入基础配置页面并进一步找到帐号体系集成部分 // * step2. 单击“应用配置”进入基础配置页面,并进一步找到“帐号体系集成”部分。
* step3. 点击查看密钥按钮就可以看到计算 UserSig 使用的加密的密钥了请将其拷贝并复制到如下的变量中 // * step3. 点击“查看密钥”按钮,就可以看到计算 UserSig 使用的加密的密钥了,请将其拷贝并复制到如下的变量中
* // *
* 注意该方案仅适用于调试Demo正式上线前请将 UserSig 计算代码和密钥迁移到您的后台服务器上以避免加密密钥泄露导致的流量盗用 // * 注意该方案仅适用于调试Demo正式上线前请将 UserSig 计算代码和密钥迁移到您的后台服务器上,以避免加密密钥泄露导致的流量盗用。
* 文档https://cloud.tencent.com/document/product/647/17275#Server // * 文档https://cloud.tencent.com/document/product/647/17275#Server
*/ // */
const SECRETKEY = 'dzrUpsgeMo0ygiSmqeDVqxnLbdT3Lbbh'; // const SECRETKEY = 'dzrUpsgeMo0ygiSmqeDVqxnLbdT3Lbbh';
// a soft reminder to guide developer to configure sdkAppId/secretKey // // a soft reminder to guide developer to configure sdkAppId/secretKey
if (SDKAPPID === '' || SECRETKEY === '') { // if (SDKAPPID === '' || SECRETKEY === '') {
alert( // alert(
'请先配置好您的账号信息: SDKAPPID 及 SECRETKEY ' + // '请先配置好您的账号信息: SDKAPPID 及 SECRETKEY ' +
'\r\n\r\nPlease configure your SDKAPPID/SECRETKEY in js/debug/GenerateTestUserSig.js' // '\r\n\r\nPlease configure your SDKAPPID/SECRETKEY in js/debug/GenerateTestUserSig.js'
); // );
} // }
const generator = new LibGenerateTestUserSig(SDKAPPID, SECRETKEY, EXPIRETIME); // const generator = new LibGenerateTestUserSig(SDKAPPID, SECRETKEY, EXPIRETIME);
const userSig = window.istow ? "eJwtzdEKgjAUBuB32XXYdJubQhcV2IWBkGYEgohOO1SypoYQvXtLvTzff85-Pig5xtZbauQjx8JoNc1QybaHGibuboWW*dBJnRNMMcYeX9a66l4oBRXybeOUMO7yOZGjAi2NM8YcczJrD8*-uZhhYRPBlhZozJfW4*f9y7EPafmgTXjdnYQagjIRY7Ye4qim20sNaRsGEWk26PsDMPg1Xg__" : "eJwtzE8LgkAQBfDvstdCJt3RTeigl6gMw-7oLUK3GCNZ1Foj*u5t6vH93sz7sEO0t16yZj6zLWDTPlMhq5au1POzkfXZAQ4Ac288aIr7RSkqmD8zzh30XG9oZKeolsYR0TYvg7b0*JsLCAIcjuMK3cx*LmyV5GFXBWGZ6m4VVaejzjax3K3fehsTpk2QJKVeTsSCfX94djN6"; // const userSig = window.istow ? "eJwtzdEKgjAUBuB32XXYdJubQhcV2IWBkGYEgohOO1SypoYQvXtLvTzff85-Pig5xtZbauQjx8JoNc1QybaHGibuboWW*dBJnRNMMcYeX9a66l4oBRXybeOUMO7yOZGjAi2NM8YcczJrD8*-uZhhYRPBlhZozJfW4*f9y7EPafmgTXjdnYQagjIRY7Ye4qim20sNaRsGEWk26PsDMPg1Xg__" : "eJwtzE8LgkAQBfDvstdCJt3RTeigl6gMw-7oLUK3GCNZ1Foj*u5t6vH93sz7sEO0t16yZj6zLWDTPlMhq5au1POzkfXZAQ4Ac288aIr7RSkqmD8zzh30XG9oZKeolsYR0TYvg7b0*JsLCAIcjuMK3cx*LmyV5GFXBWGZ6m4VVaejzjax3K3fehsTpk2QJKVeTsSCfX94djN6";
console.log(userSig) // console.log(userSig)
window.istow = true // window.istow = true
return { // return {
sdkAppId: SDKAPPID, // sdkAppId: SDKAPPID,
userSig:userSig // userSig:userSig
}; // };
return new Promise((res)=>{
$.ajax({
url: window.url + 'userSig?userid=' + userID,
headers: "Bearer " + localStorage.getItem("token"),
success(data){
res({data: data.data, id: 1400435767})
}
})
})
} }

View File

@ -30,16 +30,22 @@ class Presetting {
userId = 'share_' + userId; userId = 'share_' + userId;
} }
console.log(userId) console.log(userId)
const config = genTestUserSig(userId);
const sdkAppId = config.sdkAppId; let sdkAppId;
const userSig = config.userSig; let userSig;
const roomId = $('#roomId').val(); let roomId = $('#roomId').val();
genTestUserSig(userId).then((res)=>{
sdkAppId = res.id;
userSig = res.data
callback({
sdkAppId,
userId,
userSig,
roomId
});
})
callback({
sdkAppId,
userId,
userSig,
roomId
});
} }
} }

View File

@ -407,6 +407,10 @@
</div> </div>
</div> </div>
</div> </div>
<script>
window.url = 'https://case.sy-my.net/beelink/public/home/'
</script>
<script src="./js/jquery-3.2.1.min.js"></script> <script src="./js/jquery-3.2.1.min.js"></script>
<script src="./js/popper.js"></script> <script src="./js/popper.js"></script>
<script src="./js/bootstrap-material-design.js"></script> <script src="./js/bootstrap-material-design.js"></script>

View File

@ -1,5 +1,5 @@
<template> <template>
<iframe src="./zhibo.html" frameborder="0"></iframe> <iframe style="width:100%;height: 100%" src="/zhibo.html" frameborder="0"></iframe>
</template> </template>
<style lang="scss" scoped> <style lang="scss" scoped>
@ -11,7 +11,7 @@ import { defineComponent } from 'vue';
export default defineComponent({ export default defineComponent({
setup(){ setup(){
return { return {
} }
} }
}) })