完善交互
This commit is contained in:
@ -1,6 +1,9 @@
|
||||
const actions = {
|
||||
async init({ dispatch }, payload) {
|
||||
dispatch("global/init", payload);
|
||||
},
|
||||
async updateUnreadCount({ commit }, payload) {
|
||||
commit("global/save", payload);
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -9,12 +9,11 @@ const getters = {
|
||||
name: state => state.user.name,
|
||||
introduction: state => state.user.introduction,
|
||||
roles: state => state.user.roles,
|
||||
// roles: state => ["dietician"],
|
||||
permissions: state => state.user.permissions,
|
||||
userId: state => state.user.userId,
|
||||
// userId: state => 131,
|
||||
userRemark: state => state.user.remark,
|
||||
permission_routes: state => state.permission.routes,
|
||||
msgUnreadCount: state => state.global.msgUnreadCount,
|
||||
//
|
||||
nutritionistIdOptions: state => state.global.nutritionistIdOptions,
|
||||
nutriAssisIdOptions: state => state.global.nutriAssisIdOptions,
|
||||
|
@ -9,7 +9,8 @@ const oriState = {
|
||||
plannerIdOptions: [],
|
||||
plannerAssisIdOptions: [],
|
||||
operatorIdOptions: [],
|
||||
operatorAssisIdOptions: []
|
||||
operatorAssisIdOptions: [],
|
||||
msgUnreadCount: 0,
|
||||
};
|
||||
|
||||
const mutations = {
|
||||
|
@ -6,6 +6,7 @@ import {
|
||||
} from "@/api/custom/message";
|
||||
|
||||
const oriState = {
|
||||
pageNum: 1,
|
||||
topicList: [],
|
||||
detailData: {},
|
||||
selTopicId: ""
|
||||
@ -28,23 +29,35 @@ const mutations = {
|
||||
};
|
||||
|
||||
const actions = {
|
||||
async init({ rootGetters, commit, dispatch }, payload) {
|
||||
async init({ dispatch }, payload) {
|
||||
dispatch("fetchTopicListApi", {});
|
||||
},
|
||||
async fetchTopicListApi({ dispatch, commit, rootGetters, state }, payload) {
|
||||
const {
|
||||
roles: [role],
|
||||
userId
|
||||
} = rootGetters;
|
||||
const result = await fetchTopicList({ role, uid: userId });
|
||||
const { detailData, pageNum, topicList } = state;
|
||||
const result = await fetchTopicList({
|
||||
role,
|
||||
uid: userId,
|
||||
pageSize: 20,
|
||||
pageNum
|
||||
});
|
||||
if (result.code === 200) {
|
||||
const [defTopic] = result.rows;
|
||||
|
||||
dispatch("fetchTopicDetailActions", {
|
||||
topicId: defTopic.topicId,
|
||||
id: defTopic.id
|
||||
});
|
||||
|
||||
commit("save", {
|
||||
topicList: result.rows
|
||||
});
|
||||
if (!detailData.topicId) {
|
||||
const [defTopic] = result.rows;
|
||||
dispatch("fetchTopicDetailActions", {
|
||||
topicId: defTopic.topicId,
|
||||
id: defTopic.id
|
||||
});
|
||||
}
|
||||
if (result.rows.length) {
|
||||
commit("save", {
|
||||
pageNum: pageNum + 1,
|
||||
topicList: [...topicList, ...result.rows]
|
||||
});
|
||||
}
|
||||
}
|
||||
},
|
||||
async fetchTopicDetailActions({ commit }, payload) {
|
||||
|
Reference in New Issue
Block a user