Нет описания

Work-banli.html 8.0KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259
  1. <!doctype html>
  2. <html lang="en" class="feedback">
  3. <head>
  4. <meta charset="UTF-8" />
  5. <meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
  6. <title>问题反馈</title>
  7. <link rel="stylesheet" type="text/css" href="../css/mui.min.css" />
  8. <link href="../css/feedback-page.css" rel="stylesheet" />
  9. <style>
  10. p {
  11. font-size: 16px;
  12. color: #fe6604;
  13. }
  14. </style>
  15. </head>
  16. <body>
  17. <header class="mui-bar mui-bar-nav" style="">
  18. <a class="mui-action-back mui-icon mui-icon-left-nav mui-pull-left" style="color: #fff;"></a>
  19. <h1 class="mui-title" style="color: #fff;">办理工单</h1>
  20. </header>
  21. <div class="mui-content">
  22. <p>办理人(必填)</p>
  23. <div class="mui-input-row">
  24. <input id='contact' type="text" class="mui-input-clear contact" />
  25. </div>
  26. <p>办理内容(必填)</p>
  27. <div class="row mui-input-row">
  28. <textarea id='question' class="mui-input-clear question" placeholder="请详细描述你的问题和意见..."></textarea>
  29. </div>
  30. <br />
  31. <div class="mui-input-row" style="background: #FFFFFF;">
  32. <div class="feedback">
  33. <p>添加图片(选填,提供问题截图,单张10M以下)</p>
  34. <div id='image-list' class="row image-list"></div>
  35. </div>
  36. </div>
  37. <div class="" style="padding: 10px;">
  38. <br />
  39. <button id="submit" type="button" class="mui-btn mui-btn-block mui-btn-primary submit">办理</button>
  40. </div>
  41. </div>
  42. <script src="../js/jquery.min.js"></script>
  43. <script src="../js/huayi.config.js"></script>
  44. <script src="../js/zepto.js"></script>
  45. <script src="../js/mui.min.js"></script>
  46. <script src="../js/webuploader.min.js"></script>
  47. <script src="../js/mui.zoom.js"></script>
  48. <script src="../js/mui.previewimage.js"></script>
  49. <script src="../js/feedback-page.js"></script>
  50. <script type="text/javascript">
  51. mui.init();
  52. mui.plusReady(function() {
  53. var wv = plus.webview.currentWebview();
  54. var vText = wv.name;
  55. var token = wv.token;
  56. var Str = '';
  57. var str_ary;
  58. document.getElementById("submit").addEventListener('tap', function() {
  59. var username = $("#contact").val();
  60. var question = $("#question").val();
  61. $(".image-box").each(function(i, n) {
  62. var a = $(n).attr("indexs");
  63. if(a) {
  64. Str += a + ',';
  65. }
  66. })
  67. str_ary = Str.substring(0, Str.length - 1);
  68. // alert(str_ary);
  69. if(!username) {
  70. plus.nativeUI.toast('输入办理人');
  71. } else if(!question) {
  72. plus.nativeUI.toast('输入内容');
  73. } else {
  74. mui.ajax(huayi.config.callcenter_url + 'WorkOrder/FeedBackWorkOrder', {
  75. data: {
  76. workorderid: vText,
  77. dealman: username, //办理人
  78. result: question, //办理内容
  79. state: 1,
  80. token: token,
  81. files: str_ary,
  82. },
  83. dataType: 'json', //服务器返回json格式数据
  84. type: 'post', //HTTP请求类型
  85. timeout: 10000, //超时时间设置为10秒;
  86. success: function(data) {
  87. var btnArray = ['否', '是'];
  88. mui.confirm('是否办理工单', '提示', btnArray, function(e) {
  89. if(e.index == 1) {
  90. plus.nativeUI.toast('办理成功');
  91. var wobj = plus.webview.getWebviewById("WorkDetails");
  92. wobj.reload(true);
  93. } else {
  94. plus.nativeUI.toast('取消办理');
  95. }
  96. })
  97. },
  98. error: function(xhr, type, errorThrown) {
  99. }
  100. });
  101. }
  102. })
  103. })
  104. var applicationPath = window.applicationPath === "" ? "" : window.applicationPath || "../../";
  105. var $ = jQuery;
  106. $list = $('#image-list'),
  107. // 优化retina, 在retina下这个值是2
  108. ratio = window.devicePixelRatio || 1,
  109. // 缩略图大小
  110. thumbnailWidth = 50 * ratio,
  111. thumbnailHeight = 50 * ratio,
  112. // Web Uploader实例
  113. //添加图片
  114. $(function() {
  115. //imgNum = 2;
  116. var usercode = localStorage.getItem("user"); //获取本地存储
  117. // var base64 = reader.result.split(',')[1];
  118. // var dataUrl = 'data:image/png;base64,' + base64;
  119. uploader = WebUploader.create({
  120. // 自动上传。
  121. auto: true,
  122. // swf文件路径
  123. swf: 'js/Uploader.swf',
  124. // 文件接收服务端。
  125. server: 'http://117.158.196.116:4010/Web/Upload64',
  126. // 选择文件的按钮。可选。
  127. // 内部根据当前运行是创建,可能是input元素,也可能是flash.
  128. pick: '#filePicker',
  129. // 图片数量限制
  130. threads: 5, //上传并发数。允许同时最大上传进程数,为了保证文件上传顺序
  131. fileNumLimit: 5,
  132. // fileSizeLimit: 30 * 1024 * 1024, // 20 M
  133. fileSingleSizeLimit: 5 * 1024 * 1024,// 20 M
  134. // alert(usercode);
  135. formData: {
  136. uploadtype: "Works",
  137. // dataurl: dataUrl,
  138. usercode:1234
  139. },
  140. //可以重复上传
  141. //duplicate: false,
  142. // 只允许选择文件,可选。
  143. accept: {
  144. title: 'Images',
  145. extensions: 'gif,jpg,jpeg,bmp,png',
  146. mimeTypes: 'image/*'
  147. },
  148. // resize: false
  149. });
  150. uploader.on('beforeFileQueued', function(file) {
  151. console.log(file)
  152. });
  153. //上传图片提示
  154. uploader.on('error', function(handler) {
  155. console.log(handler)
  156. if(handler == "Q_EXCEED_NUM_LIMIT") {
  157. mui.toast("超出最大文件数");
  158. }
  159. });
  160. // 当有文件添加进来的时候
  161. uploader.on('fileQueued', function(file) {
  162. $('#image-list').addClass('SHOW');
  163. console.log(file);
  164. var $li = $(
  165. '<div id="' + file.id + '" class="file-item thumbnail">' +
  166. '<div class="image-close">X</div>' +
  167. '<img>' +
  168. '<div class="info">' + file.name + '</div>' +
  169. '</div>'
  170. ),
  171. $img = $li.find('img');
  172. uploader.makeThumb(file, function(error, src) {
  173. if(error) {
  174. $img.replaceWith('<span>不能预览</span>');
  175. return;
  176. }
  177. $img.attr('src', src);
  178. }, thumbnailWidth, thumbnailHeight);
  179. $list.prepend($li);
  180. var IMGLIST = $(".thumbnail");
  181. //绑定删除
  182. $('#' + file.id).on('tap', '.image-close', function() {
  183. uploader.removeFile(file);
  184. var $fileLi = $('#' + file.id);
  185. $fileLi.off().find('.image-close').off().end().remove();
  186. file_num();
  187. });
  188. });
  189. // 文件上传成功,给item添加成功class, 用样式标记上传成功。
  190. uploader.on('uploadSuccess', function(file, response){
  191. // $.each(response.data, function(i, j) {
  192. // var $img = $('#' + file.id).find('img');
  193. // var img = j.fileurl;
  194. // //console.log(img);
  195. // $('#' + file.id).attr({
  196. // 'data-filename': j.filename,
  197. // 'data-fileext': j.fileext,
  198. // 'data-filemd5': j.filemd5,
  199. // 'data-filesize': j.filesize,
  200. // 'data-fileurl': j.fileurl
  201. // });
  202. //
  203. // });
  204. // $('#' + file.id).addClass('upload-state-done');
  205. // file_num();
  206. });
  207. // 文件上传失败,现实上传出错。
  208. uploader.on('uploadError', function(file) {
  209. var $li = $('#' + file.id),
  210. $error = $li.find('div.error');
  211. // 避免重复创建
  212. if(!$error.length) {
  213. $error = $('<div class="error"></div>').appendTo($li);
  214. }
  215. $error.text('上传失败');
  216. });
  217. // 完成上传完了,成功或者失败,先删除进度条。
  218. uploader.on('uploadComplete', function(file) {
  219. $('#' + file.id).find('.progress').remove();
  220. });
  221. });
  222. function file_num() {
  223. // var base64 = reader.result.split(',')[1];
  224. // var dataUrl = 'data:image/png;base64,' + base64;
  225. // var usercode = localStorage.getItem("user"); //获取本地存储
  226. var arr = [];
  227. $('#image-list').find('.thumbnail').each(function(j, m) {
  228. var obj = {
  229. 'filename': $(m).attr("data-filename"),
  230. 'fileext': $(m).attr("data-fileext"),
  231. 'filemd5': $(m).attr("data-filemd5"),
  232. 'filesize': $(m).attr("data-filesize"),
  233. 'fileurl': $(m).attr("data-fileurl")
  234. }
  235. arr.push(obj)
  236. })
  237. window['Faultpic'] = arr;
  238. console.log(Faultpic);
  239. }
  240. </script>
  241. </body>
  242. </html>