Merge remote-tracking branch 'origin/dev-3.1' into dev-3.1.1_theme

This commit is contained in:
chenjinsong
2021-11-15 15:05:04 +08:00
4 changed files with 13 additions and 23 deletions

View File

@@ -87,8 +87,8 @@ export function noSpecialChar (rule, value, callback) {
} }
export function latlng (rule, value, callback) { export function latlng (rule, value, callback) {
const lngReg = /^[\-\+]?(0?\d{1,2}\.\d{1,7}|1[0-7]?\d{1}\.\d{1,7}|180\.0{1,7})$/ const lngReg = /^[\-\+]?(0?\d{1,2}\.\d{1,7}|1[0-7]?\d{1}\.\d{1,7}|180\.0{1,7}|0?\d{1,2}|1[0-7]?\d{1}|180)$/ // 经度正则验证
const latReg = /^[\-\+]?([1-8]?\d{1}\.\d{1,7}|90\.0{1,7})$/ const latReg = /^[\-\+]?([1-8]?\d{1}\.\d{1,7}|90\.0{1,7}|[1-8]?\d{1}|90)$/ // 纬度正则验证
setTimeout(() => { setTimeout(() => {
const lnglat = value.split(',') const lnglat = value.split(',')
if (!lnglat || lnglat.length !== 2) { if (!lnglat || lnglat.length !== 2) {

View File

@@ -136,8 +136,8 @@ export default {
this.$message.error(this.$t('tip.lnglatError')) this.$message.error(this.$t('tip.lnglatError'))
return false return false
} }
const lngReg = /^[\-\+]?(0?\d{1,2}\.\d{0,7}|1[0-7]?\d{1}\.\d{1,7}|180\.0{0,7})$/ const lngReg = /^[\-\+]?(0?\d{1,2}\.\d{1,7}|1[0-7]?\d{1}\.\d{1,7}|180\.0{1,7}|0?\d{1,2}|1[0-7]?\d{1}|180)$/ // 经度正则验证
const latReg = /^[\-\+]?([0-8]?\d{1}\.\d{0,7}|90\.0{0,7})$/ const latReg = /^[\-\+]?([1-8]?\d{1}\.\d{1,7}|90\.0{1,7}|[1-8]?\d{1}|90)$/ // 纬度正则验证
if (!lngReg.test(lnglat[0]) || !latReg.test(lnglat[1])) { if (!lngReg.test(lnglat[0]) || !latReg.test(lnglat[1])) {
// this.lnglat = this.oldlnglat // this.lnglat = this.oldlnglat
this.$message.error(this.$t('tip.lnglatError')) this.$message.error(this.$t('tip.lnglatError'))

View File

@@ -70,7 +70,8 @@ import latlngPicker from '../latlngPicker'
import editRigthBox from '../mixin/editRigthBox' import editRigthBox from '../mixin/editRigthBox'
import { noSpecialChar, latlng } from '@/components/common/js/validate' import { noSpecialChar, latlng } from '@/components/common/js/validate'
const regNum = /^[0-9]+.?[0-9]*/ const latitudeNum = /^[\-\+]?([1-8]?\d{1}\.\d{1,7}|90\.0{1,7}|[1-8]?\d{1}|90)$/ // 纬度正则验证
const longitudeNum = /^[\-\+]?(0?\d{1,2}\.\d{1,7}|1[0-7]?\d{1}\.\d{1,7}|180\.0{1,7}|0?\d{1,2}|1[0-7]?\d{1}|180)$/ // 经度正则验证
export default { export default {
name: 'dcBox', name: 'dcBox',
@@ -139,10 +140,10 @@ export default {
const attr = this.$refs.latlngPicker.getAttribute() const attr = this.$refs.latlngPicker.getAttribute()
param.latitude = attr.latitude param.latitude = attr.latitude
param.longitude = attr.longitude param.longitude = attr.longitude
if (!regNum.test(param.longitude)) { if (!longitudeNum.test(param.longitude)) {
param.longitude = null param.longitude = null
} }
if (!regNum.test(param.latitude)) { if (!latitudeNum.test(param.latitude)) {
param.latitude = null param.latitude = null
} }
this.$post('/dc', param).then(response => { this.$post('/dc', param).then(response => {

View File

@@ -32,10 +32,6 @@
<script> <script>
export default { export default {
name: 'changePin', name: 'changePin',
props: {
curUser: { type: String },
showDialog: { type: Boolean, default: false }
},
data () { data () {
const temp = this const temp = this
const validatePass = (rule, value, callback) => { const validatePass = (rule, value, callback) => {
@@ -54,12 +50,11 @@ export default {
} }
return { return {
user: { user: {
username: '',
pin: '', pin: '',
newPin: '', newPin: '',
confirmPin: '' confirmPin: ''
}, },
sysUser: sessionStorage.getItem('nz-username'), userId: localStorage.getItem('nz-user-id'),
rules: { rules: {
pin: [{ required: true, message: this.$t('validate.required'), trigger: 'blur' }], pin: [{ required: true, message: this.$t('validate.required'), trigger: 'blur' }],
newPin: [{ required: true, message: this.$t('validate.required'), trigger: 'blur' }, { validator: validatePass, trigger: 'blur' }], newPin: [{ required: true, message: this.$t('validate.required'), trigger: 'blur' }, { validator: validatePass, trigger: 'blur' }],
@@ -68,9 +63,7 @@ export default {
visible: false visible: false
} }
}, },
created () { created () {},
this.user.username = this.curUser && this.curUser != '' ? this.curUser : sessionStorage.getItem('nz-username')
},
methods: { methods: {
dialogOpened: function () { dialogOpened: function () {
if (this.$refs.changePinForm) { if (this.$refs.changePinForm) {
@@ -88,9 +81,10 @@ export default {
if (valid) { if (valid) {
const paramObj = { const paramObj = {
pin: this.user.pin, pin: this.user.pin,
newPin: this.user.newPin newPin: this.user.newPin,
id: this.userId
} }
this.$put('/sys/user/pin?oldPin=' + paramObj.pin + '&newPin=' + paramObj.newPin).then(response => { this.$put('/sys/user/pin?oldPin=' + paramObj.pin + '&newPin=' + paramObj.newPin + '&id=' + paramObj.id).then(response => {
if (response && response.code == 200) { if (response && response.code == 200) {
this.$message({ duration: 2000, type: 'success', message: this.$t('tip.saveSuccess') }) this.$message({ duration: 2000, type: 'success', message: this.$t('tip.saveSuccess') })
this.user.pin = '' this.user.pin = ''
@@ -103,11 +97,6 @@ export default {
} }
}) })
} }
},
watch: {
showDialog: function (n, o) {
this.visible = n
}
} }
} }
</script> </script>