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
7e6a2497
Commit
7e6a2497
authored
May 10, 2021
by
Võ Quang Thành Đạt
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update upload image
parent
cb9e9c49
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
156 additions
and
30 deletions
+156
-30
type.ts
src/assets/type.ts
+5
-3
app.scss
src/css/app.scss
+1
-1
updateInformationArtist.ts
...ges/cap-nhat-thong-tin-nghe-sy/updateInformationArtist.ts
+75
-16
index.vue
src/pages/nghe-sy/index.vue
+1
-0
AddArtist.ts
src/pages/them-nghe-sy/AddArtist.ts
+74
-10
No files found.
src/assets/type.ts
View file @
7e6a2497
...
...
@@ -111,9 +111,9 @@ export type WorkType = {
export
type
BannerType
=
{
bannerUrl
:
string
;
id
:
number
;
numIndex
:
number
;
status
:
number
;
id
?
:
number
;
numIndex
?
:
number
;
status
?
:
number
;
url
?:
string
;
file
?:
File
;
};
...
...
@@ -134,6 +134,8 @@ export type StoriesType = {
content
:
string
;
imageUrl
:
string
;
status
:
number
;
url
?:
string
;
file
?:
File
;
};
export
type
BankAccountType
=
{
...
...
src/css/app.scss
View file @
7e6a2497
...
...
@@ -7,7 +7,7 @@
.q-table__bottom
,
thead
tr
:first-child
th
{
// / bg color is important for th; just specify one /
background-color
:
#c1f4cd
;
background-color
:
white
;
}
thead
tr
th
{
...
...
src/pages/cap-nhat-thong-tin-nghe-sy/updateInformationArtist.ts
View file @
7e6a2497
...
...
@@ -88,6 +88,7 @@ export default defineComponent({
const
account
:
Ref
<
string
|
null
>
=
ref
(
null
);
const
avatar
:
Ref
<
string
|
null
>
=
ref
(
null
);
const
avatarFile
:
Ref
<
File
|
null
>
=
ref
(
null
);
const
avatarUploaded
:
Ref
<
string
|
null
>
=
ref
(
null
);
const
artistCode
:
Ref
<
string
>
=
ref
(
''
);
const
fullName
:
Ref
<
string
>
=
ref
(
''
);
const
artistName
:
Ref
<
string
|
null
|
undefined
>
=
ref
();
...
...
@@ -309,6 +310,8 @@ export default defineComponent({
};
const
selectedFile
=
(
value
:
BannerType
)
=>
{
console
.
log
(
value
,
'banners'
);
banners
.
value
.
push
(
value
);
console
.
log
(
banners
.
value
);
};
...
...
@@ -374,6 +377,7 @@ export default defineComponent({
const
addStory
=
(
value
:
StoriesType
)
=>
{
stories
.
value
.
push
(
value
);
console
.
log
(
stories
,
'storiesstoriesstories'
);
};
const
deleteStory
=
(
idx
:
number
)
=>
{
...
...
@@ -404,29 +408,84 @@ export default defineComponent({
birthday
.
value
=
value
;
};
// const callApiUploadImage = async (file: File) => {
// try {
// const bodyFormData = new FormData();
// bodyFormData.append('file', file);
// const response = (await api({
// headers: { 'Content-Type': 'multipart/form-data' },
// url: 'http://cms.vab.xteldev.com/file/upload',
// method: 'POST',
// data: bodyFormData,
// })) as AxiosResponse<BaseResponseBody<FileUploadType>>;
// if (response.data.error.code === config.API_RES_CODE.OK.code) {
// }
// } catch (error) {}
// };
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
:
'http://cms.vab.xteldev.com/file/upload'
,
method
:
'POST'
,
data
:
bodyFormData
,
}))
as
AxiosResponse
<
BaseResponseBody
<
FileUploadType
>>
;
if
(
response
.
data
.
error
.
code
===
config
.
API_RES_CODE
.
OK
.
code
)
{
avatarUploaded
.
value
=
'http://cms.vab.xteldev.com/file/upload/'
+
response
.
data
.
data
.
fileName
;
}
}
catch
(
error
)
{}
};
const
callApiUploadBanners
=
async
(
file
:
File
,
index
:
number
)
=>
{
try
{
const
bodyFormData
=
new
FormData
();
bodyFormData
.
append
(
'file'
,
file
);
const
response
=
(
await
api
({
headers
:
{
'Content-Type'
:
'multipart/form-data'
},
url
:
'http://cms.vab.xteldev.com/file/upload'
,
method
:
'POST'
,
data
:
bodyFormData
,
}))
as
AxiosResponse
<
BaseResponseBody
<
FileUploadType
>>
;
if
(
response
.
data
.
error
.
code
===
config
.
API_RES_CODE
.
OK
.
code
)
{
const
bannerUpload
=
'http://cms.vab.xteldev.com/file/upload/'
+
response
.
data
.
data
.
fileName
;
banners
.
value
[
index
]
=
{
bannerUrl
:
bannerUpload
,
};
}
}
catch
(
error
)
{}
};
const
callApiUploadStories
=
async
(
file
:
File
,
idxStory
:
number
)
=>
{
try
{
const
bodyFormData
=
new
FormData
();
bodyFormData
.
append
(
'file'
,
file
);
const
response
=
(
await
api
({
headers
:
{
'Content-Type'
:
'multipart/form-data'
},
url
:
'http://cms.vab.xteldev.com/file/upload'
,
method
:
'POST'
,
data
:
bodyFormData
,
}))
as
AxiosResponse
<
BaseResponseBody
<
FileUploadType
>>
;
if
(
response
.
data
.
error
.
code
===
config
.
API_RES_CODE
.
OK
.
code
)
{
const
urlStoryUpload
=
'http://cms.vab.xteldev.com/file/upload/'
+
response
.
data
.
data
.
fileName
;
stories
.
value
[
idxStory
].
imageUrl
=
urlStoryUpload
;
}
}
catch
(
error
)
{}
};
const
updateInformationArtist
=
async
()
=>
{
try
{
// await callApiUploadImage(avatarFile.value as File);
if
(
avatarFile
.
value
!==
null
)
{
await
callApiUploadAvatar
(
avatarFile
.
value
);
}
for
(
let
index
=
0
;
index
<
banners
.
value
.
length
;
index
++
)
{
const
element
=
banners
.
value
[
index
];
if
(
element
.
file
!==
undefined
)
{
await
callApiUploadBanners
(
element
.
file
,
index
);
}
}
for
(
let
idx
=
0
;
idx
<
stories
.
value
.
length
;
idx
++
)
{
const
item
=
stories
.
value
[
idx
];
if
(
item
.
file
!==
undefined
)
{
await
callApiUploadStories
(
item
.
file
,
idx
);
}
}
const
response
=
(
await
api
({
url
:
API_PATHS
.
updateArtist
,
method
:
'POST'
,
data
:
{
id
:
route
.
params
.
id
,
avatar
:
avatar
.
value
,
avatar
:
avatar
Uploaded
.
value
,
artistCode
:
artistCode
.
value
,
artistName
:
artistName
.
value
,
// eslint-disable-next-line @typescript-eslint/restrict-plus-operands
...
...
src/pages/nghe-sy/index.vue
View file @
7e6a2497
...
...
@@ -20,6 +20,7 @@
outlined
></q-select>
</div>
<div
class=
"col-2"
dense
outlined
>
<q-select
v-model=
"professionSelected"
...
...
src/pages/them-nghe-sy/AddArtist.ts
View file @
7e6a2497
...
...
@@ -34,6 +34,7 @@ import {
SchedulesType
,
CardBankType
,
TypeCardType
,
FileUploadType
,
}
from
'src/assets/type'
;
export
type
AvatarType
=
{
...
...
@@ -87,6 +88,7 @@ export default defineComponent({
const
account
:
Ref
<
string
|
null
>
=
ref
(
null
);
const
avatar
:
Ref
<
string
|
null
>
=
ref
(
null
);
const
avatarFile
:
Ref
<
File
|
null
>
=
ref
(
null
);
const
avatarUploaded
:
Ref
<
string
|
null
>
=
ref
(
null
);
const
artistCode
:
Ref
<
string
>
=
ref
(
''
);
const
fullName
:
Ref
<
string
>
=
ref
(
''
);
const
artistName
:
Ref
<
string
|
null
|
undefined
>
=
ref
();
...
...
@@ -352,24 +354,86 @@ export default defineComponent({
stories
.
value
.
splice
(
idx
,
1
);
});
};
// const callApiUploadImage = async (file: File) => {
// try {
// const response = await api({
// url: API_PATHS.uploadImage,
// method: 'GET',
// params: {},
// });
// } catch (error) {}
// };
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
:
'http://cms.vab.xteldev.com/file/upload'
,
method
:
'POST'
,
data
:
bodyFormData
,
}))
as
AxiosResponse
<
BaseResponseBody
<
FileUploadType
>>
;
if
(
response
.
data
.
error
.
code
===
config
.
API_RES_CODE
.
OK
.
code
)
{
avatarUploaded
.
value
=
'http://cms.vab.xteldev.com/file/upload/'
+
response
.
data
.
data
.
fileName
;
}
}
catch
(
error
)
{}
};
const
callApiUploadBanners
=
async
(
file
:
File
,
index
:
number
)
=>
{
try
{
const
bodyFormData
=
new
FormData
();
bodyFormData
.
append
(
'file'
,
file
);
const
response
=
(
await
api
({
headers
:
{
'Content-Type'
:
'multipart/form-data'
},
url
:
'http://cms.vab.xteldev.com/file/upload'
,
method
:
'POST'
,
data
:
bodyFormData
,
}))
as
AxiosResponse
<
BaseResponseBody
<
FileUploadType
>>
;
if
(
response
.
data
.
error
.
code
===
config
.
API_RES_CODE
.
OK
.
code
)
{
const
bannerUpload
=
'http://cms.vab.xteldev.com/file/upload/'
+
response
.
data
.
data
.
fileName
;
banners
.
value
[
index
]
=
{
bannerUrl
:
bannerUpload
,
};
}
}
catch
(
error
)
{}
};
const
callApiUploadStories
=
async
(
file
:
File
,
idxStory
:
number
)
=>
{
try
{
const
bodyFormData
=
new
FormData
();
bodyFormData
.
append
(
'file'
,
file
);
const
response
=
(
await
api
({
headers
:
{
'Content-Type'
:
'multipart/form-data'
},
url
:
'http://cms.vab.xteldev.com/file/upload'
,
method
:
'POST'
,
data
:
bodyFormData
,
}))
as
AxiosResponse
<
BaseResponseBody
<
FileUploadType
>>
;
if
(
response
.
data
.
error
.
code
===
config
.
API_RES_CODE
.
OK
.
code
)
{
const
urlStoryUpload
=
'http://cms.vab.xteldev.com/file/upload/'
+
response
.
data
.
data
.
fileName
;
stories
.
value
[
idxStory
].
imageUrl
=
urlStoryUpload
;
}
}
catch
(
error
)
{}
};
const
addArtist
=
async
()
=>
{
try
{
if
(
avatarFile
.
value
!==
null
)
{
await
callApiUploadAvatar
(
avatarFile
.
value
);
}
for
(
let
index
=
0
;
index
<
banners
.
value
.
length
;
index
++
)
{
const
element
=
banners
.
value
[
index
];
if
(
element
.
file
!==
undefined
)
{
await
callApiUploadBanners
(
element
.
file
,
index
);
}
}
for
(
let
idx
=
0
;
idx
<
stories
.
value
.
length
;
idx
++
)
{
const
item
=
stories
.
value
[
idx
];
if
(
item
.
file
!==
undefined
)
{
await
callApiUploadStories
(
item
.
file
,
idx
);
}
}
const
response
=
(
await
api
({
url
:
API_PATHS
.
addArtist
,
method
:
'POST'
,
data
:
{
id
:
route
.
params
.
id
,
avatar
:
avatar
.
value
,
avatar
:
avatar
Uploaded
.
value
,
artistCode
:
artistCode
.
value
,
artistName
:
artistName
.
value
,
// eslint-disable-next-line @typescript-eslint/restrict-plus-operands
...
...
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