StepSecurity.vue 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122
  1. <template>
  2. <div class="f-main">
  3. <div class="content-top">
  4. <p>更换管理员</p>
  5. <a href="javascript:void(0)" class="back" @click="jump('select')"><i class="el-icon-back"></i></a>
  6. </div>
  7. <div class="f-form">
  8. <div class="page-part">
  9. <p class="security">密保问题一:<span v-text="info[0].question"></span></p>
  10. </div>
  11. <div class="page-part">
  12. <mt-field placeholder="请填写答案一"
  13. :state="state.answer1"
  14. @blur.native.capture="validAnswer1"
  15. v-model="valid.answer1"></mt-field>
  16. </div>
  17. <div class="page-part">
  18. <p class="security">密保问题二:<span v-text="info[1].question"></span></p>
  19. </div>
  20. <div class="page-part">
  21. <mt-field placeholder="请填写答案二"
  22. :state="state.answer2"
  23. @blur.native.capture="validAnswer2"
  24. v-model="valid.answer2"></mt-field>
  25. </div>
  26. <div class="page-part">
  27. <mt-button size="large" type="primary" @click="sureAccount('new')">下一步</mt-button>
  28. </div>
  29. </div>
  30. </div>
  31. </template>
  32. <script>
  33. export default {
  34. name: 'step-security',
  35. props: ['info'],
  36. data () {
  37. return {
  38. state: {
  39. answer1: 'error',
  40. answer2: 'error'
  41. },
  42. valid: {
  43. answer1: '',
  44. answer2: ''
  45. },
  46. questions: '',
  47. token: ''
  48. }
  49. },
  50. mounted () {
  51. this.$nextTick(() => {
  52. this.loadIssue()
  53. })
  54. },
  55. methods: {
  56. jump (type) {
  57. this.$emit('stepEvent', type)
  58. },
  59. // 警告弹窗
  60. downToast (type) {
  61. this.$toast({
  62. message: type,
  63. iconClass: 'el-icon-warning'
  64. })
  65. },
  66. // 验证密保答案一
  67. validAnswer1 () {
  68. if (!this.valid.answer1) {
  69. this.downToast('请填写问题一的正确答案')
  70. this.state.answer1 = 'error'
  71. } else {
  72. this.state.answer1 = 'success'
  73. }
  74. },
  75. // 验证密保答案二
  76. validAnswer2 () {
  77. if (!this.valid.answer2) {
  78. this.downToast('请填写问题二的正确答案')
  79. this.state.answer2 = 'error'
  80. } else {
  81. this.state.answer2 = 'success'
  82. }
  83. },
  84. sureAccount (type) {
  85. if (this.state.answer1 !== 'success' || this.state.answer2 !== 'success') {
  86. this.downToast('请确认填写部分是否有误')
  87. } else {
  88. this.$indicator.open('验证过程中...')
  89. let param = new FormData()
  90. let answer = []
  91. answer.push({'answer': this.valid.answer1, sort: this.info[0].sort, id: this.info[0].id}, {
  92. 'answer': this.valid.answer2, sort: this.info[1].sort, id: this.info[1].id
  93. })
  94. let answers = JSON.stringify(answer)
  95. param.append('answers', answers)
  96. let config = {
  97. headers: {'Content-Type': 'multipart/form-data'}
  98. }
  99. this.$http.post(`/sso/change/admin/check/question`, param, config)
  100. .then(response => {
  101. this.$indicator.close()
  102. if (response.data.success) {
  103. this.$emit('stepEvent', type)
  104. this.$emit('tokenEvent', response.data.content.token)
  105. } else {
  106. this.downToast(response.data.errMsg)
  107. }
  108. }).catch((err) => {
  109. this.$indicator.close()
  110. this.downToast(err.errMsg)
  111. })
  112. }
  113. }
  114. }
  115. }
  116. </script>
  117. <style scoped type="text/scss" lang="scss">
  118. </style>