diff --git a/develop_requirements.txt b/develop_requirements.txt index d7f671b..53f564a 100644 --- a/develop_requirements.txt +++ b/develop_requirements.txt @@ -33,3 +33,4 @@ zipp==3.5.0 redis==4.1.0 black instagram_private_api +drf-nested-routers diff --git a/dsite/settings_default.py b/dsite/settings_default.py index f2065ab..2495fb8 100644 --- a/dsite/settings_default.py +++ b/dsite/settings_default.py @@ -27,7 +27,6 @@ DEBUG = True ALLOWED_HOSTS = [] - # Application definition INSTALLED_APPS = [ diff --git a/dsite/urls.py b/dsite/urls.py index 87236df..8d6bd53 100644 --- a/dsite/urls.py +++ b/dsite/urls.py @@ -18,8 +18,8 @@ Including another URLconf from django.urls import include, path from django.conf.urls import url -from rest_framework import routers from rest_framework.authtoken import views +from rest_framework_nested import routers router = routers.DefaultRouter() # Wire up our API using automatic URL routing. diff --git a/frontend/src/components/input_recipe.vue b/frontend/src/components/input_recipe.vue index dda6ea6..7dafe3b 100644 --- a/frontend/src/components/input_recipe.vue +++ b/frontend/src/components/input_recipe.vue @@ -138,7 +138,7 @@ export default { }); } else { axios - .put(config.publicPath + '/recipe/recipe/' + recipe_id, data) + .put(config.publicPath + '/recipe/recipe/' + recipe_id + '/', data) .then(function () { ElMessage({ message: '修改成功.', @@ -152,7 +152,7 @@ export default { }, onSubmitDelete(recipe_id) { axios - .delete(config.publicPath + '/recipe/recipe/' + recipe_id) + .delete(config.publicPath + '/recipe/recipe/' + recipe_id + '/') .then(function () { ElMessage.error('删除成功.'); location.reload(); diff --git a/frontend/src/components/recipe-mobile/recipe-edit.vue b/frontend/src/components/recipe-mobile/recipe-edit.vue index 3a8bd98..eab9d62 100644 --- a/frontend/src/components/recipe-mobile/recipe-edit.vue +++ b/frontend/src/components/recipe-mobile/recipe-edit.vue @@ -42,6 +42,94 @@ type="textarea" /> + + + + + + + +
+ + + 创建食材 + + + 添加食材 + + +
+ + + + + + + + + + +
@@ -49,7 +137,6 @@ class="submit-button" round type="danger" - plain hairline :disabled="disable_submit" @click="onSubmitDelete(recipe_id)" @@ -62,7 +149,6 @@ class="submit-button" round type="primary" - plain hairline :disabled="disable_submit" @click="onSubmit(recipe_id)" @@ -75,7 +161,6 @@ class="submit-button" round type="primary" - plain hairline :disabled="disable_submit" @click="onSubmit(recipe_id)" @@ -90,21 +175,27 @@