优化代码

pull/6/head
nineven 4 years ago
parent 664c79dedf
commit 23016487fe
  1. 6
      fir_client/src/components/FirLogin.vue
  2. 2
      fir_ser/api/views/login.py

@ -62,7 +62,7 @@
<el-button type="danger" @click="onSubmit">登录</el-button> <el-button type="danger" @click="onSubmit">登录</el-button>
</el-form-item> </el-form-item>
<el-form-item> <el-form-item v-if="register_enable">
<el-button type="primary" @click="onRegister" plain>注册</el-button> <el-button type="primary" @click="onRegister" plain>注册</el-button>
</el-form-item> </el-form-item>
</el-form> </el-form>
@ -92,7 +92,8 @@
activeName: 'username', activeName: 'username',
allow_ways: {}, allow_ways: {},
rutitle: '', rutitle: '',
rctitle: '' rctitle: '',
register_enable: false,
} }
}, },
@ -220,6 +221,7 @@
if (data.code === 1000) { if (data.code === 1000) {
this.cptch = data.data; this.cptch = data.data;
this.allow_ways = data.data.login_type; this.allow_ways = data.data.login_type;
this.register_enable = data.data.register_enable;
this.set_rtitle(); this.set_rtitle();
this.set_activename(); this.set_activename();
} else { } else {

@ -232,6 +232,8 @@ class LoginView(APIView):
if LOGIN.get("captcha"): if LOGIN.get("captcha"):
response.data = get_captcha() response.data = get_captcha()
response.data['login_type'] = get_login_type() response.data['login_type'] = get_login_type()
allow_f = REGISTER.get("enable")
response.data['register_enable'] = allow_f
return Response(response.dict) return Response(response.dict)

Loading…
Cancel
Save