| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122 |
- <template>
- <div class="f-main">
- <div class="content-top">
- <p>更换管理员</p>
- <a href="javascript:void(0)" class="back" @click="jump('select')"><i class="el-icon-back"></i></a>
- </div>
- <div class="f-form">
- <div class="page-part">
- <p class="security">密保问题一:<span v-text="info[0].question"></span></p>
- </div>
- <div class="page-part">
- <mt-field placeholder="请填写答案一"
- :state="state.answer1"
- @blur.native.capture="validAnswer1"
- v-model="valid.answer1"></mt-field>
- </div>
- <div class="page-part">
- <p class="security">密保问题二:<span v-text="info[1].question"></span></p>
- </div>
- <div class="page-part">
- <mt-field placeholder="请填写答案二"
- :state="state.answer2"
- @blur.native.capture="validAnswer2"
- v-model="valid.answer2"></mt-field>
- </div>
- <div class="page-part">
- <mt-button size="large" type="primary" @click="sureAccount('new')">下一步</mt-button>
- </div>
- </div>
- </div>
- </template>
- <script>
- export default {
- name: 'step-security',
- props: ['info'],
- data () {
- return {
- state: {
- answer1: 'error',
- answer2: 'error'
- },
- valid: {
- answer1: '',
- answer2: ''
- },
- questions: '',
- token: ''
- }
- },
- mounted () {
- this.$nextTick(() => {
- this.loadIssue()
- })
- },
- methods: {
- jump (type) {
- this.$emit('stepEvent', type)
- },
- // 警告弹窗
- downToast (type) {
- this.$toast({
- message: type,
- iconClass: 'el-icon-warning'
- })
- },
- // 验证密保答案一
- validAnswer1 () {
- if (!this.valid.answer1) {
- this.downToast('请填写问题一的正确答案')
- this.state.answer1 = 'error'
- } else {
- this.state.answer1 = 'success'
- }
- },
- // 验证密保答案二
- validAnswer2 () {
- if (!this.valid.answer2) {
- this.downToast('请填写问题二的正确答案')
- this.state.answer2 = 'error'
- } else {
- this.state.answer2 = 'success'
- }
- },
- sureAccount (type) {
- if (this.state.answer1 !== 'success' || this.state.answer2 !== 'success') {
- this.downToast('请确认填写部分是否有误')
- } else {
- this.$indicator.open('验证过程中...')
- let param = new FormData()
- let answer = []
- answer.push({'answer': this.valid.answer1, sort: this.info[0].sort, id: this.info[0].id}, {
- 'answer': this.valid.answer2, sort: this.info[1].sort, id: this.info[1].id
- })
- let answers = JSON.stringify(answer)
- param.append('answers', answers)
- let config = {
- headers: {'Content-Type': 'multipart/form-data'}
- }
- this.$http.post(`/sso/change/admin/check/question`, param, config)
- .then(response => {
- this.$indicator.close()
- if (response.data.success) {
- this.$emit('stepEvent', type)
- this.$emit('tokenEvent', response.data.content.token)
- } else {
- this.downToast(response.data.errMsg)
- }
- }).catch((err) => {
- this.$indicator.close()
- this.downToast(err.errMsg)
- })
- }
- }
- }
- }
- </script>
- <style scoped type="text/scss" lang="scss">
- </style>
|