kitchendDevice/tools/model.js

244 lines
6.7 KiB
JavaScript
Raw Normal View History

2023-09-08 15:17:21 +08:00
import http from './https.js'
import tools from './tools.js'
import store from '@/store'
export default {
2025-03-25 10:17:30 +08:00
// 登录
getonlogin(param) { // 登录
return http.post("/login_action", param).then(res => {
2023-09-08 15:17:21 +08:00
return res
})
},
getSendCode(param) { // 验证码
2025-03-25 10:17:30 +08:00
return http.post("/send_phone_email_code", param).then(res => {
2023-09-08 15:17:21 +08:00
return res
})
},
2025-03-25 10:17:30 +08:00
getregister(param) { // 注册
return http.post("/register_action", param).then(res => {
2023-09-08 15:17:21 +08:00
return res
})
},
2025-11-25 14:21:22 +08:00
getloginOut(param) { // 退出登录
return http.post("/user_quit_account", param).then(res => {
2025-04-02 09:49:39 +08:00
return res
})
},
2025-11-25 14:21:22 +08:00
getRegisterPhone(param) { // 手机号快捷登录
return http.post("/kitchenscale2/wechat_quick_login", param).then(res => {
2023-09-08 15:17:21 +08:00
return res
})
},
2025-03-25 10:17:30 +08:00
getResetPassword(param) { // 重置密码
2025-11-08 16:50:26 +08:00
return http.post("/kitchenscale2/reset_password", param).then(res => {
2023-09-08 15:17:21 +08:00
return res
})
},
2025-03-25 10:17:30 +08:00
getAccountPassword(param) { // 修改密码
2025-11-08 16:50:26 +08:00
return http.post("/kitchenscale2/update_my_password", param).then(res => {
2023-09-08 15:17:21 +08:00
return res
})
},
2025-03-25 10:17:30 +08:00
getAccountMsg(param) { // 邮箱/手机号绑定
2025-11-08 16:50:26 +08:00
return http.post("/kitchenscale2/update_my_account_msg", param).then(res => {
2023-09-08 15:17:21 +08:00
return res
})
},
2025-03-25 10:17:30 +08:00
// 首页
getHomeInfo(param) { // 默认数据
2025-11-08 16:50:26 +08:00
return http.post("/kitchenscale2/get_homepage_information", param).then(res => {
2023-09-08 15:17:21 +08:00
return res
})
},
2025-04-02 09:49:39 +08:00
getHomeUserInfo(param) { // 用户信息
2025-11-08 16:50:26 +08:00
return http.post("/kitchenscale2/get_user_msg", param).then(res => {
2025-04-02 09:49:39 +08:00
return res
})
},
getHomeConfig(param) { // 配置
2025-11-08 16:50:26 +08:00
return http.post("/kitchenscale2/get_default_config", param).then(res => {
2023-09-08 15:17:21 +08:00
return res
})
},
2025-03-25 10:17:30 +08:00
getHomeSearch(param) { // 首页搜索
2025-11-08 16:50:26 +08:00
return http.post("/kitchenscale2/search_column", param).then(res => {
2023-09-08 15:17:21 +08:00
return res
})
},
2025-03-25 10:17:30 +08:00
getUserInfoEdit(param) { // 修改用户信息
2025-11-08 16:50:26 +08:00
return http.post("/kitchenscale2/update_user_msg", param).then(res => {
2023-09-08 15:17:21 +08:00
return res
})
},
2025-07-28 16:57:16 +08:00
getSearchPopularFood(param) { //获取搜索页面常用食材
2025-11-08 16:50:26 +08:00
return http.post("/kitchenscale2/get_search_food_page_list", param).then(res => {
2025-07-28 16:57:16 +08:00
return res
})
},
getFoodSearch(param) { //搜索食材
2025-11-08 16:50:26 +08:00
return http.post("/kitchenscale2/get_food_list", param).then(res => {
2025-07-28 16:57:16 +08:00
return res
})
},
getMenuSearch(param) { //搜索菜谱
2025-11-08 16:50:26 +08:00
return http.post("/find_by_food", param).then(res => {
return res
})
},
getMenuSearchColumn(param) { //搜索菜谱2
return http.post("/kitchenscale2/search_column", param).then(res => {
2025-07-28 16:57:16 +08:00
return res
})
},
getPhotoSearch(param) { //图像识别
2025-11-08 16:50:26 +08:00
return http.post("/kitchenscale2/baidu_identify_food", param).then(res => {
2025-07-28 16:57:16 +08:00
return res
})
},
2025-03-25 10:17:30 +08:00
// 通用
getUploadImg(param) { // 上传素材
2025-11-08 16:50:26 +08:00
return http.upload("/kitchenscale2/pic_upload_one_action", param).then(res => {
2023-09-08 15:17:21 +08:00
return res
})
},
2025-03-25 10:17:30 +08:00
// 菜谱
getAddCookbook(param) { // 添加菜谱
2025-11-08 16:50:26 +08:00
return http.post("/kitchenscale2/add_cookbook", param).then(res => {
2023-09-08 15:17:21 +08:00
return res
})
},
2025-04-02 09:49:39 +08:00
getEditCookbook(param) { // 修改菜谱
2025-11-08 16:50:26 +08:00
return http.post("/kitchenscale2/update_cookbook", param).then(res => {
2025-04-02 09:49:39 +08:00
return res
})
},
2025-03-25 10:17:30 +08:00
getCookListLabel(param) { // 菜谱查询(根据菜谱标签拉取)
2025-11-08 16:50:26 +08:00
return http.post("/kitchenscale2/find_by_cook_label", param).then(res => {
2023-09-08 15:17:21 +08:00
return res
})
},
2025-03-25 10:17:30 +08:00
getCookListFood(param) { // 菜谱列表(根据食材名称拉取)
2025-11-08 16:50:26 +08:00
return http.post("/kitchenscale2/find_by_food", param).then(res => {
2023-09-08 15:17:21 +08:00
return res
})
},
2025-03-25 10:17:30 +08:00
getCookListDetails(param) { // 查询菜谱详情
2025-11-08 16:50:26 +08:00
return http.post("/kitchenscale2/cookbook_details", param).then(res => {
2023-09-08 15:17:21 +08:00
return res
})
},
2025-03-25 10:17:30 +08:00
getCookFollow(param) { // 关注行为
2025-11-08 16:50:26 +08:00
return http.post("/kitchenscale2/cookbook_follow", param).then(res => {
2023-09-08 15:17:21 +08:00
return res
})
},
2025-03-25 10:17:30 +08:00
getCookLike(param) { // 点赞收藏菜谱
2025-11-08 16:50:26 +08:00
return http.post("/kitchenscale2/cookbook_like", param).then(res => {
2023-09-08 15:17:21 +08:00
return res
})
},
2025-03-25 10:17:30 +08:00
getCookKcal(param) { // 食材卡路里计算
2025-11-08 16:50:26 +08:00
return http.post("/kitchenscale2/food_count_kcal", param).then(res => {
2023-09-08 15:17:21 +08:00
return res
})
},
2025-03-25 10:17:30 +08:00
// 食材
getCookFoodList(param) { // 食材列表
2025-11-08 16:50:26 +08:00
return http.post("/kitchenscale2/get_food_list", param).then(res => {
2023-09-08 15:17:21 +08:00
return res
})
},
2025-03-25 10:17:30 +08:00
getCookListSave(param) { // 食材列表查询
2025-11-08 16:50:26 +08:00
return http.post("/kitchenscale2/save_food_list", param).then(res => {
2023-09-08 15:17:21 +08:00
return res
})
},
2025-03-25 10:17:30 +08:00
// 计食器
getAddIntakeFood(param) { // 添加每日摄入记录
2025-11-08 16:50:26 +08:00
return http.post("/kitchenscale2/add_intake_food", param).then(res => {
2023-09-08 15:17:21 +08:00
return res
})
},
2025-03-25 10:17:30 +08:00
getCountfootCon(param) { // 每日记食器板块详细内容
2025-11-08 16:50:26 +08:00
return http.post("/kitchenscale2/get_countfoot_content", param).then(res => {
2023-09-08 15:17:21 +08:00
return res
})
},
2025-09-04 17:33:41 +08:00
delCEatAction(param) { // 删除餐饮食物
2025-11-08 16:50:26 +08:00
return http.post("/kitchenscale2/del_user_eat_log", param).then(res => {
2025-09-04 17:33:41 +08:00
return res
})
},
2025-03-25 10:17:30 +08:00
getLogList(param) { // 记食器角色饮食记录列表
2025-11-08 16:50:26 +08:00
return http.post("/kitchenscale2/get_log_list", param).then(res => {
2023-09-08 15:17:21 +08:00
return res
})
},
2025-03-25 10:17:30 +08:00
getSetUpContent(param) { // 计食器板块-设置里的内容
2025-11-08 16:50:26 +08:00
return http.post("/kitchenscale2/set_up_content", param).then(res => {
2025-03-25 10:17:30 +08:00
return res
})
},
getSetUserKcal(param) { // 设置用户的卡路里
2025-11-08 16:50:26 +08:00
return http.post("/kitchenscale2/set_user_kcal", param).then(res => {
2025-03-25 10:17:30 +08:00
return res
})
},
// 个人中心
getUserCollectList(param) { // 用户收藏点赞列表
2025-11-08 16:50:26 +08:00
return http.post("/kitchenscale2/get_user_collect_list", param).then(res => {
2025-03-25 10:17:30 +08:00
return res
})
},
getMyCookbook(param) { // 我的菜谱
2025-11-08 16:50:26 +08:00
return http.post("/kitchenscale2/get_my_cookbook", param).then(res => {
2025-03-25 10:17:30 +08:00
return res
})
},
2025-04-02 09:49:39 +08:00
getMyCookbookDel(param) { // 删除我的菜谱
2025-11-08 16:50:26 +08:00
return http.post("/kitchenscale2/del_my_cookbook", param).then(res => {
2025-04-02 09:49:39 +08:00
return res
})
},
2025-03-25 10:17:30 +08:00
getMyLogList(param) { // 饮食列表
2025-11-08 16:50:26 +08:00
return http.post("/kitchenscale2/get_log_list", param).then(res => {
2025-04-02 09:49:39 +08:00
let pkList = {
list: [],
Dlist: []
}
2025-03-25 10:17:30 +08:00
if (res.code == 0) {
for (var i = 0; i < res.data.content_list.length; i++) {
pkList.list.push(res.data.content_list[i])
if (!pkList.Dlist.includes(res.data.content_list[i].time)) { //includes 检测数组是否有某个值
pkList.Dlist.push(res.data.content_list[i].time);
2023-09-08 15:17:21 +08:00
}
2025-03-25 10:17:30 +08:00
}
2023-09-08 15:17:21 +08:00
}
2025-04-02 09:49:39 +08:00
res.data.pkList = pkList
2025-03-25 10:17:30 +08:00
return res.data
2023-09-08 15:17:21 +08:00
})
},
2025-03-25 10:17:30 +08:00
// 计食器
getAddIntakeFood(param) { // 添加每日摄入记录
2025-11-08 16:50:26 +08:00
return http.post("/kitchenscale2/add_intake_food", param).then(res => {
2023-09-08 15:17:21 +08:00
return res
})
},
2025-03-25 10:17:30 +08:00
getCountFoodInfo(param) { // 获取记食器板块详细内容
2025-11-08 16:50:26 +08:00
return http.post("/kitchenscale2/get_countfoot_content", param).then(res => {
2023-09-08 15:17:21 +08:00
return res
})
},
2025-03-25 10:17:30 +08:00
getCountSetKcal(param) { // 获取记食器设置里的内容
2025-11-08 16:50:26 +08:00
return http.post("/kitchenscale2/set_up_content", param).then(res => {
2023-09-08 15:17:21 +08:00
return res
})
},
2025-03-25 10:17:30 +08:00
getCountSetUserKcal(param) { // 获取记食器设置里的内容
2025-11-08 16:50:26 +08:00
return http.post("/kitchenscale2/set_user_kcal", param).then(res => {
2023-09-08 15:17:21 +08:00
return res
})
2025-03-25 10:17:30 +08:00
},
}