xiaogang 4 vuotta sitten
vanhempi
commit
bcecb63bf1

+ 33 - 0
app/Admin/Actions/AdminSetting.php

xqd
@@ -0,0 +1,33 @@
+<?php
+
+namespace App\Admin\Actions;
+
+use App\Admin\Forms\AdminSetting as AdminSettingForm;
+use Dcat\Admin\Actions\Action;
+use Dcat\Admin\Widgets\Modal;
+
+class AdminSetting extends Action
+{
+    /**
+     * @return string
+     */
+	protected $title = '<i class="feather icon-edit" style="font-size: 1.5rem"></i> 网站设置';
+
+    public function render()
+    {
+        $modal = Modal::make()
+            ->id('admin-setting-config') // 导航栏显示弹窗,必须固定ID,随机ID会在刷新后失败
+            ->title($this->title())
+            ->body(AdminSettingForm::make())
+            ->lg()
+            ->button(
+                <<<HTML
+<ul class="nav navbar-nav">
+     <li class="nav-item"> &nbsp;{$this->title()} &nbsp;</li>
+</ul> 
+HTML
+            );
+
+        return $modal->render();
+    }
+}

+ 123 - 0
app/Admin/Actions/Users/UserAction.php

xqd
@@ -0,0 +1,123 @@
+<?php
+
+
+namespace App\Admin\Actions\Users;
+
+use App\Models\UserInfoModel;
+use Dcat\Admin\Admin;
+use Dcat\Admin\Grid\RowAction;
+use Dcat\Admin\Widgets\Modal;
+use Dcat\Admin\Widgets\Table;
+
+class UserAction extends RowAction
+{
+    protected $title = '更多资料';
+
+    protected $model;
+
+    public function __construct(string $model = null)
+    {
+        $this->model = $model;
+    }
+
+    /**
+     * 设置确认弹窗信息,如果返回空值,则不会弹出弹窗
+     *
+     * 允许返回字符串或数组类型
+     *
+     * @return array|string|void
+     */
+    public function confirm()
+    {
+
+    }
+
+    /**
+     * 处理请求
+     *
+     * @param Request $request
+     *
+     * @return \Dcat\Admin\Actions\Response
+     */
+    public function handle(Request $request)
+    {
+        return $this->response()
+            ->success('Processed successfully: '.$this->getKey())
+            ->redirect('/');
+    }
+
+    /**
+     * 设置要POST到接口的数据
+     *
+     * @return array
+     */
+    public function parameters()
+    {
+        return [];
+    }
+
+    public function render()
+    {
+        return Modal::make()
+            ->lg()
+            ->title($this->title)
+            ->body($this->table($this->getKey()))
+            ->button('<i class="feather icon-grid"></i> 更多资料');
+    }
+
+    protected function table($user_id)
+    {
+        $userInfo = UserInfoModel::query()->find($user_id);
+        if(!$userInfo){
+            return ;
+        }
+            $photo = json_decode($userInfo->photo,true);
+            $photoDiv = "<div class='show_img_div'>";
+            if(count($photo)>0){
+                foreach ($photo as $v){
+                    $photoDiv.= "<img  src='".$v."' style='width:80px;height:80px;margin-right:10px'/>";
+                }
+            }
+            $photoDiv .= "</div>";
+
+            $video = json_decode($userInfo->video,true);
+            $videoDiv = "<div>";
+            if(count($video)>0){
+                foreach ($video as $v){
+                    $videoDiv .= "<video src='".$v."' style='width:200px;height:200px;margin-right:10px' controls='controls'></video>";
+                }
+            }
+            $videoDiv .= "</div>";
+
+
+
+        Admin::style('.table td{padding: .85rem .55rem}');
+        Admin::script(<<<JS
+                $('.show_img_div>img').click(function(){
+                    Dcat.swal.fire(
+                         {imageUrl:this.src,
+                         imageMaxWidth:1200,
+                         imageMaxHeight:900,
+                         imageAlt:'图片打开失败'}
+                    );
+                });
+            JS);
+        $data = [
+            ['name' => '相册',    'value' => $photoDiv],
+            ['name' => '视频',    'value' => $videoDiv],
+            ['name' => '生日',    'value' => $userInfo->birthday],
+            ['name' => '身高',    'value' => $userInfo->height.'cm'],
+            ['name' => '体重',    'value' => $userInfo->weight.'kg'],
+            ['name' => '职业',    'value' => $userInfo->work],
+            ['name' => '个人简介', 'value' =>$userInfo->info],
+            ['name' => '地区',    'value' => $userInfo->area],
+            ['name' => '身材',    'value' => $userInfo->figure],
+            ['name' => '感情状态', 'value' => $userInfo->feeling],
+            ['name' => '学历',    'value' => $userInfo->education],
+            ['name' => '年收入',   'value' => $userInfo->income],
+            ['name' => '兴趣爱好', 'value' => $userInfo->hobby],
+            ['name' => '抽烟喝酒',  'value' => $userInfo->drink],
+        ];
+        return Table::make(['名称', '值'], $data);
+    }
+}

+ 69 - 0
app/Admin/Actions/Users/UserAuth.php

xqd
@@ -0,0 +1,69 @@
+<?php
+
+
+namespace App\Admin\Actions\Users;
+
+use Dcat\Admin\Grid\RowAction;
+use Illuminate\Http\Request;
+
+class UserAuth extends RowAction
+{
+    protected $title = '<i class="feather icon-user-check"></i> 用户认证';
+
+    protected $model;
+
+    public function __construct(string $model = null)
+    {
+        $this->model = $model;
+    }
+
+    /**
+     * 设置确认弹窗信息,如果返回空值,则不会弹出弹窗
+     *
+     * 允许返回字符串或数组类型
+     *
+     * @return array|string|void
+     */
+    public function confirm()
+    {
+        return [
+            "确定认证吗?"
+        ];
+    }
+
+    /**
+     * 处理请求
+     *
+     * @param Request $request
+     *
+     * @return \Dcat\Admin\Actions\Response
+     */
+    public function handle(Request $request)
+    {
+        // 获取当前行ID
+        $id = $this->getKey();
+
+        // 获取 parameters 方法传递的参数
+        $model = $request->get('model');
+        $apply = $model::find($id);
+        $apply->is_auth=1;
+        $apply->save();
+        // 返回响应结果并刷新页面
+        return $this->response()->success("操作成功")->refresh();
+    }
+
+    /**
+     * 设置要POST到接口的数据
+     *
+     * @return array
+     */
+    public function parameters()
+    {
+        return [
+            // 发送当前行 username 字段数据到接口
+            'status' => $this->row->is_auth,
+            // 把模型类名传递到接口
+            'model' => $this->model,
+        ];
+    }
+}

