|
@@ -58,35 +58,38 @@ export default {
|
|
|
methods: {
|
|
|
onSubmit() {
|
|
|
//this.$message.success(this.username);
|
|
|
+ /*
|
|
|
var mailReg = /^(\w-*\.*)+@(\w-?)+(\.\w{2,})+$/;
|
|
|
if (mailReg.test(this.username)) {
|
|
|
- var that = this ;
|
|
|
- var url = DocConfig.server+'/api/user/login';
|
|
|
- var params = new URLSearchParams();
|
|
|
- params.append('username', this.username);
|
|
|
- params.append('password', this.password);
|
|
|
- params.append('v_code', this.v_code);
|
|
|
-
|
|
|
- that.axios.post(url, params)
|
|
|
- .then(function (response) {
|
|
|
- if (response.data.error_code === 0 ) {
|
|
|
- //that.$message.success("登录成功");
|
|
|
- let redirect = decodeURIComponent(that.$route.query.redirect || '/item/index');
|
|
|
- that.$router.replace({
|
|
|
- path: redirect
|
|
|
- });
|
|
|
- }else{
|
|
|
- if (response.data.error_code === 10206 || response.data.error_code === 10210) {
|
|
|
- that.show_v_code = true ;
|
|
|
- that.change_v_code_img() ;
|
|
|
- };
|
|
|
- that.$alert(response.data.error_message);
|
|
|
- }
|
|
|
-
|
|
|
- });
|
|
|
+
|
|
|
} else {
|
|
|
this.$message.error('用户名必须是邮箱');
|
|
|
}
|
|
|
+ */
|
|
|
+ var that = this ;
|
|
|
+ var url = DocConfig.server+'/api/user/login';
|
|
|
+ var params = new URLSearchParams();
|
|
|
+ params.append('username', this.username);
|
|
|
+ params.append('password', this.password);
|
|
|
+ params.append('v_code', this.v_code);
|
|
|
+
|
|
|
+ that.axios.post(url, params)
|
|
|
+ .then(function (response) {
|
|
|
+ if (response.data.error_code === 0 ) {
|
|
|
+ //that.$message.success("登录成功");
|
|
|
+ let redirect = decodeURIComponent(that.$route.query.redirect || '/item/index');
|
|
|
+ that.$router.replace({
|
|
|
+ path: redirect
|
|
|
+ });
|
|
|
+ }else{
|
|
|
+ if (response.data.error_code === 10206 || response.data.error_code === 10210) {
|
|
|
+ that.show_v_code = true ;
|
|
|
+ that.change_v_code_img() ;
|
|
|
+ };
|
|
|
+ that.$alert(response.data.error_message);
|
|
|
+ }
|
|
|
+
|
|
|
+ });
|
|
|
},
|
|
|
change_v_code_img(){
|
|
|
var rand = '&rand='+Math.random();
|