Skip to content
切换导航面板
项目
群组
代码片段
帮助
zhangtai
/
zzhnc
当前项目
正在载入...
登录
切换导航面板
转到一个项目
项目
版本库
问题
0
合并请求
0
流水线
维基
设置
活动
图像
图表
创建新的问题
作业
提交
问题看板
文件
提交
分支
标签
贡献者
图像
比较
图表
Commit f9fc13a7
由
沈姿.前端(已离职)
编写于
Jan 02, 2018
浏览文件
选项
浏览文件
标签
下载
差异文件
Merge branch 'shenzi'
2 个父辈
a7a7b264
7ab455b9
隐藏空白字符变更
内嵌
并排
正在显示
2 个修改的文件
包含
48 行增加
和
15 行删除
WebContent/WEB-INF/jsp/pc/activity/activityEdit.jsp
WebContent/WEB-INF/jsp/pc/activity/activityList.jsp
WebContent/WEB-INF/jsp/pc/activity/activityEdit.jsp
查看文件 @
f9fc13a
...
...
@@ -33,13 +33,23 @@
<body
class=
"wrap"
>
<div
class=
"layui-form"
>
<div
class=
"layui-form-item"
>
<label
class=
"layui-form-label"
>
<i
class=
"redrequired"
>
*
</i>
文章标题
</label>
<label
class=
"layui-form-label"
>
文章标题
</label>
<div
class=
"layui-input-inline"
style=
"width: 400px;"
>
<input
type=
"text"
name=
"title"
lay-verify=
"required|title"
placeholder=
"文章标题"
class=
"layui-input"
>
</div>
<div
class=
"layui-form-mid layui-word-aux"
>
不超过20个汉字
</div>
</div>
<div
class=
"layui-form-item"
>
<label
class=
"layui-form-label"
><i
class=
"redrequired"
>
*
</i>
专区类型
</label>
<div
class=
"layui-input-inline"
style=
"width: 400px;"
>
<select
name=
"type"
lay-verify=
"required"
>
<option
value=
""
>
请选择
</option>
<option
value=
"1"
>
活动预告
</option>
<option
value=
"2"
>
福利专区
</option>
</select>
</div>
</div>
<div
class=
"layui-form-item"
>
<label
class=
"layui-form-label"
><i
class=
"redrequired"
>
*
</i>
上传主图
</label>
<div
class=
"layui-input-inline"
style=
"width: 400px;"
>
<div
class=
"layui-upload"
>
...
...
@@ -52,8 +62,8 @@
</div>
</div>
</div>
<div
class=
"layui-form-item"
>
<label
class=
"layui-form-label"
>
<i
class=
"redrequired"
>
*
</i>
文章内容
</label>
<div
class=
"layui-form-item"
style=
"display: none"
>
<label
class=
"layui-form-label"
>
文章内容
</label>
<div
class=
"layui-input-block"
style=
"margin-left: 130px;"
>
<!-- 加载编辑器的容器 -->
<script
id=
"container"
name=
"content"
type=
"text/plain"
>
...
...
@@ -75,7 +85,7 @@
<script
src=
"/zzhnc/res/plugins/layui/layui.js"
charset=
"utf-8"
></script>
<script
type=
"text/javascript"
src=
"/zzhnc/res/js/me.js"
></script>
<script>
window
.
onload
=
function
()
{
/*
window.onload = function() {
UE.Editor.prototype._bkGetActionUrl = UE.Editor.prototype.getActionUrl;
UE.Editor.prototype.getActionUrl = function(action) {
if(action == 'uploadimage' || action == 'uploadscrawl' || action == 'uploadimage') {
...
...
@@ -89,8 +99,7 @@
var ue = UE.getEditor('container', {
autoHeight: false
});
}
}*/
layui
.
use
([
'form'
,
'element'
,
'layer'
,
'upload'
],
function
()
{
var
form
=
layui
.
form
,
...
...
@@ -108,9 +117,10 @@
console
.
log
(
data
);
if
(
data
.
code
==
0
)
{
$
(
"[name=title]"
).
val
(
data
.
data
.
title
);
UE
.
getEditor
(
"container"
).
ready
(
function
()
{
/*
UE.getEditor("container").ready(function() {
UE.getEditor("container").setContent(unescape(data.data.content));
})
})*/
$
(
"[name=type]"
).
val
(
data
.
data
.
type
);
$
(
"[name=imgurl]"
).
val
(
data
.
data
.
imgurl
);
$
(
".mainpictrue"
).
attr
(
"src"
,
data
.
data
.
imgurl
).
css
(
"margin-top"
,
"15px"
);
form
.
render
();
...
...
@@ -141,9 +151,10 @@
//提交
form
.
on
(
'submit(submit)'
,
function
(
data
)
{
var
title
=
$
(
"[name=title]"
).
val
();
var
content
=
UE
.
getEditor
(
'container'
).
getContent
();
//
var content = UE.getEditor('container').getContent();
var
imgurl
=
$
(
"[name=imgurl]"
).
val
();
if
(
title
==
""
)
{
var
type
=
$
(
"[name=type]"
).
val
();
/*if(title == "") {
top.layer.msg("请填写文章标题");
return false;
} else {
...
...
@@ -151,21 +162,30 @@
top.layer.msg("文章标题不超过20个汉字");
return false;
}
}*/
if
(
strlen
(
title
)
>
40
)
{
top
.
layer
.
msg
(
"文章标题不超过20个汉字"
);
return
false
;
}
if
(
type
<
1
){
top
.
layer
.
msg
(
"请选择专区类型"
);
return
false
;
}
if
(
imgurl
==
""
)
{
top
.
layer
.
msg
(
"请上传主图"
);
return
false
;
}
if
(
content
==
""
)
{
/*
if(content == "") {
top.layer.msg("请输入内容");
return false;
}
}
*/
if
(
id
>
0
)
{
//修改项目
$
.
post
(
"/zzhnc/article/updateArticle"
,
{
id
:
id
,
title
:
title
,
content
:
content
,
//content: content,
type
:
type
,
imgurl
:
imgurl
},
function
(
data
)
{
console
.
log
(
data
);
...
...
@@ -179,7 +199,8 @@
//添加项目
$
.
post
(
"/zzhnc/article/addArticle"
,
{
title
:
title
,
content
:
content
,
//content: content,
type
:
type
,
imgurl
:
imgurl
},
function
(
data
)
{
console
.
log
(
data
);
...
...
@@ -197,7 +218,8 @@
//重置
$
(
".resetBtn"
).
on
(
"click"
,
function
()
{
$
(
"[name=title]"
).
val
(
""
);
$
(
"[name=content]"
).
val
(
""
);
//$("[name=content]").val("");
$
(
"[name=type]"
).
val
(
""
);
$
(
"[name=imgurl]"
).
val
(
""
);
$
(
".mainpictrue"
).
attr
(
"src"
,
""
).
css
(
"margin-top"
,
"0"
);
form
.
render
();
...
...
WebContent/WEB-INF/jsp/pc/activity/activityList.jsp
查看文件 @
f9fc13a
...
...
@@ -28,6 +28,7 @@
<th>
No
</th>
<th
style=
"width: 130px;"
>
主图
</th>
<th>
标题
</th>
<th>
类型
</th>
<th>
更新时间
</th>
<th>
操作
</th>
</tr>
...
...
@@ -74,6 +75,7 @@
'<td>'
+
((
data
.
page
-
1
)
*
data
.
pageSize
+
i
+
1
)
+
'</td>'
+
'<td><img src="'
+
data
.
rows
[
i
].
imgurl
+
'" style="width: 100px; height: 100px;" /></td>'
+
'<td>'
+
data
.
rows
[
i
].
title
+
'</td>'
+
'<td>'
+
toType
(
data
.
rows
[
i
].
type
)
+
'</td>'
+
'<td>'
+
toTime_G
(
data
.
rows
[
i
].
createdtime
)
+
'</td>'
+
'<td>'
+
'<a href="#" class="layui-btn layui-btn-sm updataBtn">修改</a>'
+
...
...
@@ -170,6 +172,15 @@
layer
.
close
(
index
);
});
});
//专区类型转换
function
toType
(
t
){
if
(
t
==
1
){
return
t
=
"活动介绍"
}
else
{
return
t
=
"福利专区"
}
}
})
</script>
...
...
编写
预览
Markdown
格式
附加文件
你添加了
0
人
到此讨论。请谨慎行事。
请先完成此消息的编辑!
取消
请
注册
或
登录
后发表评论