portal html css js resource

wen.html 12KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <meta charset="UTF-8">
  5. <title>问题分享-科袖网</title>
  6. <meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
  7. <link rel="stylesheet" href="../css/zoomify.min.css">
  8. <link rel="stylesheet" href="../css/common.css" />
  9. <link rel="stylesheet" href="../css/share.css" />
  10. <script type="text/javascript" src="../js/jquery-1.11.1.js"></script>
  11. <script type="text/javascript" src="../js/public/zoomify.js"></script>
  12. <script type="text/javascript" src="http://res.wx.qq.com/open/js/jweixin-1.0.0.js"></script>
  13. <script type="text/javascript" src="../js/public/baseUtil.js"></script>
  14. <script type="text/javascript" src="../js/public/shareCom.js"></script>
  15. <script type="text/javascript" src="../js/public/openApp.js"></script>
  16. <style>
  17. html,
  18. body {
  19. margin: 0;
  20. padding: 0px;
  21. background: #F4F6F8;
  22. }
  23. </style>
  24. </head>
  25. <body>
  26. <div class="contentBody2">
  27. <div class="list-main scroll-view">
  28. <section class="list_content clearfix">
  29. <ul class="tagList"></ul>
  30. <div class="item_detail" id="questionId">
  31. <h3 class="h1Font" id="questionTit"></h3>
  32. <div class="list_con" id="questionCnt"></div>
  33. <ul class="list_image clearfix"><li><span class="imgspan"></span></li></ul>
  34. <div class="item_info">
  35. <span class="time h3Font" id="questionTime"></span>
  36. </div>
  37. </div>
  38. <ul class="item-btn clearfix">
  39. <li class="go-answer"><span>回答</span></li>
  40. <li class="invite-answer"><span>邀请回答</span></li>
  41. <li class="collectBtn"><span class="iconfontnew icon-shoucang"></span></li>
  42. </ul>
  43. </section>
  44. <section class="list-hold">
  45. <div class="list-hold-count">
  46. <span>全部 <em id="replyCount"></em> 个回答</span>
  47. <ul>
  48. <li class="active" data-type="1"><span>默认</span></li>
  49. <li data-type="2"><span>最新</span></li>
  50. </ul>
  51. </div>
  52. <ul class="mui-table-view myAllneeds partLine" id="curAnswers">
  53. </ul>
  54. </section>
  55. </div>
  56. <div class="shareEcode">
  57. <img class="Ecodecon" src="../images/ecordCard.jpg" />
  58. <div class="Ecodeinfo">
  59. <a href="http://a.app.qq.com/o/simple.jsp?pkgname=com.ekexiu.app"><button class="frmbtn frmactive">下载移动客户端</button></a>
  60. </div>
  61. </div>
  62. </div>
  63. <script type="text/javascript">
  64. $(document).ready(function() {
  65. var imgUrl = "http://www.ekexiu.com/images/logo180.png",
  66. lineLink = document.location.href,
  67. descContent = "",
  68. shareTitle,
  69. appid = '';
  70. var questionId = GetQueryString("id");
  71. wlog("question",questionId,'3');
  72. pageViewLog(questionId,8);
  73. var rows = 5,
  74. dataO = {
  75. time: "",
  76. id: "",
  77. score: "",
  78. agree:""
  79. };
  80. var pkey = [],
  81. byway;
  82. var oAjax = function(url, dataS, otype, oFun) {
  83. $.ajax({
  84. url: url,
  85. dataType: 'json',
  86. type: otype,
  87. data: dataS,
  88. success: function(res) {
  89. if(res.success) {
  90. oFun(res)
  91. }
  92. }
  93. });
  94. },
  95. getConmain = function() {
  96. oAjax('/ajax/question/qo', {
  97. "id": questionId
  98. }, "get", function(res) {
  99. var $da = res.data
  100. document.getElementById("questionId").setAttribute("data-id", $da.id);
  101. document.getElementById("questionTit").innerHTML = $da.title;
  102. document.getElementById("questionTime").innerHTML = commenTime($da.createTime);
  103. document.getElementById("replyCount").innerHTML = $da.replyCount;
  104. if($da.cnt) {
  105. document.getElementById("questionCnt").innerHTML = ($da.cnt).replace(/\n/g,"<br />");
  106. descContent = document.getElementById("questionCnt").innerHTML.substr(0, 70);
  107. }
  108. shareTitle = $da.title;
  109. document.title = $da.title;
  110. if($da.keys != undefined && $da.keys.length != 0) {
  111. var subs=strToAry($da.keys)
  112. var pstr = ""
  113. if(subs.length > 0) {
  114. for(var i = 0; i < subs.length; i++) {
  115. pstr += '<li><span class="h2Font">' + subs[i] + '</span></li>'
  116. };
  117. document.getElementsByClassName("tagList")[0].innerHTML = pstr;
  118. } else {
  119. document.getElementsByClassName("tagList")[0].style.display = "none";
  120. }
  121. }
  122. if($da.img) {
  123. var subs=strToAry($da.img)
  124. var pstr = ""
  125. if(subs.length > 0) {
  126. for(var i = 0; i < subs.length; i++) {
  127. var imgu= "/data/question"+subs[i]
  128. pstr += '<li><span class="imgspan" style="background-image: url('+imgu+');"><img src="'+imgu+'" data-preview-src="" /></span></li>'
  129. };
  130. document.getElementsByClassName("list_image")[0].style.display = "block";
  131. document.getElementsByClassName("list_image")[0].innerHTML = pstr;
  132. }
  133. $('.list_image img').zoomify();
  134. imgUrl = "http://www.ekexiu.com/data/question" + subs[0].replace(/\.(jpg|jpeg|png)$/,"_s.jpg");
  135. }
  136. })
  137. },
  138. answerList = function() {
  139. var byway = document.querySelector('.list-hold-count>ul').querySelector("li.active").getAttribute("data-type");
  140. var typeurl, dataStr = {};
  141. if(byway == 1) {
  142. typeurl = "/ajax/question/answer/qes/byScore"
  143. dataStr = {
  144. "qid": questionId,
  145. "score": dataO.score,
  146. "agree":dataO.agree,
  147. "id": dataO.id,
  148. "rows": rows
  149. }
  150. } else if(byway == 2) {
  151. typeurl = "/ajax/question/answer/qes/byTime"
  152. dataStr = {
  153. "qid": questionId,
  154. "time": dataO.time,
  155. "id": dataO.id,
  156. "rows": rows
  157. }
  158. }
  159. oAjax(typeurl, dataStr, "get", function(res) {
  160. var aimId = "curAnswers",
  161. newStr = "暂无回答"
  162. var $info = res.data;
  163. if($info.length > 0) {
  164. for(var i = 0; i < $info.length; i++) {
  165. var liStr = document.createElement("li");
  166. liStr.className = "mui-table-view-cell";
  167. liStr.setAttribute("data-id", $info[i].id);
  168. document.getElementById(aimId).appendChild(liStr);
  169. answerModule($info[i], liStr);
  170. }
  171. }
  172. var liLen=document.getElementById(aimId).querySelectorAll("li").length;
  173. removeAfter(aimId);
  174. if($info.length == 0 && liLen == 0 ){
  175. insertAfter(newStr,aimId);
  176. }
  177. })
  178. },
  179. insertAfter = function (newStr, targetE) {
  180. var parent = document.getElementById(targetE).parentNode;
  181. var kong = document.createElement("div");
  182. kong.className = "con-kong";
  183. kong.innerHTML = newStr;
  184. if (parent.firstChild.className == "con-kong") {
  185. return
  186. } else {
  187. parent.insertBefore(kong,parent.firstChild);
  188. }
  189. },
  190. removeAfter = function (targetE) {
  191. var parent = document.getElementById(targetE).parentNode;
  192. console.log(parent.firstChild.className);
  193. if (parent.firstChild.className == "con-kong") {
  194. parent.removeChild(parent.firstChild);
  195. } else {
  196. return
  197. }
  198. },
  199. answerModule = function(dataStr, liStr) {
  200. var hd = "",
  201. hl = "";
  202. if(dataStr.agree > 0) {
  203. hd = '<span>赞 ' + dataStr.agree + '</span>'
  204. }
  205. liStr.setAttribute("data-id", dataStr.id);
  206. liStr.className = "mui-table-view-cell";
  207. liStr.innerHTML = '<div class="madiaInfo">' +
  208. '<div class="flexCenter qa-owner"></div>' +
  209. '<div class="qa-con mui-ellipsis-5">' + listConCut(dataStr.cnt) + '</div>' +
  210. '<div class="showliSpan mui-ellipsis">' +
  211. '<span>' + commenTime(dataStr.createTime) + '</span>' + hd + '<span class="leaveMsgCount"></span>' +
  212. '</div>' +
  213. '</div>'
  214. var $str = $(liStr)
  215. proinfo(dataStr.uid, $str);
  216. leaveMsgCount(dataStr.id,4, $str);
  217. },
  218. proinfo = function(pid, $str) {
  219. oAjax("/ajax/professor/baseInfo/" + pid, {}, "get", function(res) {
  220. var dataStr = res.data
  221. var baImg = "../images/default-photo.jpg";
  222. if(dataStr.hasHeadImage == 1) {
  223. baImg = "/images/head/" + dataStr.id + "_l.jpg";
  224. }
  225. var userType = autho(dataStr.authType, dataStr.orgAuth, dataStr.authStatus);
  226. var os = "";
  227. if(dataStr.title) {
  228. if(dataStr.orgName) {
  229. os = dataStr.title + "," + dataStr.orgName;
  230. } else {
  231. os = dataStr.title;
  232. }
  233. } else {
  234. if(dataStr.office) {
  235. if(dataStr.orgName) {
  236. os = dataStr.office + "," + dataStr.orgName;
  237. } else {
  238. os = dataStr.office;
  239. }
  240. } else {
  241. if(dataStr.orgName) {
  242. os = dataStr.orgName;
  243. }
  244. }
  245. }
  246. var styStr='<em class="authiconNew ' + userType.sty + '" title="' + userType.title + '"></em>'
  247. if(userType.sty=="e"){
  248. styStr=""
  249. }
  250. var str = '<div class="owner-head useHead" style="background-image:url(' + baImg + ')"></div>' +
  251. '<div class="owner-info">' +
  252. '<div class="owner-name"><span class="h1Font">' + dataStr.name + '</span>'+styStr+'</div>' +
  253. '<div class="owner-tit ellipsisSty h2Font">' + os + '</div>' +
  254. '</div>'
  255. $str.find(".qa-owner").html(str);
  256. });
  257. }
  258. getConmain();
  259. answerList();
  260. var this_ = "../html/qa-question-show.html?quid=" + questionId;
  261. wcFresh(this_);
  262. $(".list-main").on("click", "ul.item-btn", function() {
  263. isInstalled(this_, true);
  264. $(this).addClass("activeThis");
  265. })
  266. $(".list-hold-count>ul").on('click', 'li', function(e) {
  267. var sortlist = document.querySelector('.list-hold-count>ul').querySelectorAll("li");
  268. for(var i = 0; i < sortlist.length; i++) {
  269. sortlist[i].classList.remove('active');
  270. }
  271. this.classList.add('active');
  272. byway = this.getAttribute("data-type");
  273. document.getElementById("curAnswers").innerHTML = "";
  274. dataO = {
  275. time: "",
  276. id: "",
  277. score: "",
  278. agree:""
  279. }
  280. answerList()
  281. });
  282. $("#curAnswers").on("click", "li", function() {
  283. var id = this.getAttribute("data-id");
  284. location.href = "http://" + window.location.host + "/e/da.html?id=" + id;
  285. })
  286. /*微信分享*/
  287. $.ajax({
  288. url: "../ajax/weixin/jsapiTicket",
  289. type: 'get',
  290. dataType: 'json',
  291. contentType: "application/x-www-form-urlencoded; charset=utf-8",
  292. data: {
  293. 'url': location.href.split('#')[0]
  294. },
  295. success: function(data) {
  296. if(data.data) {
  297. wx.config({
  298. debug: false, //调试模式好犀利
  299. appId: data.data.appId,
  300. timestamp: data.data.timestamp,
  301. nonceStr: data.data.nonceStr,
  302. signature: data.data.signature,
  303. jsApiList: [ // 所有要调用的 API 都要加到这个列表中
  304. "onMenuShareAppMessage",
  305. "onMenuShareTimeline",
  306. "onMenuShareQQ",
  307. "onMenuShareQZone",
  308. "scanQRCode",
  309. ]
  310. });
  311. wx.ready(function() {
  312. // 在这里调用 API
  313. wx.onMenuShareAppMessage({ //分享给朋友
  314. title: shareTitle, // 分享标题
  315. desc: descContent, // 分享描述
  316. link: lineLink, // 分享链接
  317. imgUrl: imgUrl, // 分享图标
  318. success: share_success_callback,
  319. cancel: share_cancel_callback
  320. });
  321. wx.onMenuShareTimeline({ //分享到朋友圈
  322. title: shareTitle, // 分享标题
  323. desc: descContent, // 分享描述
  324. link: lineLink, // 分享链接
  325. imgUrl: imgUrl, // 分享图标
  326. success: share_success_callback,
  327. cancel: share_cancel_callback
  328. });
  329. wx.onMenuShareQQ({ //分享到QQ
  330. title: shareTitle, // 分享标题
  331. desc: descContent, // 分享描述
  332. link: lineLink, // 分享链接
  333. imgUrl: imgUrl, // 分享图标
  334. success: share_success_callback,
  335. cancel: share_cancel_callback
  336. });
  337. wx.onMenuShareQZone({ //分享到QQ空间
  338. title: shareTitle, // 分享标题
  339. desc: descContent, // 分享描述
  340. link: lineLink, // 分享链接
  341. imgUrl: imgUrl, // 分享图标
  342. success: share_success_callback,
  343. cancel: share_cancel_callback
  344. });
  345. });
  346. //分享成功后的回调函数
  347. function share_success_callback() {}
  348. //用户取消分享后执行的回调函数
  349. function share_cancel_callback() {}
  350. }
  351. }
  352. });
  353. })
  354. </script>
  355. </body>
  356. </html>