From 6e289bb231d389e00d9b1fad807820b128800b2a Mon Sep 17 00:00:00 2001 From: bum12ark Date: Mon, 7 Mar 2022 16:47:46 +0900 Subject: [PATCH] =?UTF-8?q?feat(customer-vue):=20Just=20Pick-up=20?= =?UTF-8?q?=EC=A3=BC=EB=AC=B8=EB=82=B4=EC=97=AD=20=ED=8E=98=EC=9D=B4?= =?UTF-8?q?=EC=A7=80=20=EA=B5=AC=ED=98=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 주문내역 페이지 카드 구현 - API 호출 부 구현 --- customer-vue/.env | 4 +- customer-vue/src/api/order.js | 12 ++ .../src/components/BottomNavigation.vue | 37 +++---- .../src/components/OrderHistoryCard.vue | 62 +++++++++++ customer-vue/src/main.js | 14 +-- customer-vue/src/router/router.js | 7 +- customer-vue/src/views/OrderHistory.vue | 103 ++++++++++++++++++ 7 files changed, 209 insertions(+), 30 deletions(-) create mode 100644 customer-vue/src/api/order.js create mode 100644 customer-vue/src/components/OrderHistoryCard.vue create mode 100644 customer-vue/src/views/OrderHistory.vue diff --git a/customer-vue/.env b/customer-vue/.env index 8f9f97c..782f11c 100644 --- a/customer-vue/.env +++ b/customer-vue/.env @@ -1,4 +1,6 @@ VUE_APP_BASEURL=https://just-pickup.com:8080 VUE_APP_OWNER_SERVICE_BASEURL=https://just-pickup.com:8001 VUE_APP_CUSTOMER_SERVICE_BASEURL=https://just-pickup.com:8000 -VUE_APP_STORE_API_URL=https://just-pickup.com:8000/store-service/api/customer \ No newline at end of file + +VUE_APP_STORE_API_URL=https://just-pickup.com:8000/store-service/api/customer +VUE_APP_ORDER_API_URL=https://just-pickup.com:8000/order-service/api/customer \ No newline at end of file diff --git a/customer-vue/src/api/order.js b/customer-vue/src/api/order.js new file mode 100644 index 0000000..7cccf7b --- /dev/null +++ b/customer-vue/src/api/order.js @@ -0,0 +1,12 @@ +import axios from "axios"; + +export default { + requestOrderHistory(page) { + const options = { + params: { + page: page + } + } + return axios.get(process.env.VUE_APP_ORDER_API_URL + "/order/history", options); + } +} \ No newline at end of file diff --git a/customer-vue/src/components/BottomNavigation.vue b/customer-vue/src/components/BottomNavigation.vue index 0a74a36..14636de 100644 --- a/customer-vue/src/components/BottomNavigation.vue +++ b/customer-vue/src/components/BottomNavigation.vue @@ -6,25 +6,9 @@ :value="value" color="primary" > - - - mdi-home-outline - - - 검색 - mdi-magnify - - - 즐겨찾기 - mdi-cards-heart-outline - - - 주문내역 - mdi-clipboard-check-outline - - - 마이페이지 - mdi-account-outline + + {{ item.name }} + {{ item.icon }} @@ -34,7 +18,20 @@ export default { name: "BottomNavigation", data: function() { return { - value: 0 + value: 0, + links: [ + {name: "홈", url: "/", icon: "mdi-home-outline"}, + {name: "검색", url: "/search", icon: "mdi-magnify"}, + {name: "즐겨찾기", url: "/", icon: "mdi-cards-heart-outline"}, + {name: "주문내역", url: "/history", icon: "mdi-clipboard-check-outline"}, + {name: "마이페이지", url: "/", icon: "mdi-account-outline"} + ] + } + }, + methods: { + clickGo: function (index, url) { + this.value = index; + this.$router.push(url); } } } diff --git a/customer-vue/src/components/OrderHistoryCard.vue b/customer-vue/src/components/OrderHistoryCard.vue new file mode 100644 index 0000000..7c6052f --- /dev/null +++ b/customer-vue/src/components/OrderHistoryCard.vue @@ -0,0 +1,62 @@ + + + + + \ No newline at end of file diff --git a/customer-vue/src/main.js b/customer-vue/src/main.js index b8f32fa..bb202fc 100644 --- a/customer-vue/src/main.js +++ b/customer-vue/src/main.js @@ -29,19 +29,17 @@ axios.interceptors.response.use( const originalRequest = error.config; if (error.response.status === 401) { let code = error.response.data.code; - if (code === "EXPIRED") { - console.log("## expired"); - try { + try { + if (code === "EXPIRED") { const accessToken = await auth.requestReissue(); originalRequest.headers.Authorization = "Bearer " + accessToken; return axios(originalRequest); - } catch (reissueError) { - window.location.href = process.env.VUE_APP_BASEURL+"/login"; - alert("권한이 없습니다. 다시 로그인 해주세요"); } + } catch (error2) { + window.location.href = process.env.VUE_APP_BASEURL+"/login"; + alert("권한이 없습니다. 다시 로그인 해주세요"); + return Promise.reject(error2); } - window.location.href = process.env.VUE_APP_BASEURL+"/login"; - alert("권한이 없습니다. 다시 로그인해주세요."); } return Promise.reject(error); } diff --git a/customer-vue/src/router/router.js b/customer-vue/src/router/router.js index ffc3523..317310e 100644 --- a/customer-vue/src/router/router.js +++ b/customer-vue/src/router/router.js @@ -28,7 +28,12 @@ const routes = [ path: "/search", name: 'search-store', component: () => import('../views/SearchStore') - } + }, + { + path: "/history", + name: 'order-history', + component: () => import('../views/OrderHistory') + }, ] }, { diff --git a/customer-vue/src/views/OrderHistory.vue b/customer-vue/src/views/OrderHistory.vue new file mode 100644 index 0000000..20a4f9e --- /dev/null +++ b/customer-vue/src/views/OrderHistory.vue @@ -0,0 +1,103 @@ + + + + + \ No newline at end of file