Ver código fonte

修正加入清單愛心、清單列表內篩選打不開

nate 3 anos atrás
pai
commit
f711af279e
4 arquivos alterados com 15 adições e 9 exclusões
  1. 1 3
      component-detail.php
  2. 1 0
      component-favorite.php
  3. 11 4
      component-list.php
  4. 2 2
      script/php/addFavorite.php

+ 1 - 3
component-detail.php

@@ -187,7 +187,6 @@ include($_SERVER['DOCUMENT_ROOT'] . "/Authorization/script/php/permission/check_
 					}
 				});
 
-
 			}).error(function(error) {
 				console.log(error.responseText);
 			});
@@ -196,8 +195,7 @@ include($_SERVER['DOCUMENT_ROOT'] . "/Authorization/script/php/permission/check_
 				url: "./script/php/addFavorite.php",
 				type: "GET",
 				data: {
-					type: type,
-					object: name,
+					CheckFavorite: parent + "/" + type + "/" + name
 				},
 				contentType: "application/json",
 				dataType: "json"

+ 1 - 0
component-favorite.php

@@ -179,6 +179,7 @@ include($_SERVER['DOCUMENT_ROOT'] . "/Authorization/script/php/permission/check_
 			});
 		}
 	</script>
+	<script src="./script/js/data-sort.js"></script>
 	<script src="script/js/3Dpic-favorite.js" type="module"></script>
 
 </body>

+ 11 - 4
component-list.php

@@ -30,7 +30,6 @@ include($_SERVER['DOCUMENT_ROOT'] . "/Authorization/script/php/permission/check_
 		var $grid;
 
 		pageHeader = "元件庫";
-
 	</script>
 </head>
 
@@ -105,6 +104,14 @@ include($_SERVER['DOCUMENT_ROOT'] . "/Authorization/script/php/permission/check_
 					$("#content").append("<h3>到BIM程式庫下載拖放元件API,並參考操作方式以進行元件放置動作</h3>");
 					$("#content").css("padding", "0");
 					$("#content").css("text-align", "center");
+
+					$("a").each(function() {
+						if ($(this).context.name != "" && $(this).context.className == "menu-item" && $(this).context.name != parent) {
+							//其他大項類別不要產生ul
+							$(this).closest("ul").remove();
+						}
+					});
+
 				} else {
 					$.when(initThreeJS()).then(function() {
 
@@ -180,17 +187,17 @@ include($_SERVER['DOCUMENT_ROOT'] . "/Authorization/script/php/permission/check_
 									} else {
 										$(this).context.removeAttribute("href");
 									}
-								}else if($(this).context.name != "" && $(this).context.className == "menu-item" &&$(this).context.name != parent){
+								} else if ($(this).context.name != "" && $(this).context.className == "menu-item" && $(this).context.name != parent) {
 									//其他大項類別不要產生ul
 									$(this).closest("ul").remove();
 								}
-								
+
 							}
 						}
 					});
 				}
 			}
-			
+
 
 
 		});

+ 2 - 2
script/php/addFavorite.php

@@ -35,8 +35,8 @@ if (isset($_POST["AddFavorite"])) {
                     END
                 END";
     sqlsrv_query($conn, $sql);
-} else if (isset($_GET["object"])) {
-    $favorite = $_GET["type"] . "/" . $_GET["object"];
+} else if (isset($_GET["CheckFavorite"])) {
+    $favorite = $_GET["CheckFavorite"];
     $sql = "SELECT * FROM [BIMComponents].[dbo].[Favorite_Table] Where [favorite] = '" . $favorite . "' AND [user_name] = '" . $_SESSION["name"] . "';";
     $i = 0;
     $fetchResult = sqlsrv_query($conn, $sql);