본문 바로가기
보드게임 긱 추천 게임
Wizard Thumbnail
BoardGameGeek 사이트에서 인기순위 상위 100개 중 랜덤 3개를 보여줍니다.
BGG
귀펀치토끼는 부서지지 않는다.
주소(D)
북마크/메모장

123

<template>
  <div class="setting-wrapper">
    <div class="background"></div>
    <div class="card">
      <img class="card-image" src="../assets/userimg.png">
      <div class="w-full md:w-10 mx-auto" style="margin-top: 50px;">
        <div class="maintext">회원정보</div>
        <div class="subtext">{{currentUserId}}님의 회원정보를 확인하세요.</div>
        <div style="text-align: left;">
          <label class="block text-900 font-medium text mb-2">기존 비밀번호</label>
          <InputText id="oldPassword" v-model="oldPassword" type="password" class="w-full mb-5" :feedback="false" inputClass="w-full" style="padding: 1rem;"/>
          <label class="block text-900 font-medium text mb-2">신규 비밀번호</label>
          <InputText id="newPassword" v-model="newPassword" type="password" class="w-full mb-5" :feedback="false" inputClass="w-full" style="padding: 1rem;"/>
          <Button label="비밀번호를 변경합니다." style="margin-bottom: 25px;" class="w-full p-3 text-xl" @click="changePasswordApi(oldPassword, newPassword)"></button>
          <div style="text-align: center;" >
            <router-link to="/" class="gobacktob4">← 이전화면으로 돌아가기</router-link>
          </div>
          <Toast/>
        </div>
      </div>
    </div>
  </div>
</template>
<script lang="ts">
import {
  defineComponent, toRefs, ref, computed
} from 'vue';
import * as apis from '@apis';
import { useToast } from 'primevue/usetoast';
import { useStore } from 'vuex';

const { requestChangePassword } = apis.abTest;

export default defineComponent({
  setup() {
    const store = useStore();
    const toast = useToast();
    const currentUserId = computed(() => store.state.myInfo.userId);
    const successToast = () => toast.add({
      severity: 'info',
      summary: '비밀번호 변경완료',
      detail: '비밀번호가 변경되었습니다.',
      life: 1500
    });
    const failToast = () => toast.add({
      severity: 'warn',
      summary: '비밀번호 변경실패',
      detail: '비밀번호를 다시 확인해주세요.',
      life: 1500
    });
    const signedUserId = store.state.myInfo.userId;

    const changePasswordApi = async (oldPassword: string, newPassword: string) => {
      try {
        const res = await requestChangePassword(signedUserId, { oldPassword, newPassword });
        successToast();
        console.log('success');
      } catch (error) {
        failToast();
        console.log('fail');
      }
    };

    return {
      changePasswordApi,
      currentUserId
    };
  }
});
</script>
<style scoped>
.mypage-title {
  font-size: 35px;
  font-weight: bold;
}

.setting-title {
  width: 500px;
  padding: 20px;
  margin-top: 10px;
  font-size: 20px;
  font-weight: bold;
  border-bottom: 1.5px solid grey;
}

.setting-wrapper {
  position: fixed;
  left: 0;
  display: flex;
  align-items: center;
  width: 100%;
  height: calc(100vh - 0rem);
  padding: 1rem;
  text-align: center;
  background-color: #1666d8;
}

.background {
  position: fixed;
  bottom: 0;
  left: 0;
  display: flex;
  width: 100%;
  height: calc(60vh - 0rem);
  padding: 1rem;
  background-color: #f6f6f6;
}

.card {
  position: fixed;
  left: 37vw;
  justify-content: center;
  width: 500px;
  height: 750px;
  margin: 0 auto;
  background-color: white;
  border-radius: 2%;
  box-shadow: 0 3px 4px rgba(0, 0, 0, 0.5), 0 0 2px rgba(0, 0, 0, 0.05), 0 -1px 4px rgba(0, 0, 0, 0.08);
}

.card-image {
  display: block;
  width: 60%;
  margin: 3vh auto;
}

.maintext {
  font-size: 30px;
  font-weight: bold;
}

.subtext {
  margin: 2vh;
  font-size: 14px;
  font-weight: normal;
}

.gobacktob4 {
  font-size: 14px;
  color: #0087ca;
  text-decoration: none;
  cursor: pointer;
}

#profile-picture {
  display: flex;
}

</style>
완료
내 컴퓨터