调整banner
parent
6ba5088785
commit
f45495b6fb
|
|
@ -24,6 +24,10 @@ class BannerAdController extends AdminController
|
||||||
$query->where('name', 'like', '%'.$request->input('q').'%');
|
$query->where('name', 'like', '%'.$request->input('q').'%');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ($request->filled('id')) {
|
||||||
|
$query->where('id',$request->input('id'));
|
||||||
|
}
|
||||||
|
|
||||||
$query->select(['id', 'name as text', 'width', 'height']);
|
$query->select(['id', 'name as text', 'width', 'height']);
|
||||||
|
|
||||||
if ($request->filled('_paginate')) {
|
if ($request->filled('_paginate')) {
|
||||||
|
|
@ -74,7 +78,11 @@ class BannerAdController extends AdminController
|
||||||
{
|
{
|
||||||
return Form::make(new BannerAd(), function (Form $form) {
|
return Form::make(new BannerAd(), function (Form $form) {
|
||||||
$form->text('name')->required();
|
$form->text('name')->required();
|
||||||
$form->text('key')->required()->rules([Rule::unique((new BannerAd())->getTable())]);
|
$unique = Rule::unique((new BannerAd())->getTable());
|
||||||
|
if ($form->isEditing()) {
|
||||||
|
$unique->ignore($form->getKey());
|
||||||
|
}
|
||||||
|
$form->text('key')->required()->rules([$unique]);
|
||||||
$form->number('width')->min(0);
|
$form->number('width')->min(0);
|
||||||
$form->number('height')->min(0);
|
$form->number('height')->min(0);
|
||||||
$form->switch('is_enable')->default(1);
|
$form->switch('is_enable')->default(1);
|
||||||
|
|
|
||||||
|
|
@ -87,6 +87,7 @@ class BannerController extends AdminController
|
||||||
Admin::script(
|
Admin::script(
|
||||||
<<<JS
|
<<<JS
|
||||||
$('body').on('select2:select', 'select.field_ad_id', function(e){
|
$('body').on('select2:select', 'select.field_ad_id', function(e){
|
||||||
|
console.log( e.params.data.id);
|
||||||
let url_path = '/admin/api/banner-ads?id=' + e.params.data.id
|
let url_path = '/admin/api/banner-ads?id=' + e.params.data.id
|
||||||
$.ajax({
|
$.ajax({
|
||||||
type: 'get',
|
type: 'get',
|
||||||
|
|
@ -96,10 +97,13 @@ class BannerController extends AdminController
|
||||||
//异步渲染提示尺寸;
|
//异步渲染提示尺寸;
|
||||||
let cicun = '未设置';
|
let cicun = '未设置';
|
||||||
if(result[0]){
|
if(result[0]){
|
||||||
|
console.log(result[0]);
|
||||||
if(result[0].width || result[0].height){
|
if(result[0].width || result[0].height){
|
||||||
|
console.log(654321)
|
||||||
cicun = result[0].width + '*' + result[0].height;
|
cicun = result[0].width + '*' + result[0].height;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
console.log(cicun);
|
||||||
$('input[name=path]').parent().find('span.help-block').html('<i class="fa feather icon-help-circle"></i> 建议尺寸:'+ cicun);
|
$('input[name=path]').parent().find('span.help-block').html('<i class="fa feather icon-help-circle"></i> 建议尺寸:'+ cicun);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue