From 05e955e06e966908e6a96a99785767177cce42e2 Mon Sep 17 00:00:00 2001 From: Mr Chen Date: Mon, 25 Feb 2019 18:07:31 +0800 Subject: [PATCH] =?UTF-8?q?=E5=8A=A0=E5=85=A5=E5=8E=8B=E7=BC=A9=E8=84=9A?= =?UTF-8?q?=E6=9C=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- route/static/app/soft.js | 90 ++++++++++++++++++++++++++++--- route/templates/default/soft.html | 3 +- scripts/plugin_compress.sh | 21 ++++++++ 3 files changed, 107 insertions(+), 7 deletions(-) create mode 100755 scripts/plugin_compress.sh diff --git a/route/static/app/soft.js b/route/static/app/soft.js index 252038b0c..df7165a95 100755 --- a/route/static/app/soft.js +++ b/route/static/app/soft.js @@ -342,7 +342,7 @@ function indexSoft() { var data = $("#indexsoft > div").map(function() { return $(this).attr("data-id"); }).get(); tmp = []; for(i in data){ - console.log(data[i]); + // console.log(data[i]); if (data[i] != ''){ tmp.push($.trim(data[i])); } @@ -359,8 +359,86 @@ function indexSoft() { }; } -// $(function() { -// if (window.document.location.pathname == '/soft/') { -// setInterval(function() { getSList(); }, 10000); -// } -// }); \ No newline at end of file + +function importPluginOpen(){ + $("#update_zip").on("change", function () { + var files = $("#update_zip")[0].files; + if (files.length == 0) { + return; + } + importPlugin(files[0]); + $("#update_zip").val('') + }); + + $("#update_zip").click(); +} + + +function importPlugin(file){ + var formData = new FormData(); + formData.append("plugin_zip", file); + $.ajax({ + url: "/plugin?action=update_zip", + type: "POST", + data: formData, + processData: false, + contentType: false, + success: function (data) { + if (data.status === false) { + layer.msg(data.msg, { icon: 2 }); + return; + } + var loadT = layer.open({ + type: 1, + area: "500px", + title: "安装第三方插件包", + closeBtn: 2, + shift: 5, + shadeClose: false, + content: '\ +
\ + \ + \ +
\ +
' + }); + }, + error: function (responseStr) { + layer.msg('上传失败2!', { icon: 2 }); + } + }); +} + + +function importPluginInstall(plugin_name, tmp_path) { + layer.msg('正在安装,这可能需要几分钟时间...', { icon: 16, time: 0, shade: [0.3, '#000'] }); + $.post('/plugin?action=input_zip', { plugin_name: plugin_name, tmp_path: tmp_path }, function (rdata) { + layer.closeAll() + if (rdata.status) { + soft.get_list(); + } + setTimeout(function () { layer.msg(rdata.msg, { icon: rdata.status ? 1 : 2 }) }, 1000); + }); +} + +$(function() { + if (window.document.location.pathname == '/soft/') { + setInterval(function() { getSList(); }, 8000); + } +}); \ No newline at end of file diff --git a/route/templates/default/soft.html b/route/templates/default/soft.html index 3bea580e0..035ffb0c7 100755 --- a/route/templates/default/soft.html +++ b/route/templates/default/soft.html @@ -21,7 +21,8 @@ - + +
diff --git a/scripts/plugin_compress.sh b/scripts/plugin_compress.sh new file mode 100755 index 000000000..9a7773cc8 --- /dev/null +++ b/scripts/plugin_compress.sh @@ -0,0 +1,21 @@ +#!/bin/bash + +### +### 插件压缩 +### +PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:~/bin +export PATH +LANG=en_US.UTF-8 +is64bit=`getconf LONG_BIT` +curPath=`pwd` +rootPath=$(dirname "$curPath") + +startTime=`date +%s` +PLUGIN_NAME='readme' + +#echo $rootPath/plugins/$PLUGIN_NAME +cd $rootPath/plugins/$PLUGIN_NAME && zip $rootPath/plugins/$PLUGIN_NAME/readme_${startTime}.zip -r ./* > /tmp/t.log + 2>&1 + +endTime=`date +%s` +((outTime=($endTime-$startTime)/60)) +echo -e "Time consumed:\033[32m $outTime \033[0mMinute!" \ No newline at end of file