PhoneStepSecurity.vue 13 KB

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