EmailStepNew.vue 12 KB

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