ScanCodeRegist.cshtml 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380
  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?v=1.2"></script>
  20. <script type="text/babel" src="~/Content/Scripts/plugins/mui/js/PlusUploader.js?v=1.7"></script>
  21. <script src="~/Content/Scripts/vue.js"></script>
  22. <script src="https://cdn.staticfile.org/vue-resource/1.5.1/vue-resource.min.js"></script>
  23. <script src="~/Content/Scripts/babel.min.js"></script>
  24. <script src="~/Content/Scripts/polyfill.min.js"></script>
  25. </head>
  26. <body>
  27. <style>
  28. body {
  29. font-family: -apple-system, BlinkMacSystemFont, "PingFang SC","HelveticaNeue",STHeiti,"Microsoft Yahei",Tahoma,Simsun,sans-serif;
  30. }
  31. .mui-bar {
  32. box-shadow: 0 0 7px rgb(183,210,422);
  33. }
  34. .mui-bar-nav {
  35. background-color: rgb(128, 180, 251);
  36. }
  37. .mui-active {
  38. color: rgb(142,190,254) !important;
  39. }
  40. .mui-icon.iconfont.icon-wentifankui {
  41. font-size: 35px;
  42. }
  43. .icon-soushuo {
  44. color: white;
  45. }
  46. .mui-btn-positive, .mui-btn-success, .mui-btn-green {
  47. border: 1px solid #80b4fb;
  48. background-color: #80b4fb;
  49. }
  50. .UplodImg {
  51. display: flex;
  52. justify-content: space-between;
  53. flex-direction: row;
  54. align-content: center;
  55. padding: 7px 27px;
  56. }
  57. .filep {
  58. -webkit-line-clamp: 1;
  59. overflow: hidden;
  60. word-break: break-all;
  61. display: -webkit-box;
  62. -webkit-box-orient: vertical;
  63. text-overflow: ellipsis;
  64. }
  65. .filep {
  66. -webkit-line-clamp: 1;
  67. overflow: hidden;
  68. word-break: break-all;
  69. display: -webkit-box;
  70. -webkit-box-orient: vertical;
  71. text-overflow: ellipsis;
  72. position: absolute;
  73. bottom: 12px;
  74. background-color: rgba(0, 0, 0, 0.6);
  75. font-size: 13px;
  76. color: white;
  77. width: 100px;
  78. }
  79. .destory {
  80. position: absolute;
  81. top: 0;
  82. right: -6px;
  83. width: 10px;
  84. height: 10px;
  85. font-size: 20px;
  86. color: #cc9a9a;
  87. margin-bottom: 11px;
  88. transition: color 0.2s ease-out;
  89. background-color: transparent;
  90. border: transparent;
  91. }
  92. .destory:after {
  93. content: '×';
  94. position: absolute;
  95. top: -10px;
  96. right: 5px;
  97. }
  98. </style>
  99. <header class="mui-bar mui-bar-nav">
  100. <h1 class="mui-title" style="color:white">中联区卫问题登记</h1>
  101. </header>
  102. <div class="mui-content mui-scroll-wrapper" id="scr1">
  103. <div class="mui-scroll">
  104. <div id="VUE">
  105. <div class="mui-input-row" style="margin-top: 7px">
  106. <input id="ProblemTitile" type="text" class="mui-input-clear" placeholder="填写问题标题" style="font-size:15px">
  107. </div>
  108. <div class="mui-input-row" style="font-size:14px">
  109. <textarea id="detail" rows="8" placeholder="请填写具体的问题描述,以便我们更详细的了解您需要解决的问题。" style="font-size:15px;margin-bottom:-10px"></textarea>
  110. </div>
  111. <div style="background-color:white;margin-top:10px" >
  112. <div class="UplodImg" id="pickImg">
  113. <h4 style="font-weight:400">图片</h4>
  114. <div>
  115. <span class="mui-icon mui-icon-camera" id="pickCamera" style="color:#1296db;margin-right:20px"></span>
  116. <span class="mui-icon mui-icon-image" id="pickPhoto" style="color:#1296db"></span>
  117. </div>
  118. </div>
  119. <ul id="ImgList" class="mui-table-view mui-grid-view mui-grid-9" style="background-color:white;border-color:transparent;margin:0"></ul>
  120. </div>
  121. <div style="background-color:white;border-top: solid 1px #efeff4;">
  122. <div class="UplodImg" id="pickFlie">
  123. <h4 style="font-weight:400">附件</h4>
  124. <span class="mui-icon mui-icon-paperclip" style="color:#1296db"></span>
  125. </div>
  126. <ul id="FileList" class="mui-table-view mui-grid-view mui-grid-9" style="background-color:white;border-color:transparent;"></ul>
  127. </div>
  128. <div style="display:none" id="picker">选择文件</div>
  129. <div style="display:none" id="picker2">选择文件</div>
  130. <button style="margin-top: 30px;display:none;" id="ctlBtn" class="btn btn-default">图片上传</button>
  131. <div id="ZlUser" v-if="@ViewBag.UserType">
  132. </div>
  133. <div style="margin-bottom:50px"></div>
  134. </div>
  135. <div style="display:none" id="picker">选择文件</div>
  136. <button style="margin-top: 30px;display:none;" id="ctlBtn" class="btn btn-default">开始上传</button>
  137. <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>
  138. </div>
  139. </div>
  140. <script type="text/babel">
  141. mui.init({
  142. swipeBack: true //启用右滑关闭功能
  143. });
  144. //是否在Plus环境下
  145. var IsPlus = mui.os.plus ? true : false;
  146. var FivePlusUploder;
  147. mui('.mui-scroll-wrapper').scroll();
  148. var GProductCode = "@ViewBag.ProductCode";
  149. var GregistrantID = "@ViewBag.registrantID";
  150. var GInstitutionResId = "@ViewBag.InstitutionResId";
  151. LoadUploder();
  152. ///提交产品问题
  153. function Submit() {
  154. var param = {
  155. detail: $("#detail").val(),
  156. ProblemTitile: $("#ProblemTitile").val(),
  157. ProductCode: GProductCode,
  158. registrantSorID: GregistrantID,
  159. InstitutionID: GInstitutionResId
  160. };
  161. if ($("#ProblemTitile").val().trim() == '') {
  162. mui.toast('请输入问题标题', { duration: 'long', type: 'div' });
  163. $('#ProblemTitile').focus();
  164. return;
  165. }
  166. if ($("#detail").val().trim() == '') {
  167. mui.toast('请填写问题详细描述', { duration: 'long', type: 'div' });
  168. $('#detail').focus();
  169. return;
  170. }
  171. lod = mui.showLoading("正在提交,请稍后...", "div");
  172. $.post("/MobileAccount/SubmitProblemByScanCode", param, function (data) {
  173. if (data.code == 200) {
  174. ProblemProcessIDtoImg = data.msg;
  175. $("#ctlBtn").click();
  176. } else {
  177. mui.toast(data.msg, { duration: 'long', type: 'div' });
  178. }
  179. })
  180. }
  181. function LoadUploder() {
  182. if (!GProductCode || !GregistrantID || !GInstitutionResId) {
  183. mui.alert("二维码信息不足,请联系管理员!", "提示", "确定", function () {
  184. window.location.href = '/MobileProblem/Home';
  185. return
  186. }, 'div');
  187. }
  188. $("#ProblemTitile").mouseleave(function () {
  189. if (!$("#detail").val()) {
  190. var va = $("#ProblemTitile").val();
  191. $("#detail").val(va);
  192. }
  193. })
  194. Load();
  195. if (IsPlus) {
  196. FivePlusUploder = new FivePlus({ UplodUrl: "MobileAccount"});
  197. }
  198. }
  199. var Count = 0;
  200. var ProblemProcessIDtoImg;
  201. var lod;
  202. function Load() {
  203. var $list = $("#ImgList");
  204. var $list2 = $("#FileList");
  205. var $btn = $("#ctlBtn");
  206. var thumbnailWidth = 100;
  207. var thumbnailHeight = 100;
  208. var uploader = WebUploader.create({
  209. // 选完文件后,是否自动上传。
  210. auto: false,
  211. // swf文件路径
  212. swf: '/Content/Scripts/plugins/mui/js/Uploader.swf',
  213. // 文件接收服务端。
  214. server: '/MobileAccount/FlieUploadAndSave',
  215. // 选择文件的按钮。可选。
  216. // 内部根据当前运行是创建,可能是input元素,也可能是flash.
  217. pick: '#picker2',
  218. compress: {
  219. width: 1600,
  220. height: 1600,
  221. // 图片质量,只有type为`image/jpeg`的时候才有效。
  222. quality: 90,
  223. // 是否允许放大,如果想要生成小图的时候不失真,此选项应该设置为false.
  224. allowMagnify: false,
  225. // 是否允许裁剪。
  226. crop: false,
  227. // 是否保留头部meta信息。
  228. preserveHeaders: true,
  229. // 如果发现压缩后文件大小比原来还大,则使用原来图片
  230. // 此属性可能会影响图片自动纠正功能
  231. noCompressIfLarger: false,
  232. // 单位字节,如果图片大小小于此值,不会采用压缩。
  233. compressSize: 0
  234. }
  235. });
  236. uploader.on('fileQueued', function (file) {
  237. var $li = $(
  238. '<li id="' + file.id + '" class="mui-table-view-cell mui-media mui-col-xs-4 mui-col-sm-3"><img><button class="destory" ></button><p class="filep">' + file.name + '</p> </li>'
  239. ),
  240. $img = $li.find('img');
  241. // $list为容器jQuery实例
  242. if (file.ext == 'jpg' || file.ext == 'jpeg' || file.ext == 'png' || file.ext == 'bmp') {
  243. $list.append($li);
  244. } else {
  245. $list2.append('<li id="' + file.id + '" class="mui-table-view-cell mui-media mui-col-xs-4 mui-col-sm-3"><span class="mui-icon mui-icon-upload" style="padding-bottom:10px"></span><button class="destory" ></button>' +
  246. '<p class="filep">' + file.name + '</p> </li>');
  247. }
  248. $("#" + file.id).children(".destory").click(() =>{
  249. uploader.removeFile(file);
  250. $("#" + file.id).remove();
  251. })
  252. // 创建缩略图
  253. // 如果为非图片文件,可以不用调用此方法。
  254. // thumbnailWidth x thumbnailHeight 为 100 x 100
  255. uploader.makeThumb(file, function (error, src) {
  256. if (error) {
  257. $img.replaceWith('<span>不能预览</span>');
  258. return;
  259. }
  260. $img.attr('src', src);
  261. }, thumbnailWidth, thumbnailHeight);
  262. });
  263. // 文件上传成功,给item添加成功class, 用样式标记上传成功。
  264. uploader.on('uploadSuccess', function (file, response) {
  265. $('#' + file.id).addClass('upload-state-done');
  266. if (response.msg = "1") {
  267. Count += 1;
  268. }
  269. });
  270. // 文件上传失败,显示上传出错。
  271. uploader.on('uploadError', function (file) {
  272. var $li = $('#' + file.id),
  273. $error = $li.find('div.error');
  274. // 避免重复创建
  275. if (!$error.length) {
  276. $error = $('<div class="error"></div>').appendTo($li);
  277. }
  278. $error.text('上传失败');
  279. });
  280. // 完成上传完了,成功或者失败,先删除进度条。
  281. uploader.on('uploadComplete', function (file) {
  282. $('#' + file.id).find('.progress').remove();
  283. });
  284. uploader.on('uploadFinished', function () {
  285. mui.hideLoading(lod);
  286. if (IsPlus) {
  287. FivePlusUploder.uplod(ProblemProcessIDtoImg, lod);
  288. } else {
  289. mui.alert("问题反馈成功,请耐心等待,成功上传" + Count + "个附件!", "提交成功", "确定", function () {
  290. window.location.href = "/MobileProblem/Home";
  291. }, 'div');
  292. }
  293. })
  294. $btn.on('click', function () {
  295. uploader.options.formData.ProcessId = ProblemProcessIDtoImg;
  296. uploader.upload();
  297. });
  298. if (!IsPlus) {
  299. document.getElementById('pickImg').addEventListener('tap', function () {
  300. $("#picker").find('.webuploader-element-invisible').click();
  301. });
  302. }
  303. document.getElementById('pickFlie').addEventListener('tap', function () {
  304. $("#picker2").find('.webuploader-element-invisible').click();
  305. });
  306. uploader.addButton({
  307. id: '#picker',
  308. innerHTML: '选择文件',
  309. accept: {
  310. title: 'Images',
  311. extensions: 'gif,jpg,jpeg,bmp,png',
  312. mimeTypes: 'image/*'
  313. }
  314. });
  315. }
  316. </script>
  317. </body>
  318. </html>