Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
jinli gu
MCMS
Commits
e1276926
Commit
e1276926
authored
Nov 29, 2019
by
tianbj
Browse files
优化
parent
b3ffa311
Changes
4
Hide whitespace changes
Inline
Side-by-side
src/main/webapp/WEB-INF/manager/cms/category/form.ftl
View file @
e1276926
...
@@ -208,6 +208,7 @@
...
@@ -208,6 +208,7 @@
var
that
=
this
;
var
that
=
this
;
ms
.http.get
(
ms
.manager
+
"/cms/category/list.do"
,{
pageSize
:
9999
})
.then
(
function
(
res
){
ms
.http.get
(
ms
.manager
+
"/cms/category/list.do"
,{
pageSize
:
9999
})
.then
(
function
(
res
){
if
(
res
.result
){
if
(
res
.result
){
//
res
.data.rows.push
({
id
:
0
,
categoryId
:
null
,
categoryTitle
:
'顶级栏目管理'
})
;
that
.treeList
=
ms
.util.treeData
(
res
.data.rows
,
'
id
'
,
'
categoryId
'
,
'
children
'
)
;
that
.treeList
=
ms
.util.treeData
(
res
.data.rows
,
'
id
'
,
'
categoryId
'
,
'
children
'
)
;
}
}
})
.catch
(
function
(
err
){
})
.catch
(
function
(
err
){
...
...
src/main/webapp/WEB-INF/manager/cms/content/form.ftl
View file @
e1276926
...
@@ -27,14 +27,9 @@
...
@@ -27,14 +27,9 @@
</el-col>
</el-col>
<el-col span="12">
<el-col span="12">
<el-form-item label="所属栏目" prop="contentCategoryId">
<el-form-item label="所属栏目" prop="contentCategoryId">
<el-cascader v-model="form.contentCategoryId"
<tree-select :props="
{
value
:
'
id
'
,
label
:
'
categoryTitle
'
,
children
:
'
children
'
}
"
:disabled="false"
:options="contentCategoryIdOptions" :style="
{
width
:
'
100
%'
}
"
:clearable="true"
v-model="form.contentCategoryId"></tree-select>
placeholder="请选择所属栏目"
:style="
{
width
:
'
100
%'
}
"
:options="contentCategoryIdTreeDatas"
:props="contentCategoryIdProps">
</el-cascader>
</el-form-item>
</el-form-item>
</el-col>
</el-col>
</el-row>
</el-row>
...
@@ -208,7 +203,7 @@
...
@@ -208,7 +203,7 @@
//
文章标题
//
文章标题
contentTitle
:
''
,
contentTitle
:
''
,
//
所属栏目
//
所属栏目
contentCategoryId
:
[]
,
contentCategoryId
:
''
,
//
文章类型
//
文章类型
contentType
:
[]
,
contentType
:
[]
,
//
是否显示
//
是否显示
...
@@ -241,16 +236,6 @@
...
@@ -241,16 +236,6 @@
},
},
watch
:{
watch
:{
},
},
computed
:{
contentCategoryIdTreeDatas
(){
let
cloneData
=
JSON
.parse
(
JSON
.stringify
(
this
.contentCategoryIdOptions
))
//
对源数据深度克隆
return
cloneData
.filter
(
father
=>
{
let
branchArr
=
cloneData
.filter
(
child
=>
father
.categoryId
==
child
.categoryCategoryId
)
//返回每一项的子级数组
branchArr
.length
>
0
?
father
.children
=
branchArr
:
''
//如果存在子级,则给父级添加一个
children
属性,并赋值
return
father
.categoryCategoryId
==
0
;
//返回第一层
})
;
},
},
methods
:
{
methods
:
{
save
()
{
save
()
{
var
that
=
this
;
var
that
=
this
;
...
@@ -262,7 +247,6 @@
...
@@ -262,7 +247,6 @@
if
(
valid
)
{
if
(
valid
)
{
that
.saveDisabled
=
true
;
that
.saveDisabled
=
true
;
var
data
=
JSON
.parse
(
JSON
.stringify
(
that
.form
))
;
var
data
=
JSON
.parse
(
JSON
.stringify
(
that
.form
))
;
data
.contentCategoryId
=
data
.contentCategoryId.join
(
'
,
'
)
;
data
.contentType
=
data
.contentType.join
(
'
,
'
)
;
data
.contentType
=
data
.contentType.join
(
'
,
'
)
;
data
.contentImg
=
JSON
.stringify
(
data
.contentImg
)
;
data
.contentImg
=
JSON
.stringify
(
data
.contentImg
)
;
ms
.http.post
(
url
,
data
)
.then
(
function
(
data
)
{
ms
.http.post
(
url
,
data
)
.then
(
function
(
data
)
{
...
@@ -272,7 +256,7 @@
...
@@ -272,7 +256,7 @@
message
:
'保存成功'
,
message
:
'保存成功'
,
type
:
'
success
'
type
:
'
success
'
})
;
})
;
location
.href
=
ms
.manager
+
"/cms/content/in
dex
.do"
;
location
.href
=
ms
.manager
+
"/cms/content/
ma
in.do"
;
}
else
{
}
else
{
that
.
$notify
({
that
.
$notify
({
title
:
'失败'
,
title
:
'失败'
,
...
@@ -293,8 +277,9 @@
...
@@ -293,8 +277,9 @@
var
that
=
this
;
var
that
=
this
;
ms
.http.get
(
ms
.manager
+
"/cms/content/get.do"
,
{
"id"
:
id
})
.then
(
function
(
res
)
{
ms
.http.get
(
ms
.manager
+
"/cms/content/get.do"
,
{
"id"
:
id
})
.then
(
function
(
res
)
{
if
(
res
.result
&&
res
.data
){
if
(
res
.result
&&
res
.data
){
res
.data.contentCategoryId
=
res
.data.contentCategoryId.split
(
'
,
'
)
;
if
(
res
.data.contentType
){
res
.data.contentType
=
res
.data.contentType.split
(
'
,
'
)
;
res
.data.contentType
=
res
.data.contentType.split
(
'
,
'
)
;
}
if
(
res
.data.contentImg
){
if
(
res
.data.contentImg
){
res
.data.contentImg
=
JSON
.parse
(
res
.data.contentImg
)
;
res
.data.contentImg
=
JSON
.parse
(
res
.data.contentImg
)
;
res
.data.contentImg.forEach
(
function
(
value
){
res
.data.contentImg.forEach
(
function
(
value
){
...
@@ -312,9 +297,11 @@
...
@@ -312,9 +297,11 @@
//获取
contentCategoryId
数据源
//获取
contentCategoryId
数据源
contentCategoryIdOptionsGet
()
{
contentCategoryIdOptionsGet
()
{
var
that
=
this
;
var
that
=
this
;
ms
.http.get
(
ms
.manager
+'/
mdiy
/
dict
/
list
.do
'
,
{})
.then
(
function
(
data
)
{
ms
.http.get
(
ms
.manager
+
"/cms/category/list.do"
,{
pageSize
:
9999
})
.then
(
function
(
res
){
that
.contentCategoryIdOptions
=
data
.rows
;
if
(
res
.result
){
})
.catch
(
function
(
err
)
{
that
.contentCategoryIdOptions
=
ms
.util.treeData
(
res
.data.rows
,
'
id
'
,
'
categoryId
'
,
'
children
'
)
;
}
})
.catch
(
function
(
err
){
console
.log
(
err
)
;
console
.log
(
err
)
;
})
;
})
;
},
},
...
@@ -363,4 +350,9 @@
...
@@ -363,4 +350,9 @@
}
}
}
}
}
);
}
);
</
script
>
</
script
>
\ No newline at end of file
<
style
>
.el-select
{
width: 100%;
}
</
style
>
\ No newline at end of file
src/main/webapp/WEB-INF/manager/cms/content/index.ftl
View file @
e1276926
...
@@ -10,7 +10,9 @@
...
@@ -10,7 +10,9 @@
<
div
id="index" v-cloak>
<
div
id="index" v-cloak>
<!--左侧-->
<!--左侧-->
<el-container class="index-menu">
<el-container class="index-menu">
<div class="left-tree"></div>
<div class="left-tree">
<el-tree :indent="5" v-loading="loading" :expand-on-click-node="false" default-expand-all :empty-text="emptyText" :data="treeData" :props="defaultProps" @node-click="handleNodeClick" style="padding: 10px;height: 100%;"></el-tree>
</div>
<iframe :src="action" class="ms-iframe-style">
<iframe :src="action" class="ms-iframe-style">
</iframe>
</iframe>
</el-container>
</el-container>
...
@@ -22,11 +24,57 @@
...
@@ -22,11 +24,57 @@
el
:
"#index"
,
el
:
"#index"
,
data
:
{
data
:
{
action
:
""
,
//跳转页面
action
:
""
,
//跳转页面
defaultProps
:
{
children
:
'
children
'
,
label
:
'
categoryTitle
'
},
treeData
:
[]
,
loading
:
true
,
emptyText
:
''
,
},
},
methods
:{
methods
:{
handleNodeClick
:
function
(
data
){
this
.
$el
.getElementsByTagName
(
'
iframe
'
)[
0
]
.contentWindow.window.mainVue.form.contentCategoryId = data.id;
this
.
$el
.getElementsByTagName
(
'
iframe
'
)[
0
]
.contentWindow.window.mainVue.list();
},
treeList
:
function
(){
var
that
=
this
;
this
.loadState
=
false
;
this
.loading
=
true
;
ms
.http.get
(
ms
.manager
+
"/cms/category/list.do"
)
.then
(
function
(
res
)
{
if
(
that
.loadState
){
that
.loading
=
false
;
}
else
{
that
.loadState
=
true
}
if
(
!
res
.result
||
res
.data.total
<=
0
)
{
that
.emptyText
=
'暂无数据';
that
.treeData
=
[];
}
else
{
that
.emptyText
=
'';
that
.treeData
=
ms
.util.treeData
(
res
.data.rows
,
'
id
'
,
'
categoryId
'
,
'
children
'
)
;
that
.treeData
=
[
{
id
:
0
,
categoryTitle
:
'全部'
,
children
:
that
.treeData
,
}
]
}
})
.catch
(
function
(
err
)
{
console
.log
(
err
)
;
})
;
setTimeout
(()
=>
{
if
(
that
.loadState
){
that
.loading
=
false
;
}
else
{
that
.loadState
=
true
}
},
500
)
;
},
},
},
mounted
(){
mounted
(){
this
.action
=
ms
.manager
+
"/cms/content/main.do"
;
this
.action
=
ms
.manager
+
"/cms/content/main.do"
;
this
.treeList
()
;
}
}
}
)
}
)
</
script
>
</
script
>
...
...
src/main/webapp/WEB-INF/manager/cms/content/main.ftl
View file @
e1276926
...
@@ -46,9 +46,9 @@
...
@@ -46,9 +46,9 @@
</el-form-item>
</el-form-item>
</el-col>
</el-col>
<el-col :span="8" style="text-align: right;padding-right: 10px;">
<el-col :span="8" style="text-align: right;padding-right: 10px;">
<el-button type="primary"size="mini" @click="$refs.search.open()"><i class="iconfont icon-shaixuan"></i>筛选</el-button>
<el-button type="primary" icon="el-icon-search" size="mini" @click="form.sqlWhere=null;currentPage=1;list()">查询</el-button>
<el-button type="primary" icon="el-icon-search" size="mini" @click="form.sqlWhere=null;currentPage=1;list()">查询</el-button>
<el-button @click="rest" icon="el-icon-refresh" size="mini">重置</el-button>
<el-button @click="rest" icon="el-icon-refresh" size="mini">重置</el-button>
<el-button type="primary"size="mini" @click="$refs.search.open()"><i class="iconfont icon-shaixuan"></i>筛选</el-button>
</el-col>
</el-col>
</el-row>
</el-row>
</el-form>
</el-form>
...
@@ -60,17 +60,17 @@
...
@@ -60,17 +60,17 @@
{{
emptyText
}}
{{
emptyText
}}
</template>
</template>
<el-table-column type="selection" width="40"></el-table-column>
<el-table-column type="selection" width="40"></el-table-column>
<el-table-column label="
所属
栏目" align="left" prop="contentCategoryId" :formatter="contentCategoryIdFormat">
<el-table-column label="栏目
名
" align="left" prop="contentCategoryId" :formatter="contentCategoryIdFormat"
width="100"
>
</el-table-column>
</el-table-column>
<el-table-column label="文章标题" align="left" prop="contentTitle">
<el-table-column label="文章标题" align="left" prop="contentTitle">
</el-table-column>
</el-table-column>
<el-table-column label="
文章
作者" align="left" prop="contentAuthor">
<el-table-column label="作者" align="left" prop="contentAuthor"
width="100"
>
</el-table-column>
</el-table-column>
<el-table-column label="
自定义顺
序" width="
10
0" align="right" prop="contentSort">
<el-table-column label="
排
序" width="
6
0" align="right" prop="contentSort">
</el-table-column>
</el-table-column>
<el-table-column label="发布时间"
width="180"
align="center" prop="contentDatetime">
<el-table-column label="发布时间" align="center" prop="contentDatetime"
width="120"
>
</el-table-column>
</el-table-column>
<el-table-column label="操作" width="1
8
0" align="center">
<el-table-column label="操作" width="1
2
0" align="center">
<template slot-scope="scope">
<template slot-scope="scope">
<@shiro.hasPermission name="cms:content:update">
<@shiro.hasPermission name="cms:content:update">
<el-link type="primary" :underline="false" @click="save(scope.row.id)">编辑</el-link>
<el-link type="primary" :underline="false" @click="save(scope.row.id)">编辑</el-link>
...
@@ -137,6 +137,7 @@
...
@@ -137,6 +137,7 @@
contentTitle
:
null
,
contentTitle
:
null
,
//
文章类型
//
文章类型
contentType
:
null
,
contentType
:
null
,
contentCategoryId
:
''
,
},
},
},
},
methods
:{
methods
:{
...
@@ -280,9 +281,12 @@
...
@@ -280,9 +281,12 @@
//获取
contentCategoryId
数据源
//获取
contentCategoryId
数据源
contentCategoryIdOptionsGet
()
{
contentCategoryIdOptionsGet
()
{
var
that
=
this
;
var
that
=
this
;
ms
.http.get
(
ms
.manager
+'/
mdiy
/
dict
/
list
.do
'
,
{})
.then
(
function
(
data
)
{
ms
.http.get
(
ms
.manager
+
"/cms/category/list.do"
,{
pageSize
:
9999
})
.then
(
function
(
res
){
that
.contentCategoryIdOptions
=
data
.rows
;
if
(
res
.result
){
})
.catch
(
function
(
err
)
{
that
.contentCategoryIdOptions
=
res
.data.rows
;
}
that
.list
()
;
})
.catch
(
function
(
err
){
console
.log
(
err
)
;
console
.log
(
err
)
;
})
;
})
;
},
},
...
@@ -299,12 +303,12 @@
...
@@ -299,12 +303,12 @@
mounted
(){
mounted
(){
this
.contentCategoryIdOptionsGet
()
;
this
.contentCategoryIdOptionsGet
()
;
this
.contentTypeOptionsGet
()
;
this
.contentTypeOptionsGet
()
;
this
.form.contentCategoryId
=
ms
.util.getParameter
(
"categoryId"
)
if
(
history
.state
){
if
(
history
.state
){
this
.form
=
history
.state.form
;
this
.form
=
history
.state.form
;
this
.currentPage
=
history
.state.page.pageNo
;
this
.currentPage
=
history
.state.page.pageNo
;
this
.pageSize
=
history
.state.page.pageSize
;
this
.pageSize
=
history
.state.page.pageSize
;
}
}
this
.list
()
;
},
},
}
)
}
)
</
script
>
</
script
>
...
...
Write
Preview
Supports
Markdown
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