123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117 |
- 'use strict';
- var app = angular.module('app', [
- 'angularUtils.directives.dirPagination',
- ]);
- app.controller("indexCtrl", ["$scope", "$http", "$interval", "$timeout", "$sce", function ($scope, $http, $interval, $timeout, $sce) {
- var self = this;
- self.userId = $.cookie("GlWorkPlatform-userid");
- self.userName = $.cookie("GlWorkPlatform-username");
- self.userChineseName = $.cookie("GlWorkPlatform-chineseName")
- self.get_AccessToken = localStorage.getItem("GlWorkPlatform-AccessToken");
- var postCfg = {
- headers: {
- 'Content-Type': 'application/json',
- 'Authorization': "Bearer " + self.get_AccessToken
- }
- };
- /*新闻*/
- self.getDataImg = function () {
- var data = {
- tablename: "WJFB_TPXW",
- pagesize: 10,
- pageno: 1,
- colums: "ID,BT,FBRQ,IMAGEDATA",
- order: "ID",
- sqlwhere: { FBZT: "1" },
- sqlorwhere: "",
- sqlinwhere: "",
- sqllikewhere: ""
- };
- $http.post(apiurljs.login + "g2app/dataabase/queryDataByColWithPage", data, postCfg)
- .success(function (obj) {
- //var res = strToJson(s4.decryptData_CBC(obj.data));
- var res = obj;
- self.newsImg = res.data;
- console.log(self.newsImg)
- $.each(self.newsImg, function (index, item) {
- if (item.IMAGEDATA != "[]" && item.IMAGEDATA != "") {
- item.FILEURL1 = $sce.trustAsResourceUrl(apiurljs.login + "g2work" + JSON.parse(item.IMAGEDATA)[0].FILEURL)
- } else {
- item.FILEURL1 = $sce.trustAsResourceUrl(apiurljs.login + "g2work" + JSON.parse(item.IMAGESDATA)[0].FILEURL)
- }
- })
- if (self.newsImg.length > 1) {
- $timeout(function () {
- var swiper = new Swiper('.swiper-container', {
- loop: true,
- autoplay: {
- delay: 2000,
- disableOnInteraction: false,
- },
- slidesPerView: 1,
- centeredSlides: true,
- pagination: {
- el: '.swiper-pagination',
- clickable: true,
- }
- })
- }, 1)
- }
- })
- }
- self.getDataImg()
- $timeout(function () {
- var swiper = new Swiper('.swiper-container', {
- loop: true,
- autoplay: {
- delay: 3000,
- disableOnInteraction: false,
- },
- slidesPerView: 1,
- centeredSlides: true,
- spaceBetween: 30,
- pagination: {
- el: '.swiper-pagination',
- clickable: true,
- }
- })
- }, 1)
- $('#newsList').settabs({
- event: 'click'
- });
- self.check = 1;
- self.getData = function () {
- var sqlwhere = "", TABLENAME = "", BT = "";
- switch (self.check) {
- case 1: sqlwhere = { GGBK: "C03", FBZT: "1" }; BT = "GGBT,FBSJ"; TABLENAME = "SX_TZGG"; break;
- case 2: sqlwhere = { LX: "C04", FBZT: "1" }; BT = "WJBT,FBRQ"; TABLENAME = "WJFB_CB"; break;
- case 3: sqlwhere = { LX: "C12", FBZT: "1" }; BT = "WJBT,FBRQ"; TABLENAME = "WJFB_CB"; break;
- }
- var data = {
- tablename: TABLENAME,
- pagesize: 7,
- pageno: 1,
- colums: "ID," + BT,
- order: "ID",
- sqlwhere: sqlwhere,
- sqlorwhere: "",
- sqlinwhere: "",
- sqllikewhere: ""
- };
- $http.post(apiurljs.login + "g2app/dataabase/queryDataByColWithPage", data, postCfg)
- .success(function (obj) {
- //var res = strToJson(s4.decryptData_CBC(obj.data));
- var res = obj;
- self.list = res.data;
- self.list.forEach(function (item) {
- item.BT = item.WJBT ? item.WJBT : item.GGBT;
- })
- })
- }
- self.getData()
- }])
|