feedback.html 12 KB

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