Commit 0b38df8b by chenweisong

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

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