// 日期回显
export function formatTime(data,famet='YYYY-MM-DD HH:MMM:SS') {
if(famet == 'YYYY-MM-DD HH:MMM:SS'){
const time = new Date(data)
const year = time.getFullYear()
const month = time.getMonth() + 1
const day = time.getDate()
const hour = time.getHours()
const minute = time.getMinutes()
const second = time.getSeconds()
return year + '-' + month + '-' + day
}
}
// 校验
export function reg(data) {
//你输入的手机号长度或格式错误
let reg = /^(13[0-9]|14[01456879]|15[0-35-9]|16[2567]|17[0-8]|18[0-9]|19[0-35-9])\d{8}$/
// 姓名格式校验
let reg = /^[\u4E00-\u9FA5\uf900-\ufa2d·s]{2,6}$/;
//身份证号校验
let reg = /^[1-9]\d{7}((0\d)|(1[0-2]))(([0|1|2]\d)|3[0-1])\d{3}$|^[1-9]\d{5}[1-9]\d{3}((0\d)|(1[0-2]))
if (!reg.test(data)) {
uni.showToast({
title: "你输入的手机号长度或格式错误",
icon: 'none'
});
return false
}
return true
}
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 20
- 21
- 22
- 23
- 24
- 25
- 26
- 27
- 28
- 29
- 30
- 31
- 32
- 33
- 34
- 35