Commit b57d5131 authored by Le Dinh Trung's avatar Le Dinh Trung

add change

parent 06f32646
...@@ -88,3 +88,5 @@ sw.* ...@@ -88,3 +88,5 @@ sw.*
# Vim swap files # Vim swap files
*.swp *.swp
#$env:NODE_OPTIONS="--openssl-legacy-provider"
\ No newline at end of file
...@@ -23,18 +23,20 @@ ...@@ -23,18 +23,20 @@
</v-col> </v-col>
<v-col> <v-col>
<v-row class="flex-row align-center justify-space-between mt-2"> <v-row class="flex-row align-center justify-space-between mt-2">
<v-card-title v-model="item.name" class="modal-title" style="margin-left:-30px"> <v-card-title v-model="item.name" class="modal-title" style="margin-left:-30px">
{{ name }} {{ name }}
</v-card-title> </v-card-title>
<v-btn icon @click="$emit('close')" style="background-color:red"> <v-btn icon style="background-color:red" @click="$emit('close'); clearDialog()">
<v-icon color="white">mdi-close</v-icon> <v-icon color="white">
mdi-close
</v-icon>
</v-btn> </v-btn>
</v-row> </v-row>
<v-row class="flex-row align-center"> <v-row class="flex-row align-center">
<h3 class="mr-4"> <h3 class="mr-4">
Price: Price:
</h3> </h3>
<v-card-title v-model="item.price"> <v-card-title v-model="item.price" class="price-tag">
{{ price + "$" }} {{ price + "$" }}
</v-card-title> </v-card-title>
</v-row> </v-row>
...@@ -51,7 +53,6 @@ ...@@ -51,7 +53,6 @@
<v-radio-group <v-radio-group
v-model="color_modal" v-model="color_modal"
row row
mandatory
class="square-radio" class="square-radio"
> >
<v-radio <v-radio
...@@ -82,7 +83,6 @@ ...@@ -82,7 +83,6 @@
<v-btn-toggle <v-btn-toggle
v-model="size_modal" v-model="size_modal"
color="primary" color="primary"
mandatory
> >
<v-btn value="S"> <v-btn value="S">
S S
...@@ -95,6 +95,11 @@ ...@@ -95,6 +95,11 @@
</v-btn> </v-btn>
</v-btn-toggle> </v-btn-toggle>
</v-row> </v-row>
<v-row v-if="isSelectionValid" class="flex-row align-center">
<h3 class="mr-4 mt-2 price-tag">
{{ total_price.toFixed(2) + "$" }}
</h3>
</v-row>
<v-row class="mt-7"> <v-row class="mt-7">
<v-divider :thickness="2" /> <v-divider :thickness="2" />
</v-row> </v-row>
...@@ -180,11 +185,21 @@ export default { ...@@ -180,11 +185,21 @@ export default {
}, },
size_modal: undefined, size_modal: undefined,
color_modal: undefined, color_modal: undefined,
quantity_modal: '' quantity_modal: 1
}), }),
computed: { computed: {
dialogDetail () { dialogDetail () {
return this.status return this.status
},
total_price () {
if (this.quantity_modal < 0) {
return 0
} else {
return this.quantity_modal * this.price
}
},
isSelectionValid () {
return this.size_modal !== undefined && this.color_modal !== undefined
} }
}, },
methods: { methods: {
...@@ -194,6 +209,11 @@ export default { ...@@ -194,6 +209,11 @@ export default {
closeDialog () { closeDialog () {
this.$props.status = false this.$props.status = false
}, },
clearDialog () {
this.size_modal = undefined
this.color_modal = undefined
this.quantity_modal = 1
},
addProductToCard () { addProductToCard () {
const fd = new FormData() const fd = new FormData()
fd.append('product_id', this.product_id) fd.append('product_id', this.product_id)
...@@ -255,5 +275,9 @@ export default { ...@@ -255,5 +275,9 @@ export default {
.v-dialog { .v-dialog {
overflow: hidden; overflow: hidden;
} }
.price-tag {
color: rgb(210, 110, 75);
font-weight: 700;
line-height: 1;
}
</style> </style>
...@@ -26,6 +26,7 @@ ...@@ -26,6 +26,7 @@
v-model="password" v-model="password"
variant="underlined" variant="underlined"
label="Password" label="Password"
type="password"
required required
/> />
</v-col> </v-col>
...@@ -106,13 +107,13 @@ export default { ...@@ -106,13 +107,13 @@ export default {
this.$toast.success('Successfully authenticated', { this.$toast.success('Successfully authenticated', {
duration: 2000 duration: 2000
}) })
this.$router.push('home') window.location.reload()
} }
} catch (e) { } catch (e) {
this.$toast.error('Username or Password not valid', { this.$toast.error('Username or Password not valid', {
duration: 2000 duration: 2000
}) })
this.$router.push('/login') window.location.reload()
} }
}, },
closeDialog () { closeDialog () {
......
...@@ -143,7 +143,7 @@ export default { ...@@ -143,7 +143,7 @@ export default {
this.$toast.success('Register successfully', { this.$toast.success('Register successfully', {
duration: 2000 duration: 2000
}) })
this.$router.push('login') window.location.reload()
} }
}) })
} catch (error) { } catch (error) {
......
...@@ -61,7 +61,18 @@ ...@@ -61,7 +61,18 @@
</v-icon> </v-icon>
<span>Need help</span> <span>Need help</span>
</div> </div>
<div class="authentication"> <div v-if="auth" class="authentication">
<div class="header-info">
<span class="font-weight-bold font-weight-black">{{ auth }}</span>
</div>
<v-icon small>
mdi-slash-forward
</v-icon>
<div class="header-info" @click="logout">
<span>log out</span>
</div>
</div>
<div v-else class="authentication">
<div class="header-info" @click="openDialogLogin"> <div class="header-info" @click="openDialogLogin">
<v-icon small> <v-icon small>
mdi-account-outline mdi-account-outline
...@@ -123,7 +134,7 @@ ...@@ -123,7 +134,7 @@
<v-divider vertical inset /> <v-divider vertical inset />
<div id="menu-activator" class="cart" plain v-bind="attrs" v-on="on"> <div id="menu-activator" class="cart" plain v-bind="attrs" v-on="on">
<span>Shopping cart: <span>Shopping cart:
<b>$:0.00</b> <b>$:{{ total }}.00</b>
</span> </span>
<v-badge <v-badge
:content="products.length || 0" :content="products.length || 0"
...@@ -189,6 +200,7 @@ ...@@ -189,6 +200,7 @@
<SignupModal :status="activeRegister" @close="activeRegister = false" /> <SignupModal :status="activeRegister" @close="activeRegister = false" />
<!-- show drawer --> <!-- show drawer -->
<v-navigation-drawer <v-navigation-drawer
class="nav-modal"
v-model="drawer" v-model="drawer"
absolute absolute
right right
...@@ -208,7 +220,7 @@ ...@@ -208,7 +220,7 @@
<v-list dense three-line> <v-list dense three-line>
<v-list-item v-for="item in wishlist" :key="item.name" link> <v-list-item v-for="item in wishlist" :key="item.name" link>
<v-list-item-avatar tile class="align-center item-avatar"> <v-list-item-avatar tile class="align-center item-avatar">
<v-img tile :src="item.product.images[0]" /> <v-img tile :src="item.product.images[0]"/>
</v-list-item-avatar> </v-list-item-avatar>
<v-list-item-content class="list-item-card"> <v-list-item-content class="list-item-card">
<v-list-item-title class="font-weight-bold">{{ item.product.name }}</v-list-item-title> <v-list-item-title class="font-weight-bold">{{ item.product.name }}</v-list-item-title>
...@@ -266,6 +278,9 @@ export default { ...@@ -266,6 +278,9 @@ export default {
return arr?.push(value.price) return arr?.push(value.price)
}) })
return arr.reduce((acc, cur) => acc + cur, 0) return arr.reduce((acc, cur) => acc + cur, 0)
},
auth () {
return this.$auth.$storage.getUniversal('userName')
} }
}, },
mounted () { mounted () {
...@@ -381,6 +396,28 @@ export default { ...@@ -381,6 +396,28 @@ export default {
}, },
changeColor () { changeColor () {
this.$vuetify.theme.dark = !this.$vuetify.theme.dark this.$vuetify.theme.dark = !this.$vuetify.theme.dark
},
async logout () {
try {
const resp = await this.$axios.post('/logout', {
token: this.$auth.$storage.getUniversal('token')
})
if (resp.status === 200) {
this.$toast.success('Logout!', {
duration: 2000
})
window.location.reload()
localStorage.setItem('token', '')
this.$auth.$storage.setUniversal('loggedIn', 'false')
this.$auth.$storage.setUniversal('token', '')
this.$auth.$storage.setUniversal('userName', '')
this.$auth.$storage.setUniversal('ID', '')
}
} catch (e) {
this.$toast.error('ERR !', {
duration: 2000
})
}
} }
} }
} }
...@@ -557,6 +594,10 @@ b { ...@@ -557,6 +594,10 @@ b {
.header-bottom { .header-bottom {
border-bottom: 1px solid rgba(0, 0, 0, 0.12); border-bottom: 1px solid rgba(0, 0, 0, 0.12);
} }
.v-navigation-drawer--close{
display: none;
}
@media only screen and (max-width: 768px) { @media only screen and (max-width: 768px) {
.header-middle-content { .header-middle-content {
display: flex; display: flex;
...@@ -566,5 +607,8 @@ b { ...@@ -566,5 +607,8 @@ b {
margin-top: 10px; margin-top: 10px;
width: 95%; width: 95%;
} }
.v-navigation-drawer--close{
display: none;
}
} }
</style> </style>
...@@ -8,28 +8,28 @@ ...@@ -8,28 +8,28 @@
<div class="numbertext"> <div class="numbertext">
1 / 4 1 / 4
</div> </div>
<img src="https://www.w3schools.com/howto/img_woods.jpg" style="width:100%; height: 100%;"> <img src="https://cdn.vuetifyjs.com/images/cards/sunshine.jpg" style="width:100%; height: 100%;">
</div> </div>
<div class="mySlides"> <div class="mySlides">
<div class="numbertext"> <div class="numbertext">
2 / 4 2 / 4
</div> </div>
<img src="https://www.w3schools.com/howto/img_5terre.jpg" style="width:100%; height: 100%;"> <img src="https://cdn.vuetifyjs.com/images/cards/docks.jpg" style="width:100%; height: 100%;">
</div> </div>
<div class="mySlides"> <div class="mySlides">
<div class="numbertext"> <div class="numbertext">
3 / 4 3 / 4
</div> </div>
<img src="https://www.w3schools.com/howto/img_mountains.jpg" style="width:100%; height: 100%;"> <img src="https://cdn.vuetifyjs.com/images/cards/hotel.jpg" style="width:100%; height: 100%;">
</div> </div>
<div class="mySlides"> <div class="mySlides">
<div class="numbertext"> <div class="numbertext">
4 / 4 4 / 4
</div> </div>
<img src="https://www.w3schools.com/howto/img_lights.jpg" style="width:100%; height: 100%;"> <img src="https://cdn.vuetifyjs.com/images/cards/sunshine.jpg" style="width:100%; height: 100%;">
</div> </div>
<!-- Next and previous buttons --> <!-- Next and previous buttons -->
...@@ -40,16 +40,16 @@ ...@@ -40,16 +40,16 @@
<!-- Thumbnail images --> <!-- Thumbnail images -->
<div class="c2"> <div class="c2">
<div class="column"> <div class="column">
<img class="demo cursor" src="https://www.w3schools.com/howto/img_woods.jpg" style="width:100%; height: 100%;" alt="The Woods" @click="currentSlide(1)"> <img class="demo cursor" src="https://cdn.vuetifyjs.com/images/cards/sunshine.jpg" style="width:100%; height: 100%;" alt="The Woods" @click="currentSlide(1)">
</div> </div>
<div class="column"> <div class="column">
<img class="demo cursor" src="https://www.w3schools.com/howto/img_5terre.jpg" style="width:100%; height: 100%;" alt="Cinque Terre" @click="currentSlide(2)"> <img class="demo cursor" src="https://cdn.vuetifyjs.com/images/cards/docks.jpg" style="width:100%; height: 100%;" alt="Cinque Terre" @click="currentSlide(2)">
</div> </div>
<div class="column"> <div class="column">
<img class="demo cursor" src="https://www.w3schools.com/howto/img_mountains.jpg" style="width:100%; height: 100%;" alt="Mountains and fjords" @click="currentSlide(3)"> <img class="demo cursor" src="https://cdn.vuetifyjs.com/images/cards/hotel.jpg" style="width:100%; height: 100%;" alt="Mountains and fjords" @click="currentSlide(3)">
</div> </div>
<div class="column"> <div class="column">
<img class="demo cursor" src="https://www.w3schools.com/howto/img_lights.jpg" style="width:100%; height: 100%;" alt="Northern Lights" @click="currentSlide(4)"> <img class="demo cursor" src="https://cdn.vuetifyjs.com/images/cards/sunshine.jpg" style="width:100%; height: 100%;" alt="Northern Lights" @click="currentSlide(4)">
</div> </div>
</div> </div>
</div> </div>
...@@ -133,6 +133,47 @@ ...@@ -133,6 +133,47 @@
</v-col> </v-col>
</div> </div>
</div> </div>
<v-row class="d-flex justify-center mt-10">
<h2>
RELATED PRODUCT
</h2>
</v-row>
<v-row class="pt-5 pb-5">
<v-col
v-for="(item, i) in items"
:key="i"
cols="12"
md="3"
>
<v-hover
v-slot="{ hover }"
:elevation="hover ? 12 : 2"
:class="{ 'on-hover': hover }"
>
<v-card
:elevation="hover ? 16 : 2"
:class="{ 'on-hover': hover }"
class="mx-auto pa-2 ma-3"
max-width="280"
link
>
<div>
<v-img
:src="item.images"
height="250px"
cover
/>
</div>
<v-card-title class="d-flex justify-center">
{{ item.name }}
</v-card-title>
<v-card-subtitle class="d-flex justify-center">
{{ item.price }}
</v-card-subtitle>
</v-card>
</v-hover>
</v-col>
</v-row>
</v-container> </v-container>
</template> </template>
...@@ -142,7 +183,29 @@ export default { ...@@ -142,7 +183,29 @@ export default {
data: () => { data: () => {
return { return {
product: [], product: [],
slideIndex: 1 slideIndex: 1,
items: [
{
images: 'https://cdn.vuetifyjs.com/images/cards/docks.jpg',
price: '100$',
name: 'xiaomi x99'
},
{
images: 'https://cdn.vuetifyjs.com/images/cards/docks.jpg',
price: '100$',
name: 'xiaomi x99'
},
{
images: 'https://cdn.vuetifyjs.com/images/cards/docks.jpg',
price: '100$',
name: 'xiaomi x99'
},
{
images: 'https://cdn.vuetifyjs.com/images/cards/docks.jpg',
price: '100$',
name: 'xiaomi x99'
}
]
} }
}, },
mounted () { mounted () {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment