Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Q
quasar-web-base
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
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
Nguyễn Hải Sơn
quasar-web-base
Commits
02d3e0dd
Commit
02d3e0dd
authored
Nov 30, 2022
by
Nguyễn Đức Thắng
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update
parent
3ce550a7
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
136 additions
and
57 deletions
+136
-57
configurations.example.ts
src/assets/configurations.example.ts
+1
-0
index.vue
src/components/add-update-post/index.vue
+49
-14
HotProduct.ts
src/components/artist-information/hot-product/HotProduct.ts
+24
-10
index.vue
src/components/configSystem/index.vue
+49
-9
index.vue
src/pages/cau-hinh-trang-chu/index.vue
+13
-24
No files found.
src/assets/configurations.example.ts
View file @
02d3e0dd
...
...
@@ -134,4 +134,5 @@ export enum API_PATHS {
getListDeposit
=
'deposit'
,
formalityDeposit
=
'common/formalityDeposit'
,
// danh sách hình thức đặt cọc
configHomeProduct
=
'config/home/product'
,
artistFeaturedProduct
=
'artist/featuredProduct'
}
src/components/add-update-post/index.vue
View file @
02d3e0dd
...
...
@@ -177,8 +177,6 @@
<q-separator
/>
<q-tab-panels
v-model=
"tabContent"
animated
>
<q-tab-panel
v-for=
"(info, index) in languageOptions"
...
...
@@ -195,7 +193,6 @@
toolbar-bg=
"primary"
style=
"height: 100%"
:definitions=
"
{
upload: {
tip: 'Upload to cloud',
icon: 'cloud_upload',
...
...
@@ -335,8 +332,17 @@
<
script
lang=
"ts"
>
import
{
defineComponent
,
PropType
,
ref
,
Ref
}
from
'vue'
;
import
{
i18n
}
from
'src/boot/i18n'
;
import
{
config
}
from
'src/assets/configurations.example'
;
import
{
API_PATHS
}
from
'src/assets/configurations.example'
;
import
{
AxiosResponse
}
from
'axios'
;
import
{
api
,
BaseResponseBody
}
from
'src/boot/axios'
;
import
{
FileUploadType
}
from
'src/assets/type'
;
export
type
AvatarType
=
{
file
?:
File
;
url
?:
string
|
null
;
};
export
default
defineComponent
({
props
:
{
...
...
@@ -372,7 +378,7 @@ export default defineComponent({
methods
:
{},
setup
(
_
,
context
)
{
const
avatarUploaded
:
Ref
<
string
>
=
ref
(
''
);
const
uploadImage
=
ref
(
null
);
const
uploadFile
=
()
=>
{
// eslint-disable-next-line
...
...
@@ -388,6 +394,28 @@ export default defineComponent({
});
};
const
callApiUploadAvatar
=
async
(
file
:
File
)
=>
{
try
{
const
bodyFormData
=
new
FormData
();
bodyFormData
.
append
(
'file'
,
file
);
const
response
=
(
await
api
({
headers
:
{
'Content-Type'
:
'multipart/form-data'
},
url
:
config
.
API_IMAGE_ENDPOINT
,
// pro
method
:
'POST'
,
data
:
bodyFormData
,
}))
as
AxiosResponse
<
BaseResponseBody
<
FileUploadType
>>
;
if
(
response
.
data
.
error
.
code
===
config
.
API_RES_CODE
.
OK
.
code
)
{
return
response
.
data
.
data
.
fileName
;
}
else
{
return
''
;
}
}
catch
(
error
)
{
return
''
;
}
};
const
insertImg
=
()
=>
{
// eslint-disable-next-line
// @ts-ignore
...
...
@@ -396,24 +424,31 @@ export default defineComponent({
const
input
=
document
.
createElement
(
'input'
);
input
.
type
=
'file'
;
input
.
accept
=
'.png, .jpg'
;
// file extensions allowed
input
.
onchange
=
(
e
)
=>
{
// const div = `
<
img
src
=
"${url}>`
const
files
=
(
<
HTMLInputElement
&
EventTarget
>
e
.
target
).
files
;
// eslint-disable-next-line
// @ts-ignore
// eslint-disable-next-line
const url = URL.createObjectURL(files[0]);
const
file
=
files
[
0
]
// eslint-disable-next-line
// @ts-ignore
// eslint-disable-next-line
avatarUploaded
.
value
=
callApiUploadAvatar
(
file
).
then
(
res
=>
{
console
.
log
(
res
,
'res'
)
document
.
execCommand
(
'insertHTML'
,
true
,
'<div><img src="
' +
url
+ '
" /></div>'
'<div><img src="'
+
config
.
API_IMAGE_ENDPOINT
+
res
+
'" /></div>'
);
})
// eslint-disable-next-line
// @ts-ignore
// eslint-disable-next-line
};
input
.
click
();
};
...
...
@@ -447,11 +482,11 @@ export default defineComponent({
const
tab
=
ref
(
'vi'
);
const
tabContent
=
ref
(
'vi'
);
return
{
nameRules
,
imageRules
,
selectedFile
,
callApiUploadAvatar
,
categoryRules
,
uploadImage
,
upload
,
...
...
src/components/artist-information/hot-product/HotProduct.ts
View file @
02d3e0dd
...
...
@@ -3,8 +3,11 @@ import { defineComponent, Ref, ref } from 'vue';
import
Pagination
from
'components/pagination/index.vue'
;
import
{
ProductType
}
from
'src/assets/type'
;
import
{
HotProductStatus
}
from
'src/assets/enums'
;
import
{
config
}
from
'src/assets/configurations.example'
;
import
{
Dialog
,
Notify
}
from
'quasar'
;
import
{
AxiosResponse
}
from
'axios'
;
import
{
config
,
API_PATHS
}
from
'src/assets/configurations.example'
;
import
{
api
,
BaseResponseBody
}
from
'src/boot/axios'
;
export
default
defineComponent
({
components
:
{
Pagination
,
...
...
@@ -102,6 +105,7 @@ export default defineComponent({
};
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
const
showHiden
=
(
index
:
any
)
=>
{
Dialog
.
create
({
title
:
i18n
.
global
.
t
(
...
...
@@ -113,20 +117,30 @@ export default defineComponent({
'managingUnit.confirmActionsTitle.confirmDeleteManagingUnitsCancelBtnLabel'
),
color
:
'negative'
,
}).
onOk
(()
=>
{
context
.
emit
(
'click:updateStatusHot'
);
}).
onOk
(
()
=>
{
void
deleteBanner
(
index
);
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
console
.
log
(
index
.
id
,
'index'
)
});
}
const
deleteBanner
=
async
(
index
:
{
id
:
number
,
isFeaturedOnHomepage
:
number
})
=>
{
try
{
const
deleteResult
=
(
await
api
({
url
:
API_PATHS
.
artistFeaturedProduct
,
method
:
'GET'
,
params
:
{
id
:
index
?.
id
,
isFeaturedOnHomepage
:
index
?.
isFeaturedOnHomepage
===
1
?
0
:
1
,
},
}))
as
AxiosResponse
<
BaseResponseBody
<
unknown
>>
;
if
(
deleteResult
.
data
.
error
.
code
===
config
.
API_RES_CODE
.
OK
.
code
)
{
context
.
emit
(
'click:updateStatusHot'
);
Notify
.
create
({
type
:
'positive'
,
message
:
'Thay đổi trạng thái thành công'
,
actions
:
[{
icon
:
'close'
,
color
:
'white'
}],
});
});
}
}
catch
(
error
)
{}
}
...
...
src/components/configSystem/index.vue
View file @
02d3e0dd
...
...
@@ -383,9 +383,18 @@
</
template
>
<
script
lang=
"ts"
>
import
{
defineComponent
,
PropType
}
from
'vue'
;
import
{
i18n
}
from
'src/boot/i18n'
;
import
{
i18n
}
from
'src/boot/i18n'
;
import
{
config
}
from
'src/assets/configurations.example'
;
import
{
API_PATHS
}
from
'src/assets/configurations.example'
;
import
{
AxiosResponse
}
from
'axios'
;
import
{
api
,
BaseResponseBody
}
from
'src/boot/axios'
;
import
{
FileUploadType
}
from
'src/assets/type'
;
import
{
defineComponent
,
PropType
,
ref
,
Ref
}
from
'vue'
;
export
type
AvatarType
=
{
file
?:
File
;
url
?:
string
|
null
;
};
export
default
defineComponent
({
props
:
{
isOpened
:
{
...
...
@@ -419,6 +428,29 @@ export default defineComponent({
},
},
setup
()
{
const
avatarUploaded
:
Ref
<
string
>
=
ref
(
''
);
const
callApiUploadAvatar
=
async
(
file
:
File
)
=>
{
try
{
const
bodyFormData
=
new
FormData
();
bodyFormData
.
append
(
'file'
,
file
);
const
response
=
(
await
api
({
headers
:
{
'Content-Type'
:
'multipart/form-data'
},
url
:
config
.
API_IMAGE_ENDPOINT
,
// pro
method
:
'POST'
,
data
:
bodyFormData
,
}))
as
AxiosResponse
<
BaseResponseBody
<
FileUploadType
>>
;
if
(
response
.
data
.
error
.
code
===
config
.
API_RES_CODE
.
OK
.
code
)
{
return
response
.
data
.
data
.
fileName
;
}
else
{
return
''
;
}
}
catch
(
error
)
{
return
''
;
}
};
const
selectedFile
=
()
=>
{
// eslint-disable-next-line
// @ts-ignore
...
...
@@ -429,22 +461,30 @@ export default defineComponent({
input
.
accept
=
'.png, .jpg'
;
// file extensions allowed
input
.
onchange
=
(
e
)
=>
{
// const div = `
<
img
src
=
"${url}>`
const
files
=
(
<
HTMLInputElement
&
EventTarget
>
e
.
target
).
files
;
// eslint-disable-next-line
// @ts-ignore
// eslint-disable-next-line
const url = URL.createObjectURL(files[0]);
const
file
=
files
[
0
]
// eslint-disable-next-line
// @ts-ignore
// eslint-disable-next-line
avatarUploaded
.
value
=
callApiUploadAvatar
(
file
).
then
(
res
=>
{
console
.
log
(
res
,
'res'
)
document
.
execCommand
(
'insertHTML'
,
true
,
'<div><img src="
' +
url
+ '
" /></div>'
'<div><img src="'
+
config
.
API_IMAGE_ENDPOINT
+
res
+
'" /></div>'
);
})
// eslint-disable-next-line
// @ts-ignore
// eslint-disable-next-line
};
input
.
click
();
};
...
...
src/pages/cau-hinh-trang-chu/index.vue
View file @
02d3e0dd
...
...
@@ -71,9 +71,6 @@
isUpdate
@saveBannerInfo="addBanner"
/> -->
</div>
</template>
...
...
@@ -86,7 +83,6 @@ import { api, BaseResponseBody } from 'src/boot/axios';
import
{
PaginationResponse
,
FileUploadType
,
ListBannerConfig
,
DetailBannerConfig
,
ListHomeConfig
,
AddBannerConfig
,
...
...
@@ -144,7 +140,6 @@ export default defineComponent({
headerStyle
:
'text-align: center !important; width: 25%'
,
align
:
'left'
,
sortable
:
false
,
},
{
name
:
'imageUrl'
,
...
...
@@ -155,7 +150,7 @@ export default defineComponent({
),
align
:
'center'
,
sortable
:
false
,
headerStyle
:
'width: 25%'
headerStyle
:
'width: 25%'
,
},
{
name
:
'action'
,
...
...
@@ -164,7 +159,7 @@ export default defineComponent({
label
:
i18n
.
global
.
t
(
'artist.bankAccount.tableColumnsBank.action'
),
align
:
'center'
,
sortable
:
false
,
headerStyle
:
'width: 5%'
headerStyle
:
'width: 5%'
,
},
];
...
...
@@ -210,7 +205,8 @@ export default defineComponent({
title
:
i18n
.
global
.
t
(
'banner.confirmActionsTitle.confirmDeleteBannerTitle'
),
message
:
'Bạn chắc chắn muốn xóa sản phẩm này khỏi danh sách nổi bật không?'
,
message
:
'Bạn chắc chắn muốn xóa sản phẩm này khỏi danh sách nổi bật không?'
,
cancel
:
i18n
.
global
.
t
(
'banner.confirmActionsTitle.confirmDeleteBannerCancelBtnLabel'
),
...
...
@@ -224,16 +220,17 @@ export default defineComponent({
const
deleteBanner
=
async
(
id
:
number
)
=>
{
try
{
const
deleteResult
=
(
await
api
({
url
:
API_PATHS
.
deleteBanner
,
url
:
API_PATHS
.
artistFeaturedProduct
,
method
:
'GET'
,
params
:
{
id
:
id
,
isFeaturedOnHomepage
:
0
,
},
}))
as
AxiosResponse
<
BaseResponseBody
<
unknown
>>
;
if
(
deleteResult
.
data
.
error
.
code
===
config
.
API_RES_CODE
.
OK
.
code
)
{
Notify
.
create
({
type
:
'positive'
,
message
:
i18n
.
global
.
t
(
'banner.actionMessages.deleteBannerAccess'
)
,
message
:
'Xóa thành công'
,
});
void
configHomeProduct
();
}
...
...
@@ -275,8 +272,6 @@ export default defineComponent({
}
};
//gọi api detail
const
getDetailBanner
=
async
(
id
:
number
)
=>
{
try
{
...
...
@@ -298,11 +293,6 @@ export default defineComponent({
}
catch
(
error
)
{}
};
const
setAvatar
=
(
value
:
{
file
?:
File
;
url
?:
string
})
=>
{
avatarFile
.
value
=
value
.
file
as
File
;
image
.
value
=
value
.
url
as
string
;
...
...
@@ -369,7 +359,6 @@ export default defineComponent({
configImg
,
avatarUploaded
,
bannerId
,
};
},
});
...
...
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