yjryu / KERIS star
박민혁 박민혁 2023-12-01
231201 박민혁 관리자 기술문서 이전 다음 링크 수정
@87ef6e796ad3e4c777b7e8b5fbe3ce04ff7b4e4c
client/views/pages/admin/technology/TechSelectOne.vue
--- client/views/pages/admin/technology/TechSelectOne.vue
+++ client/views/pages/admin/technology/TechSelectOne.vue
@@ -11,7 +11,7 @@
                 <table class="selectone-table">
                     <colgroup>
                         <col width="10%" />
-                         <col width="90%" />
+                        <col width="90%" />
                     </colgroup>
                     <tbody>
                         <tr>
@@ -33,21 +33,21 @@
                         </tr>
                         <tr>
                             <td colspan="2">
-                                <div  v-if="post.ctgry_nm == 'service'">
+                                <div v-if="post.ctgry_nm == 'service'">
                                     <table class="tech-table">
-                                            <tr>
-                                                <th  style="width: 50px;">
-                                                    <p>배포날짜</p>
-                                                </th>
-                                                <td>{{ post.tech_doc_dt }}</td>
-                                            </tr>
-                                            <tr>
-                                                <th>
-                                                    <p>링크</p>
-                                                </th>
-                                                <td>{{ post.link_url }}</td>
-                                            </tr>
-                                        </table>
+                                        <tr>
+                                            <th style="width: 50px;">
+                                                <p>배포날짜</p>
+                                            </th>
+                                            <td>{{ post.tech_doc_dt }}</td>
+                                        </tr>
+                                        <tr>
+                                            <th>
+                                                <p>링크</p>
+                                            </th>
+                                            <td>{{ post.link_url }}</td>
+                                        </tr>
+                                    </table>
                                 </div>
                                 <div class="tech-info" v-else>
                                     <span class="tech-info-img">
@@ -93,10 +93,10 @@
                         </tr>
                         <tr v-if="post.ctgry_nm != 'service'">
                             <td colspan="2" style="border-bottom: 1px solid #007aff;">
-                                <div id="viewer" ref="viewer" class="viewer"></div>
+                                <div v-if="post.ctgry_nm !== 'service'" id="viewer" ref="viewer" class="viewer"></div>
                             </td>
                         </tr>
-                        <tr  v-if="post.ctgry_nm != 'service'">
+                        <tr v-if="post.ctgry_nm != 'service'">
                             <th style="width: 10%;">썸네일</th>
                             <td class="file-list-zone">
                                 <div v-if="thumbnailFileList.length == 0">
@@ -107,7 +107,7 @@
                                 </ul>
                             </td>
                         </tr>
-                        <tr class="file-zone"  v-if="post.ctgry_nm != 'service'">
+                        <tr class="file-zone" v-if="post.ctgry_nm != 'service'">
                             <th style="width: 10%;">첨부파일명</th>
                             <td class="file-list-zone">
                                 <div v-if="attachFileList.length == 0">
@@ -229,7 +229,7 @@
         postSelectOne: function () {
             const vm = this;
             axios({
-                url: '/post/techPostSelectOne.json',
+                url: '/post/techAdPostSelectOne.json',
                 method: 'post',
                 hearder: {
                     'Content-Type': "application/json; charset=UTF-8",
@@ -264,23 +264,25 @@
             })
         },
         getViewer(data) {
-            this.viewer = new Viewer({
-                el: this.$refs.viewer,
-                initialEditType: 'wysiwyg',
-                previewStyle: 'vertical',
-                initialValue: data,
-                customHTMLRenderer: {
-                    htmlBlock: {
-                        iframe(node) {
-                            return [
-                                { type: 'openTag', tagName: 'iframe', outerNewLine: true, attributes: node.attrs },
-                                { type: 'html', content: node.childrenHTML },
-                                { type: 'closeTag', tagName: 'iframe', outerNewLine: true },
-                            ];
-                        },
-                    }
-                },
-            });
+            this.$nextTick(() => {
+                this.viewer = new Viewer({
+                    el: this.$refs.viewer,
+                    initialEditType: 'wysiwyg',
+                    previewStyle: 'vertical',
+                    initialValue: data,
+                    customHTMLRenderer: {
+                        htmlBlock: {
+                            iframe(node) {
+                                return [
+                                    { type: 'openTag', tagName: 'iframe', outerNewLine: true, attributes: node.attrs },
+                                    { type: 'html', content: node.childrenHTML },
+                                    { type: 'closeTag', tagName: 'iframe', outerNewLine: true },
+                                ];
+                            },
+                        }
+                    },
+                });
+            })
         },
 
         downloadFile: function (item) {
@@ -351,7 +353,7 @@
             console.log('------------이동-----------')
             console.log(vm.route)
             axios({
-                url: '/post/techPostSelectOne.json',
+                url: '/post/techAdPostSelectOne.json',
                 method: 'post',
                 hearder: {
                     'Content-Type': "application/json; charset=UTF-8",
@@ -369,16 +371,19 @@
                 vm.fileList = response.data.selectFileList;
                 vm.thumbnailFileList = []
                 vm.attachFileList = []
-                for (let i = 0; i < vm.fileList.length; i++) {
-                    if (vm.fileList[i].file_ty === 'thumbnail') {
-                        vm.thumbnailFileList.push(vm.fileList[i]);
-                    } else {
-                        vm.attachFileList.push(vm.fileList[i]);
+                if (response.data.selectFileList.length != 0) {
+                    vm.fileList = response.data.selectFileList;
+                    vm.thumbnailFileList = [];
+                    vm.attachFileList = [];
+                    for (let i = 0; i < vm.fileList.length; i++) {
+                        if (vm.fileList[i].file_ty === 'thumbnail') {
+                            vm.thumbnailFileList.push(vm.fileList[i]);
+                        } else {
+                            vm.attachFileList.push(vm.fileList[i]);
+                        }
                     }
+                    vm.src = 'http://localhost:8080' + vm.thumbnailFileList[0].file_path.replace('C:', '') + '/' + vm.thumbnailFileList[0].file_nm + '.' + vm.thumbnailFileList[0].file_extn_nm
                 }
-                vm.src = 'http://localhost:8080' + vm.thumbnailFileList[0].file_path.replace('C:', '') + '/' + vm.thumbnailFileList[0].file_nm + '.' + vm.thumbnailFileList[0].file_extn_nm
-
-
                 vm.getViewer(vm.post.post_content)
             }).catch(function (error) {
                 console.log("error - ", error)
Add a comment
List