+ 68 - 0
app/Admin/Actions/Users/UserChange.php

xqd
@@ -0,0 +1,68 @@
+<?php
+
+
+namespace App\Admin\Actions\Users;
+
+use App\Models\UserInfoModel;
+use Dcat\Admin\Admin;
+use Dcat\Admin\Grid\RowAction;
+use Dcat\Admin\Widgets\Modal;
+use Dcat\Admin\Widgets\Table;
+
+class UserChange extends RowAction
+{
+    protected $title = '修改账户';
+
+    protected $model;
+
+    public function __construct(string $model = null)
+    {
+        $this->model = $model;
+    }
+
+    /**
+     * 设置确认弹窗信息,如果返回空值,则不会弹出弹窗
+     *
+     * 允许返回字符串或数组类型
+     *
+     * @return array|string|void
+     */
+    public function confirm()
+    {
+
+    }
+
+    /**
+     * 处理请求
+     *
+     * @param Request $request
+     *
+     * @return \Dcat\Admin\Actions\Response
+     */
+    public function handle(Request $request)
+    {
+        return $this->response()
+            ->success('Processed successfully: '.$this->getKey())
+            ->redirect('/');
+    }
+
+    /**
+     * 设置要POST到接口的数据
+     *
+     * @return array
+     */
+    public function parameters()
+    {
+        return [];
+    }
+
+    public function render()
+    {
+        $form = UsersInfo::make()->payload(['id'=>$this->getKey()]);
+        return Modal::make()
+            ->lg()
+            ->title($this->title)
+            ->body($form)
+            ->button('<i class="feather icon-settings"></i> '.$this->title);
+    }
+}

+ 57 - 0
app/Admin/Actions/Users/UsersInfo.php

xqd
@@ -0,0 +1,57 @@
+<?php
+namespace App\admin\Actions\Users;
+
+use App\Models\User;
+use Dcat\Admin\Contracts\LazyRenderable;
+use Dcat\Admin\Traits\LazyWidget;
+use Dcat\Admin\Widgets\Form;
+use PHPUnit\Util\Exception;
+
+class UsersInfo extends Form implements LazyRenderable
+{
+    use LazyWidget;
+
+
+    public function __construct($data = [], $key = null)
+    {
+        parent::__construct($data, $key);
+    }
+
+    public function handle(array $input)
+    {
+        $user = User::query()->find($input['id']);
+        if(!$user){
+
+            return $this->response()->error('请刷新后重试');
+        }
+        if($input['mobile']!=$user->mobile && User::query()->where('mobile',$input['mobile'])->first()){
+            return $this->response()->error('该手机号码已被使用');
+        }else{
+            $user->mobile = $input['mobile'];
+        }
+        if($input['password']!=''){
+            $user->password = $input['password'];
+
+        }
+        $user->save();
+        return $this->response()->success('保存成功')->refresh();
+    }
+
+
+    public function form()
+    {
+        $user = User::query()->find($this->payload['id']);
+        $this->hidden('id')->value($this->payload['id']);
+        $this->text('mobile', '手机号')->value($user->mobile)->help('手机号,不修改则不变');
+        $this->password('password', '密码')
+            ->minLength(6)
+            ->maxLength(20)
+            ->customFormat(function ($v) {
+                if ($v == $this->password) {
+                    return;
+                }
+                return $v;
+            })
+            ->help('请输入6-20个字符,不填写则不修改');
+    }
+}

+ 122 - 0
app/Admin/Controllers/UserController.php

xqd
@@ -0,0 +1,122 @@
+<?php
+
+namespace App\Admin\Controllers;
+
+use App\Admin\Actions\Users\UserAction;
+use App\Admin\Actions\Users\UserAuth;
+use App\Admin\Actions\Users\UserChange;
+use App\Models\User;
+use Dcat\Admin\Form;
+use Dcat\Admin\Grid;
+use Dcat\Admin\Show;
+use Dcat\Admin\Http\Controllers\AdminController;
+class UserController extends AdminController
+{
+    /**
+     * Make a grid builder.
+     *
+     * @return Grid
+     */
+    protected function grid()
+    {
+        $grid = new Grid(new User());
+        $grid->model()->with(['user_info'])->orderBy('id','desc');
+        $grid->column('id')->sortable();
+        $grid->column('user_info.avatar','头像')->image("",50);
+        $grid->column('mobile','手机号');
+        $grid->column('user_info.nickname','昵称');
+
+        $grid->column('pid','上级ID');
+        $grid->column('sex','性别')->using([1=>'男',2=>'女'])->label(['','primary','danger']);
+        $grid->column('is_vip','VIP')->using(['无','VIP'])->label(['gray','warning']);
+        $grid->column('is_auth','认证状态')->using([0=>'未认证',1=>"已认证",2=>"女神认证"])->label(['gray','success','warning']);;
+        $grid->column('ycode','邀请码');
+        $grid->column('user_info.area','所在城市');
+        $grid->column('online','在线状态')->using([0=>'离线',1=>'在线'])->label(['gray','success']);
+//        $grid->column('notice_status');
+        $grid->column('like_num','他喜欢');
+        $grid->column('like_me_num','喜欢他');
+        $grid->column('look_num','看过他');
+        $grid->column('status','状态')->switch('success',true);
+        $grid->filter(function (Grid\Filter $filter) {
+            $filter->equal('id','用户ID');
+            $filter->equal('pid','上级ID');
+            $filter->like('mobile','手机号');
+            $filter->like('user_info.nickname','昵称');
+            $filter->equal('sex','性别')->select(['1'=>'男','2'=>'女']);
+            $filter->equal('is_vip','VIP')->select(['0'=>'无','1'=>'VIP']);
+            $filter->equal('is_auth','认证状态')->select(['0'=>'未认证','1'=>'已认证','2'=>'女神认证']);
+            $filter->equal('online','在线状态')->select(['0'=>'离线','1'=>'在线']);
+        });
+
+
+        //操作管理
+        $grid->actions(function (Grid\Displayers\Actions $actions) {
+
+            $actions->append(new UserAction(User::class));
+            $actions->append(new UserChange(User::class));
+            if ($actions->row->is_auth == 0) {
+                $actions->append(new UserAuth(User::class));
+            }
+        });
+
+        //批量操作
+        $grid->batchActions(function (Grid\Tools\BatchActions $batch) {
+            $batch->disableDelete();
+        });
+        return $grid;
+    }
+
+    /**
+     * Make a show builder.
+     *
+     * @param mixed $id
+     *
+     * @return Show
+     */
+    protected function detail($id)
+    {
+        return Show::make($id, new User(), function (Show $show) {
+            $show->field('id');
+            $show->field('mobile');
+            $show->field('pid');
+            $show->field('tencent_im_user_id');
+            $show->field('sex');
+            $show->field('is_vip');
+            $show->field('is_auth');
+            $show->field('ycode');
+            $show->field('city');
+            $show->field('online');
+            $show->field('notice_status');
+            $show->field('like_num');
+            $show->field('like_me_num');
+            $show->field('look_num');
+        });
+    }
+
+    /**
+     * Make a form builder.
+     *
+     * @return Form
+     */
+    protected function form()
+    {
+        return Form::make(new User(), function (Form $form) {
+            $form->display('id');
+            $form->text('mobile');
+            $form->text('pid');
+            $form->text('tencent_im_user_id');
+            $form->text('sex');
+            $form->text('is_vip');
+            $form->text('is_auth');
+            $form->text('ycode');
+            $form->text('city');
+            $form->text('online');
+            $form->text('notice_status');
+            $form->text('like_num');
+            $form->text('like_me_num');
+            $form->text('look_num');
+            $form->switch('status')->default(1);
+        });
+    }
+}

