Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
C
confucius
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
罗超
confucius
Commits
6199ff14
Commit
6199ff14
authored
Apr 08, 2021
by
zhengke
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改
parent
a49598dd
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
141 additions
and
0 deletions
+141
-0
news-form.vue
src/components/system/news-form.vue
+141
-0
No files found.
src/components/system/news-form.vue
0 → 100644
View file @
6199ff14
<
template
>
<q-dialog
v-model=
"persistent"
content-class=
"bg-grey-1"
persistent
transition-show=
"scale"
transition-hide=
"scale"
>
<q-card
style=
"width: 800px;max-width:900px;"
>
<q-card-section>
<div
class=
"text-h6"
>
{{
objOption
.
Id
==
0
?
'新增网站新闻'
:
'修改网站新闻'
}}
</div>
</q-card-section>
<q-card-section
class=
"q-pt-none scroll"
style=
"max-height: 70vh"
>
<div
class=
"text-caption q-mb-lg q-px-md text-grey-6"
>
网站新闻
</div>
<div
class=
"row wrap"
>
<q-input
filled
stack-label
style=
"float:left;"
maxlength=
"20"
:dense=
"false"
v-model=
"objOption.Title"
ref=
"Title"
class=
"col-6 q-pr-lg q-pb-lg"
label=
"标题"
:rules=
"[val => !!val || '请填写新闻标题']"
/>
<q-input
filled
stack-label
style=
"float:left;"
maxlength=
"20"
:dense=
"false"
v-model=
"objOption.Content"
ref=
"Content"
class=
"col-6 q-pr-lg q-pb-lg"
label=
"内容"
/>
</div>
<div
class=
"row wrap"
style=
"align-items:end;"
>
<q-select
option-value=
"Id"
option-label=
"TypeName"
standout=
"bg-primary text-white"
class=
"col-6 q-pr-lg q-pr-lg"
v-model=
"objOption.TypeId"
:options=
"TypeList"
emit-value
map-options
label=
"类型"
/>
<div
class=
"col-6 q-pb-lg q-pr-lg"
>
<q-uploader
:style=
"
{ backgroundImage: 'url(' + objOption.Img + ')' }" style="width:auto;height:200px" flat
hide-upload-btn max-files="1" label="类型图片" accept=".jpg, image/*" :factory="uploadFile" auto-upload>
</q-uploader>
</div>
</div>
</q-card-section>
<q-separator
/>
<q-card-actions
align=
"right"
class=
"bg-white"
>
<q-btn
label=
"取消"
flat
color=
"grey-10"
style=
"font-weight:400 !important"
@
click=
"closeSaveForm"
/>
<q-btn
label=
"立即提交"
color=
"accent q-px-md"
style=
"font-weight:400 !important"
:loading=
"saveLoading"
@
click=
"saveWebkitMenu"
/>
</q-card-actions>
</q-card>
</q-dialog>
</
template
>
<
script
>
import
{
SetWebNews
,
GetWebNews
,
GetWebNewsTypeList
}
from
'../../api/system/webkit'
import
{
UploadSelfFile
}
from
"../../api/common/common"
;
export
default
{
props
:
{
saveObj
:
{
type
:
Object
,
default
:
null
}
},
data
()
{
return
{
persistent
:
true
,
objOption
:
{
Id
:
0
,
Title
:
''
,
Img
:
''
,
Content
:
''
,
TypeId
:
0
},
optionTitle
:
""
,
saveLoading
:
false
,
TypeList
:
[],
}
},
mounted
()
{
this
.
getWebNews
();
this
.
initObj
()
},
methods
:
{
uploadFile
(
files
)
{
UploadSelfFile
(
"course"
,
files
[
0
],
res
=>
{
if
(
res
.
Code
==
1
)
{
this
.
objOption
.
Img
=
res
.
FileUrl
;
}
});
},
//初始化表单
initObj
()
{
if
(
this
.
saveObj
&&
this
.
saveObj
.
Id
>
0
)
{
GetWebNews
({
Id
:
this
.
saveObj
.
Id
}).
then
(
res
=>
{
this
.
objOption
.
Id
=
res
.
Data
.
Id
;
this
.
objOption
.
Title
=
res
.
Data
.
Title
;
this
.
objOption
.
Img
=
res
.
Data
.
Img
;
this
.
objOption
.
Content
=
res
.
Data
.
Content
;
this
.
objOption
.
TypeId
=
res
.
Data
.
TypeId
;
})
this
.
optionTitle
=
"修改新闻信息"
}
else
{
this
.
optionTitle
=
"新增新闻信息"
this
.
objOption
.
Id
=
0
;
this
.
objOption
.
Title
=
''
;
this
.
objOption
.
Img
=
''
;
this
.
objOption
.
Content
=
''
;
this
.
objOption
.
TypeId
=
0
;
}
},
//获取下拉数据
getWebNews
()
{
GetWebNewsTypeList
({}).
then
(
res
=>
{
this
.
TypeList
=
res
.
Data
;
let
obj
=
{
Id
:
0
,
TypeName
:
'不限'
}
this
.
TypeList
.
unshift
(
obj
);
}).
catch
(()
=>
{})
},
//关闭弹窗
closeSaveForm
()
{
this
.
$emit
(
'close'
)
this
.
persistent
=
false
},
//保存菜单
saveWebkitMenu
()
{
this
.
$refs
.
Title
.
validate
();
if
(
!
this
.
$refs
.
Title
.
hasError
)
{
this
.
saveLoading
=
true
SetWebNews
(
this
.
objOption
).
then
(
res
=>
{
this
.
saveLoading
=
false
this
.
$q
.
notify
({
icon
:
'iconfont icon-chenggong'
,
color
:
'accent'
,
timeout
:
2000
,
message
:
'数据保存成功!'
,
position
:
'top'
})
this
.
$emit
(
"success"
)
this
.
closeSaveForm
()
}).
catch
(()
=>
{
this
.
saveLoading
=
false
})
}
}
},
}
</
script
>
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