123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333 |
- @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 rel="stylesheet"
- href="https://cdn.jsdelivr.net/npm/bootstrap-select@1.13.9/dist/css/bootstrap-select.min.css">
- @endsection
- @section('content')
- <style>
- .image-li img {
- width: 100%;
- max-height: 100%;
- }
- .imageDiv {
- border: 2px solid #F0F0F0;
- border-radius: 5px;
- }
- .image-li {
- list-style-type: none;
- cursor: pointer;
- float: left;
- width: 200px;
- padding: 5px 5px;
- text-align: center;
- }
- </style>
- <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">
- <div class="form-group">
- <label class="col-sm-2 control-label" for="theme"><span
- class="red">* </span>广告主题:</label>
- <div class="col-sm-6">
- <input type="text" class="form-control" id="theme" name="theme"
- value="{{$info->theme??''}}" autocomplete="off">
- </div>
- </div>
- <div class="form-group">
- <label class="col-sm-2 control-label" for="advert_id">投放位置:</label>
- <div class="col-sm-6">
- <select class="form-control" id="advert_id" name="advert_id">
- @foreach($advertList as $key=>$item)
- <option value="{{$item->id}}"
- @if (!empty($advertId) && $advertId==$item->id) selected @endif>{{$item->name}}
- [ {{$item->code}} ]
- </option>
- @endforeach
- </select>
- </div>
- </div>
- <div class="form-group">
- <label class="col-sm-2 control-label" for="type">展现形式:</label>
- <div class="col-sm-6">
- <select class="form-control" id="type" name="type" onchange="changeType()">
- <option value="none"
- @if (!empty($info->type) && $info->type=='none') selected @endif>请选择
- </option>
- <option value="text"
- @if (!empty($info->type) && $info->type=='text') selected @endif>文本
- </option>
- <option value="image"
- @if (!empty($info->type) && $info->type=='image') selected @endif>图片
- </option>
- <option value="html"
- @if (!empty($info->type) && $info->type=='html') selected @endif>HTML
- </option>
- </select>
- </div>
- </div>
- <div style="display: none" class="text">
- <div class="form-group">
- <label class="col-sm-2 control-label" for="text_description">内容文本:</label>
- <div class="col-sm-6">
- <input type="text" class="form-control" id="text_description"
- name="text_description"
- value="{{$info->description??''}}" autocomplete="off">
- </div>
- </div>
- <div class="form-group">
- <label class="col-sm-2 control-label" for="text_link">链接地址:</label>
- <div class="col-sm-6">
- <input type="text" class="form-control" id="text_link" name="text_link"
- value="{{$info->link??''}}" autocomplete="off">
- </div>
- </div>
- </div>
- <div style="display: none" class="html">
- <div class="form-group">
- <label class="col-sm-2 control-label" for="html">HTML代码:</label>
- <div class="col-sm-6">
- <input type="text" class="form-control" id="html" name="html"
- value="{{$info->html??''}}" autocomplete="off">
- </div>
- </div>
- </div>
- <div style="display: none" class="image">
- <div class="form-group">
- <label class="col-sm-2 control-label" for="image">图片上传:</label>
- <button type="button" class="btn btn-primary" onclick="addImages('advertise')">
- 图片上传
- </button>
- <input type="hidden" value="{{$info->source??''}}" id="source">
- <div id="images">
- </div>
- </div>
- <div class="form-group">
- <label class="col-sm-2 control-label" for="description">图片说明:</label>
- <div class="col-sm-6">
- <input type="text" class="form-control" id="description" name="description"
- value="{{$info->description??''}}" autocomplete="off">
- </div>
- </div>
- <div class="form-group">
- <label class="col-sm-2 control-label" for="description_two">图片说明2:</label>
- <div class="col-sm-6">
- <input type="text" class="form-control" id="description_two"
- name="description_two"
- value="{{$info->description_two??''}}" autocomplete="off">
- </div>
- </div>
- <div class="form-group">
- <label class="col-sm-2 control-label" for="description_three">图片说明3:</label>
- <div class="col-sm-6">
- <input type="text" class="form-control" id="description_three"
- name="description_three"
- value="{{$info->description_three??''}}" autocomplete="off">
- </div>
- </div>
- <div class="form-group">
- <label class="col-sm-2 control-label" for="link">图片链接:</label>
- <div class="col-sm-6">
- <input type="text" class="form-control my-date"
- name="link" id="link"
- value="{{$info->link??''}}" autocomplete="off">
- </div>
- </div>
- <div class="form-group">
- <label class="col-sm-2 control-label" for="button">按钮名称1:</label>
- <div class="col-sm-6">
- <input type="text" class="form-control my-date"
- name="button" id="button"
- value="{{$info->button??''}}" autocomplete="off">
- </div>
- </div>
- <div class="form-group">
- <label class="col-sm-2 control-label" for="button_link">按钮链接1:</label>
- <div class="col-sm-6">
- <input type="text" class="form-control my-date"
- name="button_link" id="button_link"
- value="{{$info->button_link??''}}" autocomplete="off">
- </div>
- </div>
- <div class="form-group">
- <label class="col-sm-2 control-label" for="button_two">按钮名称2:</label>
- <div class="col-sm-6">
- <input type="text" class="form-control my-date"
- name="button_two" id="button_two"
- value="{{$info->button_two??''}}" autocomplete="off">
- </div>
- </div>
- <div class="form-group">
- <label class="col-sm-2 control-label" for="button_two_link">按钮链接2:</label>
- <div class="col-sm-6">
- <input type="text" class="form-control my-date"
- name="button_two_link" id="button_two_link"
- value="{{$info->button_two_link??''}}" autocomplete="off">
- </div>
- </div>
- </div>
- <div class="form-group">
- <label class="col-sm-2 control-label" for="start_time">投放起始时间:</label>
- <div class="col-sm-6">
- <input type="text" class="form-control my-date deadline"
- name="start_time" id="start_time"
- value="{{$info->start_time??''}}" autocomplete="off">
- </div>
- </div>
- <div class="form-group">
- <label class="col-sm-2 control-label" for="end_time">投放截止时间:</label>
- <div class="col-sm-6">
- <input type="text" class="form-control my-date deadline"
- name="end_time" id="end_time"
- value="{{$info->end_time??''}}" autocomplete="off">
- </div>
- </div>
- <div class="form-group">
- <label class="col-sm-2 control-label" for="is_enabled">是否启用:</label>
- <div class="col-sm-6">
- <input type="radio" name="is_enabled" value="0"
- @if (empty($info->is_enabled)) checked="checked" @endif>启用
- <input type="radio" name="is_enabled" value="1"
- @if (!empty($info->is_enabled) && $info->is_enabled=='1') checked="checked" @endif>禁用
- </div>
- </div>
- <div class="form-group">
- <div class="col-sm-4 col-sm-offset-2">
- <button class="btn btn-primary" type="button" data-id="{{$info->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 src="{{asset('js/plugins/layDate-v5.0.9/laydate/laydate.js')}}"></script>
- <script>
- function addImages(type) {
- layer.open({
- type: 2,
- content: ['/admin/stencil/images/{{$siteId}}/' + type],
- area: ['80%', '80%'],
- title: '编辑'
- });
- }
- $(document).on('click', '.js-del-item', function () {
- $(this).parent().parent().remove();
- });
- changeType();
- //同时绑定多个
- lay('.deadline').each(function () {
- laydate.render({
- elem: this
- , trigger: 'click'
- , type: 'datetime'
- });
- });
- $(document).on('click', '#cancel', function () {
- tips.closeParentLayer();
- });
- $(document).on('click', '#save', function () {
- var data = tips.getFormValues('#form');
- var id = $(this).data('id');
- data.source = $('#images').find("img").attr('src');
- if (data.type === 'none') {
- layer.alert('请选择展现形式', {icon: 0});
- return;
- }
- var ajaxConfig = {
- url: '/admin/advertise/setting-edit/' + id + '/{{$siteId}}/{{$advertId}}',
- type: 'post',
- data: data,
- success: function (result) {
- layer.msg(result.message, {icon: 6, time: 1500}, function () {
- tips.closeParentLayer();
- window.parent.tips.tableRefresh('#table');
- });
- }
- };
- tips.ajax(ajaxConfig);
- });
- function changeType() {
- var type = $('#type').val();
- if (type === 'none') {
- $(".text").css("display", "none");
- $(".image").css("display", "none");
- $(".html").css("display", "none");
- }
- if (type === 'text') {
- $(".text").css("display", "block");
- $(".image").css("display", "none");
- $(".html").css("display", "none");
- }
- if (type === 'image') {
- $(".text").css("display", "none");
- $(".image").css("display", "block");
- $(".html").css("display", "none");
- var object = $('#images');
- object.empty();
- var source = $('#source').val();
- if (source) {
- var thumb =
- '<div class="col-sm-2 control-label">' +
- '</div>' +
- '<li class="image-li">' +
- '<div class="imageDiv">' +
- '<div style="justify-content: center;align-items: center;flex-direction: column;overflow: hidden;margin: auto;">' +
- '<img src="' + source + '" alt="' + source + '">' +
- '</div>' +
- '<div style="white-space: nowrap;overflow: hidden;text-overflow: ellipsis;padding: 10px;">' + source + '</div>' +
- '<a href="javascript:;" class="js-del-item">' +
- '<i class="fa fa-remove"></i>移除' +
- '</a>' +
- '</div>' +
- '</li>';
- object.append(thumb);
- }
- }
- if (type === 'html') {
- $(".text").css("display", "none");
- $(".image").css("display", "none");
- $(".html").css("display", "block");
- }
- }
- </script>
- @endsection
|