Commit 0b38df8b by chenweisong

1 doc文档路径访问方式改动,利用doc id访问文件

2 pdfjs访问文件请求带上了Access-Token参数
parent ab0bc293
......@@ -9,10 +9,10 @@
</template>
<script>
import { Indicator, Toast } from "mint-ui";
import pdf from 'vue-pdf'
import {Indicator, Toast} from "mint-ui";
import pdf from 'vue-pdf'
export default {
export default {
components: {
pdf
},
......@@ -25,8 +25,13 @@ export default {
methods: {
async preview() {
Indicator.open()
let pdfSrc = this.$route.query.pdfSrc ? this.$route.query.pdfSrc : 'https://blog.koley.in/pdfvuer/nationStates.pdf'
this.src = pdf.createLoadingTask(pdfSrc);
let pdfSrc = this.$route.query.pdfSrc;
this.src = pdf.createLoadingTask({
url: pdfSrc,
httpHeaders: {
"Access-Token": this.$store.state.token
}
});
this.src.then(pdf => {
Indicator.close()
this.numPages = pdf.numPages;
......@@ -43,7 +48,7 @@ export default {
if (index !== -1) {
title = title.substr(0, index)
}
this.setTitle({ title: title });
this.setTitle({title: title});
this.preview()
},
mounted() {
......@@ -52,6 +57,6 @@ export default {
beforeDestroy() {
document.getElementById("viewport").setAttribute('content', 'user-scalable=no, width=device-width, minimum-scale=1, initial-scale=1, maximum-scale=1');
},
}
}
</script>
\ No newline at end of file
......@@ -34,7 +34,7 @@
class="tab-body-item list-item">
<div class="mb20 tab-body-item-div">
<img class="icon fl ml20"
:src="l.imgUrl" />
:src="l.imgUrl"/>
<div class="name fl">{{ l.title }}</div>
<span class="clearfix"></span>
</div>
......@@ -79,20 +79,20 @@
</div>
</template>
<script >
import { Swipe, SwipeItem } from 'mint-ui';
import { formatDateTime } from "libs/common/common";
<script>
import {Swipe, SwipeItem} from 'mint-ui';
import {formatDateTime} from "libs/common/common";
// 更多、隐藏
const MORE = 1
const LESS = 2
// // 资讯、专区、材料、报告
// const INFORMATION = 1
// const SPECIALAREA = 2
// const MATERIAL = 3
// const REPORT = 4
// 更多、隐藏
const MORE = 1
const LESS = 2
// // 资讯、专区、材料、报告
// const INFORMATION = 1
// const SPECIALAREA = 2
// const MATERIAL = 3
// const REPORT = 4
export default {
export default {
components: {
"mt-swipe": Swipe,
"mt-swipe-item": SwipeItem,
......@@ -265,7 +265,7 @@ export default {
// openRaw
window.webkit.messageHandlers.openWebView.postMessage(newHref);
} else {
this.$router.push({ path: `/pdf`, query })
this.$router.push({path: `/pdf`, query})
}
},
applicationClick(applicationItem, url, index) {
......@@ -301,7 +301,7 @@ export default {
} else if (query.ua === 'ios') {
window.webkit.messageHandlers.openWebView.postMessage(newHref);
} else {
this.$router.push({ path: `/pdf`, query })
this.$router.push({path: `/pdf`, query})
}
},
async getApplicationList() {
......@@ -367,7 +367,7 @@ export default {
doc.imgUrl = require("../../assets/app/workbench/pdf.png")
// doc.createdTime = this.formatTime(doc.createdTime)
doc.createdTime = doc.createdTime.slice(0, 10)
doc.filePath = 'https://emm.cmccbigdata.com:8443/work/' + doc.filePath
doc.filePath = 'https://emm.cmccbigdata.com:8443/mobile/download?id=' + doc.id
}
data.sort((a, b) => {
return b.id - a.id
......@@ -384,70 +384,79 @@ export default {
this.getApplicationList()
},
mounted() {
this.setTitle({ title: "工作台" });
this.setTitle({title: "工作台"});
this.$store.commit('SAVE_USER', {
userInfo: this.userInfo
})
window.getApplicationList = this.getApplicationList
}
};
};
</script>
<style lang="less">
.pages {
.pages {
.mint-swipe-indicator {
width: 0.2rem;
height: 0.04rem;
opacity: 0.5;
background-color: #ffffff;
}
.mint-swipe-indicator.is-active {
opacity: 1;
background-color: #fff;
}
}
}
</style>
<style lang="less" scoped>
.list-item {
.list-item {
// display: inline-block;
margin-right: 10px;
}
.list-enter-active {
}
.list-enter-active {
transition: all 1s;
}
.list-leave-active {
}
.list-leave-active {
transition: all 0.5s;
}
.list-enter, .list-leave-to
/* .list-leave-active for below version 2.1.8 */ {
}
.list-enter, .list-leave-to
/* .list-leave-active for below version 2.1.8 */ {
opacity: 0;
transform: translateY(30px);
}
}
.pages {
.pages {
font-family: "PingFang SC";
color: #333333;
font-size: 0.28rem;
.contennt {
.tab {
.tab-header {
display: flex;
height: 0.8rem;
overflow: scroll;
.tab-header-item {
color: #999999;
flex: 1;
font-size: 0.28rem;
text-align: center;
min-width: 1.5rem;
span {
font-weight: Medium;
position: relative;
display: inline-block;
line-height: 0.8rem;
}
span.active {
font-weight: bold;
color: #2a82c3;
&:after {
content: "";
width: 100%;
......@@ -459,11 +468,13 @@ export default {
}
}
}
.tab-body {
position: relative;
min-height: 1rem;
padding-top: 0.1rem;
padding-bottom: 0.5rem;
.more,
.less {
position: absolute;
......@@ -471,9 +482,11 @@ export default {
left: 3.55rem;
width: 0.35rem;
}
p {
margin: 0;
}
// .more {
// position: absolute;
// bottom: .1rem;
......@@ -489,29 +502,36 @@ export default {
// line-height: 0.9rem;
padding: 0.15rem 0;
border-bottom: 1px solid #eee;
.tab-body-item-div {
position: relative;
padding-left: 0.6rem;
}
.name {
font-weight: normal;
font-size: 0.24rem;
color: #333;
}
.area,
.date {
font-size: 0.2rem;
color: #999999;
}
.area {
margin-right: 0.3rem;
}
.date {
margin-left: 0.3rem;
}
&:last-of-type {
border-bottom: 0px solid #eee;
}
.icon {
position: absolute;
left: 0;
......@@ -522,20 +542,24 @@ export default {
}
}
}
.swipe {
height: 3rem;
// width: 100%;
padding: 0.16rem 0.26rem;
background-color: #eeeeee;
.swipe-img {
width: 100%;
height: 100%;
border-radius: 0.12rem;
}
}
.item {
min-height: 3rem;
text-align: center;
.item-header {
color: #000;
font-size: 0.3rem;
......@@ -544,17 +568,21 @@ export default {
line-height: 0.8rem;
border-bottom: 1px solid #eee;
}
.item-body {
padding-bottom: 0.2rem;
.item-body-item {
float: left;
padding-top: 0.4rem;
height: 1.48rem;
width: 1.875rem;
img {
width: 0.68rem;
height: 0.72rem;
}
.name {
margin-top: 0.12rem;
}
......@@ -562,9 +590,10 @@ export default {
}
}
}
}
.bg {
}
.bg {
height: 0.12rem;
background-color: #eeeeee;
}
}
</style>
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment