This commit is contained in:
daihh
2022-06-06 18:43:16 +08:00
parent 62747f9fa6
commit 7ae5bd5afc
4 changed files with 34 additions and 49 deletions

View File

@@ -14,10 +14,10 @@ VUE_APP_BOE_WEB_URL = 'https://u.boe.com'
VUE_APP_BOE_MOBILE_URL = 'http://192.168.0.10:8082/mobile' VUE_APP_BOE_MOBILE_URL = 'http://192.168.0.10:8082/mobile'
# File路径的基础url # File路径的基础url
VUE_APP_FILE_BASE_URL = 'http://localhost:9090/cdn/upload' VUE_APP_FILE_BASE_URL = 'http://localhost:8091/upload'
# File路径的基础url的相对路径加此项是为了不影响之前的路径配置 # File路径的基础url的相对路径加此项是为了不影响之前的路径配置
VUE_APP_FILE_RELATIVE_PATH = 'http://localhost:9090/cdn/upload' VUE_APP_FILE_RELATIVE_PATH = '/upload'
# 登录地址 # 登录地址
VUE_APP_LOGIN_URL='/pc/login' VUE_APP_LOGIN_URL='/pc/login'

View File

@@ -14,7 +14,7 @@ VUE_APP_BOE_WEB_URL = 'https://u.boe.com/preview'
VUE_APP_BOE_MOBILE_URL = 'http://u.boe.com' VUE_APP_BOE_MOBILE_URL = 'http://u.boe.com'
# File路径的基础url # File路径的基础url
VUE_APP_FILE_BASE_URL='http://u-pre.boe.com/upload' VUE_APP_FILE_BASE_URL='http://u.boe.com/upload'
# File路径的基础url的相对路径加此项是为了不影响之前的路径配置 # File路径的基础url的相对路径加此项是为了不影响之前的路径配置
VUE_APP_FILE_RELATIVE_PATH = '/upload' VUE_APP_FILE_RELATIVE_PATH = '/upload'
@@ -23,4 +23,4 @@ VUE_APP_FILE_RELATIVE_PATH = '/upload'
VUE_APP_PUBLIC_PATH='/pc' VUE_APP_PUBLIC_PATH='/pc'
# 登录地址 # 登录地址
VUE_APP_LOGIN_URL='https://u-pre.boe.com/web/' VUE_APP_LOGIN_URL='https://u.boe.com/web/'

View File

