diff --git a/components/BasketButton.vue b/components/BasketButton.vue
new file mode 100644
index 0000000..84ed7a2
--- /dev/null
+++ b/components/BasketButton.vue
@@ -0,0 +1,24 @@
+
+
+
+
+
diff --git a/components/ChooseFood.vue b/components/ChooseFood.vue
index 52ab864..d194cca 100644
--- a/components/ChooseFood.vue
+++ b/components/ChooseFood.vue
@@ -3,16 +3,12 @@ import { storeToRefs } from 'pinia'
import type { StuffItem } from '~/data/food'
import { meat, staple, tools, vegetable } from '~/data/food'
-import { useInvisibleElement } from '~/composables/helper'
import { useEmojiAnimation } from '~/composables/animation'
-import { useRecipe } from '~/composables/recipe'
const rStore = useRecipeStore()
const { curTool } = storeToRefs(rStore)
const curStuff = computed(() => rStore.selectedStuff)
-const { displayedRecipe, clickTool } = useRecipe(rStore.recipes)
-
const recipeBtn = ref()
const { playAnimation } = useEmojiAnimation(recipeBtn)
@@ -35,30 +31,9 @@ function toggleStuff(item: StuffItem, category = '', _e?: Event) {
action: item.name,
})
}
-
-const recipePanel = ref()
-const { isVisible, show } = useInvisibleElement(recipePanel)
-
-
-
-
🥘 先选一下食材
@@ -123,7 +98,7 @@ const { isVisible, show } = useInvisibleElement(recipePanel)
{{ item.emoji }}
@@ -137,44 +112,5 @@ const { isVisible, show } = useInvisibleElement(recipePanel)
-
-
- 🍲 来看看组合出的菜谱吧!
-
-
-
-
-
-
-
-
-
-
-
- 你要先选食材或工具哦~
-
-
-
-
-
-
-
- 还没有完美匹配的菜谱呢……
-
- 大胆尝试一下,或者
- 换个组合?
-
- 欢迎来
- 这里
- 反馈新的菜谱!
-
-
-
-
-
-
-
-
-
-
+
diff --git a/components/FAQItem.vue b/components/FAQItem.vue
new file mode 100644
index 0000000..1b0c133
--- /dev/null
+++ b/components/FAQItem.vue
@@ -0,0 +1,25 @@
+
+
+
+
+
+ {{ title }}
+
+
+
+
+
+
+
diff --git a/components/RecipePanel.vue b/components/RecipePanel.vue
new file mode 100644
index 0000000..14c2c34
--- /dev/null
+++ b/components/RecipePanel.vue
@@ -0,0 +1,53 @@
+
+
+
+
+
+
+
+
+
+ 🍲 来看看组合出的菜谱吧!
+
+
+
+
+
+
+
+
+
+
+
+ 你要先选食材或工具哦~
+
+
+
+
+
+
+
+ 还没有完美匹配的菜谱呢……
+
+ 大胆尝试一下,或者
+ 换个组合?
+
+ 欢迎来
+ 这里
+ 反馈新的菜谱!
+
+
+
+
+
+
+
+
+
+
+
diff --git a/components/TheBottomMenu.vue b/components/TheBottomMenu.vue
new file mode 100644
index 0000000..105ecb8
--- /dev/null
+++ b/components/TheBottomMenu.vue
@@ -0,0 +1,51 @@
+
+
+
+
+
+
+
diff --git a/components/AboutMe.vue b/components/content/AboutMe.vue
similarity index 100%
rename from components/AboutMe.vue
rename to components/content/AboutMe.vue
diff --git a/components/Menu.vue b/components/content/AboutMenu.vue
similarity index 80%
rename from components/Menu.vue
rename to components/content/AboutMenu.vue
index 50aefca..b2632b9 100644
--- a/components/Menu.vue
+++ b/components/content/AboutMenu.vue
@@ -1,11 +1,5 @@
-
diff --git a/composables/helper.ts b/composables/helper.ts
index 8e8e589..ddaffbb 100644
--- a/composables/helper.ts
+++ b/composables/helper.ts
@@ -1,12 +1,12 @@
+import type { MaybeComputedElementRef } from '@vueuse/core'
import { isClient, useElementBounding } from '@vueuse/core'
-import type { Ref } from 'vue'
/**
* trigger show invisible element
* @param target
* @returns
*/
-export function useInvisibleElement(target: Ref) {
+export function useInvisibleElement(target: MaybeComputedElementRef) {
const { top } = useElementBounding(target)
const isVisible = computed(() => {
diff --git a/composables/recipe.ts b/composables/recipe.ts
deleted file mode 100644
index 02a071c..0000000
--- a/composables/recipe.ts
+++ /dev/null
@@ -1,81 +0,0 @@
-import { storeToRefs } from 'pinia'
-import type { Recipes } from '~/types'
-
-import type { StuffItem } from '~/data/food'
-import { useRecipeStore } from '~/composables/store/recipe'
-
-export function useRecipe(recipe: Recipes) {
- const gtm = useGtm()
-
- const rStore = useRecipeStore()
- const { curMode, curTool } = storeToRefs(rStore)
- const curStuff = computed(() => rStore.selectedStuff)
-
- // 默认严格模式
- const displayedRecipe = computed(() => {
- // if keyword exist, return result directly
- const keyword = rStore.keyword
- if (keyword)
- return recipe.filter(item => item.name.includes(keyword))
-
- if (curMode.value === 'strict') {
- return recipe.filter((item) => {
- const stuffFlag = curStuff.value.every(stuff => item.stuff.includes(stuff))
- const toolFlag = item.tools?.includes(curTool.value)
- return curTool.value ? (stuffFlag && toolFlag) : stuffFlag
- })
- }
- else if (curMode.value === 'loose') {
- return recipe.filter((item) => {
- const stuffFlag = curStuff.value.some(stuff => item.stuff.includes(stuff))
- const toolFlag = item.tools?.includes(curTool.value)
-
- // 同时存在 厨具和材料,则同时判断
- if (curTool.value && curStuff.value.length) {
- return stuffFlag && toolFlag
- }
- else {
- if (curStuff.value.length)
- return stuffFlag
- else if (curTool.value)
- return toolFlag
-
- return false
- }
- })
- }
- // survival
- else {
- return recipe.filter((item) => {
- const stuffFlag = item.stuff.every(stuff => curStuff.value.includes(stuff))
- const toolFlag = item.tools?.includes(curTool.value)
- return curTool.value ? (stuffFlag && toolFlag) : stuffFlag
- })
- }
- })
-
- /**
- * toggle tool
- * @param item
- */
- const clickTool = (item: StuffItem) => {
- const value = item.name
- rStore.toggleTools(value)
-
- gtm?.trackEvent({
- event: 'click',
- category: `tool_${value}`,
- action: 'click_tool',
- label: '工具',
- })
- gtm?.trackEvent({
- event: 'click_tool',
- action: item.name,
- })
- }
-
- return {
- displayedRecipe,
- clickTool,
- }
-}
diff --git a/composables/store/recipe.ts b/composables/store/recipe.ts
index a7b8a32..bffb826 100644
--- a/composables/store/recipe.ts
+++ b/composables/store/recipe.ts
@@ -3,6 +3,7 @@ import { useStorage } from '@vueuse/core'
import type { RecipeItem, Recipes } from '~/types'
import recipeData from '~/data/recipe.json'
+import type { StuffItem } from '~/data/food'
const namespace = 'cook'
@@ -80,6 +81,69 @@ export const useRecipeStore = defineStore('recipe', () => {
const randomRecipe = ref(generateRandomRecipe(recipes))
+ const gtm = useGtm()
+
+ // 默认严格模式
+ const displayedRecipe = computed(() => {
+ if (keyword.value)
+ return recipes.filter(item => item.name.includes(keyword.value))
+
+ if (curMode.value === 'strict') {
+ return recipes.filter((item) => {
+ const stuffFlag = selectedStuff.value.every(stuff => item.stuff.includes(stuff))
+ const toolFlag = item.tools?.includes(curTool.value)
+ return curTool.value ? (stuffFlag && toolFlag) : stuffFlag
+ })
+ }
+ else if (curMode.value === 'loose') {
+ return recipes.filter((item) => {
+ const stuffFlag = selectedStuff.value.some(stuff => item.stuff.includes(stuff))
+ const toolFlag = item.tools?.includes(curTool.value)
+
+ // 同时存在 厨具和材料,则同时判断
+ if (curTool.value && selectedStuff.value.length) {
+ return stuffFlag && toolFlag
+ }
+ else {
+ if (selectedStuff.value.length)
+ return stuffFlag
+ else if (curTool.value)
+ return toolFlag
+
+ return false
+ }
+ })
+ }
+ // survival
+ else {
+ return recipes.filter((item) => {
+ const stuffFlag = item.stuff.every(stuff => selectedStuff.value.includes(stuff))
+ const toolFlag = item.tools?.includes(curTool.value)
+ return curTool.value ? (stuffFlag && toolFlag) : stuffFlag
+ })
+ }
+ })
+
+ /**
+ * toggle tool
+ * @param item
+ */
+ const clickTool = (item: StuffItem) => {
+ const value = item.name
+ toggleTools(value)
+
+ gtm?.trackEvent({
+ event: 'click',
+ category: `tool_${value}`,
+ action: 'click_tool',
+ label: '工具',
+ })
+ gtm?.trackEvent({
+ event: 'click_tool',
+ action: item.name,
+ })
+ }
+
return {
recipes,
@@ -98,6 +162,10 @@ export const useRecipeStore = defineStore('recipe', () => {
setMode,
addStuff,
+
+ // useRecipe
+ displayedRecipe,
+ clickTool,
}
})
diff --git a/content/about.md b/content/about.md
index cff8b5e..f40b608 100644
--- a/content/about.md
+++ b/content/about.md
@@ -2,6 +2,8 @@
title: 关于
---
+:AboutMenu
+
### **🍜 好的,今天我们来做菜!**
> 希望大家吃的开心!
@@ -54,11 +56,11 @@ Hello,我是云游君。
此外,我也会继续尝试做一些有趣或有用的东西,并分享给大家。
你也可以在这些地方找到我。
-
+:AboutMe
对了,给微信公众号「云游君」发送「做菜」也可以快速找到这个网址。
-## [**赞助者**](https://sponsors.yunyoujun.cn)
+## 赞助者
也非常感谢至今以来的所有赞助者们!
diff --git a/content/help.md b/content/help.md
deleted file mode 100644
index 7385b80..0000000
--- a/content/help.md
+++ /dev/null
@@ -1,38 +0,0 @@
----
-title: 帮助
----
-
-- 相关链接
- - [居家菜谱投稿](https://docs.qq.com/form/page/DWk9GWW9oTmlXZU9V)
- - [晒晒你的菜](https://docs.qq.com/sheet/DQk1vdkhFV0twQVNS?tab=dmeahc)
- - [反馈建议](https://docs.qq.com/sheet/DQk1vdkhFV0twQVNS?tab=snaau2)
-- 网站相关
- - 故障/新功能反馈:[Issues](https://github.com/YunYouJun/cook/issues)
- - 交流/建议/分享:[Discussions](https://github.com/YunYouJun/cook/issues)
-
-## **模式说明**
-
-- 模糊匹配:展示所有含当前选中任意食材的菜谱
-- 精准匹配:展示所有含当前选中所有食材的菜谱
-- 生存模式:展示当前选中食材即可制作的所有菜谱
-
-## **友情提示**
-
-- 点击首页最上方的大锅图标,可清空所选食材和工具。
-
-
-
-
-## FAQ
-
-### 页面无法点击、资源加载失败?
-
-> 试试「无痕模式」是否正常?
-
-1. 清除 Cookie(点击浏览器网址前方的 🔒 图标,找到 Cookie 并清除)
-2. 🔒 图标,网站数据(清除)
-3. 强制刷新缓存
- - Windows: `Ctrl + F5`
- - macOS: `Cmd + Shift + R`
-
-
diff --git a/layouts/default.vue b/layouts/default.vue
index cf5a5a9..1c41bbe 100644
--- a/layouts/default.vue
+++ b/layouts/default.vue
@@ -1,7 +1,8 @@
-
-
+
+
+
diff --git a/nuxt.config.ts b/nuxt.config.ts
index f88c9dc..ef02a66 100644
--- a/nuxt.config.ts
+++ b/nuxt.config.ts
@@ -14,7 +14,10 @@ export default defineNuxtConfig({
'@nuxtjs/color-mode',
'@vite-pwa/nuxt',
'@nuxt/content',
+
'@zadigetvoltaire/nuxt-gtm',
+
+ '@yunlefun/vue/nuxt',
],
experimental: {
diff --git a/package.json b/package.json
index 398be26..95b4969 100644
--- a/package.json
+++ b/package.json
@@ -23,6 +23,7 @@
},
"devDependencies": {
"@antfu/eslint-config": "^0.39.8",
+ "@headlessui/vue": "^1.7.15",
"@iconify-json/carbon": "^1.1.18",
"@iconify-json/fe": "^1.1.6",
"@iconify-json/gg": "^1.1.5",
@@ -40,6 +41,7 @@
"@vite-pwa/nuxt": "^0.1.0",
"@vue/test-utils": "^2.4.1",
"@vueuse/nuxt": "^10.2.1",
+ "@yunlefun/vue": "^0.0.7",
"@zadigetvoltaire/nuxt-gtm": "^0.0.13",
"consola": "^3.2.3",
"cross-env": "^7.0.3",
diff --git a/pages/[...slug].vue b/pages/[...slug].vue
index 83caa52..b27d348 100644
--- a/pages/[...slug].vue
+++ b/pages/[...slug].vue
@@ -1,5 +1,5 @@
-
+
{{ doc.title }}
diff --git a/pages/help.vue b/pages/help.vue
new file mode 100644
index 0000000..c8dac5a
--- /dev/null
+++ b/pages/help.vue
@@ -0,0 +1,92 @@
+
+
+
+
+
+ 帮助
+
+
+
+
+ - 模糊匹配:展示所有含当前选中任意食材的菜谱
+ - 精准匹配:展示所有含当前选中所有食材的菜谱
+ - 生存模式:展示当前选中食材即可制作的所有菜谱
+
+
+
+
+
+
+
+
+ 暂时没有开发 APP 的计划。
+
+ 但我们正在优化 PWA 的体验,以便您可以直接将本站添加到桌面,并享受类似 APP 的体验。
+
+ 敬请期待!
+
+
+
+
+ 试试「无痕模式」是否正常?
+
+
+
+ -
+ 清除 Cookie
+
+ -
+ 点击浏览器网址前方的 🔒 图标
+
+ -
+ 点击「Cookie」并清除
+
+
+
+ -
+ 强制刷新缓存
+
+ - Windows:
Ctrl + F5
+ - macOS:
Cmd + Shift + R
+
+
+
+
+
+
+
+ -
+ 相关链接
+
+
+ -
+ 网站相关
+
+
+
+
+
+
+
diff --git a/pages/settings.vue b/pages/settings.vue
new file mode 100644
index 0000000..c2bab97
--- /dev/null
+++ b/pages/settings.vue
@@ -0,0 +1,7 @@
+
+
+
+
+
diff --git a/pages/user.vue b/pages/user.vue
new file mode 100644
index 0000000..76a97a2
--- /dev/null
+++ b/pages/user.vue
@@ -0,0 +1,7 @@
+
+
+
diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml
index 10116b2..dee48f4 100644
--- a/pnpm-lock.yaml
+++ b/pnpm-lock.yaml
@@ -13,6 +13,9 @@ devDependencies:
'@antfu/eslint-config':
specifier: ^0.39.8
version: 0.39.8(eslint@8.46.0)(typescript@5.1.6)
+ '@headlessui/vue':
+ specifier: ^1.7.15
+ version: 1.7.15(vue@3.3.4)
'@iconify-json/carbon':
specifier: ^1.1.18
version: 1.1.18
@@ -64,6 +67,9 @@ devDependencies:
'@vueuse/nuxt':
specifier: ^10.2.1
version: 10.2.1(nuxt@3.6.3)(rollup@2.79.1)(vue@3.3.4)
+ '@yunlefun/vue':
+ specifier: ^0.0.7
+ version: 0.0.7
'@zadigetvoltaire/nuxt-gtm':
specifier: ^0.0.13
version: 0.0.13(nuxt@3.6.3)(rollup@2.79.1)(vue@3.3.4)
@@ -1956,6 +1962,15 @@ packages:
'@hapi/hoek': 9.3.0
dev: true
+ /@headlessui/vue@1.7.15(vue@3.3.4):
+ resolution: {integrity: sha512-3ozVEgQ8mw09nWvUPN+8S6C8l3SM0lVT1aEN/+oP5Y4LF0WNMM9UrVisVTN9LLQ06v/X3EFA0blyL/vg8XNZlg==}
+ engines: {node: '>=10'}
+ peerDependencies:
+ vue: ^3.2.0
+ dependencies:
+ vue: 3.3.4
+ dev: true
+
/@humanwhocodes/config-array@0.11.10:
resolution: {integrity: sha512-KVVjQmNUepDVGXNuoRRdmmEjruj0KfiGSbS8LVc12LMsWDQzRXJ0qdhN8L8uUigKpfEHRhlaQFY0ib1tnUbNeQ==}
engines: {node: '>=10.10.0'}
@@ -4109,6 +4124,10 @@ packages:
resolution: {integrity: sha512-NuHqBY1PB/D8xU6s/thBgOAiAP7HOYDQ32+BFZILJ8ivkUkAHQnWfn6WhL79Owj1qmUnoN/YPhktdIoucipkAQ==}
dev: true
+ /@yunlefun/vue@0.0.7:
+ resolution: {integrity: sha512-d5CSyg5LDlg/r6lm+99MZrlS9TzqmAA+pEM+7CpezkhsRkRpqXJWg/K12dex7hcewC9gRYb3GrEVnI7NeAuhTw==}
+ dev: true
+
/@zadigetvoltaire/nuxt-gtm@0.0.13(nuxt@3.6.3)(rollup@2.79.1)(vue@3.3.4):
resolution: {integrity: sha512-7SgXtIB8uLdLGJaoUAQSGCSbRnNzplNkNVFKIHaVI4We0vqghstBoVPlJCJ9VdwsfdNyk3/C+Lh1uKpzTrtEuw==}
peerDependencies:
diff --git a/styles/markdown.scss b/styles/markdown.scss
index 8dedfbb..4af460b 100644
--- a/styles/markdown.scss
+++ b/styles/markdown.scss
@@ -5,3 +5,32 @@
list-style: disc;
}
}
+
+blockquote {
+ border-left: 0.25em solid #ddd;
+ padding: 0 1em;
+ color: #777;
+ quotes: '\\201C''\\201D''\\2018''\\2019';
+}
+
+ol {
+ list-style: decimal;
+ padding-left: 2em;
+
+ li {
+ line-height: 2;
+ }
+}
+
+ul {
+ list-style: disc;
+ padding-left: 2em;
+
+ li {
+ line-height: 2;
+ }
+}
+
+a {
+ border-bottom: 1px dashed #ddd;
+}
diff --git a/vercel.json b/vercel.json
deleted file mode 100644
index 448dc52..0000000
--- a/vercel.json
+++ /dev/null
@@ -1,7 +0,0 @@
-{
- "rewrites": [
- { "source": "/about", "destination": "/index.html" },
- { "source": "/help", "destination": "/index.html" },
- { "source": "/wechat", "destination": "/index.html" }
- ]
-}