zhuoyuan.wang
2024-06-19 15ebe96f28cadec6a726c5324593a40bbf56205f
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
<template>
  <app-page-form v-bind="pageFormProps" v-loading="appStore.getLoading('getEntity')">
  <div class="editor-content-view" v-html="htmlValue"></div>
  </app-page-form>
</template>
 
<script setup>
 
import {closeTab} from '@/utils/iframe.js';
import {useAppStore, useEntityStore} from "@/store/modules";
import {convertFilter} from "@/utils/filter.js";
import * as baseApi from "@/api/index.js";
 
const entityStore = useEntityStore();
const appStore = useAppStore();
 
const router = useRouter();
 
const params = router.currentRoute.value.query;
 
const htmlValue = ref('');
 
onMounted(async () => {
  if (params.id) {
    const {data} = await entityStore.getEntity({
      dataName: "affiche",
      filter: convertFilter({
        andEqParams: {
          id: params.id
        }
      })
    });
 
    const content = await baseApi.file.getFileText(data.affiche.file_id);
    htmlValue.value = content;
  }
});
 
const pageFormProps = {
  subClose() {
    closeTab();
  },
  submitDom: false,
  resetDom: false,
}
 
</script>
 
<style lang="scss">
.editor-content-view {
 
  p, li {
    white-space: pre-wrap; /* 保留空格 */
  }
 
  blockquote {
    border-left: 8px solid #d0e5f2;
    padding: 10px 10px;
    margin: 10px 0;
    background-color: #f1f1f1;
  }
 
  code {
    font-family: monospace;
    padding: 3px;
    border-radius: 3px;
  }
 
  pre{
    code {
      background-color: #eee;
    }
  }
 
  pre > code {
    display: block;
    padding: 10px;
  }
 
  table {
    border-collapse: collapse;
  }
 
  td, th {
    border: 1px solid #ccc;
    min-width: 50px;
    height: 20px;
  }
 
  th {
    background-color: #f1f1f1;
  }
 
  ul, ol {
    padding-left: 20px;
  }
 
  input[type="checkbox"] {
    margin-right: 5px;
  }
}
</style>