test_service d3170b4d1c 1
2023-12-01 15:43:29 +08:00

1 line
9.7 KiB
HTML
Executable File
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<div class="row-content am-cf">
<div class="row">
<div class="am-u-sm-12 am-u-md-12 am-u-lg-12">
<div class="widget am-cf">
<div class="widget-head am-cf">
<div class="widget-title am-cf">关键字回复</div>
</div>
{if $wechat AND $wechat['status']['value'] == 1}
<div class="widget-body am-fr">
<div class="am-u-sm-12 am-u-md-3">
<div class="am-form-group">
<div class="am-btn-group am-btn-group-sm">
<a href="javascript:void(0);" class="hema-add am-btn am-btn-primary am-radius">
<span class="am-icon-plus"></span> 添加
</a>
</div>
</div>
</div>
<div class="am-scrollable-horizontal am-u-sm-12">
<table width="100%" class="am-table am-table-hover tpl-table-black">
<thead>
<tr>
<th>编号</th>
<th>关键字</th>
<th>类型</th>
<th>状态</th>
<th>时间</th>
<th>操作</th>
</tr>
</thead>
<tbody>
{if !$list->isEmpty()}
{foreach $list as $item}
<tr>
<td class="am-text-middle">{$item['keyword_id']}</td>
<td class="am-text-middle">
<p class="item-title">{$item['keyword']}</p>
</td>
<td class="am-text-middle">{$item['type']['text']}</td>
<td class="am-text-middle">
<span class="j-status am-badge x-cur-p {$item['is_open']['value'] == 1 ? ' am-badge-success' : ' am-badge-warning'}"
data-id="{$item['keyword_id']}"
data-status="{$item['is_open']['value']}">
{$item['is_open']['text']}
</span>
</td>
<td class="am-text-middle">{$item['create_time']}</td>
<td class="am-text-middle">
<div class="tpl-table-black-operation">
<a href="javascript:;" class="hema-edit" data-id="{$item['keyword_id']}">
<i class="am-icon-pencil"></i> 编辑
</a>
<a href="javascript:;" class="hema-del tpl-table-black-operation-del" data-id="{$item['keyword_id']}">
<i class="am-icon-trash"></i> 删除
</a>
</div>
</td>
</tr>
{/foreach}
{else /}
<tr>
<td colspan="6" class="am-text-center">暂无记录</td>
</tr>
{/if}
</tbody>
</table>
</div>
<div class="am-u-lg-12 am-cf">
<div class="am-fr">{:$list->render()} </div>
<div class="am-fr pagination-total am-margin-right">
<div class="am-vertical-align-middle">总记录:{:$list->total()}</div>
</div>
</div>
</div>
{else /}
<div class="tips am-margin-bottom-sm am-u-sm-12">
<div class="pre-error">未绑定授权公众号</div>
</div>
{/if}
</div>
</div>
</div>
</div>
{include file="../../admin/view/wechat/keyword/add" /}
{include file="../../admin/view/wechat/keyword/edit" /}
<script>
$(function () {
//添加
$('.hema-add').on('click', function () {
$.showAction({
title: '添加',
area: '750px',
content: template('tpl-add', {}),
uCheck: true,
success: function ($content) {
var $image = $('.key-image'), $news = $('.key-news'), $text = $('.key-text'), $video = $('.key-video'), $voice = $('.key-voice'), $contt = $('.key-content'), $media_id = $('.key-media-id');
$image.hide();
$news.hide();
$text.hide();
$video.hide();
$voice.hide();
$contt.hide();
$media_id.hide();
$('.type').change(() => {
$image.hide();
$news.hide();
$text.hide();
$video.hide();
$voice.hide();
$contt.hide();
$media_id.hide();
var msg_type = $('.type').val();
if(msg_type != ''){
$contt.show();
}
if(msg_type == "text"){
$text.show();
}else{
$media_id.show();
}
if(msg_type == "image"){
$image.show();
}
if(msg_type == "news"){
$news.show();
}
if(msg_type == "video"){
$video.show();
}
if(msg_type == "voice"){
$voice.show();
}
});
$('#my-form').formPost({
url: "{:url('wechat.keyword/add')}"
});
},
btn2: function ($content) {
return true;
}
});
});
//编辑
$('.hema-edit').on('click', function () {
var data = $(this).data();
$.get("{:url('wechat.keyword/edit')}?id=" + data.id, function (result) {
if(result.code == 0){
$.show_error(result.msg);
return false;
}
$.showAction({
title: '编辑',
area: '750px',
content: template('tpl-edit', {model:result.data.model}),
uCheck: true,
success: function ($content) {
var $image = $('.key-image'), $news = $('.key-news'), $text = $('.key-text'), $video = $('.key-video'), $voice = $('.key-voice'), $contt = $('.key-content'), $media_id = $('.key-media-id');
$image.hide();
$news.hide();
$text.hide();
$video.hide();
$voice.hide();
$contt.show();
$media_id.hide();
if(result.data.model.type.value == "text"){
$text.show();
}else{
$media_id.show();
}
if(result.data.model.type.value == "image"){
$image.show();
}
if(result.data.model.type.value == "news"){
$news.show();
}
if(result.data.model.type.value == "video"){
$video.show();
}
if(result.data.model.type.value == "voice"){
$voice.show();
}
$('.type').change(() => {
$image.hide();
$news.hide();
$text.hide();
$video.hide();
$voice.hide();
$contt.hide();
$media_id.hide();
var msg_type = $('.type').val();
if(msg_type != ''){
$contt.show();
}
if(msg_type == "text"){
$text.show();
}else{
$media_id.show();
}
if(msg_type == "image"){
$image.show();
}
if(msg_type == "news"){
$news.show();
}
if(msg_type == "video"){
$video.show();
}
if(msg_type == "voice"){
$voice.show();
}
});
$('#my-form').formPost({
url: "{:url('wechat.keyword/edit')}?id=" + data.id
});
},
btn2: function ($content) {
return true;
}
});
});
});
// 切换状态
$('.j-status').click(function () {
var data = $(this).data();
var msg = '确定要'+(parseInt(data.status) === 1 ? '关闭' : '开启')+'';
$('.j-status').del('id', "{:url('wechat.keyword/status')}",msg);
});
// 删除元素
$('.hema-del').del('id', "{:url('wechat.keyword/delete')}");
});
</script>