提交 95e1064e authored 作者: 龙菲's avatar 龙菲

修复wps iframe宽度问题

上级 6b888550
<template> <template>
<!-- doc文档的新增或更新笔记--> <!-- doc文档的新增或更新笔记-->
<el-dialog <el-dialog
:title="formData.docId ? '编辑笔记' : '新增笔记'" :title="formData.id ? '编辑笔记' : '新增笔记'"
:visible.sync="dialogVisible" :visible.sync="dialogVisible"
width="500px" width="500px"
:close-on-click-modal="false" :close-on-click-modal="false"
...@@ -9,7 +9,13 @@ ...@@ -9,7 +9,13 @@
:append-to-body="true" :append-to-body="true"
v-loading="loading" v-loading="loading"
> >
<el-form :model="form" label-width="50px" :rules="rules" ref="form" size="mini"> <el-form
:model="form"
label-width="50px"
:rules="rules"
ref="form"
size="mini"
>
<el-form-item label="原文"> <el-form-item label="原文">
<el-input <el-input
type="textarea" type="textarea"
...@@ -92,8 +98,8 @@ export default { ...@@ -92,8 +98,8 @@ export default {
return { return {
dialogVisible: false, //新建笔记窗口可见性 dialogVisible: false, //新建笔记窗口可见性
form: { form: {
id: "", id: "", //笔记ID,新增时没有
docId: "", docId: "", //文档ID
docSType: "doc", //文档类型 docSType: "doc", //文档类型
bookmarkContent: "", //原文 bookmarkContent: "", //原文
noteContent: "", //笔记 noteContent: "", //笔记
...@@ -135,6 +141,11 @@ export default { ...@@ -135,6 +141,11 @@ export default {
for (const key in this.form) { for (const key in this.form) {
if (key == "tagsArr") { if (key == "tagsArr") {
formData.append("tags", this.form.tagsArr.join(",")); formData.append("tags", this.form.tagsArr.join(","));
} else if (key == "id") {
// 只有id有值的时候才append
if (id != "") {
formData.append("id", this.form.id);
}
} else { } else {
formData.append(key, this.form[key]); formData.append(key, this.form[key]);
} }
...@@ -146,6 +157,8 @@ export default { ...@@ -146,6 +157,8 @@ export default {
this.dialogVisible = false; this.dialogVisible = false;
this.$emit("update"); this.$emit("update");
} }
// 清空表单项
this.$refs.form.resetFields()
} }
}); });
}, },
...@@ -189,7 +202,7 @@ export default { ...@@ -189,7 +202,7 @@ export default {
margin-top: 16px; margin-top: 16px;
.el-button + .el-button { .el-button + .el-button {
margin-left: 0; margin-left: 0;
margin-top: 10px; margin-top: 10px;
} }
} }
</style> </style>
...@@ -306,7 +306,7 @@ export default { ...@@ -306,7 +306,7 @@ export default {
color: #999; color: #999;
} }
.note-list { .note-list {
height: calc(100vh - 210px); height: calc(100vh - 270px);
overflow: auto; overflow: auto;
.note-item { .note-item {
margin-bottom: 16px; margin-bottom: 16px;
......
...@@ -47,7 +47,7 @@ export default { ...@@ -47,7 +47,7 @@ export default {
<style lang="scss" scoped> <style lang="scss" scoped>
.panel { .panel {
display: flex; display: flex;
padding: 40px 0 20px; padding: 20px 0;
position: relative; position: relative;
box-sizing: border-box; box-sizing: border-box;
width: 100%; width: 100%;
......
<template> <template>
<div class="wps-reader"> <div
:class="{
'wps-reader': true,
'sidebar-open': $store.state.app.sidebar.opened,
}"
>
<div ref="myIframe" id="wps-container" class="wps-container"></div> <div ref="myIframe" id="wps-container" class="wps-container"></div>
<RightPanel <RightPanel
class="right-panel" class="right-panel"
...@@ -18,6 +23,7 @@ import WebOfficeSDK from "/public/weboffice/web-office-sdk-v1.1.19.es"; ...@@ -18,6 +23,7 @@ import WebOfficeSDK from "/public/weboffice/web-office-sdk-v1.1.19.es";
import RightPanel from "./component/rightPanel.vue"; import RightPanel from "./component/rightPanel.vue";
import AddOrUpdateNoteDialog from "./component/addOrUpdateNoteDialog.vue"; import AddOrUpdateNoteDialog from "./component/addOrUpdateNoteDialog.vue";
import { addNearRead } from "@/api/user"; import { addNearRead } from "@/api/user";
import { mapGetters } from "vuex";
export default { export default {
components: { components: {
RightPanel, RightPanel,
...@@ -35,13 +41,29 @@ export default { ...@@ -35,13 +41,29 @@ export default {
noteContent: "", //笔记内容 noteContent: "", //笔记内容
tagsArr: [], //标签 tagsArr: [], //标签
}, },
// isSidebarOpen:false
}; };
}, },
computed: {
// ...mapGetters(["sidebar"]),
isSidebarOpen() {
return this.$store.state.app.sidebar.opened;
},
},
// watch:{
// 'sidebar.opened':{
// handler(value){
// this.isSidebarOpen =
// },
// immediate:true
// }
// },
mounted() { mounted() {
const { wpsUrl, token, fileId } = this.$route.query; const { wpsUrl, token, fileId } = this.$route.query;
this.routeParams = { wpsUrl, token, fileId }; this.routeParams = { wpsUrl, token, fileId };
this.form.docId = fileId; this.form.docId = fileId;
this.initWps(wpsUrl, token); this.initWps(wpsUrl, token);
console.log("isSidebarOpen", this.isSidebarOpen);
}, },
destroyed() { destroyed() {
this.removeSelectionChangeListener(); this.removeSelectionChangeListener();
...@@ -169,12 +191,28 @@ export default { ...@@ -169,12 +191,28 @@ export default {
.wps-reader { .wps-reader {
display: flex; display: flex;
.wps-container { .wps-container {
width: 80vw; width: calc((100vw - 54px) * 0.8); //默认宽度是sidebar收起的宽度
height: 100vh;
overflow: hidden; overflow: hidden;
} }
.right-panel {
width: calc((100vw - 54px) * 0.2); //默认宽度是sidebar收起的宽度
}
.wps-container,
.right-panel { .right-panel {
width: 20vw; height: calc(100vh - 84px);
transition: all ease 0.5s;
}
}
.sidebar-open {
.wps-container {
width: calc((100vw - 200px) * 0.8); //sidebar展开后的宽度
}
.right-panel {
width: calc((100vw - 200px) * 0.2); //默认宽度是sidebar收起的宽度
} }
} }
.add-note-container { .add-note-container {
...@@ -184,3 +222,8 @@ export default { ...@@ -184,3 +222,8 @@ export default {
padding: 20px; padding: 20px;
} }
</style> </style>
<style>
.web-office-iframe {
width: 100% !important;
}
</style>
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论