diff --git a/src/main/resources/static/js/LoginStyle.js b/src/main/resources/static/js/LoginStyle.js index ded4252..646ac94 100644 --- a/src/main/resources/static/js/LoginStyle.js +++ b/src/main/resources/static/js/LoginStyle.js @@ -1,22 +1,19 @@ var Main = { data() { - var checkuserName = (rule, value, callback) => { + var checkName = (rule, value, callback) => { if (!value) { return callback(new Error('用户名不能为空')); - } else { - callback(); } - /* setTimeout(() => { - if (!Number.isInteger(value)) { - callback(new Error('请输入数字值')); - } else { - if (value < 18) { - callback(new Error('必须年满18岁')); - } else { - callback(); - } - } - }, 1000);*/ + }; + var checkNo = (rule, value, callback) => { + if (!value) { + return callback(new Error('学号不能为空')); + } + }; + var checkRealName = (rule, value, callback) => { + if (!value) { + return callback(new Error('真实姓名不能为空')); + } }; var validatePass = (rule, value, callback) => { if (value === '') { @@ -31,7 +28,7 @@ var Main = { var validatePass2 = (rule, value, callback) => { if (value === '') { callback(new Error('请再次输入密码')); - } else if (value !== this.ruleForm2.pass) { + } else if (value !== this.ruleForm2.colpassword) { callback(new Error('两次输入密码不一致!')); } else { callback(); @@ -39,23 +36,39 @@ var Main = { }; return { ruleForm2: { - pass: '', - checkPass: '', - userName: '', - email: '' + colname: '', + colpassword: '', + checkPass:'', + colstudentno: '', + colrealname: '', + colemail: '' }, - activeName: 'login', rules2: { - pass: [ - {validator: validatePass, trigger: 'blur'} + colpassword: [ + {required: true,validator: validatePass, trigger: 'blur'} ], checkPass: [ - {validator: validatePass2, trigger: 'blur'} + {required: true,validator: validatePass2, trigger: 'blur'} ], - userName: [ - {validator: checkuserName, trigger: 'blur'} - ] - } + colstudentno: [ + { + required: true, + validator: checkNo, + trigger: 'blur' + } + ], + colrealname: [ + { + required: true, + validator: checkRealName, + trigger: 'blur' + } + ], + colname: [ + {required: true,validator: checkName, trigger: 'blur'} + ], + }, + activeName:'login', }; }, methods: { diff --git a/src/main/resources/static/js/homePage.js b/src/main/resources/static/js/homePage.js index ad3e3ec..436d18e 100644 --- a/src/main/resources/static/js/homePage.js +++ b/src/main/resources/static/js/homePage.js @@ -9,9 +9,75 @@ axios.get('http://localhost:8080/cms/download/findall') });*/ var Main = { data() { + var checkName = (rule, value, callback) => { + if (!value) { + return callback(new Error('用户名不能为空')); + } + }; + var checkNo = (rule, value, callback) => { + if (!value) { + return callback(new Error('学号不能为空')); + } + }; + var checkRealName = (rule, value, callback) => { + if (!value) { + return callback(new Error('真实姓名不能为空')); + } + }; + var validatePass = (rule, value, callback) => { + if (value === '') { + callback(new Error('请输入密码')); + } else { + if (this.ruleForm2.checkPass !== '') { + this.$refs.ruleForm2.validateField('checkPass'); + } + callback(); + } + }; + var validatePass2 = (rule, value, callback) => { + if (value === '') { + callback(new Error('请再次输入密码')); + } else if (value !== this.ruleForm2.colpassword) { + callback(new Error('两次输入密码不一致!')); + } else { + callback(); + } + }; return { - activeIndex: '1', - activeIndex2: '1', + ruleForm2: { + colname: '', + colpassword: '', + checkPass:'', + colstudentno: '', + colrealname: '', + colemail: '' + }, + rules2: { + colpassword: [ + {required: true,validator: validatePass, trigger: 'blur'} + ], + checkPass: [ + {required: true,validator: validatePass2, trigger: 'blur'} + ], + colstudentno: [ + { + required: true, + validator: checkNo, + trigger: 'blur' + } + ], + colrealname: [ + { + required: true, + validator: checkRealName, + trigger: 'blur' + } + ], + colname: [ + {required: true,validator: checkName, trigger: 'blur'} + ], + }, + activeName:'login', fileList: [{ name: 'food.jpeg', url: 'https://fuss10.elemecdn.com/3/63/4e7f3a15429bfda99bce42a18cdd1jpeg.jpeg?imageMogr2/thumbnail/360x360/format/webp/quality/100' @@ -22,87 +88,101 @@ var Main = { DownloadList: [] }; }, - mounted(){ - this.$nextTick(()=>{ - var that=this; + mounted() { + this.$nextTick(() => { + var that = this; axios.get('http://localhost:8080/cms/download/findall') - .then(function (response) { - console.log(response.data); - that.DownloadList = response.data; - }) - .catch(function (error) { - console.log(error); - });}) + .then(function (response) { + console.log(response.data); + that.DownloadList = response.data; + }) + .catch(function (error) { + console.log(error); + }); + }) }, methods: { - handleClick(row) { - console.log(row.colfileid); - }, - submitUpload() { - this.$refs.upload.submit(); - }, - handleRemove(file, fileList) { - console.log(file, fileList); - }, - handleDownload(row){ - /*var url = window.location.protocol+"://"+window.location.host+":"+window.location.port+"/"*/ - window.open("http://localhost:8080/cms/download/dodownload?fileId="+row.colfileid); - }, - handlePreview(file) { - console.log(file); - }, - handleExceed(files, fileList) { - this.$message.warning(`当前限制选择 3 个文件,本次选择了 ${files.length} 个文件,共选择了 ${files.length + fileList.length} 个文件`); - }, - beforeRemove(file, fileList) { - return this.$confirm(`确定移除 ${ file.name }?`); - }, - handleSelect(key, keyPath) { - console.log(key, keyPath); - }, - handleOpen(key, keyPath) { - console.log(key, keyPath); - }, - handleClose(key, keyPath) { - console.log(key, keyPath); - }, - showMsg(msg) { - this.$message({ - message: msg, - type: 'success' + submitForm(formName) { + this.$refs[formName].validate((valid) => { + if (valid) { + alert('submit!'); + } else { + console.log('error submit!!'); + return false; + } }); }, - notiSuccess(title, value) { - this.$notify({ - title: title, - message: value, - type: 'success' - }); - }, - notiWarning(title, value) { - this.$notify({ - title: title, - message: value, - type: 'warning' - }); + resetForm(formName) { + this.$refs[formName].resetFields(); }, + handleClick(row) { + console.log(row.colfileid); + }, + submitUpload() { + this.$refs.upload.submit(); + }, + handleRemove(file, fileList) { + console.log(file, fileList); + }, + handleDownload(row) { + /*var url = window.location.protocol+"://"+window.location.host+":"+window.location.port+"/"*/ + window.open("http://localhost:8080/cms/download/dodownload?fileId=" + row.colfileid); + }, + handlePreview(file) { + console.log(file); + }, + handleExceed(files, fileList) { + this.$message.warning(`当前限制选择 3 个文件,本次选择了 ${files.length} 个文件,共选择了 ${files.length + fileList.length} 个文件`); + }, + beforeRemove(file, fileList) { + return this.$confirm(`确定移除 ${ file.name }?`); + }, + handleSelect(key, keyPath) { + console.log(key, keyPath); + }, + handleOpen(key, keyPath) { + console.log(key, keyPath); + }, + handleClose(key, keyPath) { + console.log(key, keyPath); + }, + showMsg(msg) { + this.$message({ + message: msg, + type: 'success' + }); + }, + notiSuccess(title, value) { + this.$notify({ + title: title, + message: value, + type: 'success' + }); + }, + notiWarning(title, value) { + this.$notify({ + title: title, + message: value, + type: 'warning' + }); + }, - notiInfo(title, value) { - this.$notify.info({ - title: title, - message: value - }); - }, + notiInfo(title, value) { + this.$notify.info({ + title: title, + message: value + }); + }, - notiError(title, value) { - this.$notify.error({ - title: title, - message: value - }); - } + notiError(title, value) { + this.$notify.error({ + title: title, + message: value + }); } } +} var Ctor = Vue.extend(Main) var con = new Ctor().$mount('#app') //con.showMsg('登录成功'); diff --git a/src/main/resources/static/loginTest.html b/src/main/resources/static/loginTest.html new file mode 100644 index 0000000..59ec417 --- /dev/null +++ b/src/main/resources/static/loginTest.html @@ -0,0 +1,124 @@ + + + + + 登录 + + + + + + + + + +
+ + +
+

登录系统

+
+
+
+ + +
+ +
+
+
+
+ + + + + \ No newline at end of file diff --git a/src/main/resources/templates/login.html b/src/main/resources/templates/login.html index 5603531..69da4ba 100644 --- a/src/main/resources/templates/login.html +++ b/src/main/resources/templates/login.html @@ -2,6 +2,7 @@ +
@@ -25,16 +26,16 @@ :rules="rules2" ref="ruleForm2" label-width="100px" class="demo-ruleForm" action="/cms/login/dologin" - method="POST" name="loginTest"> + method="POST" name="login"> + prop="colname"> + v-model="ruleForm2.colname" name="colname"> + label="密码" prop="colpassword"> + v-model="ruleForm2.colpassword" auto-complete="off" name="colpassword"> + method="POST" name="register"> + prop="colname"> + v-model="ruleForm2.colname" name="colname"> + label="密码" prop="colpassword"> + v-model="ruleForm2.colpassword" auto-complete="off" name="colpassword"> + auto-complete="off" name="checkPass"> - - + + + + + + +
- +