jichoi / lms_front star
박민혁 박민혁 08-21
240821 박민혁 문제 수정
@1c6b90ac38fd418a8ae4c6091b402237d608eaf2
client/views/pages/teacher/QuestionDetail.vue
--- client/views/pages/teacher/QuestionDetail.vue
+++ client/views/pages/teacher/QuestionDetail.vue
@@ -206,8 +206,8 @@
                 <div class="flex align-center mb20">
                     <label :for="'file' + i" class="title2">첨부파일</label>
                     <div v-for="(data, index) in prblmDetail.answers[i].fileInfo" :key="index">
-                            <label>{{ data.fileNm }}</label>
-                        </div>
+                        <label>{{ data.fileNm }}</label>
+                    </div>
 
                     <input type="file" :ref="'fileInput' + 1" @change="handleDetailFileUpload(1)" multiple />
                 </div>
@@ -360,6 +360,10 @@
                 vm.dataList = res.data.problem;
                 vm.problemDetail = res.data.problemDetail;
 
+                vm.problemDetail.sort((a, b) => {
+                    return a.prblmDtlId.localeCompare(b.prblmDtlId);
+                });
+
                 vm.selectedSearchOption = vm.dataList.prblmCtgryId;
                 vm.selectedSearchOption2 = vm.dataList.prblmTypeId;
                 vm.book_id = vm.dataList.bookId;
client/views/pages/teacher/QuestionList.vue
--- client/views/pages/teacher/QuestionList.vue
+++ client/views/pages/teacher/QuestionList.vue
@@ -10,68 +10,67 @@
     </div>
     <div class="content-t">
 
-    <label for="" class="title2">단원</label>
-    <div class="unit-pagination flex mt10 mb20" style="gap: 10px;">
-        <button 
-            v-for="(unit, index) in units" 
-            :key="index" 
-            :class="{ 'selected-btn': selectedUnitId === unit.unitId }"
-            @click="selectUnit(unit.unitId)">
-            {{ unit.unitName }}
-        </button>
-    </div>
-    <div class="search-wrap flex justify-end mb20">
-        <select name="" id="" class="mr10 data-wrap" v-model="searchOption">
-            <option value="">전체</option>
-            <option value="prblm_expln">문제</option>
-            <option value="prblm_type_id">유형</option>
-            <option value="user_id">작성자</option>
-        </select>
-        <input type="text" placeholder="검색하세요." v-model="searchKeyword">
-        <button type="button" title="위원회 검색" @click="searchProblems">
-            <img src="../../../resources/img/look_t.png" alt="">
-        </button>
-    </div>
-    <div class="table-wrap">
-        <table>
-            <thead>
-                <tr>
-                    <td>No.</td>
-                    <td>문제</td>
-                    <td>유형</td>
-                   <td>점수</td>
-                   <td>작성자</td>
-                    <td>등록일</td>
-                </tr>
-            </thead>
-            <tbody>
-                <tr v-for="(problem, index) in problems" :key="problem.prblmId" @click="[goToPage('QuestionDetail', selectQuestionList(problem))]">
-                    <td>{{ (currentPage - 1) * 10 + index + 1 }}</td>
-                    <td>{{ problem.prblmExpln }}</td>
-                    <td>{{ problem.prblmTypeNm }}</td>
-                    <td>{{ problem.prblmScr }}</td>
-                    <td>{{ problem.userId }}</td>
-                    <td>{{ problem.regDt}}</td>
-                </tr>
-            </tbody>
-        </table>
-        <article class="table-pagination flex justify-center align-center mb20 mt30" style="gap: 10px;">
-            <button @click="changePage(currentPage - 1)" :disabled="currentPage === 1">
-                <img src="../../../resources/img/btn27_90t_normal.png" alt="Previous">
-            </button>
-            <button v-for="page in paginationButtons" :key="page" @click="changePage(page)" :class="{ 'selected-btn': currentPage === page }">
-                {{ page }}
-            </button>
-            <button @click="changePage(currentPage + 1)" :disabled="currentPage === totalPages">
-                <img src="../../../resources/img/btn28_90t_normal.png" alt="Next">
-            </button>
-        </article>
-        <div class="flex justify-end ">
-            <button type="button" title="등록" class="new-btn" @click="goToPage('QuestionInsert')">
-                등록
+        <label for="" class="title2">단원</label>
+        <div class="unit-pagination flex mt10 mb20" style="gap: 10px;">
+            <button v-for="(unit, index) in units" :key="index"
+                :class="{ 'selected-btn': selectedUnitId === unit.unitId }" @click="selectUnit(unit.unitId)">
+                {{ unit.unitName }}
             </button>
         </div>
