single.html 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="UTF-8">
  5. <meta name="viewport" content="width=device-width, initial-scale=1.0">
  6. <meta http-equiv="X-UA-Compatible" content="ie=edge, Chrome=1">
  7. <meta http-equiv="Cache-Control" content="no-cache">
  8. <title>ChoozMo Free PR Service 新聞發佈服務 | 集仕多</title>
  9. <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.0.2/dist/css/bootstrap.min.css" rel="stylesheet"
  10. integrity="sha384-EVSTQN3/azprG1Anm3QDgpJLIm9Nao0Yz1ztcQTwFspd3yD65VohhpuuCOmLASjC" crossorigin="anonymous">
  11. <link rel="stylesheet" href="//use.fontawesome.com/releases/v5.11.2/css/all.css">
  12. <link rel="stylesheet" href="/css/style.css">
  13. <style>
  14. /* 外層容器 */
  15. .container {
  16. width: 100%;
  17. overflow-x: auto;
  18. margin-bottom: 12px;
  19. font-weight: 500;
  20. }
  21. h1 {
  22. margin-bottom: 3rem;
  23. text-align: center;
  24. font-weight: bold;
  25. }
  26. /* 內容框架 */
  27. .form-wrapper {
  28. display: flex;
  29. flex-direction: column;
  30. gap: 24px;
  31. padding: 16px 0;
  32. border-radius: 8px;
  33. }
  34. /* 圖片上傳 */
  35. .upload-section {
  36. display: flex;
  37. flex-direction: column;
  38. margin-bottom: 16px;
  39. }
  40. .file-input {
  41. padding: 8px;
  42. font-size: 14px;
  43. border: 1px solid #ccc;
  44. border-radius: 6px;
  45. cursor: pointer;
  46. }
  47. /* .upload-section {
  48. width: 100%;
  49. }
  50. .file-input {
  51. display: none;
  52. }
  53. .upload-btn {
  54. color: #920783;
  55. background-color: #ffffff;
  56. border: 1px solid #920783;
  57. font-weight: 500;
  58. border-radius: 8px;
  59. font-size: 14px;
  60. padding: 10px 20px;
  61. margin-right: 8px;
  62. margin-bottom: 8px;
  63. transition: all 0.3s ease;
  64. cursor: pointer;
  65. }
  66. .upload-btn:hover {
  67. background-color: #920783;
  68. color: #ffffff;
  69. } */
  70. /* 圖片預覽 */
  71. .preview {
  72. margin-top: 8px;
  73. }
  74. .preview-img {
  75. max-height: 240px;
  76. object-fit: cover;
  77. border-radius: 8px;
  78. }
  79. /* 文字輸入 */
  80. .text-section {
  81. width: 100%;
  82. }
  83. .text-area {
  84. width: 100%;
  85. height: 160px;
  86. border: 1px solid #ccc;
  87. border-radius: 8px;
  88. padding: 12px;
  89. resize: none;
  90. font-size: 14px;
  91. transition: all 0.3s ease;
  92. }
  93. /* 選項 */
  94. .options {
  95. margin-top: 16px;
  96. }
  97. .options-title {
  98. margin-bottom: 8px;
  99. font-weight: 600;
  100. font-size: 1.25rem;
  101. }
  102. .option-item {
  103. display: block;
  104. cursor: pointer;
  105. margin-bottom: 4px;
  106. }
  107. /* 送出按鈕 */
  108. .submit-btn {
  109. display: flex;
  110. align-items: center;
  111. justify-content: center;
  112. gap: 8px;
  113. color: #ffffff;
  114. background-color: #920783;
  115. border: 1px solid transparent;
  116. font-weight: 500;
  117. border-radius: 8px;
  118. padding: 10px 50px;
  119. margin-right: 8px;
  120. margin-bottom: 8px;
  121. transition: all 0.3s ease;
  122. cursor: pointer;
  123. }
  124. .submit-btn:hover {
  125. background-color: #ffffff;
  126. color: #920783;
  127. border: 1px solid #920783;
  128. }
  129. .submit-btn:disabled {
  130. opacity: 0.6;
  131. cursor: not-allowed;
  132. }
  133. /* 讀取動畫 */
  134. .spinner {
  135. animation: spin 1s linear infinite;
  136. height: 20px;
  137. width: 20px;
  138. color: white;
  139. }
  140. .spinner-bg {
  141. opacity: 0.25;
  142. }
  143. .spinner-path {
  144. opacity: 0.75;
  145. }
  146. @keyframes spin {
  147. to {
  148. transform: rotate(360deg);
  149. }
  150. }
  151. .contact-input {
  152. display: flex;
  153. flex-direction: column;
  154. margin-bottom: 16px;
  155. }
  156. .contact-input input {
  157. padding: 10px 12px;
  158. border: 1px solid #ccc;
  159. border-radius: 6px;
  160. font-size: 14px;
  161. transition: all 0.3s ease;
  162. }
  163. .contact-input input:focus,
  164. .text-area:focus {
  165. outline: none;
  166. border-color: #920783;
  167. box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.2);
  168. }
  169. label span {
  170. color: red;
  171. }
  172. .bg-img {
  173. position: absolute;
  174. z-index: -1;
  175. top: -15vw;
  176. opacity: 0.5;
  177. }
  178. small {
  179. display: inline-block;
  180. color: #767676;
  181. font-weight: 600;
  182. }
  183. label {
  184. font-weight: 600;
  185. margin-bottom: 6px;
  186. }
  187. </style>
  188. <!-- Start of HubSpot Embed Code -->
  189. <!-- <script type="text/javascript" id="hs-script-loader" async defer src="//js-na1.hs-scripts.com/20485755.js"></script> -->
  190. <!-- End of HubSpot Embed Code -->
  191. <!-- Google Tag Manager -->
  192. <script>(function (w, d, s, l, i) {
  193. w[l] = w[l] || []; w[l].push({
  194. 'gtm.start':
  195. new Date().getTime(), event: 'gtm.js'
  196. }); var f = d.getElementsByTagName(s)[0],
  197. j = d.createElement(s), dl = l != 'dataLayer' ? '&l=' + l : ''; j.async = true; j.src =
  198. 'https://www.googletagmanager.com/gtm.js?id=' + i + dl; f.parentNode.insertBefore(j, f);
  199. })(window, document, 'script', 'dataLayer', 'GTM-MTWWP3G');</script>
  200. <!-- End Google Tag Manager -->
  201. <!-- Google tag (gtag.js) -->
  202. <script async src="https://www.googletagmanager.com/gtag/js?id=G-G5H9MMGQFM"></script>
  203. <script>
  204. window.dataLayer = window.dataLayer || [];
  205. function gtag() { dataLayer.push(arguments); }
  206. gtag('js', new Date());
  207. gtag('config', 'G-G5H9MMGQFM');
  208. </script>
  209. <!-- Global site tag (gtag.js) - Google Ads: 474336061 -->
  210. <script async src="https://www.googletagmanager.com/gtag/js?id=AW-474336061"></script>
  211. <script>
  212. window.dataLayer = window.dataLayer || [];
  213. function gtag() { dataLayer.push(arguments); }
  214. gtag('js', new Date());
  215. gtag('config', 'AW-474336061');
  216. </script>
  217. </head>
  218. <body>
  219. {{ partial "navbar.html" . }}
  220. <main id="media-release">
  221. <img src="/imgs/dm/ai-video/SaaS-08.webp" alt="" class="img-fluid bg-img">
  222. <div class="container my-5 py-5 position-relative">
  223. <form id="mediaForm" class="row g-3 justify-content-center mt-5">
  224. <h1 class="text-center mb-0">
  225. Free PR Service <br> <small>新聞發佈服務</small>
  226. </h1>
  227. <div class="col-md-8">
  228. <div class="contact-input mb-4">
  229. <label for="email">
  230. Email <span>(*) mandatory</span>
  231. <br> <small>電子郵件</small>
  232. </label>
  233. <input type="text" id="email" placeholder="Enter your email" />
  234. </div>
  235. <div class="contact-input mb-4">
  236. <label for="headline">
  237. News Headline <span>(*) mandatory</span> <br> <small>新聞標題</small>
  238. </label>
  239. <input type="text" id="headline" placeholder="Enter news headline" />
  240. </div>
  241. <div class="contact-input mb-4">
  242. <label for="contactId">LINE ID / WhatsApp ID</label>
  243. <input type="text" id="contactId" placeholder="Enter your LINE or WhatsApp ID" />
  244. </div>
  245. <div class="form-wrapper">
  246. <div class="text-section mb-2">
  247. <label for="newsText" class="form-label">News Content <span>(*) mandatory</span>
  248. <br><small>新聞內文</small></label>
  249. <textarea id="newsText" placeholder="Enter news content..." class="text-area"></textarea>
  250. </div>
  251. <div class="upload-section">
  252. <label for="fileInput">Select Image <span>(*) mandatory</span> <br><small>選擇圖片</small></label>
  253. <input type="file" id="fileInput" class="file-input" accept="image/*" />
  254. <div id="preview" class="preview"></div>
  255. <!-- <input type="file" id="fileInput" class="file-input" accept="image/*" />
  256. <button type="button" id="uploadBtn" class="upload-btn">Select Image <br> 選擇圖片 </button>
  257. <div id="preview" class="preview"></div> -->
  258. </div>
  259. </div>
  260. <!-- <div class="options">
  261. <p class="options-title mb-0">Publishing Platform (optional, multiple choices allowed)</p>
  262. <small class="mb-3">發佈平台(可多選,非必填)</small>
  263. <label class="option-item"><input type="checkbox" value="經濟日報網路版" />
  264. Economic Daily <br>
  265. <small class="ms-3">&nbsp;經濟日報網路版</small>
  266. </label>
  267. <label class="option-item"><input type="checkbox" value="工商時報網路版" /> Commercial Times <br>
  268. <small class="ms-3">&nbsp;工商時報網路版</small></label>
  269. <label class="option-item"><input type="checkbox" value="Yahoo 新聞" /> Yahoo News <br> <small
  270. class="ms-3">&nbsp;Yahoo
  271. 新聞</small></label>
  272. </div> -->
  273. <button type="button" id="submitBtn" class="submit-btn">
  274. <span>Submit <br> 送出</span>
  275. </button>
  276. </div>
  277. </form>
  278. <!-- <div class="content">
  279. {{ .Content }}
  280. </div> -->
  281. <!-- <div id="form">
  282. {{ partial "form-main.html" . }}
  283. </div> -->
  284. </div>
  285. </main>
  286. {{ partial "footer.html" . }}
  287. <script type="application/javascript">
  288. var doNotTrack = false;
  289. if (!doNotTrack) {
  290. (function (i, s, o, g, r, a, m) {
  291. i['GoogleAnalyticsObject'] = r; i[r] = i[r] || function () {
  292. (i[r].q = i[r].q || []).push(arguments)
  293. }, i[r].l = 1 * new Date(); a = s.createElement(o),
  294. m = s.getElementsByTagName(o)[0]; a.async = 1; a.src = g; m.parentNode.insertBefore(a, m)
  295. })(window, document, 'script', 'https://www.google-analytics.com/analytics.js', 'ga');
  296. ga('create', 'UA-153100602-5', 'auto');
  297. ga('send', 'pageview');
  298. }
  299. </script>
  300. <script src="https://cdn.jsdelivr.net/npm/@popperjs/core@2.9.2/dist/umd/popper.min.js"
  301. integrity="sha384-IQsoLXl5PILFhosVNubq5LC7Qb9DXgDA9i+tQ8Zj3iwWAwPtgFTxbJ8NT4GN1R8p"
  302. crossorigin="anonymous"></script>
  303. <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.0.2/dist/js/bootstrap.min.js"
  304. integrity="sha384-cVKIPhGWiC2Al4u+LWgxfKTRIcfu0JTxR+EQDz/bgldoEyl4H0zUF0QKbrJ0EcQF"
  305. crossorigin="anonymous"></script>
  306. <script src="https://cdn.jsdelivr.net/npm/sweetalert2@11"></script>
  307. <script>
  308. const fileInput = document.getElementById("fileInput");
  309. // const uploadBtn = document.getElementById("uploadBtn");
  310. const preview = document.getElementById("preview");
  311. const email = document.getElementById("email");
  312. const headline = document.getElementById("headline");
  313. const newsText = document.getElementById("newsText");
  314. const contactId = document.getElementById("contactId");
  315. const submitBtn = document.getElementById("submitBtn");
  316. const optionCheckboxes = document.querySelectorAll(".options input[type=checkbox]");
  317. let file = null;
  318. let fileName = "";
  319. let previewUrl = null;
  320. let isLoading = false;
  321. // // 觸發檔案選擇
  322. // uploadBtn.addEventListener("click", () => {
  323. // fileInput.click();
  324. // });
  325. // 選擇檔案後處理
  326. fileInput.addEventListener("change", (e) => {
  327. const f = e.target.files[0];
  328. if (f) {
  329. file = f;
  330. previewUrl = URL.createObjectURL(f);
  331. fileName = f.name;
  332. preview.innerHTML = `<img src="${previewUrl}" class="preview-img" />`;
  333. // uploadBtn.textContent = fileName;
  334. }
  335. });
  336. // 送出表單
  337. submitBtn.addEventListener("click", async () => {
  338. console.log('送出表單');
  339. if (isLoading) return;
  340. // 檢查檔案
  341. if (!file) {
  342. Swal.fire({
  343. title: "請上傳圖片",
  344. icon: "warning",
  345. confirmButtonColor: "#910784",
  346. });
  347. return;
  348. }
  349. // 檢查標題
  350. if (!headline.value.trim()) {
  351. Swal.fire({
  352. title: "請輸入新聞標題",
  353. icon: "warning",
  354. confirmButtonColor: "#910784",
  355. });
  356. return;
  357. }
  358. // 檢查文字
  359. if (!newsText.value.trim()) {
  360. Swal.fire({
  361. title: "請輸入新聞稿文字",
  362. icon: "warning",
  363. confirmButtonColor: "#910784",
  364. });
  365. return;
  366. }
  367. // 檢查信箱
  368. if (!email.value.trim()) {
  369. Swal.fire({
  370. title: "請輸入 Email",
  371. icon: "warning",
  372. confirmButtonColor: "#910784",
  373. });
  374. return;
  375. }
  376. // 取得勾選選項
  377. const selectedOptions = Array.from(optionCheckboxes)
  378. .filter(cb => cb.checked)
  379. .map(cb => cb.value);
  380. isLoading = true;
  381. submitBtn.disabled = true;
  382. submitBtn.textContent = "處理中...";
  383. const formData = new FormData();
  384. formData.append("email", email.value);
  385. formData.append("image", file);
  386. formData.append("text", newsText.value);
  387. formData.append("title", headline.value);
  388. formData.append("contact_id", contactId.value);
  389. selectedOptions.forEach(opt => formData.append("options", opt));
  390. try {
  391. const response = await fetch("https://cmm.ai:10001/auth/add_form_record", {
  392. method: "POST",
  393. body: formData
  394. });
  395. const result = await response.json();
  396. console.log("handleSubmit", result);
  397. Swal.fire({
  398. title: "送出成功!",
  399. icon: "success",
  400. confirmButtonColor: "#910784",
  401. }).then(() => {
  402. // 清空欄位
  403. file = null;
  404. previewUrl = null;
  405. fileName = "";
  406. preview.innerHTML = "";
  407. email.value = "";
  408. headline.value = "";
  409. newsText.value = "";
  410. contactId.value = "";
  411. optionCheckboxes.forEach(cb => cb.checked = false);
  412. // uploadBtn.textContent = "選擇圖片";
  413. });
  414. } catch (error) {
  415. console.error("error", error);
  416. } finally {
  417. isLoading = false;
  418. submitBtn.disabled = false;
  419. submitBtn.innerHTML = "<span>Submit <br> 送出</span>";
  420. }
  421. });
  422. </script>
  423. </body>
  424. </html>