-

太陽能管理

+
-
+
+

太陽能管理

+ +
+
@@ -18,22 +26,43 @@ $(function () { }); function initPage() { - // 初始載入 iframe - $('#pageIframe').html(` - - `); - // 監聽 iframe 中的點擊事件 - $('#pageIframe iframe').on('load', function() { - $(this).contents().on('click', function() { - sessionStorage.setItem("solar", JSON.stringify({'siteID': "133", 'siteName': "大眾電腦內湖總部"})); - $("#app").load(`_solarEnergyItem.html`); + // 初始載入 iframe + $('#pageIframe').html(` + + `); + + $('#solarIframe').on('load', function() { + const iframe = this; + const currentUrl = iframe.contentWindow.location.href; + console.log("currentUrl",currentUrl) + + // 檢查 URL 是否包含 'solarEnergyItem' + if (currentUrl.includes('solarEnergyItem')) { + // 解析 URL 的查詢參數 + const queryString = currentUrl.split('?')[1]; + const urlParams = new URLSearchParams(queryString); + const siteId = urlParams.get('siteId'); + + if (siteId) { + sessionStorage.setItem('siteId', siteId); + } else { + console.log('未找到 siteId 參數'); + } + } else { + console.log('當前 URL 不包含期望的結構'); + } + }); - }); - - -} + } + function goback() { + sessionStorage.removeItem('siteId'); + // 回復到初始頁面 + initPage(); + } diff --git a/Frontend/solarEnergyItem.html b/Frontend/solarEnergyItem.html new file mode 100644 index 0000000..5e01fde --- /dev/null +++ b/Frontend/solarEnergyItem.html @@ -0,0 +1,813 @@ + + + + + + + + + + + + + + + + + + + +
+
+
+
+ + +
+
+
+ +
+
+ +
+
+ +
+
+ +
+
+
+
+
+ + +
+
+
+
+ +
+
+
+ 查詢 +
+
+
+
+ +
+
+ + + + +
+
+
+
+ +
+
+
+
+ +
+
+
+ 查詢 +
+
+ +
+
+
+
+
+
+
+ + + + +
+
+
+
+
+
+
+
+ +
+
+
+ 查詢 +
+
+ +
+
+
+ +
+
+ +
+
+
+
+ 6 +
+
+
+
+
+
+ + \ No newline at end of file