2023-01-29 10:26:52 +08:00

320 lines
11 KiB
HTML
Raw 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.

{extend name="public/base" /}
{block name="body"}
<style>
.clinhei{width:100%;height:25px;}
.inp{width:200px;}
.inpdiv{width:25%;float:left;}
.inpdivbut{width:10%;float:left;}
.so{width:80px;height:30px;border:0;margin-top:25px;text-align:center;line-height:30px;cursor: pointer;}
.tdinp{width:100%;border:0;}
.up{border:0;cursor: pointer;}
.bs{width:50px;height:50px;text-align:center;}
.bj{background:#fff;}
.btn-jun{display:block;margin:0 auto;}
.uptopimg{position:fixed; top:15%;left:35%;width: 500px;height:500px;display:none;background:#fff;z-index:999;}
.uptopimg img{width:450px;height:280px; display:block; margin:0 auto;margin-top:10px;}
.uppay{position:fixed; top:15%;left:42%;width:30%;height:80%;display:none;background:#fff;z-index:999;}
.task{display:block;margin: 0 auto;width:88%;margin-top:10px;}
.tasksetbut{display: block;margin:0 auto;width:100px;}
.tasksetg{display: block;margin:0 auto;width:100px;margin-top:10px;}
.tasktext{color: red;width:90%;display: block;margin: 0 auto;margin-top: 5px;}
.modal-content p{margin-top: 10px;margin-bottom: 10px;margin-left: 10px;font-size:16px;width:80%;}
.modal-content p span{color: #689f38;}
.mcent{display: block;margin: 0 auto;}
</style>
<div class="alert alert-danger alert-dismissable" id="alertmgs" style="display:none;position:fixed;top:10;">
<button type="button" class="close" data-dismiss="alert"
aria-hidden="true">
&times;
</button>
<p>错误!请进行一些更改。</p>
</div>
<div class="alert alert-success alert-dismissable" id="alertyes" style="display:none;position:fixed;top:10;">
<button type="button" class="close" data-dismiss="alert"
aria-hidden="true">
&times;
</button>
成功!
</div>
<div class="main-box clearfix">
{if $modeswitch==1}
<header class="main-box-header clearfix">
<div class="pull-left">
<h2>当前任务状态:
{if $istask==0}
<font style="color: chocolate;">关闭</font>
{else}
<font style="color: darkgreen;">定时中</font>
{/if}
</h2>
</div>
</header>
<div class="main-box-body clearfix">
<div class="container">
<form id="forms" enctype="multipart/form-data">
<div class="inpdiv">
<label for="name">尾缀</label>
<input type="text" class="form-control inp" id="fonts" name="fonts">
</div>
<div class="inpdivbut">
<div class="btn btn-info" onclick="formsub()" style="margin-top:25px;">添加尾缀</div>
</div>
<div class="inpdiv" style="margin-left:14px;">
<label for="name" style="color: red;">任务秒数x秒更换一次0为关闭</label>
<input type="text" class="form-control inp" id="TaskTime" value="{$TaskTime}">
</div>
<div class="inpdivbut">
<div class="btn btn-success" style="margin-top:25px;" onclick="settask()">设置任务</div>
</div>
<div class="inpdivbut">
<a href="javascript:history.back(-1)" class="btn btn-primary" style="margin-top:25px;margin-left:14px;">返回</a>
</div>
<div class="inpdivbut">
<div class="btn btn-success" style="margin-top:25px;background: chocolate;" onclick="qie(2)">切换无截流模式</div>
</div>
</form>
</div>
<div class="clinhei"></div>
<div class="container">
<table class="table table-bordered bj" id="table" cellspacing="0" cellpadding="2" border="1">
<thead>
<tr>
<th style="text-align: center;">尾缀</th>
<th style="text-align: center;">状态</th>
<th style="text-align: center;">操作</th>
</tr>
</thead>
<tbody id="table" cellspacing="0" cellpadding="2" border="1">
{volist name="res" id="v"}
<tr data-id="{$v.id}">
<td>
<input type="text" class="tdinp text-center" value="{$v.text}">
</td>
<td style="text-align: center;">
{if $v.status==0}
<font style="color: rgb(117, 192, 41);">待使用</font>
{else}
<font style="color: red;">已使用</font>
{/if}
</td>
<td>
{if $v.status==0}
<div class="btn btn-success" onclick="generate(this)" style="margin-left:40%;">修改</div>
<div class="btn btn-danger" onclick="del('{$v.id}')">删除</div>
{/if}
</td>
</tr>
{/volist}
</tbody>
</table>
{$page}
</div>
</div>
{else}
<div class="inpdivbut">
<div class="btn btn-success" style="background: chocolate;" onclick="qie(1)">关闭无截流模式</div>
</div>
{/if}
</div>
{/block}
{block name="script"}
<script src = "/public/js/colResizable-1.6.min.js" ></script>
<script>
$(function(){
//此处实现表格可拖放属性
$("#table").colResizable({
liveDrag:true,//实现实时拖动,可看见拖动轨迹
draggingClass:"dragging", //防止拖动出险虚标线
resizeMode: "overflow" //表的宽度可以超过父级宽度
});
});
function del(id){
if(confirm("确定删除这项配置吗?")){
$.ajax({
type: "POST",
url: "{:url('transfer/delwxfont')}",
data: {id:id},
dataType: "json",
success: function(data){
if(data.status==1){
swal('删除成功',"", {icon : "success",buttons:{confirm:{className : 'btn btn-success'}},});
window.location = '';
}else{
swal('删除失败',"", {icon : "success",buttons:{confirm:{className : 'btn btn-success'}},});
}
}
});
}
}
function generate(zz){
var id = $(zz).parent().parent().attr('data-id');
if(confirm("确定修改吗?")){
$.ajax({
type: "POST",
url: "{:url('transfer/upwxfont')}",
data: {
id:id,
text:$(zz).parent().parent().find('input:eq(0)').val(),
},
dataType: "json",
success: function(data){
if(data.status==1){
swal(data.reg,"", {icon : "success",buttons:{confirm:{className : 'btn btn-success'}},});
}else{
swal('错误',data.reg, {icon : "error",buttons:{confirm:{className : 'btn btn-danger'}},});
}
}
});
}
}
function formsub(){
var lid = '{$id}';
var text = $("#fonts").val();
var fm = $('#forms');
var formData = new FormData();
formData.append("text",text);
formData.append("lid",lid);
if(text == ''){
swal('错误','尾缀不能为空', {icon : "error",buttons:{confirm:{className : 'btn btn-danger'}},});
}else{
$.ajax({
type: "POST",
url:"{:url('transfer/setfont')}",
data: formData,
async: false,
cache: false,
processData:false,
contentType:false,
dataType:"json",
error: function(request) {
},
success: function(data) {
if(data.status==1){
swal(data.reg,"", {icon : "success",buttons:{confirm:{className : 'btn btn-success'}},});
window.location = '';
}else{
swal('错误',data.reg, {icon : "error",buttons:{confirm:{className : 'btn btn-danger'}},});
}
}
});
}
}
// 设置任务
function settask(){
var lid = '{$id}';
var TaskTime = $('#TaskTime').val();
if(TaskTime=='' || TaskTime<0){
swal('错误','', {icon : "error",buttons:{confirm:{className : 'btn btn-danger'}},});
}else{
swal({
title: '确定操作?',
text: "修改秒数需要等上个任务执行完",
type: 'warning',
buttons:{
confirm: {
text : '确认',
className : 'btn btn-success'
},
cancel: {
text : '关闭',
visible: true,
className: 'btn btn-danger'
}
}
}).then((Delete) => {
if (Delete) {
$.ajax({
type: "POST",
url: "{:url('transfer/setWxFontTask')}",
data: {
lid:lid,
TaskTime:TaskTime,
},
dataType: "json",
success: function(data){
if(data.status==1){
swal(data.reg,"", {icon : "success",buttons:{confirm:{className : 'btn btn-success'}},});
window.location = '';
}else{
swal('错误',data.reg, {icon : "error",buttons:{confirm:{className : 'btn btn-danger'}},});
}
}
});
} else {
//关闭执行
swal.close();
}
});
}
}
// 切换无截流模式
function qie(t){
var lid = '{$id}';
swal({
title: '确定操作?',
text: "",
type: 'warning',
buttons:{
confirm: {
text : '确认',
className : 'btn btn-success'
},
cancel: {
text : '关闭',
visible: true,
className: 'btn btn-danger'
}
}
}).then((Delete) => {
if (Delete) {
$.ajax({
type: "POST",
url: "{:url('transfer/openmodes')}",
data: {
lid:lid,
t:t,
},
dataType: "json",
success: function(data){
if(data.status==1){
swal(data.reg,"", {icon : "success",buttons:{confirm:{className : 'btn btn-success'}},});
window.location = '';
}else{
swal('错误',data.reg, {icon : "error",buttons:{confirm:{className : 'btn btn-danger'}},});
}
}
});
} else {
//关闭执行
swal.close();
}
});
}
</script>
{/block}