diff --git a/frontend/src/components/input_recipe.vue b/frontend/src/components/input_recipe.vue index a8535d4..b052536 100644 --- a/frontend/src/components/input_recipe.vue +++ b/frontend/src/components/input_recipe.vue @@ -1,5 +1,5 @@ @@ -68,6 +98,8 @@ import { Rate, Button, Toast, + Col, + Row, } from 'vant'; import axios from 'axios'; import config from '@/config/index'; @@ -90,6 +122,8 @@ export default { [RadioGroup.name]: RadioGroup, [Rate.name]: Rate, [Button.name]: Button, + [Col.name]: Col, + [Row.name]: Row, }, data() { return { @@ -137,6 +171,20 @@ export default { ); } }, + onSubmitDelete(recipe_id) { + if (!this.form.name) { + return; + } + this.loading = true; + axios.delete(config.publicPath + '/recipe/recipe/' + recipe_id).then( + (Toast.success({ + message: '删除成功', + forbidClick: true, + duration: 500, + }), + (this.loading = false)) + ); + }, }, }; @@ -144,4 +192,7 @@ export default { .recipe-create { margin: 20px 16px; } +.submit-button { + width: 100%; +} diff --git a/recipe/views.py b/recipe/views.py index e958f5f..436402b 100644 --- a/recipe/views.py +++ b/recipe/views.py @@ -18,7 +18,7 @@ class RecipeAPI(rest_framework.generics.RetrieveUpdateDestroyAPIView): # authentication.SessionAuthentication, # authentication.BasicAuthentication) # permission_classes = (permissions.IsAuthenticated,) - queryset = recipe.models.Recipe.objects.exclude(status=const.RECIPE_STATUS_DELETED) + queryset = recipe.models.Recipe.objects.all() serializer_class = recipe.serializers.RecipeSerializer def perform_destroy(self, instance):