+ 111 - 0
app/Admin/Forms/AdminSetting.php

xqd
@@ -0,0 +1,111 @@
+<?php
+
+namespace App\Admin\Forms;
+
+use Dcat\Admin\Contracts\LazyRenderable;
+use Dcat\Admin\Traits\LazyWidget;
+use Dcat\Admin\Widgets\Form;
+use Illuminate\Support\Arr;
+
+class AdminSetting extends Form implements LazyRenderable
+{
+    use LazyWidget;
+
+    /**
+     * 主题颜色.
+     *
+     * @var array
+     */
+    protected $colors = [
+        'default'    => '深蓝',
+        'blue'       => '蓝',
+//        'blue-light' => '浅蓝',
+//        'blue-dark'  => '深蓝',
+        'green'      => '绿',
+    ];
+
+    /**
+     * 处理表单请求.
+     *
+     * @param array $input
+     *
+     * @return mixed
+     */
+    public function handle(array $input)
+    {
+        $input['layout']['horizontal_menu'] = in_array('horizontal_menu', $input['layout']['body_class'], true);
+
+        foreach (Arr::dot($input) as $k => $v) {
+            $this->update($k, $v);
+        }
+
+        return $this->response()->success('设置成功');
+    }
+
+    /**
+     * 构建表单.
+     */
+    public function form()
+    {
+        $this->text('name')->required()->help('网站名称');
+        $this->text('logo')->required()->help('logo设置');
+        $this->text('logo-mini', 'Logo mini')->required();
+        $this->radio('lang', '语言')->required()->options(['en' => 'English', 'zh_CN' => '简体中文']);
+        $this->radio('layout.color', '主题')
+            ->required()
+            ->help('主题颜色,支持自定义!')
+            ->options($this->colors);
+
+        $this->radio('layout.sidebar_style', '菜单样式')
+            ->options(['light' => 'Light', 'primary' => 'Primary'])
+            ->help('切换菜单栏样式');
+
+        $this->checkbox('layout.body_class', '菜单布局')
+            ->options([
+                'horizontal_menu' => '水平 (Horizontal)',
+                'sidebar-separate' => 'sidebar-separate',
+            ])
+            ->help('切换菜单布局');
+//        $this->switch('https', '启用HTTPS');
+        $this->switch('helpers.enable', '开发工具');
+    }
+
+    /**
+     * 设置接口保存成功后的回调JS代码.
+     *
+     * 1.2秒后刷新整个页面.
+     *
+     * @return string|void
+     */
+    public function savedScript()
+    {
+        return <<<'JS'
+    if (data.status) {
+        setTimeout(function () {
+          location.reload()
+        }, 1200);
+    }
+JS;
+    }
+
+    /**
+     * 返回表单数据.
+     *
+     * @return array
+     */
+    public function default()
+    {
+        return user_admin_config();
+    }
+
+    /**
+     * 更新配置.
+     *
+     * @param string $key
+     * @param string $value
+     */
+    protected function update($key, $value)
+    {
+        user_admin_config([$key => $value]);
+    }
+}

+ 46 - 0
app/Admin/bootstrap.php

xqd xqd
@@ -4,6 +4,7 @@ use Dcat\Admin\Admin;
 use Dcat\Admin\Grid;
 use Dcat\Admin\Form;
 use Dcat\Admin\Grid\Filter;
+use Dcat\Admin\Layout\Navbar;
 use Dcat\Admin\Show;
 
 /**
@@ -24,3 +25,48 @@ use Dcat\Admin\Show;
  * Admin::js('/packages/prettydocs/js/main.js');
  *
  */
+
+// 覆盖默认配置
+config(['admin' => user_admin_config()]);
+config(['app.locale' => config('admin.lang') ?: config('app.locale')]);
+
+Admin::style('.main-sidebar .nav-sidebar .nav-item>.nav-link {
+    border-radius: .1rem;
+}');
+
+
+
+// 扩展Column
+Grid\Column::extend('code', function ($v) {
+    return "<code>$v</code>";
+});
+
+Grid::resolving(function (Grid $grid) {
+    if (! request('_row_')) {
+        $grid->tableCollapse();
+
+
+//        $grid->tools(new App\Admin\Grid\Tools\SwitchGridMode());
+    }
+});
+Admin::navbar(function (Navbar $navbar) {
+    // 切换主题
+//    $navbar->right(view('admin.switch-theme', [
+//        'map' => [
+//            'indigo'    => Dcat\Admin\Admin::color()->indigo(),
+//            'blue'      => '#5686d4',
+//            'blue-dark' => '#5686d4',
+//        ],
+//    ]));
+    $method = config('admin.layout.horizontal_menu') ? 'left' : 'right';
+
+    // ajax请求不执行
+    if (! Dcat\Admin\Support\Helper::isAjaxRequest()) {
+        $navbar->$method(App\Admin\Actions\AdminSetting::make()->render());
+    }
+
+    // 下拉菜单
+    //$navbar->right(view('admin.navbar-2'));
+
+
+});

