顶部大图广告应用优化
parent
a22f25ae87
commit
3919b7244e
|
|
@ -83,5 +83,25 @@ class Plugins extends Common
|
|||
|
||||
return $this->fetch();
|
||||
}
|
||||
|
||||
/**
|
||||
* [StatusUpdate 状态更新]
|
||||
* @author Devil
|
||||
* @blog http://gong.gg/
|
||||
* @version 0.0.1
|
||||
* @datetime 2017-01-12T22:23:06+0800
|
||||
*/
|
||||
public function StatusUpdate()
|
||||
{
|
||||
// 是否ajax请求
|
||||
if(!IS_AJAX)
|
||||
{
|
||||
return $this->error('非法访问');
|
||||
}
|
||||
|
||||
// 开始处理
|
||||
$params = input();
|
||||
return PluginsService::PluginsStatusUpdate($params);
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
|
@ -7,7 +7,7 @@
|
|||
<ul data-am-widget="gallery" class="am-gallery am-avg-sm-2 am-avg-md-3 am-avg-lg-4 am-gallery-bordered" data-am-gallery="{}">
|
||||
{{foreach $data_list as $v}}
|
||||
<li>
|
||||
<div class="am-gallery-item">
|
||||
<div id="data-list-{{$v.id}}" class="am-gallery-item {{if $v['is_enable'] neq 1}}am-active{{/if}}">
|
||||
<img src="{{$v.logo}}" class="icon" />
|
||||
<div class="base">
|
||||
<h3 class="name">{{$v.name}}</h3>
|
||||
|
|
@ -20,6 +20,8 @@
|
|||
<a href="{{:MyUrl('plugins/index/index', ['control'=>$v['plugins'], 'action'=>'index'])}}" class="am-btn am-btn-default am-btn-xs am-radius am-icon-gear"> 设置</a>
|
||||
|
||||
<button class="am-btn am-btn-default am-btn-xs am-radius am-icon-remove submit-ajax" data-url="{{:MyUrl('admin/plugins/uninstall')}}" data-id="10" data-view="reload" data-msg="卸载后不可恢复、确认操作吗?"> 卸载</button>
|
||||
|
||||
<a href="javascript:;" class="am-icon-btn am-icon-check submit-state {{if $v['is_enable'] eq 1}}am-success{{else /}}am-default{{/if}}" data-url="{{:MyUrl('admin/plugins/statusupdate')}}" data-id="{{$v.id}}" data-state="{{$v['is_enable']}}" data-is-update-status="1"></a>
|
||||
</div>
|
||||
</div>
|
||||
</li>
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@ use think\Controller;
|
|||
use app\service\PluginsService;
|
||||
|
||||
/**
|
||||
* 顶部广告插件
|
||||
* 顶部大图广告插件
|
||||
* @author Devil
|
||||
* @blog http://gong.gg/
|
||||
* @version 0.0.1
|
||||
|
|
@ -22,9 +22,17 @@ use app\service\PluginsService;
|
|||
*/
|
||||
class CommonTopMaxPicture extends Controller
|
||||
{
|
||||
/**
|
||||
* 应用响应入口
|
||||
* @author Devil
|
||||
* @blog http://gong.gg/
|
||||
* @version 1.0.0
|
||||
* @datetime 2019-02-09T14:25:44+0800
|
||||
* @param [array] $params [输入参数]
|
||||
*/
|
||||
public function run($params = [])
|
||||
{
|
||||
// 是否控制器
|
||||
// 是否控制器钩子
|
||||
if(isset($params['is_control']) && $params['is_control'] === true)
|
||||
{
|
||||
return [];
|
||||
|
|
@ -44,12 +52,47 @@ class CommonTopMaxPicture extends Controller
|
|||
*/
|
||||
public function html()
|
||||
{
|
||||
// 当前模块/控制器/方法
|
||||
$module_name = strtolower(request()->module());
|
||||
$controller_name = strtolower(request()->controller());
|
||||
$action_name = strtolower(request()->action());
|
||||
|
||||
// 获取应用数据
|
||||
$ret = PluginsService::PluginsData('commontopmaxpicture');
|
||||
|
||||
// html拼接
|
||||
$html = '<div style="text-align: center;';
|
||||
$content = '';
|
||||
if($ret['code'] == 0)
|
||||
{
|
||||
// 有效时间
|
||||
if(!empty($ret['data']['time_start']))
|
||||
{
|
||||
// 是否已开始
|
||||
if(strtotime($ret['data']['time_start']) > time())
|
||||
{
|
||||
return '';
|
||||
}
|
||||
}
|
||||
if(!empty($ret['data']['time_end']))
|
||||
{
|
||||
// 是否已结束
|
||||
if(strtotime($ret['data']['time_end']) < time())
|
||||
{
|
||||
return '';
|
||||
}
|
||||
}
|
||||
|
||||
// 非全局
|
||||
if($ret['data']['is_overall'] != 1)
|
||||
{
|
||||
// 非首页则空
|
||||
if($module_name.$controller_name.$action_name != 'indexindexindex')
|
||||
{
|
||||
return '';
|
||||
}
|
||||
}
|
||||
|
||||
// 背景色
|
||||
if(!empty($ret['data']['bg_color']))
|
||||
{
|
||||
|
|
@ -86,11 +129,6 @@ class CommonTopMaxPicture extends Controller
|
|||
'sales_amount' => 0,
|
||||
];
|
||||
|
||||
// 后台配置
|
||||
$admin = [
|
||||
|
||||
];
|
||||
|
||||
// 控制器钩子
|
||||
$control_hook = [
|
||||
'plugins_control_hook' => [
|
||||
|
|
@ -100,7 +138,6 @@ class CommonTopMaxPicture extends Controller
|
|||
|
||||
return [
|
||||
'base' => $base,
|
||||
'admin' => $admin,
|
||||
'control_hook' => $control_hook,
|
||||
];
|
||||
}
|
||||
|
|
@ -139,6 +176,13 @@ class CommonTopMaxPicture extends Controller
|
|||
$ret = PluginsService::PluginsData('commontopmaxpicture');
|
||||
if($ret['code'] == 0)
|
||||
{
|
||||
// 是否
|
||||
$is_whether_list = array(
|
||||
0 => array('id' => 0, 'name' => '否', 'checked' => true),
|
||||
1 => array('id' => 1, 'name' => '是'),
|
||||
);
|
||||
$this->assign('is_whether_list', $is_whether_list);
|
||||
|
||||
$this->assign('data', $ret['data']);
|
||||
return $this->fetch('commontopmaxpicture/saveinfo');
|
||||
} else {
|
||||
|
|
@ -148,7 +192,7 @@ class CommonTopMaxPicture extends Controller
|
|||
}
|
||||
|
||||
/**
|
||||
* 保存
|
||||
* 数据保存
|
||||
* @author Devil
|
||||
* @blog http://gong.gg/
|
||||
* @version 1.0.0
|
||||
|
|
@ -160,6 +204,5 @@ class CommonTopMaxPicture extends Controller
|
|||
unset($params['max_file_size']);
|
||||
return PluginsService::PluginsDataSave(['plugins'=>'commontopmaxpicture', 'data'=>$params]);
|
||||
}
|
||||
|
||||
}
|
||||
?>
|
||||
|
|
@ -39,7 +39,31 @@
|
|||
{{/if}}
|
||||
</div>
|
||||
</div>
|
||||
<a href="{{:MyUrl('plugins/index/index', ['control'=>'commontopmaxpicture', 'action'=>'saveinfo'])}}" class="am-btn am-btn-secondary am-radius btn-loading-example am-btn-sm am-btn-block">编辑</a>
|
||||
<div class="items">
|
||||
<label>是否全局</label>
|
||||
<div>
|
||||
{{if isset($data['is_overall']) and $data['is_overall'] eq 1}}
|
||||
是
|
||||
{{else /}}
|
||||
否
|
||||
{{/if}}
|
||||
</div>
|
||||
</div>
|
||||
<div class="items">
|
||||
<label>有效时间</label>
|
||||
<div>
|
||||
{{if !empty($data['time_start']) and !empty($data['time_end'])}}
|
||||
{{$data.time_start}} ~ {{$data.time_end}}
|
||||
{{elseif !empty($data['time_start']) and empty($data['time_end'])}}
|
||||
{{$data.time_start}} ~ 长期有效
|
||||
{{elseif empty($data['time_start']) and !empty($data['time_end'])}}
|
||||
立即生效 ~ {{$data.time_end}}
|
||||
{{else /}}
|
||||
无限制
|
||||
{{/if}}
|
||||
</div>
|
||||
</div>
|
||||
<a href="{{:MyUrl('plugins/index/index', ['control'=>'commontopmaxpicture', 'action'=>'saveinfo'])}}" class="am-btn am-btn-secondary am-radius btn-loading-example am-btn-sm am-btn-block edit-submit">编辑</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -35,7 +35,36 @@
|
|||
<input type="url" placeholder="链接地址" name="url" data-validation-message="链接地址格式有误" class="am-radius" {{if !empty($data)}} value="{{$data.url}}"{{/if}} />
|
||||
</div>
|
||||
|
||||
{{include file="lib/is_new_window_open" /}}
|
||||
<div class="am-form-group">
|
||||
<label>是否新窗口打开</label>
|
||||
<div>
|
||||
{{foreach $is_whether_list as $v}}
|
||||
<label class="am-radio-inline m-r-10">
|
||||
<input type="radio" name="is_new_window_open" value="{{$v.id}}" {{if isset($data['is_new_window_open']) and $data['is_new_window_open'] eq $v['id']}}checked="checked"{{else /}}{{if !isset($data['is_new_window_open']) and isset($v['checked']) and $v['checked'] eq true}}checked="checked"{{/if}}{{/if}} data-am-ucheck /> {{$v.name}}
|
||||
</label>
|
||||
{{/foreach}}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="am-form-group">
|
||||
<label>是否全局<span class="fs-12 fw-100 cr-999">(默认首页)</span></label>
|
||||
<div>
|
||||
{{foreach $is_whether_list as $v}}
|
||||
<label class="am-radio-inline m-r-10">
|
||||
<input type="radio" name="is_overall" value="{{$v.id}}" {{if isset($data['is_overall']) and $data['is_overall'] eq $v['id']}}checked="checked"{{else /}}{{if !isset($data['is_overall']) and isset($v['checked']) and $v['checked'] eq true}}checked="checked"{{/if}}{{/if}} data-am-ucheck /> {{$v.name}}
|
||||
</label>
|
||||
{{/foreach}}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="am-form-group">
|
||||
<label>有效时间<span class="fs-12 fw-100 cr-999">(留空则不限制)</span></label>
|
||||
<div class="form-date">
|
||||
<input type="text" autocomplete="off" name="time_start" class="Wdate am-radius" placeholder="起始时间" onclick="WdatePicker({firstDayOfWeek:1,dateFmt:'yyyy-MM-dd HH:mm:ss'})" {{if !empty($data['time_start'])}}value="{{$data.time_start}}"{{/if}}/>
|
||||
<span>~</span>
|
||||
<input type="text" autocomplete="off" class="Wdate am-radius" placeholder="结束时间" name="time_end" onclick="WdatePicker({firstDayOfWeek:1,dateFmt:'yyyy-MM-dd HH:mm:ss'})" {{if !empty($data['time_end'])}}value="{{$data.time_end}}"{{/if}}/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="am-form-group">
|
||||
<button type="submit" class="am-btn am-btn-primary am-radius btn-loading-example am-btn-sm w100" data-am-loading="{loadingText:'处理中...'}">保存</button>
|
||||
|
|
|
|||
|
|
@ -178,11 +178,6 @@ class PluginsService
|
|||
'key_name' => 'id',
|
||||
'error_msg' => '操作id有误',
|
||||
],
|
||||
[
|
||||
'checked_type' => 'empty',
|
||||
'key_name' => 'field',
|
||||
'error_msg' => '未指定操作字段',
|
||||
],
|
||||
[
|
||||
'checked_type' => 'in',
|
||||
'key_name' => 'state',
|
||||
|
|
@ -197,7 +192,7 @@ class PluginsService
|
|||
}
|
||||
|
||||
// 数据更新
|
||||
if(Db::name('Plugins')->where(['id'=>$params['id']])->update([$params['field']=>intval($params['state']), 'upd_time'=>time()]))
|
||||
if(Db::name('Plugins')->where(['id'=>$params['id']])->update(['is_enable'=>intval($params['state']), 'upd_time'=>time()]))
|
||||
{
|
||||
return DataReturn('操作成功');
|
||||
}
|
||||
|
|
|
|||
File diff suppressed because one or more lines are too long
|
|
@ -14,6 +14,10 @@
|
|||
border: 1px solid #d4d4d4;
|
||||
border-radius: 2px;
|
||||
}
|
||||
.content ul.am-gallery-bordered .am-gallery-item.am-active {
|
||||
border: 1px solid #ffeaea;
|
||||
background: #fffbfb;
|
||||
}
|
||||
.content ul.am-gallery-bordered .am-gallery-item:hover {
|
||||
border: 1px solid #999;
|
||||
box-shadow: 0px 12px 12px -10px rgba(0,0,0,.4);
|
||||
|
|
@ -61,6 +65,14 @@
|
|||
border-top: 1px dashed #eee;
|
||||
padding: 10px 0 5px 0;
|
||||
}
|
||||
.content ul li .submit-state {
|
||||
width: 28px;
|
||||
height: 28px;
|
||||
border-radius: 2px;
|
||||
}
|
||||
.content ul li .submit-state.am-default {
|
||||
background-color: #e6e6e6;
|
||||
}
|
||||
@media only screen and (max-width: 641px) {
|
||||
.content ul .icon {
|
||||
width: 65px;
|
||||
|
|
|
|||
|
|
@ -18,6 +18,9 @@
|
|||
height: 50px;
|
||||
border: 1px solid #eee;
|
||||
}
|
||||
.commontopmaxpicture-content .edit-submit {
|
||||
margin-bottom: 20px;
|
||||
}
|
||||
|
||||
/**
|
||||
* 编辑页面
|
||||
|
|
@ -25,4 +28,12 @@
|
|||
ul.plugins-images-view li {
|
||||
width: 100%;
|
||||
height: auto;
|
||||
}
|
||||
.form-date input {
|
||||
width: 30% !important;
|
||||
display: -webkit-inline-box !important;
|
||||
}
|
||||
|
||||
.form-date span {
|
||||
vertical-align: middle;
|
||||
}
|
||||
Loading…
Reference in New Issue