updateplatform.html 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <meta charset="utf-8">
  5. <meta http-equiv="X-UA-Compatible" content="IE=edge">
  6. <title></title>
  7. <meta name="description" content="">
  8. <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
  9. <meta name="robots" content="all,follow">
  10. <!-- Bootstrap CSS-->
  11. <link rel="stylesheet" href="__VENDOR__/bootstrap/css/bootstrap.min.css">
  12. <!-- Font Awesome CSS-->
  13. <link rel="stylesheet" href="__VENDOR__/font-awesome/css/font-awesome.min.css">
  14. <!-- Fontastic Custom icon font-->
  15. <!--<link rel="stylesheet" href="__CSS__/fontastic.css">-->
  16. <link rel="stylesheet" href="__CSS__/iconfont.css">
  17. <!-- Google fonts - Poppins -->
  18. <link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Poppins:300,400,700">
  19. <!-- theme stylesheet-->
  20. <link rel="stylesheet" href="__CSS__/style.default.css" id="theme-stylesheet">
  21. <!-- Custom stylesheet - for your changes-->
  22. <link rel="stylesheet" href="__CSS__/custom.css">
  23. <!-- Favicon-->
  24. <link rel="shortcut icon" href="__IMG__/favicon.ico">
  25. <!-- Tweaks for older IEs--><!--[if lt IE 9]>
  26. <script src="https://oss.maxcdn.com/html5shiv/3.7.3/html5shiv.min.js"></script>
  27. <script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script><![endif]-->
  28. </head>
  29. <body>
  30. <div class="page">
  31. <!-- Main Navbar-->
  32. {include file="layout/header" /}
  33. <div class="page-content d-flex align-items-stretch">
  34. <!-- Side Navbar -->
  35. {include file="layout/navigation" /}
  36. <div class="content-inner">
  37. <!-- Page Header-->
  38. <header class="page-header">
  39. <div class="container-fluid">
  40. <h2 class="no-margin-bottom">平台编辑</h2>
  41. </div>
  42. </header>
  43. <!-- Breadcrumb-->
  44. <div class="breadcrumb-holder container-fluid">
  45. <ul class="breadcrumb">
  46. <li class="breadcrumb-item">平台管理</li>
  47. <li class="breadcrumb-item">平台列表</li>
  48. <li class="breadcrumb-item active">平台编辑</li>
  49. </ul>
  50. </div>
  51. <!-- Forms Section-->
  52. <section class="forms">
  53. <div class="container-fluid">
  54. <div class="row">
  55. <!-- Form Elements -->
  56. <div class="col-lg-12">
  57. <div class="card">
  58. <div class="card-header d-flex align-items-center">
  59. <h3 class="h4">平台编辑</h3>
  60. </div>
  61. <div class="card-body">
  62. <form class="form-horizontal">
  63. <div class="form-group row">
  64. <label style="margin: 8px 0px 0px 30px; width: 80px;" class="form-control-label">平台名称:</label>
  65. <div class="col-sm-9">
  66. <input type="text" id="platform_name" value="{$platform['platform_name']}" class="form-control">
  67. <input type="text" id="platform_id" value="{$platform['platform_id']}" style="display: none">
  68. </div>
  69. </div>
  70. <div class="line"></div>
  71. <div class="form-group row">
  72. <label style="margin: 8px 0px 0px 30px; width: 80px;" class="form-control-label">平台邮箱:</label>
  73. <div class="col-sm-9">
  74. <input type="text" value="{$platform['platform_email']}" id="platform_email" class="form-control">
  75. </div>
  76. </div>
  77. <div class="line"></div>
  78. <div class="form-group row">
  79. <label style="margin: 8px 0px 0px 30px; width: 80px;" class="form-control-label">平台电话:</label>
  80. <div class="col-sm-9">
  81. <input type="text" id="platform_phone" value="{$platform['platform_phone']}" class="form-control">
  82. </div>
  83. </div>
  84. <div class="line"></div>
  85. <div class="form-group row">
  86. <label style="margin: 8px 0px 0px 30px; width: 80px;" class="form-control-label">平台图标:</label>
  87. <div class="layui-input-block" style="display: flex;">
  88. <input id="file" style="border-style: hidden;border-left: 1px solid #ededed;width: 150px;" type="file" class="layui-input field-name" name="file"/>
  89. <div style="display: flex;margin-left: 20px;">
  90. 所选图标:
  91. <img id="onFile" src="__IMG__/map-marker-violet.png" style="width: 30px;height: 30px">
  92. </div>
  93. <div style="display: flex;margin-left: 20px;">
  94. 原图标:
  95. <img src="{$platform['platform_img']}" style="width: 30px;height: 30px">
  96. </div>
  97. </div>
  98. </div>
  99. <div class="line"></div>
  100. <div class="form-group row">
  101. <label style="margin: 8px 0px 0px 30px; width: 80px;" class="form-control-label">状&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;态:<br></label>
  102. <div class="col-sm-9" style="display: flex; line-height: 2.5;">
  103. <div>
  104. <input id="optionsRadios1" type="radio" {$platform['platform_status'] == 1 ? 'checked' : ''} value="1" name="platform_status">
  105. <label for="optionsRadios1">启用</label>
  106. </div>
  107. <div style="margin-left: 30px;">
  108. <input id="optionsRadios2" type="radio" value="2" {$platform['platform_status'] == 2 ? 'checked' : ''} name="platform_status">
  109. <label for="optionsRadios2">禁用</label>
  110. </div>
  111. </div>
  112. </div>
  113. <div class="line"></div>
  114. <div class="form-group row">
  115. <label style="margin: 8px 0px 0px 30px; width: 80px;" class="form-control-label">验证网址:</label>
  116. <div class="col-sm-9">
  117. <div class="input-group">
  118. <input id="newPlatformUrl" type="text" class="form-control">
  119. <div class="input-group-append">
  120. <button onclick="addPlatformUrl()" type="button" class="btn btn-primary">添加</button>
  121. </div>
  122. </div>
  123. </div>
  124. <div class="col-sm-9" style="margin-left: 110px">
  125. <div class="card-body no-padding" id="platformUrl">
  126. <?php
  127. $platformUrl = json_decode($platform['platform_url']);
  128. foreach ($platformUrl as $k=>$va):
  129. ?>
  130. <div class="item d-flex">
  131. <label style="width: 90%; word-break: break-all;">{$va}</label>
  132. <div style="display: flex; align-items: center;">
  133. <i onclick="deleteUrl({$k})" class="icon iconfont icon-delete" style="margin-left: 20px; color: red; font-size: 20px; cursor:pointer"></i>
  134. </div>
  135. </div>
  136. <?php endforeach; ?>
  137. </div>
  138. </div>
  139. </div>
  140. <div class="line"></div>
  141. <div class="form-group row">
  142. <label style="margin: 8px 0px 0px 30px; width: 80px;" class="form-control-label">备&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;注:</label>
  143. <div class="col-sm-9">
  144. <textarea id="platform_remark" class="form-control">{$platform['platform_remark']}</textarea>
  145. </div>
  146. </div>
  147. <div class="line"></div>
  148. <div class="form-group row">
  149. <div class="col-sm-4" style="margin-left: 110px;">
  150. <a class="btn btn-primary" onclick="onSubmit()" style="color: #fff">提交</a>
  151. <a class="btn btn-secondary" onclick="goBack()" style="color: #fff">返回</a>
  152. </div>
  153. </div>
  154. </form>
  155. </div>
  156. </div>
  157. </div>
  158. </div>
  159. </div>
  160. </section>
  161. <!-- Page Footer-->
  162. {include file="layout/footer" /}
  163. </div>
  164. </div>
  165. </div>
  166. <!-- JavaScript files-->
  167. <script src="__VENDOR__/jquery/jquery.min.js"></script>
  168. <script src="__VENDOR__/popper.js/umd/popper.min.js"> </script>
  169. <script src="__VENDOR__/bootstrap/js/bootstrap.min.js"></script>
  170. <script src="__VENDOR__/jquery.cookie/jquery.cookie.js"> </script>
  171. <script src="__VENDOR__/chart.js/Chart.min.js"></script>
  172. <script src="__VENDOR__/jquery-validation/jquery.validate.min.js"></script>
  173. <script src="__JS__/jquery.form.js"></script>
  174. <script src="__JS__/plugins/layer/layer.min.js"></script>
  175. <!-- Main File-->
  176. <script src="__JS__/front.js"></script>
  177. <script>
  178. let platformUrl = {$platform['platform_url']};
  179. function deleteUrl($k) {
  180. platformUrl.splice($k, 1);
  181. let newPlatformUrl = '';
  182. for(let key in platformUrl) {
  183. newPlatformUrl += '<div class="item d-flex">' +
  184. '<label style="width: 90%; word-break: break-all;">'+platformUrl[key]+'</label>' +
  185. '<div style="display: flex; align-items: center;">' +
  186. '<i onclick="deleteUrl('+key+')" class="icon iconfont icon-delete" style="margin-left: 20px; color: red; font-size: 20px; cursor:pointer"></i>' +
  187. '</div>' +
  188. '</div>';
  189. }
  190. $("#platformUrl").html(newPlatformUrl);
  191. }
  192. function addPlatformUrl() {
  193. let newPlatformUrl = $("#newPlatformUrl").val();
  194. platformUrl.push(newPlatformUrl);
  195. let nowPlatformUrl = '';
  196. for(let key in platformUrl) {
  197. nowPlatformUrl += '<div class="item d-flex">' +
  198. '<label style="width: 90%; word-break: break-all;">'+platformUrl[key]+'</label>' +
  199. '<div style="display: flex; align-items: center;">' +
  200. '<span onclick="deleteUrl('+key+')" class="icon iconfont icon-delete" style="margin-left: 20px; color: red; font-size: 20px; cursor:pointer"></span>' +
  201. '</div>' +
  202. '</div>';
  203. }
  204. $("#platformUrl").html(nowPlatformUrl);
  205. }
  206. function onSubmit() {
  207. let formData = new FormData();
  208. if ($("#file")[0].files[0]) {
  209. formData.append("file",$("#file")[0].files[0]);
  210. }
  211. formData.append("platform_id",$("#platform_id").val());
  212. formData.append("platform_name",$("#platform_name").val());
  213. formData.append("platform_email",$("#platform_email").val());
  214. formData.append("platform_phone",$("#platform_phone").val());
  215. formData.append("platform_status",$("input[name='platform_status']:checked").val());
  216. formData.append("platform_remark",$("#platform_remark").val());
  217. formData.append("platform_url",JSON.stringify(platformUrl));
  218. $.ajax({
  219. url: "{:url('admin/index/updatePlatform')}", /*接口域名地址*/
  220. type:'post',
  221. data: formData,
  222. contentType: false,
  223. processData: false,
  224. success:function(res){
  225. if(res.code == 1){
  226. layer.alert(res.msg, {title: '友情提示', icon: 1, closeBtn: 0}, function(){
  227. let urlParam = "{:url('admin/index/platformList')}";
  228. window.location.href = urlParam;
  229. });
  230. } else {
  231. layer.alert(res.msg, {title: '友情提示', icon: 2});
  232. }
  233. }
  234. });
  235. /*$.getJSON("{:url('admin/index/updatePlatform')}", param, function(res){
  236. if(1 == res.code){
  237. layer.alert(res.msg, {title: '友情提示', icon: 1, closeBtn: 0}, function(){
  238. let urlParam = "{:url('admin/index/platformList')}";
  239. window.location.href = urlParam;
  240. });
  241. }else{
  242. layer.alert(res.msg, {title: '友情提示', icon: 2});
  243. }
  244. });*/
  245. }
  246. function goBack() {
  247. let urlParam = "{:url('admin/index/platformList')}";
  248. window.location.href = urlParam;
  249. }
  250. // 图片预览.
  251. $(function() {
  252. $("#file").change(function(e) {
  253. var imgBox = e.target;
  254. uploadImg(imgBox)
  255. });
  256. function uploadImg(tag) {
  257. var file = tag.files[0];
  258. var imgSrc;
  259. if (!/image\/\w+/.test(file.type)) {
  260. layer.alert("您选择的图片格式错误", {title: '友情提示', icon: 2});
  261. let fileIput = $("#file").val("");
  262. //fileIput.after(fileIput.clone().val(""));
  263. $("#onFile").attr("src", '__IMG__//map-marker-violet.png');
  264. //fileIput.remove();
  265. return false;
  266. }
  267. var reader = new FileReader();
  268. reader.readAsDataURL(file);
  269. reader.onload = function() {
  270. imgSrc = this.result;
  271. $("#onFile").attr("src", imgSrc);
  272. };
  273. }
  274. })
  275. </script>
  276. </body>
  277. </html>