+ 1 - 1
app/Admin/routes.php

xqd
@@ -14,5 +14,5 @@ Route::group([
 
     $router->get('/', 'HomeController@index');
     $router->resource('/banner', 'BannerController');
-
+    $router->resource('/users', 'UserController');
 });

+ 34 - 0
app/Helper/function.php

xqd
@@ -1,5 +1,39 @@
 <?php
+
+use Illuminate\Support\Arr;
 use \Illuminate\Support\Facades\DB;
+
+
+if (! function_exists('user_admin_config')) {
+    function user_admin_config($key = null, $value = null)
+    {
+        $session = session();
+
+        if (! $config = $session->get('admin.config')) {
+            $config = config('admin');
+
+            $config['lang'] = config('app.locale');
+        }
+
+        if (is_array($key)) {
+            // 保存
+            foreach ($key as $k => $v) {
+                Arr::set($config, $k, $v);
+            }
+
+            $session->put('admin.config', $config);
+
+            return;
+        }
+
+        if ($key === null) {
+            return $config;
+        }
+
+        return Arr::get($config, $key, $value);
+    }
+}
+
 //生成随机码
 function create_invite_code() {
     $code = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ';

+ 1 - 1
app/Http/Controllers/Api/SmsController.php

xqd
@@ -34,6 +34,6 @@ class SmsController extends Controller
             return $this->response->errorForbidden($result['error']);
         }
 
-        return $this->response->array(['verifyKey' => $result['verifyKey']]);
+        return $this->response->array(['verifyKey' => $result['verifyKey'],'code'=>$result['code']]);
     }
 }

+ 6 - 1
app/Models/User.php

