kitchendDevice/tools/model.js

239 lines
6.5 KiB
JavaScript

import http from './https.js'
import tools from './tools.js'
import store from '@/store'
export default {
// 登录
getonlogin(param) { // 登录
return http.post("/login_action", param).then(res => {
return res
})
},
getSendCode(param) { // 验证码
return http.post("/send_phone_email_code", param).then(res => {
return res
})
},
getregister(param) { // 注册
return http.post("/register_action", param).then(res => {
return res
})
},
getRegisterPhone(param) { // 手机号快捷登录
return http.post("/kitchenscale/wechat_quick_login", param).then(res => {
return res
})
},
getloginOut(param) { // 退出登录
return http.post("/user_quit_account", param).then(res => {
return res
})
},
getResetPassword(param) { // 重置密码
return http.post("/reset_password", param).then(res => {
return res
})
},
getAccountPassword(param) { // 修改密码
return http.post("/update_my_password", param).then(res => {
return res
})
},
getAccountMsg(param) { // 邮箱/手机号绑定
return http.post("/update_my_account_msg", param).then(res => {
return res
})
},
// 首页
getHomeInfo(param) { // 默认数据
return http.post("/kitchenscale/get_homepage_information", param).then(res => {
return res
})
},
getHomeUserInfo(param) { // 用户信息
return http.post("/kitchenscale/get_user_msg", param).then(res => {
return res
})
},
getHomeConfig(param) { // 配置
return http.post("/kitchenscale/get_default_config", param).then(res => {
return res
})
},
getHomeSearch(param) { // 首页搜索
return http.post("/kitchenscale/search_column", param).then(res => {
return res
})
},
getUserInfoEdit(param) { // 修改用户信息
return http.post("/kitchenscale/update_user_msg", param).then(res => {
return res
})
},
getSearchPopularFood(param) { //获取搜索页面常用食材
return http.post("/kitchenscale/get_search_food_page_list", param).then(res => {
return res
})
},
getFoodSearch(param) { //搜索食材
return http.post("/kitchenscale/find_food", param).then(res => {
return res
})
},
getMenuSearch(param) { //搜索菜谱
return http.post("/kitchenscale/find_by_food", param).then(res => {
return res
})
},
getPhotoSearch(param) { //图像识别
return http.post("/kitchenscale/baidu_identify_food", param).then(res => {
return res
})
},
// 通用
getUploadImg(param) { // 上传素材
return http.upload("/kitchenscale/pic_upload_one_action", param).then(res => {
return res
})
},
// 菜谱
getAddCookbook(param) { // 添加菜谱
return http.post("/kitchenscale/add_cookbook", param).then(res => {
return res
})
},
getEditCookbook(param) { // 修改菜谱
return http.post("/kitchenscale/update_cookbook", param).then(res => {
return res
})
},
getCookListLabel(param) { // 菜谱查询(根据菜谱标签拉取)
return http.post("/kitchenscale/find_by_cook_label", param).then(res => {
return res
})
},
getCookListFood(param) { // 菜谱列表(根据食材名称拉取)
return http.post("/kitchenscale/find_by_food", param).then(res => {
return res
})
},
getCookListDetails(param) { // 查询菜谱详情
return http.post("/kitchenscale/cookbook_details", param).then(res => {
return res
})
},
getCookFollow(param) { // 关注行为
return http.post("/kitchenscale/cookbook_follow", param).then(res => {
return res
})
},
getCookLike(param) { // 点赞收藏菜谱
return http.post("/kitchenscale/cookbook_like", param).then(res => {
return res
})
},
getCookKcal(param) { // 食材卡路里计算
return http.post("/kitchenscale/food_count_kcal", param).then(res => {
return res
})
},
// 食材
getCookFoodList(param) { // 食材列表
return http.post("/kitchenscale/get_food_list", param).then(res => {
return res
})
},
getCookListSave(param) { // 食材列表查询
return http.post("/kitchenscale/save_food_list", param).then(res => {
return res
})
},
// 计食器
getAddIntakeFood(param) { // 添加每日摄入记录
return http.post("/kitchenscale/add_intake_food", param).then(res => {
return res
})
},
getCountfootCon(param) { // 每日记食器板块详细内容
return http.post("/kitchenscale/get_countfoot_content", param).then(res => {
return res
})
},
delCEatAction(param) { // 删除餐饮食物
return http.post("/kitchenscale/del_user_eat_log", param).then(res => {
return res
})
},
getLogList(param) { // 记食器角色饮食记录列表
return http.post("/kitchenscale/get_log_list", param).then(res => {
return res
})
},
getSetUpContent(param) { // 计食器板块-设置里的内容
return http.post("/kitchenscale/set_up_content", param).then(res => {
return res
})
},
getSetUserKcal(param) { // 设置用户的卡路里
return http.post("/kitchenscale/set_user_kcal", param).then(res => {
return res
})
},
// 个人中心
getUserCollectList(param) { // 用户收藏点赞列表
return http.post("/kitchenscale/get_user_collect_list", param).then(res => {
return res
})
},
getMyCookbook(param) { // 我的菜谱
return http.post("/kitchenscale/get_my_cookbook", param).then(res => {
return res
})
},
getMyCookbookDel(param) { // 删除我的菜谱
return http.post("/kitchenscale/del_my_cookbook", param).then(res => {
return res
})
},
getMyLogList(param) { // 饮食列表
return http.post("/kitchenscale/get_log_list", param).then(res => {
let pkList = {
list: [],
Dlist: []
}
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);
}
}
}
res.data.pkList = pkList
return res.data
})
},
// 计食器
getAddIntakeFood(param) { // 添加每日摄入记录
return http.post("/kitchenscale/add_intake_food", param).then(res => {
return res
})
},
getCountFoodInfo(param) { // 获取记食器板块详细内容
return http.post("/kitchenscale/get_countfoot_content", param).then(res => {
return res
})
},
getCountSetKcal(param) { // 获取记食器设置里的内容
return http.post("/kitchenscale/set_up_content", param).then(res => {
return res
})
},
getCountSetUserKcal(param) { // 获取记食器设置里的内容
return http.post("/kitchenscale/set_user_kcal", param).then(res => {
return res
})
},
}