fix(customer-vue): mypage 개발
- customer mypage 개발
This commit is contained in:
@@ -5,6 +5,9 @@ export default {
|
||||
requestRegisterUser(user) {
|
||||
return axios.post(process.env.VUE_APP_CUSTOMER_SERVICE_BASEURL+"/user-service/store-owner", user);
|
||||
},
|
||||
geUserData() {
|
||||
return axios.get(process.env.VUE_APP_CUSTOMER_SERVICE_BASEURL+"/user-service/customer/", );
|
||||
},
|
||||
|
||||
async requestLoginUser(email, password) {
|
||||
const user = {
|
||||
|
||||
@@ -24,7 +24,7 @@ export default {
|
||||
{name: "검색", url: "/search", icon: "mdi-magnify"},
|
||||
{name: "즐겨찾기", url: "/favorite", icon: "mdi-cards-heart-outline"},
|
||||
{name: "주문내역", url: "/history", icon: "mdi-clipboard-check-outline"},
|
||||
{name: "마이페이지", url: "/", icon: "mdi-account-outline"}
|
||||
{name: "마이페이지", url: "/mypage", icon: "mdi-account-outline"}
|
||||
]
|
||||
}
|
||||
},
|
||||
@@ -33,6 +33,13 @@ export default {
|
||||
this.value = index;
|
||||
this.$router.push(url);
|
||||
}
|
||||
},mounted() {
|
||||
const path =this.$route.path
|
||||
this.links.forEach((link, index) => {
|
||||
if(link.url === path){
|
||||
this.value = index
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
@@ -37,44 +37,58 @@ const routes = [
|
||||
children: [
|
||||
{
|
||||
path: "/home",
|
||||
beforeEnter: authCheck,
|
||||
name: 'home',
|
||||
component: () => import('../views/HomeView')
|
||||
},
|
||||
{
|
||||
path: "/search",
|
||||
beforeEnter: authCheck,
|
||||
name: 'search-store',
|
||||
component: () => import('../views/SearchStore')
|
||||
},
|
||||
{
|
||||
path: "/history",
|
||||
beforeEnter: authCheck,
|
||||
name: 'order-history',
|
||||
component: () => import('../views/OrderHistory')
|
||||
},
|
||||
{
|
||||
path: "/favorite",
|
||||
beforeEnter: authCheck,
|
||||
name: 'favorite-store',
|
||||
component: () => import('../views/FavoriteStore')
|
||||
},
|
||||
{
|
||||
path: "/notification",
|
||||
beforeEnter: authCheck,
|
||||
name: 'notification',
|
||||
component: () => import('../views/NotificationView')
|
||||
},
|
||||
{
|
||||
path: '/login',
|
||||
beforeEnter: authCheck,
|
||||
name: 'login',
|
||||
component: () => import('../views/LoginPage')
|
||||
},
|
||||
{
|
||||
path: "/item/:itemId",
|
||||
beforeEnter: authCheck,
|
||||
name: 'itemDetail',
|
||||
component: () => import('../views/ItemDetail')
|
||||
},
|
||||
{
|
||||
path: "/order",
|
||||
beforeEnter: authCheck,
|
||||
name: 'orderPage',
|
||||
component: () => import('../views/OrderPage')
|
||||
},
|
||||
{
|
||||
path: "/mypage",
|
||||
beforeEnter: authCheck,
|
||||
name: 'myPage',
|
||||
component: () => import('../views/MyPage')
|
||||
},
|
||||
]
|
||||
},
|
||||
{
|
||||
@@ -86,6 +100,7 @@ const routes = [
|
||||
{
|
||||
path: "/store/:storeId",
|
||||
name: "store",
|
||||
beforeEnter: authCheck,
|
||||
component: () => import('../views/StoreView'),
|
||||
props: true
|
||||
},
|
||||
|
||||
88
customer-vue/src/views/MyPage.vue
Normal file
88
customer-vue/src/views/MyPage.vue
Normal file
@@ -0,0 +1,88 @@
|
||||
<template>
|
||||
<v-container
|
||||
fill-height
|
||||
>
|
||||
<v-row >
|
||||
<v-col >
|
||||
<v-card
|
||||
class="mx-auto mb-5 v-alert--border"
|
||||
outlined
|
||||
|
||||
elevation="9"
|
||||
|
||||
>
|
||||
<v-card-title>내 정보 관리</v-card-title>
|
||||
<v-card-text>
|
||||
<v-form
|
||||
ref="form"
|
||||
v-model="userData.valid"
|
||||
lazy-validation
|
||||
readonly
|
||||
>
|
||||
<v-text-field
|
||||
v-model="userData.userId"
|
||||
label="id"
|
||||
required
|
||||
/>
|
||||
<v-text-field
|
||||
v-model="userData.email"
|
||||
label="E-mail"
|
||||
required
|
||||
/>
|
||||
|
||||
<v-text-field
|
||||
v-model="userData.userName"
|
||||
label="Name"
|
||||
required
|
||||
/>
|
||||
|
||||
<v-text-field
|
||||
v-model="userData.phoneNumber"
|
||||
label="phoneNumber"
|
||||
required
|
||||
/>
|
||||
<v-btn
|
||||
color="orange"
|
||||
block>수정하기</v-btn>
|
||||
</v-form>
|
||||
</v-card-text>
|
||||
</v-card>
|
||||
</v-col>
|
||||
</v-row>
|
||||
</v-container>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
|
||||
import userApi from "@/api/user";
|
||||
|
||||
export default {
|
||||
name: "MyPage",
|
||||
data (){
|
||||
return {
|
||||
userData:{
|
||||
userId:'',
|
||||
email:'',
|
||||
userName:'',
|
||||
phoneNumber:'',
|
||||
},
|
||||
}
|
||||
},
|
||||
methods:{
|
||||
getUserData(){
|
||||
userApi.geUserData().then(response =>{
|
||||
this.userData = response.data.data
|
||||
}).catch(error =>{
|
||||
console.log(error.response)
|
||||
})
|
||||
},
|
||||
},
|
||||
mounted() {
|
||||
this.getUserData()
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
|
||||
</style>
|
||||
@@ -16,6 +16,7 @@ public abstract class UserDto {
|
||||
// == 생성 메소드 == //
|
||||
public UserDto(Customer customer) {
|
||||
this.id = customer.getId();
|
||||
this.email = customer.getEmail();
|
||||
this.password = customer.getPassword();
|
||||
this.name = customer.getName();
|
||||
this.phoneNumber = customer.getPhoneNumber();
|
||||
|
||||
@@ -24,6 +24,33 @@ public class UserController {
|
||||
|
||||
private final UserService userService;
|
||||
|
||||
@GetMapping("/customer/")
|
||||
public ResponseEntity getCustomerByToken(@Valid @RequestHeader(value = "user-id") String userId ) {
|
||||
|
||||
CustomerDto customerDto = userService.findCustomerByUserId(Long.parseLong(userId));
|
||||
|
||||
GetCustomerByTokenResponse getCustomerByTokenResponse = new GetCustomerByTokenResponse(customerDto);
|
||||
|
||||
return ResponseEntity.status(HttpStatus.OK)
|
||||
.body(Result.createSuccessResult(getCustomerByTokenResponse));
|
||||
}
|
||||
|
||||
@Data @NoArgsConstructor @AllArgsConstructor
|
||||
static class GetCustomerByTokenResponse {
|
||||
private Long userId;
|
||||
private String email;
|
||||
private String userName;
|
||||
private String phoneNumber;
|
||||
|
||||
public GetCustomerByTokenResponse(CustomerDto customerDto) {
|
||||
this.userId = customerDto.getId();
|
||||
this.email = customerDto.getEmail();
|
||||
this.userName = customerDto.getName();
|
||||
this.phoneNumber = customerDto.getPhoneNumber();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@GetMapping("/customer/{userId}")
|
||||
public ResponseEntity getCustomer(@Valid @PathVariable("userId") Long userId) {
|
||||
|
||||
|
||||
Reference in New Issue
Block a user