xqd xqd
@@ -20,7 +20,7 @@ class User extends Authenticatable implements JWTSubject
      * @var array
      */
     protected $fillable = [
-        'mobile', 'password', 'pid', 'tencent_im_user_id','sex','is_vip','is_auth','remember_token','ycode','latitude','longitude','online','notice_status','like_num','like_me_num','look_num'
+        'mobile', 'password', 'pid', 'tencent_im_user_id','sex','status','is_vip','is_auth','remember_token','ycode','latitude','longitude','online','notice_status','like_num','like_me_num','look_num'
     ];
 
     /**
@@ -54,4 +54,9 @@ class User extends Authenticatable implements JWTSubject
     {
         $this->attributes['password'] = bcrypt($value);
     }
+
+    public function user_info()
+    {
+        return $this->belongsTo(UserInfoModel::class,'id','user_id');
+    }
 }

+ 2 - 1
app/Services/DynamicService.php

xqd
@@ -143,13 +143,14 @@ class DynamicService
         if(!$dynamic){
             throw new Exception("动态不存在");
         }
-        $zan = 1;
+
         if($dynamic_zan = DynamicZanModel::query()->where(['user_id'=>$dynamicZanParam->user_id,'dynamic_id'=>$dynamicZanParam->dynamic_id])->first()){
             $zan = 0;
             //已点赞  取消点赞
             DynamicModel::query()->where('id',$dynamicZanParam->dynamic_id)->decrement('zan_num',1);
             $dynamic_zan->delete();
         }else{
+            $zan = 1;
             //点赞
             DynamicModel::query()->where('id',$dynamicZanParam->dynamic_id)->increment('zan_num',1);
             DynamicZanModel::query()->create([

+ 1 - 0
app/Services/SmsService.php

xqd
@@ -72,6 +72,7 @@ class SmsService
 
             return [
                 'verifyKey' => $verifyKey,
+                'code' => $smsCode,
             ];
 
         } catch (SmsException $e) {

+ 1 - 0
config/admin.php

xqd
@@ -162,6 +162,7 @@ return [
 
         // The global Grid action display class.
         'grid_action_class' => Dcat\Admin\Grid\Displayers\DropdownActions::class,
+        //'grid_action_class' => Dcat\Admin\Grid\Displayers\Actions::class,
 
         // The global Grid batch action display class.
         'batch_action_class' => Dcat\Admin\Grid\Tools\BatchActions::class,

+ 61 - 33
dcat_admin_ide_helper.php

xqd xqd xqd xqd xqd xqd xqd xqd xqd xqd xqd xqd xqd
@@ -45,6 +45,7 @@ namespace Dcat\Admin {
      * @property Grid\Column|Collection img_url
      * @property Grid\Column|Collection site
      * @property Grid\Column|Collection status
+     * @property Grid\Column|Collection sort
      * @property Grid\Column|Collection to_user_id
      * @property Grid\Column|Collection last_msg
      * @property Grid\Column|Collection last_time
@@ -90,7 +91,20 @@ namespace Dcat\Admin {
      * @property Grid\Column|Collection ycode
      * @property Grid\Column|Collection last_login_time
      * @property Grid\Column|Collection last_login_ip
+     * @property Grid\Column|Collection city
+     * @property Grid\Column|Collection latitude
+     * @property Grid\Column|Collection longitude
+     * @property Grid\Column|Collection online
+     * @property Grid\Column|Collection notice_status
+     * @property Grid\Column|Collection like_num
+     * @property Grid\Column|Collection like_me_num
+     * @property Grid\Column|Collection look_num
      * @property Grid\Column|Collection black_id
+     * @property Grid\Column|Collection comment_id
+     * @property Grid\Column|Collection con1
+     * @property Grid\Column|Collection con2
+     * @property Grid\Column|Collection con3
+     * @property Grid\Column|Collection con4
      * @property Grid\Column|Collection figure
      * @property Grid\Column|Collection feeling
      * @property Grid\Column|Collection education
@@ -107,17 +121,10 @@ namespace Dcat\Admin {
      * @property Grid\Column|Collection info
      * @property Grid\Column|Collection area
      * @property Grid\Column|Collection area_code
+     * @property Grid\Column|Collection weixin
      * @property Grid\Column|Collection like_id
      * @property Grid\Column|Collection look_id
      * @property Grid\Column|Collection report_id
-     * @property Grid\Column|Collection city
-     * @property Grid\Column|Collection latitude
-     * @property Grid\Column|Collection longitude
-     * @property Grid\Column|Collection online
-     * @property Grid\Column|Collection notice_status
-     * @property Grid\Column|Collection like_num
-     * @property Grid\Column|Collection like_me_num
-     * @property Grid\Column|Collection look_num
      * @property Grid\Column|Collection day
      * @property Grid\Column|Collection end_day
      * @property Grid\Column|Collection day_price
@@ -157,6 +164,7 @@ namespace Dcat\Admin {
      * @method Grid\Column|Collection img_url(string $label = null)
      * @method Grid\Column|Collection site(string $label = null)
      * @method Grid\Column|Collection status(string $label = null)
+     * @method Grid\Column|Collection sort(string $label = null)
      * @method Grid\Column|Collection to_user_id(string $label = null)
      * @method Grid\Column|Collection last_msg(string $label = null)
      * @method Grid\Column|Collection last_time(string $label = null)
@@ -202,7 +210,20 @@ namespace Dcat\Admin {
      * @method Grid\Column|Collection ycode(string $label = null)
      * @method Grid\Column|Collection last_login_time(string $label = null)
      * @method Grid\Column|Collection last_login_ip(string $label = null)
+     * @method Grid\Column|Collection city(string $label = null)
+     * @method Grid\Column|Collection latitude(string $label = null)
+     * @method Grid\Column|Collection longitude(string $label = null)
+     * @method Grid\Column|Collection online(string $label = null)
+     * @method Grid\Column|Collection notice_status(string $label = null)
+     * @method Grid\Column|Collection like_num(string $label = null)
+     * @method Grid\Column|Collection like_me_num(string $label = null)
+     * @method Grid\Column|Collection look_num(string $label = null)
      * @method Grid\Column|Collection black_id(string $label = null)
+     * @method Grid\Column|Collection comment_id(string $label = null)
+     * @method Grid\Column|Collection con1(string $label = null)
+     * @method Grid\Column|Collection con2(string $label = null)
+     * @method Grid\Column|Collection con3(string $label = null)
+     * @method Grid\Column|Collection con4(string $label = null)
      * @method Grid\Column|Collection figure(string $label = null)
      * @method Grid\Column|Collection feeling(string $label = null)
      * @method Grid\Column|Collection education(string $label = null)
@@ -219,17 +240,10 @@ namespace Dcat\Admin {
      * @method Grid\Column|Collection info(string $label = null)
      * @method Grid\Column|Collection area(string $label = null)
      * @method Grid\Column|Collection area_code(string $label = null)
+     * @method Grid\Column|Collection weixin(string $label = null)
      * @method Grid\Column|Collection like_id(string $label = null)
      * @method Grid\Column|Collection look_id(string $label = null)
      * @method Grid\Column|Collection report_id(string $label = null)
-     * @method Grid\Column|Collection city(string $label = null)
-     * @method Grid\Column|Collection latitude(string $label = null)
-     * @method Grid\Column|Collection longitude(string $label = null)
-     * @method Grid\Column|Collection online(string $label = null)
-     * @method Grid\Column|Collection notice_status(string $label = null)
-     * @method Grid\Column|Collection like_num(string $label = null)
-     * @method Grid\Column|Collection like_me_num(string $label = null)
-     * @method Grid\Column|Collection look_num(string $label = null)
      * @method Grid\Column|Collection day(string $label = null)
      * @method Grid\Column|Collection end_day(string $label = null)
      * @method Grid\Column|Collection day_price(string $label = null)
@@ -274,6 +288,7 @@ namespace Dcat\Admin {
      * @property Show\Field|Collection img_url
      * @property Show\Field|Collection site
      * @property Show\Field|Collection status
+     * @property Show\Field|Collection sort
      * @property Show\Field|Collection to_user_id
      * @property Show\Field|Collection last_msg
      * @property Show\Field|Collection last_time
@@ -319,7 +334,20 @@ namespace Dcat\Admin {
      * @property Show\Field|Collection ycode
      * @property Show\Field|Collection last_login_time
      * @property Show\Field|Collection last_login_ip
+     * @property Show\Field|Collection city
+     * @property Show\Field|Collection latitude
+     * @property Show\Field|Collection longitude
+     * @property Show\Field|Collection online
+     * @property Show\Field|Collection notice_status
+     * @property Show\Field|Collection like_num
+     * @property Show\Field|Collection like_me_num
+     * @property Show\Field|Collection look_num
      * @property Show\Field|Collection black_id
+     * @property Show\Field|Collection comment_id
+     * @property Show\Field|Collection con1
+     * @property Show\Field|Collection con2
+     * @property Show\Field|Collection con3
+     * @property Show\Field|Collection con4
      * @property Show\Field|Collection figure
      * @property Show\Field|Collection feeling
      * @property Show\Field|Collection education
@@ -336,17 +364,10 @@ namespace Dcat\Admin {
      * @property Show\Field|Collection info
      * @property Show\Field|Collection area
      * @property Show\Field|Collection area_code
+     * @property Show\Field|Collection weixin
      * @property Show\Field|Collection like_id
      * @property Show\Field|Collection look_id
      * @property Show\Field|Collection report_id
-     * @property Show\Field|Collection city
-     * @property Show\Field|Collection latitude
-     * @property Show\Field|Collection longitude
-     * @property Show\Field|Collection online
-     * @property Show\Field|Collection notice_status
-     * @property Show\Field|Collection like_num
-     * @property Show\Field|Collection like_me_num
-     * @property Show\Field|Collection look_num
      * @property Show\Field|Collection day
      * @property Show\Field|Collection end_day
      * @property Show\Field|Collection day_price
@@ -386,6 +407,7 @@ namespace Dcat\Admin {
      * @method Show\Field|Collection img_url(string $label = null)
      * @method Show\Field|Collection site(string $label = null)
      * @method Show\Field|Collection status(string $label = null)
+     * @method Show\Field|Collection sort(string $label = null)
      * @method Show\Field|Collection to_user_id(string $label = null)
      * @method Show\Field|Collection last_msg(string $label = null)
      * @method Show\Field|Collection last_time(string $label = null)
@@ -431,7 +453,20 @@ namespace Dcat\Admin {
      * @method Show\Field|Collection ycode(string $label = null)
      * @method Show\Field|Collection last_login_time(string $label = null)
      * @method Show\Field|Collection last_login_ip(string $label = null)
+     * @method Show\Field|Collection city(string $label = null)
+     * @method Show\Field|Collection latitude(string $label = null)
+     * @method Show\Field|Collection longitude(string $label = null)
+     * @method Show\Field|Collection online(string $label = null)
+     * @method Show\Field|Collection notice_status(string $label = null)
+     * @method Show\Field|Collection like_num(string $label = null)
+     * @method Show\Field|Collection like_me_num(string $label = null)
+     * @method Show\Field|Collection look_num(string $label = null)
      * @method Show\Field|Collection black_id(string $label = null)
+     * @method Show\Field|Collection comment_id(string $label = null)
+     * @method Show\Field|Collection con1(string $label = null)
+     * @method Show\Field|Collection con2(string $label = null)
+     * @method Show\Field|Collection con3(string $label = null)
+     * @method Show\Field|Collection con4(string $label = null)
      * @method Show\Field|Collection figure(string $label = null)
      * @method Show\Field|Collection feeling(string $label = null)
      * @method Show\Field|Collection education(string $label = null)
@@ -448,17 +483,10 @@ namespace Dcat\Admin {
      * @method Show\Field|Collection info(string $label = null)
      * @method Show\Field|Collection area(string $label = null)
      * @method Show\Field|Collection area_code(string $label = null)
+     * @method Show\Field|Collection weixin(string $label = null)
      * @method Show\Field|Collection like_id(string $label = null)
      * @method Show\Field|Collection look_id(string $label = null)
      * @method Show\Field|Collection report_id(string $label = null)
-     * @method Show\Field|Collection city(string $label = null)
-     * @method Show\Field|Collection latitude(string $label = null)
-     * @method Show\Field|Collection longitude(string $label = null)
-     * @method Show\Field|Collection online(string $label = null)
-     * @method Show\Field|Collection notice_status(string $label = null)
-     * @method Show\Field|Collection like_num(string $label = null)
-     * @method Show\Field|Collection like_me_num(string $label = null)
-     * @method Show\Field|Collection look_num(string $label = null)
      * @method Show\Field|Collection day(string $label = null)
      * @method Show\Field|Collection end_day(string $label = null)
      * @method Show\Field|Collection day_price(string $label = null)
@@ -475,7 +503,7 @@ namespace Dcat\Admin {
 
 namespace Dcat\Admin\Grid {
     /**
-     
+     * @method $this code(...$params)
      */
     class Column {}
 

