Merge branch 'feature/comment-0615-ch' into msb_test

msb_test
ch 3 years ago
commit 1105d4de62

@ -127,7 +127,7 @@ const state = {
}, },
], ],
commentType: { commentType: {
//  评论 // 评论
comment: 1, comment: 1,
// 追评 // 追评
addComment: 2, addComment: 2,
@ -156,28 +156,26 @@ const actions = {
...rootGetters['local/page'](pagingCode), ...rootGetters['local/page'](pagingCode),
...data, ...data,
}); });
if (!res) { if (res) {
ElMessage.error('评价列表查询失败'); 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); const res = await api.updateCommentShow(params);
if (!res) { if (!res) {
ElMessage.error('状态更新失败!'); ElMessage.error('状态更新失败!');
return Promise.reject('更新失败'); return Promise.reject('状态更新失败!');
} }
return Promise.resolve(res); return Promise.resolve(res);
}, },
async getDetail({ state, commit }, id) { async getDetail({ commit }, id) {
const res = await api.commentDetail({ id }); const res = await api.commentDetail({ id });
if (!res) { if (!res) {
ElMessage.error('获取详情失败'); ElMessage.error('获取详情失败');
@ -186,7 +184,7 @@ const actions = {
commit('setDetail', res); commit('setDetail', res);
return Promise.resolve(res); return Promise.resolve(res);
}, },
async add({ state, commit }, data) { async add({}, data) {
const res = await api.commentAdd(data); const res = await api.commentAdd(data);
if (!res) { if (!res) {
ElMessage.error('回复失败'); ElMessage.error('回复失败');

@ -31,7 +31,7 @@
<el-switch <el-switch
v-if="detailData.id" v-if="detailData.id"
inactive-text="是否显示" inactive-text="是否显示"
:value="!detailData.isShow" :value="detailData.isShow"
@click="handleShowHide(detailData)" @click="handleShowHide(detailData)"
/> />
</div> </div>
@ -135,6 +135,7 @@
const $textarea = ref(null); const $textarea = ref(null);
const getDetail = async () => { const getDetail = async () => {
detailData.value = {};
const res = await store.dispatch('comment/getDetail', route.params.id); const res = await store.dispatch('comment/getDetail', route.params.id);
if (res) { if (res) {
detailData.value = _.cloneDeep(store.state.comment.detail); detailData.value = _.cloneDeep(store.state.comment.detail);

@ -2,14 +2,14 @@
* @Author: ch * @Author: ch
* @Date: 2022-06-15 17:29:32 * @Date: 2022-06-15 17:29:32
* @LastEditors: ch * @LastEditors: ch
* @LastEditTime: 2022-06-20 16:52:35 * @LastEditTime: 2022-06-28 17:48:42
* @Description: file content * @Description: file content
--> -->
<template> <template>
<table-list <table-list
v-loading="loading" v-loading="loading"
:operation="['search']" :operation="['search']"
:code="pagingCode" :code="_pagingCode"
:config="config" :config="config"
:data="list" :data="list"
:total="total" :total="total"

Loading…
Cancel
Save