feedback.html 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441
  1. {extend name="layout/base" /}
  2. {block name="title"}<title>意见反馈_麻花网络</title>{/block}
  3. {block name="header"}
  4. <link rel="stylesheet" href="__STATIC__/css/mobile/form.css">
  5. <style>
  6. header {
  7. width: 94%;
  8. padding: 3%;
  9. height: auto;
  10. display: flex;
  11. position: fixed;
  12. background: #ffffff;
  13. border-bottom: 0.01rem solid #EEEEEE;
  14. top: 0;
  15. z-index: 2;
  16. }
  17. .feedback_form>div {
  18. overflow: hidden;
  19. }
  20. .feedback_form p{
  21. color: #262228;
  22. line-height: 0.5rem;
  23. font-weight: bold;
  24. }
  25. .feedback_form p b {
  26. color: #FC5351;
  27. }
  28. .feedback_form textarea {
  29. width: 3.33rem;
  30. height: 1.06rem;
  31. padding: 0.1rem;
  32. border: 0.01rem solid #EEEEEE;
  33. border-radius: 0.05rem;
  34. }
  35. .tip_cont {
  36. float: right;
  37. line-height: normal !important;
  38. color: #BCBCBC !important;
  39. font-weight: normal !important;
  40. }
  41. .tip_cont span{
  42. color: #51a7ff;
  43. }
  44. .type input {
  45. width:0.25rem;
  46. height:0.25rem;
  47. appearance: none;
  48. -webkit-appearance: none;
  49. border: none;
  50. background: none;
  51. outline: none;
  52. position: relative;
  53. top: -0.01rem;
  54. }
  55. .type div{
  56. width: 50%;
  57. float: left;
  58. }
  59. .radio_type:before {
  60. content: '';
  61. width: 0.13rem;
  62. height: 0.13rem;
  63. border: 1px solid #626262;
  64. display: flex;
  65. border-radius: 50%;
  66. vertical-align: middle;
  67. }
  68. .radio_type:checked:before {
  69. content: '';
  70. width: 0.13rem;
  71. height: 0.13rem;
  72. border: 1px solid #51a7ff;
  73. display: flex;
  74. border-radius: 50%;
  75. vertical-align: middle;
  76. }
  77. .radio_type:checked:after {
  78. content: '';
  79. width: 0.13rem;
  80. height: 0.13rem;
  81. text-align: center;
  82. background: #51a7ff;
  83. border-radius: 50%;
  84. display: block;
  85. position: absolute;
  86. top: 0.01rem;
  87. left: 0.01rem;
  88. }
  89. .type label {
  90. line-height: 20px;
  91. display: inline-block;
  92. margin-left: 5px;
  93. margin-right: 15px;
  94. color: #777;
  95. }
  96. .submit{
  97. background: #FFA42D;
  98. color: #fff;
  99. font-size: 0.18rem;
  100. height: 0.5rem;
  101. border: none;
  102. border-radius: 0.25rem;
  103. }
  104. .tip_uoload {
  105. font-size: 0.13rem;
  106. color: #BCBCBC !important;
  107. line-height: 0.2rem !important;
  108. font-weight: normal !important;
  109. margin-top: 0.2rem;
  110. }
  111. .contact input {
  112. width:3.43rem;
  113. height: 0.45rem;
  114. line-height: 0.45rem;
  115. border: 0.01rem solid #EEEEEE;
  116. border-radius: 0.05rem;
  117. padding-left: 0.1rem;
  118. }
  119. #upBox{
  120. width: 100%;
  121. position: relative;
  122. margin: 0.2rem 0;
  123. float: left;
  124. }
  125. #inputBox {
  126. width: 1.08rem;
  127. height: 1.08rem;
  128. border: 1px solid #EEEEEE;
  129. color: #B2B2B2;
  130. position: relative;
  131. text-align: center;
  132. line-height: 1.08rem;
  133. overflow: hidden;
  134. font-size: 0.5rem;
  135. bottom: 0px;
  136. float: left;
  137. cursor: pointer;
  138. border-radius: 5px;
  139. }
  140. #inputBox input{
  141. width: 1.08rem;
  142. height: 1.08rem;
  143. opacity: 0;
  144. cursor: pointer;
  145. position: absolute;
  146. top: 0;
  147. left: 0;
  148. }
  149. .imgContainer {
  150. display: inline-block;
  151. width: 1.08rem;
  152. height: 1.08rem;
  153. margin-right: 0.1rem;
  154. position: relative;
  155. box-sizing: border-box;
  156. float: left;
  157. }
  158. .imgContainer img{
  159. width: 100%;
  160. height: 100%;
  161. cursor: pointer;
  162. }
  163. .imgContainer p{
  164. position: absolute;
  165. top: -8px;
  166. right: -6px;
  167. width: 0.2rem;
  168. height: 0.2rem;
  169. background: #fff;
  170. text-align: center;
  171. line-height: 0.2rem;
  172. color: #494949;
  173. font-size: 0.19rem;
  174. font-weight: bold;
  175. cursor: pointer;
  176. border-radius: 50%;
  177. border: 0.01rem solid #D2D2D2;
  178. }
  179. .imgContainer:hover p{
  180. display: block;
  181. }
  182. </style>
  183. {/block}
  184. {block name="content"}
  185. <!-- header start -->
  186. <header>
  187. <a href="javascript:history.back(-1)"><img src="__STATIC__/images/mobile/icon/left.png" class="back"></a>
  188. <h1>意见反馈</h1>
  189. </header>
  190. <!-- header end -->
  191. <div class="feedback">
  192. <p class="tip">如出现无法充值、充值不到账、游戏无法更新、无法注册登录等,可以先联系麻花网络客服QQ:<span>{$kefu}</span></p>
  193. <form class="feedback_form">
  194. <div class="type">
  195. <p>反馈类型<b>*</b></p>
  196. <div>
  197. <input type="radio" name="type" value="1" id="radio1" class="radio_type" />Bug反馈
  198. <label for="radio1"></label>
  199. </div>
  200. <div>
  201. <input type="radio" name="type" value="2" id="radio2" class="radio_type" />游戏相关问题
  202. <label for="radio2"></label>
  203. </div>
  204. <div>
  205. <input type="radio" name="type" value="3" id="radio3" class="radio_type" />优化建议
  206. <label for="radio3"></label>
  207. </div>
  208. <div>
  209. <input type="radio" name="type" value="4" id="radio4" class="radio_type" />其他
  210. <label for="radio4"></label>
  211. </div>
  212. </div>
  213. <div class="content">
  214. <p>反馈内容 <b>*</b></p>
  215. <textarea id="content" maxlength="500" name="content" placeholder="请具体描述您的意见,我们将不断改进"></textarea>
  216. <div>
  217. <p class="tip_cont">最少5个字,最多还可以输入<span id="contentwordage">500</span>个字</p>
  218. </div>
  219. </div>
  220. <div class="contact">
  221. <p>联系QQ</p>
  222. <input placeholder="选填,方便客服人员与您取得联系" class="qq" name="qq"/>
  223. </div>
  224. <div class="upload_img">
  225. <p>上传图片</p>
  226. <!-- <div id="cupload"></div> -->
  227. <div id="upBox">
  228. <div id="imgBox">
  229. </div>
  230. <div id="inputBox"><input type="file" title="请选择图片" id="file" name="file1" accept="image/png,image/jpg,image/JPEG" />+</div>
  231. </div>
  232. <p class="tip_uoload">选填,仅可上传jpg、png、的图片,最多可上传3张,每张不超过3M.</p>
  233. </div>
  234. <input type="button" value="提交" class="submit" id="btnSubmit" />
  235. </form>
  236. </div>
  237. {include file="layout/footer" /}
  238. {/block}
  239. {block name="detail_js"}
  240. <script>
  241. imgUpload({
  242. inputId: 'file', //input框id
  243. imgBox: 'imgBox', //图片容器id
  244. buttonId: 'btnSubmit', //提交按钮id
  245. upUrl: 'Member/member/feedback', //提交地址
  246. data: 'file1', //参数名
  247. num: "3" //上传个数
  248. })
  249. var limitNum = 500;
  250. $('#content').keyup(function() {
  251. var remain = $(this).val().length;
  252. var result = limitNum - remain;
  253. $('#contentwordage').html(result);
  254. });
  255. var imgSrc = []; //图片路径
  256. var imgFile = []; //文件流
  257. var imgName = []; //图片名字
  258. //选择图片
  259. function imgUpload(obj) {
  260. var oInput = '#' + obj.inputId;
  261. var imgBox = '#' + obj.imgBox;
  262. var btn = '#' + obj.buttonId;
  263. $(oInput).on("change", function() {
  264. var fileImg = $(oInput)[0];
  265. var fileList = fileImg.files;
  266. var fileSize = fileImg.files[0].size;
  267. var size = fileSize / 1024;
  268. var name = fileImg.files[0].name;
  269. var fileName = name.substring(name.lastIndexOf(".")+1).toLowerCase();
  270. if(size > 3000 || (fileName !="jpg" && fileName !="png")){
  271. $.alert('请上传不超过3M的.jpg或.png的图片文件。')
  272. return
  273. }
  274. for(var i = 0; i < fileList.length; i++) {
  275. var imgSrcI = getObjectURL(fileList[i]);
  276. imgName.push(fileList[i].name);
  277. imgSrc.push(imgSrcI);
  278. imgFile.push(fileList[i]);
  279. }
  280. addNewContent(imgBox);
  281. if( $(".imgContainer").length > 2){
  282. $("#inputBox").hide();
  283. }
  284. })
  285. $(btn).on('click', function() {
  286. var type = $('input:radio[name="type"]:checked').val();
  287. var content =$("#content").val().length;
  288. var qq = $(".qq").val();
  289. var regexp = /^[1-9]\d{4,9}$/;
  290. if (type == null || content<5 ||(qq != "" && regexp.test(qq) == false)) {
  291. if (type == null ){
  292. $.alert('请选择反馈类型');
  293. return
  294. }
  295. if(content<5){
  296. $.alert('反馈内容不少于5个字');
  297. return
  298. }
  299. if(qq != "" && regexp.test(qq) == false){
  300. $.alert('请输入正确的QQ号');
  301. return
  302. }
  303. }else{
  304. //用formDate对象上传
  305. var fd = new FormData($('form')[0]);
  306. for(var i=0;i<imgFile.length;i++){
  307. fd.append(obj.data+"[]",imgFile[i]);
  308. }
  309. submitPicture(obj.upUrl, fd);
  310. }
  311. })
  312. }
  313. //图片展示
  314. function addNewContent(obj) {
  315. $(imgBox).html("");
  316. for(var a = 0; a < imgSrc.length; a++) {
  317. var oldBox = $(obj).html();
  318. $(obj).html(oldBox + '<div class="imgContainer"><img title=' + imgName[a] + ' alt=' + imgName[a] + ' src=' + imgSrc[a] + ' onclick="imgDisplay(this)"><p onclick="removeImg(this,' + a + ')" class="imgDelete">x</p></div>');
  319. }
  320. }
  321. //删除
  322. function removeImg(obj, index) {
  323. imgSrc.splice(index, 1);
  324. imgFile.splice(index, 1);
  325. imgName.splice(index, 1);
  326. var boxId = "#" + $(obj).parent('.imgContainer').parent().attr("id");
  327. addNewContent(boxId);
  328. if( $(".imgContainer").length < 3){
  329. $("#inputBox").show();
  330. }
  331. $("#file").val('');
  332. }
  333. //限制图片个数
  334. function limitNum(num){
  335. if(!num){
  336. return true;
  337. }else if(imgFile.length>num){
  338. return false;
  339. }else{
  340. return true;
  341. }
  342. }
  343. //上传(将文件流数组传到后台)
  344. function submitPicture(url,data) {
  345. for (var p of data) {
  346. console.log(p);
  347. }
  348. $.ajax({
  349. type: "post",
  350. url: url,
  351. async: true,
  352. data: data,
  353. processData: false,
  354. contentType: false,
  355. success: function(dat) {
  356. console.log(dat);
  357. if (dat.code==1){
  358. $.modal({
  359. title: "提示",
  360. text: dat.msg,
  361. buttons: [{
  362. text: "确定",
  363. onClick: function() {
  364. window.location.href =dat.url
  365. }
  366. }
  367. ]
  368. });
  369. }else {
  370. $.alert(dat.msg);
  371. }
  372. },
  373. error: function () {
  374. alert("网络错误,请刷新页面重试");
  375. }
  376. });
  377. }
  378. //图片灯箱
  379. function imgDisplay(obj) {
  380. var src = $(obj).attr("src");
  381. var imgHtml = '<div style="width: 100%;height: 100vh;overflow: auto;background: rgba(0,0,0,0.5);text-align: center;position: fixed;top: 0;left: 0;z-index: 1000;"><img src=' + src + ' style="margin-top: 100px;width: 70%;margin-bottom: 100px;"/><p style="font-size: 50px;position: fixed;top: 30px;right: 30px;color: white;cursor: pointer;" onclick="closePicture(this)">×</p></div>'
  382. $('body').append(imgHtml);
  383. }
  384. //关闭
  385. function closePicture(obj) {
  386. $(obj).parent("div").remove();
  387. }
  388. //图片预览路径
  389. function getObjectURL(file) {
  390. var url = null;
  391. if(window.createObjectURL != undefined) { // basic
  392. url = window.createObjectURL(file);
  393. } else if(window.URL != undefined) { // mozilla(firefox)
  394. url = window.URL.createObjectURL(file);
  395. } else if(window.webkitURL != undefined) { // webkit or chrome
  396. url = window.webkitURL.createObjectURL(file);
  397. }
  398. return url;
  399. }
  400. </script>
  401. {/block}