+ 85 - 0
resources/views/admin/grid/custom.blade.php

xqd
@@ -0,0 +1,85 @@
+<style>
+    .mailbox-attachment-icon {
+        max-height: none;
+    }
+    .mailbox-attachment-info {
+        background: #fff;
+    }
+    .mailbox-attachments .img-thumbnail {
+        border: 1px solid #fff;
+        border-radius: 0;
+        background-color: #fff;
+    }
+    .mailbox-attachment-icon.has-img>img {
+        max-width: 100%!important;
+        /*height: 180px!important;*/
+    }
+    .mailbox-attachment-info .item {
+        margin-bottom: 6px;
+    }
+    .mailbox-attachments li {
+        box-shadow: 0 2px 4px 0 rgba(0,0,0,.08);
+        border: 0;
+        background: #fff;
+    }
+
+    body.dark-mode .table {
+        background-color: #2c2c43;
+    }
+    body.dark-mode .mailbox-attachments .img-thumbnail {
+        border-color: #223;
+        background-color: #223;
+    }
+    body.dark-mode .mailbox-attachment-info {
+        background: #223;
+    }
+    body.dark-mode .mailbox-attachments li {
+        border-color: #223;
+        background-color: #223;
+    }
+    body.dark-mode .mailbox-attachment-name {
+        color: #a8a9bb
+    }
+</style>
+
+
+<div class="dcat-box custom-data-table dt-bootstrap4">
+
+    @include('admin::grid.table-toolbar')
+
+    {!! $grid->renderFilter() !!}
+
+    {!! $grid->renderHeader() !!}
+
+    <div class="table-responsive table-wrapper mt-1">
+        <ul class="mailbox-attachments clearfix {{ $grid->formatTableClass() }} p-0"  id="{{ $tableId }}">
+            @foreach($grid->rows() as $row)
+                <li>
+                    <span class="mailbox-attachment-icon has-img">
+                        {!! $row->column('url') !!}
+                    </span>
+                    <div class="mailbox-attachment-info">
+                        <div class="d-flex justify-content-between item">
+                            <span class="mailbox-attachment-name">{!! $grid->columns()->get('id')->getLabel() !!}</span> {!! $row->column('id') !!}
+                        </div>
+
+
+                        <div class="d-flex justify-content-between item">
+                            <span class="mailbox-attachment-name">{!! $grid->columns()->get('name')->getLabel() !!}</span> {!! $row->column('name') !!}
+                        </div>
+
+                        <span class="d-flex justify-content-between" style="margin-top: 5px">
+                            {!! $row->column(Dcat\Admin\Grid\Column::SELECT_COLUMN_NAME) !!}
+                            <div>{!! $row->column(Dcat\Admin\Grid\Column::ACTION_COLUMN_NAME) !!}</div>
+                        </span>
+                    </div>
+                </li>
+            @endforeach
+        </ul>
+    </div>
+
+    {!! $grid->renderFooter() !!}
+
+    @include('admin::grid.table-pagination')
+
+</div>

+ 253 - 0
resources/views/admin/login.blade.php

