From 1c8d3864f5c95ec104b68c2b722ab2a33f116ef8 Mon Sep 17 00:00:00 2001 From: taoser Date: Wed, 7 Jul 2021 17:40:43 +0800 Subject: [PATCH] =?UTF-8?q?=E6=94=AF=E6=8C=81=E6=9B=B4=E6=8D=A2=E5=9F=9F?= =?UTF-8?q?=E5=90=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 4 +- app/admin/controller/Database.php | 1 + app/admin/controller/Index.php | 4 +- app/admin/controller/Login.php | 10 +- app/admin/controller/Set.php | 17 +-- app/admin/controller/Upgrade.php | 1 + app/admin/lang/en-us.php | 126 ++++++++++++++++++++ app/admin/lang/zh-cn.php | 137 ++++++++++++++++++++++ app/admin/lang/zh-tw.php | 129 ++++++++++++++++++++ app/admin/model/System.php | 22 ++-- app/admin/view/index/home.html | 10 +- app/admin/view/public/base.html | 1 + app/admin/view/set/system/website.html | 8 +- app/admin/view/slider/add.html | 11 +- app/common/controller/AdminController.php | 16 +-- app/common/model/User.php | 7 ++ app/index/lang/zh-cn.php | 2 + app/install/data/taoler.sql | 2 +- config/taoler.php | 2 +- public/static/admin/modules/imgcom.js | 112 ++++++++++++++++++ public/static/admin/modules/set.js | 6 + public/static/res/mods/index.js | 4 +- 22 files changed, 587 insertions(+), 45 deletions(-) create mode 100644 app/admin/lang/en-us.php create mode 100644 app/admin/lang/zh-cn.php create mode 100644 app/admin/lang/zh-tw.php create mode 100644 public/static/admin/modules/imgcom.js diff --git a/README.md b/README.md index 461b56e..825a88a 100644 --- a/README.md +++ b/README.md @@ -7,8 +7,8 @@ * 后台:http://adm.aieok.com * 账号:test * 密码:test123 - * 版本:TaoLer 1.7.8 - * 日期:2021.6.1 + * 版本:TaoLer 1.7.15 + * 日期:2021.7.1 #### 项目地址 diff --git a/app/admin/controller/Database.php b/app/admin/controller/Database.php index 29ef29b..24f27b5 100644 --- a/app/admin/controller/Database.php +++ b/app/admin/controller/Database.php @@ -14,6 +14,7 @@ class Database extends AdminController public function __construct() { + parent::initialize(); $this->hostname = Config::get('database.connections.mysql.hostname'); $this->hostport = Config::get('database.connections.mysql.hostport'); $this->database = Config::get('database.connections.mysql.database'); diff --git a/app/admin/controller/Index.php b/app/admin/controller/Index.php index 0f25543..9e46013 100644 --- a/app/admin/controller/Index.php +++ b/app/admin/controller/Index.php @@ -7,6 +7,7 @@ use think\facade\Db; use think\facade\Session; use think\facade\Request; use think\facade\Cache; +use think\facade\Lang; use app\admin\model\Admin; use app\admin\model\Article; use app\admin\model\Cunsult; @@ -83,8 +84,9 @@ class Index extends AdminController $days = floor($days%365); } $runTime = $years ? "{$years}年{$days}天{$hos}时{$mins}分" : "{$days}天{$hos}时{$mins}分"; + $cpy = ($this->getCyl() > 1) ? Lang::get('Authorized') : Lang::get('Free version'); - View::assign(['runTime'=>$runTime,'versions'=>$versions,'comms'=>$comms,'forums'=>$forums]); + View::assign(['runTime'=>$runTime,'versions'=>$versions,'comms'=>$comms,'forums'=>$forums,'cpy'=>$cpy]); return View::fetch(); } diff --git a/app/admin/controller/Login.php b/app/admin/controller/Login.php index 5db8a35..f657c3e 100644 --- a/app/admin/controller/Login.php +++ b/app/admin/controller/Login.php @@ -6,18 +6,14 @@ use think\facade\Request; use think\facade\Session; use app\admin\validate\Admin; use think\exception\ValidateException; +use app\common\controller\AdminController; -class Login +class Login extends AdminController { //登录 public function index() - { - - if(Session::has('admin_id')){ - return redirect((string) url('index/index')); - } - + { if(Request::isAjax()){ $data = Request::param(); diff --git a/app/admin/controller/Set.php b/app/admin/controller/Set.php index b2ee101..8b4be21 100644 --- a/app/admin/controller/Set.php +++ b/app/admin/controller/Set.php @@ -17,16 +17,16 @@ class Set extends AdminController protected function initialize() { parent::initialize(); - + + $this->sysInfo = $this->getSystem(); + $this->syscy = $this->getCyl(); } //网站设置显示 public function index() { $mailserver = MailServer::find(1); - $sysInfo = Db::name('system')->find(1); - $syscy = $this->cyCheck($sysInfo['base_url'],$sysInfo['domain']); $template = Files::getDirName('../view'); - View::assign(['sysInfo'=>$sysInfo,'syscy'=>$syscy,'mailserver'=>$mailserver,'template'=>$template]); + View::assign(['sysInfo'=>$this->sysInfo,'syscy'=>$this->syscy,'mailserver'=>$mailserver,'template'=>$template]); return View::fetch('set/system/website'); } @@ -34,12 +34,13 @@ class Set extends AdminController public function website() { if(Request::isPost()){ - $data = Request::only(['webname','template','cache','upsize','uptype','blackname','webtitle','keywords','descript','icp','copyright']); - $result = Db::name('system')->cache('system')->where('id', 1)->update($data); - if($result){ + $data = Request::only(['webname','domain','template','cache','upsize','uptype','blackname','webtitle','keywords','descript','icp','copyright']); + $system = new System(); + $result = $system->sets($data,$this->syscy); + if($result == 1){ return json(['code'=>0,'msg'=>'更新成功']); } else { - return json(['code'=>-1,'msg'=>'更新失败']); + return json(['code'=>-1,'msg'=>$result]); } } } diff --git a/app/admin/controller/Upgrade.php b/app/admin/controller/Upgrade.php index ffdfda9..1a06927 100644 --- a/app/admin/controller/Upgrade.php +++ b/app/admin/controller/Upgrade.php @@ -36,6 +36,7 @@ class Upgrade extends AdminController public function __construct() { + parent::initialize(); $this->sys_version = Config::get('taoler.version'); $this->pn = Config::get('taoler.appname'); $this->sys = Db::name('system')->where('id',1)->find(); diff --git a/app/admin/lang/en-us.php b/app/admin/lang/en-us.php new file mode 100644 index 0000000..dfce03f --- /dev/null +++ b/app/admin/lang/en-us.php @@ -0,0 +1,126 @@ + 'language', + 'chinese' => '中文简体', + 'english' => 'English', + + //message + 'add' => 'add', + 'delete' => 'delete', + 'edit' => 'edit', + 'uploads' => 'Upload', + 'login success' => 'login success', + 'login error' => 'login error', + 'add success' => 'add success!', + 'add error' => 'add error', + 'edit success' => 'edit success', + 'edit error' => 'edit error', + 'delete success' => 'delete success', + 'delete error' => 'delete error', + 'upload success' => 'upload success', + 'upload error' => 'upload error', + 'upgrade success' => 'upgrade success', + 'upgrade error' => 'upgrade error', + 'illegal request' => 'illegal request', + + //menu + 'index' => 'Index', + 'home page' => 'Home', + 'user center' => 'Center', + 'set info' => 'Set info', + 'my message' => 'Message', + 'my page' => 'My page', + + 'login' => 'Login', + 'logout' => 'Logout', + 'sign in' => 'Sign in', + 'sign up' => 'Sign up', + 'register' => 'Register', + 'discuss' => 'Discuss', + 'case' => 'Case', + 'timeline' => 'Timeline', + + //article/post + 'poster' => 'poster', + 'title' => 'Title', + 'title color' => 'Title color', + 'add post' => 'Add post', + 'edit post' => 'Edit post', + 'delete post' => 'Delete post', + 'post now' => 'Post now', + 'collection' => 'collection', + 'my collection' => 'My collection', + 'cancel collection' => 'cancel collection', + 'all' => 'All', + 'finished' => 'Finished', + 'end' => 'End', + 'no finished' => 'no finished', + 'hot' => 'Hot', + 'top' => 'Top', + 'cancel hoting' => 'Cancel hoting', + 'cancel topping' => 'Cancel topping', + 'go sign' => 'Go sign', + 'more post' => 'more post', + 'friendly link' => 'Friendly link', + 'reviewers list' => 'Reviewers list', + 'hot post list' => 'Hot post list', + 'links list' => 'Links list', + 'statement' => 'Statement', + 'trends' => 'Trends', + 'sponsor' => 'Super sponsor', + 'i want to join' => 'i want to join', + 'official products' => 'Official products', + 'no comments' => 'No comments', + 'submit comments' => 'Submit comments', + 'reply' => 'reply', + 'replies' => 'replies', + 'accept' => 'accept', + 'please input the content' => 'please input the content', + 'ads area' => 'Ads area', + 'enclosure' => 'Enclosure', + 'add attachment' => 'Add attachment', + 'download files' => 'Download files', + 'special column' => 'Columns', + + //Sign in/up + 'username' => 'Username', + 'password' => 'Password', + 'username or password error' => 'username or password error', + 'new password' => 'New Password', + 'reset password' => 'Reset password', + 'retrieve password' => 'Retrieve password', + 'email' => 'Email', + 'confirm password' => 'Confirm password', + 'captcha' => 'Captcha', + 'remember password' => 'Remember password', + 'forget password' => 'Forget password', + 'login now' => 'Login now', + 'submit' => 'Submit', + 'go back' => 'Go back', + 'register now' => 'Register now', + 'mail/username' => 'mail/username', + '6-16 characters' => '6-16 characters', + 'strong type encryption' => 'Strong type encryption', + 'it cannot be changed' => 'It cannot be changed', + 'the only way to get back your password' => 'The only way to get back your password', + 'please input the password' => 'Please input the password', + 'please confirm the password' => 'Please confirm the password', + 'please input the captcha' => 'Please input the captcha', + + //user + 'add friends' => 'Add friends', + 'start a chat' => 'Start a chat', + 'authentication information' => 'Authentication information', + 'it is not signed yet' => 'It is not signed yet', + 'log in to view' => 'Log in to view', + 'join' => 'Join', + 'recent statements' => 'Recent statements', + 'recent answers' => 'Recent answers', + 'browses' => 'Browses', + 'in' => 'in', + 'accumulate points' => 'Accumulate points', + 'my post' => 'My post', + 'my auth' => 'My authorize' +]; \ No newline at end of file diff --git a/app/admin/lang/zh-cn.php b/app/admin/lang/zh-cn.php new file mode 100644 index 0000000..bcda12f --- /dev/null +++ b/app/admin/lang/zh-cn.php @@ -0,0 +1,137 @@ + 'language', + 'chinese' => '中文简体', + 'english' => 'english', + + //弹窗提示消息 + 'add' => '添加', + 'delete' => '删除', + 'edit' => '编辑', + 'uploads' => '上传', + 'login success' => '登录成功', + 'login error' => '登录失败', + 'add success' => '添加成功!', + 'add error' => '添加失败', + 'edit success' => '修改成功', + 'edit error' => '修改失败', + 'delete success' => '删除成功', + 'delete error' => '删除失败', + 'upload success' => '上传成功', + 'upload error' => '上传失败', + 'upgrade success' => '升级成功', + 'upgrade error' => '升级失败', + 'illegal request' => '非法请求', + + //菜单 + 'index' => 'index', + 'home page' => '首页', + 'user center' => '用户中心', + 'set info' => '设置', + 'my message' => '我的消息', + 'my page' => '我的主页', + + 'login' => '登录', + 'logout' => '退出', + 'sign in' => '签到', + 'sign up' => '注册', + 'register' => '注册', + 'discuss' => '讨论', + 'case' => '案例', + 'timeline' => '框架日志', + + //帖子 + 'poster' => '贴主', + 'title' => '标题', + 'title color' => '颜色', + 'add post' => '添加帖子', + 'edit post' => '编辑帖子', + 'delete post' => '删除帖子', + 'post now' => '立即发布', + 'my collection' => '我的收藏', + 'collection' => '收藏', + 'cancel collection' => '收藏-', + 'all' => '综合', + 'finished' => '已结', + 'end' => '已结', + 'no finished' => '未结', + 'hot' => '加精', + 'top' => '置顶', + 'cancel hoting' => '精-', + 'cancel topping' => '顶-', + 'go sign' => '去签到', + 'more post' => '更多帖子', + 'friendly link' => '友情链接', + 'reviewers list' => '回帖热榜', + 'hot post list' => '本周热议', + 'links list' => '温馨通道', + 'statement' => '说明', + 'trends' => '动态', + 'sponsor' => '钻级赞助商', + 'i want to join' => '我要加入', + 'official products' => '官方产品', + 'no comments' => '暂时还没有评论', + 'submit comments' => '提交评论', + 'reply' => '回复', + 'replies' => '次回复', + 'accept' => '采纳', + 'please input the content' => '请输入内容', + 'ads area' => '广告区', + 'enclosure' => '附件', + 'add attachment' => '添加附件', + 'download files' => '下载文件', + 'special column' => '选择专栏', + 'tags' => '标签', + 'add tags' => '添加标签', + + //Sign in/up + 'username' => '用户', + 'password' => '密码', + 'username or password error' => '用户或密码错误', + 'new password' => '新密码', + 'reset password' => '重置密码', + 'retrieve password' => '找回密码', + 'email' => '邮箱', + 'confirm password' => '确认密码', + 'captcha' => '验证码', + 'remember password' => '一周内记住密码', + 'forget password' => '忘记密码', + 'login now' => '立即登录', + 'submit' => '提交', + 'go back' => '返回', + 'register now' => '立即注册', + 'mail/username' => '邮箱/用户名', + '6-16 characters' => '6-16 字符', + 'strong type encryption' => '经过强类型加密', + 'it cannot be changed' => '不能更改', + 'the only way to get back your password' => '找回密码唯一途径', + 'please input the password' => '请输入密码', + 'please confirm the password' => '请确认密码', + 'please input the captcha' => '请输入验证码', + + //user + 'add friends' => '添加为好友', + 'start a chat' => '开始会话', + 'authentication information' => '认证信息', + 'it is not signed yet' => '懒得还没有任何签名', + 'log in to view' => '登录查看', + 'join' => '加入', + 'recent statements' => '最近发帖', + 'recent answers' => '最近回贴', + 'browses' => '浏览', + 'in' => '在', + 'accumulate points' => '积分', + 'my post' => '我的帖子', + 'my auth' => '我的授权', + 'Please log in 10 minutes later' => '请10分钟后再登陆', + 'Login error 3, Please log in 10 minutes later' => '连续登陆错误3次,请10分钟后登录', + 'Account disabled' => '账号被禁用,请联系管理员', + 'Pending approval' => '待审核,请联系管理员', + + 'Authorized' => '已授权', + 'Unauthorized' => '未授权', + 'Free version'=> '免费版', + +]; \ No newline at end of file diff --git a/app/admin/lang/zh-tw.php b/app/admin/lang/zh-tw.php new file mode 100644 index 0000000..47ff9cf --- /dev/null +++ b/app/admin/lang/zh-tw.php @@ -0,0 +1,129 @@ + 'language', + 'chinese' => '中文簡體', + 'english' => 'english', + + //彈窗提示消息 + 'add' => '添加', + 'delete' => '刪除', + 'edit' => '編輯', + 'uploads' => '上傳', + 'login success' => '登錄成功', + 'login error' => '登錄失敗', + 'add success' => '添加成功!', + 'add error' => '添加失敗', + 'edit success' => '修改成功', + 'edit error' => '修改失敗', + 'delete success' => '刪除成功', + 'delete error' => '刪除失敗', + 'upload success' => '上傳成功', + 'upload error' => '上傳失敗', + 'upgrade success' => '升級成功', + 'upgrade error' => '升級失敗', + 'illegal request' => '非法請求', + + //菜單 + 'index' => 'index', + 'home page' => '首頁', + 'user center' => '用戶中心', + 'set info' => '設置', + 'my message' => '我的消息', + 'my page' => '我的主頁', + + 'login' => '登錄', + 'logout' => '退出', + 'sign in' => '簽到', + 'sign up' => '註冊', + 'register' => '註冊', + 'discuss' => '討論', + 'case' => '案例', + 'timeline' => '框架日誌', + + //帖子 + 'poster' => '貼主', + 'title' => '標題', + 'title color' => '顏色', + 'add post' => '添加帖子', + 'edit post' => '編輯帖子', + 'delete post' => '刪除帖子', + 'post now' => '立即發布', + 'my collection' => '我的收藏', + 'cancel collection' => '取消收藏', + 'all' => '綜合', + 'finished' => '已結', + 'end' => '已結', + 'no finished' => '未結', + 'hot' => '加精', + 'top' => '置頂', + 'cancel hoting' => '取消加精', + 'cancel topping' => '取消置頂', + 'go sign' => '去簽到', + 'more post' => '更多帖子', + 'friendly link' => '友情鏈接', + 'reviewers list' => '回帖熱榜', + 'hot post list' => '本周熱議', + 'links list' => '溫馨通道', + 'statement' => '說明', + 'trends' => '動態', + 'sponsor' => '鉆級贊助商', + 'i want to join' => '我要加入', + 'official products' => '官方產品', + 'no comments' => '暫時還沒有評論', + 'submit comments' => '提交評論', + 'reply' => '回復', + 'replies' => '次回復', + 'accept' => '采納', + 'please input the content' => '請輸入內容', + 'ads area' => '廣告區', + 'enclosure' => '附件', + 'add attachment' => '添加附件', + 'download files' => '下載文件', + 'special column' => '選擇專欄', + 'tags' => '標簽', + 'add tags' => '添加標簽', + + //Sign in/up + 'username' => '用戶', + 'password' => '密碼', + 'username or password error' => '用戶或密碼錯誤', + 'new password' => '新密碼', + 'reset password' => '重置密碼', + 'retrieve password' => '找回密碼', + 'email' => '郵箱', + 'confirm password' => '確認密碼', + 'captcha' => '驗證碼', + 'remember password' => '壹周內記住密碼', + 'forget password' => '忘記密碼', + 'login now' => '立即登錄', + 'submit' => '提交', + 'go back' => '返回', + 'register now' => '立即註冊', + 'mail/username' => '郵箱/用戶名', + '6-16 characters' => '6-16 字符', + 'strong type encryption' => '經過強類型加密', + 'it cannot be changed' => '不能更改', + 'the only way to get back your password' => '找回密碼唯壹途徑', + 'please input the password' => '請輸入密碼', + 'please confirm the password' => '請確認密碼', + 'please input the captcha' => '請輸入驗證碼', + + //user + 'add friends' => '添加為好友', + 'start a chat' => '開始會話', + 'authentication information' => '認證信息', + 'it is not signed yet' => '懶得還沒有任何簽名', + 'log in to view' => '登錄查看', + 'join' => '加入', + 'recent statements' => '最近發帖', + 'recent answers' => '最近回貼', + 'browses' => '瀏覽', + 'in' => '在', + 'accumulate points' => '積分', + 'my post' => '我的帖子', + 'my auth' => '我的授权' + + +]; \ No newline at end of file diff --git a/app/admin/model/System.php b/app/admin/model/System.php index 5e26d8e..cb45d18 100644 --- a/app/admin/model/System.php +++ b/app/admin/model/System.php @@ -3,19 +3,25 @@ namespace app\admin\model; use think\Model; -//use think\model\concern\SoftDelete; +use think\facade\Cache; + class System extends Model { - //软删除 - //use SoftDelete; - //protected $deleteTime = 'delete_time'; - //protected $defaultSoftDelete = 0; //登陆校验 - public function website() + public function sets($data,$cy) { - - + $sys = $this::find(1); + if($cy == 0){ + unset($data['copyright']); + } + $res = $sys->save($data); + if($res){ + Cache::delete('system'); + return 1; + } else { + return Lang::get('edit error'); + } } } diff --git a/app/admin/view/index/home.html b/app/admin/view/index/home.html index a87d936..f5d0859 100644 --- a/app/admin/view/index/home.html +++ b/app/admin/view/index/home.html @@ -223,7 +223,7 @@ @@ -258,6 +258,14 @@ {$runTime} + + + 当前授权 + + + diff --git a/app/admin/view/public/base.html b/app/admin/view/public/base.html index 0294fa5..3c2c68d 100644 --- a/app/admin/view/public/base.html +++ b/app/admin/view/public/base.html @@ -18,6 +18,7 @@ var AdminLogin = "{:url('Login/index')}", AdminLogout = "{:url('Admin/logout')}", adminClearCache = "{:url('Admin/clearCache')}"; +var sysCy = "{$syscy}"; //var c = "{:config('app.domain_bind.www')}"; //console.log(c); diff --git a/app/admin/view/set/system/website.html b/app/admin/view/set/system/website.html index 708a6a3..7f320ae 100644 --- a/app/admin/view/set/system/website.html +++ b/app/admin/view/set/system/website.html @@ -24,7 +24,7 @@
- +
@@ -104,8 +104,8 @@
-
- +
+
提示:
未经授权用户,可不限制功能使用,但严禁私自改写版权脚本。一旦发现,永远禁止升级并追诉相关责任。
@@ -185,7 +185,7 @@ ,form = layui.form ,upload = layui.upload; - //选完文件后不自动上传 + //LOGO选完文件后不自动上传 upload.render({ elem: '#logo-img' ,url: '{:url('admin/set/upload')}' diff --git a/app/admin/view/slider/add.html b/app/admin/view/slider/add.html index b455fdb..64fef9a 100644 --- a/app/admin/view/slider/add.html +++ b/app/admin/view/slider/add.html @@ -74,11 +74,12 @@ base: '/static/admin/' //静态资源所在路径 }).extend({ index: 'lib/index' //主入口模块 - }).use(['index', 'form', 'upload','laydate','colorpicker'], function(){ + }).use(['index', 'form', 'upload','laydate','colorpicker', 'imgcom'], function(){ var $ = layui.$ ,form = layui.form ,laydate = layui.laydate - ,upload = layui.upload ; + ,upload = layui.upload + ,imgcom = layui.imgcom; var colorpicker = layui.colorpicker; //颜色表单赋值 @@ -108,8 +109,12 @@ elem: '#layuiadmin-upload-slid-img' ,url: 'uploadImg' ,accept: 'images' - ,method: 'get' ,acceptMime: 'image/*' + ,auto: false + ,choose: function (obj) { //选择文件后的回调 + imgcom.uploads(obj); + } + ,done: function(res){ //console.log(res) $(this.item).prev("div").children("input").val(res.src) diff --git a/app/common/controller/AdminController.php b/app/common/controller/AdminController.php index ddb8acf..ad74f09 100644 --- a/app/common/controller/AdminController.php +++ b/app/common/controller/AdminController.php @@ -108,17 +108,19 @@ abstract class AdminController return $v->failException(true)->check($data); } - - protected function cyCheck($url,$d) + //获取层级 + protected function getCyl() { - $url = $url.'?u='.$d; + $sys = $this->getSystem(); + $url = $sys['base_url'].'?u='.$sys['domain']; $cy = Api::urlGet($url); if($cy && $cy->code == 0){ $cylevel = $cy->level; - return $cylevel; } else { - return 0; + $cylevel = 0; } + Cache::set('cylevel',$cylevel,3600); + return Cache::get('cylevel'); } /** @@ -191,12 +193,12 @@ abstract class AdminController } //得到当前系统安装前台域名 - protected function getIndexUrl() { $sysUrl = $this->getSystem(); $domain = $this->getHttpUrl($sysUrl['domain']); - View::assign(['domain'=>$domain,'insurl'=>$sysUrl['domain']]); + $syscy = $this->getCyl(); + View::assign(['domain'=>$domain,'insurl'=>$sysUrl['domain'],'syscy'=>$syscy]); } diff --git a/app/common/model/User.php b/app/common/model/User.php index 4438847..35c6dfd 100644 --- a/app/common/model/User.php +++ b/app/common/model/User.php @@ -47,6 +47,13 @@ class User extends Model $user = $this::whereOr('email',$data['name'])->whereOr('name',$data['name'])->findOrEmpty(); if(!($user->isEmpty())){ + //被禁用和待审核 + if($user['status'] == -1){ + return Lang::get('Account disabled'); + } + if($user['status'] == 0){ + return Lang::get('Pending approval'); + } //错误登陆连续3次且小于10分钟 if((time() - $user->login_error_time < 60) && is_int($user->login_error_num/3)){ return Lang::get('Please log in 10 minutes later'); diff --git a/app/index/lang/zh-cn.php b/app/index/lang/zh-cn.php index 23c95a9..001f66b 100644 --- a/app/index/lang/zh-cn.php +++ b/app/index/lang/zh-cn.php @@ -127,5 +127,7 @@ return [ 'my auth' => '我的授权', 'Please log in 10 minutes later' => '请10分钟后再登陆', 'Login error 3, Please log in 10 minutes later' => '连续登陆错误3次,请10分钟后登录', + 'Account disabled' => '账号被禁用,请联系管理员', + 'Pending approval' => '待审核,请联系管理员', ]; \ No newline at end of file diff --git a/app/install/data/taoler.sql b/app/install/data/taoler.sql index 3a45977..eefa1ee 100644 --- a/app/install/data/taoler.sql +++ b/app/install/data/taoler.sql @@ -541,7 +541,7 @@ CREATE TABLE `tao_user` ( -- ---------------------------- -- Records of tao_user -- ---------------------------- -INSERT INTO `tao_user` VALUES ('1', 'admin', '95d6f8d0d0c3b45e5dbe4057da1b149e', '2147483647', 'admin@qq.com', '管理员', '北京市', '1', '这是我的第一个TP5系统,2019北京。OK! OK!ok@', '/static/res/images/avatar/00.jpg', '1', '14', '1', '1', '0', '127.0.0.1', '0', '0', '0', '0', '1579053025', '1578469091', '0'); +INSERT INTO `tao_user` VALUES ('1', 'admin', '95d6f8d0d0c3b45e5dbe4057da1b149e', '2147483647', 'admin@qq.com', '管理员', '北京市', '1', '这是我的第一个TP5系统,2019北京。OK! OK!ok@', '/static/res/images/avatar/00.jpg', '1', '0', '1', '1', '0', '127.0.0.1', '0', '0', '0', '0', '1579053025', '1578469091', '0'); -- ---------------------------- -- Table structure for tao_user_area diff --git a/config/taoler.php b/config/taoler.php index 83724f3..55a09ed 100644 --- a/config/taoler.php +++ b/config/taoler.php @@ -7,7 +7,7 @@ return [ //应用名,此项不可更改 'appname' => 'TaoLer', //版本配置 - 'version' => '1.7.14', + 'version' => '1.7.15', //加盐 'salt' => 'taoler', //数据库备份目录 diff --git a/public/static/admin/modules/imgcom.js b/public/static/admin/modules/imgcom.js new file mode 100644 index 0000000..3639838 --- /dev/null +++ b/public/static/admin/modules/imgcom.js @@ -0,0 +1,112 @@ +/** + images压缩扩展模块 + changlin_zhao@qq.com + 2021.5.25 +**/ + +layui.define(['upload','layer'],function(exports){ +var upload = layui.upload; +var layer = layui.layer; +var compressImage = { + uploads: function(obj){ + //obj.preview(function(index, file, result){ + + //执行实例 + + var files = obj.pushFile(); + var filesArry = []; + for (var key in files) { //将上传的文件转为数组形式 + filesArry.push(files[key]) + } + var index = filesArry.length - 1; + var file = filesArry[index]; //获取最后选择的图片,即处理多选情况 + + if (navigator.appName == "Microsoft Internet Explorer" && parseInt(navigator.appVersion.split(";")[1] + .replace(/[ ]/g, "").replace("MSIE", "")) < 9) { + return obj.upload(index, file) + } + canvasDataURL(file, function (blob) { + var aafile = new File([blob], file.name, { + type: file.type + }) + var isLt1M; + if (file.size < aafile.size) { + isLt1M = file.size + } else { + isLt1M = aafile.size + } + + if (isLt1M / 1024 / 1024 > 2) { + return layer.alert('上传图片过大!') + } else { + if (file.size < aafile.size) { + return obj.upload(index, file) + } + obj.upload(index, aafile) + } + }) + + + + + function canvasDataURL(file, callback) { //压缩转化为base64 + var reader = new FileReader() + reader.readAsDataURL(file) + reader.onload = function (e) { + const img = new Image() + const quality = 0.5 // 图像质量 + const canvas = document.createElement('canvas') + const drawer = canvas.getContext('2d') + img.src = this.result + img.onload = function () { + + var originWidth = img.width,/* 图片的宽度 */ + originHeight = img.height; /* 图片的高度 */ + + // 设置最大尺寸限制,将所有图片都压缩到小于1m + const maxWidth = 1024, maxHeight = 1024; + // 需要压缩的目标尺寸 + let targetWidth = originWidth, targetHeight = originHeight; + // 等比例计算超过最大限制时缩放后的图片尺寸 + if (originWidth > maxWidth || originHeight > maxHeight) { + if (originWidth / originHeight > 1) { + // 宽图片 + targetWidth = maxWidth; + targetHeight = Math.round(maxWidth * (originHeight / originWidth)); + } else { + // 高图片 + targetHeight = maxHeight; + targetWidth = Math.round(maxHeight * (originWidth / originHeight)); + } + } + + canvas.width = targetWidth; + canvas.height = targetHeight; + drawer.drawImage(img, 0, 0, canvas.width, canvas.height) + convertBase64UrlToBlob(canvas.toDataURL(file.type, quality), callback); + } + } + } + + function convertBase64UrlToBlob(urlData, callback) { //将base64转化为文件格式 + const arr = urlData.split(',') + const mime = arr[0].match(/:(.*?);/)[1] + const bstr = atob(arr[1]) + let n = bstr.length + const u8arr = new Uint8Array(n) + while (n--) { + u8arr[n] = bstr.charCodeAt(n) + } + callback(new Blob([u8arr], { + type: mime + })); + } + + + //}) + } + } + //输出 imgcom 接口 + exports('imgcom', compressImage); +}); + diff --git a/public/static/admin/modules/set.js b/public/static/admin/modules/set.js index 69c6d3a..1358a96 100644 --- a/public/static/admin/modules/set.js +++ b/public/static/admin/modules/set.js @@ -152,6 +152,12 @@ layui.define(['form', 'upload'], function(exports){ return false; }); + var othis = $("input[name='copyright']"); + if(sysCy == 0){ + othis.addClass('layui-disabled'); + othis.attr("disabled"); + } + //上传头像 var avatarSrc = $('#LAY_avatarSrc'); upload.render({ diff --git a/public/static/res/mods/index.js b/public/static/res/mods/index.js index 8da8f99..84d8ec3 100644 --- a/public/static/res/mods/index.js +++ b/public/static/res/mods/index.js @@ -400,8 +400,8 @@ layui.define(['layer', 'laytpl', 'form', 'element', 'upload', 'util', 'imgcom'], url: audioUrl ,elem: '#fly-jie-audio-upload .upload-audio' ,accept: 'audio' - ,acceptMime: 'audio/mp3' - ,exts: 'mp3' + ,acceptMime: 'audio/*' + ,exts: 'mp3|m4a' ,before: function(obj){ //loding = layer.msg('文件上传中,请稍等哦', { icon: 16 ,shade:0.3,time:0 }); layer.load(2); //上传loading