EncryptedNew.vue 11 KB

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