|
@@ -24,11 +24,11 @@
|
|
|
label-width="100px"
|
|
|
class="demo-ruleForm"
|
|
|
>
|
|
|
- <el-form-item prop="phoneNum">
|
|
|
+ <el-form-item prop="userName">
|
|
|
<el-input
|
|
|
- type="phoneNum"
|
|
|
- placeholder="手机号码"
|
|
|
- v-model="ruleForm2.phoneNum"
|
|
|
+ type="userName"
|
|
|
+ placeholder="用户名"
|
|
|
+ v-model="ruleForm2.userName"
|
|
|
auto-complete="off"
|
|
|
></el-input>
|
|
|
</el-form-item>
|
|
@@ -75,9 +75,9 @@ export default {
|
|
|
data () {
|
|
|
var validateUser = (rule, value, callback) => {
|
|
|
if (!value) {
|
|
|
- return callback(new Error('手机号码不能为空'))
|
|
|
+ return callback(new Error('用户名不能为空'))
|
|
|
} else if (value.length < 3) {
|
|
|
- callback(new Error('手机号码不合法'))
|
|
|
+ callback(new Error('用户名不合法'))
|
|
|
} else {
|
|
|
callback()
|
|
|
}
|
|
@@ -97,11 +97,11 @@ export default {
|
|
|
fullscreenLoading: false,
|
|
|
checked: true,
|
|
|
ruleForm2: {
|
|
|
- phoneNum: '',
|
|
|
+ userName: '',
|
|
|
pass: ''
|
|
|
},
|
|
|
rules2: {
|
|
|
- phoneNum: [
|
|
|
+ userName: [
|
|
|
{
|
|
|
validator: validateUser,
|
|
|
trigger: 'blur'
|
|
@@ -118,16 +118,17 @@ export default {
|
|
|
},
|
|
|
|
|
|
mounted () {
|
|
|
- this.ruleForm2.phoneNum = window.localStorage.getItem('cjt_phoneNum') || ''
|
|
|
+ this.ruleForm2.userName = window.localStorage.getItem('cjt_userName') || ''
|
|
|
this.ruleForm2.pass = window.localStorage.getItem('cjt_pass') || ''
|
|
|
},
|
|
|
methods: {
|
|
|
async login () {
|
|
|
- let {phoneNum, pass} = this.ruleForm2
|
|
|
+ let {userName, pass} = this.ruleForm2
|
|
|
this.fullscreenLoading = true
|
|
|
- let res = await this.$http.post('/api/sso/user/login', {
|
|
|
- phoneNum,
|
|
|
- password: encodeStr(Base64.encode(pass)),
|
|
|
+ let res = await this.$http.post('/admin/login', {
|
|
|
+ userName,
|
|
|
+ // password: encodeStr(Base64.encode(pass)),
|
|
|
+ password: pass,
|
|
|
})
|
|
|
this.fullscreenLoading = false
|
|
|
if (res.code === 0) {
|
|
@@ -135,12 +136,12 @@ export default {
|
|
|
window.localStorage.setItem('cjt_token', data.token)
|
|
|
if (this.checked) {
|
|
|
window.localStorage.setItem(
|
|
|
- 'cjt_phoneNum',
|
|
|
- phoneNum
|
|
|
+ 'cjt_userName',
|
|
|
+ userName
|
|
|
)
|
|
|
window.localStorage.setItem('cjt_pass', pass)
|
|
|
} else {
|
|
|
- window.localStorage.setItem('cjt_phoneNum', '')
|
|
|
+ window.localStorage.setItem('cjt_userName', '')
|
|
|
window.localStorage.setItem('cjt_pass', '')
|
|
|
}
|
|
|
this.$router.push('/list')
|