网站
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 2.5 KiB

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