| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280 |
- <!DOCTYPE html>
- <html>
- <head>
- <meta charset="utf-8">
- <meta http-equiv="X-UA-Compatible" content="IE=edge">
- <title></title>
- <meta name="description" content="">
- <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
- <meta name="robots" content="all,follow">
- <!-- Bootstrap CSS-->
- <link rel="stylesheet" href="__VENDOR__/bootstrap/css/bootstrap.min.css">
- <!-- Font Awesome CSS-->
- <link rel="stylesheet" href="__VENDOR__/font-awesome/css/font-awesome.min.css">
- <!-- Fontastic Custom icon font-->
- <!--<link rel="stylesheet" href="__CSS__/fontastic.css">-->
- <link rel="stylesheet" href="__CSS__/iconfont.css">
- <!-- Google fonts - Poppins -->
- <link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Poppins:300,400,700">
- <!-- theme stylesheet-->
- <link rel="stylesheet" href="__CSS__/style.default.css" id="theme-stylesheet">
- <!-- Custom stylesheet - for your changes-->
- <link rel="stylesheet" href="__CSS__/custom.css">
- <!-- Favicon-->
- <link rel="shortcut icon" href="__IMG__/favicon.ico">
- <!-- Tweaks for older IEs--><!--[if lt IE 9]>
- <script src="https://oss.maxcdn.com/html5shiv/3.7.3/html5shiv.min.js"></script>
- <script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script><![endif]-->
- </head>
- <body>
- <div class="page">
- <!-- Main Navbar-->
- {include file="layout/header" /}
- <div class="page-content d-flex align-items-stretch">
- <!-- Side Navbar -->
- {include file="layout/navigation" /}
- <div class="content-inner">
- <!-- Page Header-->
- <header class="page-header">
- <div class="container-fluid">
- <h2 class="no-margin-bottom">平台编辑</h2>
- </div>
- </header>
- <!-- Breadcrumb-->
- <div class="breadcrumb-holder container-fluid">
- <ul class="breadcrumb">
- <li class="breadcrumb-item">平台管理</li>
- <li class="breadcrumb-item">平台列表</li>
- <li class="breadcrumb-item active">平台编辑</li>
- </ul>
- </div>
- <!-- Forms Section-->
- <section class="forms">
- <div class="container-fluid">
- <div class="row">
- <!-- Form Elements -->
- <div class="col-lg-12">
- <div class="card">
- <div class="card-header d-flex align-items-center">
- <h3 class="h4">平台编辑</h3>
- </div>
- <div class="card-body">
- <form class="form-horizontal">
- <div class="form-group row">
- <label style="margin: 8px 0px 0px 30px; width: 80px;" class="form-control-label">平台名称:</label>
- <div class="col-sm-9">
- <input type="text" id="platform_name" value="{$platform['platform_name']}" class="form-control">
- <input type="text" id="platform_id" value="{$platform['platform_id']}" style="display: none">
- </div>
- </div>
- <div class="line"></div>
- <div class="form-group row">
- <label style="margin: 8px 0px 0px 30px; width: 80px;" class="form-control-label">平台邮箱:</label>
- <div class="col-sm-9">
- <input type="text" value="{$platform['platform_email']}" id="platform_email" class="form-control">
- </div>
- </div>
- <div class="line"></div>
- <div class="form-group row">
- <label style="margin: 8px 0px 0px 30px; width: 80px;" class="form-control-label">平台电话:</label>
- <div class="col-sm-9">
- <input type="text" id="platform_phone" value="{$platform['platform_phone']}" class="form-control">
- </div>
- </div>
- <div class="line"></div>
- <div class="form-group row">
- <label style="margin: 8px 0px 0px 30px; width: 80px;" class="form-control-label">平台图标:</label>
- <div class="layui-input-block" style="display: flex;">
- <input id="file" style="border-style: hidden;border-left: 1px solid #ededed;width: 150px;" type="file" class="layui-input field-name" name="file"/>
- <div style="display: flex;margin-left: 20px;">
- 所选图标:
- <img id="onFile" src="__IMG__/map-marker-violet.png" style="width: 30px;height: 30px">
- </div>
- <div style="display: flex;margin-left: 20px;">
- 原图标:
- <img src="{$platform['platform_img']}" style="width: 30px;height: 30px">
- </div>
- </div>
- </div>
- <div class="line"></div>
- <div class="form-group row">
- <label style="margin: 8px 0px 0px 30px; width: 80px;" class="form-control-label">状 态:<br></label>
- <div class="col-sm-9" style="display: flex; line-height: 2.5;">
- <div>
- <input id="optionsRadios1" type="radio" {$platform['platform_status'] == 1 ? 'checked' : ''} value="1" name="platform_status">
- <label for="optionsRadios1">启用</label>
- </div>
- <div style="margin-left: 30px;">
- <input id="optionsRadios2" type="radio" value="2" {$platform['platform_status'] == 2 ? 'checked' : ''} name="platform_status">
- <label for="optionsRadios2">禁用</label>
- </div>
- </div>
- </div>
- <div class="line"></div>
- <div class="form-group row">
- <label style="margin: 8px 0px 0px 30px; width: 80px;" class="form-control-label">验证网址:</label>
- <div class="col-sm-9">
- <div class="input-group">
- <input id="newPlatformUrl" type="text" class="form-control">
- <div class="input-group-append">
- <button onclick="addPlatformUrl()" type="button" class="btn btn-primary">添加</button>
- </div>
- </div>
- </div>
- <div class="col-sm-9" style="margin-left: 110px">
- <div class="card-body no-padding" id="platformUrl">
- <?php
- $platformUrl = json_decode($platform['platform_url']);
- foreach ($platformUrl as $k=>$va):
- ?>
- <div class="item d-flex">
- <label style="width: 90%; word-break: break-all;">{$va}</label>
- <div style="display: flex; align-items: center;">
- <i onclick="deleteUrl({$k})" class="icon iconfont icon-delete" style="margin-left: 20px; color: red; font-size: 20px; cursor:pointer"></i>
- </div>
- </div>
- <?php endforeach; ?>
- </div>
- </div>
- </div>
- <div class="line"></div>
- <div class="form-group row">
- <label style="margin: 8px 0px 0px 30px; width: 80px;" class="form-control-label">备 注:</label>
- <div class="col-sm-9">
- <textarea id="platform_remark" class="form-control">{$platform['platform_remark']}</textarea>
- </div>
- </div>
- <div class="line"></div>
- <div class="form-group row">
- <div class="col-sm-4" style="margin-left: 110px;">
- <a class="btn btn-primary" onclick="onSubmit()" style="color: #fff">提交</a>
- <a class="btn btn-secondary" onclick="goBack()" style="color: #fff">返回</a>
- </div>
- </div>
- </form>
- </div>
- </div>
- </div>
- </div>
- </div>
- </section>
- <!-- Page Footer-->
- {include file="layout/footer" /}
- </div>
- </div>
- </div>
- <!-- JavaScript files-->
- <script src="__VENDOR__/jquery/jquery.min.js"></script>
- <script src="__VENDOR__/popper.js/umd/popper.min.js"> </script>
- <script src="__VENDOR__/bootstrap/js/bootstrap.min.js"></script>
- <script src="__VENDOR__/jquery.cookie/jquery.cookie.js"> </script>
- <script src="__VENDOR__/chart.js/Chart.min.js"></script>
- <script src="__VENDOR__/jquery-validation/jquery.validate.min.js"></script>
- <script src="__JS__/jquery.form.js"></script>
- <script src="__JS__/plugins/layer/layer.min.js"></script>
- <!-- Main File-->
- <script src="__JS__/front.js"></script>
- <script>
- let platformUrl = {$platform['platform_url']};
- function deleteUrl($k) {
- platformUrl.splice($k, 1);
- let newPlatformUrl = '';
- for(let key in platformUrl) {
- newPlatformUrl += '<div class="item d-flex">' +
- '<label style="width: 90%; word-break: break-all;">'+platformUrl[key]+'</label>' +
- '<div style="display: flex; align-items: center;">' +
- '<i onclick="deleteUrl('+key+')" class="icon iconfont icon-delete" style="margin-left: 20px; color: red; font-size: 20px; cursor:pointer"></i>' +
- '</div>' +
- '</div>';
- }
- $("#platformUrl").html(newPlatformUrl);
- }
- function addPlatformUrl() {
- let newPlatformUrl = $("#newPlatformUrl").val();
- platformUrl.push(newPlatformUrl);
- let nowPlatformUrl = '';
- for(let key in platformUrl) {
- nowPlatformUrl += '<div class="item d-flex">' +
- '<label style="width: 90%; word-break: break-all;">'+platformUrl[key]+'</label>' +
- '<div style="display: flex; align-items: center;">' +
- '<span onclick="deleteUrl('+key+')" class="icon iconfont icon-delete" style="margin-left: 20px; color: red; font-size: 20px; cursor:pointer"></span>' +
- '</div>' +
- '</div>';
- }
- $("#platformUrl").html(nowPlatformUrl);
- }
- function onSubmit() {
- let formData = new FormData();
- if ($("#file")[0].files[0]) {
- formData.append("file",$("#file")[0].files[0]);
- }
- formData.append("platform_id",$("#platform_id").val());
- formData.append("platform_name",$("#platform_name").val());
- formData.append("platform_email",$("#platform_email").val());
- formData.append("platform_phone",$("#platform_phone").val());
- formData.append("platform_status",$("input[name='platform_status']:checked").val());
- formData.append("platform_remark",$("#platform_remark").val());
- formData.append("platform_url",JSON.stringify(platformUrl));
- $.ajax({
- url: "{:url('admin/index/updatePlatform')}", /*接口域名地址*/
- type:'post',
- data: formData,
- contentType: false,
- processData: false,
- success:function(res){
- if(res.code == 1){
- layer.alert(res.msg, {title: '友情提示', icon: 1, closeBtn: 0}, function(){
- let urlParam = "{:url('admin/index/platformList')}";
- window.location.href = urlParam;
- });
- } else {
- layer.alert(res.msg, {title: '友情提示', icon: 2});
- }
- }
- });
- /*$.getJSON("{:url('admin/index/updatePlatform')}", param, function(res){
- if(1 == res.code){
- layer.alert(res.msg, {title: '友情提示', icon: 1, closeBtn: 0}, function(){
- let urlParam = "{:url('admin/index/platformList')}";
- window.location.href = urlParam;
- });
- }else{
- layer.alert(res.msg, {title: '友情提示', icon: 2});
- }
- });*/
- }
- function goBack() {
- let urlParam = "{:url('admin/index/platformList')}";
- window.location.href = urlParam;
- }
- // 图片预览.
- $(function() {
- $("#file").change(function(e) {
- var imgBox = e.target;
- uploadImg(imgBox)
- });
- function uploadImg(tag) {
- var file = tag.files[0];
- var imgSrc;
- if (!/image\/\w+/.test(file.type)) {
- layer.alert("您选择的图片格式错误", {title: '友情提示', icon: 2});
- let fileIput = $("#file").val("");
- //fileIput.after(fileIput.clone().val(""));
- $("#onFile").attr("src", '__IMG__//map-marker-violet.png');
- //fileIput.remove();
- return false;
- }
- var reader = new FileReader();
- reader.readAsDataURL(file);
- reader.onload = function() {
- imgSrc = this.result;
- $("#onFile").attr("src", imgSrc);
- };
- }
- })
- </script>
- </body>
- </html>
|