index.vue 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151
  1. <template>
  2. <view class="container">
  3. <view class="back-btn" @click="backToBefore()">
  4. <u-icon name="arrow-left" color="#fff" size="20" customStyle="margin:0 auto"></u-icon>
  5. <text class="back-text">验证邮箱</text>
  6. </view>
  7. <view class="change-content">
  8. <view class="pass-item">
  9. <view class="pass-item-name">电子邮箱</view>
  10. <input type="text" class="pass-item-content" v-model="emailAddress" />
  11. </view>
  12. </view>
  13. <view class="confirm-btn" @click="confirmEmail()">发送验证码</view>
  14. </view>
  15. </template>
  16. <script setup>
  17. import {
  18. ref
  19. } from "vue";
  20. import {
  21. getCheckcode
  22. } from '@/api/login';
  23. function backToBefore() {
  24. uni.navigateBack({})
  25. };
  26. let emailAddress = ref(null)
  27. function confirmEmail() {
  28. let reg = /^([a-zA-Z\d][\w-]{2,})@(\w{2,})\.([a-z]{2,})(\.[a-z]{2,})?$/;
  29. let isValid = reg.test(emailAddress.value)
  30. if (!isValid) {
  31. return uni.showToast({
  32. title: "邮箱格式不正确",
  33. icon: "error",
  34. duration: 2000
  35. })
  36. }
  37. getCheckcode({
  38. email: emailAddress.value
  39. }).then(res => {
  40. if (res.code === 200) {
  41. uni.navigateTo({
  42. url: `/pages/login/changePass/index?login=done&email=${emailAddress.value}`
  43. })
  44. }
  45. })
  46. }
  47. </script>
  48. <style lang="scss" scoped>
  49. page {
  50. height: 100%;
  51. background-color: #EAF0FA;
  52. }
  53. .container {
  54. position: relative;
  55. width: 100%;
  56. height: 100%;
  57. background: linear-gradient(180deg, #1869F6 0%, #EAF0FA 64%, #EAF0FA 100%);
  58. .back-btn {
  59. position: absolute;
  60. top: 8%;
  61. left: 4%;
  62. display: flex;
  63. font-size: 40rpx;
  64. font-weight: 500;
  65. color: #FFF;
  66. .back-text {
  67. margin-left: 28rpx;
  68. }
  69. }
  70. .change-content {
  71. position: absolute;
  72. top: 226rpx;
  73. left: 4%;
  74. width: 92%;
  75. height: 118rpx;
  76. padding: 19rpx 28rpx;
  77. box-sizing: border-box;
  78. background-color: #fff;
  79. border-radius: 40rpx;
  80. .pass-item {
  81. display: flex;
  82. align-items: center;
  83. justify-content: space-between;
  84. width: 100%;
  85. height: 80rpx;
  86. font-size: 32rpx;
  87. font-weight: 400;
  88. color: #9E9E9E;
  89. .pass-item-name {
  90. flex: 2;
  91. }
  92. .pass-item-content {
  93. flex: 6;
  94. text-align: right;
  95. font-size: 32rpx;
  96. color: #343437;
  97. }
  98. .pass-item-icon {
  99. flex: 1;
  100. height: 100%;
  101. line-height: 80rpx;
  102. text-align: right;
  103. image {
  104. width: 36rpx;
  105. height: 28rpx;
  106. }
  107. }
  108. .pass-item-hide {
  109. image {
  110. width: 36rpx;
  111. height: 18rpx;
  112. }
  113. }
  114. }
  115. }
  116. .confirm-btn {
  117. position: absolute;
  118. top: 396rpx;
  119. left: 4%;
  120. width: 92%;
  121. height: 84rpx;
  122. line-height: 84rpx;
  123. font-size: 36rpx;
  124. color: #fff;
  125. text-align: center;
  126. background: #1869F6;
  127. border-radius: 16rpx;
  128. }
  129. }
  130. </style>