修复健康信息
This commit is contained in:
78
stdiet-ui/src/views/custom/recipesBuild/InfoView/index.vue
Normal file
78
stdiet-ui/src/views/custom/recipesBuild/InfoView/index.vue
Normal file
@ -0,0 +1,78 @@
|
||||
<template>
|
||||
<div class="recipes_build_info_view_wrapper">
|
||||
<div class="top" v-if="!!recipesData.length">
|
||||
<BarChart
|
||||
v-if="analyseData.length > 1"
|
||||
:data="analyseData"
|
||||
height="160px"
|
||||
width="100%"
|
||||
:max="max"
|
||||
/>
|
||||
<PieChart
|
||||
v-if="analyseData.length === 1"
|
||||
:data="analyseData"
|
||||
height="160px"
|
||||
width="100%"
|
||||
/>
|
||||
</div>
|
||||
<div class="content">
|
||||
<TemplateInfoView v-if="!!temId" :data="templateInfo" />
|
||||
<HealthyView :data="healthyData" v-else-if="healthyDataType === 0" dev />
|
||||
<BodySignView :data="healthyData" v-else dev />
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
<script>
|
||||
import { createNamespacedHelpers } from "vuex";
|
||||
const {
|
||||
mapActions,
|
||||
mapState,
|
||||
mapGetters,
|
||||
} = createNamespacedHelpers("recipes");
|
||||
import BarChart from "./BarChart";
|
||||
import PieChart from "./PieChart";
|
||||
import TemplateInfoView from "./TemplateInfoView";
|
||||
import HealthyView from "@/components/HealthyView";
|
||||
import BodySignView from "@/components/BodySignView";
|
||||
export default {
|
||||
name: "InfoView",
|
||||
data() {
|
||||
const { temId } = this.$route.query;
|
||||
return { temId };
|
||||
},
|
||||
components: {
|
||||
BarChart,
|
||||
PieChart,
|
||||
HealthyView,
|
||||
BodySignView,
|
||||
TemplateInfoView,
|
||||
},
|
||||
computed: {
|
||||
max() {
|
||||
const { basicBMR } = this.healthyData || {};
|
||||
return basicBMR
|
||||
? parseFloat(basicBMR.substring(0, basicBMR.indexOf("千卡")))
|
||||
: 0;
|
||||
},
|
||||
...mapState([
|
||||
"recipesData",
|
||||
"healthyData",
|
||||
"healthyDataType",
|
||||
"templateInfo",
|
||||
]),
|
||||
...mapGetters(["analyseData"]),
|
||||
},
|
||||
};
|
||||
</script>
|
||||
<style lang="scss" scoped>
|
||||
.recipes_build_info_view_wrapper {
|
||||
.top {
|
||||
height: 160px;
|
||||
}
|
||||
|
||||
.content {
|
||||
overflow: auto;
|
||||
height: calc(100% - 160px);
|
||||
}
|
||||
}
|
||||
</style>
|
@ -1,7 +1,8 @@
|
||||
<template>
|
||||
<div class="recipes_header_com_wrapper">
|
||||
<div class="header_btns" v-loading="loading">
|
||||
<section>
|
||||
<section style="display: flex; align-items: center">
|
||||
<em class="el-icon-s-unfold collapse_btn" />
|
||||
<div>食谱制作</div>
|
||||
<el-button
|
||||
size="mini"
|
||||
@ -165,6 +166,10 @@ export default {
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
padding-bottom: 8px;
|
||||
|
||||
.collapse_btn {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
.font_size_style {
|
||||
|
@ -27,7 +27,7 @@ export default {
|
||||
data() {
|
||||
return {};
|
||||
},
|
||||
props: ["data", "analyseData", "name", "numRange"],
|
||||
props: ["data", "name"],
|
||||
};
|
||||
</script>
|
||||
<style lang="scss" scoped >
|
||||
|
@ -1,48 +1,16 @@
|
||||
<template>
|
||||
<div class="recipes_build_wrapper" v-title :data-title="name">
|
||||
<div class="left" v-loading="recipesDataLoading">
|
||||
<div class="left"></div>
|
||||
<div class="content" v-loading="recipesDataLoading">
|
||||
<RecipesView
|
||||
v-if="!!recipesData.length"
|
||||
:data="recipesData"
|
||||
:name="healthyData.name"
|
||||
:analyseData="analyseData"
|
||||
/>
|
||||
<RecommendView v-else />
|
||||
</div>
|
||||
<div class="right" v-loading="healthDataLoading">
|
||||
<div class="top" v-if="!!recipesData.length">
|
||||
<BarChart
|
||||
v-if="analyseData.length > 1"
|
||||
:data="analyseData"
|
||||
height="160px"
|
||||
width="100%"
|
||||
:max="
|
||||
healthyData.basicBMR
|
||||
? parseFloat(
|
||||
healthyData.basicBMR.substring(
|
||||
0,
|
||||
healthyData.basicBMR.indexOf('千卡')
|
||||
)
|
||||
)
|
||||
: 0
|
||||
"
|
||||
/>
|
||||
<PieChart
|
||||
v-if="analyseData.length === 1"
|
||||
:data="analyseData"
|
||||
height="160px"
|
||||
width="100%"
|
||||
/>
|
||||
</div>
|
||||
<div class="content">
|
||||
<TemplateInfoView v-if="!!temId" :data="templateInfo" />
|
||||
<HealthyView
|
||||
:data="healthyData"
|
||||
v-else-if="healthyDataType === 0"
|
||||
dev
|
||||
/>
|
||||
<BodySignView :data="healthyData" v-else dev />
|
||||
</div>
|
||||
<InfoView />
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
@ -54,14 +22,9 @@ const {
|
||||
mapMutations,
|
||||
mapGetters,
|
||||
} = createNamespacedHelpers("recipes");
|
||||
|
||||
import HealthyView from "@/components/HealthyView";
|
||||
import BodySignView from "@/components/BodySignView";
|
||||
import RecipesView from "./RecipesView/index";
|
||||
import RecipesView from "./RecipesView";
|
||||
import RecommendView from "./RecommendView";
|
||||
import TemplateInfoView from "./TemplateInfoView";
|
||||
import BarChart from "./BarChart";
|
||||
import PieChart from "./PieChart";
|
||||
import InfoView from "./InfoView";
|
||||
|
||||
export default {
|
||||
name: "BuildRecipies",
|
||||
@ -87,25 +50,18 @@ export default {
|
||||
},
|
||||
created() {},
|
||||
components: {
|
||||
BarChart,
|
||||
PieChart,
|
||||
HealthyView,
|
||||
BodySignView,
|
||||
RecipesView,
|
||||
RecommendView,
|
||||
TemplateInfoView,
|
||||
InfoView,
|
||||
},
|
||||
props: ["name", "planId"],
|
||||
computed: {
|
||||
...mapState([
|
||||
"healthyData",
|
||||
"healthyDataType",
|
||||
"templateInfo",
|
||||
"recipesData",
|
||||
"recipesDataLoading",
|
||||
"healthDataLoading",
|
||||
]),
|
||||
...mapGetters(["analyseData"]),
|
||||
},
|
||||
methods: {
|
||||
...mapActions(["init"]),
|
||||
@ -119,6 +75,8 @@ export default {
|
||||
display: flex;
|
||||
height: 100vh;
|
||||
.left {
|
||||
}
|
||||
.content {
|
||||
flex: 4;
|
||||
border-right: 1px solid #e6ebf5;
|
||||
height: 100%;
|
||||
@ -129,15 +87,6 @@ export default {
|
||||
flex: 1;
|
||||
height: 100%;
|
||||
padding-left: 20px;
|
||||
|
||||
.top {
|
||||
height: 160px;
|
||||
}
|
||||
|
||||
.content {
|
||||
overflow: auto;
|
||||
height: calc(100% - 160px);
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
Reference in New Issue
Block a user