diff --git a/vendor/antgoods/goods/src/controllers/GoodsController.php b/vendor/antgoods/goods/src/controllers/GoodsController.php index eaca006..f405a98 100644 --- a/vendor/antgoods/goods/src/controllers/GoodsController.php +++ b/vendor/antgoods/goods/src/controllers/GoodsController.php @@ -82,7 +82,7 @@ class GoodsController extends Controller { $model = new Goods(); - if ($model->load(Yii::$app->request->post())) { + if ($model->load(Yii::$app->request->post()) && $model->validate()) { //商品封面图和商品详情图上传保存处理 $cover_image_id_str = $model->coverImageId; @@ -121,7 +121,7 @@ class GoodsController extends Controller $cover_image_old_id_arr = $model->image; $detail_image_old_id_arr = $model->detailImageId; - if ($model->load(Yii::$app->request->post())) { + if ($model->load(Yii::$app->request->post()) && $model->validate()) { //商品封面图和商品详情图上传保存处理 $cover_image_id_str = $model->coverImageId; diff --git a/vendor/antgoods/goods/src/views/goods/create.php b/vendor/antgoods/goods/src/views/goods/create.php index 4e98c8d..6736a1b 100644 --- a/vendor/antgoods/goods/src/views/goods/create.php +++ b/vendor/antgoods/goods/src/views/goods/create.php @@ -13,29 +13,13 @@ $this->params['breadcrumbs'][] = $this->title; Yii::$app->params['bsVersion'] = '4.x'; ?>
+
- true, - 'position' => TabsX::POS_ABOVE, - 'encodeLabels' => false, - ]); - + render('_form', [ + 'model' => $model, + ]) ?> -
- 'btn btn-success']) ?> - 'btn btn-info']) ?>
- - - - render('_form', [ -// 'model' => $model, -// ]) - ?> -
diff --git a/vendor/antgoods/goods/src/views/goods/picture.php b/vendor/antgoods/goods/src/views/goods/picture.php new file mode 100644 index 0000000..d176fc5 --- /dev/null +++ b/vendor/antgoods/goods/src/views/goods/picture.php @@ -0,0 +1,41 @@ + +field($model, 'coverImageId')->hiddenInput()->label('') ?> +field($model, 'coverImagePath')->widget(\iron\widgets\Upload::className(), [ + 'url' => 'upload', + 'deleteUrl' => 'img-id-del', + 'dragdropWidth'=> 800, + 'afterSave' => 'save-file', + 'maxCount' => 1, + 'fillInAttribute' => 'coverImageId', + 'model' => $model, + 'previewConfig' => [ + 'url' => Url::to(['image-file', 'fileidstr' => $model->coverImageId]), + ], +])->label('商品封面图') ?> + +field($model, 'detailImageId')->hiddenInput()->label('') ?> +field($model, 'detailImagePath')->widget(\iron\widgets\Upload::className(), [ + 'url' => 'upload', + 'deleteUrl' => 'img-id-del', + 'dragdropWidth'=> 800, + 'afterSave' => 'save-file', + 'maxCount' => 5, + 'fillInAttribute' => 'detailImageId', + 'model' => $model, + 'previewConfig' => [ + 'url' => Url::to(['image-file', 'fileidstr' => $model->detailImageId]), + ], +])->label('商品详情图') ?>