Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
C
cloud-platform-ui
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
youjj
cloud-platform-ui
Commits
680c86fe
Commit
680c86fe
authored
Aug 28, 2019
by
hanfeng
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
添加新闻模块
parent
6fe82b9b
Changes
3
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
823 additions
and
0 deletions
+823
-0
news.js
src/api/officialWebsite/news.js
+84
-0
popup.vue
src/views/xxOfficialWebsite/modal/popup.vue
+347
-0
newsList.vue
src/views/xxOfficialWebsite/newsList.vue
+392
-0
No files found.
src/api/officialWebsite/news.js
0 → 100644
View file @
680c86fe
import
fetch
from
'utils/fetch'
;
/**
* 获取列表
* @param query
*/
export
function
page
(
query
)
{
return
fetch
({
url
:
'/api/uccn/article/all'
,
method
:
'post'
,
data
:
query
});
}
/**
* 添加
* @param query
*/
export
function
add
(
query
)
{
return
fetch
({
url
:
'/api/uccn/article/add'
,
method
:
'post'
,
data
:
query
});
}
/**
* 删除
* @param query
*/
export
function
update
(
query
)
{
return
fetch
({
url
:
'/api/uccn/article/update'
,
method
:
'put'
,
data
:
query
});
}
/**
* 上架
* @param id
*/
export
function
putaway
(
id
)
{
return
fetch
({
url
:
'/api/uccn/article/putaway/'
+
id
,
method
:
'put'
});
}
/**
* 下架
* @param query
*/
export
function
soldOut
(
id
)
{
return
fetch
({
url
:
'/api/uccn/article/soldOut/'
+
id
,
method
:
'put'
,
});
}
/**
* 删除
* @param id
*/
export
function
remove
(
id
)
{
return
fetch
({
url
:
'/api/uccn/article/remove/'
+
id
,
method
:
'put'
});
}
/**
* 查询一条
* @param query
*/
export
function
getOne
(
query
)
{
return
fetch
({
url
:
'/api/uccn/article/app/unauth/one'
,
method
:
'get'
,
params
:
query
});
}
src/views/xxOfficialWebsite/modal/popup.vue
0 → 100644
View file @
680c86fe
<
template
>
<!-- 车型:创建、编辑 -->
<div>
<h4>
{{
popupTitle
}}
</h4>
<el-form
:model=
"form"
:rules=
"rules"
ref=
"form"
label-width=
"90px"
>
<el-row>
<el-col
:span=
"8"
>
<el-form-item
label=
"文章标题"
prop=
"title"
>
<el-input
v-model=
"form.title"
type=
"text"
placeholder=
"请输入文章标题"
></el-input>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col
:span=
"8"
>
<el-form-item
label=
"文章摘要"
prop=
"epitome"
>
<el-input
v-model=
"form.epitome"
type=
"text"
placeholder=
"请输入文章摘要"
></el-input>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col
:span=
"8"
>
<el-form-item
label=
"作者"
prop=
"author"
>
<el-input
v-model=
"form.author"
type=
"text"
placeholder=
"请输入文章作者"
></el-input>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col
:span=
"8"
>
<el-form-item
label=
"发布人"
prop=
"publisher"
>
<el-input
v-model=
"form.publisher"
type=
"text"
placeholder=
"请输入发布人"
></el-input>
</el-form-item>
</el-col>
</el-row>
<el-form-item
label=
"是否上架"
>
<el-radio
class=
"radio"
v-model=
"form.status"
label=
"1"
>
是
</el-radio>
<el-radio
class=
"radio"
v-model=
"form.status"
label=
"0"
>
否
</el-radio>
</el-form-item>
<el-row>
<el-col
:span=
"8"
>
<el-form-item
label=
"发布网站"
>
<el-radio
class=
"radio"
v-model=
"form.type"
label=
"0"
>
所有网站
</el-radio>
<el-radio
class=
"radio"
v-model=
"form.type"
label=
"1"
>
新欣房车官网
</el-radio>
<el-radio
class=
"radio"
v-model=
"form.type"
label=
"2"
>
滴房车官网
</el-radio>
</el-form-item>
</el-col>
</el-row>
<el-form-item
label=
"封面图"
>
<el-upload
class=
"upload-demo"
:headers=
"getHeaderWithToken"
:action=
"BASE_API+'/api/universal/file/app/unauth/admin/upload'"
:show-file-list=
"false"
:on-success=
"handleAvatarSuccess"
:on-progress=
"uploadProcess"
list-type=
"picture"
>
<el-progress
v-show=
"imgFlag == true"
type=
"circle"
:percentage=
"percent"
style=
"margin-top: 20px"
></el-progress>
<img
v-if=
"$utils.isString(form.coverImage) && !$utils.isEmpty(form.coverImage) && !imgFlag"
:src=
"form.coverImage"
style=
"width:300px;max-height:300px;"
>
<i
v-else-if=
"!imgFlag"
class=
"el-icon-plus avatar-uploader-icon"
style=
"lineHeight:100px;width:300px;height: 100px;border: 1px dashed #ccc;"
></i>
</el-upload>
</el-form-item>
<el-row>
<el-tabs
v-model=
"activeName"
type=
"card"
>
<el-tab-pane
label=
"文章内容"
name=
"first"
>
<div
class=
"editor-container"
v-if=
"activeName=='first'"
>
<UE
:editorId=
"activeName"
:defaultMsg=
"form.text"
:config=
config
ref=
"ue"
@
ready=
"editorReadyEvent"
></UE>
</div>
</el-tab-pane>
</el-tabs>
</el-row>
</el-form>
<div
slot=
"footer"
class=
"dialog-footer"
>
<el-button
@
click=
"cancel"
>
取 消
</el-button>
<el-button
type=
"primary"
v-if=
"popupTitle=='创建'"
@
click=
"create('form')"
>
确 定
</el-button>
<el-button
type=
"primary"
v-if=
"popupTitle=='编辑'"
@
click=
"update('form')"
>
确 定
</el-button>
</div>
</div>
</
template
>
<
style
>
textarea
{
display
:
none
;
}
.el-upload-list
{
display
:
flex
;
width
:
100px
;
}
.el-upload-list
li
{
margin-left
:
10px
;
}
</
style
>
<
script
>
import
UE
from
'../../modal/Ueditor'
;
//百度ue富文本
import
{
add
,
update
,
getOne
}
from
'src/api/officialWebsite/news'
;
import
{
getToken
}
from
'../../../utils/auth'
;
import
{
mapGetters
}
from
'vuex'
;
import
ElRow
from
"element-ui/packages/row/src/row"
;
import
ElCol
from
"element-ui/packages/col/src/col"
;
import
ElFormItem
from
"../../../../node_modules/element-ui/packages/form/src/form-item.vue"
;
import
ElRadio
from
"../../../../node_modules/element-ui/packages/radio/src/radio.vue"
;
export
default
{
props
:
[
"oneRow"
,
"popupTitle"
],
//
name
:
'popup'
,
components
:
{
ElRadio
,
ElFormItem
,
ElCol
,
ElRow
,
UE
},
data
()
{
return
{
imgPosterFlag
:
false
,
percent_poster
:
0
,
BASE_API
:
process
.
env
.
BASE_API
,
percent
:
0
,
//上传进度
imgFlag
:
false
,
config
:
{
initialFrameWidth
:
null
,
initialFrameHeight
:
350
},
fileList2
:
[],
activeName
:
''
,
form
:
{
title
:
undefined
,
status
:
'0'
,
type
:
'0'
,
epitome
:
undefined
,
text
:
""
,
author
:
undefined
,
publisher
:
undefined
},
rules
:
{
title
:
{
type
:
'string'
,
required
:
true
,
message
:
'请输入标题'
,
trigger
:
'blur'
},
epitome
:
{
type
:
'string'
,
required
:
true
,
message
:
'请输入文章摘要'
,
trigger
:
'blur'
},
},
}
},
created
()
{
},
mounted
()
{
this
.
getAllTag
();
// this.cleanForm();
},
computed
:
{
...
mapGetters
([
'elements'
,
'vehicleWarningMsgType'
]),
getHeaderWithToken
()
{
return
{
Authorization
:
getToken
()};
}
},
methods
:
{
getAllTag
()
{
this
.
activeName
=
'first'
;
if
(
this
.
popupTitle
==
"编辑"
){
let
row
=
this
.
oneRow
;
this
.
getOne
(
row
.
id
);
}
},
/**
* 封面图上传进度
* */
uploadProcess
(
event
,
file
,
fileList
)
{
this
.
imgFlag
=
true
;
console
.
log
(
event
.
percent
);
this
.
percent
=
Math
.
floor
(
event
.
percent
);
},
/**
* 封面图上传
* **/
handleAvatarSuccess
(
res
,
file
)
{
console
.
log
(
res
)
this
.
percent
=
0
;
this
.
imgFlag
=
false
;
this
.
form
.
coverImage
=
res
.
data
;
},
/**
* 创建
* */
create
(
formName
)
{
const
set
=
this
.
$refs
;
set
[
formName
].
validate
(
valid
=>
{
if
(
valid
)
{
add
(
this
.
form
).
then
(
response
=>
{
if
(
response
.
status
===
200
)
{
this
.
$notify
({
title
:
'成功'
,
message
:
'创建成功'
,
type
:
'success'
,
duration
:
2000
});
this
.
$emit
(
"oneDialogEvent"
,
true
);
}
else
{
this
.
$notify
({
title
:
'创建失败'
,
message
:
'操作失败!'
,
type
:
'error'
,
duration
:
2000
});
}
});
}
else
{
return
;
}
});
},
/**
* 编辑
* */
update
(
formName
)
{
const
set
=
this
.
$refs
;
set
[
formName
].
validate
(
valid
=>
{
if
(
valid
)
{
update
(
this
.
form
).
then
(
response
=>
{
if
(
response
.
status
===
200
)
{
this
.
$notify
({
title
:
'成功'
,
message
:
'编辑成功'
,
type
:
'success'
,
duration
:
2000
});
this
.
$emit
(
"oneDialogEvent"
,
true
);
}
else
{
this
.
$notify
({
title
:
'编辑失败'
,
message
:
'操作失败!'
,
type
:
'error'
,
duration
:
2000
});
}
});
}
else
{
return
;
}
});
},
/**
* 获取一条车型数据
* */
getOne
(
id
)
{
let
query
=
{
id
:
id
,
urlType
:
2
}
getOne
(
query
).
then
(
response
=>
{
if
(
this
.
$utils
.
isInteger
(
response
.
data
.
status
))
{
response
.
data
.
status
=
response
.
data
.
status
.
toString
()
response
.
data
.
type
=
response
.
data
.
type
.
toString
()
}
response
.
data
.
text
=
response
.
data
.
text
?
response
.
data
.
text
:
''
this
.
form
=
response
.
data
})
},
/**
* 深拷贝
*/
objDeepCopy
(
source
)
{
var
sourceCopy
=
source
instanceof
Array
?
[]
:
{};
for
(
var
item
in
source
)
{
sourceCopy
[
item
]
=
typeof
source
[
item
]
===
'object'
?
objDeepCopy
(
source
[
item
])
:
source
[
item
];
}
return
sourceCopy
;
},
/**
* 富文本内容
* @param step
*/
editorReadyEvent
(
instance
)
{
let
t
=
this
;
instance
.
addListener
(
'contentChange'
,
()
=>
{
t
.
form
.
text
=
instance
.
getContent
();
});
},
/**
* 关闭编辑
*/
cancel
(){
this
.
cleanForm
();
this
.
$emit
(
"oneDialogEvent"
,
false
);
},
/**
* 弹框数据
*/
cleanForm
()
{
this
.
activeName
=
''
;
this
.
form
=
{
title
:
undefined
,
status
:
'0'
,
type
:
'0'
,
epitome
:
undefined
,
text
:
""
,
author
:
undefined
,
publisher
:
undefined
}
}
}
}
</
script
>
<
style
>
.flex-aic
{
display
:
flex
;
align-items
:
center
;
}
.left-item
{
width
:
300px
;
border-left
:
1px
solid
#999
;
border-right
:
1px
solid
#999
;
border-bottom
:
1px
solid
#999
;
padding
:
3px
;
}
.right-item
{
width
:
400px
;
border-right
:
1px
solid
#999
;
border-bottom
:
1px
solid
#999
;
padding
:
3px
;
}
</
style
>
src/views/xxOfficialWebsite/newsList.vue
View file @
680c86fe
This diff is collapsed.
Click to expand it.
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