修改模板文件

This commit is contained in:
邹景立 2022-08-11 14:22:40 +08:00
parent c5a42cc55c
commit 09224443e4
3 changed files with 25 additions and 50 deletions

View File

@ -105,19 +105,6 @@ class Auto extends Controller
}
}
/**
* 表单结果处理
* @param boolean $result
*/
protected function _form_result(bool $result)
{
if ($result !== false) {
$this->success('恭喜, 关键字保存成功!', 'javascript:history.back()');
} else {
$this->error('关键字保存失败, 请稍候再试!');
}
}
/**
* 修改规则状态
* @auth true

View File

@ -1,6 +1,3 @@
{extend name="../../admin/view/main"}
{block name="style"}
<style>
.keys-container .layui-card {
width: 580px;
@ -28,18 +25,16 @@
margin-left: 100px;
}
</style>
{/block}
{block name="content"}
<div class="nowrap think-box-shadow" style="width:910px">
<div class='mobile-preview inline-block'>
<div class='mobile-header'>公众号</div>
<div class='mobile-body' data-iframe-box></div>
</div>
<div class="keys-container inline-block absolute margin-left-10 margin-right-15">
<form action="{:sysuri()}" method="post" data-auto="true" class="layui-form layui-card">
<form action="{:sysuri()}" method="post" data-auto="true" data-table-id="AutoTable" class="layui-form layui-card">
<div class="layui-card relative shadow-none">
<div class="layui-card-header layui-bg-gray text-center">编辑关键字</div>
<div class="layui-card-header layui-bg-gray text-center">编辑回复规则</div>
<div class="layui-card-body">
<div class="layui-form-item margin-top-10">
<label class="layui-form-label">延迟时间</label>
@ -89,14 +84,14 @@
<label class="layui-form-label label-required">选取图文</label>
<div class="layui-input-block">
<input type="hidden" name="news_id" value="{$vo.news_id|default=0}">
<a class="layui-btn layui-btn-sm layui-btn-primary" data-title="选择图文" data-iframe="{:url('wechat/news/select')}?field={:encode('news_id')}">选择图文</a>
<a class="layui-btn layui-btn-primary" data-title="选择图文" data-iframe="{:url('wechat/news/select')}?field={:encode('news_id')}">选择图文</a>
</div>
</div>
<div class="layui-form-item" data-keys-type='image'>
<label class="layui-form-label label-required">图片地址</label>
<div class="layui-input-block">
<input class="layui-input padding-right-30" onchange="$(this).nextAll('img').attr('src', this.value)" value="{$vo.image_url|default=$defaultImage}" name="image_url" required placeholder="请上传图片或输入图片URL地址  ">
<input class="layui-input padding-right-30" onchange="$(this).nextAll('img').attr('src', this.value)" value="{$vo.image_url|default=$defaultImage}" name="image_url" required placeholder="请上传图片或输入图片地址">
<a data-file="btn" data-type="bmp,png,jpeg,jpg,gif" data-field="image_url" class="input-right-icon"><i class="layui-icon layui-icon-upload"></i></a>
<p class="help-block">文件最大2Mb支持bmp/png/jpeg/jpg/gif格式</p>
<img data-tips-image src='{$vo.image_url|default=$defaultImage}' alt="img">
@ -106,7 +101,7 @@
<div class="layui-form-item" data-keys-type='voice'>
<label class="layui-form-label">上传语音</label>
<div class="layui-input-block">
<input class='layui-input padding-right-30' value="{$vo.voice_url|default=''}" name="voice_url" required title="请上传语音文件或输入语音URL地址  ">
<input class='layui-input padding-right-30' value="{$vo.voice_url|default=''}" name="voice_url" required title="请上传语音文件或输入语音地址">
<a data-file="btn" data-type="mp3,wma,wav,amr" data-field="voice_url" class="input-right-icon"><i class="layui-icon layui-icon-upload"></i></a>
<p class="help-block">文件最大2Mb播放长度不超过60smp3/wma/wav/amr格式</p>
</div>
@ -122,7 +117,7 @@
<div class="layui-form-item" data-keys-type='music'>
<label class="layui-form-label label-required">上传音乐</label>
<div class="layui-input-block">
<input class='layui-input padding-right-30' value="{$vo.music_url|default=''}" name="music_url" required title="请上传音乐文件或输入音乐URL地址  ">
<input class='layui-input padding-right-30' value="{$vo.music_url|default=''}" name="music_url" required title="请上传音乐文件或输入音乐地址">
<a data-file="btn" data-type="mp3,wma,wav,amr" data-field="music_url" class="input-right-icon"><i class="layui-icon layui-icon-upload"></i></a>
</div>
</div>
@ -137,7 +132,7 @@
<div class="layui-form-item" data-keys-type='music'>
<label class="layui-form-label">音乐图片</label>
<div class="layui-input-block">
<input class="layui-input padding-right-30" value="{$vo.music_image|default=$defaultImage}" name="music_image" required title="请上传音乐图片或输入音乐图片URL地址  ">
<input class="layui-input padding-right-30" value="{$vo.music_image|default=$defaultImage}" name="music_image" required title="请上传音乐图片或输入音乐图片地址">
<a data-file="btn" data-type="jpg,png" data-field="music_image" class="input-right-icon"><i class="layui-icon layui-icon-upload"></i></a>
<p class="help-block">文件最大64KB只支持JPG格式</p>
</div>
@ -153,7 +148,7 @@
<div class="layui-form-item" data-keys-type='video'>
<label class="layui-form-label">上传视频</label>
<div class="layui-input-block">
<input class='layui-input padding-right-30' value="{$vo.video_url|default=''}" name="video_url" required title="请上传视频或输入音乐视频URL地址  ">
<input class='layui-input padding-right-30' value="{$vo.video_url|default=''}" name="video_url" required title="请上传视频或输入音乐视频地址">
<a data-file="btn" data-type="mp4" data-field="video_url" class="input-right-icon"><i class="layui-icon layui-icon-upload"></i></a>
<p class="help-block">文件最大10MB只支持MP4格式</p>
</div>
@ -166,26 +161,21 @@
</div>
</div>
<div class="text-center padding-bottom-10 absolute full-width" style="bottom:0;margin-left:-15px">
<div class="hr-line-dashed margin-top-10 margin-bottom-10"></div>
{if isset($vo['id'])}<input type='hidden' value='{$vo.id}' name='id'>{/if}
{if isset($vo['code'])}<input type='hidden' value='{$vo.code}' name='code'>{/if}
<button class="layui-btn menu-submit">保存数据</button>
<button data-history-back class="layui-btn layui-btn-danger" type='button'>取消编辑</button>
</div>
</div>
</div>
<div class="text-center absolute full-width" style="bottom:0">
<div class="hr-line-dashed margin-bottom-10"></div>
{if isset($vo['id'])}<input type='hidden' value='{$vo.id}' name='id'>{/if}
{if isset($vo['code'])}<input type='hidden' value='{$vo.code}' name='code'>{/if}
<button class="layui-btn menu-submit">保存数据</button>
<button data-history-back class="layui-btn layui-btn-danger" type='button'>取消编辑</button>
</div>
</form>
</div>
</div>
{/block}
{block name="script"}
<script>
(function ($body) {
$(function () {
/*! 刷新预览显示 */
function showReview(params, location) {
if (params['type'] === 'news') {
@ -197,7 +187,7 @@
$('[data-iframe-box]').empty().append($(iframe).attr('src', location));
}
$body.off('change', '[name="news_id"]').on('change', '[name="news_id"]', function () {
$('body').off('change', '[name="news_id"]').on('change', '[name="news_id"]', function () {
/*! 图文显示预览 */
showReview({type: 'news', content: this.value});
}).off('change', '[name="content"]').on('change', '[name="content"]', function () {
@ -213,7 +203,7 @@
/*! 音乐显示预览 */
var musicSelector = '[name="music_url"],[name="music_title"],[name="music_desc"],[name="music_image"]';
$body.off('change', musicSelector).on('change', musicSelector, function () {
$('body').off('change', musicSelector).on('change', musicSelector, function () {
var params = {type: 'music'}, $parent = $(this).parents('form');
params.url = $parent.find('[name="music_url"]').val();
params.desc = $parent.find('[name="music_desc"]').val();
@ -224,7 +214,7 @@
/*! 视频显示预览 */
var videoSelector = '[name="video_title"],[name="video_url"],[name="video_desc"]';
$body.off('change', videoSelector).on('change', videoSelector, function () {
$('body').off('change', videoSelector).on('change', videoSelector, function () {
var params = {type: 'video'}, $parent = $(this).parents('form');
params.url = $parent.find('[name="video_url"]').val();
params.desc = $parent.find('[name="video_desc"]').val();
@ -233,7 +223,7 @@
});
/*! 默认类型事件 */
$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');
if (value === 'customservice') value = 'text';
var $current = $form.find('[data-keys-type="' + value + '"]').removeClass('layui-hide');
@ -259,7 +249,5 @@
$('input[name=type]:checked').map(function () {
$(this).trigger('click');
});
})($('body'));
</script>
{/block}
});
</script>

View File

@ -2,7 +2,7 @@
{block name="button"}
<!--{if auth("add") and $type eq 'index'}-->
<button class='layui-btn layui-btn-sm layui-btn-primary' data-open='{:url("add")}'>添加规则</button>
<button class='layui-btn layui-btn-sm layui-btn-primary' data-table-id="AutoTable" data-width="950px" data-modal='{:url("add")}'>添加规则</button>
<!--{/if}-->
<!--{if auth("state") and $type eq 'index'}-->
@ -34,7 +34,7 @@
</ul>
<div class="layui-tab-content">
{include file='auto/index_search'}
<table id="AutoTable" data-url="{:sysuri()}" data-target-search="form.form-search"></table>
<table id="AutoTable" data-url="{$request->url()}" data-target-search="form.form-search"></table>
</div>
</div>
{/block}
@ -103,7 +103,7 @@
<!-- 操作面板模板 -->
<script type="text/html" id="toolbar">
<!--{if auth("edit") and isset($type) and $type eq 'index'}-->
<a class="layui-btn layui-btn-sm" data-open="{:url('edit')}?id={{d.id}}" data-title="编辑回复规则"> </a>
<a class="layui-btn layui-btn-sm" data-width="950px" data-modal="{:url('edit')}?id={{d.id}}" data-title="编辑回复规则"> </a>
<!--{/if}-->
<!--{if auth("remove") and isset($type) and $type neq 'index'}-->
<a class="layui-btn layui-btn-sm layui-btn-danger" data-action="{:url('remove')}" data-value="id#{{d.id}}" data-confirm="确定要删除该用户吗?"> </a>