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(' 更多资料'); } protected function table($user_id) { $userInfo = UserInfoModel::query()->find($user_id); if(!$userInfo){ return ; } $photoDiv = ""; if(isset($userInfo->photo)&&!empty($userInfo->photo)){ $photo = json_decode($userInfo->photo,true); $photoDiv = "
"; if(is_array($photo)&&count($photo)>0){ foreach ($photo as $v){ $photoDiv.= ""; } } $photoDiv .= "
"; } $videoDiv = ""; if(isset($userInfo->video)&&!empty($userInfo->video)){ $video = json_decode($userInfo->video,true); $videoDiv = "
"; if(is_array($video)&&count($video)>0){ foreach ($video as $v){ if(isset($v['url'])){ $videoDiv .= ""; } } } $videoDiv .= "
"; } Admin::style('.table td{padding: .85rem .55rem}'); Admin::script(<<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); } }