|
|
@@ -156,10 +156,11 @@ export default {
|
|
|
this.$refs['postForm'].validate((valid) => {
|
|
|
if (valid) {
|
|
|
const resultPromise = this.isEdit ? update(this.foodId, this.postForm) : create(this.postForm)
|
|
|
- resultPromise.then(() => {
|
|
|
+ resultPromise.then((res) => {
|
|
|
this.$notify.success('提交成功')
|
|
|
this.loading = false
|
|
|
- this.$router.push({ path: '/food' })
|
|
|
+ const nextPath = this.isEdit ? '/food' : `/food/${res.data}/nutrient`
|
|
|
+ this.$router.push({ path: nextPath })
|
|
|
}).catch(res => {
|
|
|
this.$message.error(res.data.message)
|
|
|
this.loading = false
|