unionShareMessageAdd.html
7.37 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8" />
<title>Yoho!Buy运营平台</title>
<script src="/union/js/include.js"></script>
<style>
.sub-title {
height: 60px;
align-items: left;
vertical-align: middle;
padding-left: 20px;
font-size: 20px;
line-height: 60px;
border: 1px solid #D7D7D7;
color: #666666;
background-color: #F7F7F7;
}
.row-input {
width:95%;
heigth: 40px;
line-height: 40px;
margin-top:15px;
font-size: 16px;
display: block;
}
.row-input .row-left {
padding-left: 22px;
width: 100px;
display: block;
float: left;
}
.row-input .row-right {
width: auto;
display: inline-block;
}
.red-must-edit {
color: red;
}
.genderradio {
margin: 0px 5px 5px 35px;
}
.btn-short {
width: 80px;
height: 40px;
line-height: 40px;
font-size: 20px;
color: white;
border-radius: 5px;
display: inline-block;
cursor: pointer;
text-align: center;
}
.btn-short:hover {
opacity: 0.9;
}
</style>
</head>
<body class="easyui-layout" fit="true">
<div region="north" style="height: 100px; border-bottom: 0;">
<script>
document.write(addHead('CPS联盟管理', 'CPS消息管理'));
</script>
</div>
<div region="center" style="margin: 10px;border: 1px solid #D7D7D7;">
<form id="activityEditForm" name="activityEditForm" method="post">
<div class="row-input">
<div class="row-left">
消息内容<span class="red-must-edit">*</span>
</div>
<div class="row-right">
<input class="easyui-textbox" id="content" name="content" style="width:500px">
</div>
</div>
<div class="row-input">
<div class="row-left">
消息图片<span class="red-must-edit">*</span>
</div>
<div class="row-right">
<div id="messageImage" style='position: relative;top:15px;'></div>
</div>
</div>
<div class="row-input">
<div class="row-left">
链接url<span class="red-must-edit">*</span>
</div>
<div class="row-right">
<input id="url" name="url" class="easyui-textbox" style="width:500px">
</div>
</div>
<div class="row-input">
<div class="row-left">
优先级<span class="red-must-edit">*</span>
</div>
<div class="row-right">
<input id="priority" name="priority" class="easyui-textbox" style="width:100px"><font color="gray">数字越大,优先级越高</font>
</div>
</div>
<div class="row-input">
<div class="row-left">
有效时间<span class="red-must-edit">*</span>
</div>
<div class="row-right">
<input id="startTime" name="startTime" class="easyui-datetimebox" style="width:180px">
~ <input id="endTime" name="endTime" class="easyui-datetimebox" style="width:180px">
</div>
</div>
<div id="el"></div>
<div class="sub-title" style="border-left: 0px; border-right: 0; height: 80px; line-height:80px;margin-top: 30px;margin-bottom: 10px;text-align: center;">
<div id="cancelBtn" class="btn-short" style="background-color: #42A9CA;">取消</div>
<div id="submitBtn" class="btn-short" style="background-color: #5CB85C;margin-left: 20px;">提交</div>
</div>
</form>
</div>
<script>
$(function () {
$("#messageImage").imageUpload({
width:500,
heigth:50,
realInputName : "unionShareMessagePic",
url:contextPath + '/fileupload/upload',
queryParams : {
bucket : "unionimg"
},
filterFileName : function(data) {
if (!data || data.code != 200) {
$.messager.alert("失败", data.message, "error");
}
return data.data;
}
});
$("#cancelBtn").click(function () {
$.messager.confirm("确认", "您确定要取消创建信息吗?", function(flag) {
if (flag) {
window.location.href = contextPath + "/html/unionshare/unionShareMessageList.html";
}
});
});
$("#submitBtn").click(function () {
var requestObj = {};
var content = $("#content").val();
if (content == "") {
alert("消息内容不能为空");
$("#content").focus();
return;
}
requestObj.content = content;
var arr = document.getElementsByName("unionShareMessagePic");
var image = arr[0].value;
if (image == "") {
alert("请上传消息图片");
return;
}
requestObj.image = image;
var url = $("#url").val();
if (url == "") {
alert("链接url不能为空");
$("#url").focus();
return;
}
requestObj.url = url;
var priority = $("#priority").val();
if (priority == "") {
alert("优先级不能为空");
$("#priority").focus();
return;
}
requestObj.priority = priority;
var startTime = $("#startTime").datetimebox("getValue");
if (startTime == "") {
alert("有效开始时间不能为空");
$("#startTime").click();
return;
}
requestObj.startTime = parseInt(new Date($("#startTime").datetimebox('getValue')).getTime() / 1000);
var endTime = $("#endTime").datetimebox("getValue");
if (endTime == "") {
alert("有效结束时间不能为空");
$("#endTime").click();
return;
}
requestObj.endTime = parseInt(new Date($("#endTime").datetimebox('getValue')).getTime() / 1000)
if (requestObj.startTime > requestObj.endTime) {
alert("开始时间不能大于结束时间");
return;
}
$.ajax({
url: contextPath + '/UnionShareRest/addMessage',
type: "POST",
contentType: "application/json",
async: false,
data: JSON.stringify(requestObj),
success: function (data) {
if(data.code==200){
alert('保存成功');
window.location.href = contextPath + "/html/unionshare/unionShareMessageList.html";
}else{
alert('保存失败');
}
}
});
});
});
</script>
</body>
</html>