Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
glsx-web
/
glsx-oss-notice
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit 647dce37
authored
Apr 16, 2019
by
cwq0219
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
详情、编辑弹窗
1 parent
7e981a2d
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
97 additions
and
121 deletions
src/api/noticeManage.js
src/views/noticeManage/AddDialog.vue
src/views/noticeManage/DetailDialog.vue
src/views/noticeManage/Editor.vue
src/views/noticeManage/index.vue
src/api/noticeManage.js
View file @
647dce3
...
...
@@ -5,7 +5,8 @@ const methods = {
Search
:
`
${
path
}
search`
,
UserCountSearch
:
`
${
path_push
}
.push.search`
,
CancelPublish
:
`
${
path_push
}
.publish.cancel`
,
MerchantGroup
:
`
${
path_merchant
}
.group.dict`
MerchantGroup
:
`
${
path_merchant
}
.group.dict`
,
Detail
:
`
${
path_push
}
.detail`
}
export
{
methods
...
...
src/views/noticeManage/AddDialog.vue
View file @
647dce3
...
...
@@ -18,11 +18,11 @@
prop=
"title"
>
<gl-input
v-model=
"noticeForm.title"
v-model=
"noticeForm.tit
i
le"
placeholder=
"请输入标题"
name=
"title"
data-vv-as=
"标题"
v-validate=
"'required|max:
3
0'"
v-validate=
"'required|max:
10
0'"
clearable
></gl-input>
<span
...
...
src/views/noticeManage/DetailDialog.vue
View file @
647dce3
...
...
@@ -18,20 +18,9 @@
prop=
"title"
>
<gl-input
readonly=
"true"
v-model=
"noticeForm.title"
placeholder=
"请输入标题"
name=
"title"
data-vv-as=
"标题"
v-validate=
"'required|max:30'"
clearable
readonly=
"readonly"
v-model=
"noticeForm.titile"
></gl-input>
<span
v-show=
"errorBags.has('title')"
class=
"error"
>
{{
errorBags
.
first
(
'title'
)
}}
</span>
</gl-form-item>
<gl-form-item
label=
"内容详情:"
...
...
@@ -39,110 +28,48 @@
>
<div>
<editor
:isClear=
"isClear"
name=
"context"
data-vv-as=
"内容"
v-validate=
"'required'"
:isEditable=
"isEditable"
v-model=
"noticeForm.context"
></editor>
</div>
<span
v-show=
"errorBags.has('context')"
class=
"error"
>
{{
errorBags
.
first
(
'context'
)
}}
</span>
</gl-form-item>
<gl-form-item
label=
"发送对象:"
prop=
"sendObj"
>
<gl-checkbox-group
v-model=
"noticeForm.sendObj"
name=
"sendObj"
data-vv-as=
"发送对象"
v-validate=
"'required'"
>
<gl-checkbox-group
v-model=
"noticeForm.sendObj"
>
<gl-checkbox
v-for=
"item in sendObjList"
:label=
"item.value"
:key=
"item.value"
disabled
>
{{
item
.
label
}}
</gl-checkbox>
</gl-checkbox-group>
<span
v-show=
"errorBags.has('sendObj')"
class=
"error"
>
{{
errorBags
.
first
(
'sendObj'
)
}}
</span>
</gl-form-item>
<gl-form-item
label=
"上传附件:"
prop=
"attachment"
class=
"download"
>
<gl-upload
class=
"upload-demo"
action=
"https://jsonplaceholder.typicode.com/posts/"
name=
"attachment"
v-validate=
"'required'"
data-vv-as=
"附件"
:limit=
"2"
:before-upload=
"beforeUpload"
:on-success=
"handleSuccess"
:on-error=
"handleError"
:on-remove=
"handleRemove"
:file-list=
"fileList"
>
<gl-button
size=
"small"
type=
"primary"
>
点击上传
</gl-button>
<div
slot=
"tip"
class=
"el-upload__tip"
>
请上传小于20MB的文件
</div>
</gl-upload>
<span
v-show=
"errorBags.has('attachment')"
class=
"error"
>
{{
errorBags
.
first
(
'attachment'
)
}}
</span>
<!--
<a
href=
"http://down8.5156edu.com/showzipdown4.php?f_type1=2&id=96098"
>
下载附件
</a>
-->
<a
href=
"https://cdn.shopify.com/s/files/1/1545/3617/files/SH01_User_Manaul.pdf"
download=
"SH01_User_Manaul.pdf"
>
下载附件
</a>
</gl-form-item>
<gl-form-item
label=
"展示方式:"
prop=
"showType"
>
<gl-radio-group
v-model=
"noticeForm.showType"
>
<gl-radio-group
v-model=
"noticeForm.showType"
disabled
>
<gl-radio
v-for=
"item in showTypeList"
:label=
"item.value"
:key=
"item.value"
name=
"showType"
data-vv-as=
"展示方式"
v-validate=
"'required'"
>
{{
item
.
label
}}
</gl-radio>
</gl-radio-group>
<!--
<p>
说明:没有勾选则为默认形式,即在消息中心中展示
</p>
-->
<span
v-show=
"errorBags.has('showType')"
class=
"error"
>
{{
errorBags
.
first
(
'showType'
)
}}
</span>
</gl-form-item>
</gl-form>
<!--
<span
slot=
"footer"
>
<el-button
type=
"primary"
@
click=
"handleDraft"
>
保存草稿
</el-button>
<el-button
type=
"primary"
@
click=
"handleComfrim"
>
审核并发布
</el-button>
<el-button
@
click=
"handleClose"
>
取消发布
</el-button>
</span>
-->
</gl-dialog>
</div>
</
template
>
...
...
@@ -156,10 +83,12 @@ export default {
},
data
()
{
return
{
isClear
:
false
,
// isClear: false,
readonly
:
true
,
isEditable
:
false
,
// 通过数据watch
title
:
'通知详情'
,
fileList
:
[],
//
fileList: [],
sendObjList
:
[
{
label
:
'爱车保镖分组'
,
...
...
@@ -173,11 +102,11 @@ export default {
}
],
showTypeList
:
[{
label
:
'置顶消息'
,
value
:
'2'
},
{
label
:
'弹出框'
,
value
:
'1'
},
{
label
:
'置顶消息'
,
value
:
'2'
}],
rules
:
{
title
:
[{
required
:
true
}],
...
...
@@ -213,25 +142,25 @@ export default {
},
methods
:
{
// 上传附件,限制用户上传的附件格式和大小
beforeUpload
(
file
)
{
const
isLT20M
=
file
.
size
/
1024
/
1024
<
20
!
isLT20M
&&
this
.
$message
.
error
(
'上传附件大小不能超过20M'
)
return
isLT20M
},
handleSuccess
(
file
,
fileList
)
{
this
.
fileList
=
[{
name
:
fileList
.
name
,
url
:
fileList
.
url
}]
this
.
noticeForm
.
attachment
=
fileList
.
url
// 移除验证
// this.errorBags.remove('attachment')
},
handleError
()
{
this
.
$message
.
error
(
'上传失败,请重新上传!'
)
},
handleRemove
(
file
,
fileList
)
{
this
.
noticeForm
.
attachment
=
''
// 添加验证
// this.$validator.validate('attachment', this.noticeForm.attachment)
},
//
beforeUpload(file) {
//
const isLT20M = file.size / 1024 / 1024 < 20
//
!isLT20M && this.$message.error('上传附件大小不能超过20M')
//
return isLT20M
//
},
//
handleSuccess(file, fileList) {
//
this.fileList = [{ name: fileList.name, url: fileList.url }]
//
this.noticeForm.attachment = fileList.url
//
// 移除验证
//
// this.errorBags.remove('attachment')
//
},
//
handleError() {
//
this.$message.error('上传失败,请重新上传!')
//
},
//
handleRemove(file, fileList) {
//
this.noticeForm.attachment = ''
//
// 添加验证
//
// this.$validator.validate('attachment', this.noticeForm.attachment)
//
},
handleClose
()
{
console
.
log
(
this
.
noticeForm
)
this
.
$emit
(
'hideDialog'
)
...
...
@@ -247,4 +176,26 @@ export default {
.detail
.el-select
{
width
:
100%
;
}
.detail
.download
a
{
color
:
#409eff
;
text-decoration
:
underline
;
}
.detail
.el-checkbox__input.is-disabled
+
span
.el-checkbox__label
,
.detail
.el-radio__input.is-disabled
+
span
.el-radio__label
{
color
:
#606266
;
}
.detail
.el-checkbox__input.is-disabled.is-checked
.el-checkbox__inner
,
.detail
.el-radio__input.is-disabled.is-checked
.el-radio__inner
{
border-color
:
#409eff
;
background
:
#409eff
;
}
.detail
.el-checkbox__input.is-disabled.is-checked
.el-checkbox__inner
::after
{
border-color
:
#fff
;
}
.detail
.el-radio__input.is-disabled.is-checked
.el-radio__inner
::after
{
background-color
:
#fff
;
}
.detail
.el-radio
:focus:not
(
.is-focus
)
:not
(
:active
)
.el-radio__inner
{
box-shadow
:
0
0
;
}
</
style
>
\ No newline at end of file
src/views/noticeManage/Editor.vue
View file @
647dce3
...
...
@@ -32,6 +32,10 @@ export default {
isClear
:
{
type
:
Boolean
,
default
:
false
},
isEditable
:
{
type
:
Boolean
,
default
:
true
}
},
watch
:
{
...
...
@@ -121,6 +125,8 @@ export default {
}
// 创建富文本编辑器
this
.
editor
.
create
()
// 禁用编辑功能
!
this
.
isEditable
&&
this
.
editor
.
$textElem
.
attr
(
'contenteditable'
,
false
)
}
}
}
...
...
src/views/noticeManage/index.vue
View file @
647dce3
...
...
@@ -68,7 +68,7 @@
<gl-button
class=
"newButton"
type=
"primary"
@
click=
"handleAdd"
@
click=
"handleAdd
(true)
"
>
创建通知
</gl-button>
</gl-form-item>
</gl-col>
...
...
@@ -229,7 +229,8 @@ export default {
// 编辑弹窗参数-start
addVisible
:
false
,
noticeForm
:
{
title
:
''
,
recordId
:
''
,
titile
:
''
,
context
:
''
,
// 发送对象
sendObj
:
[],
...
...
@@ -340,7 +341,8 @@ export default {
label
:
'详情'
,
type
:
'text'
,
callback
:
(
index
,
row
)
=>
{
// console.log(row[index])
this
.
noticeDetail
(
row
[
index
].
recordId
)
}
},
{
...
...
@@ -367,7 +369,7 @@ export default {
return
row
.
publishStatus
===
1
?
null
:
'编辑'
},
callback
:
(
index
,
row
)
=>
{
this
.
noticeDetail
(
row
[
index
].
recordId
,
1
)
}
}
]
...
...
@@ -538,10 +540,25 @@ export default {
})
.
catch
(
err
=>
console
.
log
(
err
))
},
// 公告详情
noticeDetail
(
recordId
,
isEdit
=
0
)
{
const
params
=
{
'recordId'
:
recordId
}
params
.
method
=
nmMethods
.
Detail
request
.
req
(
params
).
then
(
res
=>
{
console
.
log
(
res
)
for
(
var
item
in
this
.
noticeForm
)
{
this
.
noticeForm
[
item
]
=
res
[
item
]
}
// console.log(this.noticeForm)
isEdit
?
this
.
handleAdd
()
:
this
.
handleDetail
()
}).
catch
(
err
=>
{
notice
.
errorTips
(
err
)
})
},
// 新增公告
handleAdd
()
{
this
.
noticeForm
.
showType
=
'1'
// this.noticeForm.context = '<p>fdasfdasf</p><p><img src="https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1555392730451&di=6f2af72a691e8f7a19a436d63a40124b&imgtype=0&src=http%3A%2F%2Fb-ssl.duitang.com%2Fuploads%2Fitem%2F20182%2F21%2F2018221142159_MZ33z.jpeg" style="max-width:100%;"><
br></p><p><br>
</p>'
handleAdd
(
isCreate
)
{
isCreate
&&
(
this
.
noticeForm
.
showType
=
'1'
)
// this.noticeForm.context = '<p>fdasfdasf</p><p><img src="https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1555392730451&di=6f2af72a691e8f7a19a436d63a40124b&imgtype=0&src=http%3A%2F%2Fb-ssl.duitang.com%2Fuploads%2Fitem%2F20182%2F21%2F2018221142159_MZ33z.jpeg" style="max-width:100%;"><
/p><p></p><p>gfdgdg</p><p>gfdgdg
</p>'
this
.
addVisible
=
!
this
.
addVisible
},
handleAddHide
()
{
...
...
@@ -553,11 +570,12 @@ export default {
resetSearch
(
this
.
noticeForm
)
},
// 通知详情
handleDetail
()
{
handleDetail
(
recordId
)
{
this
.
detailVisible
=
!
this
.
detailVisible
},
handleDetailHide
()
{
this
.
handleDetail
()
this
.
detailVisible
=
!
this
.
detailVisible
resetSearch
(
this
.
noticeForm
)
}
}
}
...
...
Write
Preview
Markdown
is supported
Attach a file
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 post a comment