视频增加token参数

This commit is contained in:
zhangsir
2024-10-31 19:04:20 +08:00
parent 041643a135
commit 22668d756f

View File

@@ -645,11 +645,24 @@
let urlSign = encodeURIComponent(encrypt(beforeUrl));
//console.log(urlSign,'urlSign');
cookies.set('PLAYSIGN_TIME', ctime); //写客户端的cookie保存
const token = cookies.get('token');
const chunkSize = 100;
let tokenUrl = '';
for (let i = 0; i < token.length; i += chunkSize) {
const chunk = token.slice(i, i + chunkSize);
const encryptedChunk = encrypt(chunk);
if (encryptedChunk) {
tokenUrl += encryptedChunk + '&&&&&&&&&';
} else {
console.error('加密失败');
break;
}
}
//以下判断是为了区分本地环境和服务器环境
if (process.env.NODE_ENV == 'development') {
this.blobUrl = process.env.VUE_APP_FILE_BASE_URL + u;
} else {
this.blobUrl = process.env.VUE_APP_BASE_API + '/xboe/m/course/cware/resource?sign=' + urlSign;
this.blobUrl = process.env.VUE_APP_BASE_API + '/xboe/m/course/cware/resource?sign=' + urlSign + '&token=' + tokenUrl;
}
//console.log(this.blobUrl,'this.blobUrl');
},
@@ -752,7 +765,7 @@
if (this.contentData.status < 2) {
// this.contentData.status = 2; //进行中
if(r.contentType != 61&&r.contentType != 20 && r.contentType != 10){
setTimeout(() => {
setTimeout(() => {
this.isContentTypeTwo = r.contentType
$this.isShowTime()
}, 2000);
@@ -1500,7 +1513,7 @@
}
}
},
progress(val) {
progress(val) {
const progressValue = parseFloat(val) * 100;
this.sendEventProgress = Number(progressValue.toFixed(2));
},