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
70541b9a
Commit
70541b9a
authored
Jan 31, 2020
by
信 赵
Browse files
修复兼容问题 删除多余的方法体
parent
6201a48d
Changes
11
Expand all
Hide whitespace changes
Inline
Side-by-side
src/main/webapp/WEB-INF/manager/cms/category/form.ftl
View file @
70541b9a
...
@@ -232,12 +232,12 @@
...
@@ -232,12 +232,12 @@
<
script
>
<
script
>
var form = new Vue(
{
var form = new Vue(
{
el
:
'#
form
'
,
el
:
'#
form
'
,
data
()
{
data
:
function
()
{
return
{
return
{
treeList
:
[
{
treeList
:
[
{
id
:
'
0
'
,
id
:
'
0
'
,
categoryTitle
:
'顶级栏目'
,
categoryTitle
:
'顶级栏目'
,
children
:
[]
,
children
:
[]
}
]
,
}
]
,
categoryList
:
[]
,
categoryList
:
[]
,
saveDisabled
:
false
,
saveDisabled
:
false
,
...
@@ -269,7 +269,13 @@
...
@@ -269,7 +269,13 @@
//栏目字典
//栏目字典
categoryFlag
:
[]
categoryFlag
:
[]
},
},
categoryTypeOptions
:
[
{
"value"
:
"1"
,
"label"
:
"列表"
},
{
"value"
:
"2"
,
"label"
:
"封面"
}
]
,
categoryTypeOptions
:
[
{
"value"
:
"1"
,
"label"
:
"列表"
},
{
"value"
:
"2"
,
"label"
:
"封面"
}
]
,
categoryListUrlOptions
:
[]
,
categoryListUrlOptions
:
[]
,
categoryUrlOptions
:
[]
,
categoryUrlOptions
:
[]
,
mdiyModelIdOptions
:
[]
,
mdiyModelIdOptions
:
[]
,
...
@@ -279,16 +285,26 @@
...
@@ -279,16 +285,26 @@
categoryTitle
:
[
{
categoryTitle
:
[
{
"required"
:
true
,
"required"
:
true
,
"message"
:
"请选择栏目管理名称"
"message"
:
"请选择栏目管理名称"
},
{
"pattern"
:
/^[^[!@#$%^&
*
()
_+-/~?!@#¥%…&
*
()——+—?》《:“‘’]+$/
,
"message"
:
"栏目管理名称格式不匹配"
}
]
,
},
{
categoryListUrl
:
[
{
"required"
:
true
,
"message"
:
"请选择列表模板"
}
]
,
"pattern"
:
/^[^[!@#$%^&
*
()
_+-/~?!@#¥%…&
*
()——+—?》《:“‘’]+$/
,
"message"
:
"栏目管理名称格式不匹配"
}
]
,
categoryListUrl
:
[
{
"required"
:
true
,
"message"
:
"请选择列表模板"
}
]
,
//
内容模板
//
内容模板
categoryUrl
:
[
{
"required"
:
true
,
"message"
:
"请选择内容模板"
}
]
,
categoryUrl
:
[
{
},
"required"
:
true
,
"message"
:
"请选择内容模板"
}
}
]
}
}
;
},
},
watch
:
{
watch
:
{
'
form
.categoryId
'
:
function
(
n
,
o
)
{
'
form
.categoryId
'
:
function
(
n
,
o
)
{
var
_
this
=
this
;
if
(
n
==
this
.form.id
)
{
if
(
n
==
this
.form.id
)
{
this
.
$notify
({
this
.
$notify
({
title
:
'提示'
,
title
:
'提示'
,
...
@@ -297,12 +313,15 @@
...
@@ -297,12 +313,15 @@
})
;
})
;
return
;
return
;
}
}
this
.categoryList.forEach
(
item
=>
{
if
(
item
.categoryParentId
!=
null
&&
item
.categoryParentId
!=
""
&&
item
.categoryParentId.indexOf
(
this
.form.id
)
!=
-1
)
{
this
.categoryList.forEach
(
function
(
item
)
{
if
(
item
.categoryParentId
!=
null
&&
item
.categoryParentId
!=
""
&&
item
.categoryParentId.indexOf
(
_
this
.form.id
)
!=
-1
)
{
if
(
item
.id
==
n
)
{
if
(
item
.id
==
n
)
{
this
.form.categoryId
=
null
;
_
this
.form.categoryId
=
null
;
this
.
$refs
.tree.clearHandle
()
;
this
.
$notify
({
_
this
.
$refs
.tree.clearHandle
()
;
_
this
.
$notify
({
title
:
'提示'
,
title
:
'提示'
,
message
:
'不能选择子分类'
,
message
:
'不能选择子分类'
,
type
:
'
warning
'
type
:
'
warning
'
...
@@ -314,9 +333,11 @@
...
@@ -314,9 +333,11 @@
},
},
computed
:
{},
computed
:
{},
methods
:
{
methods
:
{
getTree
()
{
getTree
:
function
()
{
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
:
'顶级栏目管理'
})
;
//
res
.data.rows.push
({
id
:
0
,
categoryId
:
null
,
categoryTitle
:
'顶级栏目管理'
})
;
that
.categoryList
=
res
.data.rows
;
that
.categoryList
=
res
.data.rows
;
...
@@ -326,21 +347,24 @@
...
@@ -326,21 +347,24 @@
console
.log
(
err
)
;
console
.log
(
err
)
;
})
;
})
;
},
},
save
()
{
save
:
function
()
{
var
that
=
this
;
var
that
=
this
;
var
url
=
ms
.manager
+
"/cms/category/save.do"
var
url
=
ms
.manager
+
"/cms/category/save.do"
;
if
(
that
.form.id
>
0
)
{
if
(
that
.form.id
>
0
)
{
url
=
ms
.manager
+
"/cms/category/update.do"
;
url
=
ms
.manager
+
"/cms/category/update.do"
;
}
}
this
.
$refs
.form.validate
((
valid
)
=>
{
if
(
valid
)
{
this
.
$refs
.form.validate
(
function
(
valid
)
{
if
(
valid
)
{
//栏目属性为封面则不需要列表模板
//栏目属性为封面则不需要列表模板
if
(
that
.form.categoryType
==
'
2
'
)
{
if
(
that
.form.categoryType
==
'
2
'
)
{
that
.form.categoryListUrl
=
'';
that
.form.categoryListUrl
=
'';
}
}
that
.saveDisabled
=
true
;
that
.saveDisabled
=
true
;
var
data
=
JSON
.parse
(
JSON
.stringify
(
that
.form
))
;
var
data
=
JSON
.parse
(
JSON
.stringify
(
that
.form
))
;
if
(
data
.id
&&
data
.id
==
data
.categoryId
)
{
if
(
data
.id
&&
data
.id
==
data
.categoryId
)
{
that
.
$notify
({
that
.
$notify
({
title
:
'提示'
,
title
:
'提示'
,
...
@@ -348,12 +372,14 @@
...
@@ -348,12 +372,14 @@
type
:
'
error
'
type
:
'
error
'
})
;
})
;
that
.saveDisabled
=
false
;
that
.saveDisabled
=
false
;
return
return
;
}
}
if
(
data
.categoryId
==
'
0
'
)
{
if
(
data
.categoryId
==
'
0
'
)
{
data
.categoryId
=
'';
data
.categoryId
=
'';
}
}
if
(
data
.categoryFlag
){
if
(
data
.categoryFlag
)
{
data
.categoryFlag
=
data
.categoryFlag.join
(
'
,
'
)
;
data
.categoryFlag
=
data
.categoryFlag.join
(
'
,
'
)
;
}
}
...
@@ -373,44 +399,51 @@
...
@@ -373,44 +399,51 @@
type
:
'
warning
'
type
:
'
warning
'
})
;
})
;
}
}
that
.saveDisabled
=
false
;
that
.saveDisabled
=
false
;
})
;
})
;
}
else
{
}
else
{
return
false
;
return
false
;
}
}
})
})
;
},
},
//获取分类内容模型
//获取分类内容模型
getColumnContentModelId
:
function
()
{
getColumnContentModelId
:
function
()
{
var
that
=
this
;
var
that
=
this
;
ms
.http.get
(
ms
.manager
+
"/mdiy/model/list.do"
,
{
modelType
:
'
zdymx_wz
'
})
.then
(
ms
.http.get
(
ms
.manager
+
"/mdiy/model/list.do"
,
{
function
(
data
)
{
modelType
:
'
zdymx_wz
'
that
.mdiyModelIdOptions
=
data
.data.rows
;
})
.then
(
function
(
data
)
{
})
.catch
(
function
(
err
)
{
that
.mdiyModelIdOptions
=
data
.data.rows
;
})
.catch
(
function
(
err
)
{
console
.log
(
err
)
;
console
.log
(
err
)
;
})
;
})
;
},
},
//获取当前分类
//获取当前分类
get
(
id
)
{
get
:
function
(
id
)
{
var
that
=
this
;
var
that
=
this
;
ms
.http.get
(
ms
.manager
+
"/cms/category/get.do"
,
{
"id"
:
id
})
.then
(
function
(
res
)
{
ms
.http.get
(
ms
.manager
+
"/cms/category/get.do"
,
{
"id"
:
id
})
.then
(
function
(
res
)
{
if
(
res
.result
&&
res
.data
)
{
if
(
res
.result
&&
res
.data
)
{
if
(
res
.data.categoryFlag
){
if
(
res
.data.categoryFlag
)
{
res
.data.categoryFlag
=
res
.data.categoryFlag.split
(
'
,
'
)
;
res
.data.categoryFlag
=
res
.data.categoryFlag.split
(
'
,
'
)
;
}
}
if
(
res
.data.categoryImg
)
{
if
(
res
.data.categoryImg
)
{
res
.data.categoryImg
=
JSON
.parse
(
res
.data.categoryImg
)
;
res
.data.categoryImg
=
JSON
.parse
(
res
.data.categoryImg
)
;
res
.data.categoryImg.forEach
(
function
(
value
)
{
res
.data.categoryImg.forEach
(
function
(
value
)
{
value
.url
=
ms
.base
+
value
.path
value
.url
=
ms
.base
+
value
.path
;
})
})
;
}
else
{
}
else
{
res
.data.categoryImg
=
[]
res
.data.categoryImg
=
[]
;
}
}
if
(
!
res
.data.categoryId
)
{
if
(
!
res
.data.categoryId
)
{
res
.data.categoryId
=
'
0
';
res
.data.categoryId
=
'
0
';
}
}
that
.form
=
res
.data
;
//判断该分类是否存在文章,存在则不能修改栏目属性
that
.form
=
res
.data
;
//判断该分类是否存在文章,存在则不能修改栏目属性
that
.contentList
(
that
.form.id
)
;
that
.contentList
(
that
.form.id
)
;
}
}
})
.catch
(
function
(
err
)
{
})
.catch
(
function
(
err
)
{
...
@@ -420,7 +453,7 @@
...
@@ -420,7 +453,7 @@
contentList
:
function
(
id
)
{
contentList
:
function
(
id
)
{
var
that
=
this
;
var
that
=
this
;
ms
.http.post
(
ms
.manager
+
"/cms/content/list.do"
,
{
ms
.http.post
(
ms
.manager
+
"/cms/content/list.do"
,
{
contentCategoryId
:
id
,
contentCategoryId
:
id
})
.then
(
function
(
data
)
{
})
.then
(
function
(
data
)
{
if
(
data
.data.total
>
0
)
{
if
(
data
.data.total
>
0
)
{
that
.categoryTypeDisabled
=
true
;
that
.categoryTypeDisabled
=
true
;
...
@@ -432,7 +465,7 @@
...
@@ -432,7 +465,7 @@
})
;
})
;
},
},
//获取
categoryListUrl
数据源
//获取
categoryListUrl
数据源
categoryListUrlOptionsGet
()
{
categoryListUrlOptionsGet
:
function
()
{
var
that
=
this
;
var
that
=
this
;
ms
.http.get
(
ms
.manager
+
"/template/queryTemplateFileForColumn.do"
,
{})
.then
(
function
(
data
)
{
ms
.http.get
(
ms
.manager
+
"/template/queryTemplateFileForColumn.do"
,
{})
.then
(
function
(
data
)
{
that
.categoryListUrlOptions
=
data
.data
;
that
.categoryListUrlOptions
=
data
.data
;
...
@@ -441,7 +474,7 @@
...
@@ -441,7 +474,7 @@
})
;
})
;
},
},
//获取
categoryUrl
数据源
//获取
categoryUrl
数据源
categoryUrlOptionsGet
()
{
categoryUrlOptionsGet
:
function
()
{
var
that
=
this
;
var
that
=
this
;
ms
.http.get
(
ms
.manager
+
"/template/queryTemplateFileForColumn.do"
,
{})
.then
(
function
(
data
)
{
ms
.http.get
(
ms
.manager
+
"/template/queryTemplateFileForColumn.do"
,
{})
.then
(
function
(
data
)
{
that
.categoryUrlOptions
=
data
.data
;
that
.categoryUrlOptions
=
data
.data
;
...
@@ -449,51 +482,53 @@
...
@@ -449,51 +482,53 @@
console
.log
(
err
)
;
console
.log
(
err
)
;
})
;
})
;
},
},
//
categoryImg
文件上传完成回调
categoryImgSuccess
:
function
(
response
,
file
,
fileList
)
{
this
.form.categoryImg.push
({
url
:
file
.url
,
name
:
file
.name
,
path
:
response
,
uid
:
file
.uid
})
;
},
categoryImghandleRemove
:
function
(
file
,
files
)
{
var
index
=
-1
;
index
=
this
.form.categoryImg.findIndex
(
text
=>
text
==
file
)
;
if
(
index
!=
-1
)
{
this
.form.categoryImg.splice
(
index
,
1
)
;
}
},
//获取
categoryFlag
数据源
//获取
categoryFlag
数据源
categoryFlagOptionsGet
()
{
categoryFlagOptionsGet
:
function
()
{
var
that
=
this
;
var
that
=
this
;
ms
.http.get
(
ms
.base
+'/
mdiy
/
dict
/
list
.do
'
,
{
dictType
:
'栏目属性'
,
pageSize
:
99999
})
.then
(
function
(
res
)
{
ms
.http.get
(
ms
.base
+
'/
mdiy
/
dict
/
list
.do
'
,
{
dictType
:
'栏目属性'
,
pageSize
:
99999
})
.then
(
function
(
res
)
{
that
.categoryFlagOptions
=
res
.rows
;
that
.categoryFlagOptions
=
res
.rows
;
})
.catch
(
function
(
err
)
{
})
.catch
(
function
(
err
)
{
console
.log
(
err
)
;
console
.log
(
err
)
;
})
;
})
;
},
},
//
categoryImg
文件上传完成回调
//
categoryImg
文件上传完成回调
categoryImgSuccess
:
function
(
response
,
file
,
fileList
)
{
categoryImgSuccess
:
function
(
response
,
file
,
fileList
)
{
this
.form.categoryImg.push
({
url
:
file
.url
,
name
:
file
.name
,
path
:
response
,
uid
:
file
.uid
})
;
this
.form.categoryImg.push
({
url
:
file
.url
,
name
:
file
.name
,
path
:
response
,
uid
:
file
.uid
})
;
},
},
//上传超过限制
//上传超过限制
categoryImghandleExceed
:
function
(
files
,
fileList
)
{
categoryImghandleExceed
:
function
(
files
,
fileList
)
{
this
.
$notify
({
title
:
'当前最多上传
1
个文件'
,
type
:
'
warning
'
})
;
this
.
$notify
({
title
:
'当前最多上传
1
个文件'
,
type
:
'
warning
'
})
;
},
},
categoryImghandleRemove
:
function
(
file
,
files
)
{
categoryImghandleRemove
:
function
(
file
,
files
)
{
var
index
=
-1
;
var
index
=
-1
;
index
=
this
.form.categoryImg.findIndex
(
text
=>
text
==
file
)
;
index
=
this
.form.categoryImg.findIndex
(
function
(
text
)
{
return
text
==
file
;
})
;
if
(
index
!=
-1
)
{
if
(
index
!=
-1
)
{
this
.form.categoryImg.splice
(
index
,
1
)
;
this
.form.categoryImg.splice
(
index
,
1
)
;
}
}
},
}
},
},
created
()
{
created
:
function
()
{
this
.getColumnContentModelId
()
;
this
.getColumnContentModelId
()
;
this
.getTree
()
this
.getTree
()
;
this
.categoryListUrlOptionsGet
()
;
this
.categoryListUrlOptionsGet
()
;
this
.categoryUrlOptionsGet
()
;
this
.categoryUrlOptionsGet
()
;
this
.categoryFlagOptionsGet
()
;
this
.categoryFlagOptionsGet
()
;
this
.form.id
=
ms
.util.getParameter
(
"id"
)
;
this
.form.id
=
ms
.util.getParameter
(
"id"
)
;
if
(
this
.form.id
)
{
if
(
this
.form.id
)
{
this
.get
(
this
.form.id
)
;
this
.get
(
this
.form.id
)
;
}
else
{
}
else
{
...
@@ -506,4 +541,4 @@
...
@@ -506,4 +541,4 @@
.el-select
{
.el-select
{
width
:
100
%;
width
:
100
%;
}
}
</
style
>
</
style
>
\ No newline at end of file
src/main/webapp/WEB-INF/manager/cms/category/index.ftl
View file @
70541b9a
...
@@ -72,163 +72,177 @@
...
@@ -72,163 +72,177 @@
</template>
</template>
</el-table-column>
</el-table-column>
</el-table>
</el-table>
</el-main>
</el-main>
</div>
</div>
</
body
>
</
body
>
</
html
>
</
html
>
<
script
>
<
script
>
var
indexVue = new Vue(
{
"use strict";
el
:
'#
index
'
,
data
:{
var indexVue = new Vue(
{
dataList
:
[]
,
//分类列表
el
:
'#
index
'
,
selectionList
:
[]
,
//分类列表选中
data
:
{
loading
:
true
,
//加载状态
dataList
:
[]
,
emptyText
:
''
,
//提示文字
//分类列表
manager
:
ms
.manager
,
selectionList
:
[]
,
loadState
:
false
,
//分类列表选中
categoryTypeOptions
:
[
{
"value"
:
"1"
,
"label"
:
"列表"
},{
"value"
:
"2"
,
"label"
:
"封面"
}
]
,
loading
:
true
,
//搜索表单
//加载状态
form
:{
emptyText
:
''
,
//
栏目管理名称
//提示文字
categoryTitle
:
''
,
manager
:
ms
.manager
,
//
所属栏目
loadState
:
false
,
categoryId
:
''
,
categoryTypeOptions
:
[
{
//
栏目管理属性
"value"
:
"1"
,
categoryType
:
'
2
'
,
"label"
:
"列表"
//
自定义顺序
},
{
categorySort
:
0
,
"value"
:
"2"
,
//
列表模板
"label"
:
"封面"
categoryListUrl
:
''
,
}
]
,
//
内容模板
//搜索表单
categoryUrl
:
''
,
form
:
{
//
栏目管理关键字
//
栏目管理名称
categoryKeyword
:
''
,
categoryTitle
:
''
,
//
栏目管理描述
//
所属栏目
categoryDescrip
:
''
,
categoryId
:
''
,
//
缩略图
//
栏目管理属性
categoryImg
:
[]
,
categoryType
:
'
2
'
,
//
自定义链接
//
自定义顺序
categoryDiyUrl
:
''
,
categorySort
:
0
,
//
栏目管理的内容模型
id
//
列表模板
mdiyModelId
:
''
,
categoryListUrl
:
''
,
//
内容模板
categoryUrl
:
''
,
//
栏目管理关键字
categoryKeyword
:
''
,
//
栏目管理描述
categoryDescrip
:
''
,
//
缩略图
categoryImg
:
[]
,
//
自定义链接
categoryDiyUrl
:
''
,
//
栏目管理的内容模型
id
mdiyModelId
:
''
}
},
},
},
methods
:
{
methods
:{
//查询列表
//查询列表
list
:
function
()
{
list
:
function
()
{
var
that
=
this
;
var
that
=
this
;
this
.loadState
=
false
;
this
.loadState
=
false
;
this
.loading
=
true
;
this
.loading
=
true
;
ms
.http.get
(
ms
.manager
+
"/cms/category/list.do"
,
{
ms
.http.get
(
ms
.manager
+
"/cms/category/list.do"
,{
pageSize
:
999
pageSize
:
999
,
})
.then
(
function
(
res
)
{
})
.then
(
if
(
that
.loadState
)
{
function
(
res
)
{
that
.loading
=
false
;
if
(
that
.loadState
){
}
else
{
that
.loading
=
false
;
that
.loadState
=
true
;
}
else
{
}
that
.loadState
=
true
if
(
!
res
.result
||
res
.data.total
<=
0
)
{
that
.emptyText
=
'暂无数据';
that
.dataList
=
[];
}
else
{
that
.emptyText
=
'';
that
.dataList
=
ms
.util.treeData
(
res
.data.rows
,
'
id
'
,
'
categoryId
'
,
'
children
'
)
;
}
})
.catch
(
function
(
err
)
{
console
.log
(
err
)
;
})
;
setTimeout
(
function
()
{
if
(
that
.loadState
)
{
that
.loading
=
false
;
}
else
{
that
.loadState
=
true
;
}
},
500
)
;
},
copyUrl
:
function
()
{
var
clipboard
=
new
C
lipboardJS
(
'
.copyBtn
'
)
;
var
self
=
this
;
clipboard
.on
(
'
success
'
,
function
(
e
)
{
self
.
$notify
({
title
:
'提示'
,
message
:
"链接地址已保存到剪切板"
,
type
:
'
success
'
})
;
clipboard
.destroy
()
;
})
;
},
//分类列表选中
handleSelectionChange
:
function
(
val
)
{
this
.selectionList
=
val
;
},
//删除
del
:
function
(
row
)
{
var
that
=
this
;
that
.
$confirm
(
'此操作将永久删除所选内容
,
是否继续?'
,
'提示'
,
{
confirmButtonText
:
'确定'
,
cancelButtonText
:
'取消'
,
type
:
'
warning
'
})
.then
(
function
()
{
ms
.http.post
(
ms
.manager
+
"/cms/category/delete.do"
,
row
.length
?
row
:
[
row
]
,
{
headers
:
{
'
C
ontent-Type
'
:
'
application
/
json
'
}
}
if
(
!
res
.result
||
res
.data.total
<=
0
)
{
}
).then(function (res)
{
that
.emptyText
=
'暂无数据'
if
(
res
.result
)
{
that
.dataList
=
[];
that
.
$notify
({
type
:
'
success
'
,
message
:
'删除成功!'
})
;
//删除成功,刷新列表
that
.list
()
;
}
else
{
}
else
{
that
.emptyText
=
'';
that
.
$notify
({
that
.dataList
=
ms
.util.treeData
(
res
.data.rows
,
'
id
'
,
'
categoryId
'
,
'
children
'
)
;
title
:
'失败'
,
message
:
res
.msg
,
type
:
'
warning
'
})
;
}
}
})
.catch
(
function
(
err
)
{
}
);
console
.log
(
err
)
;
})
.catch
(
function
()
{
})
;
that
.
$notify
({
setTimeout
(()
=>
{
type
:
'
info
'
,
if
(
that
.loadState
){
message
:
'已取消删除'
that
.loading
=
false
;
})
;
}
else
{
that
.loadState
=
true
}
},
500
)
;
},
copyUrl
:
function
(){
var
clipboard
=
new
C
lipboardJS
(
'
.copyBtn
'
)
;
var
self
=
this
;
clipboard
.on
(
'
success
'
,
function
(
e
)
{
self
.
$notify
({
title
:
'提示'
,
message
:
"链接地址已保存到剪切板"
,
type
:
'
success
'
})
;
})
;
clipboard
.destroy
()
;
},
})
;
//表格数据转换
},
categoryTypeFormat
:
function
(
row
,
column
,
cellValue
,
index
)
{
//分类列表选中
var
value
=
""
;
handleSelectionChange
:
function
(
val
){
this
.selectionList
=
val
;
if
(
cellValue
)
{
},
var
data
=
this
.categoryTypeOptions.find
(
function
(
value
)
{
//删除
return
value
.value
==
cellValue
;
del
:
function
(
row
){
})
;
var
that
=
this
;
that
.
$confirm
(
'此操作将永久删除所选内容
,
是否继续?'
,
'提示'
,
{
if
(
data
&&
data
.label
)
{
confirmButtonText
:
'确定'
,
value
=
data
.label
;
cancelButtonText
:
'取消'
,
}
type
:
'
warning
'
})
.then
(()
=>
{
ms
.http.post
(
ms
.manager
+
"/cms/category/delete.do"
,
row
.length
?
row
:[
row
]
,
{
headers
:
{
'
C
ontent-Type
'
:
'
application
/
json
'
}
}
).then(
function
(
res
){
if
(
res
.result
)
{
that
.
$notify
({
type
:
'
success
'
,
message
:
'删除成功!'
})
;
//删除成功,刷新列表
that
.list
()
;
}
else
{
that
.
$notify
({
title
:
'失败'
,
message
:
res
.msg
,
type
:
'
warning
'
})
;
}
})
;
})
.catch
(()
=>
{
that
.
$notify
({
type
:
'
info
'
,
message
:
'已取消删除'
})
;
})
;
},
//表格数据转换
categoryTypeFormat
(
row
,
column
,
cellValue
,
index
){
var
value
=
""
;
if
(
cellValue
){
var
data
=
this
.categoryTypeOptions.find
(
function
(
value
){
return
value
.value
==
cellValue
;
})
if
(
data
&&
data
.label
){
value
=
data
.label
;
}
}
return
value
;
},
//新增
save
:
function
(
id
)
{
if
(
id
)
{
location
.href
=
this
.manager
+
"/cms/category/form.do?id="
+
id
;
}
else
{
location
.href
=
this
.manager
+
"/cms/category/form.do"
;
}
},
//重置表单
rest
:
function
()
{
this
.
$refs
.searchForm.resetFields
()
;
}
}
return
value
;
},
//新增
save
:
function
(
id
){
if
(
id
){
location
.href
=
this
.manager
+
"/cms/category/form.do?id="
+
id
;
}
else
{
location
.href
=
this
.manager
+
"/cms/category/form.do"
;
}
},
//重置表单
rest
(){
this
.
$refs
.searchForm.resetFields
()
;
},
},
},
created
:
function
()
{
created
(){
/
*
this
.categoryListUrlOptionsGet
()
;
/
*
this
.categoryListUrlOptionsGet
()
;
this
.categoryUrlOptionsGet
()
;
*
/
this
.categoryUrlOptionsGet
()
;
*
/
this
.list
()
;
this
.list
()
;
}
},
}
);
}
)
</
script
>
</
script
>
\ No newline at end of file
src/main/webapp/WEB-INF/manager/cms/content/form.ftl
View file @
70541b9a
...
@@ -247,12 +247,16 @@
...
@@ -247,12 +247,16 @@
<
script
>
<
script
>
var
form
=
new
V
ue
({
var
form
=
new
V
ue
({
el
:
'#
form
'
,
el
:
'#
form
'
,
data
()
{
data
:
function
()
{
return
{
return
{
saveDisabled
:
false
,
saveDisabled
:
false
,
activeName
:
'
form
'
,
activeName
:
'
form
'
,
model
:
undefined
,
//自定义模型实例
model
:
undefined
,
editableTabs
:
[
{
title
:
'文章编辑'
,
name
:
'
form
'
}
]
,
//自定义模型实例
editableTabs
:
[
{
title
:
'文章编辑'
,
name
:
'
form
'
}
]
,
editorConfig
:
{
editorConfig
:
{
imageScaleEnabled
:
true
,
imageScaleEnabled
:
true
,
autoHeightEnabled
:
true
,
autoHeightEnabled
:
true
,
...
@@ -268,7 +272,7 @@
...
@@ -268,7 +272,7 @@
},
},
contentCategoryIdOptions
:
[]
,
contentCategoryIdOptions
:
[]
,
returnIsShow
:
true
,
returnIsShow
:
true
,
type
:
''
,
type
:
''
,
//表单数据
//表单数据
form
:
{
form
:
{
//
文章标题
//
文章标题
...
@@ -292,74 +296,100 @@
...
@@ -292,74 +296,100 @@
//
关键字
//
关键字
contentKeyword
:
''
,
contentKeyword
:
''
,
//
文章内容
//
文章内容
contentDetails
:
''
,
contentDetails
:
''
},
},
contentTypeOptions
:
[]
,
contentTypeOptions
:
[]
,
categoryIdOptions
:
[]
,
categoryIdOptions
:
[]
,
contentDisplayOptions
:
[
{
"value"
:
"0"
,
"label"
:
"是"
},
{
"value"
:
"1"
,
"label"
:
"否"
}
]
,
contentDisplayOptions
:
[
{
"value"
:
"0"
,
"label"
:
"是"
},
{
"value"
:
"1"
,
"label"
:
"否"
}
]
,
rules
:
{
rules
:
{
//
文章标题
//
文章标题
contentTitle
:
[
{
"required"
:
true
,
"message"
:
"请选择文章标题"
}
]
,
contentTitle
:
[
{
"required"
:
true
,
"message"
:
"请选择文章标题"
}
]
,
//
发布时间
//
发布时间
contentDatetime
:
[
{
"required"
:
true
,
"message"
:
"发布时间不能为空"
}
]
,
contentDatetime
:
[
{
contentCategoryId
:
[
{
"required"
:
true
,
"message"
:
"所属栏目不能为空"
}
]
,
"required"
:
true
,
},
"message"
:
"发布时间不能为空"
}
]
,
}
contentCategoryId
:
[
{
"required"
:
true
,
"message"
:
"所属栏目不能为空"
}
]
}
}
;
},
},
watch
:
{},
watch
:
{},
computed
:{
computed
:
{
currCategory
(){
currCategory
:
function
()
{
var
that
=
this
;
var
that
=
this
;
return
this
.categoryIdOptions.find
(
function
(
value
){
return
this
.categoryIdOptions.find
(
function
(
value
)
{
return
value
.id
===
that
.form.contentCategoryId
return
value
.id
===
that
.form.contentCategoryId
;
})
})
;
}
,
}
},
},
methods
:
{
methods
:
{
save
()
{
save
:
function
()
{
var
that
=
this
;
var
_
this
=
this
;
//自定义模型需要验证
if
(
this
.model
&&!
this
.model.validate
()){
var
that
=
this
;
//自定义模型需要验证
if
(
this
.model
&&
!
this
.model.validate
())
{
this
.activeName
=
'
custom-name
';
this
.activeName
=
'
custom-name
';
return
;
return
;
}
}
var
url
=
ms
.manager
+
"/cms/content/save.do"
var
url
=
ms
.manager
+
"/cms/content/save.do"
;
if
(
that
.form.id
>
0
)
{
if
(
that
.form.id
>
0
)
{
url
=
ms
.manager
+
"/cms/content/update.do"
;
url
=
ms
.manager
+
"/cms/content/update.do"
;
}
}
this
.
$refs
.form
[
0
]
.validate((valid) =>
{
this
.
$refs
.form
[
0
]
.validate(function (valid)
{
if
(
valid
)
{
if
(
valid
)
{
that
.saveDisabled
=
true
;
that
.saveDisabled
=
true
;
//判断
//判断
if
(
that
.categoryIdOptions.filter
(
f
=>
f
['
id
']
==
that
.form.contentCategoryId
)[
0
]
.categoryType == '2' && that.returnIsShow)
{
if
(
that
.categoryIdOptions.filter
(
function
(
f
)
{
return
f
['
id
']
==
that
.form.contentCategoryId
;
})[
0
]
.categoryType == '2' && that.returnIsShow)
{
that
.
$notify
({
that
.
$notify
({
title
:
'提示'
,
title
:
'提示'
,
message
:
'所属栏目不能为封面'
,
message
:
'所属栏目不能为封面'
,
type
:
'
error
'
type
:
'
error
'
})
;
})
;
that
.saveDisabled
=
false
;
that
.saveDisabled
=
false
;
return
return
;
}
}
var
data
=
JSON
.parse
(
JSON
.stringify
(
that
.form
))
;
var
data
=
JSON
.parse
(
JSON
.stringify
(
that
.form
))
;
if
(
data
.contentType
!=
null
){
if
(
data
.contentType
!=
null
)
{
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
)
{
if
(
data
.result
)
{
if
(
data
.result
)
{
//保存时需要赋值关联
ID
//保存时需要赋值关联
ID
if
(
that
.model
){
if
(
that
.model
)
{
that
.model.form.linkId
=
data
.data.id
;
that
.model.form.linkId
=
data
.data.id
;
that
.model.save
()
that
.model.save
()
;
}
}
that
.
$notify
({
that
.
$notify
({
title
:
'成功'
,
title
:
'成功'
,
message
:
'保存成功'
,
message
:
'保存成功'
,
type
:
'
success
'
type
:
'
success
'
})
;
})
;
if
(
that
.returnIsShow
){
javascript
:
history
.go
(
-1
)
;
if
(
that
.returnIsShow
)
{
javascript
:
history
.go
(
-1
)
;
}
}
}
else
{
}
else
{
that
.
$notify
({
that
.
$notify
({
...
@@ -368,101 +398,109 @@
...
@@ -368,101 +398,109 @@
type
:
'
warning
'
type
:
'
warning
'
})
;
})
;
}
}
that
.saveDisabled
=
false
;
that
.saveDisabled
=
false
;
})
;
})
;
}
else
{
}
else
{
this
.activeName
=
'
form
';
_
this
.activeName
=
'
form
';
return
false
;
return
false
;
}
}
}
)
}
)
;
},
},
removeModel
(){
removeModel
:
function
()
{
var
that
=
this
;
var
that
=
this
;
var
model
=
document
.getElementById
(
'
model1
'
)
var
model
=
document
.getElementById
(
'
model1
'
)
;
var
custom
=
document
.getElementById
(
'
c_model
'
)
var
custom
=
document
.getElementById
(
'
c_model
'
)
;
if
(
custom
){
model
.removeChild
(
custom
)
if
(
custom
)
{
model
.removeChild
(
custom
)
;
}
}
that
.model
=
undefined
;
that
.model
=
undefined
;
},
},
categoryChange
(){
categoryChange
:
function
()
{
this
.changeModel
()
;
this
.changeModel
()
;
},
},
changeModel
(){
changeModel
:
function
()
{
var
that
=
this
;
var
that
=
this
;
that
.editableTabs
=
[
that
.editableTabs
[
0
]
];
that
.editableTabs
=
[
that
.editableTabs
[
0
]
];
this
.removeModel
()
;
this
.removeModel
()
;
if
(
this
.currCategory
){
if
(
this
.currCategory.mdiyModelId
){
if
(
this
.currCategory
)
{
ms
.http.get
(
ms
.manager
+
"/mdiy/model/get.do"
,{
if
(
this
.currCategory.mdiyModelId
)
{
id
:
this
.currCategory.mdiyModelId
ms
.http.get
(
ms
.manager
+
"/mdiy/model/get.do"
,
{
id
:
this
.currCategory.mdiyModelId
})
.then
(
function
(
data
)
{
})
.then
(
function
(
data
)
{
if
(
data
.data
&&
data
.data.id
){
if
(
data
.data
&&
data
.data.id
)
{
that
.rederModel
(
data
.data
,
JSON
.parse
(
data
.data.modelJson
))
that
.rederModel
(
data
.data
,
JSON
.parse
(
data
.data.modelJson
))
;
}
}
})
})
;
}
}
}
}
},
},
rederModel
(
modelEntity
,
data
){
rederModel
:
function
(
modelEntity
,
data
)
{
var
that
=
this
;
var
that
=
this
;
that
.editableTabs.push
({
that
.editableTabs.push
({
title
:
modelEntity
.modelName
,
title
:
modelEntity
.modelName
,
name
:
'
custom-name
'
,
name
:
'
custom-name
'
})
;
})
;
this
.removeModel
()
;
this
.removeModel
()
;
that
.
$nextTick
(
function
()
{
that
.
$nextTick
(
function
()
{
var
div
=
document
.createElement
(
'
div
'
)
var
div
=
document
.createElement
(
'
div
'
)
;
div
.id
=
'
c_model
'
div
.id
=
'
c_model
'
;
var
model
=
document
.getElementById
(
'
model1
'
)
var
model
=
document
.getElementById
(
'
model1
'
)
;
model
.appendChild
(
div
)
model
.appendChild
(
div
)
;
var
s
=
document
.createElement
(
'
script
'
)
var
s
=
document
.createElement
(
'
script
'
)
;
s
.innerHTML
=
data
.script
s
.innerHTML
=
data
.script
;
var
con
=
document
.createElement
(
'
div
'
)
var
con
=
document
.createElement
(
'
div
'
)
;
con
.id
=
'
custom-model
';
con
.id
=
'
custom-model
';
con
.innerHTML
=
data
.html
;
con
.innerHTML
=
data
.html
;
div
.appendChild
(
s
)
;
div
.appendChild
(
s
)
;
div
.appendChild
(
con
)
;
div
.appendChild
(
con
)
;
//初始化自定义模型并传入关联参数
//初始化自定义模型并传入关联参数
that
.model
=
new
custom_model
(
{
data
:{
title
:
modelEntity
.modelName
,
modelId
:
modelEntity
.id
,
form
:{
linkId
:
that
.form.id
},
}
})
})
that
.model
=
new
custom_model
({
data
:
{
title
:
modelEntity
.modelName
,
modelId
:
modelEntity
.id
,
form
:
{
linkId
:
that
.form.id
}
}
})
;
})
;
},
},
getValue
(
data
)
{
getValue
:
function
(
data
)
{
this
.form.contentCategoryId
=
data
.id
;
this
.form.contentCategoryId
=
data
.id
;
},
},
//获取当前文章
//获取当前文章
get
(
id
)
{
get
:
function
(
id
)
{
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
)
{
if
(
res
.data.contentType
)
{
if
(
res
.data.contentType
)
{
res
.data.contentType
=
res
.data.contentType.split
(
'
,
'
)
;
res
.data.contentType
=
res
.data.contentType.split
(
'
,
'
)
;
}
}
else
{
else
{
res
.data.contentType
=
[];
res
.data.contentType
=
[];
}
}
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
)
{
value
.url
=
ms
.base
+
value
.path
value
.url
=
ms
.base
+
value
.path
;
})
})
;
}
else
{
}
else
{
res
.data.contentImg
=
[]
res
.data.contentImg
=
[]
;
}
}
that
.form
=
res
.data
;
that
.form
=
res
.data
;
var
category
=
that
.categoryIdOptions.filter
(
f
=>
f
['
id
']
==
that
.form.contentCategoryId
)
;
var
category
=
that
.categoryIdOptions.filter
(
function
(
f
)
{
if
(
category
.length
==
1
){
return
f
['
id
']
==
that
.form.contentCategoryId
;
if
(
category
[
0
]
.categoryType == '2')
{
})
;
if
(
category
.length
==
1
)
{
if
(
category
[
0
]
.categoryType == '2')
{
that
.returnIsShow
=
false
;
that
.returnIsShow
=
false
;
}
}
}
}
...
@@ -473,9 +511,11 @@
...
@@ -473,9 +511,11 @@
})
;
})
;
},
},
//获取
contentCategoryId
数据源
//获取
contentCategoryId
数据源
contentCategoryIdOptionsGet
()
{
contentCategoryIdOptionsGet
:
function
()
{
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
)
{
that
.contentCategoryIdOptions
=
ms
.util.treeData
(
res
.data.rows
,
'
id
'
,
'
categoryId
'
,
'
children
'
)
;
that
.contentCategoryIdOptions
=
ms
.util.treeData
(
res
.data.rows
,
'
id
'
,
'
categoryId
'
,
'
children
'
)
;
that
.categoryIdOptions
=
res
.data.rows
;
that
.categoryIdOptions
=
res
.data.rows
;
...
@@ -486,9 +526,12 @@
...
@@ -486,9 +526,12 @@
})
;
})
;
},
},
//获取
contentType
数据源
//获取
contentType
数据源
contentTypeOptionsGet
()
{
contentTypeOptionsGet
:
function
()
{
var
that
=
this
;
var
that
=
this
;
ms
.http.get
(
ms
.base
+
'/
mdiy
/
dict
/
list
.do
'
,
{
dictType
:
'文章属性'
,
pageSize
:
99999
})
.then
(
function
(
data
)
{
ms
.http.get
(
ms
.base
+
'/
mdiy
/
dict
/
list
.do
'
,
{
dictType
:
'文章属性'
,
pageSize
:
99999
})
.then
(
function
(
data
)
{
that
.contentTypeOptions
=
data
.rows
;
that
.contentTypeOptions
=
data
.rows
;
})
.catch
(
function
(
err
)
{
})
.catch
(
function
(
err
)
{
console
.log
(
err
)
;
console
.log
(
err
)
;
...
@@ -496,66 +539,70 @@
...
@@ -496,66 +539,70 @@
},
},
//
contentImg
文件上传完成回调
//
contentImg
文件上传完成回调
contentImgSuccess
:
function
(
response
,
file
,
fileList
)
{
contentImgSuccess
:
function
(
response
,
file
,
fileList
)
{
this
.form.contentImg.push
({
url
:
file
.url
,
name
:
file
.name
,
path
:
response
,
uid
:
file
.uid
})
;
this
.form.contentImg.push
({
url
:
file
.url
,
name
:
file
.name
,
path
:
response
,
uid
:
file
.uid
})
;
},
},
contentImghandleRemove
:
function
(
file
,
files
)
{
contentImghandleRemove
:
function
(
file
,
files
)
{
var
index
=
-1
;
var
index
=
-1
;
index
=
this
.form.contentImg.findIndex
(
text
=>
text
==
file
)
;
index
=
this
.form.contentImg.findIndex
(
function
(
text
)
{
return
text
==
file
;
})
;
if
(
index
!=
-1
)
{
if
(
index
!=
-1
)
{
this
.form.contentImg.splice
(
index
,
1
)
;
this
.form.contentImg.splice
(
index
,
1
)
;
}
}
},
},
//
contentImg
文件上传完成回调
contentImgSuccess
:
function
(
response
,
file
,
fileList
)
{
this
.form.contentImg.push
({
url
:
file
.url
,
name
:
file
.name
,
path
:
response
,
uid
:
file
.uid
})
;
},
//上传超过限制
//上传超过限制
contentImghandleExceed
:
function
(
files
,
fileList
)
{
contentImghandleExceed
:
function
(
files
,
fileList
)
{
this
.
$notify
({
title
:
'当前最多上传
1
个文件'
,
type
:
'
warning
'
})
;
this
.
$notify
({
},
title
:
'当前最多上传
1
个文件'
,
contentImghandleRemove
:
function
(
file
,
files
)
{
type
:
'
warning
'
var
index
=
-1
;
})
;
index
=
this
.form.contentImg.findIndex
(
text
=>
text
==
file
)
;
if
(
index
!=
-1
)
{
this
.form.contentImg.splice
(
index
,
1
)
;
}
},
},
//查询列表
//查询列表
list
:
function
(
contentCategoryId
)
{
list
:
function
(
contentCategoryId
)
{
var
that
=
this
;
var
that
=
this
;
ms
.http.post
(
ms
.manager
+
"/cms/content/list.do"
,
{
ms
.http.post
(
ms
.manager
+
"/cms/content/list.do"
,
{
contentCategoryId
:
contentCategoryId
,
contentCategoryId
:
contentCategoryId
})
.then
(
function
(
res
)
{
})
.then
(
function
(
res
)
{
if
(
res
.result
&&
res
.data.total
>
0
)
{
if
(
res
.result
&&
res
.data.total
>
0
)
{
if
(
res
.data.rows
[
0
]
.contentType)
{
if
(
res
.data.rows
[
0
]
.contentType)
{
res
.data.rows
[
0
]
.contentType = res.data.rows[0].contentType.split(',');
res
.data.rows
[
0
]
.contentType = res.data.rows[0].contentType.split(',');
}
}
if
(
res
.data.rows
[
0
]
.contentImg)
{
if
(
res
.data.rows
[
0
]
.contentImg)
{
res
.data.rows
[
0
]
.contentImg = JSON.parse(res.data.rows[0].contentImg);
res
.data.rows
[
0
]
.contentImg = JSON.parse(res.data.rows[0].contentImg);
res
.data.rows
[
0
]
.contentImg.forEach(function (value)
{
res
.data.rows
[
0
]
.contentImg.forEach(function (value)
{
value
.url
=
ms
.base
+
value
.path
value
.url
=
ms
.base
+
value
.path
;
}
)
}
)
;
}
else
{
}
else
{
res
.data.rows
[
0
]
.contentImg = []
res
.data.rows
[
0
]
.contentImg = []
;
}
}
that
.form
=
res
.data.rows
[
0
]
;
that
.form
=
res
.data.rows
[
0
]
;
}
}
})
.catch
(
function
(
err
)
{
})
.catch
(
function
(
err
)
{
console
.log
(
err
)
;
console
.log
(
err
)
;
})
;
})
;
}
,
}
},
},
created
()
{
created
:
function
()
{
this
.contentCategoryIdOptionsGet
()
;
this
.contentCategoryIdOptionsGet
()
;
this
.contentTypeOptionsGet
()
;
this
.contentTypeOptionsGet
()
;
this
.form.id
=
ms
.util.getParameter
(
"id"
)
;
this
.form.id
=
ms
.util.getParameter
(
"id"
)
;
if
(
ms
.util.getParameter
(
"categoryId"
)
!=
'
undefined
'
&&
ms
.util.getParameter
(
"categoryId"
)
!=
'
null
'
){
if
(
ms
.util.getParameter
(
"categoryId"
)
!=
'
undefined
'
&&
ms
.util.getParameter
(
"categoryId"
)
!=
'
null
'
)
{
this
.form.contentCategoryId
=
ms
.util.getParameter
(
"categoryId"
)
;
this
.form.contentCategoryId
=
ms
.util.getParameter
(
"categoryId"
)
;
}
}
this
.type
=
ms
.util.getParameter
(
"type"
)
;
this
.type
=
ms
.util.getParameter
(
"type"
)
;
if
(
this
.form.id
)
{
if
(
this
.form.id
)
{
this
.get
(
this
.form.id
)
;
this
.get
(
this
.form.id
)
;
}
}
if
(
this
.type
)
{
if
(
this
.type
)
{
this
.list
(
this
.form.contentCategoryId
)
;
this
.list
(
this
.form.contentCategoryId
)
;
this
.returnIsShow
=
false
;
this
.returnIsShow
=
false
;
...
@@ -575,4 +622,4 @@
...
@@ -575,4 +622,4 @@
#
form
{
#
form
{
overflow
:
hidden
;
overflow
:
hidden
;
}
}
</
style
>
</
style
>
\ No newline at end of file
src/main/webapp/WEB-INF/manager/cms/content/index.ftl
View file @
70541b9a
...
@@ -25,75 +25,78 @@
...
@@ -25,75 +25,78 @@
var indexVue = new Vue(
{
var indexVue = new Vue(
{
el
:
"#index"
,
el
:
"#index"
,
data
:
{
data
:
{
action
:
""
,
//跳转页面
action
:
""
,
//跳转页面
defaultProps
:
{
defaultProps
:
{
children
:
'
children
'
,
children
:
'
children
'
,
label
:
'
categoryTitle
'
label
:
'
categoryTitle
'
},
},
treeData
:
[]
,
treeData
:
[]
,
loading
:
true
,
loading
:
true
,
emptyText
:
''
,
emptyText
:
''
},
},
methods
:{
methods
:
{
handleNodeClick
:
function
(
data
){
handleNodeClick
:
function
(
data
)
{
if
(
data
.categoryType
==
'
1
'
){
if
(
data
.categoryType
==
'
1
'
)
{
this
.action
=
ms
.manager
+
"/cms/content/main.do?categoryId="
+
data
.id
;
this
.action
=
ms
.manager
+
"/cms/content/main.do?categoryId="
+
data
.id
;
}
else
if
(
data
.categoryType
==
'
2
'
){
}
else
if
(
data
.categoryType
==
'
2
'
)
{
this
.action
=
ms
.manager
+
"/cms/content/form.do?categoryId="
+
data
.id
+
"&type=2"
;
this
.action
=
ms
.manager
+
"/cms/content/form.do?categoryId="
+
data
.id
+
"&type=2"
;
}
else
{
}
else
{
this
.action
=
ms
.manager
+
"/cms/content/main.do"
;
this
.action
=
ms
.manager
+
"/cms/content/main.do"
;
}
}
},
},
treeList
:
function
(){
treeList
:
function
()
{
var
that
=
this
;
var
that
=
this
;
this
.loadState
=
false
;
this
.loadState
=
false
;
this
.loading
=
true
;
this
.loading
=
true
;
ms
.http.get
(
ms
.manager
+
"/cms/category/list.do"
,{
ms
.http.get
(
ms
.manager
+
"/cms/category/list.do"
,
{
pageSize
:
999
,
pageSize
:
999
})
.then
(
})
.then
(
function
(
res
)
{
function
(
res
)
{
if
(
that
.loadState
)
{
if
(
that
.load
State
){
that
.load
ing
=
false
;
that
.loading
=
fa
lse
;
}
e
lse
{
}
else
{
that
.loadState
=
true
;
that
.loadState
=
true
}
}
if
(
!
res
.result
||
res
.data.total
<=
0
)
{
if
(
!
res
.result
||
res
.data.total
<=
0
)
{
that
.emptyText
=
'暂无数据';
that
.emptyText
=
'暂无数据';
that
.treeData
=
[];
that
.treeData
=
[];
}
else
{
}
else
{
that
.emptyText
=
'';
that
.emptyText
=
'';
that
.treeData
=
ms
.util.treeData
(
res
.data.rows
,
'
id
'
,
'
categoryId
'
,
'
children
'
)
;
that
.treeData
=
ms
.util.treeData
(
res
.data.rows
,
'
id
'
,
'
categoryId
'
,
'
children
'
)
;
that
.treeData
=
[
{
that
.treeData
=
[
{
id
:
0
,
id
:
0
,
categoryTitle
:
'全部'
,
categoryTitle
:
'全部'
,
children
:
that
.treeData
,
children
:
that
.treeData
}
]
}
]
;
}
}
})
.catch
(
function
(
err
)
{
})
.catch
(
function
(
err
)
{
console
.log
(
err
)
;
console
.log
(
err
)
;
})
;
})
;
setTimeout
(
()
=>
{
setTimeout
(
function
()
{
if
(
that
.loadState
){
if
(
that
.loadState
)
{
that
.loading
=
false
;
that
.loading
=
false
;
}
else
{
}
else
{
that
.loadState
=
true
that
.loadState
=
true
;
}
}
},
500
)
;
},
500
)
;
}
,
}
},
},
mounted
(){
mounted
:
function
()
{
this
.action
=
ms
.manager
+
"/cms/content/main.do"
;
this
.action
=
ms
.manager
+
"/cms/content/main.do"
;
this
.treeList
()
;
this
.treeList
()
;
}
}
}
)
}
)
;
</
script
>
</
script
>
<
style
>
<
style
>
#index .index-menu
{
#index .index-menu
{
height
:
100
vh
;
min-height
:
100
vh
;
min-height
:
100
vh
;
min-width
:
140
px
;
min-width
:
140
px
;
}
}
#index .ms-iframe-style
{
#index .ms-iframe-style
{
width
:
100
%;
width
:
100
%;
height
:
100
%;
border
:
0
;
border
:
0
;
}
}
...
...
src/main/webapp/WEB-INF/manager/cms/content/main.ftl
View file @
70541b9a
This diff is collapsed.
Click to expand it.
src/main/webapp/WEB-INF/manager/cms/generate/index.ftl
View file @
70541b9a
...
@@ -119,119 +119,163 @@
...
@@ -119,119 +119,163 @@
</
body
>
</
body
>
</
html
>
</
html
>
<
script
>
<
script
>
"use strict";
var app = new Vue(
{
var app = new Vue(
{
el
:
'#
app
'
,
el
:
'#
app
'
,
watch
:{
watch
:
{},
},
data
:
{
data
:
{
homeLoading
:
false
,
homeLoading
:
false
,
articleLoading
:
false
,
articleLoading
:
false
,
columnLoading
:
false
,
columnLoading
:
false
,
template
:
''
,
//主题模板
template
:
''
,
templateOptions
:
[]
,
//主题模板
position
:
'
index
'
,
//位置
templateOptions
:
[]
,
contentSection
:
'
0
'
,
//文章栏目
position
:
'
index
'
,
section
:
'
0
'
,
//栏目
//位置
time
:
ms
.util.date.fmt
(
new
D
ate
(),
"yyyy-MM-dd"
),
contentSection
:
'
0
'
,
treeList
:
[
{
//文章栏目
id
:
'
0
'
,
section
:
'
0
'
,
categoryTitle
:
'顶级栏目'
,
//栏目
children
:
[]
,
time
:
ms
.util.date.fmt
(
new
D
ate
(),
"yyyy-MM-dd"
),
}
]
,
treeList
:
[
{
id
:
'
0
'
,
categoryTitle
:
'顶级栏目'
,
children
:
[]
}
]
},
},
methods
:
{
methods
:
{
//更新主页
//更新主页
updataIndex
(){
updataIndex
:
function
()
{
var
that
=
this
;
var
that
=
this
;
if
(
!
that
.position
||
that
.position
==
''
){
if
(
!
that
.position
||
that
.position
==
''
)
{
this
.
$notify
({
title
:
'请输入主页位置!'
,
type
:
'
warning
'
})
;
this
.
$notify
({
title
:
'请输入主页位置!'
,
type
:
'
warning
'
})
;
return
;
return
;
}
}
that
.homeLoading
=
true
;
that
.homeLoading
=
true
;
ms
.http.post
(
ms
.manager
+'/
cms
/
generate
//
generateIndex
.do
'
,
{
url
:
that
.template
,
position
:
that
.position
})
.then
(
function
(
data
)
{
ms
.http.post
(
ms
.manager
+
'/
cms
/
generate
//
generateIndex
.do
'
,
{
if
(
data
.result
){
url
:
that
.template
,
that
.
$notify
({
title
:
'更新成功!'
,
type
:
'
success
'
})
;
position
:
that
.position
}
else
{
})
.then
(
function
(
data
)
{
that
.
$notify
({
title
:
'更新失败!'
,
message
:
"错误"
,
type
:
'
error
'
})
;
if
(
data
.result
)
{
that
.
$notify
({
title
:
'更新成功!'
,
type
:
'
success
'
})
;
}
else
{
that
.
$notify
({
title
:
'更新失败!'
,
message
:
"错误"
,
type
:
'
error
'
})
;
}
}
})
.catch
(
function
(
err
)
{
})
.catch
(
function
(
err
)
{
that
.
$notify
({
title
:
'更新失败!'
,
message
:
err
,
type
:
'
error
'
})
;
that
.
$notify
({
title
:
'更新失败!'
,
message
:
err
,
type
:
'
error
'
})
;
console
.log
(
err
)
;
console
.log
(
err
)
;
})
.finally
(
()
=>
{
})
.finally
(
function
()
{
that
.homeLoading
=
false
;
that
.homeLoading
=
false
;
})
;
})
;
},
},
//预览主页
//预览主页
viewIndex
(){
viewIndex
:
function
()
{
if
(
!
this
.position
||
this
.position
==
''
){
if
(
!
this
.position
||
this
.position
==
''
)
{
this
.
$notify
({
title
:
'请输入主页位置!'
,
type
:
'
warning
'
})
;
this
.
$notify
({
title
:
'请输入主页位置!'
,
type
:
'
warning
'
})
;
return
;
return
;
}
}
window
.open
(
ms
.manager
+
"/cms/generate/"
+
this
.position
+
"/viewIndex.do"
)
;
window
.open
(
ms
.manager
+
"/cms/generate/"
+
this
.position
+
"/viewIndex.do"
)
;
},
},
//更新栏目
//更新栏目
updateColumn
(){
updateColumn
:
function
()
{
var
that
=
this
;
var
that
=
this
;
that
.columnLoading
=
true
;
that
.columnLoading
=
true
;
ms
.http.get
(
ms
.manager
+'/
cms
/
generate
/'+
(
that
.section
?
that
.section
:
0
)
+'/
genernateColumn
.do
'
)
.then
(
function
(
data
)
{
ms
.http.get
(
ms
.manager
+
'/
cms
/
generate
/'
+
(
that
.section
?
that
.section
:
0
)
+
'/
genernateColumn
.do
'
)
.then
(
function
(
data
)
{
if
(
data
.result
){
if
(
data
.result
)
{
that
.
$notify
({
title
:
'更新成功!'
,
type
:
'
success
'
})
;
that
.
$notify
({
title
:
'更新成功!'
,
type
:
'
success
'
})
;
}
}
})
.catch
(
function
(
err
)
{
})
.catch
(
function
(
err
)
{
that
.
$notify
({
title
:
'更新失败!'
,
message
:
err
,
type
:
'
error
'
})
;
that
.
$notify
({
title
:
'更新失败!'
,
message
:
err
,
type
:
'
error
'
})
;
console
.log
(
err
)
;
console
.log
(
err
)
;
})
.finally
(
()
=>
{
})
.finally
(
function
()
{
that
.columnLoading
=
false
;
that
.columnLoading
=
false
;
})
;
})
;
},
},
//生成文章栏目
//生成文章栏目
updateArticle
(){
updateArticle
:
function
()
{
var
that
=
this
;
var
that
=
this
;
that
.articleLoading
=
true
;
that
.articleLoading
=
true
;
ms
.http.post
(
ms
.manager
+'/
cms
/
generate
/'+
(
that
.contentSection
?
that
.contentSection
:
0
)
+'/
generateArticle
.do
'
,
{
dateTime
:
that
.time
})
.then
(
function
(
data
)
{
ms
.http.post
(
ms
.manager
+
'/
cms
/
generate
/'
+
(
that
.contentSection
?
that
.contentSection
:
0
)
+
'/
generateArticle
.do
'
,
{
if
(
data
.result
){
dateTime
:
that
.time
that
.
$notify
({
title
:
'更新成功!'
,
type
:
'
success
'
})
;
})
.then
(
function
(
data
)
{
if
(
data
.result
)
{
that
.
$notify
({
title
:
'更新成功!'
,
type
:
'
success
'
})
;
}
}
})
.catch
(
function
(
err
)
{
})
.catch
(
function
(
err
)
{
that
.
$notify
({
title
:
'更新失败!'
,
message
:
err
,
type
:
'
error
'
})
;
that
.
$notify
({
title
:
'更新失败!'
,
message
:
err
,
type
:
'
error
'
})
;
console
.log
(
err
)
;
console
.log
(
err
)
;
})
.finally
(
()
=>
{
})
.finally
(
function
()
{
that
.articleLoading
=
false
;
that
.articleLoading
=
false
;
})
;
})
;
},
},
//获取主题模板数据源
//获取主题模板数据源
templateOptionsGet
()
{
templateOptionsGet
:
function
()
{
var
that
=
this
;
var
that
=
this
;
ms
.http.get
(
ms
.manager
+'/
template
/
queryTemplateFileForColumn
.do
'
,
{
pageSize
:
99999
})
.then
(
function
(
data
)
{
ms
.http.get
(
ms
.manager
+
'/
template
/
queryTemplateFileForColumn
.do
'
,
{
that
.templateOptions
=
data
.data
;
pageSize
:
99999
//寻找主页
})
.then
(
function
(
data
)
{
that
.templateOptions
=
data
.data
;
//寻找主页
var
template
=
that
.templateOptions.find
(
function
(
x
)
{
var
template
=
that
.templateOptions.find
(
function
(
x
)
{
return
x
.indexOf
(
"index"
)
!=
-1
||
x
.indexOf
(
"default"
)
!=
-1
;
return
x
.indexOf
(
"index"
)
!=
-1
||
x
.indexOf
(
"default"
)
!=
-1
;
})
})
;
//没有就找其他的
//没有就找其他的
that
.template
=
template
||
(
that
.templateOptions.length
>
0
?
that
.templateOptions
[
0
]
:
"");
that
.template
=
template
||
(
that
.templateOptions.length
>
0
?
that
.templateOptions
[
0
]
:
"");
})
.catch
(
function
(
err
)
{
})
.catch
(
function
(
err
)
{
console
.log
(
err
)
;
console
.log
(
err
)
;
})
;
})
;
},
},
getTree
(){
getTree
:
function
()
{
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"
,
{
if
(
res
.result
){
pageSize
:
9999
})
.then
(
function
(
res
)
{
if
(
res
.result
)
{
//
res
.data.rows.push
({
id
:
0
,
categoryId
:
null
,
categoryTitle
:
'顶级栏目管理'
})
;
//
res
.data.rows.push
({
id
:
0
,
categoryId
:
null
,
categoryTitle
:
'顶级栏目管理'
})
;
that
.treeList
[
0
]
.children = ms.util.treeData(res.data.rows,'id','categoryId','children');
that
.treeList
[
0
]
.children = ms.util.treeData(res.data.rows,
'id',
'categoryId',
'children');
}
}
})
.catch
(
function
(
err
){
})
.catch
(
function
(
err
)
{
console
.log
(
err
)
;
console
.log
(
err
)
;
})
;
})
;
}
,
}
},
},
created
(){
created
:
function
()
{
this
.getTree
()
;
this
.getTree
()
;
this
.templateOptionsGet
()
;
this
.templateOptionsGet
()
;
}
}
}
)
}
)
;
</
script
>
</
script
>
<
style
>
<
style
>
input
{
input
{
...
...
src/main/webapp/WEB-INF/manager/main.ftl
View file @
70541b9a
...
@@ -427,92 +427,120 @@
...
@@ -427,92 +427,120 @@
<
script
>
<
script
>
var app = new Vue(
{
var app = new Vue(
{
el
:
'#
app
'
,
el
:
'#
app
'
,
watch
:{
watch
:
{},
},
data
:
{
data
:
{
base
:
ms
.base
,
base
:
ms
.base
,
msNewsLast
:
''
,
msNewsLast
:
''
,
msNewsPath
:
''
msNewsPath
:
''
},
},
methods
:
{
methods
:
{
jumpArtcleManager
(){
jumpArtcleManager
:
function
()
{
window
.parent.indexVue.openMenu
({
modelId
:
706
,
modelTitle
:
'文章管理'
,
modelIcon
:
"icon-neirongguanli"
})
;
window
.parent.indexVue.openMenu
({
modelId
:
706
,
modelTitle
:
'文章管理'
,
modelIcon
:
"icon-neirongguanli"
})
;
},
},
//栏目管理
//栏目管理
jumpCategorymanager
(){
jumpCategorymanager
:
function
()
{
window
.parent.indexVue.open
({
"modelId"
:
708
,
"modelTitle"
:
"栏目管理"
,
"modelModelId"
:
706
,
"modelUrl"
:
"cms/category/index.do"
})
;
window
.parent.indexVue.open
({
"modelId"
:
708
,
"modelTitle"
:
"栏目管理"
,
"modelModelId"
:
706
,
"modelUrl"
:
"cms/category/index.do"
})
;
},
},
//静态化
//静态化
jumpStaticManager
(){
jumpStaticManager
:
function
()
{
window
.parent.indexVue.open
({
"modelId"
:
406
,
"modelTitle"
:
"静态化"
,
"modelModelId"
:
23
,
"modelUrl"
:
"cms/generate/index.do"
})
;
window
.parent.indexVue.open
({
"modelId"
:
406
,
"modelTitle"
:
"静态化"
,
"modelModelId"
:
23
,
"modelUrl"
:
"cms/generate/index.do"
})
;
},
},
//管理员管理
//管理员管理
jumpAdmininstatorManager
(){
jumpAdmininstatorManager
:
function
()
{
window
.parent.indexVue.open
({
"modelId"
:
411
,
"modelTitle"
:
"管理员管理"
,
"modelModelId"
:
23
,
"modelUrl"
:
"basic/manager/index.do"
})
;
window
.parent.indexVue.open
({
"modelId"
:
411
,
"modelTitle"
:
"管理员管理"
,
"modelModelId"
:
23
,
"modelUrl"
:
"basic/manager/index.do"
})
;
},
},
//角色管理
//角色管理
jumpUserManager
(){
jumpUserManager
:
function
()
{
window
.parent.indexVue.open
({
"modelId"
:
406
,
"modelTitle"
:
"角色管理"
,
"modelModelId"
:
23
,
"modelUrl"
:
"basic/role/index.do"
})
;
window
.parent.indexVue.open
({
"modelId"
:
406
,
"modelTitle"
:
"角色管理"
,
"modelModelId"
:
23
,
"modelUrl"
:
"basic/role/index.do"
})
;
},
},
//菜单管理
//菜单管理
jumpMenuManager
(){
jumpMenuManager
:
function
()
{
window
.parent.indexVue.open
({
"modelId"
:
183
,
"modelTitle"
:
"菜单管理"
,
"modelModelId"
:
23
,
"modelUrl"
:
"model/index.do"
})
;
window
.parent.indexVue.open
({
"modelId"
:
183
,
"modelTitle"
:
"菜单管理"
,
"modelModelId"
:
23
,
"modelUrl"
:
"model/index.do"
})
;
},
},
//模板管理
//模板管理
jumpTemplateManager
(){
jumpTemplateManager
:
function
()
{
window
.parent.indexVue.open
({
"modelId"
:
87
,
"modelTitle"
:
"模板管理"
,
"modelModelId"
:
84
,
"modelUrl"
:
"template/index.do"
})
;
window
.parent.indexVue.open
({
"modelId"
:
87
,
"modelTitle"
:
"模板管理"
,
"modelModelId"
:
84
,
"modelUrl"
:
"template/index.do"
})
;
},
},
//应用管理
//应用管理
jumpApplicationManager
(){
jumpApplicationManager
:
function
()
{
window
.parent.indexVue.open
({
"modelId"
:
86
,
"modelTitle"
:
"应用管理"
,
"modelModelId"
:
84
,
"modelUrl"
:
"app/-1/edit.do"
})
;
window
.parent.indexVue.open
({
"modelId"
:
86
,
"modelTitle"
:
"应用管理"
,
"modelModelId"
:
84
,
"modelUrl"
:
"app/-1/edit.do"
})
;
},
},
//铭飞开发文档
//铭飞开发文档
jumpMCMSDocument
(){
jumpMCMSDocument
:
function
()
{
window
.open
(
"http://doc.ms.mingsoft.net/plugs-cms/"
)
;
window
.open
(
"http://doc.ms.mingsoft.net/plugs-cms/"
)
;
},
},
enterQQOneGroup
(){
enterQQOneGroup
:
function
()
{
window
.open
(
"https://shang.qq.com/wpa/qunwpa?idkey=ebf251dc9758de6b9c78c499956431cba73e28b3f0b72c0fc28242e98b20fca2"
)
;
window
.open
(
"https://shang.qq.com/wpa/qunwpa?idkey=ebf251dc9758de6b9c78c499956431cba73e28b3f0b72c0fc28242e98b20fca2"
)
;
},
},
enterQQTwoGroup
(){
enterQQTwoGroup
:
function
()
{
window
.open
(
"http://shang.qq.com/wpa/qunwpa?idkey=cfb32b0f47d89d7ef1c3a9493984d4ffbdfe14049fdedd90c517a072e90d68b9"
)
;
window
.open
(
"http://shang.qq.com/wpa/qunwpa?idkey=cfb32b0f47d89d7ef1c3a9493984d4ffbdfe14049fdedd90c517a072e90d68b9"
)
;
},
},
enterQQThreeGroup
(){
enterQQThreeGroup
:
function
()
{
window
.open
(
"http://shang.qq.com/wpa/qunwpa?idkey=5dd11fdb492c4ded090fa1f78a166583978e33c4a61301b136d31e9e3eb7df72"
)
;
window
.open
(
"http://shang.qq.com/wpa/qunwpa?idkey=5dd11fdb492c4ded090fa1f78a166583978e33c4a61301b136d31e9e3eb7df72"
)
;
},
},
enterQQFourGroup
(){
enterQQFourGroup
:
function
()
{
window
.open
(
"http://shang.qq.com/wpa/qunwpa?idkey=565f1e4c4fabeee42947f6c6b96ac7ca4853dece16559d3d78e944ca2931b7f5"
)
;
window
.open
(
"http://shang.qq.com/wpa/qunwpa?idkey=565f1e4c4fabeee42947f6c6b96ac7ca4853dece16559d3d78e944ca2931b7f5"
)
;
},
},
addBusinessQQ
(){
addBusinessQQ
:
function
()
{
window
.open
(
"http://wpa.qq.com/msgrd?v=3&uin=3336073455&site=qq&menu=yes"
)
;
window
.open
(
"http://wpa.qq.com/msgrd?v=3&uin=3336073455&site=qq&menu=yes"
)
;
},
},
//打开铭飞消息页面
//打开铭飞消息页面
openMCMSNews
(){
openMCMSNews
:
function
()
{
window
.open
(
this
.msNewsPath
)
;
window
.open
(
this
.msNewsPath
)
;
},
},
getNewsLast
(){
getNewsLast
:
function
()
{
var
that
=
this
;
var
that
=
this
;
axios
.create
({
axios
.create
({
withCredentials
:
true
withCredentials
:
true
})
.get
(
"https://ms.mingsoft.net/cms/content/list.do?contentCategoryId=202"
)
.then
(
function
(
res
){
})
.get
(
"https://ms.mingsoft.net/cms/content/list.do?contentCategoryId=202"
)
.then
(
function
(
res
)
{
that
.msNewsLast
=
res
.data.data.rows
[
0
]
.contentTitle.toString();
that
.msNewsLast
=
res
.data.data.rows
[
0
]
.contentTitle.toString();
that
.msNewsPath
=
'
https
:
//
ms
.mingsoft.net
/
html
/
1
/
203
/
202
/'
+
res
.data.data.rows
[
0
]
.id
+
'.html'
that
.msNewsPath
=
'
https
:
//
ms
.mingsoft.net
/
html
/
1
/
203
/
202
/'
+
res
.data.data.rows
[
0
]
.id
+
'.html'
;
})
})
;
}
}
},
},
created
(){
created
:
function
()
{
this
.getNewsLast
()
this
.getNewsLast
()
;
}
}
}
)
}
)
;
</
script
>
</
script
>
<
style
>
<
style
>
.custom-body
{
.custom-body
{
...
@@ -2844,4 +2872,4 @@
...
@@ -2844,4 +2872,4 @@
#app
{
#app
{
overflow-x
:
hidden
;
overflow-x
:
hidden
;
}
}
</
style
>
</
style
>
\ No newline at end of file
src/main/webapp/static/plugins/babel-polyfill/7.8.3/polyfill.min.js
0 → 100644
View file @
70541b9a
This diff is collapsed.
Click to expand it.
src/main/webapp/static/plugins/ms/1.0.0/compatible.js
0 → 100644
View file @
70541b9a
if
(
typeof
Object
.
assign
!=
'
function
'
)
{
Object
.
assign
=
function
(
target
)
{
'
use strict
'
;
if
(
target
==
null
)
{
throw
new
TypeError
(
'
Cannot convert undefined or null to object
'
);
}
target
=
Object
(
target
);
for
(
var
index
=
1
;
index
<
arguments
.
length
;
index
++
)
{
var
source
=
arguments
[
index
];
if
(
source
!=
null
)
{
for
(
var
key
in
source
)
{
if
(
Object
.
prototype
.
hasOwnProperty
.
call
(
source
,
key
))
{
target
[
key
]
=
source
[
key
];
}
}
}
}
return
target
;
};
}
src/main/webapp/static/plugins/ms/1.0.0/ms.http.js
View file @
70541b9a
...
@@ -9,6 +9,8 @@
...
@@ -9,6 +9,8 @@
function
(
config
)
{
function
(
config
)
{
config
.
headers
=
{
config
.
headers
=
{
'
Content-Type
'
:
'
application/x-www-form-urlencoded
'
,
'
Content-Type
'
:
'
application/x-www-form-urlencoded
'
,
'
Cache-Control
'
:
'
no-cache
'
,
'
Pragma
'
:
'
no-cache
'
,
'
X-Requested-With
'
:
'
XMLHttpRequest
'
'
X-Requested-With
'
:
'
XMLHttpRequest
'
}
}
if
(
config
.
method
===
'
post
'
&&
config
.
headers
[
"
Content-Type
"
]
===
"
application/x-www-form-urlencoded
"
)
{
if
(
config
.
method
===
'
post
'
&&
config
.
headers
[
"
Content-Type
"
]
===
"
application/x-www-form-urlencoded
"
)
{
...
@@ -171,4 +173,4 @@
...
@@ -171,4 +173,4 @@
}
}
window
.
ms
.
http
=
http
;
window
.
ms
.
http
=
http
;
window
.
ms
.
isLoginRedirect
=
true
;
window
.
ms
.
isLoginRedirect
=
true
;
}());
}());
\ No newline at end of file
src/main/webapp/static/plugins/ms/1.0.0/ms.util.js
View file @
70541b9a
/**
/**
* 通用工具类
* 通用工具类
*/
*/
(
function
()
{
(
function
()
{
...
@@ -21,22 +21,26 @@
...
@@ -21,22 +21,26 @@
}
}
}
}
//树形数据组织
//树形数据组织
function
treeData
(
source
,
id
,
parentId
,
children
)
{
function
treeData
(
source
,
id
,
parentId
,
children
)
{
let
cloneData
=
JSON
.
parse
(
JSON
.
stringify
(
source
))
var
cloneData
=
JSON
.
parse
(
JSON
.
stringify
(
source
));
return
cloneData
.
filter
(
father
=>
{
return
cloneData
.
filter
(
function
(
father
)
{
let
branchArr
=
cloneData
.
filter
(
child
=>
father
[
id
]
==
child
[
parentId
]);
var
branchArr
=
cloneData
.
filter
(
function
(
child
)
{
branchArr
.
length
>
0
?
father
[
children
]
=
branchArr
:
''
return
father
[
id
]
==
child
[
parentId
];
return
!
father
[
parentId
]
||
father
[
parentId
]
==
'
0
'
// 如果第一层不是parentId=0,请自行修改
});
})
branchArr
.
length
>
0
?
father
[
children
]
=
branchArr
:
''
;
return
!
father
[
parentId
]
||
father
[
parentId
]
==
'
0
'
;
// 如果第一层不是parentId=0,请自行修改
});
}
}
//验证是否为子集
//验证是否为子集
function
childValidate
(
sourceList
,
id
,
parentId
,
key
,
parentKey
){
function
childValidate
(
sourceList
,
id
,
parentId
,
key
,
parentKey
)
{
var
data
=
sourceList
.
find
(
x
=>
x
[
key
]
==
parentId
);
var
data
=
sourceList
.
find
(
function
(
x
)
{
if
(
data
&&
data
[
parentKey
]
!=
'
0
'
&&
data
[
parentKey
]){
return
x
[
key
]
==
parentId
;
if
(
id
==
data
[
parentKey
]){
});
return
false
if
(
data
&&
data
[
parentKey
]
!=
'
0
'
&&
data
[
parentKey
])
{
if
(
id
==
data
[
parentKey
])
{
return
false
;
}
}
return
childValidate
(
sourceList
,
id
,
data
[
parentKey
],
key
,
parentKey
)
return
childValidate
(
sourceList
,
id
,
data
[
parentKey
],
key
,
parentKey
)
;
}
}
return
true
;
return
true
;
}
}
...
@@ -44,20 +48,19 @@
...
@@ -44,20 +48,19 @@
//日期处理
//日期处理
var
date
=
{
var
date
=
{
//格式化时间
//格式化时间
fmt
:
function
(
date
,
fmt
)
{
fmt
:
function
(
de
,
fmt
)
{
var
date
=
new
Date
(
date
);
var
date
=
new
Date
(
typeof
de
==
"
string
"
?
de
.
replace
(
/-/g
,
"
/
"
):
de
);
log
(
fmt
);
if
(
!
fmt
)
{
if
(
!
fmt
)
{
fmt
=
"
yyyy-mm-dd
"
;
fmt
=
"
yyyy-mm-dd
"
;
}
}
var
o
=
{
var
o
=
{
"
M+
"
:
date
.
getMonth
()
+
1
,
//月份
"
M+
"
:
date
.
getMonth
()
+
1
,
//月份
"
d+
"
:
date
.
getDate
(),
//日
"
d+
"
:
date
.
getDate
(),
//日
"
h+
"
:
date
.
getHours
(),
//小时
"
h+
"
:
date
.
getHours
(),
//小时
"
m+
"
:
date
.
getMinutes
(),
//分
"
m+
"
:
date
.
getMinutes
(),
//分
"
s+
"
:
date
.
getSeconds
(),
//秒
"
s+
"
:
date
.
getSeconds
(),
//秒
"
q+
"
:
Math
.
floor
((
date
.
getMonth
()
+
3
)
/
3
),
//季度
"
q+
"
:
Math
.
floor
((
date
.
getMonth
()
+
3
)
/
3
),
//季度
"
S
"
:
date
.
getMilliseconds
()
//毫秒
"
S
"
:
date
.
getMilliseconds
()
//毫秒
};
};
if
(
/
(
y+
)
/
.
test
(
fmt
))
if
(
/
(
y+
)
/
.
test
(
fmt
))
fmt
=
fmt
.
replace
(
RegExp
.
$1
,
(
date
.
getFullYear
()
+
""
).
substr
(
4
-
RegExp
.
$1
.
length
));
fmt
=
fmt
.
replace
(
RegExp
.
$1
,
(
date
.
getFullYear
()
+
""
).
substr
(
4
-
RegExp
.
$1
.
length
));
...
@@ -226,4 +229,4 @@
...
@@ -226,4 +229,4 @@
}
}
window
.
ms
.
util
=
util
;
window
.
ms
.
util
=
util
;
window
.
ms
.
debug
=
false
window
.
ms
.
debug
=
false
}());
}());
\ No newline at end of file
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