index.vue 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. <script lang='ts' setup>
  2. import { submitSubscribeApi } from '~/api/model/common'
  3. const form = ref<any>({
  4. mail: '',
  5. })
  6. async function submitSubscribe() {
  7. try {
  8. await submitSubscribeApi(form.value)
  9. ElMessage.success(`You've subscribed successfully.`)
  10. form.value.mail = ''
  11. }
  12. catch (error) {
  13. console.log(error)
  14. }
  15. }
  16. const validateEmail = computed(() => {
  17. const emailReg = /^[\w-]+(\.[\w-]+)*@[\w-]+(\.[\w-]+)+$/
  18. if (!form.value.mail)
  19. return true
  20. return emailReg.test(form.value.mail)
  21. })
  22. </script>
  23. <template>
  24. <div>
  25. <div class="pt-184px pb-50px bg-#F3F4FB text-center">
  26. <h2 class="text-60px fw-800 ls-2 text-#333 inline-block pos-relative">
  27. EJET Spark <span class="custom-title-bg">Blog</span>
  28. <img src="@/assets/images/blog_icon05.png" class="w-90px h-90px pos-absolute top--10px left--120px" alt="" srcset="">
  29. <img src="@/assets/images/blog_icon06.png" class="w-70px h-70px pos-absolute top--20px right--100px" alt="" srcset="">
  30. </h2>
  31. <div class="pos-relative w-500px mx-auto mb-60px mt-40px">
  32. <el-input v-model.trim="form.mail" class="custom-input h-46px !b-rd-200px overflow-hidden" placeholder="Please enter your email address" />
  33. <el-button :disabled="!validateEmail || !form.mail" type="primary" class="!bg-#9B6CFF text-#fff pos-absolute !b-0px top-50% transform-translate-y--50% right-10px w-140px !text-16px !b-rd-150px" @click="submitSubscribe">
  34. Subscribe
  35. </el-button>
  36. </div>
  37. </div>
  38. <AppFooter />
  39. </div>
  40. </template>
  41. <style lang='less' scoped>
  42. .custom-title-bg{
  43. position: relative;
  44. display: inline-block;
  45. background: url(~/assets/images/title_bg03.png);
  46. background-repeat: no-repeat;
  47. background-position: 88% 150%;
  48. background-size: 94% auto;
  49. }
  50. ::v-deep(.custom-input){
  51. .el-input__wrapper{
  52. border-radius:4px!important;
  53. padding: 7px 10px!important;
  54. color: #999;
  55. font-size: 16px;
  56. box-shadow: unset!important;
  57. }
  58. }
  59. </style>