+
输入食材快速搜索菜谱
@@ -106,45 +120,6 @@
-
-
-
-
-
-
-
-
- {{ite.name}}
-
-
-
-
-
-
-
-
-
-
- {{ListDetail.title}}
- {{ListDetail.content.time}}
-
-
-
- {{it.name}}
- {{it.weight}}
- {{it.kcal}}
- {{it.time}}
-
-
-
- 更多详情
- 取消
-
-
-
-
-
@@ -157,31 +132,12 @@
data() {
return {
token: "",
- isShow: false,
- isFoodList: false,
- // today_intake: {
- // kcal: {},
- // list: [],
- // time: "",
- // title: "",
- // other_elements: {}
- // },
chartData: {
series: [{
- data: 1,
- color: "#ff4c4f"
+ data: 0,
+ color: "#3CB383"
}]
},
- ListDetail: {
- title: "",
- value: "",
- unit: "",
- content: {
- time: '',
- list: []
- }
- },
- addfoodList: [],
}
},
components: {
@@ -195,13 +151,15 @@
kcalVal() {
return this.configInfo.kcal_data
},
- today_intake() {
- return this.countFoodInfo.home_food_count.kcal_data
- }
+ foodInfo() {
+ let that = this
+ that.chartData.series[0].data = that.user.aud_id ? that.user.food_count.nutrients_four[0].proportion /
+ 100 : 0
+ return uni.getStorageSync('token') ? that.user.food_count : that.configInfo.food_count
+ },
},
onLoad() {
let that = this
- that.addfoodList = that.$json.addfoodList
that.token = uni.getStorageSync('token')
that.$store.dispatch("getHomeConfig")
},
@@ -215,92 +173,49 @@
}, 500);
},
methods: {
- //配置接口
- handleHomeConfig() {
- let that = this
- that.$model.getHomeConfig({}).then(res => {
- if (res.code != 0) return
- that.handleHomeUserInfo()
- that.$store.commit('changeConfig', res.data)
- })
- },
- // 获取账号信息
- handleHomeUserInfo() {
- let that = this
- that.$model.getHomeUserInfo({}).then(res => {
- if (res.code != 0) {
- that.$store.commit('changeUserInfo', {})
- console.log("11111")
- return
- }
- that.$store.commit('changeUserInfo', res.data)
- that.handleCountFoodInfo()
- })
- },
- // 计食器信息
- handleCountFoodInfo() {
- let that = this
- that.$model.getCountFoodInfo({
- aud_id: that.info.aud_id,
- time: that.$tools.getDate("start")
- }).then(res => {
- if (res.code != 0) return
- that.today_intake = res.data.home_food_count.kcal_data
- })
- },
-
- // 搜索
- handleSearch() {
- uni.switchTab({
- url: '/pages/search/search'
- })
- },
// 登录
handleLogin() {
uni.reLaunch({
url: "/pageTwo/login/login"
})
},
- //个人资料
- handleUserEdit() {
- uni.navigateTo({
- url: '/pageTwo/me/userEdit'
- })
- },
- // 计食器详情
- handleNavTo(time) {
- this.isShow = false
- uni.setStorageSync("startDay", time)
- uni.switchTab({
- url: "/pages/count/count"
- })
- },
- // 添加食物
- handleAddFood(ind, name) {
- this.isShow = false
- if (ind != 3) {
- uni.navigateTo({
- url: "/pageTwo/count/search?name=" + name + '&ind=' + ind
- })
- } else {
- this.isShow = true
- }
-
- },
- // 计食器列表详情
- handleListDetail(item) {
+ handleAddFood(name) {
let that = this
- console.log("item", item)
- if (item.content.list.length) {
- that.isFoodList = true
- that.ListDetail = item
- } else {
- that.$tools.msg("暂无摄入,快去添加吧")
+ if (!that.token) {
+ that.$tools.msg("登录后查看更多")
+ return
}
+ uni.navigateTo({
+ url: "/pageTwo/count/search?name=" + name + "&time=" + this.foodInfo.date
+ })
+ },
+ // 餐食详情
+ handledetail(ind) {
+ let that = this
+ if (!that.token) {
+ that.$tools.msg("登录后查看更多")
+ return
+ }
+ uni.navigateTo({
+ url: "/pageTwo/count/everyMeal?page=home&index=" + ind
+ })
+ },
+ handleEveryDay() {
+ let that = this
+ if (!that.token) {
+ that.$tools.msg("登录后查看更多")
+ return
+ }
+ uni.navigateTo({
+ url: "/pageTwo/count/everyDay?page=home"
+ })
},
-
// 功能页面跳转
navTo(url) {
+ if (!this.token) {
+ this.$tools.msg("登录后查看更多")
+ return
+ }
uni.navigateTo({
url
})
@@ -313,22 +228,14 @@
\ No newline at end of file
diff --git a/pages/menu/menu.vue b/pages/menu/menu.vue
index 9417161..0ad99ba 100644
--- a/pages/menu/menu.vue
+++ b/pages/menu/menu.vue
@@ -158,7 +158,7 @@
.right_inner_list {
display: flex;
flex-wrap: wrap;
- margin-top: 10px;
+ margin-top: 20rpx;
// justify-content: space-between;
}
@@ -169,14 +169,14 @@
margin: auto;
width: 140rpx;
height: 140rpx;
- border-radius: 10px;
+ border-radius: 20rpx;
}
text {
width: 100%;
display: inline-block;
text-align: center;
- margin-bottom: 10px;
+ margin-bottom: 20rpx;
}
}
\ No newline at end of file
diff --git a/pages/search/list.vue b/pages/search/list.vue
index be4808c..2fc61ce 100644
--- a/pages/search/list.vue
+++ b/pages/search/list.vue
@@ -1,7 +1,7 @@
-