topicEdit.html
7.45 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
<!DOCTYPE html>
<head>
<style>
span .tag {
display: block;
float: left;
padding: 2px 5px;
background: #1caf9a;
margin-right: 5px;
margin-bottom: 5px;
-moz-border-radius: 2px;
-webkit-border-radius: 2px;
border-radius: 2px;
font-size: 13px;
}
</style>
</head>
<div id="tt" class="easyui-layout" fit="true" style="overflow-y: scroll">
<form name="activityAddForm" id="activityAddForm" method="post" enctype="multipart/form-data">
<div style="margin-top: 20px;margin-left: 30px">
<table border="0" style="width:95%;margin-top:5px;line-height:30px;" id="tab">
<tr style="height: 60px">
<td >
<span style="color:red">*</span><label>话题名称</label> <br>
<input id="topicName" name="topicName" class="easyui-textbox" style="width: 380px;"/>
</td>
</tr>
<tr style="height: 60px">
<td >
<span style="color:red">*</span><label>话题描述</label> <br>
<textarea id="topicDesc" name="topicDesc" style="width: 380px;" rows="6" ></textarea>
</td>
</tr>
<tr style="height: 60px">
<td>
<span style="color:red">*</span><label>图片</label> <br>
<div id="imageUpload">
</div>
<!-- <span style=" margin-left: 10px; color: red"> 图片宽高(186x170)</span>-->
</td>
</tr>
<tr style="height: 60px">
<td >
<span style="color:red">*</span><label>关联内容标签</label> <br>
<a id="searchLabelBtn" class="btn-info">查询</a>
<div id="relatedLabelsDiv">
<div id="taglist" class="tagwrap">
<!--<span class="tag"><span>32132</span><a href="#" title="Removing tag" data-index="0" class="removetag">x</a></span>
<span class="tag"><span>淋淋惹</span><a href="#" title="Removing tag" data-index="1" class="removetag" >x</a></span>-->
</div>
</div>
</td>
</tr>
</table>
</div>
</form>
</div>
<script>
$(function () {
$("#topicName").textbox({
required: true,
missingMessage: "话题名称不能为空",
prompt: "请输入话题名称"
});
$("#imageUpload").imageUpload({
width: 171,
height: 120,
realInputName: "topicImageUrl",
url: serverContextPath + '/fileupload/uploadFile',
queryParams: {
bucket: "activity"
},
onBeforeSubmit: function () {
$.messager.progress({
title: "正在执行",
msg: "正在执行,请稍后...",
interval: 500,
text: ""
});
},
filterFileName: function (data) {
debugger;
if (!data || data.code != 200) {
$.messager.progress("close");
$.messager.alert("错误",data.message);
return "";
}
return data.data.url;
},
onLoadSuccess: function (data) {
$.messager.progress("close");
//$("#imageUpload").hide();
//$("#fileName").val(data.data.fileName);
//$("#videoSize").val(data.data.fileSize); //如果有大小校验
/*$("#callBackDiv").html("<div id='videoUploadDiv' class='image-upload' style='position: relative;top:19px;width: 120px; height: 150px;'><img id='imageShow' src='"+data.data.url+"?vframe/jpg/offset/0' width='120' height='150'/></div>"
+"<span style='position: relative;top: -40px;left: 30px;'>"+data.data.fileName+"</span><span style='position: relative;left: 50px;top: -40px;'>"+data.data.fileSize+"M</span>").show();
*/
return false;
}
});
var data = paramObject.mkData;
if (data){
$("#topicName").textbox("setValue", data.topicName);
debugger
$("#topicDesc").val(data.topicDesc);
$("#imageUpload").imageUpload("setValue", data.topicImageUrl);
//展示已经关联的标签
var labelInfoList = data.labelInfoList;
for(var i=0; i< labelInfoList.length; i++){
var choosedTagSpan = '<span style="margin-left: 10px" class="tag" name="choosedTag" data-labelId="'+labelInfoList[i].labelId+'"><span style="background-color: #1caf9a;color: white">'+labelInfoList[i].labelName+'</span><a href="#" style="background-color: #1caf9a" title="Removing tag" data-index="0" class="removetag">x</a></span>' ;
$("#taglist").append(choosedTagSpan);
}
}
$(document).on('click', '.removetag', function() {
// $(this).remove();
$(this).closest(".tag").remove();
});
//查询标签列表
$("#searchLabelBtn").linkbutton({
iconCls : "icon-search",
onClick : function() {
chooseLabels();
}
});
});
//选择标签列表
function chooseLabels(){
var chooseLabelList = $("<div id='chooseLabelList'>").appendTo($(document.body));
var title = "选择标签";
$("#chooseLabelList").myDialog({
title: title,
width: "60%",
height: "70%",
resizable:false,
buttons:[{
id : "saveChooseLabelBtn",
text: "保存",
iconCls : "icon-save",
handler:function(){
//确定保存之前,要把之前已经选择的标签清空
$("#taglist").html("");
//做相应的处理 回填信息--所有被选择的复选框
debugger
$("input[type='checkbox'][class='tagCheckbox']:checked").each(function () {
var labelId = $(this).attr("data-labelId");
var labelName = $(this).attr("data-labelName");
var choosedTagSpan = '<span class="tag" style="margin-left: 10px" name="choosedTag" data-labelId="'+labelId+'"><span style="background-color: #1caf9a;color: white">'+labelName+'</span><a href="#" style="background-color: #1caf9a" title="Removing tag" data-index="0" class="removetag">x</a></span>' ;
$("#taglist").append(choosedTagSpan);
});
$(chooseLabelList).dialog("close");
$.messager.show({
title: "提示",
msg: title + "成功!",
height: 120
});
}
}, {
id:"closeChooseBtn",
text: "关闭",
iconCls: "icon-cancel",
handler: function () {
$.messager.confirm("确认", "确认关闭吗?", function (flag) {
if(flag){
$(chooseLabelList).dialog("close");
}
});
}
}],
modal: true,
href: contextPath + "/html/grass/labelManage/chooseLabels.html",
});
}
</script>