调整界面
This commit is contained in:
		| @@ -8,6 +8,7 @@ import settings from "./modules/settings"; | ||||
| import recipes from "./modules/recipes"; | ||||
| import recipesShow from "./modules/recipesShow"; | ||||
| import global from "./modules/global"; | ||||
| import message from "./modules/message"; | ||||
|  | ||||
| import getters from "./getters"; | ||||
| import actions from "./actions"; | ||||
| @@ -23,7 +24,8 @@ const store = new Vuex.Store({ | ||||
|     settings, | ||||
|     recipes, | ||||
|     recipesShow, | ||||
|     global | ||||
|     global, | ||||
|     message | ||||
|   }, | ||||
|   getters, | ||||
|   actions | ||||
|   | ||||
							
								
								
									
										45
									
								
								stdiet-ui/src/store/modules/message.js
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										45
									
								
								stdiet-ui/src/store/modules/message.js
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,45 @@ | ||||
| import { | ||||
|   fetchTopicList, | ||||
|   postTopicReply, | ||||
|   fetchTopicDetail, | ||||
|   postTopicComment | ||||
| } from "@/api/custom/message"; | ||||
|  | ||||
| const oriState = { | ||||
|   topicList: undefined, | ||||
|   detailData: undefined | ||||
| }; | ||||
|  | ||||
| const mutations = { | ||||
|   save(state, payload) { | ||||
|     Object.keys(payload).forEach(key => { | ||||
|       state[key] = payload[key]; | ||||
|     }); | ||||
|   }, | ||||
|   clean(state) { | ||||
|     Object.keys(oriState).forEach(key => { | ||||
|       state[key] = oriState[key]; | ||||
|     }); | ||||
|   } | ||||
| }; | ||||
|  | ||||
| const actions = { | ||||
|   async init({ rootGetters, commit }, payload) { | ||||
|     const { | ||||
|       roles: [role], | ||||
|       userId | ||||
|     } = rootGetters; | ||||
|     const result = await fetchTopicList({ role: "dietician", uid: 131 }); | ||||
|     console.log({ result }); | ||||
|   } | ||||
| }; | ||||
|  | ||||
| const getters = {}; | ||||
|  | ||||
| export default { | ||||
|   namespaced: "message", | ||||
|   state: Object.assign({}, oriState), | ||||
|   mutations, | ||||
|   actions, | ||||
|   getters | ||||
| }; | ||||
		Reference in New Issue
	
	Block a user