portal html css js resource

shareCom.js 7.2KB

    //var wlogurl="http://192.168.3.233:8080" var wlogurl="http://www.ekexiu.com:8082"; 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); } /*标志*/ 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": " " } } } } } //时间显示规则 function commenTime(startTime) { //console.log(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) { if(nowTimg.getFullYear() == startTime.substring(0, 4)) { 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; if(s.length <= 6) { formatTime = y + "年" + m.replace(/\b(0+)/gi, "") + "月"; } else if(s.length > 6 && s.length <= 8) { formatTime = m.replace(/\b(0+)/gi, "") + "月" + d.replace(/\b(0+)/gi, "") + "日 "; if(y != myDate.getFullYear()) { formatTime = y + "年" + m.replace(/\b(0+)/gi, "") + "月" + d.replace(/\b(0+)/gi, "") + "日 "; } } else { 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; } //企业类型 var orgTypeShow = { "2": "上市企业", "3": "外资企业", "4": "合资企业", "5": "独资企业", "6": "个体经营", "7": "政府机构", "8": "公益组织", "9": "协会学会", "10": "新闻媒体", "11": "教育机构", "undefined":"" } //需求的费用预算 var demandCost = { '1': '1万元以内', '2': '1-5万元', '3': '5-10万元', '4': '10-20万元', '5': '20-50万元', '6': '50万元以上' } //需求的预期时长 var demandDuration = { '1': '1个月内', '2': '1-3个月', '3': '3-6个月', '4': '6-12个月', '5': '1年以上' } function shareWays(shareTitle,descContent,lineLink,imgUrl){ console.log(arguments); /*微信分享*/ $.ajax({ url: "../ajax/weixin/jsapiTicket", type: 'get', dataType: 'json', contentType: "application/x-www-form-urlencoded; charset=utf-8", data: { 'url': location.href.split('#')[0] }, success: function(data) { if(data.data) { console.log() wx.config({ debug: false, //调试模式好犀利 appId: data.data.appId, timestamp: data.data.timestamp, nonceStr: data.data.nonceStr, signature: data.data.signature, jsApiList: [ // 所有要调用的 API 都要加到这个列表中 "onMenuShareAppMessage", "onMenuShareTimeline", "onMenuShareQQ", "onMenuShareQZone", "scanQRCode", ] }); wx.ready(function() { // 在这里调用 API wx.onMenuShareAppMessage({ //分享给朋友 title: shareTitle, // 分享标题 desc: descContent, // 分享描述 link: lineLink, // 分享链接 imgUrl: imgUrl, // 分享图标 success: share_success_callback, cancel: share_cancel_callback }); wx.onMenuShareTimeline({ //分享到朋友圈 title: shareTitle, // 分享标题 desc: descContent, // 分享描述 link: lineLink, // 分享链接 imgUrl: imgUrl, // 分享图标 success: share_success_callback, cancel: share_cancel_callback }); wx.onMenuShareQQ({ //分享到QQ title: shareTitle, // 分享标题 desc: descContent, // 分享描述 link: lineLink, // 分享链接 imgUrl: imgUrl, // 分享图标 success: share_success_callback, cancel: share_cancel_callback }); wx.onMenuShareQZone({ //分享到QQ空间 title: shareTitle, // 分享标题 desc: descContent, // 分享描述 link: lineLink, // 分享链接 imgUrl: imgUrl, // 分享图标 success: share_success_callback, cancel: share_cancel_callback }); }); //分享成功后的回调函数 function share_success_callback() {} //用户取消分享后执行的回调函数 function share_cancel_callback() {} } } }); } function wlog(dt, id, src) { var src = src || "1"; var $img=$("<img src='"+wlogurl+"/log/img?__lt="+dt+"&src="+src+"&id="+id+"&_t="+(new Date().getTime())+"' style='display:none;' ></img>"); $img.appendTo($("body")); setTimeout(function(){ $img.remove(); },5000); // $.ajax({ // url: "http://www.ekexiu.com:8082/log/jsonp/log", // data: { // "id": id, // "src": src, // "__lt": dt, // }, // success:function(data) { // }, // dataType: "jsonp" // }); } //广告相关操作 function addscript(that){ var script=document.createElement("script"); script.setAttribute("type", "text/javascript"); var srclink= "https://www.ekexiu.com/data/inc/ad/"+ that +".js?r=" + new Date().getTime(); script.setAttribute("src", srclink); var heads = document.getElementsByTagName("head"); if(heads.length){ heads[0].appendChild(script); }else{ document.documentElement.appendChild(script); } } $(document).ready(function(){ //处理点击事件,需要打开原生浏览器 $("body").on("click","a.advertsub",function(){ var adId = this.getAttribute('data-id'); console.log(adId) wlog("ad", adId ,"3"); return true; }) })