|
- // JavaScript Document localStorage
- var skinLink = $('#skinLink');
- var skins = localStorage.getItem('skinLink');
- skins ? skinLink.attr('href', '/Content/css/DragSSO/' + skins + '.css') : '';
- $(document).ready(function () {
- if (skins) {
- skinLink.attr('href', '/Content/css/DragSSO/' + skins + '.css');
- $('.skins[skin="' + skins + '"]').addClass('active').siblings().removeClass('active');
- }
- var qrCodeBox = $('.qrCodeBox');
- var loginForm = $('#loginForm');
- //var qrcode = new QRCode(document.getElementById("qrCode"), {
- // width: 200,
- // height: 200
- //});
- //makeCode('http://192.168.1.126:8081/Login/Index');
- // header search
- $(document).on('click', function () {
- $('.skinBox').removeClass('active');
- }).on('click', '.headSearch', function () {
- $('body').addClass('active');
- }).on('click', '.headSearchImg', function () {
- if ($('body').hasClass('active')) {
- var keyword = $('#headSearchInput').val();
- if ($.trim(keyword) != "") {
- $.each($('.search').find('.searchLi'), function (i, item) {
- if ($(item).find('.searchLiTxt').html().indexOf(keyword) != -1) {
- $(item).show();
- } else {
- $(item).hide();
- }
- });
- } else {
- $('.search').find('.searchLi').show();
- }
- }
- }).on('click', '.searchTopList li', function () {
- if ($(this).hasClass('active')) return;
- $(this).addClass('active').siblings().removeClass('active');
- }).on('click', '.headSearchClose', function (e) {
- //阻止默认浏览器动作(W3C)
- if (e && e.preventDefault) {
- e.preventDefault();
- } else { //IE中阻止函数器默认动作的方式
- window.e.returnValue = false;
- }
- e.stopPropagation();
- $('body').removeClass('active');
- //清空搜索
- if ($.trim($('#headSearchInput').val()) != "") {
- setTimeout(function () {
- $('#headSearchInput').val('');
- $('.search').find('.searchLi').show();
- }, 50);
- }
- }).on('click', '.signOut', function () { //退出登录
- //ajax退出操作
- layer.msg('退出中...', {
- icon: 16
- , shade: 0.01
- });
- $.ajax({
- url: "/Login/OutLogin",
- headers: { __RequestVerificationToken: $.lrToken },
- data: {},
- type: "post",
- dataType: "json",
- success: function (res) {
- if (res.code == 200) {
- location.href = "/SSOSystem/DragNoLogin";
- }
- else if (res.code == 400) {
- layer.msg(res.info);
- }
- else if (res.code == 500) {
- layer.msg('服务端异常,请联系管理员');
- }
- }
- });
- }).on('click', '#flowList .fa', function () {//可用应用
- //是否收藏
- var modelCode = $('#ModelCode').val();
- var userId = $('#UserId').val();
- var Id = $(this).parent('li').attr('data-Id');
- var isCollect = true;
- var tipMsg = "";
- if ($(this).hasClass('fa-heart')) {
- //ajax取消收藏操作
- isCollect = false;
- tipMsg = "取消收藏成功!";
- } else {
- //ajax收藏操作
- isCollect = true;
- tipMsg = "收藏成功!";
- }
- if (userId != "" && userId != undefined && modelCode != "" && modelCode != undefined && Id != "" && Id != undefined) {
- $.ajax({
- url: "/SSOSystem/DoCollectFlow",
- headers: { __RequestVerificationToken: $.lrToken },
- data: { userId: userId, modelCode: modelCode, id: Id, isCollect: isCollect },
- type: "post",
- dataType: "json",
- success: function (res) {
- if (res.code == 200) {
- //操作成功执行代码
- layer.msg(tipMsg);
- //刷新可用应用列表
- flowListJson = res.data.flowList;
- $("#flowTypeList").find("li.active .itemName").trigger("click");
- //刷新我的收藏列表
- flowListOfCollectJson = res.data.flowListOfCollect;
- updateCollectCount(flowListOfCollectJson);
- $("#flowTypeListOfCollect").find("li.active .itemName").trigger("click");
- }
- else if (res.code == 400) {
- layer.msg(res.info);
- }
- else if (res.code == 500) {
- layer.msg('服务端异常,请联系管理员');
- }
- }
- });
- }
- }).on('click', '#flowListOfCollect .fa', function () {//我的收藏
- //是否收藏
- var modelCode = $('#ModelCode').val();
- var userId = $('#UserId').val();
- var Id = $(this).parent('li').attr('data-Id');
- if ($(this).hasClass('fa-heart')) {
- //ajax取消收藏操作
- if (userId != "" && userId != undefined && modelCode != "" && modelCode != undefined && Id != "" && Id != undefined) {
- $.ajax({
- url: "/SSOSystem/DoCollectFlow",
- headers: { __RequestVerificationToken: $.lrToken },
- data: { userId: userId, modelCode: modelCode, id: Id, isCollect: false },
- type: "post",
- dataType: "json",
- success: function (res) {
- if (res.code == 200) {
- //操作成功执行代码
- layer.msg('取消收藏成功!');
- //刷新我的收藏列表
- flowListOfCollectJson = res.data.flowListOfCollect;
- updateCollectCount(flowListOfCollectJson);
- $("#flowTypeListOfCollect").find("li.active .itemName").trigger("click");
- //刷新可用应用列表
- flowListJson = res.data.flowList;
- $("#flowTypeList").find("li.active .itemName").trigger("click");
- }
- else if (res.code == 400) {
- layer.msg(res.info);
- }
- else if (res.code == 500) {
- layer.msg('服务端异常,请联系管理员');
- }
- }
- });
- }
- }
- });
- //登录
- $('.loginTab > div').click(function () {
- var ind = $(this).index();
- $(this).addClass('active').siblings().removeClass('active');
- if (ind == 0) {
- qrCodeBox.css('display', 'none');
- loginForm.stop().fadeIn();
- } else {
- loginForm.css('display', 'none');
- qrCodeBox.stop().fadeIn();
- }
- })
- //皮肤点击
- var skinT = null;
- $('.skinBox').on('click', 'img', function (e) {
- //阻止默认浏览器动作(W3C)
- if (e && e.preventDefault) {
- e.preventDefault();
- } else { //IE中阻止函数器默认动作的方式
- window.e.returnValue = false;
- }
- e.stopPropagation();
- var parents = $(this).parent();
- if (parents.hasClass('active')) {
- parents.removeClass('active');
- } else {
- parents.addClass('active');
- }
-
- }).hover(function () {
- clearTimeout(skinT)
- }, function () {
- var _this = $(this);
- skinT = setTimeout(function () {
- _this.removeClass('active');
- }, 2000)
- }).on('click', '.skins', function (e) {
- //阻止默认浏览器动作(W3C)
- if (e && e.preventDefault) {
- e.preventDefault();
- } else { //IE中阻止函数器默认动作的方式
- window.e.returnValue = false;
- }
- e.stopPropagation();
- $(this).addClass('active').siblings().removeClass('active');
- var skin = $(this).attr('skin');
- localStorage.setItem('skinLink', skin);
- skinLink.attr('href', '/Content/css/DragSSO/' + skin + '.css');
- }).on('click', '.skinT img', function () {
- $('.skinBox').removeClass('active');
- })
-
- function makeCode(urls) {
- qrcode.makeCode(urls);
- }
- })
|