goto2.js 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465
  1. function getParameterByName(name, url = window.location.href) {
  2. name = name.replace(/[\[\]]/g, '\\$&');
  3. var regex = new RegExp('[?&]' + name + '(=([^&#]*)|&|#|$)'),
  4. results = regex.exec(url);
  5. if (!results) return null;
  6. if (!results[2]) return '';
  7. return decodeURIComponent(results[2].replace(/\+/g, ' '));
  8. }
  9. var id = getParameterByName('id');
  10. console.log(id);
  11. function get_data() {
  12. $.ajax({
  13. method: "GET",
  14. url: "../designer4.json",
  15. dataType: "json",
  16. })
  17. .done(function (msg) {
  18. for (var i = 0; i < msg.length; i++) {
  19. if (msg[i].id == id) {
  20. var aboutContent = '';
  21. var aboutInt = '';
  22. var aboutImg = '';
  23. var aboutViedeo = '';
  24. var aboutMethod = '';
  25. var aboutIntPhone = '';
  26. var bodyBannerDes = '';
  27. var webtitle = '';
  28. console.log(msg[i]);
  29. // var res = msg.length;
  30. // console.log(res);
  31. // const limit = res;
  32. // 公司簡介
  33. aboutContent += ' \
  34. <div class="row px-0 mx-0">\
  35. <div class="condition col-12 col-lg-4 bg-white">\
  36. <h1 class="fs-3 pb-3"><span style="color:#8DC21F" class="fw-bold fs-2">|</span>接案條件 condition</h1>\
  37. <table class="table">\
  38. <tbody>\
  39. <tr>\
  40. <th id="title-test" class="w-25" scope="row">接案區域</th>\
  41. <td>\
  42. '+ msg[i].WorkLoc + '\
  43. </td>\
  44. </tr>\
  45. <tr>\
  46. <th scope="row">接案類型</th>\
  47. <td>\
  48. '+ msg[i].WorkType + '\
  49. </td>\
  50. </tr>\
  51. <tr>\
  52. <th scope="row">接案風格</th>\
  53. <td>\
  54. '+ msg[i].WorkStyle + '\
  55. </td>\
  56. </tr>\
  57. <tr>\
  58. <th scope="row">接案預算</th>\
  59. <td>\
  60. '+ msg[i].WorkBudget + '\
  61. </td>\
  62. </tr>\
  63. <tr>\
  64. <th scope="row">接案坪數</th>\
  65. <td>\
  66. '+ msg[i].WorkSize + '\
  67. </td>\
  68. </tr>\
  69. <tr>\
  70. <th scope="row">特殊接案</th>\
  71. <td>\
  72. '+ msg[i].WorkSoho + '\
  73. </td>\
  74. </tr>\
  75. </tbody >\
  76. </table >\
  77. </div >\
  78. <div style="background: url(../img/about/sec01/idea.webp); background-size: cover; background-repeat: no-repeat;"\
  79. class="idea col-12 col-lg-4 text-white">\
  80. <h1 class="fs-3 pb-3"><span style="color:#8DC21F" class="fw-bold fs-2">|</span>設計理念 idea</h1>\
  81. <table class="table table-borderless text-white">\
  82. <tbody>\
  83. <tr>\
  84. <td>\
  85. '+ msg[i].DesignIdea1 + '\
  86. </td>\
  87. </tr>\
  88. </tbody>\
  89. </table>\
  90. </div>\
  91. <div style="background: url(../img/about/sec01/contact.webp); background-size: cover; background-repeat: no-repeat;"\
  92. class="contact col-12 col-lg-4 text-white">\
  93. <h1 class="fs-3 pb-3"><span style="color:#8DC21F" class="fw-bold fs-2">|</span>聯絡設計師 contact</h1>\
  94. <table class="table text-white">\
  95. <tbody>\
  96. <tr>\
  97. <th scope="row" class="">免付費電話/</th>\
  98. <td class="">\
  99. <a target="_blank" href="tel: '+ msg[i].TollFreeCall + '"> ' + msg[i].TollFreeCall + '</a>\
  100. </td>\
  101. </tr>\
  102. <tr>\
  103. <th scope="row" class="">電.&emsp;&emsp;&ensp;話/</th>\
  104. <td>\
  105. '+ msg[i].Telephone + '\
  106. </td>\
  107. </tr>\
  108. <tr>\
  109. <th scope="row" class="">地.&emsp;&emsp;&ensp;址/</th>\
  110. <td>\
  111. '+ msg[i].Address + '\
  112. </td>\
  113. </tr>\
  114. <tr>\
  115. <th scope="row" class="">傳.&emsp;&emsp;&ensp;真/</th>\
  116. <td>\
  117. '+ msg[i].Fax + '\
  118. </td>\
  119. </tr>\
  120. <tr>\
  121. <th scope="row" class="">電&thinsp;子&thinsp;郵&thinsp;件/</th>\
  122. <td>\
  123. <a target="_blank" href="mailto:'+ msg[i].Email + '">' + msg[i].Email + '</a>\
  124. </td>\
  125. </tr>\
  126. <tr>\
  127. <th scope="row" class="">網.&emsp;&emsp;&ensp;站/</th>\
  128. <td>\
  129. <a target="_blank" href="'+ msg[i].Web + '">' + msg[i].Web + '</a>\
  130. </td>\
  131. </tr>\
  132. <tr>\
  133. <th scope="row" class="">Facebook:</th>\
  134. <td>\
  135. <a target="_blank" href="'+ msg[i].Facebook + '">' + msg[i].Facebook + '</a>\
  136. </td>\
  137. </tr>\
  138. </tbody>\
  139. </table>\
  140. </div>\
  141. </div >';
  142. aboutInt += ' \
  143. <div class="banner-des row vertical align-items-end">\
  144. <div class="banner-3 col-2 pe-0">\
  145. <img class="img-fluid" src="'+ msg[i].Designerimg + '" alt="">\
  146. </div>\
  147. <div class="banner-0 col-9 text-white">\
  148. <div class="row">\
  149. <div class="banner-1 col-9 align-self-end pb-3">\
  150. <div style="font-weight: 900;" class="fs-2">'+ msg[i].WorkName + '</div>\
  151. <p><span class="fs-5">'+ msg[i].DesignerName + '</span>設計師</p>\
  152. <button type="button" class="btn border border-white"><a target="_blank" href="tel: '+ msg[i].TollFreeCall + '"><img class="" src="../img/002-phone-call.svg" alt=""></a>\</button>\
  153. <button type="button" data-info="' + msg[i].id + '" class="mesg btn border border-white" data-bs-toggle="modal" data-bs-target="#exampleModal"><img class="" src="../img/001-blogging.svg" alt=""></button>\
  154. </div>\
  155. <div class="banner-2 col-3 row justify-content-end px-0">\
  156. </div>\
  157. </div>\
  158. </div> \
  159. </div>';
  160. aboutIntPhone += ' \
  161. <div class="banner-m row vertical align-items-end px-0 mx-0">\
  162. <div class="bannerm-0 col-12 my-5 px-0">\
  163. <a href="../index.html"><img class="img-fluid" src="../img/banner/banner-mobile.png" alt=""></a>\
  164. </div>\
  165. <div class="bannerm-2 col-7 order-2 col-lg-2 order-3 px-0 mx-0">\
  166. <img class="img-fluid" src="'+ msg[i].Designerimg + '" alt="">\
  167. </div>\
  168. <div class="bannerm-1 col-5 order-3 col-lg-5 order-2 text-white text-start pb-3">\
  169. <div class="banner1-1 pt-3 pb-1" style="font-weight: 900;">'+ msg[i].WorkName + '</div>\
  170. <p class=""><span class="fs-5">'+ msg[i].DesignerName + '</span>設計師</p>\
  171. <button type="button" class="btn border border-white"><a target="_blank" href="tel: '+ msg[i].TollFreeCall + '"><img class="" src="../img/002-phone-call.svg" alt=""></a>\</button>\
  172. <button type="button" id="'+ msg[i].id + '" data-info="' + msg[i].id + '" class="mesg btn border border-white" data-bs-toggle="modal" data-bs-target="#exampleModal"><img class="" src="../img/001-blogging.svg" alt=""></button>\
  173. </div>\
  174. </div>';
  175. for (var j = 0; j < msg[i].workimg.length; j++) {
  176. aboutImg += ' \
  177. <div class="secimg col-lg-4 mx-0 px-0">\
  178. <a target="_blank" href="'+ msg[i].workimg[j].workSrc + '"><img class="img-fluid" src="' + msg[i].workimg[j].img + '" alt=""></a>\
  179. <div class="sec02-p-m p-1 mt-1 text-center">\
  180. <p>'+ msg[i].workimg[j].text + '</p>\
  181. <a target="_blank" href="'+ msg[i].workimg[j].workSrc + '"><div class="sec03-img-m1"><img class="play1" src="../img/arrow.png" alt=""></div></a>\
  182. </div>\
  183. </div>';
  184. }
  185. var j = 0;
  186. if (msg[i].workVideo[j] == undefined) {
  187. aboutViedeo += ' \
  188. <div id="sec05" class="sec05-row row align-items-center h-100 mx-0 w-100 px-0" style=" background: rgba(0, 0, 0, 0.8);text-align: center;">\
  189. <div style="padding:20vw 0px">\
  190. <h1 class="align-self-center" style="color:#86B81D;">Stay tuned !</h1>\
  191. <p class="align-self-center" style="color:#fff; letter-spacing: 5px;">...敬請期待...</p>\
  192. </div>\
  193. </div>';
  194. } else {
  195. for (var j = 0; j < msg[i].workVideo.length; j++) {
  196. aboutViedeo += ' \
  197. <div class="secimg col-lg-4 p-0">\
  198. <a target="_blank" href="'+ msg[i].workVideo[j].videoSrc + '"><img class="img-fluid" src="' + msg[i].workVideo[j].video + '" alt=""></a>\
  199. <div class="sec03-p-m p-1 mt-1 text-center">\
  200. <p class="mb-1">'+ msg[i].workVideo[j].videotext + '</p>\
  201. <a target="_blank" href="'+ msg[i].workVideo[j].videoSrc + '"><div class="sec03-img-m1"><img class="play1" src="../img/play.png" alt=""></div></a>\
  202. </div>\
  203. </div>';
  204. }
  205. }
  206. var j = 0;
  207. if (msg[i].workMethod[j] == undefined) {
  208. aboutMethod += ' \
  209. <div id="sec05" class="sec05-row row align-items-center h-100 mx-0 w-100 px-0" style=" background: rgba(0, 0, 0, 0.8);text-align: center;">\
  210. <div style="padding:20vw 0px">\
  211. <h1 class="align-self-center" style="color:#86B81D;">Stay tuned !</h1>\
  212. <p class="align-self-center" style="color:#fff; letter-spacing: 5px;">...敬請期待...</p>\
  213. </div>\
  214. </div>';
  215. } else {
  216. for (var j = 0; j < msg[i].workMethod.length; j++) {
  217. aboutMethod += ' \
  218. <div class="secimg col-lg-4 p-0">\
  219. <a target="_blank" href="'+ msg[i].workMethod[j].Methodsrc + '"><img class="img-fluid" src="' + msg[i].workMethod[j].Methodimg + '" alt=""></a>\
  220. <div class="sec04-p-m p-1 mt-1 text-center">\
  221. <p>'+ msg[i].workMethod[j].Methodtext + '</p>\
  222. <a target="_blank" href="'+ msg[i].workimg[j].workSrc + '"><div class="sec03-img-m1"><img class="play1" src="../img/arrow.png" alt=""></div></a>\
  223. </div>\
  224. </div>';
  225. }
  226. }
  227. bodyBannerDes += ' \
  228. <img class="banner-img" id="img_id" src="'+ msg[i].workimg[0].img + '" alt="">\
  229. ';
  230. webtitle += ' \
  231. 幸福空間::: 2022 觀眾最愛設計師 | 滿足你期待回家的夢想推手|'+ msg[i].DesignerName + '設計師\
  232. ';
  233. $('.sec03-1').html(aboutViedeo);
  234. $('.sec02-1').html(aboutImg);
  235. $('.banner-des-about').html(aboutInt);
  236. $('.sec01').html(aboutContent);
  237. $('.sec04-1').html(aboutMethod);
  238. $('.banner-m').html(aboutIntPhone);
  239. $('#bannerdes-img').html(bodyBannerDes);
  240. $('#webtitle').html(webtitle);
  241. }
  242. }
  243. });
  244. }
  245. get_data();
  246. $(document).on("click", ".mesg", function(event) {
  247. console.log(1);
  248. var desid = $(this).data("info");
  249. console.log(desid);
  250. $("#version").val(desid);
  251. });
  252. $(".arrow").hide();
  253. $(window).scroll(function () {
  254. var y1 = window.scrollY;
  255. if (y1 > 100) {
  256. $(".arrow").show();
  257. } else {
  258. $(".arrow").hide();
  259. }
  260. });
  261. $.fn.serializeObject = function () {
  262. var o = {};
  263. var a = this.serializeArray();
  264. o["id"] = 0;
  265. o["time_stamp"] = "";
  266. $.each(a, function () {
  267. if (o[this.name]) {
  268. if (!o[this.name].push) {
  269. o[this.name] = [o[this.name]];
  270. }
  271. o[this.name].push(this.value || '');
  272. } else {
  273. o[this.name] = this.value || '';
  274. }
  275. });
  276. return o;
  277. };
  278. $(".contact-form1").submit(function (e) {
  279. /* var formRef = $('#form1').serializeArray();
  280. var jsonString = JSON.stringify(formRef);*/
  281. var jsonInfo = $('.contact-form1').serializeObject();
  282. var jsonString = JSON.stringify(jsonInfo);
  283. console.log(jsonString);
  284. $.ajax({
  285. type: 'POST',
  286. url: 'https://go.hhh.com.tw:8002/deco_request_detail',
  287. data: jsonString,
  288. dataType: 'json',
  289. success: function (data) {
  290. console.log('送出成功: ' + data);
  291. if (data == 0) {
  292. alert("送出成功");
  293. } else if (data == 1) {
  294. alert("此email已填過表單");
  295. } else if (data == 2) {
  296. alert("此phone已填過表單");
  297. } else if (data == 3) {
  298. alert("此email、phone已填過表單");
  299. }
  300. location.href = "./index_complete_line.html";
  301. },
  302. beforeSend: function () {
  303. console.log('beforeSend');
  304. },
  305. complete: function () {
  306. console.log('complete');
  307. },
  308. error: function (jqXHR, textStatus, errorThrown) {
  309. console.log(JSON.stringify(jqXHR));
  310. console.log("AJAX errr: " + textStatus + ' : ' + errorThrown);
  311. console.log('送出失敗: ' + jqXHR.responseText);
  312. alert("送出失敗");
  313. }
  314. });
  315. return false;
  316. });
  317. // $(window).scroll(function () {
  318. // var y = window.scrollY;
  319. // if (y > 550) {
  320. // $(".nav").addClass("sfixed");
  321. // } else {
  322. // $(".nav").removeClass("sfixed");
  323. // }
  324. // });
  325. if (jQuery(window).width() < 767) {
  326. $(window).scroll(function () {
  327. var y = window.scrollY;
  328. if (y > 550) {
  329. $(".nav").css({ "position": "fixed", "top": "75px", "z-index": "10" });
  330. } else {
  331. $(".nav").css({ "position": "static" });
  332. }
  333. });
  334. }
  335. // $(document).ready(function(){
  336. // $(window).resize(function() {
  337. // wdth=$(window).width();
  338. // console.log(wdth)
  339. // });
  340. // });
  341. $("*").each(function (index, element) {
  342. // 此元素被點選後執行
  343. $(this).click(function (e) {
  344. // 取得被點選元素的屬性:data-gt-target
  345. var target = $(this).attr("data-gt-target");
  346. var duration = $(this).attr("data-gt-duration");
  347. var offset = $(this).attr("data-gt-offset");
  348. // JS 語法:判斷式
  349. // if (條件) {程式區塊}
  350. // 當條件成立,會執行程式區塊
  351. // 如果 目標有資料 才會執行 { } 內的程式
  352. // 避免出現 undefine (未定義 - 不存在的資料)
  353. if (target) {
  354. //console.log("目標:" + target);
  355. //console.log("時間:" + duration);
  356. //console.log("位移:" + offset);
  357. // 上方位置 = 目標區塊.位移().上方位置
  358. var top = $(target).offset().top;
  359. //console.log("要前往元素的上方位置:" + top);
  360. // 網頁元素.停止().動畫({ 上方捲動:指定元素 - 位移},持續時間)
  361. // parseInt() 將文字轉為數字
  362. $("html").stop().animate({
  363. scrollTop: top - offset
  364. }, parseInt(duration));
  365. }
  366. });
  367. });
  368. // 避免動畫與使用者滾輪衝突
  369. // html 在滾動滾輪時 停止 html 所有效果
  370. $("html").on("mousewheel", function () {
  371. $("html").stop();
  372. });
  373. function showItem() {
  374. $(".nav-item1").click(function () {
  375. $(this).addClass('nav-item-achive');
  376. $(".nav-item2").removeClass('nav-item-achive');
  377. $(".nav-item3").removeClass('nav-item-achive');
  378. $(".nav-item4").removeClass('nav-item-achive');
  379. });
  380. $(".nav-item2").click(function () {
  381. $(".nav-item2").addClass('nav-item-achive');
  382. $(".nav-item1").removeClass('nav-item-achive');
  383. $(".nav-item3").removeClass('nav-item-achive');
  384. $(".nav-item4").removeClass('nav-item-achive');
  385. });
  386. $(".nav-item3").click(function () {
  387. $(".nav-item3").addClass('nav-item-achive');
  388. $(".nav-item1").removeClass('nav-item-achive');
  389. $(".nav-item2").removeClass('nav-item-achive');
  390. $(".nav-item4").removeClass('nav-item-achive');
  391. });
  392. $(".nav-item4").click(function () {
  393. $(".nav-item4").addClass('nav-item-achive');
  394. $(".nav-item1").removeClass('nav-item-achive');
  395. $(".nav-item2").removeClass('nav-item-achive');
  396. $(".nav-item3").removeClass('nav-item-achive');
  397. });
  398. }
  399. showItem();
  400. // function showItem2(){
  401. // $(".nav-item2").click(function(){
  402. // $(this).addClass('nav-item-achive');
  403. // $(this).siblings().removeClass('nav-item-achive');
  404. // });
  405. // }
  406. // showItem2();
  407. $(function () {
  408. var dateToday = new Date();
  409. //jQuery datepicker 設定限制日期最小最大 minDate maxDate hideIfNoPrevNext
  410. $(".datepicker").datepicker({
  411. //顯示上個月日期 及下個月日期 ,但是不可選的。
  412. //default:false
  413. showOtherMonths: true,
  414. // 設置當沒有上一個/下一個可選擇的情況下,隱藏掉相應的按鈕。(默認為不可用)
  415. //配合有設定最大最小時使用
  416. //default:false
  417. hideIfNoPrevNext: true,
  418. minDate: dateToday,
  419. // 設置一個最大的可選日期。可以是Date對象,或者是數字(從今天算起,例如+7),
  420. //或者有效的字符串('y'代表年, 'm'代表月, 'w'代表周, 'd'代表日, 例如:'+1m +7d')。
  421. });
  422. });