diff --git a/stdiet-admin/src/main/java/com/stdiet/web/controller/custom/WebSocketController.java b/stdiet-admin/src/main/java/com/stdiet/web/controller/custom/WebSocketController.java index 4ae0335ec..4c2ec561d 100644 --- a/stdiet-admin/src/main/java/com/stdiet/web/controller/custom/WebSocketController.java +++ b/stdiet-admin/src/main/java/com/stdiet/web/controller/custom/WebSocketController.java @@ -2,8 +2,8 @@ package com.stdiet.web.controller.custom; import com.alibaba.fastjson.JSONObject; import com.stdiet.common.core.controller.BaseController; -import com.stdiet.custom.utils.WsUtils; import com.stdiet.custom.server.WebSocketServer; +import com.stdiet.custom.utils.WsUtils; import org.springframework.scheduling.annotation.EnableScheduling; import org.springframework.scheduling.annotation.Scheduled; import org.springframework.stereotype.Controller; @@ -38,16 +38,16 @@ public class WebSocketController extends BaseController { } -// @Scheduled(fixedRate = 30000) -// public void boardCast() { -// try { -// JSONObject heartBeat = new JSONObject(); -// heartBeat.put("type", WsUtils.WS_TYPE_HEART_BEAT); -// heartBeat.put("msg", "ping"); -// -// WebSocketServer.sendInfo(heartBeat.toJSONString(), null); -// } catch (IOException e) { -// e.printStackTrace(); -// } -// } + @Scheduled(fixedRate = 1800000) + public void boardCast() { + try { + JSONObject heartBeat = new JSONObject(); + heartBeat.put("type", WsUtils.WS_TYPE_SYSTEM_MESSAGE_CLEAN); + heartBeat.put("msg", "clean"); + + WebSocketServer.sendInfo(heartBeat.toJSONString(), null); + } catch (IOException e) { + e.printStackTrace(); + } + } } diff --git a/stdiet-custom/src/main/java/com/stdiet/custom/utils/WsUtils.java b/stdiet-custom/src/main/java/com/stdiet/custom/utils/WsUtils.java index a1b2286bf..fb76c3526 100644 --- a/stdiet-custom/src/main/java/com/stdiet/custom/utils/WsUtils.java +++ b/stdiet-custom/src/main/java/com/stdiet/custom/utils/WsUtils.java @@ -6,6 +6,8 @@ public class WsUtils { public static final String WS_TYPE_SYSTEM_MESSAGE = "WS_TYPE_SYSTEM_MESSAGE"; + public static final String WS_TYPE_SYSTEM_MESSAGE_CLEAN = "WS_TYPE_SYSTEM_MESSAGE_CLEAN"; + public static final String WS_TYPE_MESSAGE_COUNT = "WS_TYPE_MESSAGE_COUNT"; public static final String WS_TYPE_NEW_CUSTOMER_REPLY = "WS_TYPE_NEW_CUSTOMER_REPLY"; diff --git a/stdiet-ui/src/components/RecipesPlanDrawer/index.vue b/stdiet-ui/src/components/RecipesPlanDrawer/index.vue index 60e7b60b1..c024ae6e4 100644 --- a/stdiet-ui/src/components/RecipesPlanDrawer/index.vue +++ b/stdiet-ui/src/components/RecipesPlanDrawer/index.vue @@ -192,7 +192,7 @@ export default { }, methods: { showDrawer(data) { - // console.log(data); + console.log(data); this.data = data; if (!this.data) { return; diff --git a/stdiet-ui/src/store/modules/message.js b/stdiet-ui/src/store/modules/message.js index e3643e1c5..168bf4cbb 100644 --- a/stdiet-ui/src/store/modules/message.js +++ b/stdiet-ui/src/store/modules/message.js @@ -1,5 +1,9 @@ import { getCustomerPhysicalSignsByCusId } from "@/api/custom/customer"; import { dealHealthy } from "@/utils/healthyData"; +import { + listRecipesPlanByCusId, + updateRecipesPlan +} from "@/api/custom/recipesPlan"; import { fetchTopicList, @@ -16,7 +20,10 @@ const oriState = { healthyData: {}, healthDataLoading: false, healthyDataType: 0, - avoidFoodIds: [] + avoidFoodIds: [], + // + planList: [], + planListLoading: false }; const mutations = { @@ -71,12 +78,17 @@ const actions = { }, async fetchTopicDetailActions({ commit, dispatch, state }, payload) { const { topicId, id, uid } = payload; - const { healthyData } = state; + const { healthyData, planList } = state; commit("save", { selTopicId: topicId }); // 客户信息 if (healthyData.customerId !== parseInt(uid)) { dispatch("getHealthyData", { cusId: uid, callback: payload.callback }); } + // 食谱计划 + if (!planList.length || planList[0].cusId !== parseInt(uid)) { + dispatch("getRecipesPlanActions", { cusId: uid }); + } + // const result = await fetchTopicDetail({ topicId, id }); if (result.code === 200) { @@ -130,13 +142,39 @@ const actions = { obj => obj.id ); } - } else { - throw new Error(healthyDataResult.msg); } commit("save", { healthDataLoading: false, ...newState }); + }, + async getRecipesPlanActions({ commit }, payload) { + commit("save", { planListLoading: true, planList: [] }); + const result = await listRecipesPlanByCusId(payload.cusId); + let planList = []; + if (result.code === 200) { + planList = result.data; + } + commit("save", { + planList, + planListLoading: false + }); + }, + async updateRecipesPlanActions({ commit, state }, payload) { + const { id, sendFlag, callback } = payload; + const { planList } = state; + const result = await updateRecipesPlan({ id, sendFlag }); + if (result.code === 200) { + callback && callback("success", result.msg); + const newPlanList = JSON.parse(JSON.stringify(planList)); + const tarPlan = newPlanList.find(obj => obj.id === id); + if (tarPlan) { + tarPlan.sendFlag = sendFlag; + } + commit("save", { + planList: newPlanList + }); + } } }; diff --git a/stdiet-ui/src/views/custom/message/messageBrowser/Comment.vue b/stdiet-ui/src/views/custom/message/messageBrowser/Comment.vue index 94a390e71..e60aaa6f4 100644 --- a/stdiet-ui/src/views/custom/message/messageBrowser/Comment.vue +++ b/stdiet-ui/src/views/custom/message/messageBrowser/Comment.vue @@ -31,6 +31,7 @@ export default { dietician: "主任营养师", after_sale: "售后营养师", dietician_assistant: "营养师助理", + manager: "总经理", }, }; }, diff --git a/stdiet-ui/src/views/custom/message/messageBrowser/index.vue b/stdiet-ui/src/views/custom/message/messageBrowser/index.vue index dac7a0d1b..f90b80429 100644 --- a/stdiet-ui/src/views/custom/message/messageBrowser/index.vue +++ b/stdiet-ui/src/views/custom/message/messageBrowser/index.vue @@ -353,6 +353,13 @@ export default { .topic_detail_title { display: flex; cursor: pointer; + + & > :nth-child(1) { + flex: 0 0 40px; + } + & > :nth-child(2) { + flex: 1 0 0; + } } .comment_reply_item { diff --git a/stdiet-ui/src/views/custom/message/userInfo/index.vue b/stdiet-ui/src/views/custom/message/userInfo/index.vue index ba447aeb3..304299003 100644 --- a/stdiet-ui/src/views/custom/message/userInfo/index.vue +++ b/stdiet-ui/src/views/custom/message/userInfo/index.vue @@ -1,38 +1,61 @@ + diff --git a/stdiet-ui/src/views/custom/message/userInfo/recipesPlan.vue b/stdiet-ui/src/views/custom/message/userInfo/recipesPlan.vue new file mode 100644 index 000000000..1a4bfc80b --- /dev/null +++ b/stdiet-ui/src/views/custom/message/userInfo/recipesPlan.vue @@ -0,0 +1,220 @@ + + +