-    </div>
+        <div class="search-wrap flex justify-end mb20">
+            <select name="" id="" class="mr10 data-wrap" v-model="searchOption">
+                <option value="">전체</option>
+                <option value="prblm_expln">문제</option>
+                <option value="prblm_type_id">유형</option>
+                <option value="user_id">작성자</option>
+            </select>
+            <input type="text" placeholder="검색하세요." v-model="searchKeyword">
+            <button type="button" title="위원회 검색" @click="searchProblems">
+                <img src="../../../resources/img/look_t.png" alt="">
+            </button>
+        </div>
+        <div class="table-wrap">
+            <table>
+                <thead>
+                    <tr>
+                        <td>No.</td>
+                        <td>문제</td>
+                        <td>유형</td>
+                        <td>점수</td>
+                        <td>작성자</td>
+                        <td>등록일</td>
+                    </tr>
+                </thead>
+                <tbody>
+                    <tr v-for="(problem, index) in problems" :key="problem.prblmId"
+                        @click="[goToPage('QuestionDetail', selectQuestionList(problem))]">
+                        <td>{{ (currentPage - 1) * 10 + index + 1 }}</td>
+                        <td>{{ problem.prblmExpln }}</td>
+                        <td>{{ problem.prblmTypeNm }}</td>
+                        <td>{{ problem.prblmScr }}</td>
+                        <td>{{ problem.userId }}</td>
+                        <td>{{ problem.regDt }}</td>
+                    </tr>
+                </tbody>
+            </table>
+            <article class="table-pagination flex justify-center align-center mb20 mt30" style="gap: 10px;">
+                <button @click="changePage(currentPage - 1)" :disabled="currentPage === 1">
+                    <img src="../../../resources/img/btn27_90t_normal.png" alt="Previous">
+                </button>
+                <button v-for="page in paginationButtons" :key="page" @click="changePage(page)"
+                    :class="{ 'selected-btn': currentPage === page }">
+                    {{ page }}
+                </button>
+                <button @click="changePage(currentPage + 1)" :disabled="currentPage === totalPages">
+                    <img src="../../../resources/img/btn28_90t_normal.png" alt="Next">
+                </button>
+            </article>
+            <div class="flex justify-end ">
+                <button type="button" title="등록" class="new-btn" @click="goToPage('QuestionInsert')">
+                    등록
+                </button>
+            </div>
+        </div>
     </div>
 </template>
 
@@ -85,7 +84,7 @@
         return {
             mdiMagnify: mdiMagnify,
             problems: [],
-            units: [], 
+            units: [],
             books: [],
             currentPage: 1,
             pageSize: 10,
@@ -93,12 +92,17 @@
             searchOption: '',
             searchKeyword: '',
             selectedUnitId: '',
-            selectedBook: "", 
+            selectedBook: "",
         }
     },
     methods: {
         goToPage(page) {
-            this.$router.push({ name: page });
+            this.$router.push({
+                name: page, query: {
+                    book_id: this.selectedBook,
+                    unit_id: this.selectedUnitId,
+                }
+            });
         },
         showConfirm(type) {
             let message = '';
@@ -156,7 +160,7 @@
             })
                 .then(response => {
                     console.log(response.data)
-                    this.books = response.data;  
+                    this.books = response.data;
                 })
                 .catch(error => {
                     console.error("fetchBooks - error: ", error);
@@ -164,7 +168,7 @@
                 });
         },
         fetchUnits() {
-            if (!this.selectedBook) return; 
+            if (!this.selectedBook) return;
 
             axios({
                 url: "/unit/unitList.json",
@@ -178,7 +182,7 @@
             })
                 .then(response => {
                     console.log(response.data)
-                    this.units = response.data; 
+                    this.units = response.data;
                 })
                 .catch(error => {
                     console.error("fetchUnits - error: ", error);
Add a comment
List