list.html 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. {{ partial "headers.html" . }}
  5. </head>
  6. <body>
  7. <!-- <div class="header-template"></div> -->
  8. {{ partial "nav.html" . }}
  9. <section class="bhouseweb_loc_banner">
  10. <div class="card bg-transparent text-white border-0 rounded-0">
  11. <img src="/img/bn_portfolio2x.png" class="banner-img card-img" alt="..." />
  12. <div class="d-flex justify-content-end bt_container">
  13. <div class="bt_slogan text-center">
  14. <img src="/img/chevron-double-down (1).svg" alt="" />
  15. </div>
  16. </div>
  17. <img class="bt_slogan_portfolio" src="/img/bt_slogan_portfolio_h@2x.png" alt="" />
  18. </div>
  19. </section>
  20. <div class="bhouseweb_loc_content">
  21. <section class="bhouseweb_loc_sec01">
  22. <div class="bhouseweb_loc_box">
  23. <p class="fw-bold m-0">類型</p>
  24. <div class="bhouseweb_loc_type">
  25. <input style="opacity: 0;" class="type ms-1" type="radio" id="m_全部類型" name="m_type" value="全部類型" checked />
  26. <label for="m_全部類型" class="bhouseweb_item_type select">全部</label>
  27. <input style="opacity: 0;" class="type ms-1" type="radio" id="m_大樓" name="m_type" value="大樓" />
  28. <label id="building" for="m_大樓" class="bhouseweb_item_type">大樓</label>
  29. <input style="opacity: 0;" class="type ms-1" type="radio" id="m_透天" name="m_type" value="透天" />
  30. <label id="house" for="m_透天" class="bhouseweb_item_type">透天</label>
  31. </div>
  32. </div>
  33. <div class="bhouseweb_loc_box">
  34. <p class="fw-bold m-0">權狀</p>
  35. <div class="bhouseweb_loc_type">
  36. <input style="opacity: 0;" class="ping ms-1" type="radio" id="m_全部坪數" name="m_ping" value="全部坪數" checked />
  37. <label class="bhouseweb_item_type select" for="m_全部坪數">全部</label>
  38. <!-- <input style="opacity: 0;" class="ping ms-1" type="radio" id="m_20坪以下" name="m_ping" value="20坪以下" />
  39. <label class="bhouseweb_item_type" for="m_20坪以下">20坪以下</label> -->
  40. <input style="opacity: 0;" class="ping ms-1" type="radio" id="m_20-35坪" name="m_ping" value="20-35坪" />
  41. <label class="bhouseweb_item_type" for="m_20-35坪">20-35坪</label>
  42. <input style="opacity: 0;" class="ping ms-1" type="radio" id="m_36-50坪" name="m_ping" value="36-50坪" />
  43. <label class="bhouseweb_item_type" for="m_36-50坪">36-50坪</label>
  44. <input style="opacity: 0;" class="ping ms-1" type="radio" id="m_51坪以上" name="m_ping" value="51坪以上" />
  45. <label class="bhouseweb_item_type" for="m_51坪以上">51坪以上</label>
  46. <!-- <a class="bhouseweb_item_type select">全部</a>
  47. <a class="bhouseweb_item_type">20坪以下</a>
  48. <a class="bhouseweb_item_type">20-35坪</a>
  49. <a class="bhouseweb_item_type">36-50坪</a>
  50. <a class="bhouseweb_item_type">50坪以上</a>
  51. <a class="bhouseweb_item_type">50坪以上</a>
  52. <a class="bhouseweb_item_type">50坪以上</a>
  53. <a class="bhouseweb_item_type">50坪以上</a> -->
  54. </div>
  55. </div>
  56. <div class="bhouseweb_loc_box">
  57. <p class="fw-bold m-0">預算</p>
  58. <div class="bhouseweb_loc_type">
  59. <input style="opacity: 0;" class="budget ms-1" type="radio" id="m_全部預算" name="m_budget" value="全部預算"
  60. checked />
  61. <label class="bhouseweb_item_type select" for="m_全部預算">全部</label>
  62. <input style="opacity: 0;" class="budget ms-1" type="radio" id="m_59萬以下" name="m_budget" value="59萬以下" />
  63. <label class="bhouseweb_item_type" for="m_59萬以下">59萬以下</label>
  64. <input style="opacity: 0;" class="budget ms-1" type="radio" id="m_60-79萬" name="m_budget" value="60-79萬" />
  65. <label class="bhouseweb_item_type" for="m_60-79萬">60-79萬</label>
  66. <input style="opacity: 0;" class="budget ms-1" type="radio" id="m_80-99萬" name="m_budget" value="80-99萬" />
  67. <label class="bhouseweb_item_type" for="m_80-99萬">80-99萬</label>
  68. <input style="opacity: 0;" class="budget ms-1" type="radio" id="m_100萬以上" name="m_budget" value="100萬以上" />
  69. <label class="bhouseweb_item_type" for="m_100萬以上">100萬以上</label>
  70. <!-- <a class="bhouseweb_item_type">全部</a>
  71. <a class="bhouseweb_item_type">59萬以下</a>
  72. <a class="bhouseweb_item_type">60-79萬</a>
  73. <a class="bhouseweb_item_type">80-99萬</a>
  74. <a class="bhouseweb_item_type">100萬</a> -->
  75. </div>
  76. </div>
  77. <div class="bhouseweb_loc_box">
  78. <p class="fw-bold m-0">格局</p>
  79. <div class="bhouseweb_loc_type">
  80. <input style="opacity: 0;" class="rooms ms-1" type="radio" id="m_全部格局" name="m_rooms" value="全部格局" checked />
  81. <label class="bhouseweb_item_type select" for="m_全部格局">全部</label>
  82. <input style="opacity: 0;" class="rooms ms-1" type="radio" id="m_二房" name="m_rooms" value="二房" />
  83. <label class="bhouseweb_item_type" for="m_二房">兩房</label>
  84. <input style="opacity: 0;" class="rooms ms-1" type="radio" id="m_三房" name="m_rooms" value="三房" />
  85. <label class="bhouseweb_item_type" for="m_三房">三房</label>
  86. <input style="opacity: 0;" class="rooms ms-1" type="radio" id="m_四房" name="m_rooms" value="四房" />
  87. <label class="bhouseweb_item_type" for="m_四房">四房</label>
  88. <input style="opacity: 0;" class="rooms ms-1" type="radio" id="m_四房以上" name="m_rooms" value="四房以上" />
  89. <label class="bhouseweb_item_type" for="m_四房以上">四房以上</label>
  90. <!-- <a class="bhouseweb_item_type">全部</a>
  91. <a class="bhouseweb_item_type">兩房</a>
  92. <a class="bhouseweb_item_type">三房</a>
  93. <a class="bhouseweb_item_type">四房</a>
  94. <a class="bhouseweb_item_type">四房以上</a> -->
  95. </div>
  96. </div>
  97. </section>
  98. <section class="p-1">
  99. <div class="bhouseweb_loc_search_box">
  100. <form class="bhouseweb_search_form d-flex">
  101. <div class="bhouseweb_search_img">
  102. <i class="fas fa-search"></i>
  103. </div>
  104. <input id="bhouseweb_search" class="me-md-2" type="search" placeholder="搜 尋「 工 業 」「 中 島 」「 台 中 」"
  105. aria-label="Search" />
  106. <!-- <button class="btn btn-outline-success" type="submit">Search</button> -->
  107. </form>
  108. </div>
  109. </section>
  110. </div>
  111. <hr class="bhouseweb_loc_line" />
  112. <div class="bhouseweb_loc_content" style="overflow-x: hidden">
  113. <div class="bhouseweb_loc_sec02">
  114. <div class="update_info row px-0 mx-0" id="articleList">
  115. {{ $paginator := .Paginate .Data.Pages }} {{ range $paginator.Pages }}
  116. <div class="col-12 col-sm-6 p-1">
  117. <div class="bhouseweb_loc_sec02_card secimg mx-0 px-0 border-0">
  118. <a href="{{ .RelPermalink }}">
  119. <img class="img-fluid" src="{{ .Params.Image | relURL }}" alt="" />
  120. <div class="slide_item_text">
  121. <p>{{ replace .Title "|小寶優居・成家故事" "" }}</p>
  122. </div>
  123. <div class="sec02-p-dec p-1 mt-1 text-center">
  124. <h5 class="card-title">
  125. {{ replace .Title "|小寶優居・成家故事" "" }}
  126. </h5>
  127. <p class="card-text">{{ .Description | safeHTML }}</p>
  128. </div>
  129. </a>
  130. </div>
  131. </div>
  132. {{ end }}
  133. </div>
  134. </div>
  135. </div>
  136. <p class="article__readMore text-center fw-bold my-3">
  137. 看更多案例
  138. <span style="font-size: 16px" class="fw-normal me-2"> &or;</span>
  139. </p>
  140. <div class="reserve d-flex flex-column">
  141. <a href="https://maac.io/1Pife" target="_blank">
  142. <img src="/img/bhousev2_img/LINE-CONTACT.png" alt="">
  143. </a>
  144. <!-- <a href="/store/">
  145. <img src="/img/home/store-reserve.png" alt="">
  146. </a> -->
  147. </div>
  148. <!-- <div class="footer-template"></div> -->
  149. {{ partial "footer.html" . }}
  150. <!-- <script src="https://cdn.jsdelivr.net/npm/@popperjs/core@2.9.2/dist/umd/popper.min.js"
  151. integrity="sha384-IQsoLXl5PILFhosVNubq5LC7Qb9DXgDA9i+tQ8Zj3iwWAwPtgFTxbJ8NT4GN1R8p"
  152. crossorigin="anonymous"></script>
  153. <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.0.1/dist/js/bootstrap.min.js"
  154. integrity="sha384-Atwg2Pkwv9vp0ygtn1JAojH0nYbwNJLPhwyoVbhoPwBhjQPR5VtM2+xf0Uwh9KtT"
  155. crossorigin="anonymous"></script>
  156. <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.6.0/jquery.min.js"></script>
  157. <script type="text/javascript" src="https://cdn.jsdelivr.net/npm/slick-carousel@1.8.1/slick/slick.min.js"></script>
  158. <script async defer src="./js/index.js"></script> -->
  159. {{ partial "scripts.html" . }}
  160. <script src="/js/cz_filter.js"></script>
  161. <script>
  162. window.onload = function () {
  163. // 暫時隱藏第一篇作品
  164. // let first = document.querySelector('#articleList div');
  165. // first.style.display = "none"
  166. document.getElementById('bhouseweb_search').value = '';
  167. // 取得 apiData
  168. let contentsData = [];
  169. // let category = localStorage.getItem('category');
  170. (function getContentsData() {
  171. // 線上版網址 http://192.53.174.202:9001/api/
  172. // 本地端網址 http://localhost:9001/api/
  173. fetch('https://bhouse3.ptt.cx:9002/api/contents?url=/collection').then(res => res.json()).then(list => {
  174. contentsData = list;
  175. console.log('contentsData', contentsData);
  176. // filterCategory();
  177. })
  178. })();
  179. let matchContent = "";
  180. // 增加延遲(待輸入完成後再進行搜尋)
  181. function delay(fn, ms) {
  182. let timer = 0
  183. return function (...args) {
  184. clearTimeout(timer)
  185. timer = setTimeout(fn.bind(this, ...args), ms || 0)
  186. }
  187. }
  188. // 搜尋
  189. $('#bhouseweb_search').keyup(delay(function (e) {
  190. console.log(1)
  191. console.log('Time elapsed!', this.value);
  192. // 取得輸入框的值
  193. let inputVal = $('#bhouseweb_search').val();
  194. console.log('inputVal', inputVal);
  195. matchContent = "";
  196. let falseItem = [];
  197. contentsData.map((item, index) => {
  198. // 搜尋特定分類文章
  199. // if (item.categories) {
  200. // if (item.categories.includes(category)) {
  201. if (item.title.includes(inputVal) || item.description.includes(inputVal) || item.banner_img_text?.includes(inputVal) || item.content.includes(inputVal)) {
  202. if (item.url != '/collection') {
  203. matchContent += `
  204. <div class="col-12 col-sm-6 p-1"> \
  205. <div class="bhouseweb_loc_sec02_card secimg mx-0 px-0 border-0"> \
  206. <a href="${item.url}"> \
  207. <img \
  208. alt="${item.title}" \
  209. src="${item.image}" \
  210. layout="responsive"> \
  211. <div class="slide_item_text"> \
  212. <p>${item.title}</p>\
  213. </div> \
  214. <div class="sec02-p-dec p-1 mt-1 text-center">\
  215. <h5 class="card-title">${item.title}</h5>\
  216. <p>${item.description}</p>\
  217. </div>\
  218. </div> \
  219. </a> \
  220. </div> \
  221. </div>`;
  222. }
  223. } else {
  224. falseItem.push(item);
  225. }
  226. if (falseItem.length === contentsData.length) {
  227. matchContent = `
  228. <div class="alert d-flex align-items-center" role="alert" style="max-width: 300px;margin: 0 auto 25px;justify-content: center;">
  229. <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="currentColor" class="bi bi-exclamation-triangle-fill flex-shrink-0 me-2" style="color: #808e4c;" viewBox="0 0 16 16" role="img" aria-label="Warning:">
  230. <path d="M8.982 1.566a1.13 1.13 0 0 0-1.96 0L.165 13.233c-.457.778.091 1.767.98 1.767h13.713c.889 0 1.438-.99.98-1.767L8.982 1.566zM8 5c.535 0 .954.462.9.995l-.35 3.507a.552.552 0 0 1-1.1 0L7.1 5.995A.905.905 0 0 1 8 5zm.002 6a1 1 0 1 1 0 2 1 1 0 0 1 0-2z"/>
  231. </svg>
  232. <div>
  233. 找不到符合條件的作品集
  234. </div>
  235. </div>
  236. `;
  237. }
  238. // }
  239. // }
  240. })
  241. document.getElementById("articleList").innerHTML = matchContent;
  242. }, 500));
  243. // 離開頁面前清除 localStorage
  244. $(window).bind('beforeunload', function () {
  245. return window.localStorage.removeItem('type');
  246. }
  247. );
  248. }
  249. </script>
  250. </body>
  251. </html>