login(); if ($result['status']) { // 返回 JS 代码触发新窗口打开 $url = $result['data']['url']; return $this->response()->script( "window.open('{$url}', '_blank')" ); } return $this ->response() ->error('获取授权失败,请检查媒体名称是否正确!'); } else { return $this ->response() ->error('媒体名称不能为空'); } } /** * Build a form here. */ public function form() { // 设置隐藏表单,传递用户id $this->select('media_name') ->options(config('dictionary.media_list')) ->required(); } /** * The data of the form. * * @return array */ public function default() { return []; } }