Index.cshtml 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111
  1. @{
  2. ViewBag.Title = "应用管理";
  3. Layout = "~/Views/Shared/_Index.cshtml";
  4. }
  5. <script>
  6. $(function () {
  7. resize();
  8. GetList();
  9. })
  10. function resize() {
  11. $('#pageayout').height($(window).height() - 20);
  12. $(window).resize(function (e) {
  13. window.setTimeout(function () {
  14. $('#pageayout').height($(window).height() - 20);
  15. }, 200);
  16. e.stopPropagation();
  17. });
  18. }
  19. //添加App
  20. function btn_add_app() {
  21. dialogOpen({
  22. id: "Form",
  23. title: '创建新应用',
  24. url: '/WeChatManage/App/Form',
  25. width: "550px",
  26. height: "440px",
  27. callBack: function (iframeId) {
  28. top.frames[iframeId].AcceptClick();
  29. }
  30. });
  31. }
  32. //应用列表
  33. function GetList() {
  34. $.ajax({
  35. url: "../../WeChatManage/App/GetListJson",
  36. type: "get",
  37. dataType: "json",
  38. async: false,
  39. beforeSend: function (xmlHttp) {
  40. xmlHttp.setRequestHeader("If-Modified-Since", "0");
  41. xmlHttp.setRequestHeader("Cache-Control", "no-cache");
  42. },
  43. success: function (data) {
  44. var _html = "";
  45. $(".app-box").find(".app-item").remove();
  46. $.each(data, function (i) {
  47. var row = data[i];
  48. var AppLogo = top.contentPath + row.AppLogo;
  49. _html += '<li id="' + row.AppId + '" class="app-item" data-type="' + row.AppType + '" title="' + (row.Description == null ? "" : row.Description) + '">';
  50. _html += '<a class="app-logo"><img style="width: 80px; height: 80px;border-radius: 80px;" src="' + AppLogo + '"></a>';
  51. _html += '<h3 class="app-name">' + row.AppName + '</h3><div class="app-item-close"></div>';
  52. _html += ' </li>';
  53. });
  54. $(".app-box").prepend(_html);
  55. }
  56. });
  57. $(".app-box").find(".app-logo").click(function () {
  58. var AppId = $(this).parents('li').attr('id');
  59. var AppType = $(this).parents('li').attr('data-type');
  60. if (AppType == 1) {
  61. dialogOpen({
  62. id: "FormNews",
  63. title: '消息型应用',
  64. url: '/WeChatManage/App/FormNews?keyValue=' + AppId,
  65. width: "550px",
  66. height: "440px",
  67. btn: null
  68. });
  69. } else if (AppType == 2) {
  70. dialogOpen({
  71. id: "FormHome",
  72. title: '主页型应用',
  73. url: '/WeChatManage/App/FormHome?keyValue=' + AppId,
  74. width: "550px",
  75. height: "440px",
  76. callBack: function (iframeId) {
  77. top.frames[iframeId].AcceptClick();
  78. }
  79. });
  80. }
  81. });
  82. $(".app-box").find(".app-item").hover(function () {
  83. $(this).find('.app-item-close').show();
  84. }, function () {
  85. $(this).find('.app-item-close').hide();
  86. });
  87. //删除应用
  88. $(".app-item-close").click(function () {
  89. var AppId = $(this).parents('li').attr('id');
  90. $.RemoveForm({
  91. url: "../../WeChatManage/App/RemoveForm",
  92. param: { keyValue: AppId },
  93. success: function (data) {
  94. reload();
  95. }
  96. })
  97. return false;
  98. })
  99. }
  100. </script>
  101. <div id="pageayout" class="border" style="background: #fff; overflow: auto;">
  102. <div class="app-panel">
  103. <ul class="app-box">
  104. <li class="app-item-add" onclick="btn_add_app()" title="添加应用">
  105. <a class="app-logo"></a>
  106. </li>
  107. </ul>
  108. </div>
  109. </div>