|
@@ -35,7 +35,7 @@ function onResize({width,height}){
|
|
|
const scale=width/900
|
|
|
const el=document.getElementsByClassName('ppt-content-wrap')[0]
|
|
|
if(!el) return
|
|
|
- pptContentHeight.value=height*scale
|
|
|
+ pptContentHeight.value=height*scale+60
|
|
|
el.style.transform=`scale(${scale})`
|
|
|
}
|
|
|
|
|
@@ -89,10 +89,51 @@ function onSelectPlayOpt(e){
|
|
|
})
|
|
|
}
|
|
|
|
|
|
+// 下载文件
|
|
|
+function handleDownLoadFile(){
|
|
|
+ const a = document.createElement('a');
|
|
|
+ a.style.display = 'none';
|
|
|
+ // a.setAttribute('target', '_blank');
|
|
|
+ /*
|
|
|
+ * download的属性是HTML5新增的属性
|
|
|
+ * href属性的地址必须是非跨域的地址,如果引用的是第三方的网站或者说是前后端分离的项目(调用后台的接口),这时download就会不起作用。
|
|
|
+ * 此时,如果是下载浏览器无法解析的文件,例如.exe,.xlsx..那么浏览器会自动下载,但是如果使用浏览器可以解析的文件,比如.txt,.png,.pdf....浏览器就会采取预览模式
|
|
|
+ * 所以,对于.txt,.png,.pdf等的预览功能我们就可以直接不设置download属性(前提是后端响应头的Content-Type: application/octet-stream,如果为application/pdf浏览器则会判断文件为 pdf ,自动执行预览的策略)
|
|
|
+ */
|
|
|
+ a.setAttribute('download','测试');
|
|
|
+ a.href = PPTInfo.value.PptxUrl;
|
|
|
+ document.body.appendChild(a);
|
|
|
+ a.click();
|
|
|
+ document.body.removeChild(a);
|
|
|
+}
|
|
|
+
|
|
|
</script>
|
|
|
|
|
|
<template>
|
|
|
<div class="ppt-detail-page" :style="{height:pptContentHeight+'px'}">
|
|
|
+ <!-- pad端顶部操作栏 -->
|
|
|
+ <div class="pad-top-action-wrap">
|
|
|
+ <div class="item-box" @click="handllePublishPPT">
|
|
|
+ <img src="@/assets/imgs/ppt/icon_action_publish.png" alt="">
|
|
|
+ <span>发布</span>
|
|
|
+ </div>
|
|
|
+ <div class="item-box" @click="showPlayOpt=true">
|
|
|
+ <img src="@/assets/imgs/ppt/icon_action_play.png" alt="">
|
|
|
+ <span>播放</span>
|
|
|
+ </div>
|
|
|
+ <div class="item-box" @click="handleShowPPTCopy({pptid:$route.query.id})">
|
|
|
+ <img src="@/assets/imgs/ppt/icon_action_copy.png" alt="">
|
|
|
+ <span>复制</span>
|
|
|
+ </div>
|
|
|
+ <div class="item-box">
|
|
|
+ <img src="@/assets/imgs/ppt/icon_action_download2.png" alt="">
|
|
|
+ <span>下载</span>
|
|
|
+ </div>
|
|
|
+ <div class="item-box red" @click="handlePPTDel({back:true})" v-if="!PPTOptState.isCommon">
|
|
|
+ <img src="@/assets/imgs/icon_del.png" alt="">
|
|
|
+ <span>删除</span>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
<div class="ppt-content-wrap" v-element-size="onResize">
|
|
|
<template v-for="(item,index) in conArr" :key="item.id">
|
|
|
<component
|
|
@@ -149,7 +190,7 @@ function onSelectPlayOpt(e){
|
|
|
</div>
|
|
|
|
|
|
</div>
|
|
|
- <div class="item border blue">
|
|
|
+ <div class="item border blue" @click="handleDownLoadFile">
|
|
|
<img src="@/assets/imgs/ppt/icon_action_download.png" alt="">
|
|
|
<span>下载</span>
|
|
|
</div>
|
|
@@ -189,6 +230,8 @@ function onSelectPlayOpt(e){
|
|
|
<style lang="scss" scoped>
|
|
|
.ppt-detail-page{
|
|
|
width: 100%;
|
|
|
+ position: relative;
|
|
|
+ overflow: hidden;
|
|
|
.ppt-content-wrap{
|
|
|
width: 100%;
|
|
|
position: absolute;
|
|
@@ -281,4 +324,65 @@ function onSelectPlayOpt(e){
|
|
|
min-width: 150px;
|
|
|
}
|
|
|
}
|
|
|
+.pad-top-action-wrap{
|
|
|
+ display: none;
|
|
|
+}
|
|
|
+
|
|
|
+@media screen and (min-width:$media-width){
|
|
|
+ .ppt-detail-page{
|
|
|
+ margin-top: 60px;
|
|
|
+ }
|
|
|
+ .mobile-fix-bot-warp{
|
|
|
+ display: none;
|
|
|
+ }
|
|
|
+ .pad-top-action-wrap{
|
|
|
+ display: flex;
|
|
|
+ position: fixed;
|
|
|
+ top: 60px;
|
|
|
+ left: 0;
|
|
|
+ right: 0;
|
|
|
+ z-index: 999;
|
|
|
+ height: 60px;
|
|
|
+ background-color: #fff;
|
|
|
+ padding-left: 34px;
|
|
|
+ .item-box{
|
|
|
+ height: 100%;
|
|
|
+ // flex: 1;
|
|
|
+ margin-right: 43px;
|
|
|
+ display: flex;
|
|
|
+ flex-direction: column;
|
|
|
+ justify-content: center;
|
|
|
+ align-items: center;
|
|
|
+ img{
|
|
|
+ width: 20px;
|
|
|
+ }
|
|
|
+ span{
|
|
|
+ font-size: 16px;
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+ .red{
|
|
|
+ color: $theme-red;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ .ppt-copy-wrap{
|
|
|
+ padding: 50px 30px;
|
|
|
+ span{
|
|
|
+ flex-shrink: 0;
|
|
|
+ margin-right: 10px;
|
|
|
+ }
|
|
|
+ :deep(.van-popover__wrapper){
|
|
|
+ flex: 1;
|
|
|
+ }
|
|
|
+ .select-value-box{
|
|
|
+ display: block;
|
|
|
+ height: 40px;
|
|
|
+ line-height: 40px;
|
|
|
+ padding: 0 30px;
|
|
|
+ border-radius: 70px;
|
|
|
+ border: 1px solid $border-color;
|
|
|
+ min-width: 120px;
|
|
|
+ }
|
|
|
+ }
|
|
|
+}
|
|
|
</style>
|