diff --git a/src/components/case/index.vue b/src/components/case/index.vue index 0e657af..4d3c372 100644 --- a/src/components/case/index.vue +++ b/src/components/case/index.vue @@ -203,11 +203,10 @@ export default { if(status !== 1) { this.popContainer = true clearInterval(this.intervalJudge) - this.$confirm('考试已结束,已自动为您提交。', '提示', { - confirmButtonText: '确定', - type: 'info', - center: true - }) + this.$alert('考试已结束,已自动为您提交。', '提示', { + confirmButtonText: '确定', + type: 'warning' + }); // 提交 this.sureSubmit(false) }else { diff --git a/src/utils/verification.js b/src/utils/verification.js new file mode 100644 index 0000000..caeb81a --- /dev/null +++ b/src/utils/verification.js @@ -0,0 +1,63 @@ + const verification = { + vernull: function(value){//非空校验 + if(value.trim(value).length == 0){ + return false; + }else{ + return true; + } + }, + veridc: function(value){ //身份证校验 + var ext = /(^\d{15}&)|(^\d{18})|(^\d{17}(\d|X|x)$)/; + if(ext.test(value)) { + return '身份证校验有误' + } + }, + veren: function(value){ //英文校验 + var ext = /(^[a-zA-Z]+$)/; + if(ext.test(value)) { + return '英文校验有误' + } + }, + vernum: function(value){ //数字校验 + var ext = /^[0-9]*$/; + if(ext.test(value)) { + return '请输入数字' + }else { + return '' + } + }, + verdou: function(value){ //小数校验 + var ext = /^[0-9]+(.[0-9]{1,3})?$/; + if(ext.test(value)) { + return '' + }else { + return '' + } + }, + vermail: function(value){ //邮箱校验 + var ext = /^([a-zA-Z0-9_-])+@([a-zA-Z0-9_-])+((\.[a-zA-Z0-9_-]{2,3}){1,2})$/; + if(ext.test(value)) { + return '请输入正确的邮箱' + }else { + return '' + } + }, + vermob: function(value){ //手机号校验 + var ext = /^1[3456789][0-9]{9}$/; + if(ext.test(value)) { + return '请输入正确的手机号' + }else { + return '' + } + }, + vername: function(name) { // 名字校验 + var ext =/^[\u4e00-\u9fa5]{2,4}$/; + if(!ext.test(name)){ + return '请检查名字是否有误'; + }else { + return '' + } + } + } + + export default verification \ No newline at end of file