portal html css js resource

shareCom.js 5.9KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197
  1. function GetQueryString(name) {
  2. var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)", "i");
  3. var r = window.location.search.substr(1).match(reg);
  4. var context = "";
  5. if(r != null)
  6. context = r[2];
  7. reg = null;
  8. r = null;
  9. return context == null || context == "" || context == "undefined" ? "" : decodeURI(context);
  10. }
  11. /*标志*/
  12. function autho() {
  13. if(arguments[0] == 1) {
  14. return {
  15. "sty": "authicon-pro",
  16. "title": "科袖认证专家"
  17. }
  18. } else {
  19. if(arguments[1] == 1) {
  20. return {
  21. "sty": "authicon-staff-ok",
  22. "title": "企业认证员工"
  23. }
  24. } else {
  25. if(arguments[2] == 3) {
  26. return {
  27. "sty": "authicon-real",
  28. "title": "实名认证用户"
  29. }
  30. } else {
  31. return {
  32. "sty": "e",
  33. "title": " "
  34. }
  35. }
  36. }
  37. }
  38. }
  39. //时间显示规则
  40. function commenTime(startTime) {
  41. //console.log(startTime)
  42. var nowTimg = new Date();
  43. var startdate = new Date();
  44. startdate.setFullYear(parseInt(startTime.substring(0, 4)));
  45. startdate.setMonth(parseInt(startTime.substring(4, 6)) - 1);
  46. startdate.setDate(parseInt(startTime.substring(6, 8)));
  47. startdate.setHours(parseInt(startTime.substring(8, 10)));
  48. startdate.setMinutes(parseInt(startTime.substring(10, 12)));
  49. startdate.setSeconds(parseInt(startTime.substring(12, 14)));
  50. var date3 = nowTimg.getTime() - startdate.getTime(); //时间差的毫秒数
  51. var hours = parseInt((date3 % (1000 * 60 * 60 * 24)) / (1000 * 60 * 60));
  52. var minutes = parseInt((date3 % (1000 * 60 * 60)) / (1000 * 60));
  53. if(date3 < 60000) {
  54. return "刚刚";
  55. } else if(date3 >= 60000 && date3 < 3600000) {
  56. return minutes + "分钟前";
  57. } else if(date3 >= 3600000 && date3 < 86400000) {
  58. return hours + "小时前";
  59. } else if(date3 >= 86400000) {
  60. if(nowTimg.getFullYear() == startTime.substring(0, 4)) {
  61. 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);
  62. } else {
  63. 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);
  64. }
  65. }
  66. }
  67. function TimeTr(dealtime) {
  68. var myDate = new Date();
  69. var s = dealtime;
  70. var y = s.substr(0, 4);
  71. var m = s.substr(4, 2);
  72. var d = s.substr(6, 2);
  73. var h = s.substr(8, 2);
  74. var minute = s.substr(10, 2);
  75. var formatTime;
  76. if(s.length <= 6) {
  77. formatTime = y + "年" + m.replace(/\b(0+)/gi, "") + "月";
  78. } else if(s.length > 6 && s.length <= 8) {
  79. formatTime = m.replace(/\b(0+)/gi, "") + "月" + d.replace(/\b(0+)/gi, "") + "日 ";
  80. if(y != myDate.getFullYear()) {
  81. formatTime = y + "年" + m.replace(/\b(0+)/gi, "") + "月" + d.replace(/\b(0+)/gi, "") + "日 ";
  82. }
  83. } else {
  84. formatTime = m.replace(/\b(0+)/gi, "") + "月" + d.replace(/\b(0+)/gi, "") + "日 " + h + ":" + minute;
  85. if(y != myDate.getFullYear()) {
  86. formatTime = y + "年" + m.replace(/\b(0+)/gi, "") + "月" + d.replace(/\b(0+)/gi, "") + "日 " + h + ":" + minute;
  87. }
  88. }
  89. return formatTime;
  90. }
  91. //需求的费用预算
  92. var demandCost = {
  93. '1': '1万元以内',
  94. '2': '1-5万元',
  95. '3': '5-10万元',
  96. '4': '10-20万元',
  97. '5': '20-50万元',
  98. '6': '50万元以上'
  99. }
  100. //需求的预期时长
  101. var demandDuration = {
  102. '1': '1个月内',
  103. '2': '1-3个月',
  104. '3': '3-6个月',
  105. '4': '6-12个月',
  106. '5': '1年以上'
  107. }
  108. function shareWays(shareTitle,descContent,lineLink,imgUrl){
  109. console.log(arguments);
  110. /*微信分享*/
  111. $.ajax({
  112. url: "../ajax/weixin/jsapiTicket",
  113. type: 'get',
  114. dataType: 'json',
  115. contentType: "application/x-www-form-urlencoded; charset=utf-8",
  116. data: {
  117. 'url': location.href.split('#')[0]
  118. },
  119. success: function(data) {
  120. if(data.data) {
  121. console.log()
  122. wx.config({
  123. debug: false, //调试模式好犀利
  124. appId: data.data.appId,
  125. timestamp: data.data.timestamp,
  126. nonceStr: data.data.nonceStr,
  127. signature: data.data.signature,
  128. jsApiList: [ // 所有要调用的 API 都要加到这个列表中
  129. "onMenuShareAppMessage",
  130. "onMenuShareTimeline",
  131. "onMenuShareQQ",
  132. "onMenuShareQZone",
  133. "scanQRCode",
  134. ]
  135. });
  136. wx.ready(function() {
  137. // 在这里调用 API
  138. wx.onMenuShareAppMessage({ //分享给朋友
  139. title: shareTitle, // 分享标题
  140. desc: descContent, // 分享描述
  141. link: lineLink, // 分享链接
  142. imgUrl: imgUrl, // 分享图标
  143. success: share_success_callback,
  144. cancel: share_cancel_callback
  145. });
  146. wx.onMenuShareTimeline({ //分享到朋友圈
  147. title: shareTitle, // 分享标题
  148. desc: descContent, // 分享描述
  149. link: lineLink, // 分享链接
  150. imgUrl: imgUrl, // 分享图标
  151. success: share_success_callback,
  152. cancel: share_cancel_callback
  153. });
  154. wx.onMenuShareQQ({ //分享到QQ
  155. title: shareTitle, // 分享标题
  156. desc: descContent, // 分享描述
  157. link: lineLink, // 分享链接
  158. imgUrl: imgUrl, // 分享图标
  159. success: share_success_callback,
  160. cancel: share_cancel_callback
  161. });
  162. wx.onMenuShareQZone({ //分享到QQ空间
  163. title: shareTitle, // 分享标题
  164. desc: descContent, // 分享描述
  165. link: lineLink, // 分享链接
  166. imgUrl: imgUrl, // 分享图标
  167. success: share_success_callback,
  168. cancel: share_cancel_callback
  169. });
  170. });
  171. //分享成功后的回调函数
  172. function share_success_callback() {}
  173. //用户取消分享后执行的回调函数
  174. function share_cancel_callback() {}
  175. }
  176. }
  177. });
  178. }
  179. function wlog(dt, id, src) {
  180. var src = src || "1";
  181. $.ajax({
  182. url: "http://www.ekexiu.com:8082/log/jsonp/log",
  183. data: {
  184. "id": id,
  185. "src": src,
  186. "__lt": dt,
  187. },
  188. success:function(data) {
  189. },
  190. dataType: "jsonp"
  191. });
  192. }