|
@ -49,6 +49,190 @@ $(function() {
|
49
|
49
|
return context == null || context == "" || context == "undefined" ? "" : decodeURI(context);
|
50
|
50
|
}
|
51
|
51
|
|
|
52
|
function hotKey(sel, num) {
|
|
53
|
|
|
54
|
$(sel).bind({
|
|
55
|
paste: function(e) {
|
|
56
|
var pastedText;
|
|
57
|
if (window.clipboardData && window.clipboardData.getData) { // IE
|
|
58
|
pastedText = $(this).val() + window.clipboardData.getData('Text');
|
|
59
|
}
|
|
60
|
else {
|
|
61
|
pastedText = $(this).val() + e.originalEvent.clipboardData.getData('Text'); //e.clipboardData.getData('text/plain');
|
|
62
|
}
|
|
63
|
$(this).val(pastedText);
|
|
64
|
|
|
65
|
var $this = $(this);
|
|
66
|
setTimeout(function() {
|
|
67
|
if($this.val().trim()) {
|
|
68
|
$this.siblings("button").show();
|
|
69
|
} else {
|
|
70
|
$this.siblings("button").hide();
|
|
71
|
}
|
|
72
|
}, 1);
|
|
73
|
e.preventDefault();
|
|
74
|
},
|
|
75
|
cut: function(e) {
|
|
76
|
var $this = $(this);
|
|
77
|
setTimeout(function() {
|
|
78
|
if($this.val().trim()) {
|
|
79
|
$this.siblings("button").show();
|
|
80
|
} else {
|
|
81
|
$this.siblings("button").hide();
|
|
82
|
}
|
|
83
|
}, 1);
|
|
84
|
},
|
|
85
|
blur: function() {
|
|
86
|
var $this = $(this);
|
|
87
|
setTimeout(function() {
|
|
88
|
$this.siblings(".keydrop").hide();
|
|
89
|
}, 500)
|
|
90
|
},
|
|
91
|
focus: function() {
|
|
92
|
$(this).siblings(".keydrop").show();
|
|
93
|
},
|
|
94
|
keyup: function(e) {
|
|
95
|
var ti=$(this).val();
|
|
96
|
var $t=this;
|
|
97
|
$t.comr=ti;
|
|
98
|
var $this=$(this);
|
|
99
|
if($(this).val().trim()) {
|
|
100
|
$(this).siblings("button").show();
|
|
101
|
var lNum = $.trim($(this).val()).length;
|
|
102
|
if(0 < lNum) {
|
|
103
|
setTimeout(function(){
|
|
104
|
if( ti===$t.comr && ti!== $t.comrEnd) {
|
|
105
|
var tt=ti;
|
|
106
|
$t.comrEnd=tt;
|
|
107
|
$("#addKeyword").show();
|
|
108
|
$.ajax({
|
|
109
|
"url": "/ajax/article/qaHotKey",
|
|
110
|
"type": "GET",
|
|
111
|
"success": function(data) {
|
|
112
|
console.log(data);
|
|
113
|
if(data.success) {
|
|
114
|
if($t.comrEnd==tt) {
|
|
115
|
if(data.data.length == 0) {
|
|
116
|
$this.siblings(".keydrop").addClass("displayNone");
|
|
117
|
$this.siblings(".keydrop").find("ul").html("");
|
|
118
|
} else {
|
|
119
|
$this.siblings(".keydrop").removeClass("displayNone");
|
|
120
|
var oSr = "";
|
|
121
|
for(var i = 0; i < Math.min(data.data.length,5); i++) {
|
|
122
|
oSr += '<li>' + data.data[i].caption + '<div class="closeThis"></div></li>';
|
|
123
|
}
|
|
124
|
$this.siblings(".keydrop").find("ul").html(oSr);
|
|
125
|
}
|
|
126
|
}
|
|
127
|
} else {
|
|
128
|
$this.siblings(".keydrop").addClass("displayNone");
|
|
129
|
$this.siblings(".keydrop").find("ul").html("");
|
|
130
|
}
|
|
131
|
},
|
|
132
|
"data": {
|
|
133
|
"key": $this.val()
|
|
134
|
},
|
|
135
|
dataType: "json",
|
|
136
|
'error': function() {
|
|
137
|
$.MsgBox.Alert('提示', '服务器连接超时!');
|
|
138
|
}
|
|
139
|
});
|
|
140
|
}
|
|
141
|
},500);
|
|
142
|
}
|
|
143
|
} else {
|
|
144
|
$(this).siblings("button").hide();
|
|
145
|
$(this).siblings(".keydrop").addClass("displayNone");
|
|
146
|
$(this).siblings(".keydrop").find("ul").html("");
|
|
147
|
}
|
|
148
|
}
|
|
149
|
})
|
|
150
|
$(".keydrop").on("click", "li", function() {
|
|
151
|
var oValue = $(this).text();
|
|
152
|
var oJudge = $(this).parents(".col-w-12").siblings().find("ul.ulspace li");
|
|
153
|
var addNum = $(this).parents(".keydrop").siblings("input").attr("data-num");
|
|
154
|
|
|
155
|
for(var i = 0; i < oJudge.length; i++) {
|
|
156
|
if(oValue == oJudge[i].innerText) {
|
|
157
|
$.MsgBox.Alert('提示', '添加内容不能重复');
|
|
158
|
return;
|
|
159
|
}
|
|
160
|
}
|
|
161
|
$(this).parents(".col-w-12").siblings().find("ul.ulspace").append('<li>' + oValue + '<div class="closeThis"></div></li>');
|
|
162
|
$(this).parents(".keydrop").siblings("input").val("");
|
|
163
|
$(this).parents(".keydrop").siblings("button").hide();
|
|
164
|
if(oJudge.length == addNum - 1) {
|
|
165
|
$(this).parents(".keydrop").siblings("input").val("");
|
|
166
|
$(this).parents(".col-w-12").hide();
|
|
167
|
}
|
|
168
|
$(this).parent("ul").html("")
|
|
169
|
})
|
|
170
|
if(num == 1) {
|
|
171
|
return;
|
|
172
|
} else {
|
|
173
|
/*添加*/
|
|
174
|
$(".addButton").siblings("input").keypress(function(){
|
|
175
|
var e = event || window.event;
|
|
176
|
if(e.keyCode == 13) {
|
|
177
|
var oValue = $(this).val().trim();
|
|
178
|
var oJudge = $(this).parent().siblings().find("ul.ulspace li");
|
|
179
|
var addContent = $(this).attr("data-pro");
|
|
180
|
var addNum = $(this).attr("data-num");
|
|
181
|
var addfontSizeNum = $(this).attr("data-fontSizeN");
|
|
182
|
if(!oValue) {
|
|
183
|
$.MsgBox.Alert('提示', '请先填写内容');
|
|
184
|
return;
|
|
185
|
}
|
|
186
|
if(oValue.length > addfontSizeNum) {
|
|
187
|
$.MsgBox.Alert('提示', addContent);
|
|
188
|
return;
|
|
189
|
}
|
|
190
|
for(var i = 0; i < oJudge.length; i++) {
|
|
191
|
if(oValue == oJudge[i].innerText) {
|
|
192
|
$.MsgBox.Alert('提示', '添加内容不能重复');
|
|
193
|
return;
|
|
194
|
}
|
|
195
|
}
|
|
196
|
$(this).parent().siblings().find("ul.ulspace").append('<li>' + oValue + '<div class="closeThis"></div></li>');
|
|
197
|
$(this).siblings(".addButton").hide();
|
|
198
|
$(this).val("");
|
|
199
|
if(oJudge.length == addNum - 1) {
|
|
200
|
$(this).val("").parents(".col-w-12").hide();
|
|
201
|
}
|
|
202
|
$(this).siblings(".keydrop").find("ul").html("");
|
|
203
|
}
|
|
204
|
})
|
|
205
|
$(".addButton").click(function() {
|
|
206
|
var oValue = $(this).siblings("input").val().trim();
|
|
207
|
var oJudge = $(this).parent().siblings().find("ul.ulspace li");
|
|
208
|
var addContent = $(this).siblings("input").attr("data-pro");
|
|
209
|
var addNum = $(this).siblings("input").attr("data-num");
|
|
210
|
var addfontSizeNum = $(this).siblings("input").attr("data-fontSizeN");
|
|
211
|
if(!oValue) {
|
|
212
|
$.MsgBox.Alert('提示', '请先填写内容');
|
|
213
|
return;
|
|
214
|
}
|
|
215
|
if(oValue.length > addfontSizeNum) {
|
|
216
|
$.MsgBox.Alert('提示', addContent);
|
|
217
|
return;
|
|
218
|
}
|
|
219
|
for(var i = 0; i < oJudge.length; i++) {
|
|
220
|
if(oValue == oJudge[i].innerText) {
|
|
221
|
$.MsgBox.Alert('提示', '添加内容不能重复');
|
|
222
|
return;
|
|
223
|
}
|
|
224
|
}
|
|
225
|
$(this).parent().siblings().find("ul.ulspace").append('<li>' + oValue + '<div class="closeThis"></div></li>');
|
|
226
|
$(this).hide();
|
|
227
|
$(this).siblings("input").val("");
|
|
228
|
if(oJudge.length == addNum - 1) {
|
|
229
|
$(this).val("").parents(".col-w-12").hide();
|
|
230
|
}
|
|
231
|
$(this).siblings(".keydrop").find("ul").html("");
|
|
232
|
})
|
|
233
|
}
|
|
234
|
|
|
235
|
}
|
52
|
236
|
|
53
|
237
|
//校验标题
|
54
|
238
|
$("#newstitle").on({
|
|
@ -65,6 +249,8 @@ $(function() {
|
65
|
249
|
}
|
66
|
250
|
})
|
67
|
251
|
|
|
252
|
hotKey(".oinput");
|
|
253
|
|
68
|
254
|
//校验关键字
|
69
|
255
|
$("#KeyWord").on({
|
70
|
256
|
focus: function() {
|
|
@ -72,123 +258,16 @@ $(function() {
|
72
|
258
|
},
|
73
|
259
|
blur: function() {
|
74
|
260
|
$("#keyPrompt").text("");
|
75
|
|
},
|
76
|
|
keyup: function() {
|
77
|
|
var ti=$(this).val();
|
78
|
|
hbur=ti;
|
79
|
|
if(ti==""){
|
80
|
|
$(".frmadd").addClass("displayNone");
|
81
|
|
$(".keydrop ul").html("");
|
82
|
|
$(".keydrop").addClass("displayNone");
|
83
|
|
return;
|
84
|
|
}else{
|
85
|
|
$(".frmadd").removeClass("displayNone");
|
86
|
|
}
|
87
|
|
if($(this).val().length > 15) {
|
88
|
|
$(this).val($(this).val().substr(0, 15));
|
89
|
|
}
|
90
|
|
setTimeout(function(){
|
91
|
|
if( ti===hbur && ti!== hburEnd) {
|
92
|
|
KeyWordList(ti);
|
93
|
|
}
|
94
|
|
|
95
|
|
},500)
|
96
|
|
|
97
|
261
|
}
|
98
|
262
|
})
|
99
|
|
//添加关键字
|
100
|
|
$("#addkeyWord").on("click", function() {
|
101
|
|
var keyWord = $("#KeyWord").val();
|
102
|
|
keyWordlen(keyWord);
|
103
|
|
$(".frmadd").addClass("displayNone");
|
104
|
|
$(".keydrop ul").html("");
|
105
|
|
$(".keydrop").addClass("displayNone");
|
106
|
|
})
|
107
|
|
|
108
|
|
//点击搜出的关键字添加
|
109
|
|
$(".keydrop").on("click", "p", function() {
|
110
|
|
var keyWord = $(this).text();
|
111
|
|
$(".frmadd").addClass("displayNone");
|
112
|
|
keyWordlen(keyWord)
|
113
|
|
$(".keydrop ul").html("");
|
114
|
|
$(".keydrop").addClass("displayNone");
|
115
|
|
})
|
116
|
|
|
117
|
|
//删除关键字
|
118
|
263
|
$("#keyWordlist").on("click", ".closeThis", function() {
|
119
|
264
|
$(this).parent().remove();
|
120
|
|
var plength = $(".keyResult li p").length;
|
121
|
|
if(plength < 5) {
|
122
|
|
$("#KeyWord").removeClass("displayNone");
|
|
265
|
var liNum = $("#keyWordlist").find("li").length;
|
|
266
|
if(liNum < 5) {
|
|
267
|
$("#keyWordlist").parents(".keyResult").siblings("div.col-w-12").show();
|
123
|
268
|
}
|
124
|
|
$(".keydrop ul").html("");
|
125
|
|
$(".keydrop").addClass("displayNone");
|
126
|
269
|
})
|
127
|
270
|
|
128
|
|
//组合关键字
|
129
|
|
function captiureSubInd(subIndu) {
|
130
|
|
var industrys = $("#" + subIndu + "");
|
131
|
|
var industryAll = "";
|
132
|
|
if(industrys.size() > 0) {
|
133
|
|
for(var i = 0; i < industrys.size(); i++) {
|
134
|
|
industryAll += industrys[i].innerText;
|
135
|
|
industryAll += ',';
|
136
|
|
};
|
137
|
|
industryAll = industryAll.substring(0, industryAll.length - 1);
|
138
|
|
}
|
139
|
|
return industryAll;
|
140
|
|
}
|
141
|
|
|
142
|
|
function keyWordlen(keyWord) {
|
143
|
|
$("#KeyWord").val("");
|
144
|
|
var plength = $(".keyResult li p");
|
145
|
|
for(var i = 0; i < plength.length; i++) {
|
146
|
|
if(plength[i].innerText == keyWord) {
|
147
|
|
$("#keyPrompt").text("关键词已存在");
|
148
|
|
return;
|
149
|
|
}
|
150
|
|
}
|
151
|
|
if(plength.length > 3) {
|
152
|
|
$("#KeyWord").addClass("displayNone");
|
153
|
|
$("#keyWordlist").append("<li class='delkeylist'><p class='h2Font'>" + keyWord + "</p><div class='closeThis'></div></li>");
|
154
|
|
} else {
|
155
|
|
$("#keyWordlist").append("<li class='delkeylist'><p class='h2Font'>" + keyWord + "</p><div class='closeThis'></div></li>");
|
156
|
|
}
|
157
|
|
}
|
158
|
|
|
159
|
|
function KeyWordList(seValue) {
|
160
|
|
hburEnd=seValue;
|
161
|
|
$.ajax({
|
162
|
|
"url": "/ajax/article/qaHotKey",
|
163
|
|
"type": "get",
|
164
|
|
"data": {
|
165
|
|
"key": $("#KeyWord").val()
|
166
|
|
},
|
167
|
|
"success": function(data) {
|
168
|
|
console.log(data);
|
169
|
|
if(data.success) {
|
170
|
|
if(hburEnd == seValue){
|
171
|
|
var itemlist = '';
|
172
|
|
$("#keydropList").html("");
|
173
|
|
for(var i = 0; i < Math.min(data.data.length,5); i++) {
|
174
|
|
var itemlist = '<li><p class="h2Font"></p></li>';
|
175
|
|
$itemlist = $(itemlist);
|
176
|
|
$("#keydropList").append($itemlist);
|
177
|
|
$itemlist.find(".h2Font").text(data.data[i].caption);
|
178
|
|
}
|
179
|
|
$(".keydrop").removeClass("displayNone");
|
180
|
|
}
|
181
|
|
} else {
|
182
|
|
//$(".keydrop").addClass("displayNone");
|
183
|
|
//$(".keydrop ul").html("");
|
184
|
|
}
|
185
|
|
},
|
186
|
|
"error": function() {
|
187
|
|
$.MsgBox.Alert('提示', '链接服务器超时')
|
188
|
|
}
|
189
|
|
});
|
190
|
|
}
|
191
|
|
|
192
|
271
|
//拆解关键字
|
193
|
272
|
function industryShow(data,industryList){
|
194
|
273
|
if(data != undefined && data.length != 0 ){
|
|
@ -205,7 +284,7 @@ $(function() {
|
205
|
284
|
};
|
206
|
285
|
}
|
207
|
286
|
if(subs.length>4){
|
208
|
|
$("#KeyWord").addClass("displayNone");
|
|
287
|
$("#KeyWord").parent().addClass("displayNone");
|
209
|
288
|
}
|
210
|
289
|
}
|
211
|
290
|
}
|
|
@ -685,6 +764,15 @@ $(function() {
|
685
|
764
|
}
|
686
|
765
|
/*获取数据*/
|
687
|
766
|
function getdata(publishTime) {
|
|
767
|
var industrys = $("#keyWordlist li");
|
|
768
|
var industryAll = "";
|
|
769
|
if(industrys.size() > 0) {
|
|
770
|
for(var i = 0; i < industrys.size(); i++) {
|
|
771
|
industryAll += industrys[i].innerText.trim();
|
|
772
|
industryAll += ',';
|
|
773
|
};
|
|
774
|
industryAll = industryAll.substring(0, industryAll.length - 1);
|
|
775
|
}
|
688
|
776
|
expertli(); //相关专家
|
689
|
777
|
resourcesli(); //相关咨询
|
690
|
778
|
// $data.orgId = orgId;
|
|
@ -693,7 +781,7 @@ $(function() {
|
693
|
781
|
$data.orgs = getAttrId.call($("#companys li"));
|
694
|
782
|
}
|
695
|
783
|
$data.articleTitle = $("#newstitle").val();
|
696
|
|
$data.subject = captiureSubInd("keyWordlist .delkeylist");
|
|
784
|
$data.subject = industryAll;
|
697
|
785
|
$data.articleImg = $("#uploader").attr("data-id");
|
698
|
786
|
$data.articleContent = ue.getContent();
|
699
|
787
|
// $data.professors = experarray;
|