123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552 |
- $(document).ready(function(){
- $(".unlogin").show();
- $(".onlogin").hide();
-
- var footerHeight = $("footer").outerHeight(true);
- $('#container').css("padding-bottom", footerHeight +"px" );
-
- $(window).resize(function() {
- footerHeight=$("footer").outerHeight(true);
- $('#container').css("padding-bottom", footerHeight +"px" );
-
- });
-
- var orgid = $.cookie('orgId');
- $("#cmpSet2").on("click",function(){
- if (orgid && orgid != "null" && orgid != null) {
- location.href="cmp-portal/cmp-workspaces.html"
- }else{
- location.href="cmp-portal/cmp-settled-reg.html"
- }
- })
- });
-
- $("#search").on("click", function() {
- var searchContent = $("#searchContent").val();
- location.href = "searchNew.html?searchContent=" + encodeURI(searchContent);
- });
-
-
- $("#searchContent").keydown(function(e){
- if(e.which==13) {
- var searchContent = $("#searchContent").val();
- console.log(searchContent);
- location.href = "searchNew.html?searchContent=" + encodeURI(searchContent);
- }
-
- })
- $("#hsearchContent").keydown(function(e){
- if(e.which==13) {
- var searchContent = $("#hsearchContent").val();
- console.log(searchContent);
- location.href = "searchNew.html?searchContent=" + encodeURI(searchContent);
- }
- })
-
- $("#hsearch").on("click", function() {
- var searchContent = $("#hsearchContent").val();
- location.href = "searchNew.html?searchContent=" + encodeURI(searchContent);
- });
- $(document).scroll(function() {
- var top = $(document).scrollTop();
-
- if (top == 0) {
- $(".navheader").removeClass("navhdown");
- } else {
- $(".navheader").addClass("navhdown");
- }
- if (top >= 300) {
- $(".content-left").css({
- "position": "fixed",
- "top": "80px"
- })
- } else {
- $(".content-left").css({
- "position": "static"
- })
- }
-
- });
- var userid;
- function exit(){
- $.cookie('userid', null);
- $.cookie('userAuth', null);
- $.cookie('userEmail', null);
- $.cookie('userMobilePhone', null);
- $.cookie('userName', null);
- $.cookie('userType', null);
- location.href="index.html"
- }
- function valUser(){
- var userid = $.cookie('userid');
- var userAuth = $.cookie('userAuth');
- if(userid == undefined || userid.length==0 || userid == "null" || userAuth == false){
- location.href="login.html";
- }
- }
- function GetQueryString(name) {
- var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)", "i");
- var r = window.location.search.substr(1).match(reg);
-
- var context = "";
- if (r != null)
- context = r[2];
- reg = null;
- r = null;
- return context == null || context == "" || context == "undefined" ? "" : decodeURI(context);
- }
- var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)", "i");
- var r = window.location.search.substr(1).match(reg); //��ȡurl��"?"�����ַ�����ƥ��
- var context = "";
- if (r != null)
- context = r[2];
- reg = null;
- r = null;
- return context == null || context == "" || context == "undefined" ? "" : context;
- }*/
- function loginStatus(){
- userid = $.cookie('userid');
- userAuth = $.cookie('userAuth');
- authentication = $.cookie('authentication');
- if(userid && userid != "null" && userid != null){
- if(userAuth == "false" && authentication == "null"){
- location.href="loginInviteFirst.html";
- }
- if(userAuth == "true" && authentication == "null"){
- location.href="fillinfo-select.html";
- }
- if(userAuth == "true" && authentication != "null"){
- $(".onlogin").show();
- $(".unlogin").hide();
- $(".portrait-p").attr("src","/images/head/"+userid+"_m.jpg");
- $(".portrait-p").load(function(){
- })
- .error(function(){
- $(".portrait-p").attr("src","/images/default-photo.jpg");
- });
- }
- }else{
- $(".unlogin").show();
- $(".onlogin").hide();
- }
- }
- function changeTime(dealtime){
- var s = dealtime;
-
- if(dealtime.length==8){
- var y = s.substr(0,4);
- var m = s.substr(4,2);
- var d = s.substr(6,2);
- var formatTime = y+"-"+m+"-"+d;
- return formatTime;
- }
- else
- {
- var y = s.substr(0,4);
- var m = s.substr(4,2);
- var d = s.substr(6,2);
- var h = s.substr(8,2);
- var minute = s.substr(10,2);
- var formatTime = y+"-"+m+"-"+d+" "+h+":"+minute;
- return formatTime;
- }
-
- }
- function replaceStr(s)
- {
- var pattern = new RegExp("-");
- var rs = "";
- for (var i = 0; i < s.length; i++) {
- rs = rs+s.substr(i, 1).replace(pattern, '');
- }
- return rs;
- }
- function limitHeight(){
- var Length = $(".limitBox").length;
- for(var i=0; i<Length;i++){
- var limitheight = $(".limitwords").eq(i).height();
- console.log(limitheight);
- $(".limitBox").eq(i).css("height",limitheight);
- }
-
- }
- var hash={
- 'qq.com': 'http://mail.qq.com',
- 'gmail.com': 'http://mail.google.com',
- 'sina.com': 'http://mail.sina.com.cn',
- '163.com': 'http://mail.163.com',
- '126.com': 'http://mail.126.com',
- 'yeah.net': 'http://www.yeah.net/',
- 'sohu.com': 'http://mail.sohu.com/',
- 'tom.com': 'http://mail.tom.com/',
- 'sogou.com': 'http://mail.sogou.com/',
- '139.com': 'http://mail.10086.cn/',
- 'hotmail.com': 'http://www.hotmail.com',
- 'live.com': 'http://login.live.com/',
- 'live.cn': 'http://login.live.cn/',
- 'live.com.cn': 'http://login.live.com.cn',
- '189.com': 'http://webmail16.189.cn/webmail/',
- 'yahoo.com.cn': 'http://mail.cn.yahoo.com/',
- 'yahoo.cn': 'http://mail.cn.yahoo.com/',
- 'eyou.com': 'http://www.eyou.com/',
- '21cn.com': 'http://mail.21cn.com/',
- '188.com': 'http://www.188.com/',
- 'ustb.edu.cn': 'http://mail.ustb.edu.cn/',
- 'foxmail.coom': 'http://www.foxmail.com'
- };
- function Carousel(inde, num,show, childcount, obj, next, prev) {
- var tapnum=0;
- if( childcount > num ){
- next.css("display","block");
- prev.css("display","none");
- }else{
- next.css("display","none");
- prev.css("display","none");
- }
- next.click(function() {
- if (!obj.is(":animated")) {
- if (num < childcount) {
- tapnum++;
- prev.css("display","block");
- if(tapnum == childcount-show){
- next.css("display","none");
-
- }
- num++;
- obj.animate({
- left: "-=212px"
- }, 600);
- }
- }
- });
- prev.click(function() {
-
- if (!obj.is(":animated")) {
- if (num > inde) {
- tapnum--;
- next.css("display","block");
- if(tapnum == 0){
- prev.css("display","none");
- }
- num--;
- obj.animate({
- left: "+=212px"
- }, 600);
- }
- }
- });
- }
- function limitTextCountFn(TextAreaId,countContainerId,count){
- var curLength=$(TextAreaId).val().length;
- if(curLength > count){
- var num=$(TextAreaId).val().substr(0,count);
- $(TextAreaId).val(num);
-
- }
- else {
- $(countContainerId).text(count - $(TextAreaId).val().length);
- }
- };
- function titleLimitFontCountFn(){
- var curLength= $("#consultTitle").val().length;
- if(curLength>20){
- var num = $("#consultTitle").val().substr(0,20);
- $("#consultTitle").val(num);
- }
-
- };
-
- function showmenu(){
- $("#li_show").css("display","block");
- }
- $(document).on("click","#City li a", function(){
- var aVal = $(this).text();
- $(this).parent().parent().parent().find('.mr_show').text(aVal);
- $(this).parent().parent().parent().find('input[name=cho_City]').val(aVal);
- });
- function concultProInfo(professorId){
- $.ajax({
- url:"/ajax/professor/editBaseInfo/"+professorId,
- type:"get",
- data : {"id":professorId},
- contentType : "application/x-www-form-urlencoded",
- success:function(response){
-
- var myData = response["data"];
-
- $("#professorName").html(myData["name"]);
- if(myData["title"]){
- $("#professorTitle").html(myData["title"]+' ');
- }
- if(myData["department"]){
- $("#profDepartment").html(myData["department"]+' ');
- }
- if(myData["orgName"]){
- $("#profOrganization").html(myData["orgName"]+' ');
- }
- if(myData["address"]){
- $("#profAdress").html(myData["address"]);
- }
- console.log(myData["consultCount"])
- if(!myData["consultCount"]){
- $("#starLevel").hide();
- }
- $("#byConsultConut").html(myData["consultCount"]);
- $("#sendConsultBtn").attr("proId",myData["id"]);
-
-
- var startConut = parseInt(myData["starLevel"]);
- if(myData["consultCount"]){
- if(!startConut){
- $(".evastarbox2").hide();
- }
- }
- for(var i = 0; i < startConut; i ++){
- $("#starLevel .evastar2").eq(i).addClass("addStar");
- }
-
-
- var oSty=autho(myData.authType,myData.orgAuth,myData.authStatus);
- $("#proModifyN").addClass(oSty.sty);
- $("#proModifyN").attr("title",oSty.title);
-
-
- if(myData["hasHeadImage"] == 0){
- $("#prohead").attr("src","images/default-photo.jpg");
- }
- else {
- $("#prohead").attr("src","images/head/"+myData["id"]+"_l.jpg");
- }
-
-
- },
- error:function(error){
- $.MsgBox.Alert("message","请求数据失败");
- }
- });
- };
- function sendConsultHandler(professorId){
- var professorId = professorId;
- var consult_type = $(".clicknow").text();
- var consult_title = $("#consultTitle").val();
- var consult_content = $("#consultcontent").val();
- var consultStr = {
- "consultType":consult_type,
- "consultTitle":consult_title,
- "consultContant":consult_content,
- "professorId":professorId,
- "consultantId":userid
- };
-
- if(consult_type == '' || consult_title == '' || consult_content == ''){
- $.MsgBox.Alert("消息提醒","请填写完整");
- };
- if(consult_type == ''){
- $.MsgBox.Alert("消息提醒","请选择联系目的");
- }
- if(consult_title == ''){
- $.MsgBox.Alert("消息提醒","请填写咨询目的");
- }
- if(consult_content == ''){
- $.MsgBox.Alert("消息提醒","请填写咨询内容");
- }
-
- if(userid && userid != null && userid != "null" && consult_type != '' &&
- consult_title != '' && consult_content != ''
- ){
-
- $.ajax({
- "url" :"/ajax/consult",
- "type" : "post",
-
- "data" : consultStr,
- "contentType" : "application/x-www-form-urlencoded",
- "dataType" : "json",
- "success" : function(response) {
- console.log(response);
- },
- "error":function (){
- $.MsgBox.Alert("消息提醒","咨询申请失败");
- },
-
- "complete":function(){
-
- $(".blackcover").remove();
- $("body").css("position","");
- $.MsgBox.Alert("消息提醒","咨询申请成功");
- $("#mb_msgicon").css("background", 'url("images/sign_icon_chenggong_nor.png") 0% 0% / contain');
- },
- });
- }
- };
- function autho() {
- if(arguments[0] == 1) {
- return {
- "sty": "authicon-pro",
- "title": "科袖认证专家"
- }
- } else {
- if(arguments[1] == 1) {
- return {
- "sty": "authicon-staff-ok",
- "title": "企业认证员工"
- }
- } else {
- if(arguments[2] == 3) {
- return {
- "sty": "authicon-real",
- "title": "实名认证用户"
- }
- } else {
- return {
- "sty": "e",
- "title": " "
- }
- }
- }
- }
- }
- var ifuser = ifUserType();
- function ifUserType(pa){
- if(pa) {
- var useridtype =pa;
- }else{
- var useridtype = $.cookie('userid');
- }
- var authType2,authentication2;
- if (useridtype && useridtype != "null" && useridtype != null) {
- $.ajax({
- "url" :"/ajax/professor/auth",
- "type" : "GET",
- "data" :{"id":useridtype} ,
- "dataType" : "json",
- "async":false,
- "success" : function(data) {
- if(data.success){
- authType2 = data.data.authType;
- authentication2 = data.data.authentication;
- }
- }
- });
- }
- return{
- "authType2":authType2,
- "authentication2":authentication2,
- }
- }
- if ($.cookie('userName') && $.cookie('userName') != "null" && $.cookie('userName') != null) {
- if(ifuser.authType2==0){
- $("#repalyf").addClass("repalyf");
-
- $("#gozixu").on("click", function() {
- window.location.href = "myConsult.html";
- })
- }else{
- $(".nohide").show();
-
- $("#gozixu").on("click", function() {
- window.location.href = "consult.html";
- })
- }
- }
- $(".msgContbox textarea").focus(function(){
- $(this).parent().css("border-color","#ff9900");
- }).blur(function(){
- $(this).parent().css("border-color","#E5E5E5");
- })
- function commenTime(startTime){
- var nowTimg = new Date();
- var startdate = new Date();
- startdate.setFullYear(parseInt(startTime.substring(0,4)));
- startdate.setMonth(parseInt(startTime.substring(4,6))-1);
- startdate.setDate(parseInt(startTime.substring(6,8)));
- startdate.setHours(parseInt(startTime.substring(8,10)));
- startdate.setMinutes(parseInt(startTime.substring(10,12)));
- startdate.setSeconds(parseInt(startTime.substring(12,14)));
- var date3=nowTimg.getTime()-startdate.getTime();
- var hours = parseInt((date3 % (1000 * 60 * 60 * 24)) / (1000 * 60 * 60));
- var minutes = parseInt((date3 % (1000 * 60 * 60)) / (1000 * 60));
- if(date3 < 60000){
- return "刚刚";
- }else if(date3 >= 60000 && date3 < 3600000){
- return minutes + "分钟前";
- }else if(date3 >= 3600000 && date3 < 86400000){
- return hours + "小时前";
- }else if(date3 >= 86400000 && date3 < 172800000){
- return "昨天 " + startTime.substring(8,10) + ":" +startTime.substring(10,12);
-
- }else if(date3 >= 172800000 && date3 < 31536000000){
- 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);
- }
- else{
- 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);
- }
-
- }
- function TimeTr(dealtime) {
- var myDate = new Date();
- var s = dealtime;
- var y = s.substr(0, 4);
- var m = s.substr(4, 2);
- var d = s.substr(6, 2);
- var h = s.substr(8, 2);
- var minute = s.substr(10, 2);
- var formatTime = m.replace(/\b(0+)/gi, "") + "月" + d.replace(/\b(0+)/gi, "")+ "日 " + h + ":" + minute;
- if(y != myDate.getFullYear()){
- formatTime = y + "年" + m.replace(/\b(0+)/gi, "") + "月" + d.replace(/\b(0+)/gi, "")+ "日 " + h + ":" + minute;
- }
- return formatTime;
- }
|