fix:add ANSI编码适用于windows7

This commit is contained in:
david 2021-03-03 17:01:21 +08:00
parent ed70047d19
commit bd631ee663
2 changed files with 213 additions and 25 deletions

View File

@ -89,6 +89,7 @@
<label class="layui-form-label required">辅种的下载器</label>
<div class="layui-input-block" id="reseed_clients_view">
</div>
<div class="layui-form-mid layui-word-aux"><i class="layui-icon layui-icon-tips"></i> </div>
</div>
{{# } }}
@ -103,22 +104,49 @@
<div class="layui-input-block" id="to_clients_view">
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label required">排除目录</label>
<div class="layui-input-block">
<div id="path_filter_view"></div>
<div class="layui-form-mid layui-word-aux"><i class="layui-icon layui-icon-tips"></i> </div>
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label required">选择目录</label>
<div class="layui-input-block">
<div id="path_selector_view"></div>
<div class="layui-form-mid layui-word-aux"><i class="layui-icon layui-icon-tips"></i> () </div>
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label required">路径转换类型</label>
<div class="layui-input-inline">
<select name="path_type" lay-filter="path_type">
<option value="" selected="">请选择转换类型</option>
<option value="0">相等</option><option value="1"></option><option value="2"></option><option value="3"></option>
</select>
</div>
<div class="layui-form-mid layui-word-aux"><i class="layui-icon layui-icon-tips"></i> </div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">跳校验</label>
<div class="layui-input-block">
<input type="checkbox" name="skip_check" lay-skin="switch" lay-text="YES|NO" lay-filter="skip_check" id="skip_check">
<tip>转移时跳过校验</tip>
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">自动开始</label>
<div class="layui-input-block">
<input type="checkbox" name="paused" lay-skin="switch" lay-text="YES|NO" lay-filter="paused" id="paused">
<tip>转移成功自动开始任务</tip>
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">删除源做种</label>
<div class="layui-input-block">
<input type="checkbox" name="delete_torrent" lay-skin="switch" lay-text="YES|NO" lay-filter="delete_torrent" id="delete_torrent">
<tip>转移成功删除当前做种</tip>
</div>
</div>
{{# } }}
@ -156,10 +184,17 @@
{{# }); }}
</script>
<!-- 模板转移任务来源 [下载器] 选框 -->
<!-- 模板转移任务来源 [下载器] 选框 -->
<script id="form_clients_tpl" type="text/html">
{{# layui.each(d, function(index, item){ }}
<input type="checkbox" name="form_clients[{{item.uuid}}]" title="{{ item.name }}" checked>
<input type="radio" name="form_clients" value="{{item.uuid}}" title="{{ item.name }}">
{{# }); }}
</script>
<!-- 模板转移任务目标 [下载器] 单选框 -->
<script id="to_clients_tpl" type="text/html">
{{# layui.each(d, function(index, item){ }}
<input type="radio" name="to_clients" value="{{item.uuid}}" title="{{ item.name }}">
{{# }); }}
</script>
@ -224,13 +259,14 @@
<span class="layui-badge" lay-event="delete">删除</span>
</script>
<script>
layui.use(['table','form','miniPage','laytpl','code'], function () {
layui.use(['table','form','miniPage','laytpl','code','transfer'], function () {
let $ = layui.$,
layer = layui.layer,
table = layui.table,
form = layui.form,
miniPage = layui.miniPage,
laytpl = layui.laytpl;
laytpl = layui.laytpl
transfer = layui.transfer;
const API = {
tableList: '/Api/Config?config_filename=crontab&action=list'
@ -320,6 +356,8 @@
format_input('clients', formData);
delete formData.sites;
delete formData.clients;
console.log(formData);
//定义回调
callback = [
function(){
//取消复选框
@ -348,6 +386,7 @@
laytpl(getTpl).render(data, function(html) {
view.innerHTML = html;
});
//回调
callback !== null && typeof callback[0] === 'function' && callback[0]();
form.render('checkbox');
});
@ -361,6 +400,7 @@
laytpl(getTpl).render(d.data.items, function(html) {
view.innerHTML = html;
});
//回调
callback !== null && typeof callback[1] === 'function' && callback[1]();
form.render('checkbox');
});
@ -375,38 +415,95 @@
if (type !== 'move') {
return;
}
let callback = null;
if (formData !== null) {
format_input('form_clients', formData);
format_input('clients', formData);
delete formData.form_clients;
delete formData.clients;
console.log(formData);
//定义回调
callback = function(){
form.val("form", formData);
};
}
let callback = function(){
//取消复选框
$('#form_clients_view').find(':input').each(function () {
$(this).attr('checked', false);
});
//取消复选框
$('#to_clients_view :input').removeAttr("checked");
formData !==null && form.val("form", formData);
};
//辅种下载器
//获取所有下载器
$.getJSON('/Api/Config?config_filename=clients&action=list', function (d) {
let form_tpl = form_clients_tpl.innerHTML
,toTpl = reseed_clients_tpl.innerHTML
let formTpl = form_clients_tpl.innerHTML
,toTpl = to_clients_tpl.innerHTML
,form_view = getById('form_clients_view')
,to_view = getById('to_clients_view');
if (d.ret !== 200 || d.data.total <= 0) {
return;
}
laytpl(form_tpl).render(d.data.items, function(html) {
//来源下载器
laytpl(formTpl).render(d.data.items, function(html) {
form_view.innerHTML = html;
});
//转移到下载器
laytpl(toTpl).render(d.data.items, function(html) {
to_view.innerHTML = html;
});
//回调
callback !== null && typeof callback === 'function' && callback();
form.render('checkbox');
form.render('radio');
});
//获取目录
$.getJSON('/Api/Config?config_filename=folder&action=list', function (d) {
if (d.ret !== 200 || d.data.total <= 0) {
return;
}
console.log(d);
let _none = '无数据'
,_searchNone = '无匹配数据'
,_folder = '全部目录'
,_height = 250;
//过滤器
transfer.render({
elem: '#path_filter_view'
,id: 'path_filter'
,parseData: function(res){
return {
"value": res.uuid
,"title": res.name
,"disabled": res.disabled
,"checked": res.checked
,"dir":res.dir
}
}
,title: [_folder, '排除目录']
,data: d.data.items
,height: _height
,text: {
none: _none
,searchNone: _searchNone
}
,onchange: function(obj, index){
var arr = ['左边', '右边'];
layer.msg('来自 <strong>'+ arr[index] + '</strong> 的数据:'+ JSON.stringify(obj));
}
});
//选择器
transfer.render({
elem: '#path_selector_view'
,id: 'path_selector'
,parseData: function(res){
return {
"value": res.uuid
,"title": res.name
,"disabled": res.disabled
,"checked": res.checked
,"dir":res.dir
}
}
,title: [_folder, '选择目录']
,data: d.data.items
,height: _height
,text: {
none: _none
,searchNone: _searchNone
}
,onchange: function(obj, index){
var arr = ['左边', '右边'];
layer.msg('来自 <strong>'+ arr[index] + '</strong> 的数据:'+ JSON.stringify(obj));
}
});
});
}
@ -423,6 +520,7 @@
,icon: 'layui-icon-tips'
}]
,parseData: function(res){
console.log(res);
return {
"code": res.ret === 200 ? 0 : res.ret,
"msg": res.msg,
@ -492,7 +590,7 @@
,done: function(res, curr, count){
//如果是异步请求数据方式res即为你接口返回的信息。
//如果是直接赋值的方式res即为{data: [], count: 99} data为当前页数据、count为数据总长度
//console.log(res);
console.log(res);
//console.log(curr); //得到当前页码
//console.log(count); //得到数据总量
}
@ -541,7 +639,7 @@
table.on('tool(tableFilter)', function(obj){
let layEvent = obj.event;
let tr = obj.tr;
//console.log(obj.data);
console.log('原始数据:', obj.data);
switch (layEvent) {
case 'run':
$.ajax({
@ -648,7 +746,7 @@
//监听行双击事件
table.on('rowDouble(tableFilter)', function(obj){
//console.log(obj.tr) //得到当前行元素对象
console.log(obj.data) //得到当前行数据
console.log('原始数据:', obj.data) //得到当前行数据
//obj.del(); //删除当前行
//obj.update(fields) //修改当前行数据
});

90
windows7_start.cmd Normal file
View File

@ -0,0 +1,90 @@
@echo off
chcp 65001
title IYUUPlus
cd /d "%~dp0"
echo Docker: https://hub.docker.com/r/iyuucn/iyuuplus
echo Gitee: https://gitee.com/ledc/iyuuplus
echo Github: https://github.com/ledccn/IYUUPlus
echo QQ: 859882209 / 931954050 / 924099912
echo Wenda: http://wenda.iyuu.cn
echo Token: https://iyuu.cn
echo Blog: https://www.iyuu.cn
echo Docs: http://api.iyuu.cn/docs.php
echo.
goto :ping
:ping
echo "正在检查网络,请耐心等待..."
ping demo.iyuu.cn
echo.
goto :checkEnv
:checkEnv
echo "检查.env.example文件是否存在..."
if exist "%~dp0.env.example" goto :checkGit
echo "检查GIT尝试安装源码..."
git --version|find "git version">nul&&goto :install
goto :installError
:install
echo "正在使用GIT下载源码..."
git clone https://gitee.com/ledc/iyuuplus.git %~dp0IYUUPlus
echo "通过GIT安装完成开始检测php执行程序..."
cd IYUUPlus
goto :checkPHP
:installError
cls
echo "当前运行环境未检测到GIT程序源码安装失败请手动下载"
echo "Docker: https://hub.docker.com/r/iyuucn/iyuuplus"
echo "Gitee: https://gitee.com/ledc/iyuuplus"
echo "Github: https://github.com/ledccn/IYUUPlus"
pause
goto :end
:checkGit
echo "检查GIT程序尝试自动更新源码..."
git --version|find "git version">nul&&goto :pull
cls
echo "当前IYUUPlus运行环境未检测到git程序不支持自动更新。"
echo "推荐您使用git来下载代码库"
echo "您可以在安装git程序后在命令行内输入"
echo "git clone https://gitee.com/ledc/iyuuplus.git"
goto :checkPHP
:pull
echo "正在检测源码库的git特征文件..."
if exist "%~dp0.git\config" (
echo "正在为您自动更新..."
git fetch --all
git reset --hard origin/master
echo "更新完成!"
) else (
echo "当前IYUUPlus源码并非通过git拉取不支持自动更新"
)
echo.
goto :checkPHP
:checkPHP
if exist "%~dp0php\php.exe" (set PHP_BINARY=%~dp0php\php.exe) else (set PHP_BINARY=php.exe)
echo "PHP二进制程序"%PHP_BINARY%
%PHP_BINARY% -v|find "PHP Group">nul&&goto :start
cls
echo "没有检测到PHP执行程序"
echo "如果您已下载过php程序请在解压缩后把php文件夹添加进系统的环境变量。"
echo "或者把php执行程序解压缩到当前目录下的php文件夹。"
echo "脚本运行终止!!!"
pause
goto :end
:start
%PHP_BINARY% -v
echo.
echo "如果您需要停止程序请按下组合键CTRL + C"
%PHP_BINARY% start.php task.php
pause
goto :end
:end
rem 结束
echo.