@@ -459,7 +459,6 @@ export default {
$this.$message.error('加载pdf课件文件失败'); $this.$message.error('加载pdf课件文件失败');
} }
}); });
//let url = this.fileBaseUrl + r.content; //let url = this.fileBaseUrl + r.content;
}else if(con.contentType ==52){ }else if(con.contentType ==52){
if(con.content.startsWith('\{')){ if(con.content.startsWith('\{')){
@@ -500,34 +499,19 @@ export default {
createPlayUrl(fid,u){ createPlayUrl(fid,u){
let nowDate=new Date(); let nowDate=new Date();
let ctime=parseInt(nowDate.getTime()/1000); let ctime=parseInt(nowDate.getTime()/1000);
let beforeUrl=parseInt(nowDate.getTime()/1000)+u; let beforeUrl=parseInt(nowDate.getTime()/1000)+'/'+fid;
//console.log(beforeUrl,'beforeUrl'); //console.log(beforeUrl,'beforeUrl');
//let urlSign=encodeURIComponent(encrypt(beforeUrl)); let urlSign=encodeURIComponent(encrypt(beforeUrl));
//console.log(urlSign,'urlSign'); //console.log(urlSign,'urlSign');
cookies.set('PLAYSIGN_TIME', ctime);//写客户端的cookie保存 cookies.set('PLAYSIGN_TIME', ctime);//写客户端的cookie保存
//this.blobUrl=process.env.VUE_APP_BASE_API+'/xboe/m/course/play/resource?sign='+urlSign; //以下判断是为了区分本地环境和服务器环境
this.blobUrl=process.env.VUE_APP_BASE_API+'/xboe/course/resource?fid='+fid; if(process.env.NODE_ENV == 'development'){
//this.blobUrl='http://127.0.0.1:9090/xboe/course/resource?fid='+fid; this.blobUrl=process.env.VUE_APP_FILE_BASE_URL+u;
//this.blobUrl=this.fileBaseUrl+u; }else{
this.blobUrl=process.env.VUE_APP_BASE_API+'/xboe/m/course/cware/resource?sign='+urlSign;
}
//console.log(this.blobUrl,'this.blobUrl'); //console.log(this.blobUrl,'this.blobUrl');
}, },
createVideoBlob(url){
let $this=this;
let xhr = new XMLHttpRequest;
xhr.open("GET",url,true);
xhr.responseType = 'blob';
//xhr.onload只有 4 状态会触发
xhr.onreadystatechange = function() {
if (xhr.readyState==4 && xhr.status == 200) {//请求成功
//获取blob对象
let blob = xhr.response;
//获取blob对象地址并把值赋给容器
let urlObj = window.URL.createObjectURL(blob);
$this.blobUrl=urlObj;
}
};
xhr.send();
},
showQrimage(row){ showQrimage(row){
let urlPre=window.location.protocol+'//'+window.location.host; let urlPre=window.location.protocol+'//'+window.location.host;
// https://u.boe.com/mobile/pages/resource/microDetail?id=963456709515939840 // https://u.boe.com/mobile/pages/resource/microDetail?id=963456709515939840

View File

@@ -26,7 +26,7 @@
</div> </div>
<div v-if="resType == 10" style="position: relative;"> <div v-if="resType == 10" style="position: relative;">
<videoPlayer id="myVideoPlayer" v-if="resType == 10" <videoPlayer id="myVideoPlayer" v-if="resType == 10"
:src="fileBaseUrl+curriculumData.url" :src="blobUrl"
@onPlayerPlaying="onPlayerPlaying" @onPlayerPlaying="onPlayerPlaying"
:initTime="contentData.lastStudyTime" :initTime="contentData.lastStudyTime"
@onPlayerPlay="onPlayerPlay" @onPlayerPlay="onPlayerPlay"
@@ -257,7 +257,9 @@ import pdfPreview from '@/components/PdfPreview/index.vue';
import audioPlayer from '@/components/AudioPlayer/index.vue'; import audioPlayer from '@/components/AudioPlayer/index.vue';
import videoPlayer from '@/components/VideoPlayer/index.vue'; import videoPlayer from '@/components/VideoPlayer/index.vue';
import hyperLink from '@/components/Course/hyperLink.vue'; import hyperLink from '@/components/Course/hyperLink.vue';
import studyUtil from '@/utils/study.js'; import studyUtil from '@/utils/study.js';
import {encrypt} from '@/utils/jsencrypt.js';
import cookies from 'vue-cookies'
export default { export default {
name: 'ucStudyIndex', name: 'ucStudyIndex',
components: { courseImage, portalHeader, portalFooter, hyperLink, comments, homework, exam, interactBar, assess, pdfPreview, audioPlayer, videoPlayer }, components: { courseImage, portalHeader, portalFooter, hyperLink, comments, homework, exam, interactBar, assess, pdfPreview, audioPlayer, videoPlayer },
@@ -343,23 +345,22 @@ export default {
return treeList; return treeList;
} }
}, },
methods: { methods: {
createVideoBlob(url){ createPlayUrl(fid,u){
let $this=this; let nowDate=new Date();
let xhr = new XMLHttpRequest; let ctime=parseInt(nowDate.getTime()/1000);
xhr.open("GET",url,true); let beforeUrl=parseInt(nowDate.getTime()/1000)+'/'+fid;
xhr.responseType = 'blob'; //console.log(beforeUrl,'beforeUrl');
//xhr.onload只有 4 状态会触发 let urlSign=encodeURIComponent(encrypt(beforeUrl));
xhr.onreadystatechange = function() { //console.log(urlSign,'urlSign');
if (xhr.readyState==4 && xhr.status == 200) {//请求成功 cookies.set('PLAYSIGN_TIME', ctime);//写客户端的cookie保存
//获取blob对象 //以下判断是为了区分本地环境和服务器环境
let blob = xhr.response; if(process.env.NODE_ENV == 'development'){
//获取blob对象地址并把值赋给容器 this.blobUrl=process.env.VUE_APP_FILE_BASE_URL+u;
let urlObj = window.URL.createObjectURL(blob); }else{
$this.blobUrl=urlObj; this.blobUrl=process.env.VUE_APP_BASE_API+'/xboe/m/course/cware/resource?sign='+urlSign;
} }
}; console.log(this.blobUrl,'this.blobUrl');
xhr.send();
}, },
widthOpen(url) { widthOpen(url) {
window.open(url, '_blank'); window.open(url, '_blank');
@@ -815,8 +816,8 @@ export default {
this.curriculumData.url = r.content; this.curriculumData.url = r.content;
} }
//let url=process.env.VUE_APP_BASE_API+'/xboe/m/course/file/show?cf='+this.curriculumData.url; //let url=process.env.VUE_APP_BASE_API+'/xboe/m/course/file/show?cf='+this.curriculumData.url;
let url=this.fileBaseUrl+this.curriculumData.url; //let url=this.fileBaseUrl+this.curriculumData.url;
//this.createVideoBlob(url); this.createPlayUrl(r.contentRefId,this.curriculumData.url);
} else if (r.contentType == 40) { } else if (r.contentType == 40) {
// if (r.content != '' && r.content.indexOf('.pdf') == -1) { // if (r.content != '' && r.content.indexOf('.pdf') == -1) {
apiCourseFile.detail(r.contentRefId).then(cfrs => { apiCourseFile.detail(r.contentRefId).then(cfrs => {