Zhouzhendong 5 سال پیش
والد
کامیت
2e4bb1734e
2فایلهای تغییر یافته به همراه7 افزوده شده و 6 حذف شده
  1. 1 1
      app/Http/Middleware/DecodingRequest.php
  2. 6 5
      resources/js/queryForm/queryForm.js

+ 1 - 1
app/Http/Middleware/DecodingRequest.php

@@ -18,7 +18,7 @@ class DecodingRequest
     {
         if ($request->method() == "GET"){
             foreach ($request->input() as $key => $value){
-                if ($value != null)$request->offsetSet($key, str_replace("%20"," ",$value));
+                if ($value != null)$request->offsetSet($key, urldecode($value));
             }
         }
         return $next($request);

+ 6 - 5
resources/js/queryForm/queryForm.js

@@ -45,12 +45,12 @@ const query = function getQueryForm(data) {
                     //     }
                     // }
                     // console.log(map.value);
-                    form.append("<input name='" + key + "' value='" + map.value.replace(" ","%20") + "'>");
-                    // form.append("<input name='" + key + "' value='" + encodeURIComponent(map.value) + "'>")
+                    //form.append("<input name='" + key + "' value='" + map.value.replace(" ","%20") + "'>");
+                      form.append("<input name='" + key + "' value='" + encodeURIComponent(map.value) + "'>")
                 } else if ('array' === fetchJsType(map.value)) {
                     let string = map.value.join(',');
-                    form.append("<input  name='" + key + "' value='" + string.replace(" ","%20") + "'>");
-                    // form.append("<input  name='" + key + "' value='" + encodeURIComponent(string) + "'>")
+                    //form.append("<input  name='" + key + "' value='" + string.replace(" ","%20") + "'>");
+                    form.append("<input  name='" + key + "' value='" + encodeURIComponent(string) + "'>")
                 }
             }
             for (let key in this.param){
@@ -1225,7 +1225,8 @@ const query = function getQueryForm(data) {
     // url path on search form option  renderer
     function searchOptionToUrlsearch() {
         let data = (window.location.search);
-        data = decodeURIComponent(data).replace('%20'," ");
+        data = decodeURIComponent(decodeURIComponent(data));
+        //data = decodeURIComponent(data).replace('%20'," ");
         if (!!data) {
             data = (data.substr(1)).split('&');
             data = convertArrayToObj(data);