mirror of
https://codeup.aliyun.com/67762337eccfc218f6110e0e/vue/learning-system-portal.git
synced 2025-12-10 19:36:43 +08:00
pdf预览地址加密处理
This commit is contained in:
@@ -229,6 +229,7 @@ export default {
|
|||||||
min-height: 300px;
|
min-height: 300px;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
//border: 1px solid #dfdfdf;
|
//border: 1px solid #dfdfdf;
|
||||||
|
background-color: #e9e9e9;
|
||||||
overflow-y: hidden;
|
overflow-y: hidden;
|
||||||
overflow-x: hidden;
|
overflow-x: hidden;
|
||||||
>span{
|
>span{
|
||||||
|
|||||||
@@ -138,6 +138,8 @@ import apiUser from '@/api/system/user.js';
|
|||||||
import author from '@/components/Portal/authorInfo.vue';
|
import author from '@/components/Portal/authorInfo.vue';
|
||||||
import apiMessage from '@/api/system/message.js';
|
import apiMessage from '@/api/system/message.js';
|
||||||
import apiDict from "@/api/modules/dict.js"
|
import apiDict from "@/api/modules/dict.js"
|
||||||
|
import {encrypt} from '@/utils/jsencrypt.js';
|
||||||
|
import cookies from 'vue-cookies'
|
||||||
export default {
|
export default {
|
||||||
name: 'atticle',
|
name: 'atticle',
|
||||||
components: { portalHeader, portalFooter, interactBar, author, comments,pdfPreview },
|
components: { portalHeader, portalFooter, interactBar, author, comments,pdfPreview },
|
||||||
@@ -176,9 +178,20 @@ export default {
|
|||||||
);
|
);
|
||||||
},
|
},
|
||||||
methods: {
|
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() {
|
handleScroll() {
|
||||||
let innerHeight = document.querySelector('#case-list-content').clientHeight
|
let innerHeight = document.querySelector('#case-list-content').clientHeight
|
||||||
let outerHeight = document.documentElement.clientHeight
|
let outerHeight = document.documentElement.clientHeight
|
||||||
@@ -226,7 +239,12 @@ export default {
|
|||||||
this.caseDetail = res.result;
|
this.caseDetail = res.result;
|
||||||
this.getCaseUserDetail();
|
this.getCaseUserDetail();
|
||||||
if(this.caseDetail.filePath){
|
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{
|
}else{
|
||||||
this.$message.error('内容文件不存在或已被删除,请与管理员联系');
|
this.$message.error('内容文件不存在或已被删除,请与管理员联系');
|
||||||
}
|
}
|
||||||
@@ -354,6 +372,7 @@ export default {
|
|||||||
.jianjie {
|
.jianjie {
|
||||||
margin: 15px 0;
|
margin: 15px 0;
|
||||||
background-color: #fff;
|
background-color: #fff;
|
||||||
|
min-height: 300px;
|
||||||
padding: 0px 0px 10px 0px;
|
padding: 0px 0px 10px 0px;
|
||||||
.content {
|
.content {
|
||||||
padding: 10px 0;
|
padding: 10px 0;
|
||||||
|
|||||||
Reference in New Issue
Block a user