123
This commit is contained in:
parent
78b6267321
commit
6a1483e24e
|
|
@ -1,8 +1,8 @@
|
||||||
import axios from 'axios'
|
import axios from 'axios'
|
||||||
// import {getHeaders} from '../utils/token'
|
// import {getHeaders} from '../utils/token'
|
||||||
|
|
||||||
// const baseUrl = 'http://localhost:8083/api/'
|
const baseUrl = 'http://localhost:8083/api/'
|
||||||
const baseUrl = 'http://api.tomey.live/api/'
|
// const baseUrl = 'http://api.tomey.live/api/'
|
||||||
class HttpRequest {
|
class HttpRequest {
|
||||||
constructor (baseUrl) {
|
constructor (baseUrl) {
|
||||||
this.baseUrl = baseUrl
|
this.baseUrl = baseUrl
|
||||||
|
|
|
||||||
|
|
@ -44,13 +44,13 @@ export default {
|
||||||
data () {
|
data () {
|
||||||
let regexpPhoneNumber = (rule, value, callback) => {
|
let regexpPhoneNumber = (rule, value, callback) => {
|
||||||
if (value === '') {
|
if (value === '') {
|
||||||
callback(new Error('请输入联系电话!'));
|
callback(new Error('请输入联系电话!'))
|
||||||
} else if (!/^1[3-8][0-9]{9}$/.test(value)) {
|
} else if (!/^1[3-8][0-9]{9}$/.test(value)) {
|
||||||
callback(new Error('手机号码格式不正确!'));
|
callback(new Error('手机号码格式不正确!'))
|
||||||
} else {
|
} else {
|
||||||
callback();
|
callback()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
};
|
|
||||||
return {
|
return {
|
||||||
ruleForm: {
|
ruleForm: {
|
||||||
userName: '',
|
userName: '',
|
||||||
|
|
@ -78,10 +78,10 @@ export default {
|
||||||
{ required: true, message: '请输入联系地址', trigger: 'blur' }
|
{ required: true, message: '请输入联系地址', trigger: 'blur' }
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
};
|
}
|
||||||
},
|
},
|
||||||
mounted () {
|
mounted () {
|
||||||
this.ruleForm.phoneNum = this.$store.state.user.userInfo.userId;
|
this.ruleForm.phoneNum = this.$store.state.user.userInfo.userId
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
submitForm (formName) {
|
submitForm (formName) {
|
||||||
|
|
@ -94,35 +94,34 @@ export default {
|
||||||
address: this.ruleForm.address
|
address: this.ruleForm.address
|
||||||
}
|
}
|
||||||
axios.post(`/users/addInformation`, addInfo).then(response => {
|
axios.post(`/users/addInformation`, addInfo).then(response => {
|
||||||
let res = response.data;
|
let res = response.data
|
||||||
if (res.status == '0') {
|
if (res.status == '0') {
|
||||||
this.$notify({
|
this.$notify({
|
||||||
title: '修改成功',
|
title: '修改成功',
|
||||||
message: '恭喜你! 修改成功!',
|
message: '恭喜你! 修改成功!',
|
||||||
duration: 2000,
|
duration: 2000,
|
||||||
type: 'success'
|
type: 'success'
|
||||||
});
|
})
|
||||||
gotoNewOrder.$emit('goNewOrder','userInformation');
|
gotoNewOrder.$emit('goNewOrder', 'userInformation')
|
||||||
this.$router.push({path:'userInformation'});
|
this.$router.push({path: 'userInformation'})
|
||||||
} else {
|
} else {
|
||||||
this.$notify({
|
this.$notify({
|
||||||
title: '修改失败',
|
title: '修改失败',
|
||||||
message: res.msg,
|
message: res.msg,
|
||||||
duration: 2000,
|
duration: 2000,
|
||||||
type: 'error'
|
type: 'error'
|
||||||
});
|
})
|
||||||
}
|
}
|
||||||
}).catch(err => {
|
}).catch(err => {
|
||||||
console.log(err);
|
console.log(err)
|
||||||
|
|
||||||
})
|
})
|
||||||
} else {
|
} else {
|
||||||
return false;
|
return false
|
||||||
}
|
}
|
||||||
});
|
})
|
||||||
},
|
},
|
||||||
resetForm (formName) {
|
resetForm (formName) {
|
||||||
this.$refs[formName].resetFields();
|
this.$refs[formName].resetFields()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -44,13 +44,13 @@ export default {
|
||||||
data () {
|
data () {
|
||||||
let regexpPhoneNumber = (rule, value, callback) => {
|
let regexpPhoneNumber = (rule, value, callback) => {
|
||||||
if (value === '') {
|
if (value === '') {
|
||||||
callback(new Error('请输入联系电话!'));
|
callback(new Error('请输入联系电话!'))
|
||||||
} else if (!/^1[3-8][0-9]{9}$/.test(value)) {
|
} else if (!/^1[3-8][0-9]{9}$/.test(value)) {
|
||||||
callback(new Error('手机号码格式不正确!'));
|
callback(new Error('手机号码格式不正确!'))
|
||||||
} else {
|
} else {
|
||||||
callback();
|
callback()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
};
|
|
||||||
return {
|
return {
|
||||||
ruleForm: {
|
ruleForm: {
|
||||||
userName: '',
|
userName: '',
|
||||||
|
|
@ -78,10 +78,10 @@ export default {
|
||||||
{ required: true, message: '请输入联系地址', trigger: 'blur' }
|
{ required: true, message: '请输入联系地址', trigger: 'blur' }
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
};
|
}
|
||||||
},
|
},
|
||||||
mounted () {
|
mounted () {
|
||||||
this.ruleForm.phoneNum = this.$store.state.user.userInfo.userId;
|
this.ruleForm.phoneNum = this.$store.state.user.userInfo.userId
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
submitForm (formName) {
|
submitForm (formName) {
|
||||||
|
|
@ -94,35 +94,34 @@ export default {
|
||||||
address: this.ruleForm.address
|
address: this.ruleForm.address
|
||||||
}
|
}
|
||||||
axios.post(`/users/addInformation`, addInfo).then(response => {
|
axios.post(`/users/addInformation`, addInfo).then(response => {
|
||||||
let res = response.data;
|
let res = response.data
|
||||||
if (res.status == '0') {
|
if (res.status == '0') {
|
||||||
this.$notify({
|
this.$notify({
|
||||||
title: '修改成功',
|
title: '修改成功',
|
||||||
message: '恭喜你! 修改成功!',
|
message: '恭喜你! 修改成功!',
|
||||||
duration: 2000,
|
duration: 2000,
|
||||||
type: 'success'
|
type: 'success'
|
||||||
});
|
})
|
||||||
gotoNewOrder.$emit('goNewOrder','userInformation');
|
gotoNewOrder.$emit('goNewOrder', 'userInformation')
|
||||||
this.$router.push({path:'userInformation'});
|
this.$router.push({path: 'userInformation'})
|
||||||
} else {
|
} else {
|
||||||
this.$notify({
|
this.$notify({
|
||||||
title: '修改失败',
|
title: '修改失败',
|
||||||
message: res.msg,
|
message: res.msg,
|
||||||
duration: 2000,
|
duration: 2000,
|
||||||
type: 'error'
|
type: 'error'
|
||||||
});
|
})
|
||||||
}
|
}
|
||||||
}).catch(err => {
|
}).catch(err => {
|
||||||
console.log(err);
|
console.log(err)
|
||||||
|
|
||||||
})
|
})
|
||||||
} else {
|
} else {
|
||||||
return false;
|
return false
|
||||||
}
|
}
|
||||||
});
|
})
|
||||||
},
|
},
|
||||||
resetForm (formName) {
|
resetForm (formName) {
|
||||||
this.$refs[formName].resetFields();
|
this.$refs[formName].resetFields()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue