Skip to content

Commit

Permalink
Merge pull request #24 from Billing-Wise/K5P-78/fix/오류화면추가
Browse files Browse the repository at this point in the history
[fix] 오류화면추가
  • Loading branch information
Koneweekk authored Aug 2, 2024
2 parents 3d5e2be + 507d44f commit cdc7f2d
Show file tree
Hide file tree
Showing 30 changed files with 291 additions and 103 deletions.
7 changes: 7 additions & 0 deletions src/assets/scss/common.scss
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,13 @@ $mobile-header-height : 100px;
font-size: $font-size;
}

@mixin root-container {
background: $back-color;
width: 100%;
min-height: 100%;
height: 100%;
overflow: auto;
}



28 changes: 28 additions & 0 deletions src/components/common/Loading.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
<template>
<div class="loading">
<img src="@/assets/images/loading.gif" alt="loading">
</div>
</template>

<script>
export default {
}
</script>

<style lang="scss" scoped>
.loading {
@include flex-box(row, center, 0px);
position: absolute;
background: rgba(255, 255, 255, 0.8);
top: $nav-bar-height;
left: $side-bar-width;
width: calc(100% - $side-bar-width);
height: calc(100% - $nav-bar-height);
z-index: 9999;
img {
width: 160px;
}
}
</style>
4 changes: 2 additions & 2 deletions src/components/common/TheNavBar.vue
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,11 @@ export default {
.nav-bar {
@include flex-box(row, space-between, 0px);
background-color: $theme-color;
position: fixed;
position: absolute;
top: 0px;
left: 0px;
height: $nav-bar-height;
width: 100vw;
width: 100%;
padding: 0px 20px;
z-index: 2;
.nav-info {
Expand Down
6 changes: 3 additions & 3 deletions src/components/common/TheSideBar.vue
Original file line number Diff line number Diff line change
Expand Up @@ -40,11 +40,11 @@ export default {

<style lang="scss" scoped>
.side-bar {
position: fixed;
position: absolute;
left: 0;
top:60px;
top: $nav-bar-height;
width: $side-bar-width;
height: calc(100vh - $nav-bar-height);;
height: calc(100% - $nav-bar-height);;
box-shadow: 3px 0px 4px 0px rgb(0, 0, 0, 0.25);
z-index: 1;
@include flex-box(column, space-between, 0px);
Expand Down
1 change: 1 addition & 0 deletions src/components/contract/create/ContractChooseInfo.vue
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,7 @@ export default {
.right-side {
background-color: white;
max-width: 800px;
padding: 50px;
border-radius: 10px;
box-shadow: $base-shadow;
Expand Down
13 changes: 1 addition & 12 deletions src/components/invoice/detail/InvoiceInfo.vue
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
</div>
<div class="info-box">
<span class="title">계약 정보</span>

<div class="double-info">
<TitleInfoVue title="계약ID" :info="String(invoiceDetailStore.data.contractId)" />
<TitleInfoVue title="청구ID" :info="String(invoiceDetailStore.data.invoiceId)" />
Expand Down Expand Up @@ -46,7 +45,6 @@
<script>
import { mapStores } from 'pinia';
import { toDateFromDateTime } from '@/utils/formatter';
import { getInvoice } from '@/utils/invoice';
import TitleInfoVue from '../../common/info/TitleInfo.vue';
import { useInvoiceDetailStore } from '@/stores/invoice/invoiceDetail';
Expand All @@ -73,21 +71,12 @@ export default {
return toDateFromDateTime(this.invoiceDetailStore.data.updatedAt);
},
},
async created() {
this.invoiceDetailStore.$reset();
const result = await getInvoice(this.$route.params.id);
if (result.code !== 200) {
// 예외 처리
}
}
}
</script>

<style lang="scss" scoped>
.invoice-info {
@include flex-box(column, space-between, 20px);
@include flex-box(column, center, 20px);
width: 100%;
height: 100%;
}
Expand Down
4 changes: 2 additions & 2 deletions src/components/item/ItemInfo.vue
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,8 @@ export default {
@include flex-box(column, center, 20px);
width: 100%;
img {
width: 320px;
height: 320px;
width: 250px;
height: 250px;
object-fit: cover;
border: $theme-color solid 3px;
border-radius: 10px;
Expand Down
1 change: 1 addition & 0 deletions src/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import piniaPersist from 'pinia-plugin-persist'

import App from './App.vue'
import router from './router'
import { useLoadingStore } from './stores/loading'

const app = createApp(App)
const pinia = createPinia();
Expand Down
30 changes: 26 additions & 4 deletions src/router/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ const router = createRouter({
component: () => import('@/views/MainView.vue'),
meta: {
requiresAuth: true,
nonMember: false,
forMember: false,
},
children: [
{
Expand Down Expand Up @@ -93,6 +93,11 @@ const router = createRouter({
name:'settingPayment',
component: () => import('@/views/setting/SettingPaymentView.vue')
},
{
path : '/no-data',
name: 'noData',
component: () => import('@/views/error/NoDataView.vue')
}
]
},
{
Expand All @@ -101,7 +106,7 @@ const router = createRouter({
component: () => import('@/views/auth/AuthView.vue'),
meta: {
requiresAuth: false,
nonMember: false,
forMember: false,
},
children: [
{
Expand All @@ -122,7 +127,7 @@ const router = createRouter({
component: () => import('@/views/MobileView.vue'),
meta: {
requiresAuth: false,
nonMember: true,
forMember: true,
},
children: [
{
Expand Down Expand Up @@ -257,6 +262,23 @@ const router = createRouter({
},
]
},
{
path: "/notFound",
name: "notFound",
meta: {
requiresAuth: false,
forMember: true,
},
component: () => import('@/views/error/NotFoundView.vue')
},
{
path: "/:pathMatch(.*)*",
redirect: "/notFound",
meta: {
requiresAuth: false,
forMember: true,
},
}
]
});

Expand All @@ -265,7 +287,7 @@ router.beforeEach((to, from, next) => {

if (to.meta.requiresAuth && !authStore.isLoggedIn) {
next('/login');
} else if (!to.meta.nonMember && !to.meta.requiresAuth && authStore.isLoggedIn) {
} else if (!to.meta.forMember && !to.meta.requiresAuth && authStore.isLoggedIn) {
next('');
} else {
next();
Expand Down
14 changes: 14 additions & 0 deletions src/stores/loading.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import { defineStore } from 'pinia'

export const useLoadingStore = defineStore('loading', {
state() {
return {
isLoading: false,
}
},
actions: {
setIsLoading(value) {
this.isLoading = value;
}
},
})
6 changes: 4 additions & 2 deletions src/utils/axios.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ const mainAxios = axios.create({
withCredentials: true
})


mainAxios.interceptors.response.use(
(response) => {
return response.data;
Expand All @@ -37,12 +38,13 @@ mainAxios.interceptors.response.use(
if (error.response.data.code === 401) {
const authStore = useAuthStore();
authStore.logout();
// 만료된 엑세스 토큰
// 만료된 엑세스 토큰
} else if (error.response.data.code === 419) {
await mainAxios.post('auth/reissue')
return await mainAxios(error.config);
// 그 외의 예외
// 존재하지 않는 데이터
} else {
// 그 외의 예외
return error.response.data;
}
}
Expand Down
18 changes: 16 additions & 2 deletions src/utils/contract.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,13 @@ import { fileAxios, mainAxios } from "./axios";
import { useContractCreateStore } from "@/stores/contract/contractCreate";
import { useContractDetailStore } from "@/stores/contract/contractDetail";
import { useContractBulkStore } from "@/stores/contract/contractBulk";
import { useLoadingStore } from "@/stores/loading";

const contractListStore = useContractListStore();
const contractDetailStore = useContractDetailStore();
const constractCreateStore = useContractCreateStore();
const contractBulkStore = useContractBulkStore();
const loadingStore = useLoadingStore();

// 계약 목록 조회
async function getContractList() {
Expand Down Expand Up @@ -37,13 +39,17 @@ async function getContract(contractId) {

if (result.code === 200) {
contractDetailStore.setData(result.data);
} if (result.code === 404) {

}

return result;
}

// 계약 생성
async function createContract() {
loadingStore.setIsLoading(true);

const data = {
"memberId": constractCreateStore.member.id,
"itemId": constractCreateStore.item.id,
Expand All @@ -59,11 +65,15 @@ async function createContract() {

const result = await mainAxios.post('contracts', data);

loadingStore.setIsLoading(false);

return result;
}

// 계약 대량 등록
async function createContractBulk(file) {
loadingStore.setIsLoading(true);

const formData = new FormData();
formData.append('file', file, 'file');

Expand All @@ -77,11 +87,15 @@ async function createContractBulk(file) {
}
}

loadingStore.setIsLoading(false);

return result;
}

// 계약 수정
async function editContract(contractId) {
loadingStore.setIsLoading(true);

const data = {
"itemPrice": constractCreateStore.item.price,
"itemAmount": constractCreateStore.item.count,
Expand All @@ -93,10 +107,10 @@ async function editContract(contractId) {
"paymentDueCycle": constractCreateStore.paymentDueCycle
}

console.log(data)

const result = await mainAxios.put(`contracts/${contractId}`, data);

loadingStore.setIsLoading(false);

return result;
}

Expand Down
6 changes: 6 additions & 0 deletions src/utils/invoice.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,21 @@ import { useInvoiceListStore } from "@/stores/invoice/invoiceList";
import { mainAxios } from "./axios";
import { useInvoiceDetailStore } from "@/stores/invoice/invoiceDetail";
import { useInvoiceCreateStore } from "@/stores/invoice/invoiceCreate";
import { useLoadingStore } from "@/stores/loading";

const invoiceListStore = useInvoiceListStore();
const invoiceDetailStore = useInvoiceDetailStore();
const invoiceCreateStore = useInvoiceCreateStore();
const loadingStore = useLoadingStore();


// 청구서 전송
async function sendInvoice(invoiceId) {
loadingStore.setIsLoading(true);
const result = await mainAxios.get(`invoices/${invoiceId}/send`);

loadingStore.setIsLoading(false);

return result;
}

Expand Down
2 changes: 2 additions & 0 deletions src/utils/item.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ import { fileAxios, mainAxios } from "./axios";

const itemStore = useItemStore();



// 아이템 목록 조회
async function getItemList() {

Expand Down
Loading

0 comments on commit cdc7f2d

Please sign in to comment.