This commit is contained in:
memo 2021-03-20 01:07:40 +08:00
parent 78b6267321
commit 6a1483e24e
3 changed files with 176 additions and 178 deletions

View File

@ -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

View File

@ -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()
}
}
}

View File

@ -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()
}
}
}