Compare commits
10 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
87025cd17e | ||
|
|
68a4b2dbeb | ||
|
|
1ab402af8b | ||
|
|
b2cf053446 | ||
|
|
37bab9269c | ||
|
|
44f9b40ee5 | ||
|
|
4ddd5ac2d2 | ||
|
|
9df47e977e | ||
|
|
5fb76f24dc | ||
|
|
014f129b8e |
@@ -16,11 +16,12 @@ const { random, randomRecipes } = useRandomRecipe(count)
|
|||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div v-show="randomRecipes.length > 0">
|
|
||||||
<button cursor-pointer class="inline-flex inline-flex items-center justify-center rounded-md border-none bg-blue-600 px-3 py-1.5 text-sm font-semibold leading-6 text-white shadow-sm hover:bg-blue-500 focus-visible:outline-2 focus-visible:outline-blue-600 focus-visible:outline-offset-2 focus-visible:outline" @click="random">
|
<button cursor-pointer class="inline-flex inline-flex items-center justify-center rounded-md border-none bg-blue-600 px-3 py-1.5 text-sm font-semibold leading-6 text-white shadow-sm hover:bg-blue-500 focus-visible:outline-2 focus-visible:outline-blue-600 focus-visible:outline-offset-2 focus-visible:outline" @click="random">
|
||||||
<div class="transition" hover="text-blue-500" i-ri-refresh-line mr-1 inline-flex />
|
<div class="transition" hover="text-blue-500" i-ri-refresh-line mr-1 inline-flex />
|
||||||
<div>随机一下</div>
|
<div>随机一下</div>
|
||||||
</button>
|
</button>
|
||||||
|
|
||||||
|
<div v-show="randomRecipes.length > 0">
|
||||||
<div m="t-8" flex="~ col">
|
<div m="t-8" flex="~ col">
|
||||||
<template v-for="recipe, i in randomRecipes" :key="i">
|
<template v-for="recipe, i in randomRecipes" :key="i">
|
||||||
<DishTag v-if="recipe" :dish="recipe" />
|
<DishTag v-if="recipe" :dish="recipe" />
|
||||||
|
|||||||
@@ -44,7 +44,7 @@ const filteredRecipes = computedAsync(async () => {
|
|||||||
leave-from="opacity-100"
|
leave-from="opacity-100"
|
||||||
leave-to="opacity-0"
|
leave-to="opacity-0"
|
||||||
>
|
>
|
||||||
<div class="fixed inset-0" />
|
<div class="fixed inset-0 bg-black/10" />
|
||||||
</TransitionChild>
|
</TransitionChild>
|
||||||
|
|
||||||
<div class="fixed inset-0 overflow-y-auto">
|
<div class="fixed inset-0 overflow-y-auto">
|
||||||
@@ -62,7 +62,7 @@ const filteredRecipes = computedAsync(async () => {
|
|||||||
>
|
>
|
||||||
<DialogPanel
|
<DialogPanel
|
||||||
class="h-full max-w-xl w-full transform overflow-hidden bg-white p-4 text-left align-middle shadow-xl transition-all dark:bg-dark-600"
|
class="h-full max-w-xl w-full transform overflow-hidden bg-white p-4 text-left align-middle shadow-xl transition-all dark:bg-dark-600"
|
||||||
md="mt-4 rounded-2xl"
|
md="rounded-2xl"
|
||||||
overflow="auto"
|
overflow="auto"
|
||||||
flex="~ col"
|
flex="~ col"
|
||||||
>
|
>
|
||||||
@@ -89,7 +89,7 @@ const filteredRecipes = computedAsync(async () => {
|
|||||||
@click="keyword = ''"
|
@click="keyword = ''"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
<div ml-2 inline-flex op="70" text-base @click="closeModal">
|
<div op="70" ml-2 inline-flex cursor-pointer text-base @click="closeModal">
|
||||||
取消
|
取消
|
||||||
</div>
|
</div>
|
||||||
</DialogTitle>
|
</DialogTitle>
|
||||||
|
|||||||
@@ -1,3 +1,5 @@
|
|||||||
|
import { useStorage } from '@vueuse/core'
|
||||||
|
import { namespace } from '~/constants'
|
||||||
import type { DbRecipeItem } from '~/utils/db'
|
import type { DbRecipeItem } from '~/utils/db'
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -5,7 +7,7 @@ import type { DbRecipeItem } from '~/utils/db'
|
|||||||
* @param total
|
* @param total
|
||||||
*/
|
*/
|
||||||
export function useRandomRecipe(total: Ref<number>) {
|
export function useRandomRecipe(total: Ref<number>) {
|
||||||
const randomRecipes = ref<(DbRecipeItem | undefined)[]>([])
|
const randomRecipes = useStorage<(DbRecipeItem | undefined)[]>(`${namespace}:random:recipes`, [])
|
||||||
async function random() {
|
async function random() {
|
||||||
const length = await db.recipes.count()
|
const length = await db.recipes.count()
|
||||||
const randomArr = generateRandomArray(length, total.value)
|
const randomArr = generateRandomArray(length, total.value)
|
||||||
@@ -19,6 +21,8 @@ export function useRandomRecipe(total: Ref<number>) {
|
|||||||
})
|
})
|
||||||
|
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
|
// 如果没有随机菜谱,就生成一次
|
||||||
|
if (randomRecipes.value.length <= 0)
|
||||||
random()
|
random()
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|||||||
@@ -78,8 +78,6 @@ export const useRecipeStore = defineStore('recipe', () => {
|
|||||||
async function searchRecipes() {
|
async function searchRecipes() {
|
||||||
isSearching.value = true
|
isSearching.value = true
|
||||||
let result: RecipeItem[] = []
|
let result: RecipeItem[] = []
|
||||||
if (keyword.value)
|
|
||||||
result = await db.recipes.filter(item => item.name.includes(keyword.value)).toArray()
|
|
||||||
|
|
||||||
if (curMode.value === 'strict') {
|
if (curMode.value === 'strict') {
|
||||||
result = await db.recipes.filter((item) => {
|
result = await db.recipes.filter((item) => {
|
||||||
@@ -116,6 +114,9 @@ export const useRecipeStore = defineStore('recipe', () => {
|
|||||||
}).toArray()
|
}).toArray()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (keyword.value)
|
||||||
|
result = result.filter(item => item.name.includes(keyword.value))
|
||||||
|
|
||||||
isSearching.value = false
|
isSearching.value = false
|
||||||
return result
|
return result
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,6 +2,6 @@ export const appName = '食用手册'
|
|||||||
export const appDescription = '好的,今天我们来做菜!'
|
export const appDescription = '好的,今天我们来做菜!'
|
||||||
|
|
||||||
export const namespace = 'cook'
|
export const namespace = 'cook'
|
||||||
export const lastDbUpdated = '2022-07-27 03:05:02'
|
export const lastDbUpdated = '2023-11-11 19:51:02'
|
||||||
|
|
||||||
export * from './links'
|
export * from './links'
|
||||||
|
|||||||
@@ -296,7 +296,7 @@ BBQ烟熏手撕猪肉,猪肉,BV1DV411x7SH,复杂,,烤,烤箱,
|
|||||||
名古屋鸡翅,鸡肉,BV1ET4y1A7Xd,普通,日式,炸,一口大锅,
|
名古屋鸡翅,鸡肉,BV1ET4y1A7Xd,普通,日式,炸,一口大锅,
|
||||||
日式炖白萝,白萝卜,BV17b411B7H1,简单,日式,炖,一口大锅,
|
日式炖白萝,白萝卜,BV17b411B7H1,简单,日式,炖,一口大锅,
|
||||||
炸虾天妇罗,虾,BV1e5411t7LY,困难,日式,炸,一口大锅,
|
炸虾天妇罗,虾,BV1e5411t7LY,困难,日式,炸,一口大锅,
|
||||||
可乐饼,土豆、洋葱、肉、鸡蛋,BV1yW411Q7sa,普通,日式菜,炸,一口大锅,
|
可乐饼,土豆、洋葱、肉、鸡蛋,BV17x411U75q,普通,日式菜,炸,一口大锅,
|
||||||
清炒莴笋丝,莴笋、胡萝卜,BV1qK411H7RL,简单,爽口,炒,一口大锅,
|
清炒莴笋丝,莴笋、胡萝卜,BV1qK411H7RL,简单,爽口,炒,一口大锅,
|
||||||
莴笋泡菜,莴笋,BV1h741127rS,简单,爽口,泡菜,一口大锅,
|
莴笋泡菜,莴笋,BV1h741127rS,简单,爽口,泡菜,一口大锅,
|
||||||
口蘑汤,菌菇,BV1e64y1h776,简单,汤,煎、炖,一口大锅,
|
口蘑汤,菌菇,BV1e64y1h776,简单,汤,煎、炖,一口大锅,
|
||||||
@@ -597,3 +597,4 @@ biangbiang面,面食,BV1844y157GL,简单,,油泼,一口大锅,
|
|||||||
电饭煲番茄牛肉焖饭,番茄、牛肉、米,BV1Bv411C7X3,普通,,,一口大锅、电饭煲,
|
电饭煲番茄牛肉焖饭,番茄、牛肉、米,BV1Bv411C7X3,普通,,,一口大锅、电饭煲,
|
||||||
电饭煲排骨土豆焖饭,猪肉、土豆、米,BV1Bv411C7X3,普通,,,一口大锅、电饭煲,
|
电饭煲排骨土豆焖饭,猪肉、土豆、米,BV1Bv411C7X3,普通,,,一口大锅、电饭煲,
|
||||||
米布丁,米、鸡蛋,BV1hr4y1k7A5,简单,,,一口大锅、电饭煲,
|
米布丁,米、鸡蛋,BV1hr4y1k7A5,简单,,,一口大锅、电饭煲,
|
||||||
|
麻婆豆腐,豆腐,BV1it4y1X75m,简单,,,一口大锅,
|
||||||
|
|||||||
|
File diff suppressed because one or more lines are too long
19
package.json
19
package.json
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"version": "1.2.0",
|
"version": "1.2.2",
|
||||||
"private": true,
|
"private": true,
|
||||||
"packageManager": "pnpm@8.10.2",
|
"packageManager": "pnpm@8.10.2",
|
||||||
"engines": {
|
"engines": {
|
||||||
@@ -27,7 +27,7 @@
|
|||||||
"vue-about-me": "^1.2.7"
|
"vue-about-me": "^1.2.7"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@antfu/eslint-config": "^1.1.0",
|
"@antfu/eslint-config": "^1.1.1",
|
||||||
"@headlessui/vue": "^1.7.16",
|
"@headlessui/vue": "^1.7.16",
|
||||||
"@iconify-json/carbon": "^1.1.21",
|
"@iconify-json/carbon": "^1.1.21",
|
||||||
"@iconify-json/fe": "^1.1.7",
|
"@iconify-json/fe": "^1.1.7",
|
||||||
@@ -36,17 +36,18 @@
|
|||||||
"@iconify-json/mdi": "^1.1.55",
|
"@iconify-json/mdi": "^1.1.55",
|
||||||
"@iconify-json/ri": "^1.1.12",
|
"@iconify-json/ri": "^1.1.12",
|
||||||
"@iconify-json/twemoji": "^1.1.12",
|
"@iconify-json/twemoji": "^1.1.12",
|
||||||
"@nuxt/devtools": "^1.0.0",
|
"@nuxt/devtools": "^1.0.2",
|
||||||
"@nuxtjs/color-mode": "^3.3.0",
|
"@nuxtjs/color-mode": "^3.3.0",
|
||||||
"@pinia/nuxt": "^0.5.1",
|
"@pinia/nuxt": "^0.5.1",
|
||||||
"@pinia/testing": "^0.1.3",
|
"@pinia/testing": "^0.1.3",
|
||||||
"@unocss/eslint-config": "^0.57.2",
|
"@unocss/eslint-config": "^0.57.3",
|
||||||
"@unocss/nuxt": "^0.57.2",
|
"@unocss/nuxt": "^0.57.3",
|
||||||
"@vite-pwa/nuxt": "^0.1.1",
|
"@vite-pwa/nuxt": "^0.2.1",
|
||||||
"@vue/test-utils": "^2.4.1",
|
"@vue/test-utils": "^2.4.1",
|
||||||
"@vueuse/nuxt": "^10.5.0",
|
"@vueuse/nuxt": "^10.6.0",
|
||||||
"@yunlefun/vue": "0.0.8-beta.4",
|
"@yunlefun/vue": "0.0.8-beta.4",
|
||||||
"@zadigetvoltaire/nuxt-gtm": "^0.0.13",
|
"@zadigetvoltaire/nuxt-gtm": "^0.0.13",
|
||||||
|
"bumpp": "^9.2.0",
|
||||||
"consola": "^3.2.3",
|
"consola": "^3.2.3",
|
||||||
"cross-env": "^7.0.3",
|
"cross-env": "^7.0.3",
|
||||||
"dexie": "^3.2.4",
|
"dexie": "^3.2.4",
|
||||||
@@ -59,9 +60,9 @@
|
|||||||
"pinia": "^2.1.7",
|
"pinia": "^2.1.7",
|
||||||
"sass": "^1.69.5",
|
"sass": "^1.69.5",
|
||||||
"star-markdown-css": "^0.4.2",
|
"star-markdown-css": "^0.4.2",
|
||||||
"tsx": "^3.14.0",
|
"tsx": "^4.1.1",
|
||||||
"typescript": "^5.2.2",
|
"typescript": "^5.2.2",
|
||||||
"unocss": "^0.57.2",
|
"unocss": "^0.57.3",
|
||||||
"vitest": "^0.34.6",
|
"vitest": "^0.34.6",
|
||||||
"vue-tsc": "^1.8.22"
|
"vue-tsc": "^1.8.22"
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,17 +8,17 @@ import { links } from '~/constants'
|
|||||||
我的
|
我的
|
||||||
</CommonHeader>
|
</CommonHeader>
|
||||||
|
|
||||||
<div mt-4 gap="3" grid="~ cols-3" px-2>
|
|
||||||
<YlfIconItem to="/recipes/history" icon="i-ri-history-line" label="历史记录" />
|
|
||||||
<YlfIconItem to="/recipes/collect" icon="i-ri-star-line" label="我的收藏" />
|
|
||||||
<YlfIconItem to="/cookbooks" icon="i-ri-article-line" label="自定义菜谱" />
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div
|
<div
|
||||||
class="mx-auto max-w-md w-full"
|
class="mx-auto max-w-md w-full"
|
||||||
px-2
|
px-2
|
||||||
text-left
|
text-left
|
||||||
>
|
>
|
||||||
|
<div mt-2 gap="3" grid="~ cols-3">
|
||||||
|
<YlfIconItem to="/recipes/history" icon="i-ri-history-line" label="历史记录" />
|
||||||
|
<YlfIconItem to="/recipes/collect" icon="i-ri-star-line" label="我的收藏" />
|
||||||
|
<YlfIconItem to="/cookbooks" icon="i-ri-article-line" label="自定义菜谱" />
|
||||||
|
</div>
|
||||||
|
|
||||||
<YlfForm>
|
<YlfForm>
|
||||||
<YlfFormItem icon="i-ri-feedback-line" label="立即反馈" :to="links.feedback" target="_blank" />
|
<YlfFormItem icon="i-ri-feedback-line" label="立即反馈" :to="links.feedback" target="_blank" />
|
||||||
<YlfFormItem icon="i-ri-mail-send-line" label="立即投稿" :to="links.contribute" target="_blank" />
|
<YlfFormItem icon="i-ri-mail-send-line" label="立即投稿" :to="links.contribute" target="_blank" />
|
||||||
|
|||||||
1732
pnpm-lock.yaml
generated
1732
pnpm-lock.yaml
generated
File diff suppressed because it is too large
Load Diff
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user