12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152 |
- <?php
- namespace App\Distributor\Forms;
- use App\Distributor\Repositories\DistProductCategory;
- use App\Distributor\Repositories\RpcAlbum;
- use App\Libraries\CommonHelper;
- use App\Models\DistProduct;
- use App\Models\DistProductImage;
- use Dcat\Admin\Widgets\Form;
- class SmmAddAccount extends Form
- {
- public function handle(array $input)
- {
- // 处理表单提交逻辑
- $mediaName = $input['media_name'];
- if ($mediaName) {
- //跳转到媒体受权页面
- $url = CommonHelper::albumUrl($mediaName);
- // 返回 JS 代码触发新窗口打开
- return $this->response()->script(
- "window.open('{$url}', '_blank')"
- );
- } 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 [];
- }
- }
|