Form.cshtml 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117
  1. @{
  2. ViewBag.Title = "应用表单";
  3. Layout = "~/Views/Shared/_Form.cshtml";
  4. }
  5. <script src="~/Content/scripts/plugins/uploadify/ajaxfileupload.js"></script>
  6. <script>
  7. $(function () {
  8. //应用类型
  9. $("#AppType").ComboBox({
  10. description: "==请选择==",
  11. });
  12. $('#uploadFile').change(function () {
  13. var f = document.getElementById('uploadFile').files[0]
  14. var src = window.URL.createObjectURL(f);
  15. document.getElementById('uploadPreview').src = src;
  16. });
  17. });
  18. //保存表单
  19. function AcceptClick() {
  20. if (!document.getElementById('uploadFile').files[0]) {
  21. top.dialogTop('请添加应用Logo', 'error');
  22. return false;
  23. }
  24. if (!$('#form1').Validform()) {
  25. return false;
  26. }
  27. var AppId = $("#AppId").val();
  28. //上传应用图标
  29. $.ajaxFileUpload({
  30. url: "../../WeChatManage/App/UploadFile?AppId=" + AppId,
  31. secureuri: false,
  32. fileElementId: 'uploadFile',
  33. dataType: 'json',
  34. success: function (data) {
  35. var postData = $("#form1").GetWebControls("");
  36. postData["AppLogo"] = data.message;
  37. $.SaveForm({
  38. url: "../../WeChatManage/App/SaveForm",
  39. param: postData,
  40. loading: "正在保存数据...",
  41. success: function () {
  42. $.currentIframe().reload();
  43. }
  44. })
  45. }
  46. });
  47. }
  48. </script>
  49. <div style="margin-left: 20px; margin-top: 20px; margin-right: 50px;">
  50. <div class="applogo " style="text-align: center; margin-bottom: 15px;">
  51. <div class="file" style="width: 100px; height: 100px;">
  52. <img id="uploadPreview" style="width: 100px; height: 100px; border-radius: 100px;" src="~/Content/images/logo-headere47d5.png" />
  53. <input type="file" name="uploadFile" id="uploadFile">
  54. </div>
  55. </div>
  56. <table class="form">
  57. <tr>
  58. <th class="formTitle">应用名称</th>
  59. <td class="formValue">
  60. <input id="AppId" type="hidden" value="@Guid.NewGuid().ToString()" />
  61. <input id="AppName" type="text" class="form-control" placeholder="2-16个字" isvalid="yes" checkexpession="NotNull" />
  62. </td>
  63. </tr>
  64. <tr>
  65. <td class="formTitle">应用类型</td>
  66. <td class="formValue">
  67. <div id="AppType" type="select" class="ui-select" isvalid="yes" checkexpession="NotNull">
  68. <ul>
  69. <li data-value="1">消息型应用</li>
  70. <li data-value="2">主页型应用</li>
  71. </ul>
  72. </div>
  73. </td>
  74. </tr>
  75. <tr>
  76. <td class="formTitle">可信域名</td>
  77. <td class="formValue">
  78. <input id="RedirectDomain" type="text" class="form-control" placeholder="填写应用的域名地址,如:qy.weixin.qq.com:8080" />
  79. </td>
  80. </tr>
  81. <tr>
  82. <th class="formTitle" valign="top" style="padding-top: 4px;">应用介绍
  83. </th>
  84. <td class="formValue">
  85. <textarea id="Description" class="form-control" style="height: 70px;" placeholder="描述该应用的功能与特色,内容为4-120个字"></textarea>
  86. </td>
  87. </tr>
  88. </table>
  89. </div>
  90. <style>
  91. .file {
  92. position: relative;
  93. display: inline-block;
  94. overflow: hidden;
  95. text-decoration: none;
  96. text-indent: 0;
  97. cursor: pointer !important;
  98. }
  99. .file input {
  100. position: absolute;
  101. font-size: 100px;
  102. right: 0;
  103. top: 0;
  104. opacity: 0;
  105. cursor: pointer !important;
  106. }
  107. .file:hover {
  108. text-decoration: none;
  109. cursor: pointer !important;
  110. }
  111. </style>