调整后台文章媒体管理
parent
bf21a2ca41
commit
a017e932ba
|
|
@ -142,9 +142,9 @@ class ArticleController extends AdminController
|
||||||
}
|
}
|
||||||
return $v;
|
return $v;
|
||||||
});
|
});
|
||||||
})->when([2, 3], function (Form $form) {
|
})->when(2, function (Form $form) {
|
||||||
$form->file('media_content2')->chunked()
|
$form->file('media_content2')->chunked()
|
||||||
->accept('mp4', 'mp4/*', 'mp3', 'mp3/*')
|
->accept('mp3', 'mp3/*')
|
||||||
->move('articles/media/'.Carbon::now()->toDateString())
|
->move('articles/media/'.Carbon::now()->toDateString())
|
||||||
->saveFullUrl()
|
->saveFullUrl()
|
||||||
->removable(false)
|
->removable(false)
|
||||||
|
|
@ -154,6 +154,18 @@ class ArticleController extends AdminController
|
||||||
}
|
}
|
||||||
return $v;
|
return $v;
|
||||||
});
|
});
|
||||||
|
})->when(3, function (Form $form) {
|
||||||
|
$form->file('media_content3')->chunked()
|
||||||
|
->accept('mp4', 'mp4/*')
|
||||||
|
->move('articles/media/'.Carbon::now()->toDateString())
|
||||||
|
->saveFullUrl()
|
||||||
|
->removable(false)
|
||||||
|
->autoUpload()->autoSave(false)->customFormat(function ($v) {
|
||||||
|
if ($this->model()->media_type == 3) {
|
||||||
|
$v = json_decode($this->model()->media_content, true)[0];
|
||||||
|
}
|
||||||
|
return $v;
|
||||||
|
});
|
||||||
})
|
})
|
||||||
->options([
|
->options([
|
||||||
'0'=>'无', '1'=>'轮播图', '2'=>'音频', '3'=>'视频',
|
'0'=>'无', '1'=>'轮播图', '2'=>'音频', '3'=>'视频',
|
||||||
|
|
@ -181,7 +193,7 @@ class ArticleController extends AdminController
|
||||||
$form->media_content = json_encode([$form->media_content2]);
|
$form->media_content = json_encode([$form->media_content2]);
|
||||||
break;
|
break;
|
||||||
case 3:
|
case 3:
|
||||||
$form->media_content = json_encode([$form->media_content2]);
|
$form->media_content = json_encode([$form->media_content3]);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
$form->media_content = null;
|
$form->media_content = null;
|
||||||
|
|
@ -189,6 +201,7 @@ class ArticleController extends AdminController
|
||||||
}
|
}
|
||||||
$form->deleteInput('media_content1');
|
$form->deleteInput('media_content1');
|
||||||
$form->deleteInput('media_content2');
|
$form->deleteInput('media_content2');
|
||||||
|
$form->deleteInput('media_content3');
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -24,7 +24,8 @@ return [
|
||||||
'likes' => '点赞',
|
'likes' => '点赞',
|
||||||
'media_type'=>'媒体类型',
|
'media_type'=>'媒体类型',
|
||||||
'media_content1'=>'轮播图',
|
'media_content1'=>'轮播图',
|
||||||
'media_content2'=>'音视频文件',
|
'media_content2'=>'音频文件',
|
||||||
|
'media_content3'=>'视频文件',
|
||||||
],
|
],
|
||||||
'options' => [
|
'options' => [
|
||||||
],
|
],
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue