|
@ -0,0 +1,1335 @@
|
|
1
|
//var wlogurl="http://192.168.3.233:8080"
|
|
2
|
var wlogurl="http://www.ekexiu.com:8082";
|
|
3
|
|
|
4
|
$(document).ready(function() {
|
|
5
|
$(".unlogin").show();
|
|
6
|
$(".onlogin").hide();
|
|
7
|
|
|
8
|
var footerHeight = $("footer").outerHeight(true);
|
|
9
|
$('#container').css("padding-bottom", footerHeight + "px");
|
|
10
|
$(".footer_tools").css("bottom", (footerHeight+10) + "px");
|
|
11
|
$(window).resize(function() {//窗口大小变更事件
|
|
12
|
footerHeight = $("footer").outerHeight(true);
|
|
13
|
$('#container').css("padding-bottom", footerHeight + "px");
|
|
14
|
});
|
|
15
|
//底部企业入驻
|
|
16
|
var orgid = $.cookie('orgId');
|
|
17
|
$("#cmpSet2").on("click", function() {
|
|
18
|
if(orgid && orgid != "null" && orgid != null) {
|
|
19
|
location.href = "cmp-portal/cmp-workspaces.html"
|
|
20
|
} else {
|
|
21
|
location.href = "cmp-portal/cmp-settled-reg.html"
|
|
22
|
}
|
|
23
|
})
|
|
24
|
$("#cmpSet3").on("click", function() {
|
|
25
|
if(orgid && orgid != "null" && orgid != null) {
|
|
26
|
location.href = "/cmp-portal/cmp-workspaces.html"
|
|
27
|
} else {
|
|
28
|
location.href = "/cmp-portal/cmp-settled-reg.html"
|
|
29
|
}
|
|
30
|
})
|
|
31
|
|
|
32
|
//搜索框跳转页面
|
|
33
|
$("#search").on("click", function() {
|
|
34
|
var searchContent = $("#searchContent").val();
|
|
35
|
setTimeout(function(){location.href = "searchNew.html?searchContent=" + encodeURI(searchContent)},300);
|
|
36
|
|
|
37
|
});
|
|
38
|
$("#search").on("click", function() {
|
|
39
|
var searchContent = $("#searchContent").val().replace(/^\s*|\s*$/,"");
|
|
40
|
if(searchContent) {
|
|
41
|
wlog("kw", searchContent)
|
|
42
|
}
|
|
43
|
});
|
|
44
|
//enter绑定时间
|
|
45
|
$("#searchContent").keydown(function(e) {
|
|
46
|
if(e.which == 13) {
|
|
47
|
var searchContent = $("#searchContent").val();
|
|
48
|
console.log(searchContent);
|
|
49
|
location.href = "searchNew.html?searchContent=" + encodeURI(searchContent);
|
|
50
|
}
|
|
51
|
|
|
52
|
})
|
|
53
|
$("#hsearchContent").keydown(function(e) {
|
|
54
|
if(e.which == 13) {
|
|
55
|
var searchContent = $("#hsearchContent").val();
|
|
56
|
if($(this).siblings()[0].id=="searchh") {
|
|
57
|
location.href = "/searchNew.html?searchContent=" + encodeURI(searchContent);
|
|
58
|
return;
|
|
59
|
}
|
|
60
|
location.href = "searchNew.html?searchContent=" + encodeURI(searchContent);
|
|
61
|
}
|
|
62
|
})
|
|
63
|
|
|
64
|
$("#hsearch").on("click", function() {
|
|
65
|
var searchContent = $("#hsearchContent").val();
|
|
66
|
setTimeout(function(){
|
|
67
|
location.href = "searchNew.html?searchContent=" + encodeURI(searchContent);
|
|
68
|
},300)
|
|
69
|
|
|
70
|
});
|
|
71
|
$("#searchh").on("click", function() {
|
|
72
|
var searchContent = $("#hsearchContent").val();
|
|
73
|
setTimeout(function(){
|
|
74
|
location.href = "/searchNew.html?searchContent=" + encodeURI(searchContent);
|
|
75
|
},300)
|
|
76
|
|
|
77
|
});
|
|
78
|
$("#hsearch").on("click", function() {
|
|
79
|
var searchContent = $("#hsearchContent").val().replace(/^\s*|\s*$/,"");
|
|
80
|
if(searchContent) {
|
|
81
|
wlog("kw", searchContent)
|
|
82
|
}
|
|
83
|
});
|
|
84
|
/*向下滚动时,header背景变半透明*/
|
|
85
|
$(document).scroll(function() {
|
|
86
|
var top = $(document).scrollTop();
|
|
87
|
|
|
88
|
if(top == 0) {
|
|
89
|
$(".navheader").removeClass("navhdown");
|
|
90
|
} else {
|
|
91
|
$(".navheader").addClass("navhdown");
|
|
92
|
}
|
|
93
|
|
|
94
|
if(top >= 300) {
|
|
95
|
$(".content-left").css({
|
|
96
|
"position": "fixed",
|
|
97
|
"top": "80px"
|
|
98
|
})
|
|
99
|
} else {
|
|
100
|
$(".content-left").css({
|
|
101
|
"position": "static"
|
|
102
|
})
|
|
103
|
}
|
|
104
|
|
|
105
|
});
|
|
106
|
/*选择省份*/
|
|
107
|
$(document).on("click", "#Province li a", function() {
|
|
108
|
var aVal = $(this).text();
|
|
109
|
$(this).parent().parent().parent().find('.mr_show').text(aVal);
|
|
110
|
$(this).parent().parent().parent().find('input[name=cho_Province]').val(aVal);
|
|
111
|
|
|
112
|
if($("#oprovince").text() == "请选择省/直辖市") {
|
|
113
|
$("#oprovince").removeClass("mr_select");
|
|
114
|
$("#ocity").removeClass("mr_select");
|
|
115
|
} else {
|
|
116
|
$("#oprovince").addClass("mr_select");
|
|
117
|
$("#ocity").removeClass("mr_select");
|
|
118
|
}
|
|
119
|
});
|
|
120
|
/*选择城市填充js */
|
|
121
|
$(document).on("click", "#City li a", function() {
|
|
122
|
var aVal = $(this).text();
|
|
123
|
$(this).parent().parent().parent().find('.mr_show').text(aVal);
|
|
124
|
$(this).parent().parent().parent().find('input[name=cho_City]').val(aVal);
|
|
125
|
if($("#ocity").text() == "请选择城市") {
|
|
126
|
$("#ocity").removeClass("mr_select");
|
|
127
|
} else {
|
|
128
|
$("#ocity").addClass("mr_select");
|
|
129
|
}
|
|
130
|
});
|
|
131
|
/*多行文本框样式(带有限制数字)模拟focus效果*/
|
|
132
|
$(".msgContbox textarea").focus(function() {
|
|
133
|
$(this).parent().css("border-color", "#ff9900");
|
|
134
|
}).blur(function() {
|
|
135
|
$(this).parent().css("border-color", "#E5E5E5");
|
|
136
|
})
|
|
137
|
});
|
|
138
|
|
|
139
|
|
|
140
|
var userid;
|
|
141
|
|
|
142
|
function exit() {
|
|
143
|
$.cookie('userid', null);
|
|
144
|
$.cookie('userAuth', null);
|
|
145
|
$.cookie('userEmail', null);
|
|
146
|
$.cookie('userMobilePhone', null);
|
|
147
|
$.cookie('userName', null);
|
|
148
|
$.cookie('userType', null);
|
|
149
|
location.href = "index.html"
|
|
150
|
}
|
|
151
|
function exitStaticize() {
|
|
152
|
$.cookie('userid', null,{ path: '/' });
|
|
153
|
$.cookie('userAuth', null,{ path: '/' });
|
|
154
|
$.cookie('userEmail', null,{ path: '/' });
|
|
155
|
$.cookie('userMobilePhone', null,{ path: '/' });
|
|
156
|
$.cookie('userName', null,{ path: '/' });
|
|
157
|
$.cookie('userType', null,{ path: '/' });
|
|
158
|
location.href = "/index.html"
|
|
159
|
}
|
|
160
|
function valUser() {
|
|
161
|
var userid = $.cookie('userid');
|
|
162
|
var userAuth = $.cookie('userAuth');
|
|
163
|
if(userid == undefined || userid.length == 0 || userid == "null" || userAuth == false) {
|
|
164
|
location.href = "login.html";
|
|
165
|
}
|
|
166
|
}
|
|
167
|
function pageUrl(type,datalist) {
|
|
168
|
return ("shtml/"+type+"/"+datalist.createTime.substring(0,8)+"/"+datalist.shareId+".html");
|
|
169
|
}
|
|
170
|
function GetQueryString(name) {
|
|
171
|
var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)", "i");
|
|
172
|
var r = window.location.search.substr(1).match(reg);
|
|
173
|
|
|
174
|
var context = "";
|
|
175
|
if(r != null)
|
|
176
|
context = r[2];
|
|
177
|
reg = null;
|
|
178
|
r = null;
|
|
179
|
return context == null || context == "" || context == "undefined" ? "" : decodeURI(context);
|
|
180
|
}
|
|
181
|
|
|
182
|
function loginStatus() {
|
|
183
|
userid = $.cookie('userid');
|
|
184
|
userAuth = $.cookie('userAuth');
|
|
185
|
authentication = $.cookie('authentication');
|
|
186
|
if(userid && userid != "null" && userid != null) {
|
|
187
|
if(userAuth == "false" && authentication == "null") {
|
|
188
|
location.href = "loginInviteFirst.html";
|
|
189
|
}
|
|
190
|
if(userAuth == "true" && authentication == "null") {
|
|
191
|
location.href = "fillinfo-select.html";
|
|
192
|
}
|
|
193
|
if(userAuth == "true" && authentication != "null") {
|
|
194
|
$(".onlogin").show();
|
|
195
|
$(".unlogin").hide();
|
|
196
|
$(".portrait-p").attr("src", "/images/head/" + userid + "_m.jpg");
|
|
197
|
$(".portrait-p").load(function() { //判断图片是否加载,加载不成功默认有默认的图像
|
|
198
|
})
|
|
199
|
.error(function() {
|
|
200
|
$(".portrait-p").attr("src", "/images/default-photo.jpg");
|
|
201
|
});
|
|
202
|
unReadedCount(userid);
|
|
203
|
unInformCount(userid)
|
|
204
|
}
|
|
205
|
$(".portrait-p").on("click",function(){
|
|
206
|
location.href="userInforShow.html?professorId="+userid;
|
|
207
|
})
|
|
208
|
$(".onlogin").on("click",".goMyInf",function(){
|
|
209
|
$(this).attr("href","userInforShow.html?professorId="+userid)
|
|
210
|
})
|
|
211
|
} else {
|
|
212
|
$(".unlogin").show();
|
|
213
|
$(".onlogin").hide();
|
|
214
|
}
|
|
215
|
}
|
|
216
|
function loginYesOrNo() {
|
|
217
|
userid = $.cookie('userid');
|
|
218
|
userAuth = $.cookie('userAuth');
|
|
219
|
authentication = $.cookie('authentication');
|
|
220
|
if(userid && userid != "null" && userid != null) {
|
|
221
|
if(userAuth == "false" && authentication == "null") {
|
|
222
|
location.href = "/loginInviteFirst.html";
|
|
223
|
}
|
|
224
|
if(userAuth == "true" && authentication == "null") {
|
|
225
|
location.href = "/fillinfo-select.html";
|
|
226
|
}
|
|
227
|
if(userAuth == "true" && authentication != "null") {
|
|
228
|
$(".onlogin").show();
|
|
229
|
$(".unlogin").hide();
|
|
230
|
$(".portrait-p").attr("src", "/images/head/" + userid + "_m.jpg");
|
|
231
|
$(".portrait-p").load(function() { //判断图片是否加载,加载不成功默认有默认的图像
|
|
232
|
})
|
|
233
|
.error(function() {
|
|
234
|
$(".portrait-p").attr("src", "/images/default-photo.jpg");
|
|
235
|
});
|
|
236
|
unReadedCount(userid);
|
|
237
|
}
|
|
238
|
$(".portrait-p").on("click",function(){
|
|
239
|
location.href="/userInforShow.html?professorId="+userid;
|
|
240
|
})
|
|
241
|
$(".onlogin").on("click",".goMyInf",function(){
|
|
242
|
$(this).attr("href","/userInforShow.html?professorId="+userid)
|
|
243
|
})
|
|
244
|
} else {
|
|
245
|
$(".unlogin").show();
|
|
246
|
$(".onlogin").hide();
|
|
247
|
}
|
|
248
|
}
|
|
249
|
function unReadedCount(id){//查询指定用户的未读消息数量
|
|
250
|
$.ajax({
|
|
251
|
type:"get",
|
|
252
|
url:"/ajax/webMsg/unReadedCount",
|
|
253
|
async:true,
|
|
254
|
data:{"id":id},
|
|
255
|
success:function(data){
|
|
256
|
console.log(data)
|
|
257
|
if(data.success){
|
|
258
|
if(data.data!=0){
|
|
259
|
$(".mymessage").find(".badge").text(data.data);
|
|
260
|
}else{
|
|
261
|
$(".mymessage").find(".badge").text("");
|
|
262
|
}
|
|
263
|
}
|
|
264
|
|
|
265
|
}
|
|
266
|
});
|
|
267
|
}
|
|
268
|
function unInformCount(id){//查询指定用户的未读通知数量
|
|
269
|
$.ajax({
|
|
270
|
type:"get",
|
|
271
|
url:"/ajax/notify/idx",
|
|
272
|
async:true,
|
|
273
|
data:{"id":id},
|
|
274
|
success:function(data){
|
|
275
|
console.log(data)
|
|
276
|
if(data.success){
|
|
277
|
if(data.data.unRead!=0){
|
|
278
|
$(".myinform").find(".badge").text(data.data.unRead);
|
|
279
|
}else{
|
|
280
|
$(".myinform").find(".badge").text("");
|
|
281
|
}
|
|
282
|
}
|
|
283
|
|
|
284
|
}
|
|
285
|
});
|
|
286
|
}
|
|
287
|
//转换格式
|
|
288
|
function changeTime(dealtime) {
|
|
289
|
var s = dealtime;
|
|
290
|
//console.log(s);
|
|
291
|
if(dealtime.length == 8) {
|
|
292
|
var y = s.substr(0, 4);
|
|
293
|
var m = s.substr(4, 2);
|
|
294
|
var d = s.substr(6, 2);
|
|
295
|
var formatTime = y + "-" + m + "-" + d;
|
|
296
|
return formatTime;
|
|
297
|
} else {
|
|
298
|
var y = s.substr(0, 4);
|
|
299
|
var m = s.substr(4, 2);
|
|
300
|
var d = s.substr(6, 2);
|
|
301
|
var h = s.substr(8, 2);
|
|
302
|
var minute = s.substr(10, 2);
|
|
303
|
var formatTime = y + "-" + m + "-" + d + " " + h + ":" + minute;
|
|
304
|
return formatTime;
|
|
305
|
}
|
|
306
|
|
|
307
|
}
|
|
308
|
//******过滤特殊字符*******//
|
|
309
|
function replaceStr(s) {
|
|
310
|
var pattern = new RegExp("-");
|
|
311
|
var rs = "";
|
|
312
|
for(var i = 0; i < s.length; i++) {
|
|
313
|
rs = rs + s.substr(i, 1).replace(pattern, '');
|
|
314
|
}
|
|
315
|
return rs;
|
|
316
|
}
|
|
317
|
//**********************//
|
|
318
|
|
|
319
|
//根据用户输入的Email跳转到相应的电子邮箱首页
|
|
320
|
var hash = {
|
|
321
|
'qq.com': 'http://mail.qq.com',
|
|
322
|
'gmail.com': 'http://mail.google.com',
|
|
323
|
'sina.com': 'http://mail.sina.com.cn',
|
|
324
|
'163.com': 'http://mail.163.com',
|
|
325
|
'126.com': 'http://mail.126.com',
|
|
326
|
'yeah.net': 'http://www.yeah.net/',
|
|
327
|
'sohu.com': 'http://mail.sohu.com/',
|
|
328
|
'tom.com': 'http://mail.tom.com/',
|
|
329
|
'sogou.com': 'http://mail.sogou.com/',
|
|
330
|
'139.com': 'http://mail.10086.cn/',
|
|
331
|
'hotmail.com': 'http://www.hotmail.com',
|
|
332
|
'live.com': 'http://login.live.com/',
|
|
333
|
'live.cn': 'http://login.live.cn/',
|
|
334
|
'live.com.cn': 'http://login.live.com.cn',
|
|
335
|
'189.com': 'http://webmail16.189.cn/webmail/',
|
|
336
|
'yahoo.com.cn': 'http://mail.cn.yahoo.com/',
|
|
337
|
'yahoo.cn': 'http://mail.cn.yahoo.com/',
|
|
338
|
'eyou.com': 'http://www.eyou.com/',
|
|
339
|
'21cn.com': 'http://mail.21cn.com/',
|
|
340
|
'188.com': 'http://www.188.com/',
|
|
341
|
'ustb.edu.cn': 'http://mail.ustb.edu.cn/',
|
|
342
|
'foxmail.coom': 'http://www.foxmail.com'
|
|
343
|
};
|
|
344
|
//轮播滚动函数
|
|
345
|
function Carousel(inde, num, show, childcount, obj, next, prev) {
|
|
346
|
var tapnum = 0; //按钮可点击次数
|
|
347
|
if(childcount > num) {
|
|
348
|
next.css("display", "block");
|
|
349
|
prev.css("display", "none");
|
|
350
|
} else {
|
|
351
|
next.css("display", "none");
|
|
352
|
prev.css("display", "none");
|
|
353
|
}
|
|
354
|
next.click(function() {
|
|
355
|
if(!obj.is(":animated")) {
|
|
356
|
if(num < childcount) {
|
|
357
|
tapnum++;
|
|
358
|
prev.css("display", "block");
|
|
359
|
if(tapnum == childcount - show) {
|
|
360
|
next.css("display", "none");
|
|
361
|
|
|
362
|
}
|
|
363
|
num++;
|
|
364
|
obj.animate({
|
|
365
|
left: "-=212px"
|
|
366
|
}, 600);
|
|
367
|
}
|
|
368
|
}
|
|
369
|
});
|
|
370
|
prev.click(function() {
|
|
371
|
|
|
372
|
if(!obj.is(":animated")) {
|
|
373
|
if(num > inde) {
|
|
374
|
tapnum--;
|
|
375
|
next.css("display", "block");
|
|
376
|
if(tapnum == 0) {
|
|
377
|
prev.css("display", "none");
|
|
378
|
}
|
|
379
|
num--;
|
|
380
|
obj.animate({
|
|
381
|
left: "+=212px"
|
|
382
|
}, 600);
|
|
383
|
}
|
|
384
|
}
|
|
385
|
});
|
|
386
|
}
|
|
387
|
|
|
388
|
//评价字数限制
|
|
389
|
//字数限制函数
|
|
390
|
function limitTextCountFn(TextAreaId, countContainerId, count) {
|
|
391
|
var curLength = $(TextAreaId).val().length;
|
|
392
|
if(curLength > count) {
|
|
393
|
var num = $(TextAreaId).val().substr(0, count);
|
|
394
|
$(TextAreaId).val(num);
|
|
395
|
|
|
396
|
} else {
|
|
397
|
$(countContainerId).text(count - $(TextAreaId).val().length);
|
|
398
|
}
|
|
399
|
};
|
|
400
|
|
|
401
|
//咨询申请主题字数限制函数
|
|
402
|
function titleLimitFontCountFn() {
|
|
403
|
var curLength = $("#consultTitle").val().length;
|
|
404
|
|
|
405
|
if(curLength > 20) {
|
|
406
|
var num = $("#consultTitle").val().substr(0, 20);
|
|
407
|
$("#consultTitle").val(num);
|
|
408
|
}
|
|
409
|
|
|
410
|
};
|
|
411
|
|
|
412
|
|
|
413
|
/*下拉select选择js */
|
|
414
|
function seleCo(obj){
|
|
415
|
var sleTd=$(obj).val();
|
|
416
|
if(sleTd==0){
|
|
417
|
$(obj).css("color","#999");
|
|
418
|
}else{
|
|
419
|
$(obj).css("color","#666");
|
|
420
|
}
|
|
421
|
}
|
|
422
|
|
|
423
|
|
|
424
|
//咨询 专家信息接口函数
|
|
425
|
function concultProInfo(professorId) {
|
|
426
|
$.ajax({
|
|
427
|
url: "/ajax/professor/editBaseInfo/" + professorId,
|
|
428
|
type: "get",
|
|
429
|
data: {
|
|
430
|
"id": professorId
|
|
431
|
},
|
|
432
|
contentType: "application/x-www-form-urlencoded",
|
|
433
|
success: function(response) {
|
|
434
|
//console.log(response);
|
|
435
|
var myData = response["data"];
|
|
436
|
|
|
437
|
$("#professorName").html(myData["name"]);
|
|
438
|
if(myData["title"]) {
|
|
439
|
$("#professorTitle").html(myData["title"] + ' ');
|
|
440
|
}
|
|
441
|
if(myData["department"]) {
|
|
442
|
$("#profDepartment").html(myData["department"] + ' ');
|
|
443
|
}
|
|
444
|
if(myData["orgName"]) {
|
|
445
|
$("#profOrganization").html(myData["orgName"] + ' ');
|
|
446
|
}
|
|
447
|
if(myData["address"]) {
|
|
448
|
$("#profAdress").html(myData["address"]);
|
|
449
|
}
|
|
450
|
console.log(myData["consultCount"])
|
|
451
|
if(!myData["consultCount"]) {
|
|
452
|
$("#starLevel").hide();
|
|
453
|
}
|
|
454
|
$("#byConsultConut").html(myData["consultCount"]);
|
|
455
|
$("#sendConsultBtn").attr("proId", myData["id"]);
|
|
456
|
|
|
457
|
//星级
|
|
458
|
var startConut = parseInt(myData["starLevel"]);
|
|
459
|
if(myData["consultCount"]) {
|
|
460
|
if(!startConut) {
|
|
461
|
$(".evastarbox2").hide();
|
|
462
|
}
|
|
463
|
}
|
|
464
|
for(var i = 0; i < startConut; i++) {
|
|
465
|
$("#starLevel .evastar2").eq(i).addClass("addStar");
|
|
466
|
}
|
|
467
|
|
|
468
|
//认证
|
|
469
|
var oSty = autho(myData.authType, myData.orgAuth, myData.authStatus);
|
|
470
|
$("#proModifyN").addClass(oSty.sty);
|
|
471
|
$("#proModifyN").attr("title", oSty.title);
|
|
472
|
|
|
473
|
//头像
|
|
474
|
if(myData["hasHeadImage"] == 0) {
|
|
475
|
$("#prohead").attr("src", "images/default-photo.jpg");
|
|
476
|
} else {
|
|
477
|
$("#prohead").attr("src", "images/head/" + myData["id"] + "_l.jpg");
|
|
478
|
}
|
|
479
|
|
|
480
|
},
|
|
481
|
error: function(error) {
|
|
482
|
$.MsgBox.Alert("message", "请求数据失败");
|
|
483
|
}
|
|
484
|
});
|
|
485
|
};
|
|
486
|
|
|
487
|
//发送咨询
|
|
488
|
function sendConsultHandler(professorId) {
|
|
489
|
|
|
490
|
var professorId = professorId;
|
|
491
|
var consult_type = $(".clicknow").text(); //咨询类型
|
|
492
|
var consult_title = $("#consultTitle").val(); //咨询主题
|
|
493
|
var consult_content = $("#consultcontent").val(); //咨询内容
|
|
494
|
var consultStr = {
|
|
495
|
"consultType": consult_type,
|
|
496
|
"consultTitle": consult_title,
|
|
497
|
"consultContant": consult_content,
|
|
498
|
"professorId": professorId,
|
|
499
|
"consultantId": userid
|
|
500
|
};
|
|
501
|
|
|
502
|
if(consult_type == '' || consult_title == '' || consult_content == '') {
|
|
503
|
$.MsgBox.Alert("消息提醒", "请填写完整");
|
|
504
|
};
|
|
505
|
if(consult_type == '') {
|
|
506
|
$.MsgBox.Alert("消息提醒", "请选择联系目的");
|
|
507
|
}
|
|
508
|
if(consult_title == '') {
|
|
509
|
$.MsgBox.Alert("消息提醒", "请填写咨询目的");
|
|
510
|
}
|
|
511
|
if(consult_content == '') {
|
|
512
|
$.MsgBox.Alert("消息提醒", "请填写咨询内容");
|
|
513
|
}
|
|
514
|
|
|
515
|
if(userid && userid != null && userid != "null" && consult_type != '' &&
|
|
516
|
consult_title != '' && consult_content != ''
|
|
517
|
) {
|
|
518
|
|
|
519
|
$.ajax({
|
|
520
|
"url": "/ajax/consult",
|
|
521
|
"type": "post",
|
|
522
|
//传值:咨询类型、主题、内容、专家id、申请人id
|
|
523
|
"data": consultStr,
|
|
524
|
"contentType": "application/x-www-form-urlencoded",
|
|
525
|
"dataType": "json",
|
|
526
|
"success": function(response) {
|
|
527
|
console.log(response);
|
|
528
|
},
|
|
529
|
"error": function() {
|
|
530
|
$.MsgBox.Alert("消息提醒", "咨询申请失败");
|
|
531
|
},
|
|
532
|
|
|
533
|
"complete": function() {
|
|
534
|
//$(".consultapply").remove();
|
|
535
|
$(".blackcover").remove();
|
|
536
|
$("body").css("position", "");
|
|
537
|
$.MsgBox.Alert("消息提醒", "咨询申请成功");
|
|
538
|
$("#mb_msgicon").css("background", 'url("images/sign_icon_chenggong_nor.png") 0% 0% / contain');
|
|
539
|
},
|
|
540
|
});
|
|
541
|
}
|
|
542
|
|
|
543
|
};
|
|
544
|
|
|
545
|
/*标志*/
|
|
546
|
function autho() {
|
|
547
|
if(arguments[0] == 1) {
|
|
548
|
return {
|
|
549
|
"sty": "authicon-pro",
|
|
550
|
"title": "科袖认证专家"
|
|
551
|
}
|
|
552
|
} else {
|
|
553
|
if(arguments[1] == 1) {
|
|
554
|
return {
|
|
555
|
"sty": "authicon-staff-ok",
|
|
556
|
"title": "企业认证员工"
|
|
557
|
}
|
|
558
|
} else {
|
|
559
|
if(arguments[2] == 3) {
|
|
560
|
return {
|
|
561
|
"sty": "authicon-real",
|
|
562
|
"title": "实名认证用户"
|
|
563
|
}
|
|
564
|
} else {
|
|
565
|
return {
|
|
566
|
"sty": "e",
|
|
567
|
"title": " "
|
|
568
|
}
|
|
569
|
}
|
|
570
|
}
|
|
571
|
}
|
|
572
|
}
|
|
573
|
|
|
574
|
|
|
575
|
//时间显示规则
|
|
576
|
function commenTime(startTime) {
|
|
577
|
var nowTimg = new Date();
|
|
578
|
var startdate = new Date();
|
|
579
|
startdate.setFullYear(parseInt(startTime.substring(0, 4)));
|
|
580
|
startdate.setMonth(parseInt(startTime.substring(4, 6)) - 1);
|
|
581
|
startdate.setDate(parseInt(startTime.substring(6, 8)));
|
|
582
|
startdate.setHours(parseInt(startTime.substring(8, 10)));
|
|
583
|
startdate.setMinutes(parseInt(startTime.substring(10, 12)));
|
|
584
|
startdate.setSeconds(parseInt(startTime.substring(12, 14)));
|
|
585
|
var date3 = nowTimg.getTime() - startdate.getTime(); //时间差的毫秒数
|
|
586
|
var hours = parseInt((date3 % (1000 * 60 * 60 * 24)) / (1000 * 60 * 60));
|
|
587
|
var minutes = parseInt((date3 % (1000 * 60 * 60)) / (1000 * 60));
|
|
588
|
if(date3 < 60000) {
|
|
589
|
return "刚刚";
|
|
590
|
} else if(date3 >= 60000 && date3 < 3600000) {
|
|
591
|
return minutes + "分钟前";
|
|
592
|
} else if(date3 >= 3600000 && date3 < 86400000) {
|
|
593
|
return hours + "小时前";
|
|
594
|
} else if(date3 >= 86400000) {
|
|
595
|
|
|
596
|
if(nowTimg.getFullYear() == startTime.substring(0, 4)) {
|
|
597
|
|
|
598
|
return startTime.substring(4, 6).replace(/\b(0+)/gi, "") + "月" + startTime.substring(6, 8).replace(/\b(0+)/gi, "") + "日 " + startTime.substring(8, 10) + ":" + startTime.substring(10, 12);
|
|
599
|
} else {
|
|
600
|
|
|
601
|
return startTime.substring(0, 4) + "年" + startTime.substring(4, 6).replace(/\b(0+)/gi, "") + "月" + startTime.substring(6, 8).replace(/\b(0+)/gi, "") + "日 " + startTime.substring(8, 10) + ":" + startTime.substring(10, 12);
|
|
602
|
}
|
|
603
|
}
|
|
604
|
}
|
|
605
|
/*时间转换*/
|
|
606
|
function TimeTr(dealtime) {
|
|
607
|
var myDate = new Date();
|
|
608
|
var s = dealtime;
|
|
609
|
var y = s.substr(0, 4);
|
|
610
|
var m = s.substr(4, 2);
|
|
611
|
var d = s.substr(6, 2);
|
|
612
|
var h = s.substr(8, 2);
|
|
613
|
var minute = s.substr(10, 2);
|
|
614
|
var formatTime;
|
|
615
|
if(s.length <= 6) {
|
|
616
|
formatTime = y + "年" + m.replace(/\b(0+)/gi, "") + "月";
|
|
617
|
} else if(s.length > 6 && s.length <= 8) {
|
|
618
|
formatTime = m.replace(/\b(0+)/gi, "") + "月" + d.replace(/\b(0+)/gi, "") + "日 ";
|
|
619
|
if(y != myDate.getFullYear()) {
|
|
620
|
formatTime = y + "年" + m.replace(/\b(0+)/gi, "") + "月" + d.replace(/\b(0+)/gi, "") + "日 ";
|
|
621
|
}
|
|
622
|
} else {
|
|
623
|
formatTime = m.replace(/\b(0+)/gi, "") + "月" + d.replace(/\b(0+)/gi, "") + "日 " + h + ":" + minute;
|
|
624
|
if(y != myDate.getFullYear()) {
|
|
625
|
formatTime = y + "年" + m.replace(/\b(0+)/gi, "") + "月" + d.replace(/\b(0+)/gi, "") + "日 " + h + ":" + minute;
|
|
626
|
}
|
|
627
|
}
|
|
628
|
return formatTime;
|
|
629
|
}
|
|
630
|
|
|
631
|
|
|
632
|
/*判断是否收藏资源文章或者是否关注专家*/
|
|
633
|
function ifcollectionAbout(watchObject, sel,num) {
|
|
634
|
var that=sel;
|
|
635
|
$.ajax('/ajax/watch/hasWatch', {
|
|
636
|
data: {
|
|
637
|
"professorId": userid,
|
|
638
|
"watchObject": watchObject
|
|
639
|
},
|
|
640
|
dataType: 'json', //数据格式类型
|
|
641
|
type: 'get', //http请求类型
|
|
642
|
timeout: 10000,
|
|
643
|
async: false,
|
|
644
|
success: function(data) {
|
|
645
|
if(data.success && data.data != null) {
|
|
646
|
if(num == "1" || num == "6") { //已关注专家
|
|
647
|
$(that).addClass("attenedSpan");
|
|
648
|
$(that).text("已关注");
|
|
649
|
} else { //已收藏资源或文章
|
|
650
|
$(that).removeClass("icon-collect");
|
|
651
|
$(that).addClass("icon-collected");
|
|
652
|
}
|
|
653
|
} else {
|
|
654
|
if(num == "1" || num == "6") { //关注专家
|
|
655
|
$(that).removeClass("attenedSpan");
|
|
656
|
$(that).text("关注");
|
|
657
|
} else { //收藏资源或文章
|
|
658
|
$(that).addClass("icon-collect");
|
|
659
|
$(that).removeClass("icon-collected");//
|
|
660
|
}
|
|
661
|
}
|
|
662
|
},
|
|
663
|
error: function(data) {
|
|
664
|
$.MsgBox.Alert('提示', "服务器链接超时");
|
|
665
|
}
|
|
666
|
});
|
|
667
|
}
|
|
668
|
/*收藏资源、文章或者关注专家*/
|
|
669
|
function collectionAbout(watchObject,sel, num) {
|
|
670
|
var that=sel;
|
|
671
|
$.ajax('/ajax/watch', {
|
|
672
|
data: {
|
|
673
|
"professorId": userid,
|
|
674
|
"watchObject": watchObject,
|
|
675
|
"watchType": num,
|
|
676
|
"uname":$.cookie("userName")
|
|
677
|
},
|
|
678
|
dataType: 'json', //数据格式类型
|
|
679
|
type: 'POST', //http请求类型
|
|
680
|
timeout: 10000,
|
|
681
|
async: false,
|
|
682
|
success: function(data) {
|
|
683
|
if(data.success) {
|
|
684
|
console.log(data)
|
|
685
|
if(num == "1" || num == "6") {
|
|
686
|
$(that).addClass("attenedSpan");
|
|
687
|
$(that).text("已关注");
|
|
688
|
} else {
|
|
689
|
$(that).removeClass("icon-collect");
|
|
690
|
$(that).addClass("icon-collected");
|
|
691
|
}
|
|
692
|
}
|
|
693
|
},
|
|
694
|
error: function(data) {
|
|
695
|
$.MsgBox.Alert('提示', "服务器链接超时");
|
|
696
|
}
|
|
697
|
});
|
|
698
|
}
|
|
699
|
/*取消收藏资源、文章或者取消关注专家*/
|
|
700
|
function cancelCollectionAbout(watchObject,sel,num) {
|
|
701
|
var that=sel;
|
|
702
|
$.ajax({
|
|
703
|
url: '/ajax/watch/delete',
|
|
704
|
data: {
|
|
705
|
professorId: userid,
|
|
706
|
watchObject: watchObject
|
|
707
|
},
|
|
708
|
dataType: 'json', //数据格式类型
|
|
709
|
type: 'post', //http请求类型
|
|
710
|
timeout: 10000,
|
|
711
|
async: true,
|
|
712
|
success: function(data) {
|
|
713
|
console.log(data.success)
|
|
714
|
if(num == "1" || num == "6") { //关注专家
|
|
715
|
$(that).removeClass("attenedSpan");
|
|
716
|
$(that).text("关注");
|
|
717
|
} else { //收藏资源或文章
|
|
718
|
$(that).addClass("icon-collect");
|
|
719
|
$(that).removeClass("icon-collected");
|
|
720
|
}
|
|
721
|
},
|
|
722
|
error: function(data) {
|
|
723
|
$.MsgBox.Alert('提示', "服务器链接超时");
|
|
724
|
}
|
|
725
|
});
|
|
726
|
}
|
|
727
|
|
|
728
|
function leaveMsgCount(id,type, $str) {//查看留言数
|
|
729
|
$.ajax({
|
|
730
|
"url":"/ajax/leavemsg/count",
|
|
731
|
"type": "GET",
|
|
732
|
"dataType": "json",
|
|
733
|
"data": {
|
|
734
|
sid:id,
|
|
735
|
stype: type
|
|
736
|
},
|
|
737
|
"success": function(data) {
|
|
738
|
if(data.success) {
|
|
739
|
if(data.data > 0) {
|
|
740
|
$str.find(".leaveMsgCount").html("留言 " + data.data);
|
|
741
|
$str.find(".leaveMsgCount2").html(data.data);
|
|
742
|
}
|
|
743
|
}
|
|
744
|
}
|
|
745
|
});
|
|
746
|
}
|
|
747
|
//企业规模
|
|
748
|
var orgSizeShow = {
|
|
749
|
'1': '50人以内',
|
|
750
|
'2': '50-100人',
|
|
751
|
'3': '100-200人',
|
|
752
|
'4': '200-500人',
|
|
753
|
'5': '500-1000人',
|
|
754
|
'6': '1000人以上'
|
|
755
|
}
|
|
756
|
//企业类型
|
|
757
|
var orgTypeShow = {
|
|
758
|
"2": "上市企业",
|
|
759
|
"3": "外资企业",
|
|
760
|
"4": "合资企业",
|
|
761
|
"5": "独资企业",
|
|
762
|
"6": "个体经营",
|
|
763
|
"7": "政府机构",
|
|
764
|
"8": "公益组织",
|
|
765
|
"9": "协会学会",
|
|
766
|
"10": "新闻媒体",
|
|
767
|
"11": "教育机构",
|
|
768
|
"undefined":""
|
|
769
|
}
|
|
770
|
//学位
|
|
771
|
var eduDegree = {
|
|
772
|
"1": "博士",
|
|
773
|
"2": "硕士",
|
|
774
|
"3": "学士",
|
|
775
|
"4": "大专",
|
|
776
|
"5": "其他"
|
|
777
|
}
|
|
778
|
//栏目
|
|
779
|
var columnType = {
|
|
780
|
"1":{
|
|
781
|
fullName:"个人原创",
|
|
782
|
shortName:"原创"
|
|
783
|
},
|
|
784
|
"2":{
|
|
785
|
fullName:"企业原创",
|
|
786
|
shortName:"原创"
|
|
787
|
},
|
|
788
|
"3":{
|
|
789
|
fullName:"科研",
|
|
790
|
shortName:"科研"
|
|
791
|
},
|
|
792
|
"4":{
|
|
793
|
fullName:"智库",
|
|
794
|
shortName:"智库"
|
|
795
|
},
|
|
796
|
"5":{
|
|
797
|
fullName:"检测",
|
|
798
|
shortName:"检测"
|
|
799
|
},
|
|
800
|
"6":{
|
|
801
|
fullName:"会议",
|
|
802
|
shortName:"会议"
|
|
803
|
},
|
|
804
|
"7":{
|
|
805
|
fullName:"企业",
|
|
806
|
shortName:"企业"
|
|
807
|
},
|
|
808
|
"8":{
|
|
809
|
fullName:"招聘",
|
|
810
|
shortName:"招聘"
|
|
811
|
},
|
|
812
|
"9":{
|
|
813
|
fullName:"新闻",
|
|
814
|
shortName:"新闻"
|
|
815
|
},
|
|
816
|
"10":{
|
|
817
|
fullName:"问答",
|
|
818
|
shortName:"问答"
|
|
819
|
}
|
|
820
|
}
|
|
821
|
//需求的费用预算
|
|
822
|
var demandCost = {
|
|
823
|
'1': '1万元以内',
|
|
824
|
'2': '1-5万元',
|
|
825
|
'3': '5-10万元',
|
|
826
|
'4': '10-20万元',
|
|
827
|
'5': '20-50万元',
|
|
828
|
'6': '50万元以上'
|
|
829
|
}
|
|
830
|
//需求的预期时长
|
|
831
|
var demandDuration = {
|
|
832
|
'1': '1个月内',
|
|
833
|
'2': '1-3个月',
|
|
834
|
'3': '3-6个月',
|
|
835
|
'4': '6-12个月',
|
|
836
|
'5': '1年以上'
|
|
837
|
}
|
|
838
|
//反馈意见成功
|
|
839
|
function backSuccessed(){
|
|
840
|
$(".correctCon").val("");
|
|
841
|
$(".correctSubmit").attr("disabled",true);
|
|
842
|
$(".correctSubmit").parents(".correctBlock").fadeOut();
|
|
843
|
$.MsgBox.Alert('提示', '感谢您的反馈,我们马上处理。');
|
|
844
|
$("#mb_msgicon").css("background", 'url("images/sign_icon_chenggong_nor.png") 0% 0% / contain');
|
|
845
|
}
|
|
846
|
function suImg() {
|
|
847
|
$("#mb_msgicon").css("background", 'url("/images/sign_icon_chenggong_nor.png") 0% 0% / contain');
|
|
848
|
$("#mb_ico").css("background",'url(/images/sign_icon_guanbi_nor.png) center center no-repeat');
|
|
849
|
}
|
|
850
|
function hotKey(sel, num) {
|
|
851
|
|
|
852
|
$(sel).bind({
|
|
853
|
paste: function(e) {
|
|
854
|
var pastedText;
|
|
855
|
if (window.clipboardData && window.clipboardData.getData) { // IE
|
|
856
|
pastedText = $(this).val() + window.clipboardData.getData('Text');
|
|
857
|
}
|
|
858
|
else {
|
|
859
|
pastedText = $(this).val() + e.originalEvent.clipboardData.getData('Text'); //e.clipboardData.getData('text/plain');
|
|
860
|
}
|
|
861
|
$(this).val(pastedText);
|
|
862
|
|
|
863
|
var $this = $(this);
|
|
864
|
setTimeout(function() {
|
|
865
|
if($this.val().trim()) {
|
|
866
|
$this.siblings("button").show();
|
|
867
|
} else {
|
|
868
|
$this.siblings("button").hide();
|
|
869
|
}
|
|
870
|
}, 1);
|
|
871
|
e.preventDefault();
|
|
872
|
},
|
|
873
|
cut: function(e) {
|
|
874
|
var $this = $(this);
|
|
875
|
setTimeout(function() {
|
|
876
|
if($this.val().trim()) {
|
|
877
|
$this.siblings("button").show();
|
|
878
|
} else {
|
|
879
|
$this.siblings("button").hide();
|
|
880
|
}
|
|
881
|
}, 1);
|
|
882
|
},
|
|
883
|
blur: function() {
|
|
884
|
var $this = $(this);
|
|
885
|
setTimeout(function() {
|
|
886
|
$this.siblings(".keydrop").hide();
|
|
887
|
}, 500)
|
|
888
|
},
|
|
889
|
focus: function() {
|
|
890
|
$(this).siblings(".keydrop").show();
|
|
891
|
},
|
|
892
|
keyup: function(e) {
|
|
893
|
var ti=$(this).val();
|
|
894
|
var $t=this;
|
|
895
|
$t.comr=ti;
|
|
896
|
var $this=$(this);
|
|
897
|
if($(this).val().trim()) {
|
|
898
|
$(this).siblings("button").show();
|
|
899
|
var lNum = $.trim($(this).val()).length;
|
|
900
|
if(0 < lNum) {
|
|
901
|
setTimeout(function(){
|
|
902
|
if( ti===$t.comr && ti!== $t.comrEnd) {
|
|
903
|
var tt=ti;
|
|
904
|
$t.comrEnd=tt;
|
|
905
|
$("#addKeyword").show();
|
|
906
|
$.ajax({
|
|
907
|
"url": "/ajax/dataDict/qaHotKey",
|
|
908
|
"type": "GET",
|
|
909
|
"success": function(data) {
|
|
910
|
console.log(data);
|
|
911
|
if(data.success) {
|
|
912
|
if($t.comrEnd==tt) {
|
|
913
|
if(data.data.length == 0) {
|
|
914
|
$this.siblings(".keydrop").addClass("displayNone");
|
|
915
|
$this.siblings(".keydrop").find("ul").html("");
|
|
916
|
} else {
|
|
917
|
$this.siblings(".keydrop").removeClass("displayNone");
|
|
918
|
var oSr = "";
|
|
919
|
for(var i = 0; i < Math.min(data.data.length,5); i++) {
|
|
920
|
oSr += '<li>' + data.data[i].caption + '<div class="closeThis"></div></li>';
|
|
921
|
}
|
|
922
|
$this.siblings(".keydrop").find("ul").html(oSr);
|
|
923
|
}
|
|
924
|
}
|
|
925
|
} else {
|
|
926
|
$this.siblings(".keydrop").addClass("displayNone");
|
|
927
|
$this.siblings(".keydrop").find("ul").html("");
|
|
928
|
}
|
|
929
|
},
|
|
930
|
"data": {
|
|
931
|
"key": $this.val()
|
|
932
|
},
|
|
933
|
dataType: "json",
|
|
934
|
'error': function() {
|
|
935
|
$.MsgBox.Alert('提示', '服务器连接超时!');
|
|
936
|
}
|
|
937
|
});
|
|
938
|
}
|
|
939
|
},500);
|
|
940
|
}
|
|
941
|
} else {
|
|
942
|
$(this).siblings("button").hide();
|
|
943
|
$(this).siblings(".keydrop").addClass("displayNone");
|
|
944
|
$(this).siblings(".keydrop").find("ul").html("");
|
|
945
|
}
|
|
946
|
}
|
|
947
|
})
|
|
948
|
$(".keydrop").on("click", "li", function() {
|
|
949
|
var oValue = $(this).text();
|
|
950
|
var oJudge = $(this).parents(".col-w-12").siblings().find("ul.ulspace li");
|
|
951
|
var addNum = $(this).parents(".keydrop").siblings("input").attr("data-num");
|
|
952
|
|
|
953
|
for(var i = 0; i < oJudge.length; i++) {
|
|
954
|
if(oValue == oJudge[i].innerText) {
|
|
955
|
$.MsgBox.Alert('提示', '添加内容不能重复');
|
|
956
|
return;
|
|
957
|
}
|
|
958
|
}
|
|
959
|
$(this).parents(".col-w-12").siblings().find("ul.ulspace").append('<li>' + oValue + '<div class="closeThis"></div></li>');
|
|
960
|
$(this).parents(".keydrop").siblings("input").val("");
|
|
961
|
$(this).parents(".keydrop").siblings("button").hide();
|
|
962
|
if(oJudge.length == addNum - 1) {
|
|
963
|
$(this).parents(".keydrop").siblings("input").val("");
|
|
964
|
$(this).parents(".col-w-12").hide();
|
|
965
|
}
|
|
966
|
$(this).parent("ul").html("")
|
|
967
|
})
|
|
968
|
if(num == 1) {
|
|
969
|
return;
|
|
970
|
} else {
|
|
971
|
/*添加*/
|
|
972
|
$(".addButton").siblings("input").keypress(function(){
|
|
973
|
var e = event || window.event;
|
|
974
|
if(e.keyCode == 13) {
|
|
975
|
var oValue = $(this).val().trim();
|
|
976
|
var oJudge = $(this).parent().siblings().find("ul.ulspace li");
|
|
977
|
var addContent = $(this).attr("data-pro");
|
|
978
|
var addNum = $(this).attr("data-num");
|
|
979
|
var addfontSizeNum = $(this).attr("data-fontSizeN");
|
|
980
|
if(!oValue) {
|
|
981
|
$.MsgBox.Alert('提示', '请先填写内容');
|
|
982
|
return;
|
|
983
|
}
|
|
984
|
if(oValue.length > addfontSizeNum) {
|
|
985
|
$.MsgBox.Alert('提示', addContent);
|
|
986
|
return;
|
|
987
|
}
|
|
988
|
for(var i = 0; i < oJudge.length; i++) {
|
|
989
|
if(oValue == oJudge[i].innerText) {
|
|
990
|
$.MsgBox.Alert('提示', '添加内容不能重复');
|
|
991
|
return;
|
|
992
|
}
|
|
993
|
}
|
|
994
|
$(this).parent().siblings().find("ul.ulspace").append('<li>' + oValue + '<div class="closeThis"></div></li>');
|
|
995
|
$(this).siblings(".addButton").hide();
|
|
996
|
$(this).val("");
|
|
997
|
if(oJudge.length == addNum - 1) {
|
|
998
|
$(this).val("").parents(".col-w-12").hide();
|
|
999
|
}
|
|
1000
|
$(this).siblings(".keydrop").find("ul").html("");
|
|
1001
|
}
|
|
1002
|
})
|
|
1003
|
$(".addButton").click(function() {
|
|
1004
|
var oValue = $(this).siblings("input").val().trim();
|
|
1005
|
var oJudge = $(this).parent().siblings().find("ul.ulspace li");
|
|
1006
|
var addContent = $(this).siblings("input").attr("data-pro");
|
|
1007
|
var addNum = $(this).siblings("input").attr("data-num");
|
|
1008
|
var addfontSizeNum = $(this).siblings("input").attr("data-fontSizeN");
|
|
1009
|
if(!oValue) {
|
|
1010
|
$.MsgBox.Alert('提示', '请先填写内容');
|
|
1011
|
return;
|
|
1012
|
}
|
|
1013
|
if(oValue.length > addfontSizeNum) {
|
|
1014
|
$.MsgBox.Alert('提示', addContent);
|
|
1015
|
return;
|
|
1016
|
}
|
|
1017
|
for(var i = 0; i < oJudge.length; i++) {
|
|
1018
|
if(oValue == oJudge[i].innerText) {
|
|
1019
|
$.MsgBox.Alert('提示', '添加内容不能重复');
|
|
1020
|
return;
|
|
1021
|
}
|
|
1022
|
}
|
|
1023
|
$(this).parent().siblings().find("ul.ulspace").append('<li>' + oValue + '<div class="closeThis"></div></li>');
|
|
1024
|
$(this).hide();
|
|
1025
|
$(this).siblings("input").val("");
|
|
1026
|
if(oJudge.length == addNum - 1) {
|
|
1027
|
$(this).val("").parents(".col-w-12").hide();
|
|
1028
|
}
|
|
1029
|
$(this).siblings(".keydrop").find("ul").html("");
|
|
1030
|
})
|
|
1031
|
}
|
|
1032
|
|
|
1033
|
}
|
|
1034
|
|
|
1035
|
//带有限制字数的多行文本框
|
|
1036
|
function limitObj(obj,maxNum){
|
|
1037
|
$(obj).bind({
|
|
1038
|
paste: function(e) {
|
|
1039
|
if($(this).val().length==""){
|
|
1040
|
$(this).parent().siblings(".btnModel").attr("disabled", true);
|
|
1041
|
}else{
|
|
1042
|
$(this).parent().siblings(".btnModel").attr("disabled", false);
|
|
1043
|
}
|
|
1044
|
var pastedText;
|
|
1045
|
if (window.clipboardData && window.clipboardData.getData) { // IE
|
|
1046
|
pastedText = $(this).val() + window.clipboardData.getData('Text');
|
|
1047
|
}
|
|
1048
|
else {
|
|
1049
|
pastedText = $(this).val() + e.originalEvent.clipboardData.getData('Text'); //e.clipboardData.getData('text/plain');
|
|
1050
|
}
|
|
1051
|
$(this).val(pastedText);
|
|
1052
|
setTimeout(function() {
|
|
1053
|
$(this).siblings().find("em").text($(obj).val().length);
|
|
1054
|
}, 1);
|
|
1055
|
e.preventDefault();
|
|
1056
|
},
|
|
1057
|
cut: function(e) {
|
|
1058
|
if($(this).val().length==""){
|
|
1059
|
$(this).parent().siblings(".btnModel").attr("disabled", true);
|
|
1060
|
}else{
|
|
1061
|
$(this).parent().siblings(".btnModel").attr("disabled", false);
|
|
1062
|
}
|
|
1063
|
setTimeout(function() {
|
|
1064
|
$(obj).siblings().find("em").text($(obj).val().length);
|
|
1065
|
}, 1);
|
|
1066
|
},
|
|
1067
|
keyup: function(e) {
|
|
1068
|
if($(this).val().length==""){
|
|
1069
|
$(this).parent().siblings(".btnModel").attr("disabled", true);
|
|
1070
|
}else{
|
|
1071
|
$(this).parent().siblings(".btnModel").attr("disabled", false);
|
|
1072
|
}
|
|
1073
|
if($(this).val().length > maxNum) {
|
|
1074
|
$(obj).val($(obj).val().substring(0, maxNum));
|
|
1075
|
e.preventDefault();
|
|
1076
|
}
|
|
1077
|
setTimeout(function() {
|
|
1078
|
$(obj).siblings().find("em").text($(obj).val().length);
|
|
1079
|
}, 1);
|
|
1080
|
}
|
|
1081
|
});
|
|
1082
|
}
|
|
1083
|
|
|
1084
|
|
|
1085
|
var r64 = ["0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z", "a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z", "-", "_"];
|
|
1086
|
var d64 = {
|
|
1087
|
"0": 0,
|
|
1088
|
"1": 1,
|
|
1089
|
"2": 2,
|
|
1090
|
"3": 3,
|
|
1091
|
"4": 4,
|
|
1092
|
"5": 5,
|
|
1093
|
"6": 6,
|
|
1094
|
"7": 7,
|
|
1095
|
"8": 8,
|
|
1096
|
"9": 9,
|
|
1097
|
"A": 10,
|
|
1098
|
"B": 11,
|
|
1099
|
"C": 12,
|
|
1100
|
"D": 13,
|
|
1101
|
"E": 14,
|
|
1102
|
"F": 15,
|
|
1103
|
"G": 16,
|
|
1104
|
"H": 17,
|
|
1105
|
"I": 18,
|
|
1106
|
"J": 19,
|
|
1107
|
"K": 20,
|
|
1108
|
"L": 21,
|
|
1109
|
"M": 22,
|
|
1110
|
"N": 23,
|
|
1111
|
"O": 24,
|
|
1112
|
"P": 25,
|
|
1113
|
"Q": 26,
|
|
1114
|
"R": 27,
|
|
1115
|
"S": 28,
|
|
1116
|
"T": 29,
|
|
1117
|
"U": 30,
|
|
1118
|
"V": 31,
|
|
1119
|
"W": 32,
|
|
1120
|
"X": 33,
|
|
1121
|
"Y": 34,
|
|
1122
|
"Z": 35,
|
|
1123
|
"a": 36,
|
|
1124
|
"b": 37,
|
|
1125
|
"c": 38,
|
|
1126
|
"d": 39,
|
|
1127
|
"e": 40,
|
|
1128
|
"f": 41,
|
|
1129
|
"g": 42,
|
|
1130
|
"h": 43,
|
|
1131
|
"i": 44,
|
|
1132
|
"j": 45,
|
|
1133
|
"k": 46,
|
|
1134
|
"l": 47,
|
|
1135
|
"m": 48,
|
|
1136
|
"n": 49,
|
|
1137
|
"o": 50,
|
|
1138
|
"p": 51,
|
|
1139
|
"q": 52,
|
|
1140
|
"r": 53,
|
|
1141
|
"s": 54,
|
|
1142
|
"t": 55,
|
|
1143
|
"u": 56,
|
|
1144
|
"v": 57,
|
|
1145
|
"w": 58,
|
|
1146
|
"x": 59,
|
|
1147
|
"y": 60,
|
|
1148
|
"z": 61,
|
|
1149
|
"-": 62,
|
|
1150
|
"_": 63
|
|
1151
|
};
|
|
1152
|
function s16to64(s) {
|
|
1153
|
var out, idx, n1, n2, n3;
|
|
1154
|
idx = s.length - 1;
|
|
1155
|
out = "";
|
|
1156
|
while(idx >= 0) {
|
|
1157
|
n1 = d64[s.charAt(idx--)];
|
|
1158
|
if(idx < 0) {
|
|
1159
|
out = r64[n1] + out;
|
|
1160
|
break;
|
|
1161
|
}
|
|
1162
|
n2 = d64[s.charAt(idx--)];
|
|
1163
|
if(idx < 0) {
|
|
1164
|
out = r64[(n2 >>> 2)] + r64[((n2 & 0x3) << 4) + n1] + out;
|
|
1165
|
break;
|
|
1166
|
}
|
|
1167
|
n3 = d64[s.charAt(idx--)];
|
|
1168
|
out = r64[(n2 >>> 2) + (n3 << 2)] + r64[((n2 & 0x3) << 4) + n1] + out;
|
|
1169
|
}
|
|
1170
|
return out;
|
|
1171
|
}
|
|
1172
|
|
|
1173
|
function s64to16(s) {
|
|
1174
|
var out, idx, n1, n2;
|
|
1175
|
idx = s.length - 1;
|
|
1176
|
out = "";
|
|
1177
|
while(idx >= 0) {
|
|
1178
|
n1 = d64[s.charAt(idx--)];
|
|
1179
|
if(idx < 0) {
|
|
1180
|
out = r64[n1 >>> 4] + r64[n1 & 0xF] + out;
|
|
1181
|
break;
|
|
1182
|
}
|
|
1183
|
n2 = d64[s.charAt(idx--)];
|
|
1184
|
out = r64[(n2 >>> 2)] + r64[(n1 >>> 4) + ((n2 & 0x3) << 2)] + r64[n1 & 0xF] + out;
|
|
1185
|
}
|
|
1186
|
if(out.length>32) {
|
|
1187
|
return out.substring(1);
|
|
1188
|
}
|
|
1189
|
return out;
|
|
1190
|
}
|
|
1191
|
|
|
1192
|
|
|
1193
|
//发现上方轮播
|
|
1194
|
var bannerRotate = {// banner rotating
|
|
1195
|
_time: 3000,
|
|
1196
|
_i: 0,
|
|
1197
|
_interval: null,
|
|
1198
|
_navId: "#slide-tab",
|
|
1199
|
_navBox: "#slide-list",
|
|
1200
|
bannerShow: function() {
|
|
1201
|
$(this._navId).find("li").removeClass("slide-tab-item-active");
|
|
1202
|
$(this._navId).find("li:eq("+this._i+")").addClass("slide-tab-item-active");
|
|
1203
|
|
|
1204
|
$(this._navBox).find("li").removeClass("slide-item-active");
|
|
1205
|
$(this._navBox).find("li:eq("+this._i+")").addClass("slide-item-active");
|
|
1206
|
},
|
|
1207
|
bannerStart:function() {
|
|
1208
|
var _this = this;
|
|
1209
|
_this._interval = setInterval(function() {
|
|
1210
|
if(_this._i >= 4) {
|
|
1211
|
_this._i = 0;
|
|
1212
|
}
|
|
1213
|
else {
|
|
1214
|
_this._i++;
|
|
1215
|
}
|
|
1216
|
_this.bannerShow();
|
|
1217
|
}, _this._time);
|
|
1218
|
},
|
|
1219
|
bannerInit: function() {
|
|
1220
|
var _this = this;
|
|
1221
|
_this.bannerStart();
|
|
1222
|
|
|
1223
|
$(_this._navId).find("li").bind("mouseover", function() {
|
|
1224
|
clearInterval(_this._interval);
|
|
1225
|
_this._i = $(this).index();
|
|
1226
|
_this.bannerShow();
|
|
1227
|
_this.bannerStart();
|
|
1228
|
});
|
|
1229
|
}
|
|
1230
|
};
|
|
1231
|
|
|
1232
|
var currentdate;
|
|
1233
|
function getNowFormatDate(num) {
|
|
1234
|
var date = new Date();
|
|
1235
|
var seperator1 = "-";
|
|
1236
|
var seperator2 = ":";
|
|
1237
|
var month = date.getMonth() + 1;
|
|
1238
|
var strDate = date.getDate();
|
|
1239
|
var getHours = date.getHours();
|
|
1240
|
var getMinutes = date.getMinutes();
|
|
1241
|
if (month >= 1 && month <= 9) {
|
|
1242
|
month = "0" + month;
|
|
1243
|
}
|
|
1244
|
if (strDate >= 0 && strDate <= 9) {
|
|
1245
|
strDate = "0" + strDate;
|
|
1246
|
}
|
|
1247
|
if (getMinutes >= 0 && getMinutes <= 9) {
|
|
1248
|
getMinutes = "0" + getMinutes;
|
|
1249
|
}
|
|
1250
|
if (getHours >= 0 && getHours <= 9) {
|
|
1251
|
getHours = "0" + getHours;
|
|
1252
|
}
|
|
1253
|
var currentdate = date.getFullYear() + seperator1 + month + seperator1 + strDate
|
|
1254
|
+ " " + getHours + seperator2 + getMinutes
|
|
1255
|
if(num==1){
|
|
1256
|
currentdate = date.getFullYear() + seperator1 + month + seperator1 + strDate
|
|
1257
|
}
|
|
1258
|
|
|
1259
|
|
|
1260
|
return currentdate;
|
|
1261
|
}
|
|
1262
|
function wlog(dt, id, src) {
|
|
1263
|
var src = src || "1";
|
|
1264
|
|
|
1265
|
var $img=$("<img src='"+wlogurl+"/log/img?__lt="+dt+"&src="+src+"&id="+id+"&_t="+(new Date().getTime())+"' style='display:none;' ></img>");
|
|
1266
|
$img.appendTo($("body"));
|
|
1267
|
|
|
1268
|
setTimeout(function(){
|
|
1269
|
$img.remove();
|
|
1270
|
},5000);
|
|
1271
|
|
|
1272
|
// $.ajax({
|
|
1273
|
// url: "http://www.ekexiu.com:8082/log/jsonp/log",
|
|
1274
|
// data: {
|
|
1275
|
// "id": id,
|
|
1276
|
// "src": src,
|
|
1277
|
// "__lt": dt,
|
|
1278
|
// },
|
|
1279
|
// success:function(data) {
|
|
1280
|
// },
|
|
1281
|
// dataType: "jsonp"
|
|
1282
|
// });
|
|
1283
|
}
|
|
1284
|
|
|
1285
|
//广告相关操作
|
|
1286
|
function addscript(that){
|
|
1287
|
var script=document.createElement("script");
|
|
1288
|
script.setAttribute("type", "text/javascript");
|
|
1289
|
var srclink= "https://www.ekexiu.com/data/inc/ad/"+ that +".js?r=" + new Date().getTime();
|
|
1290
|
script.setAttribute("src", srclink);
|
|
1291
|
var heads = document.getElementsByTagName("head");
|
|
1292
|
if(heads.length){
|
|
1293
|
heads[0].appendChild(script);
|
|
1294
|
}else{
|
|
1295
|
document.documentElement.appendChild(script);
|
|
1296
|
}
|
|
1297
|
}
|
|
1298
|
$(document).ready(function(){
|
|
1299
|
//处理点击事件,需要打开原生浏览器
|
|
1300
|
$("body").on("click","a.advertsub",function(){
|
|
1301
|
var adId = this.getAttribute('data-id');
|
|
1302
|
console.log(adId)
|
|
1303
|
wlog("ad", adId ,"1");
|
|
1304
|
return true;
|
|
1305
|
})
|
|
1306
|
})
|
|
1307
|
|
|
1308
|
function adScroll(){
|
|
1309
|
//不随滚动条滚动的固定层广告代码
|
|
1310
|
function thisS() {
|
|
1311
|
var scrollHeight = $(document).height();
|
|
1312
|
var windowHeight = $(window).innerHeight();
|
|
1313
|
var footerHeight = $("footer").outerHeight(true);
|
|
1314
|
var containH = $("#container").outerHeight(true)-footerHeight
|
|
1315
|
var objHeight= $("#scroll-fixed-ad").outerHeight();
|
|
1316
|
var scroTop = document.body.scrollTop || document.documentElement.scrollTop;
|
|
1317
|
(scroTop-objHeight+offTop) < containH ? (scroTop > offTop ?
|
|
1318
|
(scroObj.attr('class',"div1 div2"), c && (scroObj.style.top = scroTop - offTop + "px")) :scroObj.attr('class',"div1")):
|
|
1319
|
(scroObj.attr('class',"div1 div3"),scroObj.css("bottom",windowHeight + scroTop + footerHeight+ 10 - scrollHeight))
|
|
1320
|
// console.log(containH+"***"+(scroTop+offTop-objHeight))
|
|
1321
|
console.log(scroTop+"&&&&&"+offTop+"&&&"+objHeight)
|
|
1322
|
}
|
|
1323
|
var scroObj = $("#scroll-fixed-ad");
|
|
1324
|
var offTop= scroObj.offset().top + 40;
|
|
1325
|
if(scroObj == undefined) return !1;
|
|
1326
|
var c;
|
|
1327
|
c = window.ActiveXObject && !window.XMLHttpRequest;
|
|
1328
|
if(!c || !0) window.onscroll =function(){
|
|
1329
|
var d;
|
|
1330
|
if(d) return;
|
|
1331
|
d = setTimeout(function() {
|
|
1332
|
thisS.call(this), d = undefined
|
|
1333
|
}, 150)
|
|
1334
|
}
|
|
1335
|
}
|