Browse Source

修改后台bug

Xiahai 11 months ago
parent
commit
d34d627780

+ 34 - 0
application/admin/common.php

@@ -195,3 +195,37 @@ if (!function_exists('build_heading')) {
         return $result;
     }
 }
+
+if (!function_exists('addHost')) {
+    function addHost($uri): string
+    {
+        $preg = "/^http(s)?:\\/\\/.+/";
+        if($uri) {
+            if (!is_https()) return 'http://'.$_SERVER['HTTP_HOST'].$uri;
+            $url = $uri;
+            if (!preg_match($preg,$url)) {
+                $url = 'https://'.$_SERVER['HTTP_HOST'].$uri;
+            }
+            return $url;
+        }
+        return '';
+    }
+}
+
+if (!function_exists('is_https')) {
+    //判断是否是HTTPS
+    function is_https()
+    {
+        if (defined('HTTPS') && HTTPS) return true;
+        if (!isset($_SERVER)) return FALSE;
+        if (!isset($_SERVER['HTTPS'])) return FALSE;
+        if ($_SERVER['HTTPS'] === 1) {  //Apache
+            return TRUE;
+        } elseif ($_SERVER['HTTPS'] === 'on') { //IIS
+            return TRUE;
+        } elseif ($_SERVER['SERVER_PORT'] == 443) { //其他
+            return TRUE;
+        }
+        return FALSE;
+    }
+}

+ 96 - 0
application/admin/controller/Protocol.php

@@ -0,0 +1,96 @@
+<?php
+
+namespace app\admin\controller;
+
+use app\common\controller\Backend;
+use think\Db;
+use think\exception\PDOException;
+use think\exception\ValidateException;
+
+/**
+ * app协议政策
+ *
+ * @icon fa fa-circle-o
+ */
+class Protocol extends Backend
+{
+    CONST TYPES = [
+        '1' => '使用条款',
+        '2' => '隐私政策',
+    ];
+    
+    /**
+     * Protocol模型对象
+     * @var \app\admin\model\Protocol
+     */
+    protected $model = null;
+
+    public function _initialize()
+    {
+        parent::_initialize();
+        $this->model = new \app\admin\model\Protocol;
+
+    }
+
+    /**
+     * 查看
+     */
+    public function index()
+    {
+        //设置过滤方法
+        $this->request->filter(['strip_tags', 'trim']);
+        if ($this->request->isAjax()) {
+            //如果发送的来源是Selectpage,则转发到Selectpage
+            if ($this->request->request('keyField')) {
+                return $this->selectpage();
+            }
+            list($where, $sort, $order, $offset, $limit) = $this->buildparams();
+
+            $list = $this->model
+                ->where($where)
+                ->order($sort, $order)
+                ->paginate($limit);
+            foreach($list as &$item) {
+                $item['url'] = addHost('/protocol/index/privacy/t/').$item['type'];
+                $item['type'] = self::TYPES[$item['type']];
+            }
+            $result = array("total" => $list->total(), "rows" => $list->items());
+
+            return json($result);
+        }
+        return $this->view->fetch();
+    }
+
+    /**
+     * 添加
+     */
+    public function add(): string
+    {
+        if ($this->request->isPost()) {
+            $params = $this->request->post("row/a");
+            if ($params) {
+                $params = $this->preExcludeFields($params);
+                //查询相同类型的是否存在
+                $one = $this->model->where('type', $params['type'])->count();
+                if($one) $this->error('同类型协议已存在');
+                $result = false;
+                Db::startTrans();
+                try {
+                    $result = $this->model->allowField(true)->save($params);
+                    Db::commit();
+                } catch (ValidateException | PDOException | Exception $e) {
+                    Db::rollback();
+                    $this->error($e->getMessage());
+                }
+                if ($result !== false) {
+                    $this->success();
+                } else {
+                    $this->error(__('No rows were inserted'));
+                }
+            }
+            $this->error(__('Parameter %s can not be empty', ''));
+        }
+        return $this->view->fetch();
+    }
+
+}

+ 189 - 216
application/admin/controller/user/User.php

@@ -34,10 +34,14 @@ class User extends Backend
         $this->model = model('User');
         $this->view->assign("typesList", $this->model->getTypesList());
 
-        $journal_list = Channel::where(['chief_id' => 0, 'parent_id' => 1])->column('name', 'id');
+        $journal_list = Channel::where(['parent_id' => 1])->column('name', 'id');
         $this->view->assign('journal_list', $journal_list);
 
+        $review_journal_list = Channel::where(['parent_id' => 1])->column('name', 'id');
+        $this->view->assign('review_journal_list', $review_journal_list);
+
         $group_list = ['author' => __('Author'), 'review' => __('Review'), 'chief' => __('chief'), 'editor' => __('editor')];
+        $this->assignconfig('site_group_list', $group_list);
         $this->view->assign('group_list', $group_list);
     }
 
@@ -55,24 +59,58 @@ class User extends Backend
             }
             list($where, $sort, $order, $offset, $limit) = $this->buildparams();
 
-            $type = $this->request->param('type');
+            $filter = $this->request->get("filter", '');
+            $filter = (array)json_decode($filter, true);
+            $filter = $filter ? $filter : [];
             $new_where = [];