xqd
@@ -0,0 +1,253 @@
+<style>
+    .row {
+        margin: 0;
+    }
+    .col-md-12,
+    .col-md-3 {
+        padding: 0;
+    }
+    @media screen and (min-width: 1000px) and (max-width: 1150px) {
+        .col-lg-3,
+        .col-lg-9 {
+            flex: 0 0 50%;
+            max-width: 50%;
+        }
+    }
+    @media screen and (min-width: 1151px) and (max-width: 1300px) {
+        .col-lg-3 {
+            flex: 0 0 40%;
+            max-width: 40%;
+        }
+        .col-lg-9 {
+            flex: 0 0 60%;
+            max-width: 60%;
+        }
+    }
+    @media screen and (min-width: 1301px) and (max-width: 1700px) {
+        .col-lg-3 {
+            flex: 0 0 35%;
+            max-width: 35%;
+        }
+        .col-lg-9 {
+            flex: 0 0 65%;
+            max-width: 65%;
+        }
+    }
+
+    .login-page {
+        height: auto;
+    }
+    .login-main {
+        position: relative;
+        display: flex;
+        min-height: 100vh;
+        flex-direction: row;
+        align-items: stretch;
+        margin: 0;
+    }
+
+    .login-main .login-page {
+        background-color: #fff;
+    }
+
+    .login-main .card {
+        box-shadow: none;
+    }
+
+    .login-main .auth-brand {
+        margin: 4rem 0 4rem;
+        font-size: 26px;
+        width: 325px;
+    }
+
+    @media (max-width: 576px) {
+        .login-main .auth-brand {
+            width: 90%;
+            margin-left: 24px
+        }
+    }
+
+    .login-main .login-logo {
+        font-size: 2.1rem;
+        font-weight: 300;
+        margin-bottom: 0.9rem;
+        text-align: left;
+        margin-left: 20px;
+    }
+
+    .login-main .login-box-msg {
+        margin: 0;
+        padding: 0 0 20px;
+        font-size: 0.9rem;
+        font-weight: 400;
+        text-align: left;
+    }
+
+    .login-main .btn {
+        width: 100%;
+    }
+
+    .login-page-right {
+        padding: 6rem 3rem;
+        flex: 1;
+        position: relative;
+        color: #fff;
+        background-color: rgba(0, 0, 0, 0.3);
+        text-align: center !important;
+        background: url(/vendor/dcat-admin/images/pages/login/bg.jpg) center;
+        background-size: cover;
+    }
+
+    .login-description {
+        position: absolute;
+        margin: 0 auto;
+        padding: 0 1.75rem;
+        bottom: 3rem;
+        left: 0;
+        right: 0;
+    }
+
+    .content-front {
+        position: absolute;
+        left: 0;
+        right: 0;
+        height: 100vh;
+        background: rgba(0,0,0,.1);
+        margin-top: -6rem;
+    }
+
+    body.dark-mode .content-front {
+        background: rgba(0,0,0,.3);
+    }
+
+    body.dark-mode .auth-brand {
+        color: #cacbd6
+    }
+</style>
+
+<div class="row login-main">
+    <div class="col-lg-3 col-12 bg-white">
+        <div class="login-page">
+            <div class="auth-brand text-lg-left">
+                {!! config('admin.logo') !!}
+            </div>
+
+            <div class="login-box">
+                <div class="login-logo mb-2">
+                    <h4 class="mt-0">让后台开发更简单</h4>
+                    <p class="login-box-msg mt-1 mb-1">{{ __('admin.welcome_back') }}</p>
+                </div>
+                <div class="card">
+                    <div class="card-body login-card-body">
+
+                        <form id="login-form" method="POST" action="{{ admin_url('auth/login') }}">
+
+                            <input type="hidden" name="_token" value="{{ csrf_token() }}"/>
+
+                            <fieldset class="form-label-group form-group position-relative has-icon-left">
+                                <input
+                                        type="text"
+                                        class="form-control {{ $errors->has('username') ? 'is-invalid' : '' }}"
+                                        name="username"
+                                        placeholder="{{ trans('admin.username') }}"
+                                        value="admin"
+                                        required
+                                        autofocus
+                                >
+
+                                <div class="form-control-position">
+                                    <i class="feather icon-user"></i>
+                                </div>
+
+                                <label for="email">{{ trans('admin.username') }}</label>
+
+                                <div class="help-block with-errors"></div>
+                                @if($errors->has('username'))
+                                    <span class="invalid-feedback text-danger" role="alert">
+                                                    @foreach($errors->get('username') as $message)
+                                            <span class="control-label" for="inputError"><i class="feather icon-x-circle"></i> {{$message}}</span><br>
+                                        @endforeach
+                                                </span>
+                                @endif
+                            </fieldset>
+
+                            <fieldset class="form-label-group form-group position-relative has-icon-left">
+                                <input
+                                        minlength="5"
+                                        maxlength="20"
+                                        id="password"
+                                        type="password"
+                                        class="form-control {{ $errors->has('password') ? 'is-invalid' : '' }}"
+                                        name="password"
+                                        placeholder="{{ trans('admin.password') }}"
+                                        required
+                                        value="admin"
+                                        autocomplete="current-password"
+                                >
+
+                                <div class="form-control-position">
+                                    <i class="feather icon-lock"></i>
+                                </div>
+                                <label for="password">{{ trans('admin.password') }}</label>
+
+                                <div class="help-block with-errors"></div>
+                                @if($errors->has('password'))
+                                    <span class="invalid-feedback text-danger" role="alert">
+                                                    @foreach($errors->get('password') as $message)
+                                            <span class="control-label" for="inputError"><i class="feather icon-x-circle"></i> {{$message}}</span><br>
+                                        @endforeach
+                                                    </span>
+                                @endif
+
+                            </fieldset>
+                            <div class="form-group d-flex justify-content-between align-items-center">
+                                <div class="text-left">
+                                    <fieldset class="checkbox">
+                                        <div class="vs-checkbox-con vs-checkbox-primary">
+                                            <input id="remember" name="remember"  value="1" type="checkbox" {{ old('remember') ? 'checked' : '' }}>
+                                            <span class="vs-checkbox">
+                                                                <span class="vs-checkbox--check">
+                                                                  <i class="vs-icon feather icon-check"></i>
+                                                                </span>
+                                                            </span>
+                                            <span> {{ trans('admin.remember_me') }}</span>
+                                        </div>
+                                    </fieldset>
+                                </div>
+                            </div>
+                            <button type="submit" class="btn btn-primary float-right login-btn">
+
+                                {{ __('admin.login') }}
+                                &nbsp;
+                                <i class="feather icon-arrow-right"></i>
+                            </button>
+                        </form>
+
+                    </div>
+                </div>
+            </div>
+        </div>
+
+    </div>
+    <div class="col-lg-9 col-12 login-page-right">
+        <div class="content-front"></div>
+        <div class="login-description">
+            <p class="lead">
+                十分钟内构建一个功能完善的高颜值后台系统。
+            </p>
+            <p>
+                Dcat Admin
+            </p>
+        </div>
+    </div>
+</div>
+
+
+<script>
+    Dcat.ready(function () {
+        // ajax表单提交
+        $('#login-form').form({
+            validate: true,
+        });
+    });
+</script>

