_index.html 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534
  1. <!doctype html>
  2. <html lang="{{ .Lang }}">
  3. <head>
  4. {{ partial "head" . }}
  5. <link rel="canonical" href="{{ .Permalink }}">
  6. <title>
  7. {{ block "title" . }}
  8. {{ .Title}}{{ if ne .Title .Site.Title }} | {{ .Site.Title }}{{ end }}
  9. {{ end }}
  10. </title>
  11. <!-- Bootstrap CSS -->
  12. <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/5.1.3/css/bootstrap.min.css"
  13. integrity="sha512-GQGU0fMMi238uA+a/bdWJfpUGKUkBdgfFdgBm72SUQ6BeyWjoY/ton0tEjH+OSH9iP4Dfh+7HM0I9f5eR0L/4w=="
  14. crossorigin="anonymous" referrerpolicy="no-referrer" />
  15. <link href='{{ "css/style.css" | relURL }}' rel="stylesheet">
  16. <style>
  17. .container {
  18. width: 100%;
  19. margin-bottom: 12px;
  20. font-weight: 500;
  21. }
  22. h1 {
  23. margin-bottom: 3rem;
  24. text-align: center;
  25. font-weight: bold;
  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: 500;
  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: var(--sub-color);
  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. text-decoration: none;
  124. }
  125. .submit-btn:hover {
  126. background-color: #ffffff;
  127. color: var(--sub-color);
  128. border: 1px solid var(--sub-color);
  129. }
  130. .submit-btn:disabled {
  131. opacity: 0.6;
  132. cursor: not-allowed;
  133. }
  134. /* 讀取動畫 */
  135. .spinner {
  136. animation: spin 1s linear infinite;
  137. height: 20px;
  138. width: 20px;
  139. color: white;
  140. }
  141. .spinner-bg {
  142. opacity: 0.25;
  143. }
  144. .spinner-path {
  145. opacity: 0.75;
  146. }
  147. @keyframes spin {
  148. to {
  149. transform: rotate(360deg);
  150. }
  151. }
  152. .contact-input {
  153. display: flex;
  154. flex-direction: column;
  155. margin-bottom: 16px;
  156. }
  157. .contact-input input {
  158. padding: 10px 12px;
  159. border: 1px solid #ccc;
  160. border-radius: 6px;
  161. font-size: 14px;
  162. transition: all 0.3s ease;
  163. }
  164. .contact-input input:focus,
  165. .text-area:focus {
  166. outline: none;
  167. border-color: var(--sub-color);
  168. box-shadow: none;
  169. }
  170. label span {
  171. color: red;
  172. }
  173. .bg-img {
  174. position: absolute;
  175. z-index: -1;
  176. top: -15vw;
  177. opacity: 0.5;
  178. }
  179. small {
  180. display: inline-block;
  181. color: #767676;
  182. font-weight: 500;
  183. }
  184. label {
  185. font-weight: 500;
  186. margin-bottom: 6px;
  187. }
  188. .title {
  189. color: var(--sub-color);
  190. text-align: center;
  191. }
  192. </style>
  193. {{ range .AlternativeOutputFormats -}}
  194. <link rel="{{ .Rel }}" type="{{ .MediaType.Type }}" href="{{ .Permalink | safeURL }}">
  195. {{ end -}}
  196. </head>
  197. <body>
  198. {{ block "header" . }}
  199. {{ partial "header" . }}
  200. {{ end }}
  201. <div class="container my-5 py-5 position-relative">
  202. <h1 class="text-center mb-0">
  203. Free PR Service <br> <small>新聞發布服務</small>
  204. </h1>
  205. <div class="row g-3 justify-content-center mt-5">
  206. <div class="col-md-11">
  207. <div class="d-flex flex-column align-items-center mb-5">
  208. <h2 class="title">🎤 免費新聞發布,讓您的品牌被更多人看見</h2>
  209. <p class="lead mt-3 text-center">
  210. 0 成本把您的產品、活動與品牌故事,<b>一鍵發布至新聞平台</b>,直達媒體與潛在客戶,輕鬆獲得曝光與關注!<br>
  211. 只要填寫以下表單,我們協助您<span style="white-space:nowrap;">潤稿 × 發布</span>,加速上稿與曝光。
  212. </p>
  213. <div class="row g-4 mb-5 py-3">
  214. <!-- 免費&省時 -->
  215. <div class="col-12 col-md-6 col-lg-3">
  216. <div class="card h-100 shadow-sm border-0">
  217. <div class="card-body text-center">
  218. <div class="fs-1 mb-3">⏱️</div>
  219. <h5 class="card-title">免費&省時</h5>
  220. <p class="card-text">填表 2 分鐘,其他交給我們。</p>
  221. </div>
  222. </div>
  223. </div>
  224. <!-- 專人協助 -->
  225. <div class="col-12 col-md-6 col-lg-3">
  226. <div class="card h-100 shadow-sm border-0">
  227. <div class="card-body text-center">
  228. <div class="fs-1 mb-3">🙋</div>
  229. <h5 class="card-title">專人協助</h5>
  230. <p class="card-text">整理重點、統一格式,提升可讀與採用率。</p>
  231. </div>
  232. </div>
  233. </div>
  234. <!-- 快速擴散 -->
  235. <div class="col-12 col-md-6 col-lg-3">
  236. <div class="card h-100 shadow-sm border-0">
  237. <div class="card-body text-center">
  238. <div class="fs-1 mb-3">📢</div>
  239. <h5 class="card-title">快速擴散</h5>
  240. <p class="card-text">依主題分類投遞至合適媒體/平台,提高被看見的機會。</p>
  241. </div>
  242. </div>
  243. </div>
  244. <!-- 彈性主題 -->
  245. <div class="col-12 col-md-6 col-lg-3">
  246. <div class="card h-100 shadow-sm border-0">
  247. <div class="card-body text-center">
  248. <div class="fs-1 mb-3">✨</div>
  249. <h5 class="card-title">彈性主題</h5>
  250. <p class="card-text">新品上市、活動/展覽、里程碑公告、合作/募資、招募訊息…</p>
  251. </div>
  252. </div>
  253. </div>
  254. </div>
  255. <!-- <ul class="my-5" aria-label="服務重點">
  256. <li><strong>免費&省時:</strong>填表 2 分鐘,其他交給我們。</li>
  257. <li><strong>專人協助:</strong>整理重點、統一格式,提升可讀與採用率。</li>
  258. <li><strong>快速擴散:</strong>依主題分類投遞至合適媒體/平台,提高被看見的機會。</li>
  259. <li><strong>彈性主題:</strong>新品上市、活動/展覽、里程碑公告、合作/募資、招募訊息…</li>
  260. </ul> -->
  261. <a href="#prForm" class="submit-btn" aria-label="前往表單填寫,開始免費發布">👉 立即填寫,免費發布</a>
  262. <small class="subtle">提交後,我們將盡快與您確認新聞稿並安排發布。</small>
  263. </div>
  264. </div>
  265. <div class="col-md-8">
  266. <form id="prForm" class="pt-5">
  267. <div class="contact-input mb-4">
  268. <label for="email">
  269. Email <span>(*) mandatory</span>
  270. <br> <small>電子郵件</small>
  271. </label>
  272. <input type="text" id="email" placeholder="Enter your email" />
  273. </div>
  274. <div class="contact-input mb-4">
  275. <label for="headline">
  276. News Headline <span>(*) mandatory</span> <br> <small>新聞標題</small>
  277. </label>
  278. <input type="text" id="headline" placeholder="Enter news headline" />
  279. </div>
  280. <div class="contact-input mb-4">
  281. <label for="contactId">LINE ID / WhatsApp ID</label>
  282. <input type="text" id="contactId" placeholder="Enter your LINE or WhatsApp ID" />
  283. </div>
  284. <div class="form-wrapper">
  285. <div class="text-section mb-2">
  286. <label for="newsText" class="form-label">News Content <span>(*) mandatory</span>
  287. <br><small>新聞內文</small></label>
  288. <textarea id="newsText" placeholder="Enter news content..." class="text-area"></textarea>
  289. </div>
  290. <div class="upload-section">
  291. <label for="fileInput">Select Image <span>(*) mandatory</span> <br><small>選擇圖片</small></label>
  292. <input type="file" id="fileInput" class="file-input" accept="image/*" />
  293. <div id="preview" class="preview"></div>
  294. <!-- <input type="file" id="fileInput" class="file-input" accept="image/*" />
  295. <button type="button" id="uploadBtn" class="upload-btn">Select Image <br> 選擇圖片 </button>
  296. <div id="preview" class="preview"></div> -->
  297. </div>
  298. </div>
  299. <!-- <div class="options">
  300. <p class="options-title mb-0">Publishing Platform (optional, multiple choices allowed)</p>
  301. <small class="mb-3">發布平台(可多選,非必填)</small>
  302. <label class="option-item"><input type="checkbox" value="經濟日報網路版" />
  303. Economic Daily <br>
  304. <small class="ms-3">&nbsp;經濟日報網路版</small>
  305. </label>
  306. <label class="option-item"><input type="checkbox" value="工商時報網路版" /> Commercial Times <br>
  307. <small class="ms-3">&nbsp;工商時報網路版</small></label>
  308. <label class="option-item"><input type="checkbox" value="Yahoo 新聞" /> Yahoo News <br> <small
  309. class="ms-3">&nbsp;Yahoo
  310. 新聞</small></label>
  311. </div> -->
  312. <div class="d-flex justify-content-center">
  313. <button type="button" id="submitBtn" class="submit-btn">
  314. <span>Submit <br> 送出</span>
  315. </button>
  316. </div>
  317. </form>
  318. </div>
  319. <!-- <div class="col-md-8">
  320. <section class="mt-5 py-5 bg-light">
  321. <div class="container text-center">
  322. <h3 class="fw-bold mb-4">Case Studies <br> <small class="mt-1">新聞發布案例</small></h3>
  323. <a href="https://drive.google.com/drive/folders/1n0uWt_VSQ_B8S8UZD5cf9i9L6x4dGKHu?usp=sharing"
  324. target="_blank" class="btn btn-lg px-4 fw-bold" style="background-color:#ea5413; color:#fff;">
  325. Explore Case Studies <br> <small class="text-white">查看案例集</small>
  326. </a>
  327. </div>
  328. </section>
  329. </div> -->
  330. </div>
  331. </div>
  332. {{ block "footer" . }}
  333. {{ partial "footer" . }}
  334. {{ end }}
  335. <!-- Bootstrap and Popper -->
  336. <script src="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/5.1.3/js/bootstrap.bundle.min.js"
  337. integrity="sha512-pax4MlgXjHEPfCwcJLQhigY7+N8rt6bVvWLFyUMuxShv170X53TRzGPmPkZmGBhk+jikR8WBM4yl7A9WMHHqvg=="
  338. crossorigin="anonymous" referrerpolicy="no-referrer"></script>
  339. <script src="https://cdn.jsdelivr.net/npm/sweetalert2@11"></script>
  340. <script>
  341. const fileInput = document.getElementById("fileInput");
  342. // const uploadBtn = document.getElementById("uploadBtn");
  343. const preview = document.getElementById("preview");
  344. const email = document.getElementById("email");
  345. const headline = document.getElementById("headline");
  346. const newsText = document.getElementById("newsText");
  347. const contactId = document.getElementById("contactId");
  348. const submitBtn = document.getElementById("submitBtn");
  349. const optionCheckboxes = document.querySelectorAll(".options input[type=checkbox]");
  350. let file = null;
  351. let fileName = "";
  352. let previewUrl = null;
  353. let isLoading = false;
  354. // // 觸發檔案選擇
  355. // uploadBtn.addEventListener("click", () => {
  356. // fileInput.click();
  357. // });
  358. // 選擇檔案後處理
  359. fileInput.addEventListener("change", (e) => {
  360. const f = e.target.files[0];
  361. if (f) {
  362. file = f;
  363. previewUrl = URL.createObjectURL(f);
  364. fileName = f.name;
  365. preview.innerHTML = `<img src="${previewUrl}" class="preview-img" />`;
  366. // uploadBtn.textContent = fileName;
  367. }
  368. });
  369. // 送出表單
  370. submitBtn.addEventListener("click", async () => {
  371. console.log('送出表單');
  372. if (isLoading) return;
  373. // 檢查檔案
  374. if (!file) {
  375. Swal.fire({
  376. title: "請上傳圖片",
  377. icon: "warning",
  378. confirmButtonColor: "#910784",
  379. });
  380. return;
  381. }
  382. // 檢查標題
  383. if (!headline.value.trim()) {
  384. Swal.fire({
  385. title: "請輸入新聞標題",
  386. icon: "warning",
  387. confirmButtonColor: "#910784",
  388. });
  389. return;
  390. }
  391. // 檢查文字
  392. if (!newsText.value.trim()) {
  393. Swal.fire({
  394. title: "請輸入新聞稿文字",
  395. icon: "warning",
  396. confirmButtonColor: "#910784",
  397. });
  398. return;
  399. }
  400. // 檢查信箱
  401. if (!email.value.trim()) {
  402. Swal.fire({
  403. title: "請輸入 Email",
  404. icon: "warning",
  405. confirmButtonColor: "#910784",
  406. });
  407. return;
  408. }
  409. // 取得勾選選項
  410. const selectedOptions = Array.from(optionCheckboxes)
  411. .filter(cb => cb.checked)
  412. .map(cb => cb.value);
  413. isLoading = true;
  414. submitBtn.disabled = true;
  415. submitBtn.textContent = "處理中...";
  416. const formData = new FormData();
  417. formData.append("email", email.value);
  418. formData.append("image", file);
  419. formData.append("text", newsText.value);
  420. formData.append("title", headline.value);
  421. formData.append("contact_id", contactId.value);
  422. selectedOptions.forEach(opt => formData.append("options", opt));
  423. try {
  424. const response = await fetch("https://cmm.ai:10001/auth/add_form_record", {
  425. method: "POST",
  426. body: formData
  427. });
  428. const result = await response.json();
  429. console.log("handleSubmit", result);
  430. Swal.fire({
  431. title: "送出成功!",
  432. icon: "success",
  433. confirmButtonColor: "#e47140",
  434. }).then(() => {
  435. // 清空欄位
  436. file = null;
  437. previewUrl = null;
  438. fileName = "";
  439. preview.innerHTML = "";
  440. email.value = "";
  441. headline.value = "";
  442. newsText.value = "";
  443. contactId.value = "";
  444. optionCheckboxes.forEach(cb => cb.checked = false);
  445. // uploadBtn.textContent = "選擇圖片";
  446. });
  447. } catch (error) {
  448. console.error("error", error);
  449. } finally {
  450. isLoading = false;
  451. submitBtn.disabled = false;
  452. submitBtn.innerHTML = "<span>Submit <br> 送出</span>";
  453. }
  454. });
  455. </script>
  456. <script src="/js/main.js"></script>
  457. </body>
  458. </html>