Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
H
hu-shoujijingfen-h5
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
chenweisong
hu-shoujijingfen-h5
Commits
0b38df8b
Commit
0b38df8b
authored
Aug 04, 2020
by
chenweisong
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
1 doc文档路径访问方式改动,利用doc id访问文件
2 pdfjs访问文件请求带上了Access-Token参数
parent
ab0bc293
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
54 additions
and
50 deletions
+54
-50
pdf.vue
src/views/app/pdf.vue
+54
-50
workbench.vue
src/views/app/workbench.vue
+0
-0
No files found.
src/views/app/pdf.vue
View file @
0b38df8b
<
template
>
<div>
<pdf
v-for=
"i in numPages"
:key=
"i"
:src=
"src"
:page=
"i"
style=
"display: block; width: 100%"
></pdf>
</div>
<div>
<pdf
v-for=
"i in numPages"
:key=
"i"
:src=
"src"
:page=
"i"
style=
"display: block; width: 100%"
></pdf>
</div>
</
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
{
components
:
{
pdf
},
data
()
{
return
{
src
:
''
,
numPages
:
undefined
,
export
default
{
components
:
{
pdf
},
data
()
{
return
{
src
:
''
,
numPages
:
undefined
,
}
},
methods
:
{
async
preview
()
{
Indicator
.
open
()
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
;
}).
catch
(
error
=>
{
Toast
(
"网络出错"
);
Indicator
.
close
()
});
}
},
created
()
{
let
title
=
this
.
$route
.
query
.
title
let
index
=
title
.
lastIndexOf
(
'.pdf'
)
// console.log('index :', index)
if
(
index
!==
-
1
)
{
title
=
title
.
substr
(
0
,
index
)
}
this
.
setTitle
({
title
:
title
});
this
.
preview
()
},
mounted
()
{
document
.
getElementById
(
"viewport"
).
setAttribute
(
'content'
,
'user-scalable=yes, width=device-width, minimum-scale=0.5, initial-scale=1, maximum-scale=3'
);
},
beforeDestroy
()
{
document
.
getElementById
(
"viewport"
).
setAttribute
(
'content'
,
'user-scalable=no, width=device-width, minimum-scale=1, initial-scale=1, maximum-scale=1'
);
},
}
},
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
);
this
.
src
.
then
(
pdf
=>
{
Indicator
.
close
()
this
.
numPages
=
pdf
.
numPages
;
}).
catch
(
error
=>
{
Toast
(
"网络出错"
);
Indicator
.
close
()
});
}
},
created
()
{
let
title
=
this
.
$route
.
query
.
title
let
index
=
title
.
lastIndexOf
(
'.pdf'
)
// console.log('index :', index)
if
(
index
!==
-
1
)
{
title
=
title
.
substr
(
0
,
index
)
}
this
.
setTitle
({
title
:
title
});
this
.
preview
()
},
mounted
()
{
document
.
getElementById
(
"viewport"
).
setAttribute
(
'content'
,
'user-scalable=yes, width=device-width, minimum-scale=0.5, initial-scale=1, maximum-scale=3'
);
},
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
src/views/app/workbench.vue
View file @
0b38df8b
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment