Browse Source

修复上传插件因样式问题导致上传插件之后的内容不显示问题

wechat_public_accounts
linyaostalker 5 years ago
parent
commit
1d28245757
  1. 10
      vendor/antgoods/goods/src/controllers/GoodsController.php
  2. 12
      vendor/antgoods/goods/src/views/goods/_form.php
  3. 22
      vendor/iron/widgets/Upload.php

10
vendor/antgoods/goods/src/controllers/GoodsController.php

@ -29,6 +29,16 @@ class GoodsController extends Controller
]; ];
} }
public function actions()
{
return [
'upload' => [
'class' => 'iron\actions\UploadAction',
'path' => 'xls/'
]
];
}
/** /**
* Lists all Goods models. * Lists all Goods models.
* @return mixed * @return mixed

12
vendor/antgoods/goods/src/views/goods/_form.php

@ -16,6 +16,12 @@ use antgoods\goods\models\ars\Supplier;
<?php $form = ActiveForm::begin(); ?> <?php $form = ActiveForm::begin(); ?>
<?= $form->field($model, 'image')->widget(\iron\widgets\Upload::className(), [
'url' => 'upload',
'deleteUrl' => 'imageDel',
'dragdropWidth'=> 800
]) ?>
<?= $form->field($model, 'cat_id')->dropDownList(Category::modelColumn(), ['prompt' => '请选择']) ?> <?= $form->field($model, 'cat_id')->dropDownList(Category::modelColumn(), ['prompt' => '请选择']) ?>
<?= $form->field($model, 'brand_id')->dropDownList(Brand::modelColumn(), ['prompt' => '请选择']) ?> <?= $form->field($model, 'brand_id')->dropDownList(Brand::modelColumn(), ['prompt' => '请选择']) ?>
@ -56,12 +62,6 @@ use antgoods\goods\models\ars\Supplier;
<?= $form->field($model, 'description')->textarea(['rows' => 6]) ?> <?= $form->field($model, 'description')->textarea(['rows' => 6]) ?>
<?= $form->field($model, 'image')->widget(\iron\widgets\Upload::className(), [
'url' => 'upload',
'deleteUrl' => 'imageDel',
'dragdropWidth'=> 800
]) ?>
<?= $form->field($model, 'model_id')->textInput() ?> <?= $form->field($model, 'model_id')->textInput() ?>
<?= $form->field($model, 'is_sale')->radioList($model::$isSale) ?> <?= $form->field($model, 'is_sale')->radioList($model::$isSale) ?>

22
vendor/iron/widgets/Upload.php

@ -201,15 +201,17 @@ SCRIPT;
*/ */
protected function renderUploadHtml() protected function renderUploadHtml()
{ {
return '<div id="upload-file">
<div class="ajax-upload-dragdrop" style="vertical-align: top; width: 600px;">
<div class="ajax-file-upload" style="position: relative; overflow: hidden; cursor: default;">Upload
<form method="POST" action="upload.php" enctype="multipart/form-data" style="margin: 0px; padding: 0px;">
<input type="file" id="ajax-upload-id-1573635462220" name="myfile[]" accept="*" multiple="" style="position: absolute; cursor: pointer; top: 0px; width: 100%; height: 100%; left: 0px; z-index: 100; opacity: 0;">
</form>
</div>
<span><b>Drag &amp; Drop Files</b></span>
</div>
<div>';
return '<div class="box-body">
<div id="upload-file">
<div class="ajax-upload-dragdrop" style="vertical-align: top; width: 600px;">
<div class="ajax-file-upload" style="position: relative; overflow: hidden; cursor: default;">Upload
<form method="POST" action="upload.php" enctype="multipart/form-data" style="margin: 0px; padding: 0px;">
<input type="file" id="ajax-upload-id-1573635462220" name="myfile[]" accept="*" multiple="" style="position: absolute; cursor: pointer; top: 0px; width: 100%; height: 100%; left: 0px; z-index: 100; opacity: 0;">
</form>
</div>
<span><b>Drag &amp; Drop Files</b></span>
</div>
<div>
</div>';
} }
} }
Loading…
Cancel
Save