Skip to content
切换导航面板
项目
群组
代码片段
帮助
zhangtai
/
zzhnc
当前项目
正在载入...
登录
切换导航面板
转到一个项目
项目
版本库
问题
0
合并请求
0
流水线
维基
设置
活动
图像
图表
创建新的问题
作业
提交
问题看板
文件
提交
分支
标签
贡献者
图像
比较
图表
Commit c3e0c6a8
由
沈姿.前端(已离职)
编写于
Dec 27, 2017
浏览文件
选项
浏览文件
标签
下载
差异文件
Merge branch 'shenzi'
2 个父辈
8039601b
23999ee8
隐藏空白字符变更
内嵌
并排
正在显示
4 个修改的文件
包含
114 行增加
和
166 行删除
WebContent/WEB-INF/jsp/pc/activity/activityList.jsp
WebContent/WEB-INF/jsp/pc/goods/goodsEdit.jsp
WebContent/WEB-INF/jsp/pc/goods/goodsList.jsp
WebContent/WEB-INF/res/js/me.js
WebContent/WEB-INF/jsp/pc/activity/activityList.jsp
查看文件 @
c3e0c6a
...
@@ -93,8 +93,8 @@
...
@@ -93,8 +93,8 @@
<script
type=
"text/javascript"
src=
"/zzhnc/res/js/me.js"
></script>
<script
type=
"text/javascript"
src=
"/zzhnc/res/js/me.js"
></script>
<script>
<script>
layui
.
use
([
'form'
,
'element'
,
'laydate'
,
'layer'
,
'laypage'
],
function
()
{
layui
.
use
([
'form'
,
'element'
,
'laydate'
,
'layer'
,
'laypage'
],
function
()
{
var
form
=
layui
.
form
()
,
var
form
=
layui
.
form
,
element
=
layui
.
element
()
,
element
=
layui
.
element
,
laydate
=
layui
.
laydate
,
laydate
=
layui
.
laydate
,
layer
=
layui
.
layer
,
layer
=
layui
.
layer
,
laypage
=
layui
.
laypage
;
laypage
=
layui
.
laypage
;
...
...
WebContent/WEB-INF/jsp/pc/goods/goodsEdit.jsp
查看文件 @
c3e0c6a
...
@@ -15,73 +15,71 @@
...
@@ -15,73 +15,71 @@
color
:
red
;
color
:
red
;
margin-right
:
5px
;
margin-right
:
5px
;
}
}
.layui-form-label
{
.layui-form-label
{
width
:
100px
;
width
:
100px
;
}
}
#container
{
#container
{
margin-left
:
20px
;
margin-left
:
20px
;
}
}
.bannerUrl
{
width
:
200px
;
height
:
200px
;
}
</style>
</style>
<body
class=
"wrap"
>
<body
class=
"wrap"
>
<form
class=
"layui-form"
>
<form
class=
"layui-form"
>
<div
class=
"layui-form-item"
>
<div
class=
"layui-form-item"
>
<label
class=
"layui-form-label"
><i
class=
"red"
>
*
</i>
商品主标题
</label>
<label
class=
"layui-form-label"
><i
class=
"red"
>
*
</i>
商品主标题
</label>
<div
class=
"layui-input-inline"
style=
"width:
39
0px;"
>
<div
class=
"layui-input-inline"
style=
"width:
40
0px;"
>
<input
type=
"text"
name=
"
titl
e"
lay-verify=
"title"
placeholder=
"商品主标题"
class=
"layui-input"
>
<input
type=
"text"
name=
"
nam
e"
lay-verify=
"title"
placeholder=
"商品主标题"
class=
"layui-input"
>
</div>
</div>
<div
class=
"layui-form-mid layui-word-aux"
>
不超过20个汉字
</div>
<div
class=
"layui-form-mid layui-word-aux"
>
不超过20个汉字
</div>
</div>
</div>
<div
class=
"layui-form-item"
>
<div
class=
"layui-form-item"
>
<label
class=
"layui-form-label"
><i
class=
"red"
>
*
</i>
商品副标题
</label>
<label
class=
"layui-form-label"
><i
class=
"red"
>
*
</i>
商品副标题
</label>
<div
class=
"layui-input-inline"
style=
"width:
39
0px;"
>
<div
class=
"layui-input-inline"
style=
"width:
40
0px;"
>
<input
type=
"text"
name=
"
subtitle"
lay-verify=
"title
"
placeholder=
"商品副标题"
class=
"layui-input"
>
<input
type=
"text"
name=
"
description"
lay-verify=
"description
"
placeholder=
"商品副标题"
class=
"layui-input"
>
</div>
</div>
</div>
</div>
<div
class=
"layui-form-item"
>
<div
class=
"layui-form-item"
>
<label
class=
"layui-form-label"
><i
class=
"red"
>
*
</i>
商品主图
</label>
<label
class=
"layui-form-label"
><i
class=
"red"
>
*
</i>
商品主图
</label>
<div
class=
"layui-input-block"
>
<div
class=
"layui-input-inline"
style=
"width: 390px;"
>
<img
class=
"bannerUrl"
/>
<div
class=
"layui-upload"
>
<button
type=
"button"
class=
"layui-btn"
id=
"upload"
>
上传商品主图
</button>
<button
type=
"button"
class=
"layui-btn"
id=
"upload"
style=
"margin:0 20px 0 0;float:left;"
>
上传商品主图
</button>
<span
class=
"layui-form-mid layui-word-aux"
>
建议尺寸:200*200
</span>
<div
class=
"layui-upload-list"
>
<img
class=
"layui-upload-img mainpictrue"
src=
""
>
<input
type=
"text"
style=
"display:none;"
name=
"imgurl"
>
<p
id=
"demoText"
></p>
</div>
</div>
</div>
</div>
</div>
</div>
<div
class=
"layui-form-item"
>
<div
class=
"layui-form-item"
>
<label
class=
"layui-form-label"
><i
class=
"red"
>
*
</i>
商品原价
</label>
<label
class=
"layui-form-label"
><i
class=
"red"
>
*
</i>
商品原价
</label>
<div
class=
"layui-input-inline"
style=
"width: 100px;"
>
<div
class=
"layui-input-inline"
style=
"width: 100px;"
>
<input
type=
"number"
name=
"
subtitle"
lay-verify=
"titl
e"
placeholder=
"商品原价"
class=
"layui-input"
>
<input
type=
"number"
name=
"
primePrice"
lay-verify=
"primePric
e"
placeholder=
"商品原价"
class=
"layui-input"
>
</div>
</div>
<div
class=
"layui-form-mid"
>
元
</div>
<div
class=
"layui-form-mid"
>
元
</div>
<label
class=
"layui-form-label"
><i
class=
"red"
>
*
</i>
商品现价
</label>
<label
class=
"layui-form-label"
><i
class=
"red"
>
*
</i>
商品现价
</label>
<div
class=
"layui-input-inline"
style=
"width: 100px;"
>
<div
class=
"layui-input-inline"
style=
"width: 100px;"
>
<input
type=
"number"
name=
"
subtitle"
lay-verify=
"titl
e"
placeholder=
"商品现价"
class=
"layui-input"
>
<input
type=
"number"
name=
"
price"
lay-verify=
"pric
e"
placeholder=
"商品现价"
class=
"layui-input"
>
</div>
</div>
<div
class=
"layui-form-mid"
>
元
</div>
<div
class=
"layui-form-mid"
>
元
</div>
</div>
</div>
<div
class=
"layui-form-item"
>
<div
class=
"layui-form-item"
>
<label
class=
"layui-form-label"
><i
class=
"red"
>
*
</i>
商家名称
</label>
<label
class=
"layui-form-label"
><i
class=
"red"
>
*
</i>
商家名称
</label>
<div
class=
"layui-input-inline"
style=
"width:
39
0px;"
>
<div
class=
"layui-input-inline"
style=
"width:
40
0px;"
>
<input
type=
"text"
name=
"s
ubtitle"
lay-verify=
"titl
e"
placeholder=
"商家名称"
class=
"layui-input"
>
<input
type=
"text"
name=
"s
ellerName"
lay-verify=
"sellerNam
e"
placeholder=
"商家名称"
class=
"layui-input"
>
</div>
</div>
</div>
</div>
<div
class=
"layui-form-item"
>
<div
class=
"layui-form-item"
>
<label
class=
"layui-form-label"
><i
class=
"red"
>
*
</i>
商家店铺号
</label>
<label
class=
"layui-form-label"
><i
class=
"red"
>
*
</i>
商家店铺号
</label>
<div
class=
"layui-input-inline"
style=
"width:
39
0px;"
>
<div
class=
"layui-input-inline"
style=
"width:
40
0px;"
>
<input
type=
"text"
name=
"s
ubtitle"
lay-verify=
"title
"
placeholder=
"商家店铺号"
class=
"layui-input"
>
<input
type=
"text"
name=
"s
ellerAddress"
lay-verify=
"sellerAddress
"
placeholder=
"商家店铺号"
class=
"layui-input"
>
</div>
</div>
</div>
</div>
<div
class=
"layui-form-item"
>
<div
class=
"layui-form-item"
>
<label
class=
"layui-form-label"
><i
class=
"red"
>
*
</i>
商家电话
</label>
<label
class=
"layui-form-label"
><i
class=
"red"
>
*
</i>
商家电话
</label>
<div
class=
"layui-input-inline"
style=
"width: 390px;"
>
<div
class=
"layui-input-inline"
style=
"width: 390px;"
>
<input
type=
"text"
name=
"
subtitle"
lay-verify=
"titl
e"
placeholder=
"商家电话"
class=
"layui-input"
>
<input
type=
"text"
name=
"
phone"
lay-verify=
"phon
e"
placeholder=
"商家电话"
class=
"layui-input"
>
</div>
</div>
</div>
</div>
<div
class=
"layui-form-item"
>
<div
class=
"layui-form-item"
>
...
@@ -104,8 +102,6 @@
...
@@ -104,8 +102,6 @@
<script
src=
'/zzhnc/res/js/jquery.min.js'
></script>
<script
src=
'/zzhnc/res/js/jquery.min.js'
></script>
<script
src=
"/zzhnc/res/plugins/layui/layui.js"
charset=
"utf-8"
></script>
<script
src=
"/zzhnc/res/plugins/layui/layui.js"
charset=
"utf-8"
></script>
<script
type=
"text/javascript"
src=
"/zzhnc/res/js/me.js"
></script>
<script
type=
"text/javascript"
src=
"/zzhnc/res/js/me.js"
></script>
<script
type=
"text/javascript"
src=
"/zzhnc/res/UE/ueditor.config.js"
></script>
<script
type=
"text/javascript"
src=
"/zzhnc/res/UE/ueditor.all.js"
></script>
<script>
<script>
window
.
onload
=
function
()
{
window
.
onload
=
function
()
{
UE
.
Editor
.
prototype
.
_bkGetActionUrl
=
UE
.
Editor
.
prototype
.
getActionUrl
;
UE
.
Editor
.
prototype
.
_bkGetActionUrl
=
UE
.
Editor
.
prototype
.
getActionUrl
;
...
@@ -123,12 +119,40 @@
...
@@ -123,12 +119,40 @@
});
});
}
}
layui
.
use
([
'form'
,
'element'
,
'layer'
,
'
laypage'
,
'
upload'
],
function
()
{
layui
.
use
([
'form'
,
'element'
,
'layer'
,
'upload'
],
function
()
{
var
form
=
layui
.
form
,
var
form
=
layui
.
form
,
element
=
layui
.
element
,
element
=
layui
.
element
,
layer
=
layui
.
layer
,
layer
=
layui
.
layer
,
laypage
=
layui
.
laypage
,
upload
=
layui
.
upload
;
upload
=
layui
.
upload
;
var
goodsid
=
getUrl_G
(
"id"
);
function
initData
()
{
$
.
get
(
"/zzhnc/goods/search"
,
{
id
:
goodsid
},
function
(
data
)
{
console
.
log
(
data
)
if
(
data
.
code
==
0
){
if
(
data
.
data
.
rows
.
length
>
0
){
var
data
=
data
.
data
.
rows
[
0
];
$
(
"[name=name]"
).
val
(
data
.
name
);
$
(
"[name=description]"
).
val
(
data
.
description
);
$
(
".bannerUrl"
).
attr
(
"src"
,
data
.
bannerUrl
);
$
(
"[name=primePrice]"
).
val
(
data
.
primePrice
);
$
(
"[name=price]"
).
val
(
data
.
price
);
$
(
"[name=sellerName]"
).
val
(
data
.
sellerName
);
$
(
"[name=sellerAddress]"
).
val
(
data
.
sellerAddress
);
$
(
"[name=phone]"
).
val
(
data
.
updateTime
);
UE
.
getEditor
(
"container"
).
ready
(
function
()
{
UE
.
getEditor
(
"container"
).
setContent
(
unescape
(
data
.
description
));
})
}
}
})
}
//初始化数据
initData
();
//普通图片上传
//普通图片上传
upload
.
render
({
upload
.
render
({
...
@@ -145,95 +169,12 @@
...
@@ -145,95 +169,12 @@
layer
.
msg
(
'上传失败'
);
layer
.
msg
(
'上传失败'
);
}
}
}
}
});
$
(
".resetBtn"
).
on
(
"click"
,
function
()
{
$
(
"input[name=title]"
).
val
(
""
);
$
(
"textarea[name=content]"
).
val
(
""
);
$
(
"input[name=imgurl]"
).
val
(
""
);
$
(
".mainpictrue"
).
attr
(
"src"
,
""
);
form
.
render
();
})
var
id
=
getUrl_G
(
"id"
);
if
(
id
>
0
)
{
$
.
post
(
"/zzhnc/article/getArticle"
,
{
id
:
id
},
function
(
data
)
{
console
.
log
(
data
);
if
(
data
.
code
==
0
)
{
$
(
"input[name=title]"
).
val
(
data
.
data
.
title
);
//重新渲染
UE
.
getEditor
(
"container"
).
ready
(
function
()
{
UE
.
getEditor
(
"container"
).
setContent
(
unescape
(
data
.
data
.
content
));
})
$
(
"input[name=imgurl]"
).
attr
(
"src"
,
data
.
data
.
imgurl
);
$
(
".mainpictrue"
).
attr
(
"src"
,
data
.
data
.
imgurl
);
form
.
render
();
}
})
}
form
.
on
(
'submit(submit)'
,
function
(
data
)
{
var
title
=
$
(
"input[name=title]"
).
val
();
var
content
=
UE
.
getEditor
(
'container'
).
getContent
();
var
imgurl
=
$
(
"input[name=imgurl]"
).
val
();
if
(
title
==
""
)
{
top
.
layer
.
msg
(
"请填写文章标题"
);
return
false
;
}
else
{
if
(
strlen
(
title
)
>
40
)
{
top
.
layer
.
msg
(
"文章标题不超过20个汉字"
);
return
false
;
}
}
if
(
imgurl
==
""
)
{
top
.
layer
.
msg
(
"请上传主图"
);
return
false
;
}
if
(
content
==
""
)
{
top
.
layer
.
msg
(
"请输入内容"
);
return
false
;
}
console
.
log
()
if
(
id
>
0
)
{
//修改项目
$
.
post
(
"/zzhnc/article/updateArticle"
,
{
id
:
id
,
title
:
title
,
content
:
content
,
imgurl
:
imgurl
},
function
(
data
)
{
console
.
log
(
data
);
if
(
data
.
code
==
0
)
{
top
.
layer
.
msg
(
"修改成功"
);
}
else
{
top
.
layer
.
msg
(
data
.
msg
);
}
})
}
else
{
//添加项目
$
.
post
(
"/zzhnc/article/addArticle"
,
{
title
:
title
,
content
:
content
,
imgurl
:
imgurl
},
function
(
data
)
{
console
.
log
(
data
);
if
(
data
.
code
==
0
)
{
top
.
layer
.
msg
(
"添加成功"
);
form
.
render
();
}
else
{
top
.
layer
.
msg
(
data
.
msg
);
}
})
}
return
false
;
});
});
})
})
</script>
</script>
<script
type=
"text/javascript"
src=
"/zzhnc/res/UE/ueditor.config.js"
></script>
<script
type=
"text/javascript"
src=
"/zzhnc/res/UE/ueditor.all.js"
></script>
</html>
</html>
\ No newline at end of file
\ No newline at end of file
WebContent/WEB-INF/jsp/pc/goods/goodsList.jsp
查看文件 @
c3e0c6a
...
@@ -36,8 +36,10 @@
...
@@ -36,8 +36,10 @@
<th>
商品主图
</th>
<th>
商品主图
</th>
<th>
商品标题
</th>
<th>
商品标题
</th>
<th>
商品副标题
</th>
<th>
商品副标题
</th>
<th>
所属商家
</th>
<th>
原价
</th>
<th>
商家店铺号
</th>
<th>
现价
</th>
<th>
商家名称
</th>
<th>
商家地址
</th>
<th>
操作
</th>
<th>
操作
</th>
</tr>
</tr>
</thead>
</thead>
...
@@ -84,8 +86,10 @@
...
@@ -84,8 +86,10 @@
'<td><img class="imgUrl" src="'
+
data
.
rows
[
i
].
bannerUrl
+
'" /></td>'
+
'<td><img class="imgUrl" src="'
+
data
.
rows
[
i
].
bannerUrl
+
'" /></td>'
+
'<td>'
+
data
.
rows
[
i
].
name
+
'</td>'
+
'<td>'
+
data
.
rows
[
i
].
name
+
'</td>'
+
'<td>'
+
data
.
rows
[
i
].
description
+
'</td>'
+
'<td>'
+
data
.
rows
[
i
].
description
+
'</td>'
+
'<td>'
+
data
.
rows
[
i
].
sellerId
+
'</td>'
+
'<td>'
+
data
.
rows
[
i
].
primePrice
+
'</td>'
+
'<td>'
+
data
.
rows
[
i
].
sellerId
+
'</td>'
+
'<td>'
+
data
.
rows
[
i
].
price
+
'</td>'
+
'<td>'
+
data
.
rows
[
i
].
sellerName
+
'</td>'
+
'<td>'
+
data
.
rows
[
i
].
sellerAddress
+
'</td>'
+
'<td>'
+
'<td>'
+
'<a href="#" class="layui-btn layui-btn-mini updataBtn">修改</a>'
+
'<a href="#" class="layui-btn layui-btn-mini updataBtn">修改</a>'
+
'<a href="#" class="layui-btn layui-btn-mini deleteBtn">删除</a>'
+
'<a href="#" class="layui-btn layui-btn-mini deleteBtn">删除</a>'
+
...
@@ -163,7 +167,7 @@
...
@@ -163,7 +167,7 @@
layer
.
confirm
(
'您确定要删除该爆款商品吗?'
,
{
layer
.
confirm
(
'您确定要删除该爆款商品吗?'
,
{
btn
:
[
'确定'
,
'取消'
]
btn
:
[
'确定'
,
'取消'
]
},
function
(
index
,
layero
)
{
},
function
(
index
,
layero
)
{
$
.
post
(
"/zzhnc/goods/
upda
te"
,
{
$
.
post
(
"/zzhnc/goods/
dele
te"
,
{
id
:
id
id
:
id
},
function
(
data
)
{
},
function
(
data
)
{
console
.
log
(
data
)
console
.
log
(
data
)
...
...
WebContent/WEB-INF/res/js/me.js
查看文件 @
c3e0c6a
// 转时间
// 转时间
function
toTime_G
(
v
){
function
toTime_G
(
v
)
{
if
(
v
==
null
||
v
==
""
){
if
(
v
==
null
||
v
==
""
)
{
return
""
;
return
""
;
}
else
{
}
else
{
var
time
=
new
Date
(
v
)
var
time
=
new
Date
(
v
)
var
year
=
time
.
getFullYear
()
var
year
=
time
.
getFullYear
()
var
mon
=
time
.
getMonth
()
+
1
;
var
mon
=
time
.
getMonth
()
+
1
;
var
day
=
time
.
getDate
();
var
day
=
time
.
getDate
();
var
hour
=
time
.
getHours
();
var
hour
=
time
.
getHours
();
var
min
=
time
.
getMinutes
();
var
min
=
time
.
getMinutes
();
if
(
mon
<
10
)
mon
=
"0"
+
mon
if
(
mon
<
10
)
mon
=
"0"
+
mon
if
(
day
<
10
)
day
=
"0"
+
day
if
(
day
<
10
)
day
=
"0"
+
day
if
(
hour
<
10
)
hour
=
"0"
+
hour
if
(
hour
<
10
)
hour
=
"0"
+
hour
if
(
min
<
10
)
min
=
"0"
+
min
if
(
min
<
10
)
min
=
"0"
+
min
return
year
+
"-"
+
mon
+
"-"
+
day
+
" "
+
hour
+
":"
+
min
return
year
+
"-"
+
mon
+
"-"
+
day
+
" "
+
hour
+
":"
+
min
}
}
//获取Url参数
function
getUrl_G
(
name
)
{
var
reg
=
new
RegExp
(
"(^|&)"
+
name
+
"=([^&]*)(&|$)"
,
"i"
);
var
r
=
window
.
location
.
search
.
substr
(
1
).
match
(
reg
);
if
(
r
!=
null
)
return
unescape
(
r
[
2
]);
return
null
;
}
}
//限制字数,英文一个字节,中文两个字节
}
function
strlen
(
str
)
{
var
len
=
0
;
//获取Url参数
for
(
var
i
=
0
;
i
<
str
.
length
;
i
++
)
{
function
getUrl_G
(
name
)
{
var
c
=
str
.
charCodeAt
(
i
);
var
reg
=
new
RegExp
(
"(^|&)"
+
name
+
"=([^&]*)(&|$)"
,
"i"
);
//单字节加1
var
r
=
window
.
location
.
search
.
substr
(
1
).
match
(
reg
);
if
((
c
>=
0x0001
&&
c
<=
0x007e
)
||
(
0xff60
<=
c
&&
c
<=
0xff9f
))
{
if
(
r
!=
null
)
return
unescape
(
r
[
2
]);
len
++
;
return
null
;
}
else
{
}
len
+=
2
;
}
//限制字数,英文一个字节,中文两个字节
function
strlen
(
str
)
{
var
len
=
0
;
for
(
var
i
=
0
;
i
<
str
.
length
;
i
++
)
{
var
c
=
str
.
charCodeAt
(
i
);
//单字节加1
if
((
c
>=
0x0001
&&
c
<=
0x007e
)
||
(
0xff60
<=
c
&&
c
<=
0xff9f
))
{
len
++
;
}
else
{
len
+=
2
;
}
}
return
len
;
}
}
function
toNull_G
(){
$
(
"table td"
).
each
(
function
(){
var
v
=
$
(
this
).
html
()
if
(
v
==
""
||
v
==
null
||
v
==
"null"
||
v
==
undefined
||
v
==
"undefined"
){
v
=
""
$
(
this
).
html
(
v
)
}
})
}
\ No newline at end of file
\ No newline at end of file
return
len
;
}
function
toNull_G
()
{
$
(
"table td"
).
each
(
function
()
{
var
v
=
$
(
this
).
html
()
if
(
v
==
""
||
v
==
null
||
v
==
"null"
||
v
==
undefined
||
v
==
"undefined"
)
{
v
=
""
$
(
this
).
html
(
v
)
}
})
}
\ No newline at end of file
\ No newline at end of file
编写
预览
Markdown
格式
附加文件
你添加了
0
人
到此讨论。请谨慎行事。
请先完成此消息的编辑!
取消
请
注册
或
登录
后发表评论