|
|
|
@ -127,7 +127,7 @@ const state = {
|
|
|
|
|
},
|
|
|
|
|
],
|
|
|
|
|
commentType: {
|
|
|
|
|
// 评论
|
|
|
|
|
// 评论
|
|
|
|
|
comment: 1,
|
|
|
|
|
// 追评
|
|
|
|
|
addComment: 2,
|
|
|
|
@ -156,28 +156,26 @@ const actions = {
|
|
|
|
|
...rootGetters['local/page'](pagingCode),
|
|
|
|
|
...data,
|
|
|
|
|
});
|
|
|
|
|
if (!res) {
|
|
|
|
|
ElMessage.error('评价列表查询失败');
|
|
|
|
|
if (res) {
|
|
|
|
|
commit(
|
|
|
|
|
'setList',
|
|
|
|
|
res?.records.map((i) => ({
|
|
|
|
|
...i,
|
|
|
|
|
scoreName: state.opts.score.find((item) => item.value === i.commentScore)?.label,
|
|
|
|
|
})) || []
|
|
|
|
|
);
|
|
|
|
|
commit('setTotal', res?.total || 0);
|
|
|
|
|
}
|
|
|
|
|
res;
|
|
|
|
|
commit(
|
|
|
|
|
'setList',
|
|
|
|
|
res?.records.map((i) => ({
|
|
|
|
|
...i,
|
|
|
|
|
scoreName: state.opts.score.find((item) => item.value == i.commentScore)?.label,
|
|
|
|
|
})) || []
|
|
|
|
|
);
|
|
|
|
|
commit('setTotal', res?.total || 0);
|
|
|
|
|
},
|
|
|
|
|
async updateShow({ state }, params) {
|
|
|
|
|
async updateShow({}, params) {
|
|
|
|
|
const res = await api.updateCommentShow(params);
|
|
|
|
|
if (!res) {
|
|
|
|
|
ElMessage.error('状态更新失败!');
|
|
|
|
|
return Promise.reject('更新失败');
|
|
|
|
|
return Promise.reject('状态更新失败!');
|
|
|
|
|
}
|
|
|
|
|
return Promise.resolve(res);
|
|
|
|
|
},
|
|
|
|
|
async getDetail({ state, commit }, id) {
|
|
|
|
|
async getDetail({ commit }, id) {
|
|
|
|
|
const res = await api.commentDetail({ id });
|
|
|
|
|
if (!res) {
|
|
|
|
|
ElMessage.error('获取详情失败');
|
|
|
|
@ -186,7 +184,7 @@ const actions = {
|
|
|
|
|
commit('setDetail', res);
|
|
|
|
|
return Promise.resolve(res);
|
|
|
|
|
},
|
|
|
|
|
async add({ state, commit }, data) {
|
|
|
|
|
async add({}, data) {
|
|
|
|
|
const res = await api.commentAdd(data);
|
|
|
|
|
if (!res) {
|
|
|
|
|
ElMessage.error('回复失败');
|
|
|
|
|