商户图片优化

main
home.fengxinyhyl 8 months ago
parent 90d4a79576
commit ee85a8eb38
  1. 18
      app/controller/merchant/Common.php
  2. 2
      public/mer.html
  3. 2
      public/system.html
  4. 1
      route/merchant/system.php
  5. 5
      view/mer/src/views/systemForm/setSystem/modifyStoreInfo.vue

@ -255,6 +255,24 @@ class Common extends BaseController
return app('json')->success(['src' => tidy_url($upload->getFileInfo()->filePath)]); return app('json')->success(['src' => tidy_url($upload->getFileInfo()->filePath)]);
} }
public function uploadPicture()
{
$file = $this->request->file('file');
if (!$file)
return app('json')->fail('请上传图片');
validate(["file|图片" => [
'fileSize' => config('upload.filesize'),
'fileExt' => 'jpg,jpeg,png,bmp',
'fileMime' => 'image/jpeg,image/png',
]])->check(['file' => $file]);
$upload = UploadService::create(1);
$data = $upload->to('attach')->move('file');
if ($data === false) {
return app('json')->fail($upload->getError());
}
return app('json')->success(['src' => tidy_url($upload->getFileInfo()->filePath)]);
}
public function uploadVideo() public function uploadVideo()
{ {
$file = $this->request->file('file'); $file = $this->request->file('file');

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

@ -122,6 +122,7 @@ Route::group(function () {
Route::get('margin/code', 'merchant.system.Merchant/getMarginQrCode'); Route::get('margin/code', 'merchant.system.Merchant/getMarginQrCode');
Route::get('margin/lst', 'merchant.system.Merchant/getMarginLst'); Route::get('margin/lst', 'merchant.system.Merchant/getMarginLst');
Route::post('upload/certificate', 'merchant.Common/uploadCertificate'); Route::post('upload/certificate', 'merchant.Common/uploadCertificate');
Route::post('upload/picture', 'merchant.Common/uploadPicture');
Route::post('upload/video', 'merchant.Common/uploadVideo'); Route::post('upload/video', 'merchant.Common/uploadVideo');
})->option([ })->option([
'_path' => '', '_path' => '',

@ -146,7 +146,7 @@
<i class="el-icon-view" @click="viewImage(item, index)" /> <i class="el-icon-view" @click="viewImage(item, index)" />
</div> </div>
</div> </div>
<el-upload :action="fileUrl" :show-file-list="false" list-type="picture-card" multiple :headers="myHeaders" :on-success="setQualificationsPicList" :before-upload="beforeUploadPic"> <el-upload :action="picUrl" :show-file-list="false" list-type="picture-card" multiple :headers="myHeaders" :on-success="setQualificationsPicList" :before-upload="beforeUploadPic">
<i class="el-icon-plus" /> <i class="el-icon-plus" />
</el-upload> </el-upload>
</div> </div>
@ -631,6 +631,9 @@ export default {
computed: { computed: {
fileUrl() { fileUrl() {
return SettingMer.https + `/upload/certificate` return SettingMer.https + `/upload/certificate`
},
picUrl() {
return SettingMer.https + `/upload/picture`
} }
}, },
watch: { watch: {

Loading…
Cancel
Save