-            if ($type == 'author') {
-                $new_where['is_author'] = 'correct';
+            if (array_key_exists('type', $filter)) {
+                if ($filter['type'] == 'author') {
+                    $new_where['is_author'] = 'correct';
+                }
+                if ($filter['type'] == 'review') {
+                    $new_where['is_review'] = 'correct';
+                }
+                if ($filter['type'] == 'chief') {
+                    $new_where['is_chief'] = 'correct';
+                }
+                if ($filter['type'] == 'editor') {
+                    $new_where['is_editor'] = 'correct';
+                }
+            }
+            if (array_key_exists('workplace', $filter)) {
+                $new_where['workplace'] = ['like', '%'. $filter['workplace'] .'%'];
+            }
+            if (array_key_exists('job_type', $filter)) {
+                $new_where['job_type'] = ['like', '%'. $filter['job_type'] .'%'];
             }
-            if ($type == 'review') {
-                $new_where['is_review'] = 'correct';
+            if (array_key_exists('title', $filter)) {
+                $new_where['title'] = ['like', '%'. $filter['title'] .'%'];
             }
-            if ($type == 'chief') {
-                $new_where['is_chief'] = 'correct';
+            if (array_key_exists('first_name', $filter)) {
+                $new_where['first_name'] = ['like', '%'. $filter['first_name'] .'%'];
             }
-            if ($type == 'editor') {
-                $new_where['is_editor'] = 'correct';
+            if (array_key_exists('middle_name', $filter)) {
+                $new_where['middle_name'] = ['like', '%'. $filter['middle_name'] .'%'];
+            }
+            if (array_key_exists('last_name', $filter)) {
+                $new_where['last_name'] = ['like', '%'. $filter['last_name'] .'%'];
+            }
+            if (array_key_exists('facebook', $filter)) {
+                $new_where['facebook'] = ['like', '%'. $filter['facebook'] .'%'];
+            }
+            if (array_key_exists('twitter', $filter)) {
+                $new_where['twitter'] = ['like', '%'. $filter['twitter'] .'%'];
+            }
+            if (array_key_exists('email', $filter)) {
+                $new_where['email'] = ['like', '%'. $filter['email'] .'%'];
+            }
+            if (array_key_exists('status', $filter)) {
+                $new_where['user.status'] = $filter['status'];
             }
 
             $list = $this->model
                 ->with('group')
-                ->where($where)
+//                ->where($where)
                 ->where($new_where)
                 ->order($sort, $order)
                 ->paginate($limit);
@@ -122,8 +160,20 @@ class User extends Backend
             $this->token();
         }
         $row = $this->model->get($ids);
-        $channel = Channel::where(['chief_id' => $row->id])->find();
-        $row->journal = $channel->id ?? 0;
+        $row->review_journal = 0;
+        $row->journal = 0;
+        $user_review_role_content = UserRoleContent::where(['user_id' => $row->id, 'type' => 'review'])->find();
+        $user_editor_role_content = UserRoleContent::where(['user_id' => $row->id, 'type' => 'editor'])->find();
+        $user_chief_role_content = UserRoleContent::where(['user_id' => $row->id, 'type' => 'chief'])->find();
+        if ($user_review_role_content) {
+            $row->review_journal = $user_review_role_content['journal_ids'];
+        }
+        if ($user_editor_role_content) {
+            $row->journal = $user_editor_role_content['journal_ids'];
+        }
+        if ($user_chief_role_content) {
+            $row->journal = $user_chief_role_content['journal_ids'];
+        }
         $this->modelValidate = true;
         if (!$row) {
             $this->error(__('No Results were found'));
@@ -160,227 +210,71 @@ class User extends Backend
         $result = false;
         Db::startTrans();
         try {
-            // 用户原来有的角色信息
-            $row_group = [];
-            // 如用户有角色需要删除角色可用
-            if ($row['is_author'] == 'correct') {
-                $row_group[] = 'author';
-            }
-            if ($row['is_review'] == 'correct') {
-                $row_group[] = 'review';
-            }
-            if ($row['is_editor'] == 'correct') {
-                $row_group[] = 'editor';
-            }
-            if ($row['is_chief'] == 'correct') {
-                $row_group[] = 'chief';
-            }
-
-            // 用户选中的角色
-            $groups = $params['group'];
-            if ($groups[0] == '') {
-                unset($groups[0]);
+            if (in_array('chief', $params['group'])) {
+                if (in_array('editor', $params['group'])) {
+                    $this->error(__('Editors and chief editors can only have one'));
+                }
+                if (empty($params['journal'])) {
+                    $this->error(__('Please select a journal'));
+                }
             }
 
-            // 原来角色有多个
-            if (count($row_group) > 0) {
-                // 新修改的身份全部取消
-                if (count($groups) == 0) {
-                    $group_data['is_author'] = 'fault';
-                    $group_data['is_review'] = 'fault';
-                    $group_data['is_editor'] = 'fault';
-                    $group_data['is_chief'] = 'fault';
+            if ($row['is_chief'] == 'correct' && !in_array('chief', $params['group'])) {
+                $params['is_chief'] = 'fault';
+                // 如果去掉主编角色则需要把对应的期刊主编数据移除
+                $channels = Channel::where(['chief_id' => $row->id])->select();
+                foreach ($channels as $channel) {
+                    $channel->chief_id = 0;
+                    $channel->save();
                 }
+                $this->syncDelUserRole($row->id, 'chief');
             }
 
-            // 用户身份
-            if (count($row_group) == 0 && count($groups) == 0) {
-                $group_data['is_author'] = 'fault';
-                $group_data['is_review'] = 'fault';
-                $group_data['is_editor'] = 'fault';
-                $group_data['is_chief'] = 'fault';
+            if ($row['is_author'] == 'correct' && !in_array('author', $params['group'])) {
+                $params['is_author'] = 'fault';
+                $this->syncDelUserRole($row->id, 'author');
             }
-
-            // 修改的角色数组大于0
-            if (count($groups) > 0) {
-                // 传入角色比原来角色数量多说明增加
-                if (count($groups) > count($row_group)) {
-                    if (count($row_group) > 0) {
-                        foreach ($groups as $item) {
-                            // 如果当前角色不在原来角色内容中
-                            if (!in_array($item, $row_group)) {
-                                if ($item == 'author') {
-                                    $group_data['is_author'] = 'correct';
-                                }
-                                if ($item == 'review') {
-                                    $group_data['is_review'] = 'correct';
-                                }
-                                if ($item == 'editor') {
-                                    $group_data['is_editor'] = 'correct';
-                                }
-                                if ($item == 'chief') {
-                                    $group_data['is_chief'] = 'correct';
-                                }
-                            }
-                        }
-                    } else { // 如果是空角色时则直接添加
-                        foreach ($groups as $group) {
-                            if ($group == 'author') {
-                                $group_data['is_author'] = 'correct';
-                            }
-                            if ($group == 'review') {
-                                $group_data['is_review'] = 'correct';
-                            }
-                            if ($group == 'editor') {
-                                $group_data['is_editor'] = 'correct';
-                            }
-                            if ($group == 'chief') {
-                                $group_data['is_chief'] = 'correct';
-                            }
-                        }
-                    }
-                }
-
-                // 如果更改的数量相同则判断是否是增加还是无增加
-                if (count($row_group) == count($groups)) {
-                    foreach ($groups as $item) {
-                        // 如果当前角色不在原来角色内容中
-                        if (!in_array($item, $row_group)) {
-                            if ($item == 'author') {
-                                $group_data['is_author'] = 'correct';
-                            }
-                            if ($item == 'review') {
-                                $group_data['is_review'] = 'correct';
-                            }
-                            if ($item == 'editor') {
-                                $group_data['is_editor'] = 'correct';
-                            }
-                            if ($item == 'chief') {
-                                $group_data['is_chief'] = 'correct';
-                            }
-                        }
-                    }
-                    foreach ($row_group as $item) {
-                        if (!in_array($item, $groups)) {
-                            if ($item == 'author') {
-                                $group_data['is_author'] = 'fault';
-                            }
-                            if ($item == 'review') {
-                                $group_data['is_review'] = 'fault';
-                            }
-                            if ($item == 'editor') {
-                                $group_data['is_editor'] = 'fault';
-                            }
-                            if ($item == 'chief') {
-                                $group_data['is_chief'] = 'fault';
-                            }
-                        }
-                    }
-                }
-
-                // 不更改用户角色时
-                if ($groups === $row_group) {
-                    foreach ($groups as $group) {
-                        if ($group == 'author') {
-                            $group_data['is_author'] = 'correct';
-                        }
-                        if ($group == 'review') {
-                            $group_data['is_review'] = 'correct';
-                        }
-                        if ($group == 'editor') {
-                            $group_data['is_editor'] = 'correct';
-                        }
-                        if ($group == 'chief') {
-                            $group_data['is_chief'] = 'correct';
-                        }
-                    }
-                }
-
-                // 在原来的基础上减少角色时
-                // 传入角色比原来角色数量少说明减少
-                if (count($groups) < count($row_group)) {
-                    foreach ($row_group as $item) {
-                        if (!in_array($item, $groups)) {
-                            if ($item == 'author') {
-                                $group_data['is_author'] = 'fault';
-                            }
-                            if ($item == 'review') {
-                                $group_data['is_review'] = 'fault';
-                            }
-                            if ($item == 'editor') {
-                                $group_data['is_editor'] = 'fault';
-                            }
-                            if ($item == 'chief') {
-                                $group_data['is_chief'] = 'fault';
-                            }
-                        }
-                    }
-                }
+            if ($row['is_review'] == 'correct' && !in_array('review', $params['group'])) {
+                $params['is_review'] = 'fault';
+                $this->syncDelUserRole($row->id, 'review');
+            }
+            if ($row['is_editor'] == 'correct' && !in_array('editor', $params['group'])) {
+                $params['is_editor'] = 'fault';
+                $this->syncDelUserRole($row->id, 'editor');
             }
 
             // 对应的角色信息插入到
-            foreach ($group_data as $key => $item) {
-                $params[$key] = $item;
-                if ($key == 'is_author') {
-                    $type = 'author';
-                }
-                if ($key == 'is_review') {
-                    $type = 'review';
-                }
-                // 如果是新增编辑角色则需要判断是否拥有主编,如拥有主编则需要去除掉
-                if ($key == 'is_editor') {
-                    $type = 'editor';
-                    if ($row->is_chief == 'correct') {
-                        $params['is_chief'] = 'fault';
-                    }
+            foreach ($params['group'] as $value) {
+                if ($value == 'author') {
+                    $params['is_author'] = 'correct';
+                    $this->syncUserRole($row->id, 'author', 'correct');
                 }
-                // 如果是新增主编角色则需要判断是否拥有编辑,如拥有编辑则需要去除掉
-                if ($key == 'is_chief') {
-                    $type = 'chief';
-                    if ($row->is_editor == 'correct') {
-                        $params['is_editor'] = 'fault';
-                    }
-
-                    // 判断如果选择了主编则需要填写期刊
-                    if (empty($params['journal'])) {
+                if ($value == 'review') {
+                    $params['is_review'] = 'correct';
+                    if (!$params['review_journal']) {
                         $this->error(__('Please select a journal'));
                     }
+                    $this->syncUserRole($row->id, 'review', 'correct', $params['review_journal']);
+                }
+                if ($value == 'chief') {
+                    $params['is_chief'] = 'correct';
+                    $params['is_editor'] = 'fault';
 
                     // 对应期刊绑定主编
                     $channel = Channel::get($params['journal']);
+                    if ($channel->chief_id > 0) {
+                        if ($channel->chief_id != $row->id) {
+                            $this->error(__('There is already an editor in chief under this journal'));
+                        }
+                    }
                     $channel->chief_id = $row->id;
                     $channel->save();
+                    $this->syncUserRole($row->id, 'chief', 'correct', $params['journal']);
                 }
-
-                // 增加user_role_content数据
-                if ($item == 'correct') {
-                    // 如果是增加角色则需要添加user_role_log 和 user_role_content
-                    $user_role_log_model = new UserRoleLog();
-                    $user_role_log_model->user_id = $row->id;
-                    $user_role_log_model->type = $type;
-                    $user_role_log_model->is_adopt = $item;
-                    if ($user_role_log_model->save()) {
-                        $user_role_model = new UserRoleContent();
-                        $user_role_model->user_id = $row->id;
-                        $user_role_model->log_id = $user_role_log_model->id;
-                        $user_role_model->type = $type;
-                        $user_role_model->affiliation = $row->affiliation;
-                        $user_role_model->save();
-                    }
-                } else {
-                    // 如果是删减角色则需要删除user_role_log 和 user_role_content
-                    $user_role_log_model = UserRoleLog::where(['user_id' => $row->id, 'type' => $type])->select();
-                    if (count($user_role_log_model) > 0) {
-                        foreach ($user_role_log_model as $user_log) {
-                            $user_role_model = UserRoleContent::where(['user_id' => $row->id, 'type' => $type, 'log_id' => $user_log->id])->select();
-                            $user_log->delete();
-                            if (count($user_role_model) > 0) {
-                                foreach ($user_role_model as $user_role) {
-                                    $user_role->delete();
-                                }
-                            }
-                        }
-                    }
+                if ($value == 'editor') {
+                    $params['is_editor'] = 'correct';
+                    $params['is_chief'] = 'fault';
+                    $this->syncUserRole($row->id, 'editor', 'correct', $params['journal']);
                 }
             }
 
@@ -443,4 +337,83 @@ class User extends Backend
         }
         return $this->view->fetch();
     }
+
+    /**
+     * 同步删除用户角色数据
+     *
+     * @param $user_id
+     * @param $type
+     * @return true
+     * @throws \think\db\exception\DataNotFoundException
+     * @throws \think\db\exception\ModelNotFoundException
+     * @throws \think\exception\DbException
+     */
+    public function syncDelUserRole($user_id, $type)
+    {
+        Db::startTrans();
+        try {
+            $user_role_log_model = UserRoleLog::where(['user_id' => $user_id, 'type' => $type])->select();
+            if (count($user_role_log_model) > 0) {
+                foreach ($user_role_log_model as $user_log) {
+                    $user_role_model = UserRoleContent::where(['user_id' => $user_id, 'type' => $type, 'log_id' => $user_log->id])->select();
+                    $user_log->delete();
+                    if (count($user_role_model) > 0) {
+                        foreach ($user_role_model as $user_role) {
+                            $user_role->delete();
+                        }
+                    }
+                }
+            }
+
+            Db::commit();
+        } catch (ValidateException|PDOException|Exception $e) {
+            Db::rollback();
+            $this->error($e->getMessage());
+        }
+        return true;
+    }
+
+    /**
+     * 同步用户角色数据
+     *
+     * @param $user_id
+     * @param $type
+     * @param $adopt
+     * @param $journal_id
+     * @return true
+     * @throws \think\db\exception\DataNotFoundException
+     * @throws \think\db\exception\ModelNotFoundException
+     * @throws \think\exception\DbException
+     */
+    public function syncUserRole($user_id, $type, $adopt, $journal_id = 0)
+    {
+        Db::startTrans();
+        try {
+            // 如果是增加角色则需要添加user_role_log 和 user_role_content
+            $user_role_log_model = UserRoleLog::where(['user_id' => $user_id, 'type' => $type, 'is_adopt' => $adopt])->find();
+            if (empty($user_role_log_model)) {
+                $user_role_log_model = new UserRoleLog();
+                $user_role_log_model->user_id = $user_id;
+                $user_role_log_model->type = $type;
+                $user_role_log_model->is_adopt = $adopt;
+                $user_role_log_model->save();
+            }
+            $user_role_model = UserRoleContent::where(['user_id' => $user_id, 'type' => $type, 'log_id' => $user_role_log_model->id])->find();
+            if (empty($user_role_model)) {
+                $user_role_model = new UserRoleContent();
+                $user_role_model->user_id = $user_id;
+                $user_role_model->log_id = $user_role_log_model->id;
+                $user_role_model->type = $type;
+                $user_role_model->journal_ids = $journal_id ?? 0;
+                $user_role_model->save();
+            }
+
+            Db::commit();
+        } catch (ValidateException|PDOException|Exception $e) {
+            Db::rollback();
+            $this->error($e->getMessage());
+        }
+
+        return true;
+    }
 }

+ 4 - 1
application/admin/lang/zh-cn/user/user.php

@@ -49,7 +49,10 @@ return [
     'Chief'          => '主编',
     'Editor'         => '编辑',
     'Note: Editors and chief editors can only have one'           => '注:编辑和主编只能拥有一个',
-    'Journal'        => '期刊',
+    'Journal'        => '主编/编辑期刊',
+    'Review_Journal'    => '审稿人期刊',
     'Please select a journal'    => '请选择期刊',
     'Note: If the editor in chief role is selected, a journal must be filled in' => '如果选择了主编角色,必须填写期刊',
+    'Editors and chief editors can only have one'        => '编辑和主编只能拥有一个',
+    'There is already an editor in chief under this journal' => '此期刊下已有主编',
 ];

+ 26 - 0
application/admin/model/Protocol.php

@@ -0,0 +1,26 @@
+<?php
+
+namespace app\admin\model;
+
+use think\Model;
+
+
+class Protocol extends Model
+{
+
+    // 表名
+    protected $name = 'protocol';
+    
+    // 自动写入时间戳字段
+    protected $autoWriteTimestamp = false;
+
+    // 定义时间戳字段名
+    protected $createTime = false;
+    protected $updateTime = false;
+    protected $deleteTime = false;
+
+    // 追加属性
+    protected $append = [
+
+    ];
+}

+ 25 - 0
application/admin/view/protocol/add.html

@@ -0,0 +1,25 @@
+<form id="add-form" class="form-horizontal" role="form" data-toggle="validator" method="POST" action="">
+
+    <div class="form-group">
+        <label class="control-label col-xs-12 col-sm-2">{:__('Type')}:</label>
+        <div class="col-xs-12 col-sm-8">
+            <select id="c-type" data-rule="required"  name="row[type]" class="form-control">
+                <option value="1">使用条款</option>
+                <option value="2">隐私政策</option>
+            </select>
+        </div>
+    </div>
+    <div class="form-group">
+        <label class="control-label col-xs-12 col-sm-2">{:__('Content')}:</label>
+        <div class="col-xs-12 col-sm-8">
+            <textarea id="c-content" data-rule="required" class="form-control editor" rows="5" name="row[content]" cols="50"></textarea>
+        </div>
+    </div>
+    <div class="form-group layer-footer">
+        <label class="control-label col-xs-12 col-sm-2"></label>
+        <div class="col-xs-12 col-sm-8">
+            <button type="submit" class="btn btn-success btn-embossed disabled">{:__('OK')}</button>
+            <button type="reset" class="btn btn-default btn-embossed">{:__('Reset')}</button>
+        </div>
+    </div>
+</form>

+ 15 - 0
application/admin/view/protocol/edit.html

@@ -0,0 +1,15 @@
+<form id="edit-form" class="form-horizontal" role="form" data-toggle="validator" method="POST" action="">
+    <div class="form-group">
+        <label class="control-label col-xs-12 col-sm-2">{:__('Content')}:</label>
+        <div class="col-xs-12 col-sm-8">
+            <textarea id="c-content" data-rule="required"  class="form-control editor" rows="5" name="row[content]" cols="50">{$row.content|htmlentities}</textarea>
+        </div>
+    </div>
+    <div class="form-group layer-footer">
+        <label class="control-label col-xs-12 col-sm-2"></label>
+        <div class="col-xs-12 col-sm-8">
+            <button type="submit" class="btn btn-success btn-embossed disabled">{:__('OK')}</button>
+            <button type="reset" class="btn btn-default btn-embossed">{:__('Reset')}</button>
+        </div>
+    </div>
+</form>

+ 26 - 0
application/admin/view/protocol/index.html

@@ -0,0 +1,26 @@
+<div class="panel panel-default panel-intro">
+    {:build_heading()}
+
+    <div class="panel-body">
+        <div id="myTabContent" class="tab-content">
+            <div class="tab-pane fade active in" id="one">
+                <div class="widget-body no-padding">
+                    <div id="toolbar" class="toolbar">
+                        <a href="javascript:;" class="btn btn-primary btn-refresh" title="{:__('Refresh')}" ><i class="fa fa-refresh"></i> </a>
+                        <a href="javascript:;" class="btn btn-success btn-add {:$auth->check('protocol/add')?'':'hide'}" title="{:__('Add')}" ><i class="fa fa-plus"></i> {:__('Add')}</a>
+                        <a href="javascript:;" class="btn btn-success btn-edit btn-disabled disabled {:$auth->check('protocol/edit')?'':'hide'}" title="{:__('Edit')}" ><i class="fa fa-pencil"></i> {:__('Edit')}</a>
+                        <a href="javascript:;" class="btn btn-danger btn-del btn-disabled disabled {:$auth->check('protocol/del')?'':'hide'}" title="{:__('Delete')}" ><i class="fa fa-trash"></i> {:__('Delete')}</a>
+                        <a href="javascript:;" class="btn btn-danger btn-import {:$auth->check('protocol/import')?'':'hide'}" title="{:__('Import')}" id="btn-import-file" data-url="ajax/upload" data-mimetype="csv,xls,xlsx" data-multiple="false"><i class="fa fa-upload"></i> {:__('Import')}</a>
+                        
+                    </div>
+                    <table id="table" class="table table-striped table-bordered table-hover table-nowrap"
+                           data-operate-edit="{:$auth->check('protocol/edit')}" 
+                           data-operate-del="{:$auth->check('protocol/del')}" 
+                           width="100%">
+                    </table>
+                </div>
+            </div>
+
+        </div>
+    </div>
+</div>

+ 19 - 3
application/admin/view/user/user/edit.html

@@ -11,24 +11,36 @@
         <label for="c-group_id" class="control-label col-xs-12 col-sm-2">{:__('Group')}:</label>
         <div class="col-xs-12 col-sm-4">
             <select id="c-group_id" class="form-control selectpicker" multiple="" name="row[group][]">
+                <option value="">{:__('None')}</option>
                 {foreach name="group_list" item="vo"}
                 <option value="{$key}" {in name="key" value="$row.group"}selected{/in}>{$vo}</option>
                 {/foreach}
             </select>
+            <div style="color: #f00;line-height: 25px">{:__('Note: Editors and chief editors can only have one')}</div>
+        </div>
+    </div>
+    <div class="form-group">
+        <label for="c-username" class="control-label col-xs-12 col-sm-2">{:__('Review_Journal')}:</label>
+        <div class="col-xs-12 col-sm-4">
+            <select id="c-review_journal" class="form-control" name="row[review_journal]">
+                <option value="">{:__('None')}</option>
+                {foreach name="review_journal_list" item="vo"}
+                <option value="{$key}" {in name="key" value="$row.review_journal" }selected{/in}>{$vo}</option>
+                {/foreach}
+            </select>
         </div>
-        <span class="msg-box" style="color: #f00;line-height: 25px">{:__('Note: Editors and chief editors can only have one')}</span>
     </div>
     <div class="form-group">
         <label for="c-username" class="control-label col-xs-12 col-sm-2">{:__('Journal')}:</label>
         <div class="col-xs-12 col-sm-4">
             <select id="c-journal" class="form-control" name="row[journal]">
-                <option value="">{:__('Please select a journal')}</option>
+                <option value="">{:__('None')}</option>
                 {foreach name="journal_list" item="vo"}
                 <option value="{$key}" {in name="key" value="$row.journal" }selected{/in}>{$vo}</option>
                 {/foreach}
             </select>
+            <div style="color: #f00;line-height: 25px">{:__('Note: If the editor in chief role is selected, a journal must be filled in')}</div>
         </div>
-        <span class="msg-box" style="color: #f00;line-height: 25px">{:__('Note: If the editor in chief role is selected, a journal must be filled in')}</span>
     </div>
     <div class="form-group">
         <label for="c-username" class="control-label col-xs-12 col-sm-2">{:__('Username')}:</label>
@@ -58,6 +70,7 @@
         <label for="c-workplace" class="control-label col-xs-12 col-sm-2">{:__('Workplace')}:</label>
         <div class="col-xs-12 col-sm-4">
             <select id="c-workplace" class="form-control" name="row[workplace]">
+                <option value="">{:__('None')}</option>
                 {foreach name="site.workplace" item="vo"}
                 <option value="{$key}" {in name="key" value="$row.workplace" }selected{/in}>{$vo}</option>
                 {/foreach}
@@ -68,6 +81,7 @@
         <label for="c-job_type" class="control-label col-xs-12 col-sm-2">{:__('Job Type')}:</label>
         <div class="col-xs-12 col-sm-4">
             <select id="c-job_type" class="form-control" name="row[job_type]">
+                <option value="">{:__('None')}</option>
                 {foreach name="site.job_type" item="vo"}
                 <option value="{$key}" {in name="key" value="$row.job_type" }selected{/in}>{$vo}</option>
                 {/foreach}
@@ -78,6 +92,7 @@
         <label for="c-title" class="control-label col-xs-12 col-sm-2">{:__('Title')}:</label>
         <div class="col-xs-12 col-sm-4">
             <select id="c-title" class="form-control" name="row[title]">
+                <option value="">{:__('None')}</option>
                 {foreach name="site.user_title" item="vo"}
                 <option value="{$key}" {in name="key" value="$row.title" }selected{/in}>{$vo}</option>
                 {/foreach}
@@ -148,6 +163,7 @@
         <label for="c-country" class="control-label col-xs-12 col-sm-2">{:__('Country')}:</label>
         <div class="col-xs-12 col-sm-4">
             <select id="c-country" class="form-control" name="row[country]">
+                <option value="">{:__('None')}</option>
                 {foreach name="site.country" item="vo"}
                 <option value="{$key}" {in name="key" value="$row.country" }selected{/in}>{$vo}</option>
                 {/foreach}

+ 9 - 2
application/index/view/user/register.html

@@ -33,10 +33,17 @@
                         <p class="help-block"></p>
                     </div>
                 </div>
+                <div class="form-group">
+                    <div class="controls">
+                        <input type="checkbox" id="privacy_checkbox">
+                        <span>I have read the <a target="_blank" href="/protocol/index/privacy/t/1">Terms of Use</a> and the <a target="_blank" href="/protocol/index/privacy/t/2">Privacy Policy</a> and I accept them.</span>
+                    </div>
+                    <div class="privacy_text" style="display: none;color: red;">Please check Agree to Agreement</div>
+                </div>
 
                 <div class="form-group">
-                    <button type="submit" class="btn btn-primary btn-lg btn-block">Register at Ideal Science</button>
-                    <a href="{:url('user/login')}?url={$url|urlencode|htmlentities}" class="btn btn-default btn-lg btn-block mt-3 no-border">Already have an account? Click to log in</a>
+                    <button type="submit" class="btn btn-primary btn-lg btn-block submit-button">Register at Ideal Science</button>
+                    <a href="{:url('user/login')}?url={$url|urlencode|htmlentities}" class="btn btn-default btn-lg btn-block mt-3 no-border">Already have an account? Click to login</a>
                 </div>
                 <!--@IndexRegisterFormEnd-->
             </form>

+ 8 - 104
application/index/view/user/submit_manuscript.html

@@ -50,7 +50,7 @@
                                 <span class="line"></span>
                             </div>
                         </div>
-                        <div class="nav-li-desc finish">Here you can upload your</div>
+                        <div class="nav-li-desc finish">Here you can upload your manuscript</div>
                     </div>
                 </div>
                 <div class="nav-item">
@@ -64,7 +64,7 @@
                                 <span class="line"></span>
                             </div>
                         </div>
-                        <div class="nav-li-desc">You can submit your manuscript</div>
+                        <div class="nav-li-desc">You can submit your manuscript information here</div>
                     </div>
                 </div>
                 <div class="nav-item">
@@ -78,7 +78,7 @@
                                 <span class="line"></span>
                             </div>
                         </div>
-                        <div class="nav-li-desc">Here you can upload author</div>
+                        <div class="nav-li-desc">Here you can upload author information</div>
                     </div>
                 </div>
                 <div class="nav-item">
@@ -92,7 +92,7 @@
                                 <span class="line"></span>
                             </div>
                         </div>
-                        <div class="nav-li-desc">We need to understand your interests</div>
+                        <div class="nav-li-desc">We need to understand your interests here</div>
                     </div>
                 </div>
                 <div class="nav-item">
@@ -101,12 +101,12 @@
                     </li>
                     <div class="nav-content">
                         <div class="nav-li-title">
-                            Recommended
+                            Recommended Reviewer
                             <div class="arrow" style="width: 60px">
                                 <span class="line"></span>
                             </div>
                         </div>
-                        <div class="nav-li-desc">Here you can recommend</div>
+                        <div class="nav-li-desc">Here you can recommend reviewers</div>
                     </div>
                 </div>
                 <div class="nav-item">
@@ -115,9 +115,9 @@
                     </li>
                     <div class="nav-content">
                         <div class="nav-li-title">
-                            Confirm and send to
+                            Confirm and send to editor
                         </div>
-                        <div class="nav-li-desc">Confirm your information and submit</div>
+                        <div class="nav-li-desc">Confirm your information and submit it to the editor</div>
                     </div>
                 </div>
             </ul>
@@ -569,102 +569,6 @@
 
                         <!-- 陈述 -->
                         <div class="form-item statement-content" style="display: none">
-<!--                            <div class="form-group">-->
-<!--                                <div class="col-xs-12 col-sm-12 statement-item-text">-->
-<!--                                    Please indicate if you received funding (institutional, private and/or corporate/private financial support) for the research reported in the manuscript.-->
-<!--                                </div>-->
-<!--                            </div>-->
-<!--                            <div class="form-group">-->
-<!--                                <label class="control-label col-xs-12 col-sm-3" style="text-align: left">-->
-<!--                                    Funding information-->
-<!--                                </label>-->
-<!--                            </div>-->
-<!--                            <div class="form-group">-->
-<!--                                <label class="control-label col-xs-12 col-sm-3" style="text-align: left">-->
-<!--                                    I have received funding:-->
-<!--                                </label>-->
-<!--                                <div class="col-xs-12 col-sm-8">-->
-<!--                                    <div class="input-group mb-3">-->
-<!--                                        <div class="radio radio-inline pl-0">-->
-<!--                                            <label for="c-funding-yes"><input id="c-funding-yes" name="row[is_funding]" type="radio" value="normal" {if condition="$row.is_funding == 'normal'"}checked{/if} />Yes</label>-->
-<!--                                            <label for="c-funding-no"><input id="c-funding-no" name="row[is_funding]" type="radio" value="hidden" {if condition="$row.is_funding == 'hidden'"}checked{/if} />No</label>-->
-<!--                                        </div>-->
-<!--                                    </div>-->
-<!--                                </div>-->
-<!--                            </div>-->
-<!--                            <div class="form-group funding_content" style="display: none;">-->
-<!--                                <label class="control-label col-xs-12 col-sm-3"></label>-->
-<!--                                <div class="col-xs-12 col-sm-8">-->
-<!--                                    <textarea id="c-funding_content" class="form-control editor" name="row[funding_content]" rows="15" placeholder="If 'yes', please add your funding unit and funding number...">{$row.funding_content|htmlentities}</textarea>-->
-<!--                                </div>-->
-<!--                            </div>-->
-
-<!--                            <hr>-->
-
-<!--                            <div class="form-group">-->
-<!--                                <div class="col-xs-12 col-sm-12 statement-item-text">-->
-<!--                                    We wish to draw the attention of the Editor to the following facts, which may be considered as potential conflicts of interest, and to significant financial contributions to this work.-->
-<!--                                </div>-->
-<!--                            </div>-->
-
-<!--                            <div class="form-group">-->
-<!--                                <label class="control-label col-xs-12 col-sm-4" style="text-align: left">-->
-<!--                                    Potential confilict of interest exists-->
-<!--                                </label>-->
-<!--                            </div>-->
-
-<!--                            <div class="form-group">-->
-<!--                                <label class="control-label col-xs-12 col-sm-3">-->
-<!--                                    choose:-->
-<!--                                </label>-->
-<!--                                <div class="col-xs-12 col-sm-8">-->
-<!--                                    <div class="input-group mb-3">-->
-<!--                                        <div class="radio radio-inline pl-0">-->
-<!--                                            <label for="is-interest-yes"><input id="is-interest-yes" name="row[is_interest]" type="radio" value="normal" {if condition="$row.is_interest == 'normal'"}checked{/if} />Yes</label>-->
-<!--                                            <label for="is-interest-no"><input id="is-interest-no" name="row[is_interest]" type="radio" value="hidden" {if condition="$row.is_interest == 'hidden'"}checked{/if} />No</label>-->
-<!--                                        </div>-->
-<!--                                    </div>-->
-<!--                                </div>-->
-<!--                            </div>-->
-
-<!--                            <div class="form-group interest_content" style="display: none;">-->
-<!--                                <label class="control-label col-xs-12 col-sm-3"></label>-->
-<!--                                <div class="col-xs-12 col-sm-8">-->
-<!--                                    <textarea id="c-interest_content" class="form-control editor" name="row[interest_content]" rows="15" placeholder="Type here...">{$row.interest_content|htmlentities}</textarea>-->
-<!--                                </div>-->
-<!--                            </div>-->
-
-<!--                            <div class="form-group">-->
-<!--                                <div class="col-xs-12 col-sm-12 statement-item-text" style="color: rgba(159,159,159,0.85);">-->
-<!--                                    <p>All forms of financial support received for this research by any institution, organization or private company.</p>-->
-<!--                                    <p>Any personal commercial or financial interest in the findings of the research.</p>-->
-<!--                                    <p>Any relationship with institutions, organizations or private companies, and other activities or relationships that may be perceived as unduly influencing the findings of the research.</p>-->
-<!--                                    <p>If in doubt, please select "Yes" and disclose any possible conflicts of interest.</p>-->
-<!--                                </div>-->
-<!--                            </div>-->
-
-<!--                            <hr>-->
-
-<!--                            <div class="form-group">-->
-<!--                                <label class="control-label col-xs-12 col-sm-12" style="text-align: left">-->
-<!--                                    Has your article been published in another journal or has it been submitted to another journal-->
-<!--                                </label>-->
-<!--                            </div>-->
-
-<!--                            <div class="form-group">-->
-<!--                                <label class="control-label col-xs-12 col-sm-3">-->
-<!--                                    choose:-->
-<!--                                </label>-->
-<!--                                <div class="col-xs-12 col-sm-8">-->
-<!--                                    <div class="input-group mb-3">-->
-<!--                                        <div class="radio radio-inline pl-0">-->
-<!--                                            <label for="is-another-choose-yes"><input id="is-another-choose-yes" name="row[statement_type]" type="radio" value="normal" {if condition="$row.statement_type == 'normal'"}checked{/if} />Yes</label>-->
-<!--                                            <label for="is-another-choose-no"><input id="is-another-choose-no" name="row[statement_type]" type="radio" value="hidden" {if condition="$row.statement_type == 'hidden'"}checked{/if} />No</label>-->
-<!--                                        </div>-->
-<!--                                    </div>-->
-<!--                                </div>-->
-<!--                            </div>-->
-
                             {include file="user/common/fields"}
                         </div>
 

+ 42 - 0
application/protocol/controller/Index.php

@@ -0,0 +1,42 @@
+<?php
+
+namespace app\protocol\controller;
+
+use app\admin\model\Protocol;
+use think\Controller;
+
+class Index extends Controller
+{
+    /**
+     * app端协议
+     */
+    public function privacy($t=1): string
+    {
+        $info = Protocol::where('type', $t)->find();
+        $content = '';
+        if($info) {
+            $content = $info->content??'';
+        }
+        switch($t) {
+            case 1:
+            case 4:
+                $title = 'APP服务协议';
+                break;
+            case 2:
+            case 3:
+                $title = 'APP隐私协议';
+                break;
+            case 5:
+                $title = '关于我们';
+                break;
+            case 6:
+                $title = '用户注册协议';
+                break;
+            default:
+                $title = '其它政策协议';
+        }
+        $this->view->assign('content', $content);
+        $this->view->assign('title', $title);
+        return $this->view->fetch('index/privacy');
+    }
+}

File diff suppressed because it is too large
+ 21 - 0
application/protocol/view/index/privacy.html


+ 55 - 0
public/assets/js/backend/protocol.js

@@ -0,0 +1,55 @@
+define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefined, Backend, Table, Form) {
+
+    var Controller = {
+        index: function () {
+            // 初始化表格参数配置
+            Table.api.init({
+                extend: {
+                    index_url: 'protocol/index' + location.search,
+                    add_url: 'protocol/add',
+                    edit_url: 'protocol/edit',
+                    del_url: 'protocol/del',
+                    multi_url: 'protocol/multi',
+                    import_url: 'protocol/import',
+                    table: 'protocol',
+                }
+            });
+
+            var table = $("#table");
+
+            // 初始化表格
+            table.bootstrapTable({
+                url: $.fn.bootstrapTable.defaults.extend.index_url,
+                pk: 'id',
+                sortName: 'id',
+                columns: [
+                    [
+                        {field: 'id', title: __('Id'),operate:false},
+                        {field: 'type', title: __('Type'),operate:false},
+                        {
+                            field: 'url', title: __('预览'), formatter: function (value, row, index) {
+                                return '<a href="' + value + '" target="_blank" class="btn btn-default btn-xs"><i class="fa fa-link"></i></a>';
+                            }
+                        },
+                        {field: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate, formatter: Table.api.formatter.operate}
+                    ]
+                ]
+            });
+
+            // 为表格绑定事件
+            Table.api.bindevent(table);
+        },
+        add: function () {
+            Controller.api.bindevent();
+        },
+        edit: function () {
+            Controller.api.bindevent();
+        },
+        api: {
+            bindevent: function () {
+                Form.api.bindevent($("form[role=form]"));
+            }
+        }
+    };
+    return Controller;
+});

+ 2 - 2
public/assets/js/backend/user/user.js

@@ -24,8 +24,8 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
                 columns: [
                     [
                         {checkbox: true},
-                        {field: 'id', title: __('Id'), sortable: true},
-                        {field: 'type', title: __('Type'), sortable: true},
+                        {field: 'id', title: __('Id'), sortable: true, operate: false},
+                        {field: 'type', title: __('Type'), searchList: Config.site_group_list},
                         {field: 'workplace', title: __('Workplace')},
                         {field: 'job_type', title: __('Job Type')},
                         {field: 'title', title: __('Title')},

+ 20 - 0
public/assets/js/frontend/user.js

@@ -47,6 +47,26 @@ define(['jquery', 'bootstrap', 'frontend', 'form', 'template'], function ($, und
             });
         },
         register: function () {
+            $(document).ready(function () {
+                $('.submit-button').prop('type', 'button');
+            });
+
+            $('.submit-button').click(function () {
+                if ($(this).prop('type') == 'button') {
+                    $('.privacy_text').show();
+                }
+            });
+
+            $(document).on('click', '#privacy_checkbox', function () {
+                if (!$(this).prop('checked')) {
+                    $('.privacy_text').show();
+                    $('.submit-button').prop('type', 'button');
+                } else {
+                    $('.privacy_text').hide();
+                    $('.submit-button').prop('type', 'submit');
+                }
+            });
+
             //本地验证未通过时提示
             $("#register-form").data("validator-options", validatoroptions);
 

Some files were not shown because too many files changed in this diff