mirror of
https://codeup.aliyun.com/67762337eccfc218f6110e0e/vue/learning-system-portal.git
synced 2025-12-11 20:06:44 +08:00
pdf预览地址加密处理
This commit is contained in:
@@ -20,7 +20,7 @@
|
||||
<!-- <span>案例编号:{{ caseDetail.id }}</span> -->
|
||||
<span v-if="caseDetail.sysCreateTime">{{ caseDetail.sysCreateTime.substring(0,10) }}</span>
|
||||
<interactBar :data="caseDetail" :type="3" :comments="false" :shares="true"></interactBar>
|
||||
|
||||
|
||||
</div>
|
||||
<div class="case-summary"><span>{{ caseDetail.summary }}</span></div>
|
||||
<div class="btn-div" >
|
||||
@@ -138,6 +138,8 @@ import apiUser from '@/api/system/user.js';
|
||||
import author from '@/components/Portal/authorInfo.vue';
|
||||
import apiMessage from '@/api/system/message.js';
|
||||
import apiDict from "@/api/modules/dict.js"
|
||||
import {encrypt} from '@/utils/jsencrypt.js';
|
||||
import cookies from 'vue-cookies'
|
||||
export default {
|
||||
name: 'atticle',
|
||||
components: { portalHeader, portalFooter, interactBar, author, comments,pdfPreview },
|
||||
@@ -168,7 +170,7 @@ export default {
|
||||
this.getCaseData();
|
||||
}
|
||||
this.getAnkingData();
|
||||
this.getPopularity();
|
||||
this.getPopularity();
|
||||
this.getPositive();
|
||||
window.addEventListener(
|
||||
"scroll",
|
||||
@@ -176,9 +178,20 @@ export default {
|
||||
);
|
||||
},
|
||||
methods: {
|
||||
|
||||
|
||||
|
||||
createPlayUrl(u){
|
||||
let nowDate=new Date();
|
||||
let ctime=parseInt(nowDate.getTime()/1000);
|
||||
let beforeUrl=parseInt(nowDate.getTime()/1000)+'/'+u;
|
||||
let urlSign=encodeURIComponent(encrypt(beforeUrl));
|
||||
cookies.set('CASE_TIME', ctime);//写客户端的cookie保存
|
||||
//以下判断是为了区分本地环境和服务器环境
|
||||
if(process.env.NODE_ENV == 'development'){
|
||||
this.pdfPath=process.env.VUE_APP_FILE_BASE_URL+u;
|
||||
}else{
|
||||
this.pdfPath=process.env.VUE_APP_BASE_API+'/xboe/m/course/cware/resource?sign='+urlSign;
|
||||
}
|
||||
//console.log(this.pdfPath,'this.blobUrl');
|
||||
},
|
||||
handleScroll() {
|
||||
let innerHeight = document.querySelector('#case-list-content').clientHeight
|
||||
let outerHeight = document.documentElement.clientHeight
|
||||
@@ -226,11 +239,16 @@ export default {
|
||||
this.caseDetail = res.result;
|
||||
this.getCaseUserDetail();
|
||||
if(this.caseDetail.filePath){
|
||||
this.pdfPath=this.basePath+this.caseDetail.filePath;
|
||||
if(this.caseDetail.filePath){
|
||||
//this.pdfPath=this.basePath+this.caseDetail.filePath;
|
||||
this.createPlayUrl(this.caseDetail.filePath);
|
||||
}else{
|
||||
this.$message.error('无内容文件,请与管理员联系');
|
||||
}
|
||||
}else{
|
||||
this.$message.error('内容文件不存在或已被删除,请与管理员联系');
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
});
|
||||
@@ -354,6 +372,7 @@ export default {
|
||||
.jianjie {
|
||||
margin: 15px 0;
|
||||
background-color: #fff;
|
||||
min-height: 300px;
|
||||
padding: 0px 0px 10px 0px;
|
||||
.content {
|
||||
padding: 10px 0;
|
||||
|
||||
Reference in New Issue
Block a user