mirror of
https://gitee.com/zoujingli/ThinkAdmin.git
synced 2025-04-06 03:58:04 +08:00
[更新]修改关键字表单样式
This commit is contained in:
parent
c209909d95
commit
51dff74326
@ -2,40 +2,12 @@
|
||||
|
||||
{block name="style"}
|
||||
<style>
|
||||
.keys-container {
|
||||
min-width: 800px
|
||||
}
|
||||
|
||||
.keys-container .control-label {
|
||||
margin: 0;
|
||||
padding-left: 0;
|
||||
padding-right: 0;
|
||||
}
|
||||
|
||||
.keys-container textarea {
|
||||
width: 95%;
|
||||
height: 100px;
|
||||
}
|
||||
|
||||
.keys-container .input-group input {
|
||||
border-right: 0
|
||||
}
|
||||
|
||||
.keys-container .input-group-addon {
|
||||
border-left: 0;
|
||||
border-radius: 0;
|
||||
}
|
||||
|
||||
.keys-container [data-tips-image] {
|
||||
width: 112px;
|
||||
height: auto;
|
||||
}
|
||||
|
||||
.keys-container .layui-elem-field {
|
||||
width: 535px;
|
||||
height: 580px;
|
||||
position: absolute;
|
||||
}
|
||||
.keys-container{min-width:800px}
|
||||
.keys-container textarea{width:95%;height:100px;border-radius:0}
|
||||
.keys-container .input-group input{border-right:0}
|
||||
.keys-container .input-group-addon{border-left:0;border-radius:0}
|
||||
.keys-container [data-tips-image]{width:112px;height:auto;}
|
||||
.keys-container .layui-elem-field{width:535px;height:580px;position:absolute}
|
||||
</style>
|
||||
{/block}
|
||||
|
||||
@ -52,154 +24,153 @@
|
||||
|
||||
<div class="row keys-container">
|
||||
<div class='col-xs-6 margin-left-15'>
|
||||
<form class="form-horizontal" role="form" data-auto="true" action="{:request()->url()}" method="post">
|
||||
<form class="form-horizontal layui-form" role="form" data-auto="true" action="{:request()->url()}" method="post">
|
||||
<fieldset class="layui-elem-field layui-box">
|
||||
<legend>{$title}</legend>
|
||||
<div>
|
||||
<!--{if !isset($vo.keys) or ($vo.keys neq 'default' and $vo.keys neq 'subscribe')}-->
|
||||
<div class="form-group">
|
||||
<label class="col-md-2 control-label layui-form-label ">关 键 字</label>
|
||||
<div class="col-md-9">
|
||||
<input required title='请输入关键字' maxlength='20' name='keys' class="layui-input" value='{$vo.keys|default=""}'>
|
||||
</div>
|
||||
<!--{if !isset($vo.keys) or ($vo.keys neq 'default' and $vo.keys neq 'subscribe')}-->
|
||||
<div class="form-group">
|
||||
<label class="col-xs-2 control-label layui-form-label ">关 键 字</label>
|
||||
<div class="col-xs-8">
|
||||
<input required title='请输入关键字' maxlength='20' name='keys' class="layui-input" value='{$vo.keys|default=""}'>
|
||||
</div>
|
||||
<!--{else}-->
|
||||
<input type="hidden" name="keys" value="{$vo.keys|default=''}">
|
||||
<!--{/if}-->
|
||||
<div class="form-group">
|
||||
<label class="col-md-2 control-label layui-form-label label-required">规则状态</label>
|
||||
<div class="col-md-9">
|
||||
<div class="mt-radio-inline padding-bottom-0">
|
||||
{foreach ['1'=>'启用','0'=>'禁用'] as $k=>$v}
|
||||
<label class="think-radio">
|
||||
<!--{if (!isset($vo.status) and $k eq '1') or (isset($vo.status) and $vo.status eq $k)}-->
|
||||
<input data-auto-none type="radio" checked name="status" value="{$k}"> {$v}
|
||||
<!--{else}-->
|
||||
<input data-auto-none type="radio" name="status" value="{$k}"> {$v}
|
||||
<!--{/if}-->
|
||||
</label>
|
||||
{/foreach}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-md-2 control-label layui-form-label label-required">消息类型</label>
|
||||
<div class="col-md-9">
|
||||
{foreach ['text'=>'文字','news'=>'图文','image'=>'图片','music'=>'音乐','video'=>'视频'] as $k=>$v}
|
||||
</div>
|
||||
<!--{else}-->
|
||||
<input type="hidden" name="keys" value="{$vo.keys|default=''}">
|
||||
<!--{/if}-->
|
||||
<div class="form-group">
|
||||
<label class="col-xs-2 control-label layui-form-label label-required">规则状态</label>
|
||||
<div class="col-xs-8">
|
||||
<div class="mt-radio-inline padding-bottom-0">
|
||||
{foreach ['1'=>'启用','0'=>'禁用'] as $k=>$v}
|
||||
<label class="think-radio">
|
||||
<!--{if (!isset($vo.type) and $k eq 'text') or (isset($vo.type) and$vo.type eq $k)}-->
|
||||
<input name="type" checked type="radio" value="{$k}"> {$v}
|
||||
<!--{if (!isset($vo.status) and $k eq '1') or (isset($vo.status) and $vo.status eq $k)}-->
|
||||
<input data-auto-none type="radio" checked name="status" value="{$k}"> {$v}
|
||||
<!--{else}-->
|
||||
<input name="type" type="radio" value="{$k}"> {$v}
|
||||
<input data-auto-none type="radio" name="status" value="{$k}"> {$v}
|
||||
<!--{/if}-->
|
||||
</label>
|
||||
{/foreach}
|
||||
{/foreach}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group" data-keys-type='text'>
|
||||
<label class="col-md-2 control-label layui-form-label label-required">规则内容</label>
|
||||
<div class="col-md-9">
|
||||
<textarea name="content" maxlength="10000" class="form-control">{$vo.content|default='说点什么吧'|raw}</textarea>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group" data-keys-type='news'>
|
||||
<label class="col-md-2 control-label layui-form-label">选取图文</label>
|
||||
<div class="col-md-9">
|
||||
<a class="btn btn-link" data-title="选择图文" data-iframe="{:url('wechat/news/select')}?field={:encode('news_id')}">选择图文</a>
|
||||
<input type="hidden" class='layui-input' value="{$vo.news_id|default=0}" name="news_id">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group" data-keys-type='image'>
|
||||
<label class="col-md-2 control-label layui-form-label label-required">图片地址</label>
|
||||
<div class="col-md-9">
|
||||
<input type="text" class="layui-input" onchange="$(this).nextAll('img').attr('src', this.value);"
|
||||
value="{$vo.image_url|default='http://plugs.ctolog.com/theme/default/img/image.png'}"
|
||||
name="image_url" required title="请上传图片或输入图片URL地址">
|
||||
<p class="help-block">文件最大2Mb,支持bmp/png/jpeg/jpg/gif格式</p>
|
||||
<img data-tips-image src='{$vo.image_url|default="http://plugs.ctolog.com/theme/default/img/image.png"}'>
|
||||
<a data-file="one" data-type="bmp,png,jpeg,jpg,gif" data-field="image_url" class='btn btn-link'>上传图片</a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group" data-keys-type='voice'>
|
||||
<label class="col-md-2 control-label layui-form-label label-required">上传语音</label>
|
||||
<div class="col-md-9">
|
||||
<div class="input-group">
|
||||
<input class='layui-input' type="text" value="{$vo.voice_url|default=''}" name="voice_url" required title="请上传语音文件或输入语音URL地址 ">
|
||||
<a data-file="one" data-type="mp3,wma,wav,amr" data-field="voice_url" class="input-group-addon"><i class="fa fa-upload"></i></a>
|
||||
</div>
|
||||
<p class="help-block">文件最大2Mb,播放长度不超过60s,mp3/wma/wav/amr格式</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group" data-keys-type='music'>
|
||||
<label class="col-md-2 control-label layui-form-label">音乐标题</label>
|
||||
<div class="col-md-9">
|
||||
<input class='layui-input' value="{$vo.music_title|default='音乐标题'}" name="music_title" required title="请输入音乐标题">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group" data-keys-type='music'>
|
||||
<label class="col-md-2 control-label layui-form-label label-required">上传音乐</label>
|
||||
<div class="col-md-9">
|
||||
<div class="input-group">
|
||||
<input class='layui-input' type="text" value="{$vo.music_url|default=''}" name="music_url" required title="请上传音乐文件或输入音乐URL地址 ">
|
||||
<a data-file="one" data-type="mp3,wma,wav,amr" data-field="music_url" class="input-group-addon"><i class="fa fa-upload"></i></a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group" data-keys-type='music'>
|
||||
<label class="col-md-2 control-label layui-form-label">音乐描述</label>
|
||||
<div class="col-md-9">
|
||||
<input name="music_desc" class="layui-input" value="{$vo.music_desc|default='音乐描述'|raw}">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group" data-keys-type='music'>
|
||||
<label class="col-md-2 control-label layui-form-label">音乐图片</label>
|
||||
<div class="col-md-9">
|
||||
<input onchange="$(this).nextAll('img').attr('src', this.value);" type="text" class="layui-input"
|
||||
value="{$vo.music_image|default='http://plugs.ctolog.com/theme/default/img/image.png'}"
|
||||
name="music_image" required title="请上传音乐图片或输入音乐图片URL地址 ">
|
||||
<p class="help-block">文件最大64KB,只支持JPG格式</p>
|
||||
<img data-tips-image src='{$vo.music_image|default="http://plugs.ctolog.com/theme/default/img/image.png"}'>
|
||||
<a data-file="one" data-type="jpg" data-field="music_image" class='btn btn-link'>上传图片</a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group" data-keys-type='video'>
|
||||
<label class="col-md-2 control-label layui-form-label">视频标题</label>
|
||||
<div class="col-md-9">
|
||||
<input class='layui-input' value="{$vo.video_title|default='视频标题'}" name="video_title" required title="请输入视频标题">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group" data-keys-type='video'>
|
||||
<label class="col-md-2 control-label layui-form-label label-required">上传视频</label>
|
||||
<div class="col-md-9">
|
||||
<div class="input-group">
|
||||
<input class='layui-input' type="text" value="{$vo.video_url|default=''}" name="video_url" required title="请上传音乐视频或输入音乐视频URL地址 ">
|
||||
<a data-file="one" data-type="mp4" data-field="video_url" class="input-group-addon"><i class="fa fa-upload"></i></a>
|
||||
</div>
|
||||
<p class="help-block">文件最大10MB,只支持MP4格式</p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group" data-keys-type='video'>
|
||||
<label class="col-md-2 control-label layui-form-label">视频描述</label>
|
||||
<div class="col-md-9">
|
||||
<textarea name="video_desc" maxlength="50" class="form-control">{$vo.video_desc|default='视频描述'|raw}</textarea>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="text-center padding-bottom-10" style="position:absolute;bottom:0;width:100%;">
|
||||
<div class="hr-line-dashed" style="margin:10px 0"></div>
|
||||
<button class="layui-btn menu-submit">保存数据</button>
|
||||
<!--{if !isset($vo.keys) || !in_array($vo.keys,['default','subscribe'])}-->
|
||||
<button data-cancel-edit class="layui-btn layui-btn-danger" type='button'>取消编辑</button>
|
||||
<!--{/if}-->
|
||||
</div>
|
||||
{if isset($vo['id'])}<input type='hidden' value='{$vo.id}' name='id'>{/if}
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-xs-2 control-label layui-form-label label-required">消息类型</label>
|
||||
<div class="col-xs-8">
|
||||
{foreach ['text'=>'文字','news'=>'图文','image'=>'图片','music'=>'音乐','video'=>'视频'] as $k=>$v}
|
||||
<label class="think-radio">
|
||||
<!--{if (!isset($vo.type) and $k eq 'text') or (isset($vo.type) and$vo.type eq $k)}-->
|
||||
<input name="type" checked type="radio" value="{$k}"> {$v}
|
||||
<!--{else}-->
|
||||
<input name="type" type="radio" value="{$k}"> {$v}
|
||||
<!--{/if}-->
|
||||
</label>
|
||||
{/foreach}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group" data-keys-type='text'>
|
||||
<label class="col-xs-2 control-label layui-form-label label-required">规则内容</label>
|
||||
<div class="col-xs-8">
|
||||
<textarea name="content" maxlength="10000" class="form-control">{$vo.content|default='说点什么吧'|raw}</textarea>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group" data-keys-type='news'>
|
||||
<label class="col-xs-2 control-label layui-form-label">选取图文</label>
|
||||
<div class="col-xs-8">
|
||||
<a class="btn btn-link" data-title="选择图文" data-iframe="{:url('wechat/news/select')}?field={:encode('news_id')}">选择图文</a>
|
||||
<input type="hidden" class='layui-input' value="{$vo.news_id|default=0}" name="news_id">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group" data-keys-type='image'>
|
||||
<label class="col-xs-2 control-label layui-form-label label-required">图片地址</label>
|
||||
<div class="col-xs-8">
|
||||
<input type="text" class="layui-input" onchange="$(this).nextAll('img').attr('src', this.value);"
|
||||
value="{$vo.image_url|default='http://plugs.ctolog.com/theme/default/img/image.png'}"
|
||||
name="image_url" required title="请上传图片或输入图片URL地址">
|
||||
<p class="help-block">文件最大2Mb,支持bmp/png/jpeg/jpg/gif格式</p>
|
||||
<img data-tips-image src='{$vo.image_url|default="http://plugs.ctolog.com/theme/default/img/image.png"}'>
|
||||
<a data-file="one" data-type="bmp,png,jpeg,jpg,gif" data-field="image_url" class='btn btn-link'>上传图片</a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group" data-keys-type='voice'>
|
||||
<label class="col-xs-2 control-label layui-form-label label-required">上传语音</label>
|
||||
<div class="col-xs-8">
|
||||
<div class="input-group">
|
||||
<input class='layui-input' type="text" value="{$vo.voice_url|default=''}" name="voice_url" required title="请上传语音文件或输入语音URL地址 ">
|
||||
<a data-file="one" data-type="mp3,wma,wav,amr" data-field="voice_url" class="input-group-addon"><i class="fa fa-upload"></i></a>
|
||||
</div>
|
||||
<p class="help-block">文件最大2Mb,播放长度不超过60s,mp3/wma/wav/amr格式</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group" data-keys-type='music'>
|
||||
<label class="col-xs-2 control-label layui-form-label">音乐标题</label>
|
||||
<div class="col-xs-8">
|
||||
<input class='layui-input' value="{$vo.music_title|default='音乐标题'}" name="music_title" required title="请输入音乐标题">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group" data-keys-type='music'>
|
||||
<label class="col-xs-2 control-label layui-form-label label-required">上传音乐</label>
|
||||
<div class="col-xs-8">
|
||||
<div class="input-group">
|
||||
<input class='layui-input' type="text" value="{$vo.music_url|default=''}" name="music_url" required title="请上传音乐文件或输入音乐URL地址 ">
|
||||
<a data-file="one" data-type="mp3,wma,wav,amr" data-field="music_url" class="input-group-addon"><i class="fa fa-upload"></i></a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group" data-keys-type='music'>
|
||||
<label class="col-xs-2 control-label layui-form-label">音乐描述</label>
|
||||
<div class="col-xs-8">
|
||||
<input name="music_desc" class="layui-input" value="{$vo.music_desc|default='音乐描述'|raw}">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group" data-keys-type='music'>
|
||||
<label class="col-xs-2 control-label layui-form-label">音乐图片</label>
|
||||
<div class="col-xs-8">
|
||||
<input onchange="$(this).nextAll('img').attr('src', this.value);" type="text" class="layui-input"
|
||||
value="{$vo.music_image|default='http://plugs.ctolog.com/theme/default/img/image.png'}"
|
||||
name="music_image" required title="请上传音乐图片或输入音乐图片URL地址 ">
|
||||
<p class="help-block">文件最大64KB,只支持JPG格式</p>
|
||||
<img data-tips-image src='{$vo.music_image|default="http://plugs.ctolog.com/theme/default/img/image.png"}'>
|
||||
<a data-file="one" data-type="jpg" data-field="music_image" class='btn btn-link'>上传图片</a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group" data-keys-type='video'>
|
||||
<label class="col-xs-2 control-label layui-form-label">视频标题</label>
|
||||
<div class="col-xs-8">
|
||||
<input class='layui-input' value="{$vo.video_title|default='视频标题'}" name="video_title" required title="请输入视频标题">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group" data-keys-type='video'>
|
||||
<label class="col-xs-2 control-label layui-form-label label-required">上传视频</label>
|
||||
<div class="col-xs-8">
|
||||
<div class="input-group">
|
||||
<input class='layui-input' type="text" value="{$vo.video_url|default=''}" name="video_url" required title="请上传音乐视频或输入音乐视频URL地址 ">
|
||||
<a data-file="one" data-type="mp4" data-field="video_url" class="input-group-addon"><i class="fa fa-upload"></i></a>
|
||||
</div>
|
||||
<p class="help-block">文件最大10MB,只支持MP4格式</p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group" data-keys-type='video'>
|
||||
<label class="col-xs-2 control-label layui-form-label">视频描述</label>
|
||||
<div class="col-xs-8">
|
||||
<textarea name="video_desc" maxlength="50" class="form-control">{$vo.video_desc|default='视频描述'|raw}</textarea>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="text-center padding-bottom-10" style="position:absolute;bottom:0;width:100%;">
|
||||
<div class="hr-line-dashed" style="margin:10px 0"></div>
|
||||
<button class="layui-btn menu-submit">保存数据</button>
|
||||
<!--{if !isset($vo.keys) || !in_array($vo.keys,['default','subscribe'])}-->
|
||||
<button data-cancel-edit class="layui-btn layui-btn-danger" type='button'>取消编辑</button>
|
||||
<!--{/if}-->
|
||||
</div>
|
||||
{if isset($vo['id'])}<input type='hidden' value='{$vo.id}' name='id'>{/if}
|
||||
|
||||
</fieldset>
|
||||
</form>
|
||||
</div>
|
||||
@ -209,42 +180,42 @@
|
||||
{block name="script"}
|
||||
<script>
|
||||
|
||||
$(function () {
|
||||
$(function (){
|
||||
|
||||
var $body = $('body');
|
||||
|
||||
/*! 取消编辑 */
|
||||
$('[data-cancel-edit]').on('click', function () {
|
||||
var dialogIndex = $.msg.confirm('确定取消编辑吗?', function () {
|
||||
$('[data-cancel-edit]').on('click', function (){
|
||||
var dialogIndex = $.msg.confirm('确定取消编辑吗?', function (){
|
||||
history.back();
|
||||
$.msg.close(dialogIndex);
|
||||
});
|
||||
});
|
||||
|
||||
/*! 刷新预览显示 */
|
||||
function showReview(params) {
|
||||
$('#phone-preview').attr('src', '{:url("@wechat/review")}?' + $.param(params || {}));
|
||||
function showReview(params){
|
||||
$('#phone-preview').attr('src', '{:url("@wechat/review")}?' + $.param(params ||{}));
|
||||
}
|
||||
|
||||
// 图文显示预览
|
||||
$body.off('change', '[name="news_id"]').on('change', '[name="news_id"]', function () {
|
||||
showReview({type: 'news', content: this.value});
|
||||
$body.off('change', '[name="news_id"]').on('change', '[name="news_id"]', function (){
|
||||
showReview({type:'news', content:this.value});
|
||||
});
|
||||
|
||||
// 文字显示预览
|
||||
$body.off('change', '[name="content"]').on('change', '[name="content"]', function () {
|
||||
showReview({type: 'text', content: this.value});
|
||||
$body.off('change', '[name="content"]').on('change', '[name="content"]', function (){
|
||||
showReview({type:'text', content:this.value});
|
||||
});
|
||||
|
||||
// 图片显示预览
|
||||
$body.off('change', '[name="image_url"]').on('change', '[name="image_url"]', function () {
|
||||
showReview({type: 'image', content: this.value});
|
||||
$body.off('change', '[name="image_url"]').on('change', '[name="image_url"]', function (){
|
||||
showReview({type:'image', content:this.value});
|
||||
});
|
||||
|
||||
// 音乐显示预览
|
||||
var musicSelector = '[name="music_url"],[name="music_title"],[name="music_desc"],[name="music_image"]';
|
||||
$body.off('change', musicSelector).on('change', musicSelector, function () {
|
||||
var params = {type: 'music'}, $parent = $(this).parents('form');
|
||||
$body.off('change', musicSelector).on('change', musicSelector, function (){
|
||||
var params ={type:'music'}, $parent = $(this).parents('form');
|
||||
params.title = $parent.find('[name="music_title"]').val();
|
||||
params.url = $parent.find('[name="music_url"]').val();
|
||||
params.image = $parent.find('[name="music_image"]').val();
|
||||
@ -254,8 +225,8 @@
|
||||
|
||||
// 视频显示预览
|
||||
var videoSelector = '[name="video_title"],[name="video_url"],[name="video_desc"]';
|
||||
$body.off('change', videoSelector).on('change', videoSelector, function () {
|
||||
var params = {type: 'video'}, $parent = $(this).parents('form');
|
||||
$body.off('change', videoSelector).on('change', videoSelector, function (){
|
||||
var params ={type:'video'}, $parent = $(this).parents('form');
|
||||
params.title = $parent.find('[name="video_title"]').val();
|
||||
params.url = $parent.find('[name="video_url"]').val();
|
||||
params.desc = $parent.find('[name="video_desc"]').val();
|
||||
@ -263,11 +234,11 @@
|
||||
});
|
||||
|
||||
/*! 默认类型事件 */
|
||||
$body.off('click', 'input[name=type]').on('click', 'input[name=type]', function () {
|
||||
$body.off('click', 'input[name=type]').on('click', 'input[name=type]', function (){
|
||||
var value = $(this).val(), $form = $(this).parents('form');
|
||||
var $current = $form.find('[data-keys-type="' + value + '"]').removeClass('hide');
|
||||
$form.find('[data-keys-type]').not($current).addClass('hide');
|
||||
switch (value) {
|
||||
switch (value){
|
||||
case 'news':
|
||||
return $('[name="news_id"]').trigger('change');
|
||||
case 'text':
|
||||
@ -284,7 +255,7 @@
|
||||
});
|
||||
|
||||
// 默认事件触发
|
||||
$('input[name=type]:checked').map(function () {
|
||||
$('input[name=type]:checked').map(function (){
|
||||
$(this).trigger('click');
|
||||
});
|
||||
});
|
||||
|
Loading…
x
Reference in New Issue
Block a user