网站
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.
 
 
 

69 rivejä
2.1 KiB

  1. /**
  2. * Created by Administrator on 2021/4/5.
  3. */
  4. define(['jquery', "template", "Tools"], function ($, template, Tools) {
  5. //数据存储
  6. var module = {
  7. data: {
  8. //服务器地址
  9. serverApi:'',
  10. //焦点图数据
  11. focusList: [],
  12. communicateList: [],
  13. },
  14. };
  15. var tools = new Tools();
  16. module.init = function (page) {
  17. //新闻详情
  18. tools.doGet(newsDetail+getQueryVariable('id'), {}, module.newsDetail , true);
  19. //新闻列表
  20. tools.doGet(newsList, {pageNum:1,pageSize:8}, module.newsList , true);
  21. tools.doGet(webList, {}, module.webList , true);
  22. };
  23. //获取地址栏参数
  24. function getQueryVariable(variable){
  25. var query = window.location.search.substring(1);
  26. var vars = query.split("&");
  27. for (var i=0;i<vars.length;i++) {
  28. var pair = vars[i].split("=");
  29. if(pair[0] == variable){return pair[1];}
  30. }
  31. return(false);
  32. }
  33. module.webList = function (data) {
  34. if (data.code == 200) {
  35. var content = data.data;
  36. module.data.webList = content;
  37. var webData = template('webData', module.data);
  38. $("#webContent").html(webData);
  39. var titData = template('titData', module.data);
  40. $("#titContent").html(titData);
  41. $('#ewm').attr('src', 'static/images/'+content.top.bz);
  42. }
  43. }
  44. module.newsDetail = function (data) {
  45. if (data.code == 200) {
  46. var content = data.data;
  47. $('#content')[0].innerHTML = content.infoContent
  48. $('#name')[0].innerHTML = content.infoName
  49. $('#creatBy')[0].innerHTML = content.infoDept+' 的报道'
  50. $('#creatTime')[0].innerHTML = '&nbsp;·&nbsp;'+content.infoTime
  51. }
  52. }
  53. module.newsList = function (data) {
  54. if (data.code == 200) {
  55. var content = data.rows;
  56. module.data.newList = content;
  57. var newListData = template('newListData', module.data);
  58. $("#newListContent").html(newListData);
  59. }
  60. }
  61. return module;
  62. });