Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
P
play_office
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
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
template admin
play_office
Commits
532611d1
Commit
532611d1
authored
Nov 11, 2024
by
liujiangnan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
debug
parent
4e95eaab
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
98 additions
and
11 deletions
+98
-11
App.vue
vue-proj/vue-project/src/App.vue
+90
-10
vite.config.js
vue-proj/vue-project/vite.config.js
+8
-1
No files found.
vue-proj/vue-project/src/App.vue
View file @
532611d1
...
...
@@ -42,12 +42,34 @@ window.courseware.getData(async (dt) => {
}
window
.
air
.
hideAirClassLoading
(
'
play_office
'
,
null
);
}
},
'
play_office
'
);
},
'
play_office
'
);
function
renderedHandler
()
{
function
renderedHandler
()
{
window
.
air
.
hideAirClassLoading
(
'
play_office
'
,
null
);
}
function
errorHandler
()
{}
function
errorHandler
()
{
}
const
ppt_iframe
=
ref
(
null
);
function
prevPage
()
{
if
(
ppt_iframe
.
value
)
{
ppt_iframe
.
value
.
contentWindow
.
ExecGoBack
();
}
}
function
nextPage
()
{
if
(
ppt_iframe
.
value
)
{
ppt_iframe
.
value
.
contentWindow
.
ExecNext
();
}
}
const
getProxiedUrl
=
(
url
)
=>
{
try
{
const
urlObj
=
new
URL
(
url
);
return
`/ppt
${
urlObj
.
pathname
}${
urlObj
.
search
}${
urlObj
.
hash
}
`
;
}
catch
(
e
)
{
return
url
;
}
}
</
script
>
...
...
@@ -58,12 +80,21 @@ function errorHandler () {}
<
template
v-if=
"url.indexOf(`.docx`) > 0 || url.indexOf(`.DOCX`) > 0"
>
<vue-office-docx
:src=
"url"
style=
"height: 100vh"
@
rendered=
"renderedHandler"
@
error=
"errorHandler"
/>
</
template
>
<
template
v-if=
"url.indexOf(`.ppt`) > 0 || url.indexOf(`.PPT`) > 0 || url.indexOf(`.pptx`) > 0 || url.indexOf(`.PPTX`) > 0"
>
<div
style=
"height: 100vh"
>
<
template
v-if=
"url.indexOf(`.ppt`) > 0 || url.indexOf(`.PPT`) > 0 || url.indexOf(`.pptx`) > 0 || url.indexOf(`.PPTX`) > 0"
>
<div
style=
"height: 100vh; position: relative;"
>
<div
v-if=
"showErrorMsg"
class=
"error-message"
>
课件正在生成中,请过一会儿再尝试
</div>
<iframe
v-else
frameborder=
"0"
width=
"100%"
height=
"100%"
:src=
"ppt_html"
></iframe>
<iframe
v-else
ref=
"ppt_iframe"
frameborder=
"0"
width=
"100%"
height=
"100%"
:src=
"getProxiedUrl(ppt_html)"
></iframe>
<div
class=
"page-buttons"
>
<button
class=
"arrow-button prev"
@
click=
"prevPage"
>
<span
class=
"arrow left"
></span>
</button>
<button
class=
"arrow-button next"
@
click=
"nextPage"
>
<span
class=
"arrow right"
></span>
</button>
</div>
</div>
</
template
>
</template>
...
...
@@ -77,4 +108,53 @@ function errorHandler () {}
font-size
:
16px
;
color
:
#666
;
}
.page-buttons
{
position
:
fixed
;
right
:
20px
;
bottom
:
20px
;
z-index
:
1000
;
display
:
flex
;
gap
:
10px
;
}
.arrow-button
{
width
:
40px
;
height
:
40px
;
border-radius
:
50%
;
border
:
none
;
background-color
:
#409EFF
;
cursor
:
pointer
;
display
:
flex
;
align-items
:
center
;
justify-content
:
center
;
transition
:
all
0.3s
;
}
.arrow-button
:hover
{
background-color
:
#66b1ff
;
}
.arrow-button
:disabled
{
background-color
:
#c0c4cc
;
cursor
:
not-allowed
;
}
.arrow
{
border
:
solid
white
;
border-width
:
0
2px
2px
0
;
display
:
inline-block
;
padding
:
4px
;
}
.left
{
transform
:
rotate
(
135deg
);
margin-left
:
4px
;
}
.right
{
transform
:
rotate
(
-45deg
);
margin-right
:
4px
;
}
</
style
>
vue-proj/vue-project/vite.config.js
View file @
532611d1
...
...
@@ -6,7 +6,14 @@ import vue from '@vitejs/plugin-vue'
// https://vitejs.dev/config/
export
default
defineConfig
({
server
:
{
port
:
3000
port
:
3000
,
proxy
:
{
'
/ppt
'
:
{
target
:
'
https://teach.cdn.ireadabc.com
'
,
changeOrigin
:
true
,
rewrite
:
(
path
)
=>
path
.
replace
(
/^
\/
ppt/
,
''
)
}
}
},
plugins
:
[
vue
(),
...
...
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