element ui实际操作

来源:互联网 发布:透明桌面日历软件 编辑:程序博客网 时间:2024/06/05 11:44

其实从上周就开始写学长的项目了。

感觉之前学的也不是太熟练,js都忘了。。。

这周主要在写前端页面和js表单验证。


上图:

这个是登录界面的js

http://img.blog.csdn.net/20170409121327417


 methods: {          check() {            var ret = /^[a-zA-Z]\w{5,17}$/;            if (this.form.username == '') {              this.$message('账号/用户名不能为空!');            }            else if (this.form.password == '') {              this.$message('密码不能为空!');            }            else if(!ret.test(this.form.password)) {              this.$message("密码必须以字母开头,且只能包含字母、数字和下划线,长度在6~18之间!");            }            else {              $.ajax({            type:"POST",            url:"${pageContext.request.contextPath}/user/check.json",            //contentType:"application/json; charset=utf-8",            data:{'username':this.form.username,'password':this.form.password},            dataType:"json",            success:function() {            if(data.message.code == 1) {   //成功              $(".form1").hide();            $(".form2").show();            } else if(data.message.code == 0) {  //为空              this.showError = true;                  this.errorMsg = data.message.msg;            } else {  //用户名已存在              this.showError = true;                  this.errorMsg = data.message.msg;            }            },        });

其他的页面也写了点,但是验证的js一直有报错。(我就不放上来丢人现眼了)

这两周都忙着复习,单片机,电机学真的好烦啊啊啊。

下周争取把前端页面全部写完!

1 0
原创粉丝点击