jichoi / lms_front star
guntaek 09-19
240919 김건택 aidashboard 문제 수정
@2e4c67925025da0cd562ca5f695fb6f0562fc9f6
client/views/pages/AppStore.js
--- client/views/pages/AppStore.js
+++ client/views/pages/AppStore.js
@@ -37,6 +37,9 @@
 
         // 순서
         seqNum: null,
+
+        // 현재 대시보드
+        currentDashboard: null,
     };
 }
 
@@ -87,6 +90,11 @@
             return state.wdBookIdList;
         },
         getCurrentWdBkIndex: (state) => state.currentWdBkIndex,
+
+        // 대시보드 위치
+        getCurrentDashboard(state) {
+            return state.currentDashboard;
+        }
     },
     mutations: {
 
@@ -114,6 +122,10 @@
             state.wdBookIdList = [],
                 state.currentWdBkIndex = 0;
             state.seqNum = null;
+
+            // 대시보드 위치
+            state.currentDashboard = null;
+
             saveStateToLocalStorage(state);
         },
 
@@ -168,6 +180,11 @@
             state.prblmTypeId = payload.prblmTypeId;
             // 순서
             state.seqNum = payload.seqNum;
+            saveStateToLocalStorage(state);
+        },
+        // 대시보드 위치
+        setCurrentDashboard(state, currentDashboard) {
+            state.currentDashboard = currentDashboard;
             saveStateToLocalStorage(state);
         },
         incrementProblemIndex(state) {
@@ -293,5 +310,9 @@
         // updateSeqNum({ commit }) {
         //   commit("setSeqNum", seqNum);
         // },
+        
+        updateCurrentDashboard({ commit }, dashboard) {
+            commit("setCurrentDashboard", dashboard);
+        },
     },
 });
client/views/pages/main/Chapter/Chapter2_10.vue
--- client/views/pages/main/Chapter/Chapter2_10.vue
+++ client/views/pages/main/Chapter/Chapter2_10.vue
@@ -138,11 +138,29 @@
   },
   methods: {
     complete() {
-      const { unit_id, book_id } = this.$route.query;
-      this.$router.push({
-        name: "Dashboard",
-        query: { value: this.seq, unit_id, book_id },
-      });
+      // 로컬 스토리지에서 currentDashboard 값을 가져옴
+      const savedState = localStorage.getItem("vuexState");
+      if (savedState) {
+        const parsedState = JSON.parse(savedState);
+        const currentDashboard = parsedState.currentDashboard;
+
+        const { unit_id, book_id } = this.$route.query;
+        if (currentDashboard === "Learning") {
+          // Learning 모드일 때 Dashboard로 이동
+          this.$router.push({
+            name: "Dashboard",
+            query: { value: this.seq, unit_id, book_id },
+          });
+        } else if (currentDashboard === "AI") {
+          // AI 모드일 때 AIDashboard로 이동
+          this.$router.push({
+            name: "AIDashboard",
+            query: { value: this.seq, unit_id, book_id },
+          });
+        }
+      } else {
+        console.error("currentDashboard 값이 없습니다.");
+      }
     },
     goToPage(page) {
       this.$router.push({ name: page });
@@ -244,27 +262,89 @@
       }
     },
 