+ 47 - 0
resources/views/admin/navbar-1.blade.php

xqd
@@ -0,0 +1,47 @@
+<ul class="nav navbar-nav">
+    <li class="dropdown dropdown-notification nav-item">
+        <a class="nav-link nav-link-label" href="#" data-toggle="dropdown" aria-expanded="true"><i class="ficon feather icon-bell"></i><span class="badge badge-pill badge-primary badge-up">5</span></a>
+        <ul class="dropdown-menu dropdown-menu-media dropdown-menu-right ">
+            <li class="dropdown-menu-header">
+                <div class="dropdown-header m-0 p-2">
+                    <h3 class="white">5 New</h3><span class="grey darken-2">App Notifications</span>
+                </div>
+            </li>
+            <li class="scrollable-container media-list ps ps--active-y">
+                <a class="d-flex justify-content-between" href="javascript:void(0)">
+                    <div class="media d-flex align-items-start">
+                        <div class="media-left"><i class="feather icon-plus-square font-medium-5 primary"></i></div>
+                        <div class="media-body">
+                            <h6 class="primary media-heading">You have new order!</h6><small class="notification-text"> Are
+                                your going to meet me
+                                tonight?</small>
+                        </div><small>
+                            <time class="media-meta" datetime="2015-06-11T18:29:20+08:00">9 hours
+                                ago</time></small>
+                    </div>
+                </a><a class="d-flex justify-content-between" href="javascript:void(0)">
+                    <div class="media d-flex align-items-start">
+                        <div class="media-left"><i class="feather icon-download-cloud font-medium-5 success"></i></div>
+                        <div class="media-body">
+                            <h6 class="success media-heading red darken-1">99% Server load</h6>
+                            <small class="notification-text">You got new order of goods.</small>
+                        </div><small>
+                            <time class="media-meta" datetime="2015-06-11T18:29:20+08:00">5 hour
+                                ago</time></small>
+                    </div>
+                </a><a class="d-flex justify-content-between" href="javascript:void(0)">
+                    <div class="media d-flex align-items-start">
+                        <div class="media-left"><i class="feather icon-alert-triangle font-medium-5 danger"></i></div>
+                        <div class="media-body">
+                            <h6 class="danger media-heading yellow darken-3">Warning notifixation
+                            </h6><small class="notification-text">Server have 99% CPU usage.</small>
+                        </div><small>
+                            <time class="media-meta" datetime="2015-06-11T18:29:20+08:00">Today</time></small>
+                    </div>
+                </a>
+                <div class="ps__rail-x" style="left: 0px; bottom: 0px;"><div class="ps__thumb-x" tabindex="0" style="left: 0px; width: 0px;"></div></div><div class="ps__rail-y" style="top: 0px; right: 0px; height: 254px;"><div class="ps__thumb-y" tabindex="0" style="top: 0px; height: 184px;"></div></div></li>
+            <li class="dropdown-menu-footer"><a class="dropdown-item p-1 text-center" href="javascript:void(0)">Read
+                    all notifications</a></li>
+        </ul>
+    </li>
+</ul>

+ 19 - 0
resources/views/admin/navbar-2.blade.php

xqd
@@ -0,0 +1,19 @@
+<ul class="nav navbar-nav">
+    <li class="dropdown dropdown-language nav-item">
+        <a class="dropdown-toggle nav-link" href="#" id="dropdown-flag" data-toggle="dropdown">
+            <i class="flag-icon flag-icon-us"></i>
+            <span class="selected-language">English</span>
+        </a>
+        <ul class="dropdown-menu" aria-labelledby="dropdown-flag">
+            <li class="dropdown-item" href="#" data-language="en">
+                <a><i class="flag-icon flag-icon-us"></i> English</a>
+            </li>
+            <li class="dropdown-item" href="#" data-language="fr">
+                <a><i class="flag-icon flag-icon-fr"></i> French</a>
+            </li>
+            <lia class="dropdown-item" href="#" data-language="de">
+                <a><i class="flag-icon flag-icon-de"></i>  German</a>
+            </lia>
+        </ul>
+    </li>
+</ul>

+ 51 - 0
resources/views/admin/switch-theme.blade.php

xqd
@@ -0,0 +1,51 @@
+<style>
+    .color-block {
+        width: 100px;
+        height: 20px;
+        background: #5c6bc6;
+        display: inline-block;
+        border-radius: .1rem;
+        color: white;
+        font-size: 13px;
+        text-align: center;
+        line-height: 20px;
+    }
+    .block-sm {
+        width: 40px;
+    }
+</style>
+<ul class="nav navbar-nav">
+    <li class="dropdown dropdown-language nav-item">
+        <a class="dropdown-toggle nav-link" href="#" id="dropdown-color" data-toggle="dropdown">
+            <span class="color-block" style="background: {{ $map[request()->get('_color_')] ?? \Dcat\Admin\Admin::color()->indigo() }}">
+                主题
+            </span>
+        </a>
+        <ul class="dropdown-menu" aria-labelledby="dropdown-color">
+            <li class="dropdown-item" href="#" data-language="en">
+                <a class="switch-color" data-value="indigo">
+                    <span class="color-block" style="background: {{ \Dcat\Admin\Admin::color()->indigo() }}">indigo</span>
+                    </a>
+            </li>
+            <li class="dropdown-item" href="#" data-language="fr">
+                <a class="switch-color" data-value="blue">
+                    <span class="color-block" style="background: #5686d4">blue</span>
+                    </a>
+            </li>
+            <lia class="dropdown-item" href="#" data-language="de">
+                <a class="switch-color" data-value="blue-dark">
+                    <span class="color-block" style="background: #5686d4">
+                         blue-dark
+                    </span>
+                   </a>
+            </lia>
+        </ul>
+    </li>
+</ul>
+<script>
+Dcat.ready(function () {
+    $('.switch-color').click(function (e) {
+        window.location.href = '{{ admin_url('/') }}?_color_='+$(this).data('value');
+    })
+});
+</script>