EmailStepNew.vue 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423
  1. <template>
  2. <div class="validation">
  3. <div class="container">
  4. <div class="content">
  5. <div class="content-top">
  6. <h3>验证邮箱</h3>
  7. <div class="step">
  8. <img src="/images/all/step02.png" alt=""/>
  9. <div class="step-item"><span class="active">账号验证</span><span class="active">新邮箱地址</span><span>设置完成</span></div>
  10. </div>
  11. </div>
  12. <div class="content-bottom">
  13. <div>
  14. <el-form :model="valid2" :rules="rules2" ref="valid2" label-width="100px" class="demo-ruleForm">
  15. <el-form-item prop="email">
  16. <el-input v-model="valid2.email"
  17. v-bind:class="{ active: emailSecondExit }"
  18. placeholder="新邮箱地址"></el-input>
  19. <span class="tip tip-mobile" v-show="emailSecondExit">该邮箱已被注册</span>
  20. </el-form-item>
  21. <el-form-item>
  22. <a class="btn finish"
  23. v-show="!sendEmailSuccess"
  24. :disabled="!emailSecondChecked"
  25. @click="sendVerificationRequest">发送验证请求</a>
  26. <a class="btn finish"
  27. v-show="sendEmailSuccess"
  28. :disabled="sendEmailSuccess">已发送验证邮件,请查收</a>
  29. </el-form-item>
  30. </el-form>
  31. </div>
  32. </div>
  33. </div>
  34. <loading v-show="isShowLoading"/>
  35. </div>
  36. </div>
  37. </template>
  38. <script>
  39. import Loading from '~components/common/loading/Loading.vue'
  40. export default {
  41. name: 'validation',
  42. components: {
  43. Loading
  44. },
  45. props: ['tokenId'],
  46. data () {
  47. // 第二步验证邮箱
  48. var validateSecondEmail = (rule, value, callback) => {
  49. if (value === '') {
  50. callback(new Error('请填写正确的邮箱号'))
  51. this.emailSecondChecked = false
  52. this.emailSecondExit = false
  53. } else {
  54. if (this.valid2.email !== '') {
  55. var reg = /^([\w-])+(\.\w+)*@([\w-])+((\.\w{2,3}){1,3})$/
  56. if (!reg.test(value)) {
  57. callback(new Error('请填写正确的邮箱号'))
  58. this.emailSecondChecked = false
  59. this.emailSecondExit = false
  60. } else {
  61. this.$http.get(`/update/user/email/hasRegister`, {params: {email: this.valid2.email}})
  62. .then(response => {
  63. if (response.data.content.hasRegister) {
  64. this.emailSecondChecked = false
  65. this.emailSecondExit = true
  66. } else {
  67. this.emailSecondChecked = true
  68. this.emailSecondExit = false
  69. }
  70. })
  71. }
  72. }
  73. callback()
  74. }
  75. }
  76. return {
  77. isShowLoading: false,
  78. sendEmailSuccess: false,
  79. emailSecondChecked: false,
  80. emailSecondExit: false,
  81. valid2: {
  82. email: ''
  83. },
  84. rules2: {
  85. email: [
  86. {validator: validateSecondEmail, trigger: 'blur'}
  87. ]
  88. }
  89. }
  90. },
  91. methods: {
  92. // 设置新邮箱
  93. sendVerificationRequest () {
  94. if (this.emailSecondChecked) {
  95. this.isShowLoading = true
  96. this.$http.get(`/update/user/setEmail`, {params: {email: this.valid2.email, token: this.tokenId ? this.tokenId : this.$route.query.token, url: window.location.href}})
  97. .then(response => {
  98. this.isShowLoading = false
  99. if (response.data.success) {
  100. this.sendEmailSuccess = true
  101. } else {
  102. this.sendEmailSuccess = false
  103. return Promise.reject(response.data)
  104. }
  105. }).catch(err => {
  106. this.isShowLoading = false
  107. this.$message.error(err.errMsg)
  108. })
  109. }
  110. }
  111. }
  112. }
  113. </script>
  114. <style lang="scss" scoped>
  115. .validation {
  116. margin: 0 auto;
  117. width: 100%;
  118. background: #eee;
  119. .container{
  120. padding-top: 50px;
  121. margin: 0 auto;
  122. width: 980px;
  123. text-align: center;
  124. .content{
  125. padding: 0 50px;
  126. margin: 50px auto 0;
  127. width: 100%;
  128. /*height: 540px;*/
  129. text-align: center;
  130. background: #fff;
  131. .content-top{
  132. height: 80px;
  133. line-height: 80px;
  134. h3{
  135. margin-bottom: 0;
  136. font-size: 24px;
  137. color: #000;
  138. border-bottom: 1px solid #dcdcdc;
  139. }
  140. .step{
  141. position: relative;
  142. margin-top: 10px;
  143. img{
  144. width: 315px;
  145. height: 46px;
  146. }
  147. .step-item{
  148. position: absolute;
  149. top: 45px;
  150. left: 265px;
  151. span{
  152. margin-right: 78px;
  153. font-size: 14px;
  154. color: #b4b4b4;
  155. }
  156. span.active {
  157. color: #0076ad;
  158. }
  159. }
  160. }
  161. }
  162. form {
  163. margin-top: 150px;
  164. padding-bottom: 44px;
  165. input{
  166. padding: 0 0 0 18px;
  167. width: 360px;
  168. height: 44px;
  169. line-height: 44px;
  170. font-size: 14px;
  171. color: #000;
  172. border-radius: 0;
  173. }
  174. input.answer {
  175. background: url("/images/all/more.png") no-repeat 325px center;
  176. cursor: pointer;
  177. }
  178. ul{
  179. display: none;
  180. position: absolute;
  181. top: 44px;
  182. left: 0;
  183. width: 360px;
  184. background: #fff;
  185. box-shadow: 0 0 5px rgba(0,0,0,.5);
  186. -moz-box-shadow: 0 0 5px rgba(0,0,0,.5);
  187. -o-box-shadow: 0 0 5px rgba(0,0,0,.5);
  188. -webkit-box-shadow: 0 0 5px rgba(0,0,0,.5);
  189. z-index: 10;
  190. li{
  191. padding-left: 18px;
  192. width: 100%;
  193. height: 30px;
  194. line-height: 30px;
  195. text-align: left;
  196. font-size: 14px;
  197. color: #000;
  198. cursor: pointer;
  199. &:hover{
  200. background: #0076ad;
  201. color: #fff;
  202. }
  203. }
  204. }
  205. span.tip{
  206. position: absolute;
  207. top: 0;
  208. right: -238px;
  209. font-size: 13px;
  210. color: #8c8c8c;
  211. a{
  212. font-size: 13px;
  213. color: #0076ad;
  214. }
  215. }
  216. span.tip.tip-mobile{
  217. top: 3px;
  218. right: -105px;
  219. color: #ff4949;
  220. font-size: 12px;
  221. }
  222. span.tip.codeError-tip{
  223. position: absolute;
  224. top: 3px;
  225. left: 378px;
  226. width: 200px;
  227. text-align: left;
  228. color: #ff4949;
  229. font-size: 12px;
  230. }
  231. i{
  232. position: absolute;
  233. top: 13px;
  234. left: 20px;
  235. font-size: 20px;
  236. color: #a0a0a0;
  237. }
  238. .btn {
  239. margin: 34px 0 16px 0;
  240. width: 360px;
  241. height: 44px;
  242. line-height: 44px;
  243. font-size: 16px;
  244. color: #fff;
  245. background: #0076AD;
  246. border-radius: 3px;
  247. }
  248. }
  249. .content-bottom{
  250. margin: 155px auto 0;
  251. padding-bottom: 50px;
  252. width: 360px;
  253. div.warp{
  254. padding-bottom: 65px;
  255. }
  256. p{
  257. font-size: 24px;
  258. color: #323232;
  259. img{
  260. margin-right: 20px;
  261. width: 30px;
  262. height: 28px;
  263. }
  264. }
  265. p.pass{
  266. font-size: 24px;
  267. color: #e77405;
  268. img{
  269. height: 30px;
  270. }
  271. }
  272. p.passed {
  273. color: #2ab300;
  274. img{
  275. height: 30px;
  276. }
  277. }
  278. span{
  279. display: inline-block;
  280. font-size: 14px;
  281. color: #8b8b8b;
  282. }
  283. span.close-tip{
  284. margin: 15px 0 140px 0;
  285. }
  286. .close-btn{
  287. margin: 0 auto;
  288. width: 200px;
  289. height: 36px;
  290. line-height: 36px;
  291. font-size: 14px;
  292. text-align: center;
  293. color: #323232;
  294. border: 1px solid #d2d2d2;
  295. border-radius: 3px;
  296. cursor: pointer ;
  297. }
  298. span.use{
  299. display: inline-block;
  300. margin-bottom: 30px;
  301. width: 360px;
  302. font-size: 14px;
  303. color: #000;
  304. text-align: left;
  305. em{
  306. font-size: 14px;
  307. font-style: normal;
  308. color: #000;
  309. }
  310. }
  311. .form-group {
  312. margin: 0 auto 16px;
  313. position: relative;
  314. width: 360px;
  315. height: 44px;
  316. line-height: 44px;
  317. input{
  318. padding: 0 0 0 18px;
  319. width: 360px;
  320. height: 44px;
  321. line-height: 44px;
  322. font-size: 14px;
  323. color: #000;
  324. border-radius: 0;
  325. }
  326. input.msg{
  327. float: left;
  328. width: 210px;
  329. padding: 0 0 0 18px;
  330. height: 44px;
  331. line-height: 44px;
  332. font-size: 14px;
  333. color: #000;
  334. border-radius: 0;
  335. }
  336. span.msg{
  337. float: right;
  338. margin: 0;
  339. width: 130px;
  340. height: 44px;
  341. line-height: 44px;
  342. text-align: center ;
  343. font-size: 14px;
  344. color: #5a5a5a;
  345. background: #f4f4f4;
  346. border: 1px solid #dcdcdc;
  347. cursor: pointer;
  348. }
  349. span.msg.send{
  350. background: #d2d2d2;
  351. color: #fff;
  352. }
  353. }
  354. .btn {
  355. margin: 34px 0 10px 0;
  356. width: 360px;
  357. height: 44px;
  358. line-height: 44px;
  359. font-size: 16px;
  360. color: #fff;
  361. background: #0076AD;
  362. border-radius: 3px;
  363. }
  364. }
  365. .choose{
  366. margin: 155px auto 0;
  367. padding-bottom: 44px;
  368. div{
  369. padding: 0 15px;
  370. margin: 0 auto 16px;
  371. width: 360px;
  372. height: 60px;
  373. line-height: 60px;
  374. text-align: left;
  375. overflow: hidden;
  376. border: 1px solid #d2d2d2;
  377. cursor: pointer;
  378. &:hover,&.active{
  379. border-color: #0076ad;
  380. span{
  381. color: #0076ad;
  382. }
  383. i.second {
  384. color: #0076ad;
  385. }
  386. }
  387. img.first{
  388. float: left;
  389. margin: 24px 20px 0 0;
  390. font-size: 20px;
  391. color: #323232;
  392. }
  393. img.first.mob{
  394. margin: 22px 20px 0 5px;
  395. font-size: 28px;
  396. }
  397. i.second {
  398. float: right;
  399. margin: 20px 0 0 5px;
  400. font-size: 20px;
  401. color: #323232;
  402. }
  403. span{
  404. float: left;
  405. font-size: 14px;
  406. color: #323232;
  407. }
  408. }
  409. }
  410. a.return{
  411. position: absolute;
  412. left: 0;
  413. top: -15px;
  414. img{
  415. width: 34px !important;
  416. height: 34px !important;
  417. }
  418. }
  419. }
  420. }
  421. }
  422. </style>