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