模块中 app.php
/**
* 取banner
*/
function get_h_banner(){
for($i=1;$i<=5;$i++){
$cc[] = "banner_img_".$i;
$cc[] = "banner_url_".$i;
$cc[] = "banner_status_".$i;
}
$all = get_config($cc);
$list = [];
for($i=1;$i<=5;$i++){
$img = "banner_img_".$i;
$url = "banner_url_".$i;
$status = "banner_status_".$i;
if($all[$img] && $all[$status] == 1){
$list[cdn_url().$all[$img]] = $all[$url];
}
}
return $list;
}
add_action('admin.config.config_key',function(&$config_key){
$config_key[] = 'enroll_open_note';
$config_key[] = 'enroll_close_note';
for($i=1;$i<=5;$i++){
$config_key[] = "banner_img_".$i;
$config_key[] = "banner_url_".$i;
$config_key[] = "banner_status_".$i;
}
});
add_action('admin.config.tab',function(){
if(is_admin()){
echo '<li><a href="#hbanner" name="" >轮播图</a></li>';
}
});
add_action('admin.config.body',function(&$vue){
if(is_admin()){
include __DIR__.'/config.php';
}
});
同级config.php
<div id="hbanner" class=" input_100" >
<label>首页轮播图</label>
<table class="pure-table pure-table-bordered" style="width:80%">
<thead>
<tr>
<th>图片</th>
<th>地址</th>
<th>操作</th>
</tr>
</thead>
<tbody>
<?php for($i=1;$i<=5;$i++){?>
<tr >
<td>
<?php think_vue_media_one_button('banner_img_'.$i,'form',$show_del = true)?>
</td>
<td>
<input v-model="form.banner_url_<?=$i?>" style="width:80%;">
</td>
<td>
<el-checkbox v-model="form.banner_status_<?=$i?>" true-label="1" false-label="-1"></el-checkbox>
</td>
</tr>
<?php }?>
</tbody>
</table>
<?php
think_vue_media($vue,"
for(let i in dd){
if(dd[i] && dd[i].url){
this.\$set(this.form,this.media_name, dd[i].url);
}
}","
this.selected_media_use_muit = false;
");
$vue->method("remove_media_one(name)","
this.\$set(this.form , name, '');
this.\$forceUpdate();
");
?>
<!-- <el-row>
<el-col :span="12" style="padding-right: 10px;">
<div class="mt10 " >
<div>
<label>查看活动时弹出提示</label>
<el-input placeholder="每次查看活动都会弹出" type="textarea" cols="3" v-model="form.enroll_open_note"></el-input>
</div>
</div>
<div class="mt10 " >
<div>
<label>禁用活动时弹出提示</label>
<el-input placeholder="活动下线时,默认是不显示在活动列表中的,但当填写此处内容时就会在列表中显示,用户点击时弹出提示" type="textarea" cols="3" v-model="form.enroll_close_note"></el-input>
</div>
</div>
</el-col>
</el-row> -->
<div class="mt10">
<button class="button-xsmall pure-button pure-button-primary" @click="save()">保 存</button>
</div>
</div>
<?php
?>