修改登录注册

This commit is contained in:
熊丽君
2021-08-10 08:39:03 +08:00
parent c2939eeb11
commit 7a48bed10c
3 changed files with 33 additions and 18 deletions

View File

@ -1,4 +1,4 @@
import { login, logout, getInfo } from '@/api/login';
import { login, register, logout, getInfo } from '@/api/login';
import { getToken, setToken, removeToken } from '@/utils/auth';
const user = {

View File

@ -162,16 +162,19 @@ export default {
this.getCity(true, data);
}
}
getLabelSetting({ companyId: data.companyId || 1 }).then(({ data }) => {
this.labelList = data;
this.arr = data.map(item =>
item.labelList
? item.labelList.filter(v => v.isHas)[0]
? item.labelList.filter(v => v.isHas)[0].id
: ''
: undefined
);
});
// data.companyId || 1;
getLabelSetting({ companyId: data ? data.companyId : 1 }).then(
({ data }) => {
this.labelList = data;
this.arr = data.map(item =>
item.labelList
? item.labelList.filter(v => v.isHas)[0]
? item.labelList.filter(v => v.isHas)[0].id
: ''
: undefined
);
}
);
});
},
// 地级市切换

View File

@ -135,11 +135,13 @@
:class="mode ? '' : 'flex-end'"
style="padding:0 0 15px"
>
<el-checkbox v-if="mode">记住密码</el-checkbox>
<el-button type="text" @click="mode = false" v-if="mode"
<el-checkbox v-if="mode" v-model="loginForm.rememberMe"
>记住密码</el-checkbox
>
<el-button type="text" @click="changeMethod(false)" v-if="mode"
>验证码登录</el-button
>
<el-button type="text" @click="mode = true" v-else
<el-button type="text" @click="changeMethod(true)" v-else
>密码登录</el-button
>
</div>
@ -152,7 +154,7 @@
>登录</el-button
>
</el-form>
<el-checkbox style="padding:15px 0 0"
<el-checkbox style="padding:15px 0 0" v-model="loginForm.flag"
>我已阅读并同意<el-button type="text"
>用户协议</el-button
></el-checkbox
@ -185,9 +187,11 @@ export default {
count: '', // 初始化次数
timer: null,
loginForm: {
username: '19855383805',
password: '123456',
rememberMe: false
// 19855383805
username: '',
password: '',
rememberMe: false,
flag: false
},
loginRules: {
username: [
@ -211,6 +215,10 @@ export default {
this.getCookie();
},
methods: {
changeMethod(flag) {
this.mode = flag;
this.loginForm.password = '';
},
getCookie() {
const username = Cookies.get('username');
const password = Cookies.get('password');
@ -245,6 +253,8 @@ export default {
});
},
handleLogin() {
if (!this.loginForm.flag)
return this.msgError('请您阅读并同意《用户协议》');
this.$refs.loginForm.validate(valid => {
if (valid) {
this.loading = true;
@ -272,6 +282,7 @@ export default {
this.loading = false;
});
} else {
// 验证码登录
this.$store
.dispatch('Register', this.loginForm)
.then(() => {
@ -437,6 +448,7 @@ $loginForm: 383px;
padding: 0 5px;
display: flex;
justify-content: space-between;
align-items: center;
}
}
}