Procházet zdrojové kódy

上传文件,提交后,文件上上传为成功
问题列表

ajun před 5 roky
rodič
revize
cfd9d30e2e

+ 0 - 1
app/Http/Requests/Demand/DemandRequest.php

@@ -47,7 +47,6 @@ class DemandRequest extends FormRequest
 
     public function rules(): array
     {
-        dd(Request::all());
         $routeName = Route::currentRouteName();
         switch ($routeName) {
             case 'demand.storeApi':

+ 1 - 1
resources/views/demand/_create.blade.php

@@ -75,7 +75,7 @@
                     <div class="form-group row">
                         <label for="add-demand-file" class="col-sm-2 col-form-label text-right">上传文件</label>
                         <div class="col-sm-10 form-inline">
-                            <input type="file" name="name" id="add-demand-file" class="form-control-file col-sm-10"
+                            <input type="file" name="name" id="add-demand-file-create" class="form-control-file col-sm-10"
                                    placeholder="输入配置名称"
                                    :class="demandErrors.file?'is-invalid':''"
                                    @focus="demandErrors.file!==null ? demandErrors.file=null:''">

+ 2 - 2
resources/views/demand/_createjs.blade.php

@@ -50,11 +50,11 @@
                 window.tempTip.setDuration(3000);
 
                 let formData = new FormData();
-                let file = document.querySelector('#add-demand-file').files[0];
+                let file = document.querySelector('#add-demand-file-create').files[0];
                 if(this.addDemand['authority_id'])formData.append('authority_id', this.addDemand['authority_id']);
                 if(this.addDemand['type'])formData.append('type', this.addDemand['type']);
                 if(this.addDemand['description'])formData.append('description', this.addDemand['description']);
-                if(file)formData.append('file', this.addDemand['file']);
+                if(file)formData.append('file', file);
 
                 window.axios.post(url, formData, {
                     'Content-Type': 'multipart/form-data'

+ 0 - 1
resources/views/demand/search/index.blade.php

@@ -86,7 +86,6 @@
                 },
                 /** 完结需求 */
                 finishDemand(demand,index) {
-                    console.log(demand['id']);
                     let url = '{{url('apiLocal/demand/finish')}}';
                     window.tempTip.setDuration(3000);
                     window.axios.post(url, {id: demand['id']}).then(res => {