diff --git a/App.vue b/App.vue index cd44c25..4e36e0f 100644 --- a/App.vue +++ b/App.vue @@ -28,13 +28,13 @@ export default { globalData: { // 定义后端数据库地址信息 fit_journey_basic_address: 'http://127.0.0.1:8086',//TODO:已完成 - fit_journey_community_address: 'http://47.122.61.54:8082',//TODO:已完成 + fit_journey_community_address: 'http://127.0.0.1:8082',//TODO:已完成 fit_journey_ai_address: 'http://47.122.61.54:8081',//TODO:配置完成 - fit_journey_login_address: 'http://47.122.61.54:8084',//TODO:配置完成 + fit_journey_login_address: 'http://127.0.0.1:8084',//TODO:配置完成 fit_journey_recipe_address: 'http://47.122.61.54:8087',//TODO:配置完成 fit_journey_exercise_address: 'http://47.122.61.54:8080',//TODO:配置完成 fit_journey_admin_address: 'http://47.122.61.54:8085',//TODO:已完成 - + message_count: 0, // TODO: 后期需要把 token 更换成从 localStorage 中获取 token: 'eyJhbGciOiJIUzI1NiJ9.eyJzdW' + 'IiOiIxODU5MDU4ODM2NDQ3NDk4MjQyIiwiaXNz' + diff --git a/components/my_recipe_plan/my_recipe_plan.vue b/components/my_recipe_plan/my_recipe_plan.vue index 3df6ce4..8d4739c 100644 --- a/components/my_recipe_plan/my_recipe_plan.vue +++ b/components/my_recipe_plan/my_recipe_plan.vue @@ -26,7 +26,7 @@ export default { methods: { go_to_page() { uni.navigateTo({ - url: '/pages/homepages/homes/my_exercise_plan/my_exercise_plan' + url: '/pages/homepages/homes/my_recipe_plan/my_recipe_plan' }) uni.showToast({ title: '跳转成功', diff --git a/pages/homepages/community/community/community.vue b/pages/homepages/community/community/community.vue index 9a76cb1..d0c47a0 100644 --- a/pages/homepages/community/community/community.vue +++ b/pages/homepages/community/community/community.vue @@ -186,5 +186,5 @@ export default { diff --git a/pages/homepages/homes/choice_book/choice_book.vue b/pages/homepages/homes/choice_book/choice_book.vue index 42310dd..3e8acdf 100644 --- a/pages/homepages/homes/choice_book/choice_book.vue +++ b/pages/homepages/homes/choice_book/choice_book.vue @@ -1,5 +1,20 @@ @@ -8,47 +23,101 @@ export default { data() { return { - token: uni.getStorageSync("access_token") + token: uni.getStorageSync("access_token"), + searchText: '' }; }, methods:{ - go_to_apple()//苹果 - { - uni.navigateTo({ - url: "/pages/homepages/homes//pages/homepages/homes/dictionary/apple/apple" - }) - }, - go_to_orange()//橘子 - { - uni.navigateTo({ - url: "/pages/homepages/homes/dictionary/orange/orange" + go_back(){ + uni.navigateTo({ + url: '/pages/homepages/homes/home/home' }) - }, - go_to_peach()//桃子 - { - uni.navigateTo({ - url: "/pages/homepages/homes/choice_book/choice_book" - }) - }, - go_to_watermelon()//西瓜 - { - uni.navigateTo({ - url: "/pages/homepages/homes//pages/homepages/homes/dictionary/apple/apple" + uni.showToast({ + title: '正在返回主页面', + icon: 'none', + duration: 2000 }) }, + onSearch() { + console.log('搜索内容:', this.searchText) + } + } +} + + diff --git a/pages/homepages/homes/home/home.vue b/pages/homepages/homes/home/home.vue index 49fc326..fa20859 100644 --- a/pages/homepages/homes/home/home.vue +++ b/pages/homepages/homes/home/home.vue @@ -4,16 +4,20 @@ - + + - + + - + + - + + @@ -71,6 +75,40 @@ export default { }; }, methods:{ + go_to_exercise(){ + uni.navigateTo({ + url: '/pages/homepages/homes/my_exercise_plan/my_exercise_plan' + }); + uni.showToast({ + title: '跳转成功', + }) + }, + go_to_read(){ + uni.navigateTo({ + url: '/pages/homepages/homes/choice_book/choice_book' + }); + uni.showToast({ + title: '跳转成功', + }) + }, + + go_to_community(){ + uni.navigateTo({ + url: '/pages/homepages/community/community/community' + }); + uni.showToast({ + title: '跳转成功', + }) + }, + go_to_puppy_chat(){ + uni.navigateTo({ + url: '/pages/homepages/puppy_chat/puppy_chat' + }); + uni.showToast({ + title: '跳转成功', + }) + }, + go_to_choice_book(){ uni.navigateTo({ url: '/pages/homepages/homes/choice_book/choice_book' diff --git a/pages/homepages/homes/knowledge_dictionary/knowledge_dictionary.vue b/pages/homepages/homes/knowledge_dictionary/knowledge_dictionary.vue index 46cb2f1..9f59fac 100644 --- a/pages/homepages/homes/knowledge_dictionary/knowledge_dictionary.vue +++ b/pages/homepages/homes/knowledge_dictionary/knowledge_dictionary.vue @@ -5,8 +5,6 @@ - - diff --git a/pages/homepages/homes/my_recipe_plan/my_recipe_plan.vue b/pages/homepages/homes/my_recipe_plan/my_recipe_plan.vue index 342846f..88d9c50 100644 --- a/pages/homepages/homes/my_recipe_plan/my_recipe_plan.vue +++ b/pages/homepages/homes/my_recipe_plan/my_recipe_plan.vue @@ -1,17 +1,287 @@ diff --git a/pages/homepages/puppy_chat/puppy_chat.vue b/pages/homepages/puppy_chat/puppy_chat.vue index 8bdf15c..709847f 100644 --- a/pages/homepages/puppy_chat/puppy_chat.vue +++ b/pages/homepages/puppy_chat/puppy_chat.vue @@ -1,28 +1,28 @@ - diff --git a/pages/login/register/register.vue b/pages/login/register/register.vue index 64f0585..66bb597 100644 --- a/pages/login/register/register.vue +++ b/pages/login/register/register.vue @@ -26,7 +26,7 @@ {{captchaButtonText}} - *验证码错误 + 验证码错误 @@ -99,6 +99,13 @@ const title = computed(()=>isRegisterSuccess.value? '成功':'错误'); //弹窗 const content = computed(()=>isRegisterSuccess.value? '注册成功':'注册失败'); //弹窗内容 const isOpenPopUp = ref(false);//是否显示弹窗 + +const is_phone_registered = ref();//用0表示手机号没有被注册 1表示手机号被注册 + + + + + /*正则表达式相关变量*/ const pMatch = /^1(3[0-9]|4[01456879]|5[0-35-9]|6[2567]|7[0-8]|8[0-9]|9[0-35-9])\d{8}$/ @@ -184,7 +191,7 @@ function sendCaptchaEvent(){ /*-----密码码相关函数-----*/ function openEyesEvent_1(){ - //TODO: 判断第一个密码是否要明文显示 + if (isOpened_1.value) { isOpened_1.value = false; @@ -197,7 +204,7 @@ function openEyesEvent_1(){ } } function openEyesEvent_2(){ - //TODO: 判断第二个密码是否要明文显示 + if (isOpened_2.value) { isOpened_2.value = false; @@ -214,6 +221,12 @@ function openEyesEvent_2(){ function checkSubmit(){ var flag = true + if(code.data===undefined){ + uni.showToast({ + title: '验证码不能为空', + icon: "error", + }) + }//验证验证码是不是空 //验证手机号 if (phone_number.value===undefined){ flag = false @@ -284,6 +297,35 @@ function registerEvent(){ console.log(code.value); console.log(phone_number.value); console.log(passagenum.value); + + + //判断手机号是否被注册 向后端发送请求 + uni.request({ + url:app.globalData.fit_journey_login_address+'/common/isPhoneRegistered', + header: { + 'content-type': 'application/x-www-form-urlencoded', + }, + method:'GET', + data:{ + phone:phone_number.value, + + }, + success:(res)=>{ + console.log(res); + if(res.data.code===400) { + is_phone_registered.value=1; + } + }, + }) + + if(is_phone_registered.value===1){//说明手机号已经被注册了 + uni.showToast({ + title: '手机号已经被注册了~', + icon: "error", + }); + } + + if (checkSubmit()){ //手机号注册网络请求 console.log("服务器地址是:"+app.globalData.fit_journey_login_address); diff --git a/static/homepages/homes/choice_book/pictures/book.png b/static/homepages/homes/choice_book/pictures/book.png new file mode 100644 index 0000000..af9d07f Binary files /dev/null and b/static/homepages/homes/choice_book/pictures/book.png differ diff --git a/static/homepages/homes/choice_book/pictures/book1.png b/static/homepages/homes/choice_book/pictures/book1.png new file mode 100644 index 0000000..de37502 Binary files /dev/null and b/static/homepages/homes/choice_book/pictures/book1.png differ diff --git a/static/homepages/homes/choice_book/pictures/book2.png b/static/homepages/homes/choice_book/pictures/book2.png new file mode 100644 index 0000000..8adef45 Binary files /dev/null and b/static/homepages/homes/choice_book/pictures/book2.png differ diff --git a/static/homepages/homes/choice_book/pictures/book3.png b/static/homepages/homes/choice_book/pictures/book3.png new file mode 100644 index 0000000..22b0b0e Binary files /dev/null and b/static/homepages/homes/choice_book/pictures/book3.png differ diff --git a/static/homepages/homes/choice_book/pictures/book4.png b/static/homepages/homes/choice_book/pictures/book4.png new file mode 100644 index 0000000..30f2375 Binary files /dev/null and b/static/homepages/homes/choice_book/pictures/book4.png differ diff --git a/static/homepages/homes/choice_book/pictures/search_area.png b/static/homepages/homes/choice_book/pictures/search_area.png new file mode 100644 index 0000000..1455f41 Binary files /dev/null and b/static/homepages/homes/choice_book/pictures/search_area.png differ diff --git a/static/homepages/homes/home/css/home.scss b/static/homepages/homes/home/css/home.scss index 749ae30..a3b35cb 100644 --- a/static/homepages/homes/home/css/home.scss +++ b/static/homepages/homes/home/css/home.scss @@ -22,6 +22,43 @@ width: 98%; left: 1%; } + +.swiper_item_background{ + justify-content: center; + align-items: center; + height: 100%; + width: 100%; + +} +.puppy_chat_button{ + position: absolute; + height: 20%; + width: 38%; + left: 6%; + top: 63%; + z-index: 1000; +} +.exercise_button{ + position: absolute; + height: 18%; + width: 38%; + left: 6%; + top: 69%; + z-index: 1000; +} + + + + + + + + + + + + + .swiper_item { justify-content: center; align-items: center; diff --git a/static/homepages/homes/my_recipe_plan/js/database.js b/static/homepages/homes/my_recipe_plan/js/database.js new file mode 100644 index 0000000..d8bfd26 --- /dev/null +++ b/static/homepages/homes/my_recipe_plan/js/database.js @@ -0,0 +1,133 @@ +export const foodCaloriesDB = { + // 主食类 + '米饭': 116, + '馒头': 223, + '面条': 110, + '包子': 200, + '饺子': 220, + '油条': 389, + '面包': 265, + '粥': 50, + '炒面': 260, + '炒饭': 290, + + // 肉类 + '猪肉': 143, + '牛肉': 106, + '鸡肉': 167, + '鸭肉': 240, + '羊肉': 203, + '鱼肉': 100, + '虾': 85, + '蛋': 155, + + // 蔬菜类 + '西红柿': 20, + '黄瓜': 16, + '胡萝卜': 36, + '白菜': 20, + '菠菜': 23, + '生菜': 15, + '茄子': 24, + '土豆': 81, + '青椒': 20, + + // 水果类 + '苹果': 52, + '香蕉': 89, + '橙子': 47, + '葡萄': 69, + '西瓜': 32, + '梨': 51, + '草莓': 32, + '柚子': 39, + + // 饮品类 + '牛奶': 79, + '豆浆': 31, + '可乐': 42, + '果汁': 54, + '咖啡': 1, + '奶茶': 150, + + // 常见菜品 + '西红柿炒鸡蛋': 100, + '宫保鸡丁': 260, + '鱼香肉丝': 195, + '红烧肉': 425, + '糖醋里脊': 290, + '麻婆豆腐': 174, + '青椒炒肉': 180, + '回锅肉': 327, + '蒜蓉炒菜心': 45, + '炒青菜': 30, + '土豆炖牛肉': 215, + '红烧排骨': 289, + '清炒白菜': 35, + '炸鸡': 260, + '水煮鱼': 180, + '酸菜鱼': 168, + + // 零食类 + '薯片': 536, + '巧克力': 546, + '饼干': 435, + '爆米花': 382, + '坚果': 607, + '冰淇淋': 267, + '蛋糕': 257, + + // 快餐类 + '汉堡': 295, + '披萨': 266, + '炸薯条': 312, + '炸鸡翅': 246, + '热狗': 290 +} + +// 模糊搜索函数 +export const searchFood = (keyword) => { + keyword = keyword.toLowerCase() + const results = [] + + for (const [food, calories] of Object.entries(foodCaloriesDB)) { + if (food.toLowerCase().includes(keyword)) { + results.push({ + name: food, + calories: calories + }) + } + } + + return results +} + +// 获取单个食物的卡路里 +export const getFoodCalories = (foodName) => { + // 直接匹配 + if (foodCaloriesDB[foodName]) { + return foodCaloriesDB[foodName] + } + + // 模糊匹配 + const results = searchFood(foodName) + if (results.length > 0) { + return results[0].calories + } + + return null +} + +// 获取食物分类列表 +export const getFoodCategories = () => { + return { + '主食类': ['米饭', '馒头', '面条', '包子', '饺子', '油条', '面包', '粥'], + '肉类': ['猪肉', '牛肉', '鸡肉', '鸭肉', '羊肉', '鱼肉', '虾', '蛋'], + '蔬菜类': ['西红柿', '黄瓜', '胡萝卜', '白菜', '菠菜', '生菜', '茄子', '土豆', '青椒'], + '水果类': ['苹果', '香蕉', '橙子', '葡萄', '西瓜', '梨', '草莓', '柚子'], + '饮品类': ['牛奶', '豆浆', '可乐', '果汁', '咖啡', '奶茶'], + '常见菜品': ['西红柿炒鸡蛋', '宫保鸡丁', '鱼香肉丝', '红烧肉', '糖醋里脊', '麻婆豆腐'], + '零食类': ['薯片', '巧克力', '饼干', '爆米花', '坚果', '冰淇淋', '蛋糕'], + '快餐类': ['汉堡', '披萨', '炸薯条', '炸鸡翅', '热狗'] + } +} diff --git a/static/homepages/homes/my_recipe_plan/my_recipe_plan.scss b/static/homepages/homes/my_recipe_plan/my_recipe_plan.scss new file mode 100644 index 0000000..945c9b4 --- /dev/null +++ b/static/homepages/homes/my_recipe_plan/my_recipe_plan.scss @@ -0,0 +1 @@ +. \ No newline at end of file diff --git a/static/homepages/homes/my_recipe_plan/pictures/button.png b/static/homepages/homes/my_recipe_plan/pictures/button.png new file mode 100644 index 0000000..d404bd4 Binary files /dev/null and b/static/homepages/homes/my_recipe_plan/pictures/button.png differ diff --git a/static/homepages/homes/my_recipe_plan/pictures/time_line.png b/static/homepages/homes/my_recipe_plan/pictures/time_line.png new file mode 100644 index 0000000..ff531df Binary files /dev/null and b/static/homepages/homes/my_recipe_plan/pictures/time_line.png differ diff --git a/unpackage/dist/cache/.vite/deps/_metadata.json b/unpackage/dist/cache/.vite/deps/_metadata.json index bca37d4..71bef9f 100644 --- a/unpackage/dist/cache/.vite/deps/_metadata.json +++ b/unpackage/dist/cache/.vite/deps/_metadata.json @@ -1,8 +1,8 @@ { - "hash": "70943268", - "configHash": "c265b382", - "lockfileHash": "e3b0c442", - "browserHash": "d782de90", + "hash": "0aaf698d", + "configHash": "cc60d382", + "lockfileHash": "22a0e42d", + "browserHash": "89d9bfb2", "optimized": {}, "chunks": {} } \ No newline at end of file