diff --git a/frontend/src/components/input_recipe.vue b/frontend/src/components/input_recipe.vue
index 37eea5a..0f80b62 100644
--- a/frontend/src/components/input_recipe.vue
+++ b/frontend/src/components/input_recipe.vue
@@ -54,7 +54,11 @@
- 提交
@@ -119,3 +123,9 @@ export default {
},
};
+
+
diff --git a/frontend/src/components/recipe_list.vue b/frontend/src/components/recipe_list.vue
new file mode 100644
index 0000000..67ce9d7
--- /dev/null
+++ b/frontend/src/components/recipe_list.vue
@@ -0,0 +1,103 @@
+
+
+
+
+
+
+
+
+
+
+
+
+ 编辑
+
+
+
+
+
+
+
diff --git a/frontend/src/components/week_recipe.vue b/frontend/src/components/week_recipe.vue
new file mode 100644
index 0000000..c560990
--- /dev/null
+++ b/frontend/src/components/week_recipe.vue
@@ -0,0 +1,93 @@
+
+
+
+
+
+
+
+
+
+
+
+ 重新生成
+
+
+
+
+
+
+
diff --git a/frontend/src/router/index.js b/frontend/src/router/index.js
index 1a5693c..0368594 100644
--- a/frontend/src/router/index.js
+++ b/frontend/src/router/index.js
@@ -1,6 +1,7 @@
import { createRouter, createWebHistory } from 'vue-router'
import Home from '@/views/home.vue'
import RecipeDetail from '@/views/recipeDetail.vue'
+import WeekRecipe from '@/views/weekRecipe.vue'
const routes = [
{
@@ -12,7 +13,12 @@ const routes = [
path: '/recipe/:id',
name: "RecipeDetail",
component: RecipeDetail
- }
+ },
+ {
+ path: '/week-recipe/',
+ name: "WeekRecipe",
+ component: WeekRecipe
+ },
];
const router = createRouter({
diff --git a/frontend/src/views/home.vue b/frontend/src/views/home.vue
index fc8c6ae..38422b5 100644
--- a/frontend/src/views/home.vue
+++ b/frontend/src/views/home.vue
@@ -1,118 +1,40 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
- 编辑
-
-
-
-
-
-
-
-
-
+
+
+
+
+ 首页
+
+
+ 每周菜谱
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/frontend/src/views/recipeDetail.vue b/frontend/src/views/recipeDetail.vue
index 15c5528..6a7f080 100644
--- a/frontend/src/views/recipeDetail.vue
+++ b/frontend/src/views/recipeDetail.vue
@@ -1,5 +1,6 @@
+
+
+
+
+ 首页
+
+
+ 每周菜谱
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/recipe/models.py b/recipe/models.py
index 40d65d9..cbc3021 100644
--- a/recipe/models.py
+++ b/recipe/models.py
@@ -96,6 +96,7 @@ class DailyRecipe(models.Model):
value_.append(recipe.serialize())
date = now()
- date.replace(year=self.date.year, month=self.date.month, day=self.date.day,)
+ date = date.replace(year=self.date.year, month=self.date.month,
+ day=self.date.day, hour=0, minute=0)
data['date'] = utils.timestamp_of(utils.day_start(date))
return data
diff --git a/recipe/views.py b/recipe/views.py
index a5ad0ff..8735aaa 100644
--- a/recipe/views.py
+++ b/recipe/views.py
@@ -42,7 +42,7 @@ class WeekRecipeListAPI(rest_framework.generics.ListAPIView,
recipes = []
for x in range(0, 7-today.weekday()):
daily_recipe, __ = recipe.models.DailyRecipe.objects.get_or_create(
- date=today + datetime.timedelta(days=1)
+ date=today + datetime.timedelta(days=x)
)
daily_recipe.generate_recipe()
recipes.append(daily_recipe.recipes.values_list('id', flat=True))
@@ -56,7 +56,9 @@ class WeekRecipeListAPI(rest_framework.generics.ListAPIView,
date__gte=week_start,
date__lte=week_end,
).order_by('date')
- data = []
+ data = [{}] * (7 - len(daily_recipes))
+
for daily_recipe in daily_recipes:
data.append(daily_recipe.serialize())
+
return Response(data)