-    fetchProblemData() {
-      axios({
-        url: "/problem/problemInfo.json",
-        method: "post",
-        headers: {
-          "Content-Type": "application/json; charset=UTF-8",
-        },
-        data: {
-          prblmId: this.prblm_id.prblm_id,
-        },
-      })
-        .then((response) => {
-          this.problemData = response.data;
-          console.log("problemData", this.problemData);
+    // fetchProblemData() {
+    //   axios({
+    //     url: "/problem/problemInfo.json",
+    //     method: "post",
+    //     headers: {
+    //       "Content-Type": "application/json; charset=UTF-8",
+    //     },
+    //     data: {
+    //       prblmId: this.prblm_id.prblm_id,
+    //     },
+    //   })
+    //     .then((response) => {
+    //       this.problemData = response.data;
+    //       console.log("problemData", this.problemData);
 
-          this.sortingProblem();
-        })
-        .catch((error) => {
-          this.state = "noProblem";
-          console.error("Error fetching problemData:", error);
-        });
+    //       this.sortingProblem();
+    //     })
+    //     .catch((error) => {
+    //       this.state = "noProblem";
+    //       console.error("Error fetching problemData:", error);
+    //     });
+    // },
+
+    fetchProblemData() {
+      // 로컬 스토리지에서 currentDashboard를 확인
+      const savedState = localStorage.getItem("vuexState");
+      if (savedState) {
+        const parsedState = JSON.parse(savedState);
+        const currentDashboard = parsedState.currentDashboard;
+
+        if (currentDashboard === "AI") {
+          // AI 모드일 경우 로컬 스토리지에서 currentLearningId를 가져와 사용
+          const currentLearningId = parsedState.currentLearningIds;
+          console.log("AI 모드에서 currentLearningId 사용:", currentLearningId);
+
+          // currentLearningId로 문제 데이터 가져오기
+          axios({
+            url: "/problem/problemInfo.json",
+            method: "post",
+            headers: {
+              "Content-Type": "application/json; charset=UTF-8",
+            },
+            data: {
+              prblmId: currentLearningId, // 로컬스토리지에서 가져온 currentLearningId 사용
+            },
+          })
+            .then((response) => {
+              this.problemData = response.data;
+              console.log("AI 모드 problemData", this.problemData);
+              this.sortingProblem();
+            })
+            .catch((error) => {
+              this.state = "noProblem";
+              console.error("Error fetching AI problemData:", error);
+            });
+
+        } else {
+          // Learning 모드일 경우 기존 로직 사용
+          console.log("Learning 모드에서 prblm_id 사용:", this.prblm_id);
+
+          axios({
+            url: "/problem/problemInfo.json",
+            method: "post",
+            headers: {
+              "Content-Type": "application/json; charset=UTF-8",
+            },
+            data: {
+              prblmId: this.prblm_id.prblm_id, // 기존 방식 사용
+            },
+          })
+            .then((response) => {
+              this.problemData = response.data;
+              console.log("Learning 모드 problemData", this.problemData);
+              this.sortingProblem();
+            })
+            .catch((error) => {
+              this.state = "noProblem";
+              console.error("Error fetching problemData:", error);
+            });
+        }
+      } else {
+        console.error("vuexState가 로컬스토리지에 없습니다.");
+      }
     },
 
     sortingProblem() {
client/views/pages/main/Chapter/Chapter2_11.vue
--- client/views/pages/main/Chapter/Chapter2_11.vue
+++ client/views/pages/main/Chapter/Chapter2_11.vue
@@ -114,11 +114,29 @@
   },
   methods: {
     complete() {
-      const { unit_id, book_id } = this.$route.query;
-      this.$router.push({
-        name: "Dashboard",
-        query: { value: this.seq, unit_id, book_id },
-      });
+      // 로컬 스토리지에서 currentDashboard 값을 가져옴
+      const savedState = localStorage.getItem("vuexState");
+      if (savedState) {
+        const parsedState = JSON.parse(savedState);
+        const currentDashboard = parsedState.currentDashboard;
+
+        const { unit_id, book_id } = this.$route.query;
+        if (currentDashboard === "Learning") {
+          // Learning 모드일 때 Dashboard로 이동
+          this.$router.push({
+            name: "Dashboard",
+            query: { value: this.seq, unit_id, book_id },
+          });
+        } else if (currentDashboard === "AI") {
+          // AI 모드일 때 AIDashboard로 이동
+          this.$router.push({
+            name: "AIDashboard",
+            query: { value: this.seq, unit_id, book_id },
+          });
+        }
+      } else {
+        console.error("currentDashboard 값이 없습니다.");
+      }
     },
     goToPage(page) {
       this.$router.push({ name: page });
@@ -152,10 +170,63 @@
         this.afterQuestion = parts[1];
       }
     },
+    // getProblem() {
+    //   const vm = this;
+    //   const prblmId = this.prblm_id.prblm_id;
+    //   // const prblmId = "PROBLEM_000000000000076";
+
+    //   axios({
+    //     url: "problem/problemInfo.json",
+    //     method: "post",
+    //     headers: {
+    //       "Content-Type": "application/json; charset=UTF-8",
+    //     },
+    //     data: {
+    //       prblmId: prblmId,
+    //     },
+    //   })
+    //     .then(function (res) {
+    //       console.log("problem - response : ", res.data);
+    //       vm.dataList = res.data.problem;
+    //       vm.problemDetail = res.data.problemDetail;
+    //       vm.example = vm.dataList.prblmExpln;
+    //       vm.problemDetail.forEach((detail, index) => {
+    //         vm.choice.push(detail.prblmDtlExpln);
+    //         if (detail.prblmYn === "Y") {
+    //           vm.answer = index + 1;
+    //         }
+    //       });
+
+    //       console.log(vm.example);
+    //       console.log(vm.choice);
+    //       console.log(vm.answer);
+    //       vm.splitExample();
+    //     })
+    //     .catch(function (error) {
+    //       console.log("problem - error : ", error);
+    //     });
+    // },
+
     getProblem() {
       const vm = this;
-      const prblmId = this.prblm_id.prblm_id;
-      // const prblmId = "PROBLEM_000000000000076";
+      let prblmId = null;
+
+      // 로컬 스토리지에서 currentDashboard를 확인
+      const savedState = localStorage.getItem("vuexState");
+      if (savedState) {
+        const parsedState = JSON.parse(savedState);
+        const currentDashboard = parsedState.currentDashboard;
+
+        if (currentDashboard === "AI") {
+          // AI 모드일 때 로컬스토리지에서 currentLearningIds를 사용
+          prblmId = parsedState.currentLearningIds; // currentLearningIds를 사용
+          console.log("AI 모드에서 currentLearningIds 사용:", prblmId);
+        } else {
+          // Learning 모드일 때 기존 방식 사용
+          prblmId = this.prblm_id.prblm_id; // 기존 방식
+          console.log("Learning 모드에서 currentLearningId 사용:", prblmId);
+        }
+      }
 
       axios({
         url: "problem/problemInfo.json",
@@ -188,6 +259,7 @@
           console.log("problem - error : ", error);
         });
     },
+
     nextProblem() {
       if (
         this.currentProblemIndex <
client/views/pages/main/Chapter/Chapter2_13.vue
--- client/views/pages/main/Chapter/Chapter2_13.vue
+++ client/views/pages/main/Chapter/Chapter2_13.vue
@@ -156,11 +156,29 @@
   },
   methods: {
     complete() {
-      const { unit_id, book_id } = this.$route.query;
-      this.$router.push({
-        name: "Dashboard",
-        query: { value: this.seq, unit_id, book_id },
-      });
+      // 로컬 스토리지에서 currentDashboard 값을 가져옴
+      const savedState = localStorage.getItem("vuexState");
+      if (savedState) {
+        const parsedState = JSON.parse(savedState);
+        const currentDashboard = parsedState.currentDashboard;
+
+        const { unit_id, book_id } = this.$route.query;
+        if (currentDashboard === "Learning") {
+          // Learning 모드일 때 Dashboard로 이동
+          this.$router.push({
+            name: "Dashboard",
+            query: { value: this.seq, unit_id, book_id },
+          });
+        } else if (currentDashboard === "AI") {
+          // AI 모드일 때 AIDashboard로 이동
+          this.$router.push({
+            name: "AIDashboard",
+            query: { value: this.seq, unit_id, book_id },
+          });
+        }
+      } else {
+        console.error("currentDashboard 값이 없습니다.");
+      }
     },
     goToPage(page) {
       this.$router.push({ name: page });
@@ -273,27 +291,89 @@
       }
     },
 
-    fetchProblemData() {
-      axios({
-        url: "/problem/problemInfo.json",
-        method: "post",
-        headers: {
-          "Content-Type": "application/json; charset=UTF-8",
-        },
-        data: {
-          prblmId: this.prblm_id.prblm_id,
-        },
-      })
-        .then((response) => {
-          this.problemData = response.data;
-          console.log("problemData", this.problemData);
+    // fetchProblemData() {
+    //   axios({
+    //     url: "/problem/problemInfo.json",
+    //     method: "post",
+    //     headers: {
+    //       "Content-Type": "application/json; charset=UTF-8",
+    //     },
+    //     data: {
+    //       prblmId: this.prblm_id.prblm_id,
+    //     },
+    //   })
+    //     .then((response) => {
+    //       this.problemData = response.data;
+    //       console.log("problemData", this.problemData);
 
-          this.sortingProblem();
-        })
-        .catch((error) => {
-          this.state = "noProblem";
-          console.error("Error fetching problemData:", error);
-        });
+    //       this.sortingProblem();
+    //     })
+    //     .catch((error) => {
+    //       this.state = "noProblem";
+    //       console.error("Error fetching problemData:", error);
+    //     });
+    // },
+
+    fetchProblemData() {
+      // 로컬 스토리지에서 currentDashboard를 확인
+      const savedState = localStorage.getItem("vuexState");
+      if (savedState) {
+        const parsedState = JSON.parse(savedState);
+        const currentDashboard = parsedState.currentDashboard;
+
+        if (currentDashboard === "AI") {
+          // AI 모드일 경우 로컬 스토리지에서 currentLearningId를 가져와 사용
+          const currentLearningId = parsedState.currentLearningIds;
+          console.log("AI 모드에서 currentLearningId 사용:", currentLearningId);
+
+          // currentLearningId로 문제 데이터 가져오기
+          axios({
+            url: "/problem/problemInfo.json",
+            method: "post",
+            headers: {
+              "Content-Type": "application/json; charset=UTF-8",
+            },
+            data: {
+              prblmId: currentLearningId, // 로컬스토리지에서 가져온 currentLearningId 사용
+            },
+          })
+            .then((response) => {
+              this.problemData = response.data;
+              console.log("AI 모드 problemData", this.problemData);
+              this.sortingProblem();
+            })
+            .catch((error) => {
+              this.state = "noProblem";
+              console.error("Error fetching AI problemData:", error);
+            });
+
+        } else {
+          // Learning 모드일 경우 기존 로직 사용
+          console.log("Learning 모드에서 prblm_id 사용:", this.prblm_id);
+
+          axios({
+            url: "/problem/problemInfo.json",
+            method: "post",
+            headers: {
+              "Content-Type": "application/json; charset=UTF-8",
+            },
+            data: {
+              prblmId: this.prblm_id.prblm_id, // 기존 방식 사용
+            },
+          })
+            .then((response) => {
+              this.problemData = response.data;
+              console.log("Learning 모드 problemData", this.problemData);
+              this.sortingProblem();
+            })
+            .catch((error) => {
+              this.state = "noProblem";
+              console.error("Error fetching problemData:", error);
+            });
+        }
+      } else {
+        console.error("vuexState가 로컬스토리지에 없습니다.");
+      }
     },
 
     sortingProblem() {
client/views/pages/main/Chapter/Chapter2_5.vue
--- client/views/pages/main/Chapter/Chapter2_5.vue
+++ client/views/pages/main/Chapter/Chapter2_5.vue
@@ -135,11 +135,29 @@
   computed: {},
   methods: {
     complete() {
-      const { unit_id, book_id } = this.$route.query;
-      this.$router.push({
-        name: "Dashboard",
-        query: { value: this.seq, unit_id, book_id },
-      });
+      // 로컬 스토리지에서 currentDashboard 값을 가져옴
+      const savedState = localStorage.getItem("vuexState");
+      if (savedState) {
+        const parsedState = JSON.parse(savedState);
+        const currentDashboard = parsedState.currentDashboard;
+
+        const { unit_id, book_id } = this.$route.query;
+        if (currentDashboard === "Learning") {
+          // Learning 모드일 때 Dashboard로 이동
+          this.$router.push({
+            name: "Dashboard",
+            query: { value: this.seq, unit_id, book_id },
+          });
+        } else if (currentDashboard === "AI") {
+          // AI 모드일 때 AIDashboard로 이동
+          this.$router.push({
+            name: "AIDashboard",
+            query: { value: this.seq, unit_id, book_id },
+          });
+        }
+      } else {
+        console.error("currentDashboard 값이 없습니다.");
+      }
     },
     goToPage(page) {
       this.$router.push({ name: page });
@@ -188,19 +206,74 @@
     returnPage() {
       window.location.reload();
     },
+    // async getProblem() {
+    //   const prblmId = this.currentLearningId.prblm_id;
+
+    //   try {
+    //     const res = await axios.post(
+    //       "problem/problemInfo.json",
+    //       {
+    //         prblmId: prblmId,
+    //       },
+    //       {
+    //         headers: {
+    //           "Content-Type": "application/json; charset=UTF-8",
+    //         },
+    //       }
+    //     );
+
+    //     console.log("problem - response : ", res.data);
+    //     this.dataList = res.data.problem;
+    //     this.problemDetail = res.data.problemDetail[0];
+    //     this.example = this.dataList.prblmExpln;
+    //     this.answer = this.problemDetail.prblmDtlExpln;
+    //     this.choice = this.answer ? this.shuffleString(this.answer) : "";
+    //     this.splitExample();
+    //     this.initializeUserAnswer();
+    //     this.choiceCharacters = this.choice.split("");
+
+    //     const fileInfo = await this.findFile(this.dataList.fileMngId);
+    //     if (fileInfo) {
+    //       this.imgUrl = "http://165.229.169.113:9080/" + fileInfo.fileRpath;
+    //       console.log(this.imgUrl);
+    //     } else {
+    //       console.warn("No file found for the given fileMngId.");
+    //     }
+    //   } catch (error) {
+    //     console.log("problem - error : ", error);
+    //   }
+    // },
+
     async getProblem() {
-      const prblmId = this.currentLearningId.prblm_id;
+      // 로컬 스토리지에서 currentDashboard를 확인
+      const savedState = localStorage.getItem("vuexState");
+      let prblmId = null;
+
+      if (savedState) {
+        const parsedState = JSON.parse(savedState);
+        const currentDashboard = parsedState.currentDashboard;
+
+        if (currentDashboard === "AI") {
+          // AI 모드일 경우 로컬 스토리지에서 currentLearningIds를 사용
+          prblmId = parsedState.currentLearningIds; // 로컬스토리지에서 가져온 currentLearningIds 사용
+          console.log("AI 모드에서 currentLearningIds 사용:", prblmId);
+        } else {
+          // Learning 모드일 경우 기존 방식 사용
+          prblmId = this.currentLearningId.prblm_id;
+          console.log("Learning 모드에서 currentLearningId 사용:", prblmId);
+        }
+      }
 
       try {
         const res = await axios.post(
           "problem/problemInfo.json",
           {
-            prblmId: prblmId,
+            prblmId: prblmId, // AI 모드 또는 Learning 모드에 따라 결정된 prblmId 사용
           },
           {
             headers: {
               "Content-Type": "application/json; charset=UTF-8",
-            },
+            }
           }
         );
 
@@ -225,6 +298,7 @@
         console.log("problem - error : ", error);
       }
     },
+
     shuffleString(string) {
       const array = string.split("");
       for (let i = array.length - 1; i > 0; i--) {
client/views/pages/main/Chapter/Chapter2_6.vue
--- client/views/pages/main/Chapter/Chapter2_6.vue
+++ client/views/pages/main/Chapter/Chapter2_6.vue
@@ -153,11 +153,29 @@
   },
   methods: {
     complete() {
-      const { unit_id, book_id } = this.$route.query;
-      this.$router.push({
-        name: "Dashboard",
-        query: { value: this.seq, unit_id, book_id },
-      });
+      // 로컬 스토리지에서 currentDashboard 값을 가져옴
+      const savedState = localStorage.getItem("vuexState");
+      if (savedState) {
+        const parsedState = JSON.parse(savedState);
+        const currentDashboard = parsedState.currentDashboard;
+
+        const { unit_id, book_id } = this.$route.query;
+        if (currentDashboard === "Learning") {
+          // Learning 모드일 때 Dashboard로 이동
+          this.$router.push({
+            name: "Dashboard",
+            query: { value: this.seq, unit_id, book_id },
+          });
+        } else if (currentDashboard === "AI") {
+          // AI 모드일 때 AIDashboard로 이동
+          this.$router.push({
+            name: "AIDashboard",
+            query: { value: this.seq, unit_id, book_id },
+          });
+        }
+      } else {
+        console.error("currentDashboard 값이 없습니다.");
+      }
     },
     goToPage(page) {
       this.$router.push({ name: page });
client/views/pages/main/Chapter/Chapter2_7.vue
--- client/views/pages/main/Chapter/Chapter2_7.vue
+++ client/views/pages/main/Chapter/Chapter2_7.vue
@@ -120,18 +120,36 @@
       problemData: [],
       problemArr: [],
       answerArr: [],
-
       seq: this.$store.getters.seqNum,
       hiddenState: false,
+      isAIMode: false, // AI 모드 여부를 확인할 변수
     };
   },
   methods: {
     complete() {
-      const { unit_id, book_id } = this.$route.query;
-      this.$router.push({
-        name: "Dashboard",
-        query: { value: this.seq, unit_id, book_id },
-      });
+      // 로컬 스토리지에서 currentDashboard 값을 가져옴
+      const savedState = localStorage.getItem("vuexState");
+      if (savedState) {
+        const parsedState = JSON.parse(savedState);
+        const currentDashboard = parsedState.currentDashboard;
+
+        const { unit_id, book_id } = this.$route.query;
+        if (currentDashboard === "Learning") {
+          // Learning 모드일 때 Dashboard로 이동
+          this.$router.push({
+            name: "Dashboard",
+            query: { value: this.seq, unit_id, book_id },
+          });
+        } else if (currentDashboard === "AI") {
+          // AI 모드일 때 AIDashboard로 이동
+          this.$router.push({
+            name: "AIDashboard",
+            query: { value: this.seq, unit_id, book_id },
+          });
+        }
+      } else {
+        console.error("currentDashboard 값이 없습니다.");
+      }
     },
     goToPage(page) {
       this.$router.push({ name: page });
@@ -174,27 +192,90 @@
       }
     },
 
+    // fetchProblemData() {
+    //   axios({
+    //     url: "/problem/problemInfo.json",
+    //     method: "post",
+    //     headers: {
+    //       "Content-Type": "application/json; charset=UTF-8",
+    //     },
+    //     data: {
+    //       prblmId: this.prblm_id.prblm_id,
+    //     },
+    //   })
+    //     .then((response) => {
+    //       this.problemData = response.data;
+    //       console.log("problemData", this.problemData);
+    //       this.sortingProblem();
+    //     })
+    //     .catch((error) => {
+    //       this.state = "noProblem";
+    //       console.error("Error fetching problemData:", error);
+    //     });
+    // },
+
     fetchProblemData() {
-      axios({
-        url: "/problem/problemInfo.json",
-        method: "post",
-        headers: {
-          "Content-Type": "application/json; charset=UTF-8",
-        },
-        data: {
-          prblmId: this.prblm_id.prblm_id,
-        },
-      })
-        .then((response) => {
-          this.problemData = response.data;
-          console.log("problemData", this.problemData);
-          this.sortingProblem();
-        })
-        .catch((error) => {
-          this.state = "noProblem";
-          console.error("Error fetching problemData:", error);
-        });
+      // 로컬 스토리지에서 currentDashboard를 확인
+      const savedState = localStorage.getItem("vuexState");
+      if (savedState) {
+        const parsedState = JSON.parse(savedState);
+        const currentDashboard = parsedState.currentDashboard;
+
+        if (currentDashboard === "AI") {
+          // AI 모드일 경우 로컬 스토리지에서 currentLearningId를 가져와 사용
+          const currentLearningId = parsedState.currentLearningIds;
+          console.log("AI 모드에서 currentLearningId 사용:", currentLearningId);
+
+          // currentLearningId로 문제 데이터 가져오기
+          axios({
+            url: "/problem/problemInfo.json",
+            method: "post",
+            headers: {
+              "Content-Type": "application/json; charset=UTF-8",
+            },
+            data: {
+              prblmId: currentLearningId, // 로컬스토리지에서 가져온 currentLearningId 사용
+            },
+          })
+            .then((response) => {
+              this.problemData = response.data;
+              console.log("AI 모드 problemData", this.problemData);
+              this.sortingProblem();
+            })
+            .catch((error) => {
+              this.state = "noProblem";
+              console.error("Error fetching AI problemData:", error);
+            });
+
+        } else {
+          // Learning 모드일 경우 기존 로직 사용
+          console.log("Learning 모드에서 prblm_id 사용:", this.prblm_id);
+
+          axios({
+            url: "/problem/problemInfo.json",
+            method: "post",
+            headers: {
+              "Content-Type": "application/json; charset=UTF-8",
+            },
+            data: {
+              prblmId: this.prblm_id.prblm_id, // 기존 방식 사용
+            },
+          })
+            .then((response) => {
+              this.problemData = response.data;
+              console.log("Learning 모드 problemData", this.problemData);
+              this.sortingProblem();
+            })
+            .catch((error) => {
+              this.state = "noProblem";
+              console.error("Error fetching problemData:", error);
+            });
+        }
+      } else {
+        console.error("vuexState가 로컬스토리지에 없습니다.");
+      }
     },
+
     sortingProblem() {
       let prblmExpln = this.problemData.problem.prblmExpln;
       let prblmArr = prblmExpln.split("/");
@@ -245,6 +326,14 @@
         this.handleProblemDetail(this.currentLearningId);
         this.goToPage(this.problemType);
       }
+    },
+
+    hideNavigationButtons() {
+      // pre-btn과 next-btn을 숨김
+      const preBtn = document.querySelector('.pre-btn');
+      const nextBtn = document.querySelector('.next-btn');
+      if (preBtn) preBtn.style.display = 'none';
+      if (nextBtn) nextBtn.style.display = 'none';
     },
 
     handleProblemDetail(item) {
@@ -298,6 +387,7 @@
         this.problemType = "Chapter2_13";
       }
     },
+    
   },
   computed: {
     currentLearningId() {
@@ -323,6 +413,20 @@
   },
   mounted() {
     this.fetchProblemData();
+    
+    // 로컬 스토리지에서 currentDashboard 값을 확인
+    const savedState = localStorage.getItem("vuexState");
+    if (savedState) {
+      const parsedState = JSON.parse(savedState);
+      const currentDashboard = parsedState.currentDashboard;
+
+      // AI 모드일 경우 pre-btn과 next-btn 숨기기
+      if (currentDashboard === "AI") {
+        this.isAIMode = true;
+        this.hideNavigationButtons();
+      }
+    }
+
     if (this.currentProblemIndex == 0) {
       this.hiddenState = true;
     }
client/views/pages/main/Chapter/Chapter2_8.vue
--- client/views/pages/main/Chapter/Chapter2_8.vue
+++ client/views/pages/main/Chapter/Chapter2_8.vue
@@ -129,11 +129,29 @@
   },
   methods: {
     complete() {
-      const { unit_id, book_id } = this.$route.query;
-      this.$router.push({
-        name: "Dashboard",
-        query: { value: this.seq, unit_id, book_id },
-      });
+      // 로컬 스토리지에서 currentDashboard 값을 가져옴
+      const savedState = localStorage.getItem("vuexState");
+      if (savedState) {
+        const parsedState = JSON.parse(savedState);
+        const currentDashboard = parsedState.currentDashboard;
+
+        const { unit_id, book_id } = this.$route.query;
+        if (currentDashboard === "Learning") {
+          // Learning 모드일 때 Dashboard로 이동
+          this.$router.push({
+            name: "Dashboard",
+            query: { value: this.seq, unit_id, book_id },
+          });
+        } else if (currentDashboard === "AI") {
+          // AI 모드일 때 AIDashboard로 이동
+          this.$router.push({
+            name: "AIDashboard",
+            query: { value: this.seq, unit_id, book_id },
+          });
+        }
+      } else {
+        console.error("currentDashboard 값이 없습니다.");
+      }
     },
     goToPage(page) {
       this.$router.push({ name: page });
@@ -280,26 +298,88 @@
       }
     },
 
+    // fetchProblemData() {
+    //   axios({
+    //     url: "/problem/problemInfo.json",
+    //     method: "post",
+    //     headers: {
+    //       "Content-Type": "application/json; charset=UTF-8",
+    //     },
+    //     data: {
+    //       prblmId: this.prblm_id.prblm_id,
+    //     },
+    //   })
+    //     .then((response) => {
+    //       this.problemData = response.data;
+    //       console.log("problemData", this.problemData);
+    //       this.sortingProblem();
+    //     })
+    //     .catch((error) => {
+    //       this.state = "noProblem";
+    //       console.error("Error fetching problemData:", error);
+    //     });
+    // },
+
     fetchProblemData() {
-      axios({
-        url: "/problem/problemInfo.json",
-        method: "post",
-        headers: {
-          "Content-Type": "application/json; charset=UTF-8",
-        },
-        data: {
-          prblmId: this.prblm_id.prblm_id,
-        },
-      })
-        .then((response) => {
-          this.problemData = response.data;
-          console.log("problemData", this.problemData);
-          this.sortingProblem();
-        })
-        .catch((error) => {
-          this.state = "noProblem";
-          console.error("Error fetching problemData:", error);
-        });
+      // 로컬 스토리지에서 currentDashboard를 확인
+      const savedState = localStorage.getItem("vuexState");
+      if (savedState) {
+        const parsedState = JSON.parse(savedState);
+        const currentDashboard = parsedState.currentDashboard;
+
+        if (currentDashboard === "AI") {
+          // AI 모드일 경우 로컬 스토리지에서 currentLearningId를 가져와 사용
+          const currentLearningId = parsedState.currentLearningIds;
+          console.log("AI 모드에서 currentLearningId 사용:", currentLearningId);
+
+          // currentLearningId로 문제 데이터 가져오기
+          axios({
+            url: "/problem/problemInfo.json",
+            method: "post",
+            headers: {
+              "Content-Type": "application/json; charset=UTF-8",
+            },
+            data: {
+              prblmId: currentLearningId, // 로컬스토리지에서 가져온 currentLearningId 사용
+            },
+          })
+            .then((response) => {
+              this.problemData = response.data;
+              console.log("AI 모드 problemData", this.problemData);
+              this.sortingProblem();
+            })
+            .catch((error) => {
+              this.state = "noProblem";
+              console.error("Error fetching AI problemData:", error);
+            });
+
+        } else {
+          // Learning 모드일 경우 기존 로직 사용
+          console.log("Learning 모드에서 prblm_id 사용:", this.prblm_id);
+
+          axios({
+            url: "/problem/problemInfo.json",
+            method: "post",
+            headers: {
+              "Content-Type": "application/json; charset=UTF-8",
+            },
+            data: {
+              prblmId: this.prblm_id.prblm_id, // 기존 방식 사용
+            },
+          })
+            .then((response) => {
+              this.problemData = response.data;
+              console.log("Learning 모드 problemData", this.problemData);
+              this.sortingProblem();
+            })
+            .catch((error) => {
+              this.state = "noProblem";
+              console.error("Error fetching problemData:", error);
+            });
+        }
+      } else {
+        console.error("vuexState가 로컬스토리지에 없습니다.");
+      }
     },
 
     sortingProblem() {
client/views/pages/main/Dashboard.vue
--- client/views/pages/main/Dashboard.vue
+++ client/views/pages/main/Dashboard.vue
@@ -1025,6 +1025,7 @@
     console.log("main mounted");
     this.checkAndFetchData();
     // const { book_id, unit_id } = this.$route.query;
+    console.log(">>>>>>>>>>>>>>>>>>>",this.$store.getters.currentDashboard);
   },
   watch: {
     getBookId(newBookId) {
client/views/pages/main/MyPlan.vue
--- client/views/pages/main/MyPlan.vue
+++ client/views/pages/main/MyPlan.vue
@@ -249,6 +249,10 @@
             Promise.all(updates)
                 .then(() => {
                     const schedule = this.schedules[startScheduleIndex];
+
+                    // 대시보드 위치 저장
+                    this.$store.dispatch('updateCurrentDashboard', 'Learning');
+                    
                     // this.$router.push({
                     //     name: page,
                     //     query: {
@@ -274,7 +278,9 @@
                     alert("학습 계획을 업데이트하는 중 오류가 발생했습니다.");
                 });
         },
+
         goToPage2(page, unit_id) {
+            this.$store.dispatch('updateCurrentDashboard', 'AI');
             this.$router.push({
                 name: page, query: {
                     unit_id: unit_id,
Add a comment
List