박정하 박정하 03-28
250328 박정하 메인화면 링크 및 통합 검색 파라미터 연결
@82c555fef9e85af2ee0ab6f3b3d5fe9871ea25f3
client/views/component/listLayout/CardViewList.vue
--- client/views/component/listLayout/CardViewList.vue
+++ client/views/component/listLayout/CardViewList.vue
@@ -5,7 +5,7 @@
         <img :src="resulticon" alt="">
         <p>총 <b>{{ count }}개</b>의 {{ helpText }}</p>
       </div>
-      <button type="button" class="gopage" @click="fnMoveTo(routeName, null)">모두보기</button>
+      <button type="button" class="gopage" @click="fnMoveTo">모두보기</button>
     </div>
     <div v-if="list.length > 0">
       <CardStyleComponent :name="name" :list="list" />
@@ -38,6 +38,10 @@
       type: Array,
       default: () => [],
     },
+    params: {
+      type: Object,
+      default: () => { },
+    },
   },
 
   data() {
@@ -58,27 +62,24 @@
           return '보도자료가 검색되었습니다.';
       }
     },
-    routeName() {
-      switch (this.name) {
-        case 'P':
-          return 'PicHistorySearch';
-        case 'V':
-          return '영상 기록물';
-        case 'M':
-          return '미디어 영상';
-        case 'N':
-          return '보도자료';
-      }
-    },
   },
 
   methods: {
     // 페이지 이동
-    fnMoveTo(page, id) {
-      if (id !== null || id !== '') {
-        this.$router.push({ name: page, query: { id: id } });
-      } else {
-        this.$router.push({ name: page });
+    fnMoveTo() {
+      switch (this.name) {
+        case 'P':
+          this.$router.push({ name: 'PicHistorySearch', query: this.params });
+          break;
+        case 'V':
+          this.$router.push({ name: 'VideoHistorySearch', query: this.params });
+          break;
+        case 'M':
+          this.$router.push({ name: 'MediaVideoSearch', query: this.params });
+          break;
+        case 'N':
+          this.$router.push({ name: 'NewsReleaseSearch', query: this.params });
+          break;
       }
     }
   },
client/views/pages/bbsDcry/photo/PicHistoryDetail.vue
--- client/views/pages/bbsDcry/photo/PicHistoryDetail.vue
+++ client/views/pages/bbsDcry/photo/PicHistoryDetail.vue
@@ -144,7 +144,7 @@
 
   created() {
     this.pageId = this.$route.query.id;
-    if (this.pageId === null) {
+    if (this.$isEmpty(this.pageId)) {
       alert("게시물 존재하지 않습니다.");
       this.fnMoveTo('list');
     }
client/views/pages/bbsDcry/photo/PicHistorySearch.vue
--- client/views/pages/bbsDcry/photo/PicHistorySearch.vue
+++ client/views/pages/bbsDcry/photo/PicHistorySearch.vue
@@ -203,24 +203,39 @@
       if (this.isInitialLoad) {
         this.isInitialLoad = false;
 
-        let searchText = this.$route.query.searchText;
-        if (searchText !== null) {
-          this.searchReqDTO.searchText = searchText;
-        }
+        this.queryParamsToSearch();
       } else {
         if (!confirm('검색 조건을 초기화하시겠습니까?')) {
           return;
         }
       }
 
+      this.searchReqDTO.searchTy = "P"; // 사진 기록물 고정
+      this.selectedTabId = this.tabs[0].id;
+
       this.searchReqDTO = JSON.parse(JSON.stringify(this.searchDefault));
       this.searchResult = []; // 검색결과 초기화
 
-      this.selectedTabId = this.tabs[0].id;
-
       this.fnSearch(); // 통합검색
     },
 
+    queryParamsToSearch() {
+      let query = this.$route.query;
+      if (!this.$isEmpty(query)) {
+        const typeConverters = {
+          useSj: val => val === 'true',
+          useCn: val => val === 'true',
+          useAdres: val => val === 'true',
+          searchCtgries: val => Array.isArray(val) ? val : (val ? val.split(',') : [])
+        };
+        Object.entries(query).forEach(([key, value]) => {
+          if (key in this.searchDefault) {
+            this.searchDefault[key] = key in typeConverters ? typeConverters[key](value) : value;
+          }
+        });
+      }
+    },
+
     // 카테고리 목록 조회
     async fnFindCategorys() {
       try {
client/views/pages/bbsDcry/video/VideoHistoryDetail.vue
--- client/views/pages/bbsDcry/video/VideoHistoryDetail.vue
+++ client/views/pages/bbsDcry/video/VideoHistoryDetail.vue
@@ -95,7 +95,7 @@
 
   created() {
     this.pageId = this.$route.query.id;
-    if (this.pageId === null) {
+    if (this.$isEmpty(this.pageId)) {
       alert("게시물 존재하지 않습니다.");
       this.fnMoveTo('list');
     }
client/views/pages/bbsDcry/video/VideoHistorySearch.vue
--- client/views/pages/bbsDcry/video/VideoHistorySearch.vue
+++ client/views/pages/bbsDcry/video/VideoHistorySearch.vue
@@ -203,24 +203,39 @@
       if (this.isInitialLoad) {
         this.isInitialLoad = false;
 
-        let searchText = this.$route.query.searchText;
-        if (searchText !== null) {
-          this.searchReqDTO.searchText = searchText;
-        }
+        this.queryParamsToSearch();
       } else {
         if (!confirm('검색 조건을 초기화하시겠습니까?')) {
           return;
         }
       }
 
+      this.searchReqDTO.searchTy = "V"; // 영상 기록물 고정
+      this.selectedTabId = this.tabs[0].id;
+
       this.searchReqDTO = JSON.parse(JSON.stringify(this.searchDefault));
       this.searchResult = []; // 검색결과 초기화
 
-      this.selectedTabId = this.tabs[0].id;
-
       this.fnChnageReqDTO(); // 통합검색
     },
 
+    queryParamsToSearch() {
+      let query = this.$route.query;
+      if (!this.$isEmpty(query)) {
+        const typeConverters = {
+          useSj: val => val === 'true',
+          useCn: val => val === 'true',
+          useAdres: val => val === 'true',
+          searchCtgries: val => Array.isArray(val) ? val : (val ? val.split(',') : [])
+        };
+        Object.entries(query).forEach(([key, value]) => {
+          if (key in this.searchDefault) {
+            this.searchDefault[key] = key in typeConverters ? typeConverters[key](value) : value;
+          }
+        });
+      }
+    },
+
     // 카테고리 목록 조회
     async fnFindCategorys() {
       try {
client/views/pages/bbsMediaVido/MediaVideoDetail.vue
--- client/views/pages/bbsMediaVido/MediaVideoDetail.vue
+++ client/views/pages/bbsMediaVido/MediaVideoDetail.vue
@@ -96,7 +96,7 @@
 
   created() {
     this.pageId = this.$route.query.id;
-    if (this.pageId === null) {
+    if (this.$isEmpty(this.pageId)) {
       alert("게시물 존재하지 않습니다.");
       this.fnMoveTo('list');
     }
client/views/pages/bbsMediaVido/MediaVideoSearch.vue
--- client/views/pages/bbsMediaVido/MediaVideoSearch.vue
+++ client/views/pages/bbsMediaVido/MediaVideoSearch.vue
@@ -196,24 +196,37 @@
       if (this.isInitialLoad) {
         this.isInitialLoad = false;
 
-        let searchText = this.$route.query.searchText;
-        if (searchText !== null) {
-          this.searchReqDTO.searchText = searchText;
-        }
+        this.queryParamsToSearch();
       } else {
         if (!confirm('검색 조건을 초기화하시겠습니까?')) {
           return;
         }
       }
 
+      this.selectedTabId = this.tabs[0].id;
+
       this.searchReqDTO = JSON.parse(JSON.stringify(this.searchDefault));
       this.searchResult = []; // 검색결과 초기화
 
-      this.selectedTabId = this.tabs[0].id;
-
       this.fnChnageReqDTO(); // 통합검색
     },
 
+    queryParamsToSearch() {
+      let query = this.$route.query;
+      if (!this.$isEmpty(query)) {
+        const typeConverters = {
+          useSj: val => val === 'true',
+          useCn: val => val === 'true',
+          searchCtgries: val => Array.isArray(val) ? val : (val ? val.split(',') : [])
+        };
+        Object.entries(query).forEach(([key, value]) => {
+          if (key in this.searchDefault) {
+            this.searchDefault[key] = key in typeConverters ? typeConverters[key](value) : value;
+          }
+        });
+      }
+    },
+
     // 카테고리 목록 조회
     async fnFindCategorys() {
       try {
client/views/pages/bbsNesDta/NewsReleaseDetail.vue
--- client/views/pages/bbsNesDta/NewsReleaseDetail.vue
+++ client/views/pages/bbsNesDta/NewsReleaseDetail.vue
@@ -100,7 +100,7 @@
 
   created() {
     this.pageId = this.$route.query.id;
-    if (this.pageId === null) {
+    if (this.$isEmpty(this.pageId)) {
       alert("게시물 존재하지 않습니다.");
       this.fnMoveTo('list');
     }
client/views/pages/bbsNesDta/NewsReleaseSearch.vue
--- client/views/pages/bbsNesDta/NewsReleaseSearch.vue
+++ client/views/pages/bbsNesDta/NewsReleaseSearch.vue
@@ -197,24 +197,37 @@
       if (this.isInitialLoad) {
         this.isInitialLoad = false;
 
-        let searchText = this.$route.query.searchText;
-        if (searchText !== null) {
-          this.searchReqDTO.searchText = searchText;
-        }
+        this.queryParamsToSearch();
       } else {
         if (!confirm('검색 조건을 초기화하시겠습니까?')) {
           return;
         }
       }
 
+      this.selectedTabId = this.tabs[0].id;
+
       this.searchReqDTO = JSON.parse(JSON.stringify(this.searchDefault));
       this.searchResult = []; // 검색결과 초기화
 
-      this.selectedTabId = this.tabs[0].id;
-
       this.fnChnageReqDTO(); // 통합검색
     },
 
+    queryParamsToSearch() {
+      let query = this.$route.query;
+      if (!this.$isEmpty(query)) {
+        const typeConverters = {
+          useSj: val => val === 'true',
+          useCn: val => val === 'true',
+          searchCtgries: val => Array.isArray(val) ? val : (val ? val.split(',') : [])
+        };
+        Object.entries(query).forEach(([key, value]) => {
+          if (key in this.searchDefault) {
+            this.searchDefault[key] = key in typeConverters ? typeConverters[key](value) : value;
+          }
+        });
+      }
+    },
+
     // 카테고리 목록 조회
     async fnFindCategorys() {
       try {
client/views/pages/main/Main.vue
--- client/views/pages/main/Main.vue
+++ client/views/pages/main/Main.vue
@@ -23,7 +23,7 @@
     </swiper>
     <div class="search-wrap">
       <div class="search-area">
-        <select name="" id="">
+        <select name="" id="" v-model="searchRecord">
           <option value="all" selected>전체</option>
           <option value="pic">사진</option>
           <option value="video">영상</option>
@@ -31,11 +31,11 @@
           <option value="bodo">보도자료</option>
         </select>
         <div class="line"></div>
-        <input type="text" placeholder="검색어를 입력하세요" v-model="searchText">
-        <button class="search-btn"><img :src="search" alt=""></button>
+        <input type="text" placeholder="검색어를 입력하세요" v-model="searchText" @keyup.enter="fnMoveTo('TotalSearch')">
+        <button type="button" class="search-btn" @click="fnMoveTo('TotalSearch')"><img :src="search" alt=""></button>
       </div>
       <div class="total-search">
-        <button class="total-btn" @click="fnMoveTo('TotalSearch')">상세검색</button>
+        <button type="button" class="total-btn" @click="fnMoveTo('TotalSearch')">상세검색</button>
       </div>
     </div>
   </div>
@@ -50,7 +50,9 @@
           <li class="line" v-if="idx < icons.length - 1"></li>
         </template>
       </ul>
-      <div class="current-banner"><div><span>기록물 현황</span><img :src="direct" alt=""></div></div>
+      <div class="current-banner">
+        <div><span>기록물 현황</span><img :src="direct" alt=""></div>
+      </div>
     </div>
   </div>
   <div class="new-update w1500 mb-50">
@@ -64,14 +66,14 @@
       <div class="tab-content">
         <template v-for="(tabContent, idx1) of tabContents" :key="idx1">
           <div v-show="tabContent.id === selectedTab" class="content-wrap">
-            <router-link :to="{ path: '/' }" class="gopage">더보기</router-link>
+            <router-link :to="{ name: tabContent.search }" class="gopage">더보기</router-link>
             <div class="new-pic">
               <div v-for="(item, idx2) in tabContent.list" :key="idx2" class="box-wrap">
-                <div class="box">
+                <div class="box" @click="fnMoveTo(tabContent.view, item.dcryId)">
                   <img :src="item.hasOwnProperty('files') && item.files.length > 0 ? item.files[0].filePath : null" :alt="item.sj" class="tab-image" />
                   <div class="info">
                     <p>{{ item.sj }}</p>
-                    <span>{{ item.rgsde.slice(0, -6) }}</span>
+                    <span>{{ $dotFormatDate(item.rgsde) }}</span>
                   </div>
                 </div>
               </div>
@@ -94,19 +96,21 @@
     <div class="new-media">
       <div class="title mb-30">
         <h4>신규 미디어 영상</h4>
-        <router-link :to="{ path: '/' }" class="gopage">더보기</router-link>
+        <router-link :to="{ name: 'MediaVideoSearch' }" class="gopage">더보기</router-link>
       </div>
       <div class="media-wrap">
-        <div v-for="(mediaContent, index) in mediaContent" :key="index" class="media-box">
-          <img :src="mediaContent.url" :alt="mediaContent.title" class="media-image" />
-          <div class="info">
-            <p>{{ mediaContent.content }}</p>
-            <span>{{ mediaContent.date }}</span>
+        <template v-for="(item, index) of mediaContents" :key="index">
+          <div class="media-box" @click="fnMoveTo('MediaVideoDetail', item.mediaVidoId)">
+            <img :src="item.url" :alt="item.sj" class="media-image" />
+            <div class="info">
+              <p>{{ item.sj }}</p>
+              <span>{{ $dotFormatDate(item.rgsde) }}</span>
+            </div>
           </div>
-        </div>
+        </template>
         <!-- 게시글이 없는 경우 -->
-        <div v-for="i in Math.max(0, 2 - mediaContent.length)" :key="`empty-${i}`" class="media-box">
-          <img :src="nomedia" :alt="mediaContent.title" class="media-image" />
+        <div v-for="i in Math.max(0, 2 - mediaContents.length)" :key="`empty-${i}`" class="media-box">
+          <img :src="nomedia" alt="" class="media-image" />
           <div class="info">
             <p>등록된 게시글이 없습니다.</p>
           </div>
@@ -116,15 +120,17 @@
     <div class="new-bodo">
       <div class="title mb-30">
         <h4>신규 보도 자료</h4>
-        <router-link :to="{ path: '/' }" class="gopage">더보기</router-link>
+        <router-link :to="{ name: 'NewsReleaseSearch' }" class="gopage">더보기</router-link>
       </div>
       <ul>
-        <li v-for="(bodoContent, index) in bodoContent" :key="index" class="info">
-          <p>{{ bodoContent.content }}</p>
-          <span>{{ bodoContent.date }}</span>
-        </li>
+        <template v-for="(item, index) of bodoContents" :key="index">
+          <li class="info" @click="fnMoveTo('NewsReleaseDetail', item.nesDtaId)">
+            <p>{{ item.sj }}</p>
+            <span>{{ $dotFormatDate(item.rgsde) }}</span>
+          </li>
+        </template>
         <!-- 게시글이 없는 경우 -->
-        <li v-if="bodoContent.length < 1" class="info">
+        <li v-if="bodoContents.length < 1" class="info">
           <img :src="nobodo" alt="">
         </li>
       </ul>
@@ -188,8 +194,9 @@
         },
       ],
       tabContents: [], // 신규 사진, 영상 기록물
-      mediaContent: [], // 신규 미디어 영상
-      bodoContent: [], // 신규 보도자료
+      mediaContents: [], // 신규 미디어 영상
+      bodoContents: [], // 신규 보도자료
+      searchRecord: 'all', // 통합검색 Selectbox 내용
       searchText: null, // 통합검색 Input 내용
       icons: [
         {
@@ -277,16 +284,16 @@
           });
 
           let photoDcrys = response.data.data.photoDcrys;
-          this.tabContents.push({ id: 'newPhoto', list: photoDcrys });
+          this.tabContents.push({ id: 'newPhoto', list: photoDcrys, search: 'PicHistorySearch', view: 'PicHistoryDetail' });
 
           let vidoDcrys = response.data.data.vidoDcrys;
-          this.tabContents.push({ id: 'newVideo', list: vidoDcrys });
+          this.tabContents.push({ id: 'newVideo', list: vidoDcrys, search: 'VideoHistorySearch', view: 'VideoHistoryDetail' });
 
           let mediaVidos = response.data.data.mediaVidos;
-          this.mediaContent = this.onChangeList(mediaVidos);
+          this.mediaContents = this.onChangeList(mediaVidos);
 
           let nesDtas = response.data.data.nesDtas;
-          this.bodoContent = this.onChangeList(nesDtas);
+          this.bodoContents = this.onChangeList(nesDtas);
         } else {
           alert(response.data.message);
         }
@@ -296,8 +303,6 @@
     },
     // 목록 변환
     onChangeList(list) {
-      let resultArr = [];
-
       for (let item of list) {
         let url = null;
 
@@ -309,29 +314,25 @@
           url = getYouTubeThumbnail(item.link);
         }
 
-        resultArr.push({
-          content: item.sj,
-          date: item.rgsde.slice(0, -6),
-          url: url
-        });
+        item.url = url;
       }
 
-      return resultArr;
+      return list;
     },
 
     // 페이지 이동
-    fnMoveTo(page) {
-      let params = null;
+    fnMoveTo(page, id) {
+      console.log("!! ", id);
       if (page === 'TotalSearch') {
-        params = { searchText: this.searchText };
+        this.$router.push({ name: page, query: { searchRecord: this.searchRecord, searchText: this.searchText }, });
+      } else {
+        if (this.$isEmpty(id)) {
+          this.$router.push({ name: page });
+        } else {
+          this.$router.push({ name: page, query: { id: id } });
+        }
       }
-
-      this.$router.push({
-        name: page,
-        query: params,
-      });
     }
   },
 };
-</script>
-<style scoped></style>
+</script>
(파일 끝에 줄바꿈 문자 없음)
client/views/pages/main/TotalSearch.vue
--- client/views/pages/main/TotalSearch.vue
+++ client/views/pages/main/TotalSearch.vue
@@ -102,7 +102,7 @@
       </dl>
     </div>
     <div class="search-result">
-      <CardViewList v-for="(item, idx) of searchResult" :key="idx" :name="item.key" :count="item.count" :list="item.list" />
+      <CardViewList v-for="(item, idx) of searchResult" :key="idx" :name="item.key" :count="item.count" :list="item.list" :params="params" />
     </div>
   </div>
 </template>
@@ -164,7 +164,9 @@
 
       searchResult: [], // 검색결과
 
-      isInitialLoad: true // 초기 로드 여부
+      isInitialLoad: true, // 초기 로드 여부
+
+      params: {},
     };
   },
 
@@ -174,6 +176,47 @@
   },
 
   mounted() {
+    let searchRecord = this.$route.query.searchRecord;
+    if (!this.$isEmpty(searchRecord)) {
+      switch (searchRecord) {
+        case 'pic':
+          this.isChkAllRecord = false;
+          this.searchReqDTO.usePhoto = true;
+          this.searchReqDTO.useVideo = false;
+          this.searchReqDTO.useMedia = false;
+          this.searchReqDTO.useNews = false;
+          break;
+        case 'video':
+          this.isChkAllRecord = false;
+          this.searchReqDTO.usePhoto = false;
+          this.searchReqDTO.useVideo = true;
+          this.searchReqDTO.useMedia = false;
+          this.searchReqDTO.useNews = false;
+          break;
+        case 'media':
+          this.isChkAllRecord = false;
+          this.searchReqDTO.usePhoto = false;
+          this.searchReqDTO.useVideo = false;
+          this.searchReqDTO.useMedia = true;
+          this.searchReqDTO.useNews = false;
+          break;
+        case 'bodo':
+          this.isChkAllRecord = false;
+          this.searchReqDTO.usePhoto = false;
+          this.searchReqDTO.useVideo = false;
+          this.searchReqDTO.useMedia = false;
+          this.searchReqDTO.useNews = true;
+          break;
+        default:
+          this.isChkAllRecord = true;
+          this.searchReqDTO.usePhoto = true;
+          this.searchReqDTO.useVideo = true;
+          this.searchReqDTO.useMedia = true;
+          this.searchReqDTO.useNews = true;
+          break;
+      }
+    }
+
     let searchText = this.$route.query.searchText;
     if (searchText !== null) {
       this.searchReqDTO.searchText = searchText;
@@ -233,6 +276,8 @@
           delete params.searchCtgries;
         }
 
+        this.params = params; // 바로가기 링크 전달을 위해 저장
+
         // API 호출
         const response = await findAllDatas(params);
         this.searchResult = response.data.data.searchResult;
Add a comment
List