resource_page.html 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330
  1. <!DOCTYPE html>
  2. <html>
  3. <head lang="en">
  4. <meta http-equiv="content-Type" content="text/html;charset=UTF-8" />
  5. <meta http-equiv="Access-Control-Allow-Origin" content="*" />
  6. <meta name="keywords" content="<?php echo $keywords ?>">
  7. <meta name="description" content="<?php echo $describe ?>">
  8. <title><?php echo $title ?></title>
  9. <link rel="stylesheet" href="official/css/main.css" />
  10. <link rel="stylesheet" href="official/css/resource.css" />
  11. </head>
  12. <body>
  13. <div id="app">
  14. <div class="nav">
  15. <div class="nav-a">
  16. <div class="nav-logo">
  17. <img src="<?php echo $top['logo']?>" alt="" />
  18. </div>
  19. <?php foreach($top['navigation'] as $kk=>$vv) {?>
  20. <a href="<?php echo $vv['url']?>">
  21. <div class="nav-li <?php if($vv[tool]==$name){?>nav-selected<?php }?>">
  22. <?php echo $vv['name']?>
  23. </div>
  24. </a>
  25. <?php }?>
  26. <?php if ($top['is_sign'] == 1) {?>
  27. <a href="#" id="jump-url">
  28. <div class="nav-login">立即登录</div>
  29. </a>
  30. <?php }?>
  31. </div>
  32. </div>
  33. <?php echo $content;?>
  34. <?php echo $tail;?>
  35. <div class="all-relation">
  36. <div class="relation-btn" id="relation-btn">
  37. <div class="relation-btn-one" id="callus">
  38. <img src="official/images/lianxikefu.png" alt="">
  39. <div>联系客服</div>
  40. </div>
  41. <div class="relation-btn-one" id="back-top">
  42. <img src="official/images/huidaodingbu.png" alt="">
  43. <div>回到顶部</div>
  44. </div>
  45. </div>
  46. <div class="relation">
  47. <div class="relation-title">在线咨询</div>
  48. <a href="<?php echo $basic['cus_link']?>" title="点击咨询">
  49. <div class="relation-tel">
  50. <div class="relation-tel-img">
  51. <img src="official/images/suspension_qq.png" alt="" />
  52. </div>
  53. <div class="relation-tel-word">在线客服</div>
  54. </div>
  55. </a>
  56. <div class="relation-tel">
  57. <div class="relation-tel-img">
  58. <img src="official/images/suspension_tel.png" alt="" />
  59. </div>
  60. <div class="relation-tel-word"><?php echo $basic['cus_mobile']?></div>
  61. </div>
  62. <div class="relation-tel relation-tel1">
  63. <div class="relation-tel-img">
  64. <img src="official/images/suspension_wechat.png" alt="" />
  65. </div>
  66. <div class="relation-tel-word">微信二维码</div>
  67. </div>
  68. <div class="qr-img">
  69. <div class="qr-img"><img src="<?php echo $basic['cus_url']?>" alt="" /></div>
  70. </div>
  71. <img id="close-btn" src="official/images/adsystem_icon_cancle.png" alt="">
  72. </div>
  73. </div>
  74. </div>
  75. <script>
  76. var article_list = [];
  77. var category_list = <?php echo json_encode($article); ?>;
  78. var problem_list = <?php echo json_encode($help); ?>;
  79. var category_index = 0;
  80. var article_index = 0;
  81. var nav_index = 1;
  82. var problem_index = 0;
  83. window.onload = function () {
  84. url = window.location.protocol + "//" + window.location.host + "/admin.html";
  85. if(document.getElementById("jump-url")) {
  86. document.getElementById("jump-url").setAttribute("href", url);
  87. }
  88. // 二级导航切换
  89. for (let i = 1; i < 4; i++) {
  90. document.getElementById("sec-nav-one" + i).onclick = function (e) {
  91. if (i == nav_index) {
  92. return;
  93. }
  94. e.currentTarget.style.color = "#00a2ff";
  95. document.getElementById("sec-nav-one" + nav_index).style.color =
  96. "#666";
  97. document.getElementById("tab" + i).style.display = "block";
  98. document.getElementById("tab" + nav_index).style.display = "none";
  99. nav_index = i;
  100. };
  101. }
  102. // 分类列表
  103. for (let i = 1; i <= category_list.length; i++) {
  104. let ids = document.getElementById("category_ul");
  105. let div1 = document.createElement("div");
  106. div1.classList.add("rticle-one-col");
  107. div1.setAttribute("id", "rticle-one-col" + i);
  108. ids.appendChild(div1);
  109. let div2 = document.createElement("div");
  110. div2.classList.add("rticle-one-col-word");
  111. div2.setAttribute("id", "rticle-one-col-word" + i);
  112. document.getElementById("rticle-one-col" + i).appendChild(div2);
  113. let text1 = document.createTextNode(category_list[i - 1].name);
  114. document.getElementById("rticle-one-col-word" + i).appendChild(text1);
  115. let div3 = document.createElement("div");
  116. div3.classList.add("rticle-one-col-icon");
  117. div3.setAttribute("id", "rticle-one-col-icon" + i);
  118. document.getElementById("rticle-one-col" + i).appendChild(div3);
  119. let text2 = document.createTextNode(">");
  120. document.getElementById("rticle-one-col-icon" + i).appendChild(text2);
  121. }
  122. if (category_list.length > 0) {
  123. category_index = 1;
  124. document.getElementById(
  125. "rticle-one-col" + category_index
  126. ).style.color = "#00a2ff";
  127. document.getElementById("category_name1").innerHTML =
  128. category_list[category_index - 1].name;
  129. document.getElementById("category_name2").innerHTML =
  130. category_list[category_index - 1].name;
  131. article_list = category_list[category_index - 1].datas
  132. }
  133. // 文章列表
  134. getArticle();
  135. // 绑定分类切换事件
  136. var cat_list = document.getElementsByClassName("rticle-one-col");
  137. for (let i = 1; i <= cat_list.length; i++) {
  138. cat_list[i - 1].onclick = function (e) {
  139. if (category_index == i) {
  140. return;
  141. }
  142. article_index = 0;
  143. e.currentTarget.style.color = "#00a2ff";
  144. document.getElementById(
  145. "rticle-one-col" + category_index
  146. ).style.color = "#000";
  147. // 请求文章数据
  148. article_list = category_list[i - 1].datas;
  149. getArticle();
  150. document.getElementById("category_name1").innerHTML =
  151. category_list[i - 1].name;
  152. document.getElementById("category_name2").innerHTML =
  153. category_list[i - 1].name;
  154. category_index = i;
  155. };
  156. }
  157. // 搜索
  158. document.getElementById("search-btn").onclick = function (e) {
  159. let val=document.getElementById('search-input').value;
  160. let arr = [];
  161. problem_list.forEach((item,index) =>{
  162. if(item.title.indexOf(val) != -1) {
  163. console.log(item.title)
  164. arr.push(item);
  165. }
  166. });
  167. getProblem(arr);
  168. };
  169. // 问题列表
  170. getProblem();
  171. document.getElementById("callus").onclick = function(e) {
  172. document.getElementById("relation-btn").style.display="none";
  173. document.getElementsByClassName("all-relation")[0].classList.add("all-relation-hover")
  174. }
  175. document.getElementById("close-btn").onclick = function(e) {
  176. document.getElementById("relation-btn").style.display="inline-block";
  177. document.getElementsByClassName("all-relation")[0].classList.remove("all-relation-hover")
  178. }
  179. var scrollTop = document.documentElement.scrollTop || document.body.scrollTop;
  180. if(scrollTop>0) {
  181. document.getElementById("back-top").style.display = 'block'
  182. }
  183. else{
  184. document.getElementById("back-top").style.display = 'none'
  185. }
  186. document.getElementById("back-top").onclick = function(e) {
  187. if(document.documentElement.scrollTop) {
  188. document.documentElement.scrollTop = 0;
  189. }
  190. else{
  191. document.body.scrollTop = 0;
  192. }
  193. }
  194. window.onscroll = function() {
  195. var scrollTop = document.documentElement.scrollTop || document.body.scrollTop;
  196. if(scrollTop>0) {
  197. document.getElementById("back-top").style.display = 'block'
  198. }
  199. else{
  200. document.getElementById("back-top").style.display = 'none'
  201. }
  202. }
  203. };
  204. function getArticle() {
  205. // 文章列表
  206. // 先清空子节点
  207. let id = document.getElementById("article-ul");
  208. while(id.hasChildNodes()) {
  209. id.removeChild(id.firstChild);
  210. }
  211. // 赋值
  212. for (let i = 1; i <= article_list.length; i++) {
  213. let ids = document.getElementById("article-ul");
  214. let div7 = document.createElement("a");
  215. div7.setAttribute("id", "article-a" + i);
  216. div7.setAttribute("href", article_list[i-1].url);
  217. ids.appendChild(div7);
  218. let div0 = document.createElement("div");
  219. div0.classList.add("article-two-li");
  220. div0.setAttribute("id", "article-two-li" + i);
  221. document.getElementById("article-a"+i).appendChild(div0);
  222. let div1 = document.createElement("div");
  223. div1.classList.add("article-two-left");
  224. div1.setAttribute("id", "article-two-left" + i);
  225. document.getElementById("article-two-li" + i).appendChild(div1);
  226. let div2 = document.createElement("img");
  227. div2.setAttribute("src", article_list[i - 1].img);
  228. document.getElementById("article-two-left" + i).appendChild(div2);
  229. let div3 = document.createElement("div");
  230. div3.classList.add("article-two-right");
  231. div3.setAttribute("id", "article-two-right" + i);
  232. document.getElementById("article-two-li" + i).appendChild(div3);
  233. let div4 = document.createElement("div");
  234. div4.classList.add("article-two-right-title");
  235. div4.innerHTML = article_list[i - 1].title;
  236. document.getElementById("article-two-right" + i).appendChild(div4);
  237. let div5 = document.createElement("div");
  238. div5.classList.add("article-two-right-content");
  239. div5.innerHTML = article_list[i - 1].content;
  240. document.getElementById("article-two-right" + i).appendChild(div5);
  241. let div6 = document.createElement("div");
  242. div6.classList.add("article-two-right-tip");
  243. div6.innerHTML =
  244. `<div class="article-author">` +
  245. article_list[i - 1].author +
  246. `</div>
  247. <div class="article-time">` +
  248. article_list[i - 1].created_at +
  249. `</div>`;
  250. document.getElementById("article-two-right" + i).appendChild(div6);
  251. }
  252. }
  253. function getProblem(arr) {
  254. // 问题列表
  255. if(!arr) {
  256. arr = problem_list
  257. }
  258. problem_index = 0;
  259. // 先清空子节点
  260. let id = document.getElementById("problem-con");
  261. while(id.hasChildNodes()) {
  262. id.removeChild(id.firstChild);
  263. }
  264. for (let i = 1; i <= arr.length; i++) {
  265. let ids = document.getElementById("problem-con");
  266. let div1 = document.createElement("div");
  267. div1.classList.add("problem-li");
  268. div1.setAttribute("id", "problem-li" + i);
  269. div1.innerHTML =
  270. `<div class="problem-title" id="problem-title` +
  271. i +
  272. `">` +
  273. arr[i - 1].title +
  274. `</div>
  275. <div class="problem-detail" id="problem-detail` +
  276. i +
  277. `" style="display:none">` +
  278. arr[i - 1].content +
  279. `</div>`;
  280. ids.appendChild(div1);
  281. // 点击事件
  282. document.getElementById("problem-title" + i).onclick = function () {
  283. if (i == problem_index) {
  284. document.getElementById(
  285. "problem-detail" + problem_index
  286. ).style.display = "none";
  287. problem_index = 0;
  288. return;
  289. }
  290. document.getElementById("problem-detail" + i).style.display =
  291. "block";
  292. if (problem_index != 0) {
  293. document.getElementById(
  294. "problem-detail" + problem_index
  295. ).style.display = "none";
  296. }
  297. problem_index = i;
  298. };
  299. }
  300. }
  301. </script>
  302. </body>
  303. </html>