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
68388f04
Commit
68388f04
authored
Mar 25, 2023
by
Nguyễn Đức Thắng
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update
parent
b57305e0
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
57 additions
and
15 deletions
+57
-15
index.vue
src/components/add-update-post/index.vue
+27
-11
index.vue
src/pages/bai-viet/index.vue
+30
-4
No files found.
src/components/add-update-post/index.vue
View file @
68388f04
...
...
@@ -15,11 +15,14 @@
<q-card-section
class=
"q-pa-none"
>
<q-item>
<q-item-section>
<q-item-label
class=
"text-h6 text-weight-regular"
>
{{
isUpdate
?
$t
(
'post.dialogLabel.title.addPost'
)
:
$t
(
'post.dialogLabel.title.updatePost'
)
}}
</q-item-label>
<q-item-label
class=
"text-h6 text-weight-regular"
>
{{
isUpdate
?
$t
(
'post.dialogLabel.title.addPost'
)
:
$t
(
'post.dialogLabel.title.updatePost'
)
}}
</q-item-label
>
</q-item-section>
</q-item>
</q-card-section>
...
...
@@ -159,8 +162,18 @@
<div
class=
"col-12"
>
<div
class=
"q-gutter-sm"
>
<q-radio
v-model=
"shape"
val=
"0"
label=
"Nhập nội dung"
/>
<q-radio
v-model=
"shape"
val=
"1"
label=
"Upload File"
/>
<q-radio
v-model=
"shape"
@
click=
"handelCheck(0)"
val=
"0"
label=
"Nhập nội dung"
/>
<q-radio
v-model=
"shape"
@
click=
"handelCheck(1)"
val=
"1"
label=
"Upload File"
/>
</div>
</div>
<div
v-if=
"shape === '0'"
>
...
...
@@ -423,7 +436,6 @@ export default defineComponent({
},
},
methods
:
{},
setup
(
_
,
context
)
{
const
dialogCrop
=
ref
(
false
);
...
...
@@ -451,13 +463,15 @@ export default defineComponent({
}
else
{
shape
.
value
=
'0'
;
}
}
);
const
filePDF
=
ref
();
const
handelCheck
=
(
value
:
any
)
=>
{
context
.
emit
(
'shape'
,
value
)
}
const
selectedFilePDF
=
(
value
:
FileList
)
=>
{
context
.
emit
(
'SetFilePDF'
,
{
file
:
value
[
0
],
url
:
URL
.
createObjectURL
(
value
[
0
]),
...
...
@@ -632,6 +646,8 @@ export default defineComponent({
onOKCrop
,
handeDialogCrop
,
changeCrop
,
handelCheck
,
};
},
emits
:
[
...
...
@@ -641,7 +657,7 @@ export default defineComponent({
'update:category'
,
'update:content'
,
'update:status'
,
'shape'
,
'savePostInfo'
,
'SetAvatar'
,
'deleteAvatar'
,
...
...
src/pages/bai-viet/index.vue
View file @
68388f04
...
...
@@ -155,6 +155,7 @@
@
SetFilePDF=
"SetFilePDF($event)"
@
deleteAvatar=
"deleteAvatar"
@
savePostInfo=
"confirmUpdatePost"
@
shape=
"handlecheckShape"
/>
</div>
</template>
...
...
@@ -458,12 +459,10 @@ export default defineComponent({
avatarUploaded
.
value
=
imageChange
.
value
;
filePDFUploaded
.
value
=
urlPDF
.
value
as
string
;
}
void
updatePost
(
avatarUploaded
.
value
,
filePDFUploaded
.
value
)
void
updatePost
(
avatarUploaded
.
value
,
filePDFUploaded
.
value
);
};
const
updatePost
=
async
(
image
:
string
,
filePost
:
string
)
=>
{
const
updatePost
=
async
(
image
:
string
,
filePost
:
string
)
=>
{
const
data
=
{
id
:
postId
.
value
,
image
,
...
...
@@ -555,6 +554,7 @@ export default defineComponent({
params
:
{},
}))
as
AxiosResponse
<
BaseResponseBody
<
LanguageType
[]
>>
;
if
(
response
.
data
.
error
.
code
===
config
.
API_RES_CODE
.
OK
.
code
)
{
console
.
log
(
response
.
data
.
data
,
'response.data.data'
);
languageOptions
.
value
=
response
.
data
.
data
.
reduce
(
(
acc
:
FromType
,
info
)
=>
{
acc
.
push
({
...
...
@@ -575,6 +575,31 @@ export default defineComponent({
}
};
const
handlecheckShape
=
(
value
:
any
)
=>
{
if
(
value
===
1
)
{
const
data
=
[];
for
(
let
i
=
0
;
i
<
languageOptions
.
value
.
length
;
i
++
)
{
console
.
log
(
languageOptions
.
value
,
'languageOptions.value'
);
data
.
push
({
name
:
languageOptions
.
value
[
i
].
name
,
title
:
languageOptions
.
value
[
i
].
title
,
content
:
''
,
status
:
languageOptions
.
value
[
i
].
status
,
language
:
{
id
:
languageOptions
.
value
[
i
].
language
.
id
,
code
:
languageOptions
.
value
[
i
].
language
.
code
,
name
:
languageOptions
.
value
[
i
].
language
.
name
,
},
});
languageOptions
.
value
=
data
;
}
// void getLanguage()
}
else
{
urlPDF
.
value
=
null
;
}
};
onMounted
(()
=>
{
void
getListPost
();
void
getpostCategory
();
...
...
@@ -608,6 +633,7 @@ export default defineComponent({
image
,
postId
,
shape
,
handlecheckShape
,
setAvatar
,
SetFilePDF
,
callApiUploadAvatar
,
...
...
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