Browse Source

Merge branch 'master' of http://121.42.53.174:3000/luyanan/plat-admin

luyanan 6 years ago
parent
commit
38d70f9080
3 changed files with 8 additions and 247 deletions
  1. 0 1
      src/router/index.js
  2. 8 2
      src/views/dashboard/admin/index.vue
  3. 0 244
      src/views/findPwd/index.vue

+ 0 - 1
src/router/index.js

@ -26,7 +26,6 @@ import Layout from '../views/layout/Layout'
26 26
27 27
export const constantRouterMap = [
28 28
  { path: '/login', component: () => import('@/views/login/index'), hidden: true },
29
  { path: '/findPwd', component: () => import('@/views/findPwd/index'), hidden: true },
30 29
  { path: '/404', component: () => import('@/views/404'), hidden: true },
31 30
  {
32 31
    path: '/',

+ 8 - 2
src/views/dashboard/admin/index.vue

@ -1,14 +1,20 @@
1 1
<template>
2 2
  <div class="dashboard-editor-container">
3 3
    <div>
4
      <p class="plat-tit">科袖科技条件平台_后台管理系统欢迎您</p>
4
      <p class="plat-tit">{{name}}科袖科技条件平台_后台管理系统欢迎您</p>
5 5
    </div>
6 6
  </div>
7 7
</template>
8 8
9 9
<script>
10
import { mapGetters } from 'vuex'
10 11
export default {
11
  name: 'dashboard-admin'
12
  name: 'dashboard-admin',
13
  computed: {
14
    ...mapGetters([
15
      'name'
16
    ])
17
  }
12 18
}
13 19
</script>
14 20

+ 0 - 244
src/views/findPwd/index.vue

@ -1,244 +0,0 @@
1
<template>
2
  <div class="logo-container login-container">
3
    <div class="logo-wrapper"></div>
4
    <div class="form-wrapper">
5
      <div class="form-contain login-form">
6
        <h3 class="title">找回密码</h3>
7
        <div class="step-wrapper">
8
          <el-steps :active="stepVal" finish-status="success" align-center>
9
            <el-step title="输入手机号"></el-step>
10
            <el-step title="重置密码"></el-step>
11
          </el-steps>
12
        </div>
13
14
        <div class="step-contain">
15
          <el-form v-show="stepFisrt" :model="ruleForm" :rules="rules" ref="ruleForm" class="demo-ruleForm">
16
            <el-form-item prop="phoneNum">
17
              <el-input v-model="ruleForm.phoneNum" placeholder="请输入您的手机号码"></el-input>
18
            </el-form-item>
19
            <el-form-item prop="msgVC">
20
              <el-input v-model="ruleForm.msgVC" placeholder="请输入短信验证码" class="code-btn" style="width:100%">
21
                <el-button slot="append" type="primary" :disabled="phoneCodeBol" @click="clickMsgVcLogin">
22
                  <span v-if="sendMsgDisabled">{{seconds + '秒后获取'}}</span>
23
                  <span v-if="!sendMsgDisabled">获取验证码</span>
24
                </el-button>
25
             </el-input>
26
            </el-form-item>
27
            <el-form-item>
28
              <el-button class="log-btn" type="primary" :disabled="isDisabl" @click="nextStep('ruleForm')">下一步</el-button>
29
            </el-form-item>
30
            <el-form-item class="el-form-find">
31
              <el-button type="text" @click="goLogin">又想起来了</el-button>
32
            </el-form-item>
33
          </el-form>
34
          <el-form v-show="stepSecond" :model="ruleForm2" :rules="rules2" ref="ruleForm2" class="demo-ruleForm">
35
            <el-form-item prop="pass">
36
              <el-input type="password" v-model="ruleForm2.pass" placeholder="请设置您的新密码" auto-complete="off"></el-input>
37
            </el-form-item>
38
            <el-form-item prop="checkPass">
39
              <el-input type="password" v-model="ruleForm2.checkPass" placeholder="请再次输入密码确认" auto-complete="off"></el-input>
40
            </el-form-item>
41
            <el-form-item>
42
              <el-button class="log-btn" type="primary" :disabled="isDisabl" @click.native.prevent="resetPwd('ruleForm2')">重置密码</el-button>
43
            </el-form-item>
44
          </el-form>
45
        </div>
46
      </div>
47
    </div>
48
  </div>
49
</template>
50
51
<script>
52
  import { isReg, getResetMsgPhone, resetPwdByTel } from '@/api/login'
53
  import '@/styles/loginform.scss'
54
55
  export default {
56
    data() {
57
      var validPhone = (rule, value, callback) => {
58
        const reg = /^1[3|4|5|7|8][0-9]\d{8}$/
59
        if (!value) {
60
          callback(new Error('请输入您的手机号码'))
61
        } else if (!reg.test(value)) {
62
          callback(new Error('请输入正确的手机号码'))
63
        } else {
64
          callback()
65
        }
66
      }
67
      var validatePass = (rule, value, callback) => {
68
        if (value === '') {
69
          callback(new Error('请设置您的新密码'))
70
        } else if (value.length < 6 || value.length > 24) {
71
          callback(new Error('密码由6-24个字符组成,区分大小写'))
72
        } else {
73
          if (this.ruleForm2.checkPass !== '') {
74
            this.$refs.ruleForm2.validateField('checkPass')
75
          }
76
          callback()
77
        }
78
      }
79
      var validatePass2 = (rule, value, callback) => {
80
        if (value === '') {
81
          callback(new Error('请再次输入密码确认'))
82
        } else if (value !== this.ruleForm2.pass) {
83
          callback(new Error('两次输入密码不一致,请重新输入!'))
84
        } else {
85
          callback()
86
        }
87
      }
88
      return {
89
        phoneCodeBol: false,
90
        sendMsgDisabled: false,
91
        seconds: 60,
92
        platId: '',
93
        resetStepNum: '',
94
        resetCode: '',
95
        stepVal: 0,
96
        stepFisrt: true,
97
        stepSecond: false,
98
        isDisabl: false,
99
        ruleForm: {
100
          phoneNum: '',
101
          msgVC: ''
102
        },
103
        rules: {
104
          phoneNum: [
105
            { required: true, validator: validPhone, trigger: 'blur' }
106
          ],
107
          msgVC: [
108
            { required: true, message: '请输入短信验证码', trigger: 'blur' }
109
          ]
110
        },
111
        ruleForm2: {
112
          pass: '',
113
          checkPass: ''
114
        },
115
        rules2: {
116
          pass: [
117
            { validator: validatePass, trigger: 'blur' }
118
          ],
119
          checkPass: [
120
            { validator: validatePass2, trigger: 'blur' }
121
          ]
122
        }
123
      }
124
    },
125
    methods: {
126
      nextStep(formName) {
127
        this.$refs[formName].validate((valid) => {
128
          if (valid) {
129
            this.stepFisrt = false
130
            this.stepSecond = true
131
            this.stepVal = 1
132
          } else {
133
            return false
134
          }
135
        })
136
      },
137
      userRegisterOk() {
138
        const me = this
139
        const account = this.ruleForm.phoneNum
140
        isReg({ account }).then(res => {
141
          if (res.success) {
142
            if (res.data === true) {
143
              me.sendMsgDisabled = false
144
              me.phoneCodeBol = false
145
              me.$message({
146
                message: '该账号不存在,请检查后重试',
147
                type: 'warning'
148
              })
149
            } else {
150
              me.getResetMsgPhone()
151
              me.sendMsgDisabled = true
152
              me.phoneCodeBol = true
153
              const interval = window.setInterval(function() {
154
                if ((me.seconds--) <= 0) {
155
                  me.seconds = 60
156
                  me.sendMsgDisabled = false
157
                  me.phoneCodeBol = false
158
                  window.clearInterval(interval)
159
                }
160
              }, 1000)
161
            }
162
          }
163
        })
164
      },
165
      getResetMsgPhone() {
166
        const me = this
167
        const account = this.ruleForm.phoneNum
168
        const checkExists = true
169
        getResetMsgPhone({ account, checkExists }).then((res) => {
170
          if (!res.success) {
171
            if (res.code === -60000) {
172
              me.sendMsgDisabled = false
173
              me.phoneCodeBol = false
174
              me.$message({
175
                message: '该账号不存在,请检查后重试',
176
                type: 'warning'
177
              })
178
            } else {
179
              me.$message({
180
                message: res.detailMsg,
181
                type: 'warning'
182
              })
183
            }
184
          }
185
        })
186
      },
187
      clickMsgVcLogin() {
188
        const reg = /^1[3|4|5|7|8][0-9]\d{8}$/
189
        if (!this.ruleForm.phoneNum) {
190
          this.$message({
191
            message: '请输入你的手机号码',
192
            type: 'warning'
193
          })
194
        } else if (!reg.test(this.ruleForm.phoneNum)) {
195
          this.$message({
196
            message: '请输入正确的手机号码',
197
            type: 'warning'
198
          })
199
        } else {
200
          this.userRegisterOk()
201
        }
202
      },
203
      resetPwd(formName) {
204
        this.$refs[formName].validate((valid) => {
205
          if (valid) {
206
            resetPwdByTel(this.ruleForm2.pass, this.ruleForm.msgVC).then((res) => {
207
              if (res.success) {
208
                this.$alert('密码已重置,快去登录吧!', '提示', {
209
                  confirmButtonText: '确定',
210
                  type: 'success',
211
                  center: true,
212
                  callback: action => {
213
                    if (action === 'confirm') {
214
                      this.$router.push({ path: '/login' })
215
                    }
216
                  }
217
                })
218
              } else {
219
                this.$alert('密码重置失败!', '提示', {
220
                  confirmButtonText: '重新找回密码',
221
                  type: 'warning',
222
                  center: true,
223
                  callback: action => {
224
                    if (action === 'confirm') {
225
                      this.stepFisrt = true
226
                      this.stepSecond = false
227
                      this.stepVal = 0
228
                    }
229
                  }
230
                })
231
                return
232
              }
233
            })
234
          } else {
235
            return false
236
          }
237
        })
238
      },
239
      goLogin() {
240
        this.$router.push({ path: '/login' })
241
      }
242
    }
243
  }
244
</script>