ScanCodeRegist.cshtml 9.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272
  1. 
  2. @{
  3. Layout = null;
  4. }
  5. <!DOCTYPE html>
  6. <html>
  7. <head>
  8. <meta charset="utf-8">
  9. <title>中联区卫产品登记</title>
  10. <meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
  11. <link href="~/Content/Scripts/plugins/mui/css/mui.css" rel="stylesheet" />
  12. <script src="~/Content/Scripts/jquery.min.js"></script>
  13. <script src="~/Content/Scripts/plugins/mui/js/mui.js"></script>
  14. <link href="~/Content/Style/MobileProductRegist/iconfont.css" rel="stylesheet" />
  15. <link href="~/Content/Scripts/plugins/mui/css/mui.picker.all.css" rel="stylesheet" />
  16. <link href="~/Content/Scripts/plugins/mui/css/webuploader.css" rel="stylesheet" />
  17. <link href="~/Content/Style/MobileProductRegist/NewProblem.css" rel="stylesheet" />
  18. <script src="~/Content/Scripts/plugins/mui/js/mui.picker.all.js"></script>
  19. <script src="~/Content/Scripts/plugins/mui/js/webuploader.js"></script>
  20. <script src="~/Content/Scripts/vue.js"></script>
  21. <script src="https://cdn.staticfile.org/vue-resource/1.5.1/vue-resource.min.js"></script>
  22. </head>
  23. <body>
  24. <style>
  25. body {
  26. font-family: -apple-system, BlinkMacSystemFont, "PingFang SC","HelveticaNeue",STHeiti,"Microsoft Yahei",Tahoma,Simsun,sans-serif;
  27. }
  28. .mui-bar {
  29. box-shadow: 0 0 7px rgb(183,210,422);
  30. }
  31. .mui-bar-nav {
  32. background-color: rgb(128, 180, 251);
  33. }
  34. .mui-active {
  35. color: rgb(142,190,254) !important;
  36. }
  37. .mui-icon.iconfont.icon-wentifankui {
  38. font-size: 35px;
  39. }
  40. .icon-soushuo {
  41. color: white;
  42. }
  43. .mui-btn-positive, .mui-btn-success, .mui-btn-green {
  44. border: 1px solid #80b4fb;
  45. background-color: #80b4fb;
  46. }
  47. </style>
  48. <header class="mui-bar mui-bar-nav">
  49. <a class="mui-action-back mui-icon mui-icon-left-nav mui-pull-left" style="color:#ffffff"></a>
  50. <h1 class="mui-title" style="color:white">区卫产品问题登记</h1>
  51. </header>
  52. <div class="mui-content mui-scroll-wrapper" id="scr1">
  53. <div class="mui-scroll">
  54. <div id="VUE">
  55. <div class="mui-input-row" style="margin-top: 7px">
  56. <input id="ProblemTitile" type="text" class="mui-input-clear" placeholder="填写问题标题" style="font-size:15px">
  57. </div>
  58. <div class="mui-input-row" style="font-size:14px">
  59. <textarea id="detail" rows="8" placeholder="请填写具体的问题描述,以便我们更详细的了解您需要解决的问题。" style="font-size:15px;margin-bottom:-10px"></textarea>
  60. <ul id="fileList" class="mui-table-view mui-grid-view mui-grid-9" style="background-color:white;border-color:transparent;">
  61. <li class="mui-table-view-cell mui-media mui-col-xs-4 mui-col-sm-3">
  62. <img id="pick" src="/Content/Scripts/plugins/mui/css/tupian.png" style="width: 80px;margin-left: 8px;margin-top: 10px;">
  63. <p>上传图片</p>
  64. </li>
  65. </ul>
  66. </div>
  67. <div id="ZlUser" v-if="@ViewBag.UserType">
  68. </div>
  69. <div style="margin-bottom:50px"></div>
  70. </div>
  71. <div style="display:none" id="picker">选择文件</div>
  72. <button style="margin-top: 30px;display:none;" id="ctlBtn" class="btn btn-default">开始上传</button>
  73. <button type="button" style="margin-top: 10px;border-radius: 10px;font-size:15px;margin:auto" class="mui-btn mui-btn-success mui-btn-block btn_2" onclick="Submit()">提交</button>
  74. </div>
  75. </div>
  76. <script>
  77. mui.init({
  78. swipeBack: true //启用右滑关闭功能
  79. });
  80. mui('.mui-scroll-wrapper').scroll();
  81. Load();
  82. ///提交产品问题
  83. function Submit() {
  84. var param = {
  85. detail: $("#detail").val(),
  86. ProblemTitile: $("#ProblemTitile").val(),
  87. ProjectID: "@ViewBag.ProjectID",
  88. ProductID: "@ViewBag.ProductID",
  89. ProductVersion: "@ViewBag.ProductVersion"
  90. };
  91. if ($("#ProblemTitile").val().trim() == '') {
  92. mui.toast('请输入问题标题', { duration: 'long', type: 'div' });
  93. $('#ProblemTitile').focus();
  94. return;
  95. }
  96. if ($("#detail").val().trim() == '') {
  97. mui.toast('请填写问题详细描述', { duration: 'long', type: 'div' });
  98. $('#detail').focus();
  99. return;
  100. }
  101. lod = mui.showLoading("正在提交,请稍后...", "div");
  102. $.post("/MobileProblem/SubmitProblem", param, function (data) {
  103. if (data.code == 200) {
  104. ProblemIDtoImg = data.msg;
  105. $("#ctlBtn").click();
  106. } else {
  107. mui.toast(data.msg, { duration: 'long', type: 'div' });
  108. }
  109. })
  110. }
  111. function Load() {
  112. var $list = $("#fileList");
  113. var $btn = $("#ctlBtn");
  114. var thumbnailWidth = 100;
  115. var thumbnailHeight = 100;
  116. var uploader = WebUploader.create({
  117. // 选完文件后,是否自动上传。
  118. auto: false,
  119. // swf文件路径
  120. swf: '/Content/Scripts/plugins/mui/js/Uploader.swf',
  121. // 文件接收服务端。
  122. server: '/MobileProblem/ImageUploadFTP',
  123. // 选择文件的按钮。可选。
  124. // 内部根据当前运行是创建,可能是input元素,也可能是flash.
  125. pick: '#picker',
  126. // 只允许选择图片文件。
  127. accept: {
  128. title: 'Images',
  129. extensions: 'gif,jpg,jpeg,bmp,png',
  130. mimeTypes: 'image/*'
  131. },
  132. compress: {
  133. width: 1600,
  134. height: 1600,
  135. // 图片质量,只有type为`image/jpeg`的时候才有效。
  136. quality: 90,
  137. // 是否允许放大,如果想要生成小图的时候不失真,此选项应该设置为false.
  138. allowMagnify: false,
  139. // 是否允许裁剪。
  140. crop: false,
  141. // 是否保留头部meta信息。
  142. preserveHeaders: true,
  143. // 如果发现压缩后文件大小比原来还大,则使用原来图片
  144. // 此属性可能会影响图片自动纠正功能
  145. noCompressIfLarger: false,
  146. // 单位字节,如果图片大小小于此值,不会采用压缩。
  147. compressSize: 0
  148. }
  149. });
  150. uploader.on('fileQueued', function (file) {
  151. var $li = $(
  152. '<li id="' + file.id + '" class="mui-table-view-cell mui-media mui-col-xs-4 mui-col-sm-3"><img><p>' + file.name + '</p> </li>'
  153. ),
  154. $img = $li.find('img');
  155. // $list为容器jQuery实例
  156. $list.append($li);
  157. // 创建缩略图
  158. // 如果为非图片文件,可以不用调用此方法。
  159. // thumbnailWidth x thumbnailHeight 为 100 x 100
  160. uploader.makeThumb(file, function (error, src) {
  161. if (error) {
  162. $img.replaceWith('<span>不能预览</span>');
  163. return;
  164. }
  165. $img.attr('src', src);
  166. }, thumbnailWidth, thumbnailHeight);
  167. });
  168. // 文件上传成功,给item添加成功class, 用样式标记上传成功。
  169. uploader.on('uploadSuccess', function (file, response) {
  170. $('#' + file.id).addClass('upload-state-done');
  171. if (response.msg = "1") {
  172. Count += 1;
  173. }
  174. });
  175. // 文件上传失败,显示上传出错。
  176. uploader.on('uploadError', function (file) {
  177. var $li = $('#' + file.id),
  178. $error = $li.find('div.error');
  179. // 避免重复创建
  180. if (!$error.length) {
  181. $error = $('<div class="error"></div>').appendTo($li);
  182. }
  183. $error.text('上传失败');
  184. });
  185. // 完成上传完了,成功或者失败,先删除进度条。
  186. uploader.on('uploadComplete', function (file) {
  187. $('#' + file.id).find('.progress').remove();
  188. });
  189. uploader.on('uploadFinished', function () {
  190. mui.hideLoading(lod);
  191. mui.alert("问题提交成功,成功上传" + Count + "张图片", "提交成功", "确定", function () {
  192. window.location.href = "/MobileProblem/Home";
  193. }, 'div');
  194. })
  195. $btn.on('click', function () {
  196. uploader.options.formData.ProblemID = ProblemIDtoImg;
  197. uploader.upload();
  198. });
  199. document.getElementById('pick').addEventListener('tap', function () {
  200. $(".webuploader-element-invisible").click();
  201. });
  202. $("#ProblemTitile").mouseleave(function () {
  203. var va = $("#ProblemTitile").val();
  204. $("#detail").val(va);
  205. })
  206. if ("@ViewBag.ProjectID" == "" || "@ViewBag.ProductID" == "" || "@ViewBag.ProductVersion" == "") {
  207. mui.alert("验证码信息不足,请联系管理员!", "提示", "确定", function () {
  208. window.location.href = '/MobileProblem/Home';
  209. }, 'div');
  210. }
  211. }
  212. </script>
  213. </body>
  214. </html>