addVideoForm.jsp 8.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279
  1. <%@ page contentType="text/html;charset=UTF-8" %>
  2. <%@ include file="/WEB-INF/views/include/taglib.jsp" %>
  3. <html>
  4. <head>
  5. <title>添加视频资料</title>
  6. <meta name="decorator" content="default"/>
  7. <style>
  8. .controls .new-tag {
  9. display: inline-block;
  10. width: 78px;
  11. height: 30px;
  12. border: 1px solid #e5e5e5;
  13. border-radius: 5px;
  14. margin: 7px;
  15. text-align: center;
  16. line-height: 30px;
  17. font-size: 14px;
  18. overflow: hidden;
  19. text-overflow: ellipsis;
  20. white-space: nowrap;
  21. cursor: pointer;
  22. }
  23. .controls .new-tag.active {
  24. border-color: #e15616;
  25. color: #e15616;
  26. }
  27. #tagInput {
  28. width: 263px;
  29. margin: 7px;
  30. display: inline-block;
  31. height: 30px;
  32. }
  33. .controls .tags-operate .tag-add {
  34. height: 40px;
  35. line-height: 40px;
  36. vertical-align: middle;
  37. }
  38. .upload {
  39. position: relative;
  40. display: inline-block;
  41. background: #D0EEFF;
  42. border: 1px solid #99D3F5;
  43. border-radius: 4px;
  44. padding: 4px 12px;
  45. color: #1E88C7;
  46. text-decoration: none;
  47. text-indent: 0;
  48. line-height: 20px;
  49. margin-left: 20px;
  50. cursor: pointer;
  51. width: 52px;
  52. height: 20px;
  53. }
  54. .upload input {
  55. position: absolute;
  56. width: 170px;
  57. font-size: 20px;
  58. right: 0;
  59. top: 0;
  60. opacity: 0;
  61. cursor: pointer;
  62. }
  63. .upload:hover {
  64. background: #AADFFD;
  65. border-color: #78C3F3;
  66. color: #004974;
  67. text-decoration: none;
  68. }
  69. .add-submit {
  70. position: relative;
  71. display: inline;
  72. background: #D0EEFF;
  73. border: 1px solid #99D3F5;
  74. border-radius: 4px;
  75. padding: 4px 12px;
  76. color: #1E88C7;
  77. text-decoration: none;
  78. text-indent: 0;
  79. line-height: 20px;
  80. margin-left: 20px;
  81. cursor: pointer;
  82. width: 52px;
  83. height: 30px;
  84. }
  85. .add-submit input {
  86. position: absolute;
  87. width: 50px;
  88. font-size: 20px;
  89. right: 0;
  90. top: 0;
  91. opacity: 0;
  92. cursor: pointer;
  93. }
  94. .add-submit:hover {
  95. background: #AADFFD;
  96. border-color: #78C3F3;
  97. color: #004974;
  98. text-decoration: none;
  99. }
  100. .upload-loading{
  101. display: none;
  102. width: 32px;
  103. height: 32px;
  104. margin-left: 10px;
  105. }
  106. .upload-loading img{
  107. width: 16px;
  108. height: 16px;
  109. margin: 0 auto 0;
  110. }
  111. #file-list-display {
  112. width: 600px;
  113. height: auto;
  114. float: left;
  115. margin-left: 20px;
  116. }
  117. #file-list-display p {
  118. line-height: 30px;
  119. font-size: 14px;
  120. color: #333333;
  121. margin: 0;
  122. }
  123. #file-list-display p .del {
  124. color: #2fa4e7;
  125. font-size: 12px;
  126. cursor: pointer;
  127. margin-left: 20px;
  128. }
  129. .Main-content{
  130. height: 100px;
  131. }
  132. .control-group{
  133. margin-top: 40px;
  134. }
  135. </style>
  136. <script type="text/javascript">
  137. $(document).ready(function () {
  138. $("#searchForm").validate({
  139. submitHandler: function (form) {
  140. var isSubMitFlag = true;
  141. var productID = $("#productID").val();
  142. if (isNaN(productID) || productID.indexOf('0') == 0 ) {
  143. alertx("请输入正确的商品ID");
  144. isSubMitFlag = false;
  145. return false;
  146. }
  147. if (isSubMitFlag) {
  148. form.submit();
  149. }
  150. }
  151. })
  152. });
  153. </script>
  154. </head>
  155. <body>
  156. <form:form id="inputForm" modelAttribute="cmProductArchiveContent" action="${ctx}/archive/cmOrderArchiveContent/save" method="post" class="form-horizontal">
  157. <form:hidden path="id"/>
  158. <form:hidden path="type" value="2"/>
  159. <sys:message content="${message}"/>
  160. <div class="control-group">
  161. <label class="control-label"><font color="red">*</font>标题:</label>
  162. <div class="controls">
  163. <form:input path="title" htmlEscape="false" maxlength="50" class="input-xlarge " style="position:relative"/>
  164. </div>
  165. <div style="margin:5px 0 0 180px">
  166. <font color="red">标题输入不超过50个字</font>
  167. </div>
  168. </div>
  169. <div class="control-group">
  170. <label class="control-label"><font color="red">*</font>视频路径:</label>
  171. <input id="uploadFileName" type="text" style="display: inline;margin-left:20px" disabled="true" class="input-xlarge required" />
  172. <div class="upload">
  173. <input type="file" name="file" id="archiveFile" accept=".mp4">选择文件
  174. </div>
  175. <div class="add-submit">
  176. <input id="addSubmit" type="button" value="上传" style="cursor: pointer"/>上传&nbsp;
  177. </div>
  178. <div class="upload-loading">
  179. <img alt="gif" src="/static/images/upload.gif" width="32px" border="none">
  180. </div>
  181. <div style="margin:5px 0 0 180px">
  182. <font color="red">视频大小不超过50M</font>
  183. </div>
  184. </div>
  185. </form:form>
  186. <script>
  187. var fileId = '';
  188. function getCheckedItems() {
  189. var items = new Array();
  190. items.push({
  191. id: $("#id").val(),
  192. title: $("#title").val(),
  193. fileId: fileId
  194. })
  195. return items;
  196. }
  197. $(function () {
  198. //初始化文件名称
  199. if (${cmProductArchiveContent.id ne null}) {
  200. var fileName = '${cmProductArchiveContent.fileList[0].fileName}';
  201. var id = '${cmProductArchiveContent.fileList[0].id}';
  202. $("#uploadFileName").val(fileName);
  203. fileId = id;
  204. }
  205. //点击上传按钮后上传文件
  206. $('#addSubmit').click(function () {
  207. var filesById = document.getElementById('archiveFile');
  208. var files = $('#archiveFile');
  209. var fileList = files.prop('files');
  210. var fileName = $('#uploadFileName').val();
  211. if (files === '' || fileList.length == 0 || fileName == '') {
  212. alertx('请选择上传文件');
  213. return;
  214. }
  215. var data = new FormData();
  216. data.append('file', fileList[0]);
  217. data.append('fileName', fileName);
  218. $('.upload-loading').css("display", "inline");
  219. $.ajax({
  220. url: "${ctx}/archive/cmProductArchiveContent/upload",
  221. data: data,
  222. type: "POST",
  223. processData: false,
  224. contentType: false,
  225. dataType: "json",
  226. success: function (res) {
  227. if (res.success) {
  228. filesById.value = '';
  229. fileId = res.archiveFile.id;
  230. $('.upload-loading').hide();
  231. $.jBox.tip('上传成功', 'info');
  232. } else {
  233. $.jBox.tip(res.msg, 'error');
  234. $('.upload-loading').hide();
  235. }
  236. },
  237. error: function (json) {
  238. }
  239. });
  240. });
  241. var fileList = [];
  242. var fileIds = '';
  243. var files = document.getElementById("archiveFile");
  244. //选择上传文件后显示文件名称
  245. files.addEventListener("change", function (event) {
  246. var name = event.target.files[0].name;
  247. $('#uploadFileName').val(name);
  248. fileId = '';
  249. });
  250. })
  251. </script>
  252. </body>
  253. </html>