Hanye官网
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318
  1. <template>
  2. <div>
  3. <div class="w-full h-[55px] sm:h-[72px]"></div>
  4. <ErrorBoundary :error="error">
  5. <div v-if="isLoading" class="flex justify-center py-12">
  6. <div
  7. class="animate-spin h-8 w-8 border-4 border-blue-500 rounded-full border-t-transparent"
  8. ></div>
  9. </div>
  10. <div v-else>
  11. <div class="max-w-full xl:px-2 lg:px-2 md:px-4 px-4 mt-6 mb-20">
  12. <div class="max-w-screen-2xl mx-auto">
  13. <nuxt-link
  14. to="/"
  15. class="justify-start text-white/60 text-base font-normal"
  16. >ホーム</nuxt-link
  17. >
  18. <span class="text-white/60 text-base font-normal px-2"> / </span>
  19. <nuxt-link to="/contact" class="text-white text-base font-normal"
  20. >お問い合わせ</nuxt-link
  21. >
  22. </div>
  23. </div>
  24. <div
  25. class="max-w-full mb-12 md:mb-20 lg:mb-32 xl:px-2 lg:px-2 md:px-4 px-4"
  26. >
  27. <div class="max-w-screen-2xl mx-auto">
  28. <div class="w-full grid grid-cols-1 md:grid-cols-2 gap-8">
  29. <!-- 联系表单 -->
  30. <div
  31. class="bg-zinc-900 rounded-lg p-8 transition-all duration-300 hover:bg-zinc-800 hover:shadow-lg"
  32. >
  33. <div class="text-white text-3xl font-medium mb-6">
  34. お問い合わせフォーム
  35. </div>
  36. <form
  37. @submit.prevent="handleSubmit"
  38. class="flex flex-col gap-6"
  39. >
  40. <div class="relative">
  41. <input
  42. v-model="form.name"
  43. type="text"
  44. id="name"
  45. class="peer block w-full appearance-none bg-transparent border-0 border-b-2 px-1 pt-5 pb-2 text-base text-gray-100 focus:outline-none focus:ring-0 placeholder-transparent transition-colors duration-300 focus:border-b-[3px] border-gray-600 focus:border-blue-500"
  46. placeholder="お名前を入力してください"
  47. required
  48. />
  49. <label
  50. for="name"
  51. class="absolute left-1 top-5 origin-[0] -translate-y-4 scale-75 transform text-sm duration-300 peer-placeholder-shown:translate-y-0 peer-placeholder-shown:scale-100 peer-focus:-translate-y-4 peer-focus:scale-75 peer-focus:font-medium text-gray-400 peer-focus:text-blue-400"
  52. >
  53. お名前
  54. </label>
  55. </div>
  56. <div class="relative">
  57. <input
  58. v-model="form.email"
  59. type="email"
  60. id="email"
  61. class="peer block w-full appearance-none bg-transparent border-0 border-b-2 px-1 pt-5 pb-2 text-base text-gray-100 focus:outline-none focus:ring-0 placeholder-transparent transition-colors duration-300 focus:border-b-[3px] border-gray-600 focus:border-blue-500"
  62. placeholder="メールアドレスを入力してください"
  63. required
  64. />
  65. <label
  66. for="email"
  67. class="absolute left-1 top-5 origin-[0] -translate-y-4 scale-75 transform text-sm duration-300 peer-placeholder-shown:translate-y-0 peer-placeholder-shown:scale-100 peer-focus:-translate-y-4 peer-focus:scale-75 peer-focus:font-medium text-gray-400 peer-focus:text-blue-400"
  68. >
  69. メールアドレス
  70. </label>
  71. </div>
  72. <div class="relative">
  73. <textarea
  74. v-model="form.message"
  75. id="message"
  76. class="peer block w-full appearance-none bg-transparent border-0 border-b-2 px-1 pt-5 pb-2 text-base text-gray-100 focus:outline-none focus:ring-0 placeholder-transparent h-36 resize-none transition-colors duration-300 focus:border-b-[3px] border-gray-600 focus:border-blue-500"
  77. placeholder="お問い合わせ内容を入力してください"
  78. required
  79. ></textarea>
  80. <label
  81. for="message"
  82. class="absolute left-1 top-5 origin-[0] -translate-y-4 scale-75 transform text-sm duration-300 peer-placeholder-shown:translate-y-0 peer-placeholder-shown:scale-100 peer-focus:-translate-y-4 peer-focus:scale-75 peer-focus:font-medium text-gray-400 peer-focus:text-blue-400"
  83. >
  84. お問い合わせ内容
  85. </label>
  86. </div>
  87. <!-- 验证码部分 -->
  88. <div class="relative pt-2">
  89. <div class="flex items-center space-x-3">
  90. <div class="flex-grow relative">
  91. <input
  92. type="text"
  93. id="captcha"
  94. v-model="captcha.userInput.value"
  95. class="peer block w-full appearance-none bg-transparent border-0 border-b-2 px-1 pt-5 pb-2 text-base text-gray-100 focus:outline-none focus:ring-0 placeholder-transparent transition-colors duration-300 focus:border-b-[3px]"
  96. :class="[
  97. captcha.error.value
  98. ? 'border-red-500 focus:border-red-500'
  99. : 'border-gray-600 focus:border-blue-500',
  100. ]"
  101. placeholder="验证码"
  102. required
  103. autocomplete="off"
  104. aria-describedby="captcha-error"
  105. :aria-invalid="captcha.error.value ? 'true' : 'false'"
  106. />
  107. <label
  108. for="captcha"
  109. class="absolute left-1 top-5 origin-[0] -translate-y-4 scale-75 transform text-sm duration-300 peer-placeholder-shown:translate-y-0 peer-placeholder-shown:scale-100 peer-focus:-translate-y-4 peer-focus:scale-75 peer-focus:font-medium"
  110. :class="[
  111. captcha.error.value
  112. ? 'text-red-400 peer-focus:text-red-400'
  113. : 'text-gray-400 peer-focus:text-blue-400',
  114. ]"
  115. >
  116. 验证码
  117. </label>
  118. </div>
  119. <div
  120. class="flex-shrink-0 cursor-pointer select-none rounded-md overflow-hidden transition-all duration-200 ease-in-out hover:shadow-md active:scale-100"
  121. v-html="captcha.captchaSvg.value"
  122. @click="captcha.generateCaptcha()"
  123. title="刷新验证码"
  124. style="line-height: 0"
  125. ></div>
  126. <button
  127. type="button"
  128. @click="captcha.generateCaptcha()"
  129. class="flex-shrink-0 p-2 text-gray-500 hover:text-blue-400 focus:outline-none focus-visible:ring-2 focus-visible:ring-blue-500 focus-visible:ring-offset-2 focus-visible:ring-offset-gray-800 rounded-full hover:bg-gray-700/50 transition-all duration-200 ease-in-out"
  130. aria-label="刷新验证码"
  131. title="刷新验证码"
  132. >
  133. <svg
  134. xmlns="http://www.w3.org/2000/svg"
  135. class="h-5 w-5"
  136. fill="none"
  137. viewBox="0 0 24 24"
  138. stroke="currentColor"
  139. stroke-width="2"
  140. >
  141. <path
  142. stroke-linecap="round"
  143. stroke-linejoin="round"
  144. d="M4 4v5h.582m15.356 2A8.001 8.001 0 004.582 9m0 0H9m11 11v-5h-.581m0 0a8.003 8.003 0 01-15.357-2m15.357 2H15"
  145. />
  146. </svg>
  147. </button>
  148. </div>
  149. <p
  150. v-if="captcha.error.value"
  151. id="captcha-error"
  152. class="mt-1.5 text-xs text-red-400 sm:text-sm"
  153. >
  154. {{ captcha.error.value }}
  155. </p>
  156. </div>
  157. <button
  158. type="submit"
  159. class="bg-gradient-to-r from-blue-700 to-blue-400 text-white text-base font-normal py-4 px-8 rounded-lg transition-all duration-300 hover:scale-105 hover:shadow-lg"
  160. :disabled="isSubmitting"
  161. >
  162. {{ isSubmitting ? "送信中..." : "送信する" }}
  163. </button>
  164. </form>
  165. </div>
  166. <!-- 公司信息和营业时间 -->
  167. <div class="flex flex-col gap-8">
  168. <div
  169. class="bg-zinc-900 rounded-lg p-8 transition-all duration-300 hover:bg-zinc-800 hover:shadow-lg"
  170. >
  171. <div class="text-white text-3xl font-medium mb-6">
  172. 会社情報
  173. </div>
  174. <div class="flex flex-col gap-4">
  175. <div class="flex items-center gap-4">
  176. <div class="text-white/60 text-base font-normal">
  177. 会社名
  178. </div>
  179. <div class="text-white text-base font-normal">
  180. 株式会社ハニエ
  181. </div>
  182. </div>
  183. <div class="flex items-center gap-4">
  184. <div class="text-white/60 text-base font-normal">
  185. 所在地
  186. </div>
  187. <div class="text-white text-base font-normal">
  188. 〒123-4567 東京都渋谷区神宮前1-1-1
  189. </div>
  190. </div>
  191. <div class="flex items-center gap-4">
  192. <div class="text-white/60 text-base font-normal">
  193. 電話番号
  194. </div>
  195. <div class="text-white text-base font-normal">
  196. 03-1234-5678
  197. </div>
  198. </div>
  199. <div class="flex items-center gap-4">
  200. <div class="text-white/60 text-base font-normal">
  201. メールアドレス
  202. </div>
  203. <div class="text-white text-base font-normal">
  204. info@hanye.co.jp
  205. </div>
  206. </div>
  207. </div>
  208. </div>
  209. <div
  210. class="bg-zinc-900 rounded-lg p-8 transition-all duration-300 hover:bg-zinc-800 hover:shadow-lg"
  211. >
  212. <div class="text-white text-3xl font-medium mb-6">
  213. 営業時間
  214. </div>
  215. <div class="flex flex-col gap-4">
  216. <div class="flex items-center gap-4">
  217. <div class="text-white/60 text-base font-normal">
  218. 平日
  219. </div>
  220. <div class="text-white text-base font-normal">
  221. 9:00 - 18:00
  222. </div>
  223. </div>
  224. <div class="flex items-center gap-4">
  225. <div class="text-white/60 text-base font-normal">
  226. 土曜日
  227. </div>
  228. <div class="text-white text-base font-normal">
  229. 9:00 - 17:00
  230. </div>
  231. </div>
  232. <div class="flex items-center gap-4">
  233. <div class="text-white/60 text-base font-normal">
  234. 日曜日・祝日
  235. </div>
  236. <div class="text-white text-base font-normal">休業</div>
  237. </div>
  238. </div>
  239. </div>
  240. </div>
  241. </div>
  242. </div>
  243. </div>
  244. </div>
  245. </ErrorBoundary>
  246. </div>
  247. </template>
  248. <script setup lang="ts">
  249. /**
  250. * 联系页面
  251. * 展示公司信息和联系表单
  252. */
  253. import { useErrorHandler } from "~/composables/useErrorHandler";
  254. import { useCaptcha } from "~/composables/useCaptcha";
  255. const { error, isLoading, wrapAsync } = useErrorHandler();
  256. const captcha = useCaptcha();
  257. const isSubmitting = ref(false);
  258. const submitSuccess = ref(false);
  259. const form = ref({
  260. name: "",
  261. email: "",
  262. message: "",
  263. });
  264. /**
  265. * 处理表单提交
  266. */
  267. async function handleSubmit() {
  268. isSubmitting.value = true;
  269. submitSuccess.value = false;
  270. try {
  271. await wrapAsync(async () => {
  272. // 验证验证码
  273. if (!captcha.validateCaptcha()) {
  274. return;
  275. }
  276. // TODO: 实现表单提交逻辑
  277. await new Promise((resolve) => setTimeout(resolve, 1000));
  278. form.value = {
  279. name: "",
  280. email: "",
  281. message: "",
  282. };
  283. captcha.generateCaptcha(); // 成功后刷新验证码
  284. submitSuccess.value = true;
  285. return { success: true };
  286. });
  287. } finally {
  288. isSubmitting.value = false;
  289. }
  290. }
  291. // SEO优化
  292. useHead({
  293. title: "联系我们 - Hanye",
  294. meta: [
  295. {
  296. name: "description",
  297. content: "联系我们,获取更多产品信息和支持。",
  298. },
  299. ],
  300. });
  301. </script>
  302. <style scoped>
  303. /* 移除之前的 focus 样式,因为现在使用 border-b 样式 */
  304. </style>