|
- /**
- * Created by Administrator on 2021/4/5.
- */
- define(['jquery', "template", "Tools"], function ($, template, Tools) {
- //数据存储
- var module = {
- data: {
- //服务器地址
- serverApi:'',
- //焦点图数据
- focusList: [],
- communicateList: [],
- },
- };
- var tools = new Tools();
-
- module.init = function (page) {
- //新闻详情
- tools.doGet(majorEventPublicDetail, {
- id:getQueryVariable('id'),
- bookId: JSON.parse(tools.getCookie('user')).bookId,
- deptId: JSON.parse(tools.getCookie('user')).deptId
- }, module.newsDetail , true);
- //新闻列表
- tools.doGet(majorEventPublicList, {
- pageNum:1,
- pageSize:10,
- orderByColumn: 'openNy',
- isAsc: 'desc',
- bookId: JSON.parse(tools.getCookie('user')).bookId,
- deptId: JSON.parse(tools.getCookie('user')).deptId
- }, module.newsList , true);
- tools.doGet(webList, {}, module.webList , true);
- };
-
- //获取地址栏参数
- function getQueryVariable(variable){
- var query = window.location.search.substring(1);
- var vars = query.split("&");
- for (var i=0;i<vars.length;i++) {
- var pair = vars[i].split("=");
- if(pair[0] == variable){return pair[1];}
- }
- return(false);
- }
-
- module.webList = function (data) {
- if (data.code == 200) {
- var content = data.data;
- module.data.webList = content;
- var webData = template('webData', module.data);
- $("#webContent").html(webData);
- $('#ewm').attr('src', 'static/images/'+content.top.bz);
- }
- }
-
- module.newsDetail = function (data) {
- if (data.code == 200) {
- var content = data.data;
- $('#openName')[0].innerHTML = content.openName;
- $('#openNy')[0].innerHTML = '公开年月:'+content.openNy;
-
- $('#openPic')[0].innerHTML = '公开图片:<br/>';
-
- if (content.openPic){
- let arr = content.openPic.split(',');
- for (let i = 0;i < arr.length; i++){
- $('#openPic')[0].innerHTML += '<img src="/api'+arr[i]+'" style="width: 200px;height: 150px;margin-right: 10px;">';
- }
- }
-
- $('#openFile')[0].innerHTML = '附件:<br/>';
-
- if (content.openFile){
- let arr2 = content.openFile.split(',');
- for (let i = 0;i < arr2.length; i++){
- $('#openFile')[0].innerHTML += '<a href="/api'+arr2[i]+'">';
- }
- }
-
- $('#content')[0].innerHTML = '内容:'+content.content;
- $('#remark')[0].innerHTML = '备注:'+content.remark;
-
- }
- }
-
- module.newsList = function (data) {
- if (data.code == 200) {
- var content = data.rows;
- module.data.newList = content;
- var newListData = template('newListData', module.data);
- $("#newListContent").html(newListData);
- }
- }
-
- return module;
- });
|