农燊高科官方网站
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

newDetail.js 1.8 KiB

3 年之前
4 年之前
3 年之前
3 年之前
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. /**
  2. * Created by Administrator on 2021/4/5.
  3. */
  4. define(['jquery', "template", "Tools", "newApi"], function ($, template, Tools ) {
  5. //数据存储
  6. var module = {
  7. data: {
  8. newsInformationList:''
  9. },
  10. };
  11. var tools = new Tools();
  12. module.init = function (page) {
  13. //底部友情链接
  14. tools.doGet(friendsLinks, {}, module.bottomFriendsLinks, true);
  15. //console.log(getQueryVariable('id'))
  16. //新闻资讯
  17. tools.doGet(newDetail + '/'+getQueryVariable('id'), {}, module.NewsInformation,true);
  18. //网站配置信息(网站名称 底部联系方式 公安备案号 网站备案号)
  19. tools.getWebConfig();
  20. };
  21. //底部友情链接
  22. module.bottomFriendsLinks = function (data) {
  23. if (data.code == 200) {
  24. var content = data.data;
  25. //console.log(content)
  26. module.data.friendsLinksList = content;
  27. var friendsLinksData = template('friendsLinksData', module.data);
  28. $("#friendsLinksContent").html(friendsLinksData);
  29. }
  30. }
  31. //获取地址栏参数
  32. function getQueryVariable(variable){
  33. var query = window.location.search.substring(1);
  34. var vars = query.split("&");
  35. for (var i=0;i<vars.length;i++) {
  36. var pair = vars[i].split("=");
  37. if(pair[0] == variable){return pair[1];}
  38. }
  39. return(false);
  40. }
  41. //新闻资讯数据
  42. module.NewsInformation = function (data) {
  43. //console.log(data)
  44. if (data.code == 200) {
  45. var content = data.data;
  46. $("#newTitle").html(content.title);
  47. $("#newTime").html(content.newsTime);
  48. $("#newCome").html(content.createBy);
  49. $("#newContent").html(content.content);
  50. }
  51. }
  52. return module;
  53. });