From 871f3dc05626fdfa0a0db0ff0474ce774ef1d76d Mon Sep 17 00:00:00 2001 From: huangdeliang <huangdeliang@skieer.com> Date: Thu, 18 Mar 2021 19:16:06 +0800 Subject: [PATCH 1/3] =?UTF-8?q?=E5=A2=9E=E5=8A=A0bmi=E5=80=BC=E5=B1=95?= =?UTF-8?q?=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../custom/SysFoodHeatStatisticsController.java | 1 - stdiet-ui/src/components/BodySignView/index.vue | 7 ++++--- stdiet-ui/src/components/HealthyView/index.vue | 11 +++++++---- .../src/components/PhysicalSignsDialog/index.vue | 8 ++++++++ stdiet-ui/src/utils/healthyData.js | 6 ++++++ 5 files changed, 25 insertions(+), 8 deletions(-) diff --git a/stdiet-admin/src/main/java/com/stdiet/web/controller/custom/SysFoodHeatStatisticsController.java b/stdiet-admin/src/main/java/com/stdiet/web/controller/custom/SysFoodHeatStatisticsController.java index 4e9350315..7307e2008 100644 --- a/stdiet-admin/src/main/java/com/stdiet/web/controller/custom/SysFoodHeatStatisticsController.java +++ b/stdiet-admin/src/main/java/com/stdiet/web/controller/custom/SysFoodHeatStatisticsController.java @@ -30,7 +30,6 @@ public class SysFoodHeatStatisticsController extends BaseController /** * 查询外食热量统计列表 */ - @PreAuthorize("@ss.hasPermi('custom:foodHeatStatistics:list')") @GetMapping("/list") public TableDataInfo list(SysCustomerHeatStatistics sysCustomerHeatStatistics) { diff --git a/stdiet-ui/src/components/BodySignView/index.vue b/stdiet-ui/src/components/BodySignView/index.vue index b7f1cdffc..ed5c404dd 100644 --- a/stdiet-ui/src/components/BodySignView/index.vue +++ b/stdiet-ui/src/components/BodySignView/index.vue @@ -104,9 +104,10 @@ export default { [{ title: "方便沟通时间", value: "connectTime" }], ]; if (this.dev) { - basicInfo.splice(3, 0, [{ title: "蛋白范围", value: "recProtein" }]); - basicInfo.splice(4, 0, [{ title: "基础代谢BMR", value: "basicBMR" }]); - basicInfo.splice(5, 0, [ + basicInfo.splice(3, 0, [{ title: "BMI", value: "bmi" }]); + basicInfo.splice(4, 0, [{ title: "蛋白范围", value: "recProtein" }]); + basicInfo.splice(5, 0, [{ title: "基础代谢BMR", value: "basicBMR" }]); + basicInfo.splice(6, 0, [ { title: "不运动总热量", value: "notSportHeat" }, ]); basicInfo.splice(basicInfo.length, 0, [ diff --git a/stdiet-ui/src/components/HealthyView/index.vue b/stdiet-ui/src/components/HealthyView/index.vue index 3f33b25fe..298d9abac 100644 --- a/stdiet-ui/src/components/HealthyView/index.vue +++ b/stdiet-ui/src/components/HealthyView/index.vue @@ -90,12 +90,15 @@ export default { [{ title: "地域", value: "position" }], ]; if (this.dev) { - basicInfo.splice(3, 0, [{ title: "推荐蛋白范围", value: "recProtein" }]); - basicInfo.splice(4, 0, [{ title: "基础代谢BMR", value: "basicBMR" }]); - basicInfo.splice(5, 0, [ + basicInfo.splice(3, 0, [{ title: "BMI", value: "bmi" }]); + basicInfo.splice(4, 0, [{ title: "推荐蛋白范围", value: "recProtein" }]); + basicInfo.splice(5, 0, [{ title: "基础代谢BMR", value: "basicBMR" }]); + basicInfo.splice(6, 0, [ { title: "不运动总热量", value: "notSportHeat" }, ]); - basicInfo.splice(basicInfo.length, 0, [{ title: "备注", value: "remark" }]); + basicInfo.splice(basicInfo.length, 0, [ + { title: "备注", value: "remark" }, + ]); } return { diff --git a/stdiet-ui/src/components/PhysicalSignsDialog/index.vue b/stdiet-ui/src/components/PhysicalSignsDialog/index.vue index 2d7f4c080..875da991d 100644 --- a/stdiet-ui/src/components/PhysicalSignsDialog/index.vue +++ b/stdiet-ui/src/components/PhysicalSignsDialog/index.vue @@ -305,6 +305,7 @@ export default { ["创建时间", "客户姓名", "手机号"], ["调理项目", "性别", "年龄"], ["身高(厘米)", "体重(斤)", "地域"], + ["BMI", "", ""], ], [ ["减脂经历", "减脂遇到的困难", "减脂是否反弹"], @@ -355,6 +356,7 @@ export default { ["createTime", "name", "phone"], ["conditioningProject", "sex", "age"], ["tall", "weight", "position"], + ["bmi", "", ""], ], [ ["experience", "difficulty", "rebound"], @@ -711,6 +713,12 @@ export default { } return arr; }, []); + detailHealthy.bmi = ( + detailHealthy.weight / + 2 / + (detailHealthy.tall / 100) / + (detailHealthy.tall / 100) + ).toFixed(1); this.detailHealthy = detailHealthy; for (let i = 0; i < this.healthyTitleData.length; i++) { let stepArray = []; diff --git a/stdiet-ui/src/utils/healthyData.js b/stdiet-ui/src/utils/healthyData.js index 509d7ecbf..a0c1a9816 100644 --- a/stdiet-ui/src/utils/healthyData.js +++ b/stdiet-ui/src/utils/healthyData.js @@ -473,6 +473,12 @@ const moduleObj = { //健康信息处理,将数组转为字符串 export function dealHealthy(customerHealthy) { + customerHealthy.bmi = ( + customerHealthy.weight / + 2 / + (customerHealthy.tall / 100) / + (customerHealthy.tall / 100) + ).toFixed(1); customerHealthy.basicBMR = ( (10 * customerHealthy.weight) / 2 + 6.25 * customerHealthy.tall - From 47f77bcc6f60c4a12e53fa4eb3fefcb0a38b4053 Mon Sep 17 00:00:00 2001 From: huangdeliang <huangdeliang@skieer.com> Date: Thu, 18 Mar 2021 19:52:10 +0800 Subject: [PATCH 2/3] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E7=83=AD=E9=87=8F?= =?UTF-8?q?=E9=A5=BC=E5=9B=BE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- stdiet-ui/src/store/modules/recipes.js | 6 ++++-- .../custom/recipesBuild/InfoView/PieChart/index.vue | 13 +++++++------ 2 files changed, 11 insertions(+), 8 deletions(-) diff --git a/stdiet-ui/src/store/modules/recipes.js b/stdiet-ui/src/store/modules/recipes.js index 3448e1f42..c5dc6652a 100644 --- a/stdiet-ui/src/store/modules/recipes.js +++ b/stdiet-ui/src/store/modules/recipes.js @@ -517,6 +517,7 @@ const getters = { obj.fHeat = obj.fWeight * 9; obj.cWeight += (igd.weight / 100) * igd.carbonRatio; obj.cHeat = obj.cWeight * 4; + obj.totalHeat = obj.pHeat + obj.fHeat + obj.cHeat; obj[`heat${cur.type}`] += (igd.weight / 100) * igd.proteinRatio * 4 + (igd.weight / 100) * igd.fatRatio * 9 + @@ -532,16 +533,17 @@ const getters = { pHeat: 0, fHeat: 0, cHeat: 0, + totalHeat: 0, heat1: 0, heat2: 0, heat3: 0, heat4: 0, heat5: 0, - heat6: 0, + heat6: 0 } ) ); - // console.log(nutriData); + console.log(nutriData); return nutriData; }, verifyNotRecData: state => diff --git a/stdiet-ui/src/views/custom/recipesBuild/InfoView/PieChart/index.vue b/stdiet-ui/src/views/custom/recipesBuild/InfoView/PieChart/index.vue index 1da5ce55c..3e4eda1bc 100644 --- a/stdiet-ui/src/views/custom/recipesBuild/InfoView/PieChart/index.vue +++ b/stdiet-ui/src/views/custom/recipesBuild/InfoView/PieChart/index.vue @@ -38,7 +38,7 @@ <div class="summary"> <div style="font-size: 12px; color: #606266">总热量约等于</div> <div style="color: #515a6e; font-weight: bold"> - {{ totalHeat.toFixed(1) }}千卡 + {{ data[0] ? data[0].totalHeat.toFixed(1) : 0 }}千卡 </div> </div> </div> @@ -82,7 +82,6 @@ export default { data() { return { chart: null, - totalHeat: 0, nameDict: { p: "蛋白质", f: "脂肪", @@ -107,15 +106,15 @@ export default { mData() { const [data] = this.data; if (!data) { - this.totalHeat = 0; return []; } - this.totalHeat = data.cHeat + data.fHeat + data.pHeat; const mData = ["Weight", "Rate"].map((t, idx) => ({ type: this.typeDict[t], ...["p", "f", "c"].reduce((obj, cur) => { obj[cur] = idx - ? `${((data[`${cur}Heat`] / this.totalHeat) * 100).toFixed(2)}%` + ? data.totalHeat === 0 + ? 0 + : `${((data[`${cur}Heat`] / data.totalHeat) * 100).toFixed(2)}%` : `${data[`${cur}Weight`].toFixed(1)}克`; return obj; }, {}), @@ -199,7 +198,9 @@ export default { top: 18, left: 8, style: { - text: `${this.totalHeat.toFixed(1)}千卡`, + text: `${ + data.totalHeat ? data.totalHeat.toFixed(1) : 0 + }千卡`, font: '14px "Microsoft YaHei", sans-serif', }, }, From 5f7e4c45db94dfaa880a7b2a91699703eea6c007 Mon Sep 17 00:00:00 2001 From: huangdeliang <huangdeliang@skieer.com> Date: Fri, 19 Mar 2021 10:55:51 +0800 Subject: [PATCH 3/3] =?UTF-8?q?=E5=9B=BE=E7=89=87=E9=A2=84=E8=A7=88?= =?UTF-8?q?=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/views/custom/ingredient/index.vue | 34 +++++++++++++++++++ 1 file changed, 34 insertions(+) diff --git a/stdiet-ui/src/views/custom/ingredient/index.vue b/stdiet-ui/src/views/custom/ingredient/index.vue index 37e214f60..8bac238f2 100644 --- a/stdiet-ui/src/views/custom/ingredient/index.vue +++ b/stdiet-ui/src/views/custom/ingredient/index.vue @@ -352,6 +352,7 @@ :on-success="handleOnUploadSuccess" :on-exceed="handleOnUploadExceed" :on-remove="handleOnUploadRemove" + :on-preview="handleOnUploadPreview" list-type="picture" > <em class="el-icon-upload" /> @@ -408,6 +409,17 @@ <el-button @click="cancel">取 消</el-button> </div> </el-dialog> + + <!-- 预览弹窗 --> + <el-dialog + :visible.sync="previewVisible" + :title="previewTitle" + class="preview_dialog_wrapper" + > + <div class="preview_content"> + <img :src="previewUrl" alt="" class="preview_img" /> + </div> + </el-dialog> </div> </template> @@ -437,6 +449,7 @@ export default { return { // 遮罩层 loading: true, + // actionUrl: process.env.VUE_APP_BASE_API + "/custom/fileUpload/ingredient", // 选中数组 @@ -480,6 +493,10 @@ export default { form: {}, // 表单校验 rules: {}, + // + previewVisible: false, + previewUrl: "", + previewTitle: "", }; }, created() { @@ -704,6 +721,23 @@ export default { type: "warning", }); }, + handleOnUploadPreview(file) { + console.log(file); + this.previewTitle = file.name; + this.previewVisible = true; + this.previewUrl = file.url; + }, }, }; </script> +<style lang="scss" scoped> +.preview_dialog_wrapper { + .preview_content { + text-align: center; + .preview_img { + max-height: 600px; + width: auto; + } + } +} +</style>