123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184 |
- @extends('admin/layout')
- @section('header')
- <link href="{{asset('css/plugins/chosen/chosen.css')}}" rel="stylesheet">
- <link href="{{asset('css/plugins/switchery/switchery.css')}}" rel="stylesheet">
- {{--<link href="{{asset('js/plugins/bootstrap-select-1.13.5/css/bootstrap-select.min.css')}}" rel="stylesheet">--}}
- <link rel="stylesheet"
- href="https://cdn.jsdelivr.net/npm/bootstrap-select@1.13.9/dist/css/bootstrap-select.min.css">
- @endsection
- @section('content')
- <body class="gray-bg">
- <div class="wrapper wrapper-content animated fadeInRight">
- <div class="row">
- <div class="col-sm-12">
- <div class="ibox float-e-margins">
- <div class="ibox-content">
- <form method="get" class="form-horizontal" id="form">
- <input type="hidden" name="" id="">
- <div class="form-group">
- <label class="col-sm-2 control-label" for="nickname"><span
- class="red">* </span>标题:</label>
- <div class="col-sm-6">
- <input type="text" class="form-control" id="title" name="title" autocomplete="off"
- value="{{$messageInfo->title??''}}">
- </div>
- </div>
- <div class="form-group">
- <label class="col-sm-2 control-label" for="username_new"><span class="red">* </span>
- 内容:</label>
- <div class="col-sm-6">
- <input type="text" class="form-control" id="message" name="message"
- value="{{$messageInfo->message??''}}" autocomplete="off">
- </div>
- </div>
- <div class="form-group">
- <label class="col-sm-2 control-label" for="username_new"><span class="red">* </span>
- 链接:</label>
- <div class="col-sm-6">
- <input type="text" class="form-control" id="url" name="url"
- value="{{$messageInfo->url??''}}" autocomplete="off">
- </div>
- </div>
- <div class="form-group">
- <label class="col-sm-2 control-label" for="type"><span
- class="red">* </span>消息类型:</label>
- <div class="col-sm-8">
- @if (empty($messageInfo))
- <select class="form-control" style="width:350px;"
- id="type" name="type">
- <option value="0">请选择消息类型</option>
- <option value="1">网站到期</option>
- <option value="2">ssl证书到期</option>
- <option value="3">cdn加速到期</option>
- <option value="4">网站域名到期</option>
- <option value="5">网站服务期到期</option>
- <option value="6">软文</option>
- <option value="7">报表</option>
- <option value="8">询盘</option>
- </select>
- @else
- <select class="form-control" style="width:350px;"
- id="type" name="type">
- <option value="0" @if ($messageInfo->type==0) selected @endif>请选择消息类型
- </option>
- <option value="1" @if ($messageInfo->type==1) selected @endif>网站到期</option>
- <option value="2" @if ($messageInfo->type==2) selected @endif>ssl证书到期</option>
- <option value="3" @if ($messageInfo->type==3) selected @endif>cdn加速到期</option>
- <option value="4" @if ($messageInfo->type==4) selected @endif>网站域名到期</option>
- <option value="5" @if ($messageInfo->type==5) selected @endif>网站服务期到期</option>
- <option value="5" @if ($messageInfo->type==6) selected @endif>软文</option>
- <option value="5" @if ($messageInfo->type==7) selected @endif>报表</option>
- <option value="5" @if ($messageInfo->type==8) selected @endif>询盘</option>
- </select>
- @endif
- </div>
- </div>
- <div class="form-group">
- <label class="col-sm-2 control-label">banner:</label>
- <div class="col-sm-4">
- <button type="button" class="btn btn-primary" name="file_upload">文件上传
- </button>
- <input type="file" value="" style="display: none" name="uploadFile"
- data-for="logo_img">
- <img id="img" width="200px" src="{{$messageInfo->img??''}}">
- </div>
- </div>
- <div class="form-group">
- <div class="col-sm-4 col-sm-offset-2">
- <button class="btn btn-primary" type="button" data-id="{{$messageInfo->id??0}}"
- id="save">
- 保存
- </button>
- <button class="btn btn-white" type="button" id="cancel">取消</button>
- </div>
- </div>
- </form>
- </div>
- </div>
- </div>
- </div>
- </div>
- </body>
- @endsection
- @section('footer')
- <script src="{{asset('js/plugins/switchery/switchery.js')}}"></script>
- <script src="https://cdn.jsdelivr.net/npm/bootstrap-select@1.13.9/dist/js/bootstrap-select.min.js"></script>
- <script>
- $(document).on('click', '[name=file_upload]', function () {
- $(this).next().trigger('click');
- });
- var jsSwitch = document.querySelector(".js-switch");
- new Switchery(jsSwitch, {color: "#1AB394", size: 'small'});
- $(document).on('click', '#cancel', function () {
- tips.closeParentLayer();
- });
- $(document).on('change', '[name=uploadFile]', function () {
- if (!$(this)[0].files[0]) {
- return;
- }
- var formData = new FormData();
- formData.append('file', $(this)[0].files[0]);
- var ln;
- $.ajax({
- url: '/admin/oss/upload',
- type: 'POST',
- cache: false,
- data: formData,
- processData: false,
- contentType: false,
- beforeSend: function () {
- ln = layer.load();
- },
- complete: function () {
- layer.close(ln);
- },
- success: function (result) {
- var data = result.path;
- $('#img').attr('src', data);
- },
- error: function (XMLHttpRequest) {
- if (XMLHttpRequest.status === 500) {
- layer.alert("异步请求失败", {icon: 5});
- return;
- }
- layer.alert(JSON.parse(XMLHttpRequest.responseText).message, {icon: 0});
- }
- });
- });
- $(document).on('click', '#save', function () {
- var data = tips.getFormValues('#form');
- data.img = $("#img").attr('src');
- var id = $(this).data('id');
- var url = '/admin/message/addOrUpdate/' + id;
- var type = 'get';
- var ajaxConfig = {
- url: url,
- type: type,
- data: data,
- success: function (result) {
- layer.msg(result.message, {icon: 6, time: 1500}, function () {
- tips.closeParentLayer();
- window.parent.tips.tableRefresh('#table');
- });
- }
- };
- tips.ajax(ajaxConfig);
- });
- </script>
- @endsection
|