inleft
2022-02-17 4d51af31b49927bf401e432138d584f9ef40ef22
commit | author | age
9bcb19 1 <template>
I 2   <a-modal
3     title="在线预览"
4     :footer="null"
5     :width="1500"
6     :visible="visible"
7     @cancel="handleCancel"
8     :destroyOnClose="true"
9   >
10     <a-spin :spinning="divLoading">
11       <div class="editorview" style="height: 800px;">
12         <Editor :option="option"/>
13       </div>
14     </a-spin>
15   </a-modal>
16 </template>
17 <script>
18   import Editor from '../../../components/xnComponents/EditorDiv'
19   import Vue from 'vue'
20   import { ACCESS_TOKEN } from '@/store/mutation-types'
21
22   export default {
23     components: {
24       Editor
25     },
26     data () {
27       return {
28         visible: false,
29         divLoading: false,
30         sysOnlineFileInfoResult: {},
31         option: {
32           url: '',
33           isEdit: false,
34           fileType: '',
35           title: '',
36           token: Vue.ls.get(ACCESS_TOKEN),
37           user: {
38             id: '',
39             name: ''
40           },
41           mode: '',
42           callbackUrl: '',
43           key: '',
44           review: false
45         }
46       }
47     },
48     created () {
49
50     },
51     methods: {
52       /**
53        * 初始化
54        */
55       preview(record, type) {
56         this.visible = true
57         const data = record.data.sysOnlineFileInfoResult
58         this.option.user.id = '1265476890672672808' // data.editorConfig.user.id
59         this.option.user.name = '超级管理员' // data.editorConfig.user.name
60         this.option.fileType = data.document.fileType
61         this.option.title = data.document.title
62         this.option.key = data.document.key
63         this.option.url = process.env.VUE_APP_API_BASE_URL + data.document.url // res.data.docServiceApiUrl
64         this.callbackUrl = process.env.VUE_APP_API_BASE_URL + data.editorConfig.callbackUrl
65         this.option.type = type
66       },
67       handleCancel () {
68         this.visible = false
69         this.option = {
70           url: '',
71             isEdit: false,
72             fileType: '',
73             title: '',
74             token: Vue.ls.get(ACCESS_TOKEN),
75             user: {
76             id: '',
77               name: ''
78           },
79           mode: '',
80             callbackUrl: '',
81             key: '',
82             review: false
83         }
84         const oScript = document.createElement('script')
85         oScript.type = 'text/javascript'
86         oScript.src = ''
87         document.body.appendChild(oScript)
88       }
89     }
90   }
91 </script>
92 <style>
93   .editorview iframe{
94     position: absolute !important;
95   }
96 </style>