Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Sign in
Toggle navigation
K
kiaisoft_tuananh_nuxt
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
1
Issues
1
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
TTS Tran Viet Anh
kiaisoft_tuananh_nuxt
Commits
4b0a2154
Commit
4b0a2154
authored
Feb 16, 2023
by
TTS Kieu Tuan Anh
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
resolve
parent
08b143ed
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
65 additions
and
354 deletions
+65
-354
index.vue
pages/categories/index.vue
+0
-63
index.vue
pages/posts/index.vue
+54
-120
index.vue
pages/products/index.vue
+4
-169
index.vue
pages/users/index.vue
+0
-2
axios.js
plugins/axios.js
+7
-0
No files found.
pages/categories/index.vue
View file @
4b0a2154
...
...
@@ -52,36 +52,6 @@
</div>
</
template
>
</v-autocomplete>
<!-- <v-card class="mx-auto" max-width="500" dark>
<v-sheet>
<v-text-field
v-model="search"
label="Search Category"
dark
flat
solo-inverted
hide-details
clearable
clear-icon="mdi-close-circle-outline"
/>
</v-sheet>
<v-card-text>
<v-treeview
v-model="eParentId"
:items="categoryTrees"
:search="search"
:filter="filter"
:open.sync="open"
selectable
transition
item-value="id"
selected-color="primary"
selection-type="independent"
@update:open="onOpen"
@input="selectCategory"
/>
</v-card-text>
</v-card> -->
</v-col>
<v-col
cols=
"12"
>
<v-file-input
...
...
@@ -110,7 +80,6 @@
</v-row>
</v-form>
</v-container>
<small>
*indicates required field
</small>
</v-card-text>
<v-card-actions>
<v-spacer
/>
...
...
@@ -212,37 +181,6 @@
</
template
>
</v-autocomplete>
</v-col>
<!-- <v-col cols="12">
<v-card class="mx-auto" max-width="500" dark>
<v-sheet>
<v-text-field
v-model="search"
label="Search Category"
dark
flat
solo-inverted
hide-details
clearable
clear-icon="mdi-close-circle-outline"
/>
</v-sheet>
<v-card-text>
<v-treeview
v-model="parent_id"
:items="categoryTrees"
:search="search"
:filter="filter"
:open.sync="open"
selectable
transition
item-value="id"
selected-color="primary"
selection-type="independent"
:rules="singleRules"
/>
</v-card-text>
</v-card>
</v-col> -->
<v-col
cols=
"12"
>
<v-file-input
v-model=
"image"
...
...
@@ -256,7 +194,6 @@
</v-col>
</v-row>
</v-container>
<small>
*indicates required field
</small>
</v-card-text>
<v-card-actions>
<v-spacer
/>
...
...
pages/posts/index.vue
View file @
4b0a2154
...
...
@@ -11,86 +11,6 @@
</v-breadcrumbs>
</div>
<div
style=
"float: right"
/>
<!-- modal-show -->
<v-dialog
v-model=
"dialog2"
persistent
max-width=
"600px"
>
<v-card>
<v-card-title>
<span
class=
"text-h5"
>
POST
</span>
</v-card-title>
<v-card-text>
<v-container>
<v-row>
<v-col
cols=
"12"
sm=
"6"
md=
"4"
>
<v-text-field
v-model=
"sTitle"
label=
"Title"
readonly
/>
</v-col>
<v-col
cols=
"12"
>
<v-select
v-model=
"sCategoryId"
:items=
"categories"
item-text=
"name"
item-value=
"id"
label=
"Category"
readonly
/>
</v-col>
<v-col
cols=
"12"
>
<v-textarea
v-model=
"sContent"
label=
"Content"
word-break=
"break-word"
readonly
/>
</v-col>
<v-col
cols=
"12"
>
<v-select
v-model=
"sStatus"
:items=
"statusDefault"
item-text=
"name"
item-value=
"id"
label=
"Status"
readonly
/>
</v-col>
<v-col
cols=
"12"
>
<!-- <v-col v-for="(image, index) in sImages" :key="index" cols="12">
<v-img :src="image"/> </v-col> -->
<v-img
v-if=
"typeof sImages == 'string'"
:src=
"sImages"
/>
</v-col>
</v-row>
</v-container>
<small>
*indicates required field
</small>
</v-card-text>
<v-card-actions>
<v-spacer
/>
<v-btn
color=
"blue darken-1"
text
@
click=
"dialog2 = false"
>
Close
</v-btn>
</v-card-actions>
</v-card>
</v-dialog>
<!-- modal-edit -->
<v-dialog
v-model=
"dialog"
...
...
@@ -120,14 +40,29 @@
<v-col
cols=
"12"
>
<v-select
<
!-- <
v-select
v-model="eCategoryId"
:items="categories"
item-text="name"
item-value="id"
label="Category"
:rules="requiredRules"
/>
/> -->
<v-autocomplete
v-model=
"eCategoryId"
:items=
"
categories.filter((category) => category.id !== eId)
"
item-text=
"name"
item-value=
"id"
label=
"Category"
>
<
template
#item
="{
item
}"
>
<div
:class=
"`category-$
{item.depth}`">
{{
item
.
name
}}
</div>
</
template
>
</v-autocomplete>
</v-col>
<v-col
cols=
"12"
>
<v-textarea
...
...
@@ -169,9 +104,18 @@
:src=
"file"
>
</v-col>
<v-col
cols=
"12"
text-align=
" left"
>
<v-img
v-for=
"(imageEdit, index) in eImages"
:key=
"index"
contain
height=
"100px"
width=
"150px"
:src=
"imageEdit"
/>
</v-col>
</v-row>
</v-container>
<small>
*indicates required field
</small>
</v-card-text>
<v-card-actions>
<v-spacer
/>
...
...
@@ -213,7 +157,7 @@
</v-dialog>
<!-- table -->
<div>
<v-data-table
:headers=
"headers"
:items=
"posts"
:search=
"searchTable"
sort-by=
"calories"
class=
"elevation-1"
>
<v-data-table
:headers=
"headers"
:items=
"posts"
:search=
"searchTable"
sort-by=
"calories"
class=
"elevation-1"
>
<
template
#top
>
<v-toolbar
flat
>
<v-text-field
...
...
@@ -265,14 +209,22 @@
<v-col
cols=
"12"
>
<v-
select
<v-
autocomplete
v-model=
"category_id"
:items=
"categories"
:search=
"search"
:filter=
"filter"
item-text=
"name"
item-value=
"id"
label=
"Category"
:rules=
"requiredRules"
/>
>
<
template
#item
="{
item
}"
>
<div
:class=
"`category-$
{item.depth}`">
{{
item
.
name
}}
</div>
</
template
>
</v-autocomplete>
</v-col>
<v-col
cols=
"12"
>
<v-textarea
...
...
@@ -317,7 +269,6 @@
</v-col>
</v-row>
</v-container>
<small>
*indicates required field
</small>
</v-card-text>
<v-card-actions>
<v-spacer
/>
...
...
@@ -361,9 +312,6 @@
<v-icon
:id=
"item.id"
small
@
click=
"dialogDelete = true; getID(item)"
>
mdi-delete
</v-icon>
<v-icon
:id=
"item.id"
small
@
click=
"showPost(item)"
>
mdi-account-details
</v-icon>
</
template
>
<
template
#no-data
>
<v-btn
color=
"primary"
@
click=
"initialize"
>
...
...
@@ -383,16 +331,17 @@ export default {
middleware
:
[
'
web
'
],
data
:
()
=>
{
return
{
filter
:
''
,
search
:
''
,
searchTable
:
''
,
file
:
null
,
dialog1
:
false
,
dialog2
:
false
,
title
:
''
,
category_id
:
null
,
content
:
''
,
user_id
:
''
,
status
:
null
,
images
:
[]
,
images
:
null
,
dialog
:
false
,
dialogDelete
:
false
,
headers
:
[
...
...
@@ -437,19 +386,13 @@ export default {
posts
:
[],
categories
:
[],
users
:
[],
sTitle
:
''
,
sCategoryId
:
''
,
sContent
:
''
,
sUserId
:
''
,
sStatus
:
[],
sImages
:
[],
eId
:
''
,
eTitle
:
''
,
eCategoryId
:
[],
eContent
:
''
,
eUserId
:
''
,
eStatus
:
''
,
eImages
:
[]
,
eImages
:
null
,
message
:
[],
editedIndex
:
-
1
,
editedItem
:
{
...
...
@@ -620,14 +563,14 @@ export default {
})
},
getID
(
item
)
{
this
.
eI
D
=
item
.
id
this
.
eI
d
=
item
.
id
this
.
editedIndex
=
this
.
categories
.
indexOf
(
item
)
},
deletePost
()
{
const
self
=
this
const
currentPostIndex
=
this
.
editedIndex
this
.
$axios
.
delete
(
`/posts/
${
this
.
eI
D
}
`
,
{
.
delete
(
`/posts/
${
this
.
eI
d
}
`
,
{
headers
:
{
Authorization
:
`Bearer
${
this
.
$auth
.
$storage
.
getUniversal
(
'
token
'
)}
`
}
...
...
@@ -645,31 +588,13 @@ export default {
})
})
},
async
showPost
(
item
)
{
const
ID
=
item
.
id
try
{
const
resp
=
await
this
.
$axios
.
get
(
`/posts/
${
ID
}
`
,
{
headers
:
{
Authorization
:
`Bearer
${
this
.
$auth
.
$storage
.
getUniversal
(
'
token
'
)}
`
}
})
this
.
sTitle
=
resp
.
data
.
data
.
title
this
.
sContent
=
resp
.
data
.
data
.
content
this
.
sCategoryId
=
resp
.
data
.
data
.
category_id
this
.
sStatus
=
resp
.
data
.
data
.
status
this
.
sImages
=
resp
.
data
.
data
.
images
}
catch
(
error
)
{
console
.
log
(
error
)
}
this
.
dialog2
=
true
},
editPost
(
item
)
{
this
.
eId
=
item
.
id
this
.
eTitle
=
item
.
title
this
.
eCategoryId
=
item
.
category_id
this
.
eContent
=
item
.
content
this
.
eStatus
=
item
.
status
this
.
eImages
=
[]
this
.
eImages
=
item
.
images
this
.
editedIndex
=
this
.
posts
.
indexOf
(
item
)
console
.
log
(
this
.
editedIndex
)
this
.
dialog
=
true
...
...
@@ -733,6 +658,15 @@ export default {
</
script
>
<
style
>
.category-1
{
padding-left
:
30px
!important
;
}
.category-2
{
padding-left
:
60px
!important
;
}
.category-3
{
padding-left
:
90px
!important
;
}
img
{
width
:
100%
;
height
:
100%
;
...
...
pages/products/index.vue
View file @
4b0a2154
...
...
@@ -7,112 +7,6 @@
</
template
>
</v-breadcrumbs>
</div>
<!-- show-modal -->
<v-dialog
v-model=
"dialog2"
persistent
max-width=
"600px"
>
<v-card>
<v-card-title>
<span
class=
"text-h5"
>
PRODUCT
</span>
</v-card-title>
<v-card-text>
<v-container>
<v-row>
<v-col
cols=
"12"
sm=
"6"
md=
"4"
>
<v-text-field
v-model=
"sName"
label=
"Name"
readonly
/>
</v-col>
<v-col
cols=
"12"
>
<v-select
v-model=
"sCategoryId"
:items=
"categories"
item-text=
"name"
item-value=
"id"
label=
"Category"
readonly
/>
</v-col>
<v-col
cols=
"12"
>
<v-text-field
v-model=
"sPrice"
label=
"Price"
readonly
/>
</v-col>
<v-col
cols=
"12"
>
<v-text-field
v-model=
"sDescription"
label=
"Description"
readonly
/>
</v-col>
<v-col
v-for=
"(image, index) in sImages"
:key=
"index"
cols=
"12"
>
<v-img
:src=
"image"
contain
/>
</v-col>
<v-col
cols=
"12"
/>
<v-row
v-for=
"(variant, index) in sVariants"
:key=
"'A' +index"
>
<v-col
cols=
"12"
sm=
"6"
md=
"4"
>
<v-text-field
v-model=
"variant.color"
label=
"Color"
readonly
/>
</v-col>
<v-col
cols=
"12"
sm=
"6"
md=
"4"
>
<v-text-field
v-model=
"variant.size"
label=
"Size"
readonly
/>
</v-col>
<v-col
cols=
"12"
sm=
"6"
md=
"4"
>
<v-text-field
v-model=
"variant.quantity"
label=
"Quantity"
readonly
/>
</v-col>
<v-col
/>
</v-row>
</v-row>
</v-container>
</v-card-text>
<v-card-actions>
<v-spacer
/>
<v-btn
color=
"blue darken-1"
text
type=
"submit"
@
click=
"dialog2 = false"
>
Close
</v-btn>
</v-card-actions>
</v-card>
</v-dialog>
<!-- edit-modal -->
<v-dialog
v-model=
"dialog3"
...
...
@@ -270,7 +164,6 @@
</v-row>
</v-row>
</v-container>
<small>
*indicates required field
</small>
</v-card-text>
<v-card-actions>
<v-spacer
/>
...
...
@@ -428,15 +321,15 @@
@
click:clear=
"clearImage"
/>
</v-col>
<v-col
v-if=
"files"
cols=
"12"
style=
"display:flex;
text-align:left
"
>
<
v-
img
<v-col
v-if=
"files"
cols=
"12"
style=
"display:flex;
justify-content: space-around;
"
>
<img
v-for=
"(image, index) in files"
:key=
"index"
:src=
"image"
contain
height=
"100px"
width=
"150px"
/
>
>
</v-col>
<v-col
cols=
"12"
>
<v-btn
...
...
@@ -507,7 +400,6 @@
</v-row>
</v-row>
</v-container>
<small>
*indicates required field
</small>
</v-card-text>
<v-card-actions>
<v-spacer
/>
...
...
@@ -551,9 +443,6 @@
<v-icon
:id=
"item.id"
small
@
click=
"dialogDelete = true; getID(item)"
>
mdi-delete
</v-icon>
<v-icon
:id=
"item.id"
small
@
click=
"showProduct(item)"
>
mdi-account-details
</v-icon>
</
template
>
<
template
#no-data
>
<v-btn
color=
"primary"
@
click=
"initialize"
>
...
...
@@ -593,7 +482,6 @@ export default {
quantity
:
''
,
dialog
:
false
,
dialog1
:
false
,
dialog2
:
false
,
dialog3
:
false
,
dialogDelete
:
false
,
dialogDeleteVariant
:
false
,
...
...
@@ -631,19 +519,6 @@ export default {
product
:
[],
categories
:
[],
categoryTrees
:
[],
sName
:
''
,
sCategoryId
:
''
,
sPrice
:
''
,
sDescription
:
''
,
sStock
:
''
,
sImages
:
[],
sVariants
:
[
{
color
:
''
,
size
:
''
,
quantity
:
''
}
],
idVariant
:
''
,
editedVariantIndex
:
''
,
eId
:
''
,
...
...
@@ -875,27 +750,6 @@ export default {
console
.
log
(
error
)
}
},
async
showProduct
(
item
)
{
const
ID
=
item
.
id
try
{
const
resp
=
await
this
.
$axios
.
get
(
`/products/
${
ID
}
`
,
{
method
:
'
GET
'
,
headers
:
{
Authorization
:
`Bearer
${
this
.
$auth
.
$storage
.
getUniversal
(
'
token
'
)}
`
}
})
this
.
sName
=
resp
.
data
.
data
.
name
this
.
sPrice
=
resp
.
data
.
data
.
price
this
.
sCategoryId
=
resp
.
data
.
data
.
category_id
this
.
sDescription
=
resp
.
data
.
data
.
description
this
.
sStock
=
resp
.
data
.
data
.
stock
this
.
sVariants
=
resp
.
data
.
data
.
variants
this
.
sImages
=
resp
.
data
.
data
.
images
}
catch
(
error
)
{
console
.
log
(
error
)
}
this
.
dialog2
=
true
},
editProduct
(
item
)
{
this
.
eId
=
item
.
id
this
.
eName
=
item
.
name
...
...
@@ -973,27 +827,8 @@ export default {
this.idVariant = item.id
},
removeVariant () {
const self = this
const currentVariantIndex = this.editedVariantIndex
if (this.idVariant !== null) {
try {
this.$axios.delete(`
/
products
/
delete
-
variant
/
$
{
this
.
idVariant
}
`,
{
headers: {
Authorization: `
Bearer
$
{
this
.
$auth
.
$storage
.
getUniversal
(
'
token
'
)}
`
}
}
).then((response) => {
self.$toast.success('Remove variant successfully!', {
duration: 3000
})
})
this.getProducts()
} catch (error) {
console.log(error)
}
this.eVariants.splice(currentVariantIndex, 1)
}
this.eVariants.splice(currentVariantIndex, 1)
},
fileSelected (event) {
if (event) {
...
...
pages/users/index.vue
View file @
4b0a2154
...
...
@@ -38,7 +38,6 @@
</v-row>
</v-form>
</v-container>
<small>
*indicates required field
</small>
</v-card-text>
<v-card-actions>
<v-spacer
/>
...
...
@@ -150,7 +149,6 @@
</v-row>
</v-form>
</v-container>
<small>
*indicates required field
</small>
</v-card-text>
<v-card-actions>
<v-spacer
/>
...
...
plugins/axios.js
View file @
4b0a2154
...
...
@@ -12,6 +12,13 @@ export default function ({ $axios }, inject, redirect) {
}
})
$axios
.
onError
((
error
)
=>
{
const
code
=
parseInt
(
error
.
response
&&
error
.
response
.
status
)
if
(
code
===
403
)
{
redirect
(
'
/login
'
)
}
})
const
api
=
$axios
.
create
({
headers
:
{
common
:
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment