提交 20d10a11 编写于 作者: bo.dang's avatar bo.dang

直播修改

上级 0a21f580
...@@ -6,11 +6,12 @@ ...@@ -6,11 +6,12 @@
// https://github.com/rndme/download // https://github.com/rndme/download
// data can be a string, Blob, File, or dataURL // data can be a string, Blob, File, or dataURL
function download(data, strFileName, strMimeType) { // function download(data, strFileName, strMimeType) {
export default function (data, strFileName, strMimeType) {
var self = window, // this script is only for browsers anyway... var self = window, // this script is only for browsers anyway...
u = "application/octet-stream", // this default mime also triggers iframe downloads u = "application/octet-stream", // this default mime also triggers iframe downloads
m = strMimeType || u, m = strMimeType || u,
x = data, x = data,
D = document, D = document,
a = D.createElement("a"), a = D.createElement("a"),
...@@ -18,31 +19,31 @@ function download(data, strFileName, strMimeType) { ...@@ -18,31 +19,31 @@ function download(data, strFileName, strMimeType) {
B = (self.Blob || self.MozBlob || self.WebKitBlob || z); B = (self.Blob || self.MozBlob || self.WebKitBlob || z);
B=B.call ? B.bind(self) : Blob ; B=B.call ? B.bind(self) : Blob ;
var fn = strFileName || "download", var fn = strFileName || "download",
blob, blob,
fr; fr;
if(String(this)==="true"){ //reverse arguments, allowing download.bind(true, "text/xml", "export.xml") to act as a callback if(String(this)==="true"){ //reverse arguments, allowing download.bind(true, "text/xml", "export.xml") to act as a callback
x=[x, m]; x=[x, m];
m=x[0]; m=x[0];
x=x[1]; x=x[1];
} }
//go ahead and download dataURLs right away //go ahead and download dataURLs right away
if(String(x).match(/^data\:[\w+\-]+\/[\w+\-]+[,;]/)){ if(String(x).match(/^data\:[\w+\-]+\/[\w+\-]+[,;]/)){
return navigator.msSaveBlob ? // IE10 can't do a[download], only Blobs: return navigator.msSaveBlob ? // IE10 can't do a[download], only Blobs:
navigator.msSaveBlob(d2b(x), fn) : navigator.msSaveBlob(d2b(x), fn) :
saver(x) ; // everyone else can save dataURLs un-processed saver(x) ; // everyone else can save dataURLs un-processed
}//end if dataURL passed? }//end if dataURL passed?
blob = x instanceof B ? blob = x instanceof B ?
x : x :
new B([x], {type: m}) ; new B([x], {type: m}) ;
function d2b(u) { function d2b(u) {
var p= u.split(/[:;,]/), var p= u.split(/[:;,]/),
t= p[1], t= p[1],
...@@ -56,10 +57,10 @@ function download(data, strFileName, strMimeType) { ...@@ -56,10 +57,10 @@ function download(data, strFileName, strMimeType) {
return new B([uia], {type: t}); return new B([uia], {type: t});
} }
function saver(url, winMode){ function saver(url, winMode){
if ('download' in a) { //html5 A[download] if ('download' in a) { //html5 A[download]
a.href = url; a.href = url;
a.setAttribute("download", fn); a.setAttribute("download", fn);
a.innerHTML = "downloading..."; a.innerHTML = "downloading...";
...@@ -74,49 +75,49 @@ function download(data, strFileName, strMimeType) { ...@@ -74,49 +75,49 @@ function download(data, strFileName, strMimeType) {
if(typeof safari !=="undefined" ){ // handle non-a[download] safari as best we can: if(typeof safari !=="undefined" ){ // handle non-a[download] safari as best we can:
url="data:"+url.replace(/^data:([\w\/\-\+]+)/, u); url="data:"+url.replace(/^data:([\w\/\-\+]+)/, u);
if(!window.open(url)){ // popup blocked, offer direct download: if(!window.open(url)){ // popup blocked, offer direct download:
if(confirm("Displaying New Document\n\nUse Save As... to download, then click back to return to this page.")){ location.href=url; } if(confirm("Displaying New Document\n\nUse Save As... to download, then click back to return to this page.")){ location.href=url; }
} }
return true; return true;
} }
//do iframe dataURL download (old ch+FF): //do iframe dataURL download (old ch+FF):
var f = D.createElement("iframe"); var f = D.createElement("iframe");
D.body.appendChild(f); D.body.appendChild(f);
if(!winMode){ // force a mime that will download: if(!winMode){ // force a mime that will download:
url="data:"+url.replace(/^data:([\w\/\-\+]+)/, u); url="data:"+url.replace(/^data:([\w\/\-\+]+)/, u);
} }
f.src=url; f.src=url;
setTimeout(function(){ D.body.removeChild(f); }, 333); setTimeout(function(){ D.body.removeChild(f); }, 333);
}//end saver }//end saver
if (navigator.msSaveBlob) { // IE10+ : (has Blob, but not a[download] or URL) if (navigator.msSaveBlob) { // IE10+ : (has Blob, but not a[download] or URL)
return navigator.msSaveBlob(blob, fn); return navigator.msSaveBlob(blob, fn);
} }
if(self.URL){ // simple fast and modern way using Blob and URL: if(self.URL){ // simple fast and modern way using Blob and URL:
saver(self.URL.createObjectURL(blob), true); saver(self.URL.createObjectURL(blob), true);
}else{ }else{
// handle non-Blob()+non-URL browsers: // handle non-Blob()+non-URL browsers:
if(typeof blob === "string" || blob.constructor===z ){ if(typeof blob === "string" || blob.constructor===z ){
try{ try{
return saver( "data:" + m + ";base64," + self.btoa(blob) ); return saver( "data:" + m + ";base64," + self.btoa(blob) );
}catch(y){ }catch(y){
return saver( "data:" + m + "," + encodeURIComponent(blob) ); return saver( "data:" + m + "," + encodeURIComponent(blob) );
} }
} }
// Blob but not URL: // Blob but not URL:
fr=new FileReader(); fr=new FileReader();
fr.onload=function(e){ fr.onload=function(e){
saver(this.result); saver(this.result);
}; };
fr.readAsDataURL(blob); fr.readAsDataURL(blob);
} }
return true; return true;
} /* end download() */ } /* end download() */
\ No newline at end of file
...@@ -143,7 +143,7 @@ ...@@ -143,7 +143,7 @@
<el-form-item label="图片"> <el-form-item label="图片">
<el-row> <el-row>
<el-col :span="24"> <el-col :span="24">
<el-button size="small" type="info" @click="addIntroImage()">+新增图片</el-button> <el-button size="small" type="info" @click="addIntroImage()">+新增图片(可上传5张)</el-button>
</el-col> </el-col>
<el-col :span="16"> <el-col :span="16">
<!--<div v-for="(item, index) in formData.rtcIntroduces.filter(obj=> obj.type === 2)" :key="index" style="margin-left:0px;min-width: 380px;display: flex;align-items: center">--> <!--<div v-for="(item, index) in formData.rtcIntroduces.filter(obj=> obj.type === 2)" :key="index" style="margin-left:0px;min-width: 380px;display: flex;align-items: center">-->
......
...@@ -175,7 +175,7 @@ ...@@ -175,7 +175,7 @@
<div v-if="uploadFlag" style="line-height: 40px;"> <div v-if="uploadFlag" style="line-height: 40px;">
<div v-if="numberShowFlag"> <div v-if="numberShowFlag">
<span>存在"{{videoNumber}}段"直播原视频,请下载合并后上传</span> <span style="margin-left: 25px;">存在</span><span style="color:#449284;">"{{videoNumber}}段"</span><span>直播原视频,请下载合并后上传</span>
</div> </div>
<div style="margin-left:30px;" v-if="downloadVideoFlag"> <div style="margin-left:30px;" v-if="downloadVideoFlag">
<span>①下载原视频</span> <span>①下载原视频</span>
...@@ -187,7 +187,8 @@ ...@@ -187,7 +187,8 @@
</div> </div>
<div style="margin-left:30px;"> <div style="margin-left:30px;">
<span>②上传回放视频</span> <span v-show="downloadVideoFlag">②上传回放视频</span>
<span v-show="!downloadVideoFlag">①上传回放视频</span>
<el-upload style="float:right;" <el-upload style="float:right;"
v-model="playbackUrl" v-model="playbackUrl"
action="#" action="#"
......
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册