From 3e7a16c6a4143dc5ee0fd8c8307d6c534d37df4b Mon Sep 17 00:00:00 2001 From: ch Date: Tue, 14 Jun 2022 20:10:14 +0800 Subject: [PATCH 1/5] =?UTF-8?q?fix:=E4=BF=AE=E6=94=B9=E7=94=9F=E4=BA=A7?= =?UTF-8?q?=E9=85=8D=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .env.prod | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.env.prod b/.env.prod index 4df8ab0..481e0db 100644 --- a/.env.prod +++ b/.env.prod @@ -1,4 +1,4 @@ VITE_BASE_URL=https://you-gateway.mashibing.com VITE_SOCKET_URL=wss://you-gateway.mashibing.com/ws VITE_REQUEST_TIMEOUT=20000 -VITE_BROWSER_URL = https://k8s-shop-pc.mashibing.cn +VITE_BROWSER_URL =https://you-gateway.mashibing.com From 474b960fba57bec9aecc5a998953a8df4f2a5e2a Mon Sep 17 00:00:00 2001 From: ch Date: Tue, 14 Jun 2022 20:46:08 +0800 Subject: [PATCH 2/5] =?UTF-8?q?fix:=E4=BF=AE=E6=94=B9=E7=94=9F=E4=BA=A7?= =?UTF-8?q?=E9=85=8D=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .env.prod | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.env.prod b/.env.prod index 481e0db..c991404 100644 --- a/.env.prod +++ b/.env.prod @@ -1,4 +1,4 @@ VITE_BASE_URL=https://you-gateway.mashibing.com VITE_SOCKET_URL=wss://you-gateway.mashibing.com/ws VITE_REQUEST_TIMEOUT=20000 -VITE_BROWSER_URL =https://you-gateway.mashibing.com +VITE_BROWSER_URL = https://you.mashibing.cn/goods/detail/ From b7dae865df566c57a0e0733357f6b5dc07d4deb3 Mon Sep 17 00:00:00 2001 From: ch Date: Tue, 14 Jun 2022 20:51:13 +0800 Subject: [PATCH 3/5] =?UTF-8?q?fix:=E4=BF=AE=E6=94=B9=E7=94=9F=E4=BA=A7?= =?UTF-8?q?=E9=85=8D=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .env.prod | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.env.prod b/.env.prod index c991404..811cd1a 100644 --- a/.env.prod +++ b/.env.prod @@ -1,4 +1,4 @@ VITE_BASE_URL=https://you-gateway.mashibing.com VITE_SOCKET_URL=wss://you-gateway.mashibing.com/ws VITE_REQUEST_TIMEOUT=20000 -VITE_BROWSER_URL = https://you.mashibing.cn/goods/detail/ +VITE_BROWSER_URL = https://you.mashibing.com From 25c9818b286383fb12ee4342939521062e877c18 Mon Sep 17 00:00:00 2001 From: ch Date: Fri, 17 Jun 2022 16:49:39 +0800 Subject: [PATCH 4/5] =?UTF-8?q?=E8=AF=84=E4=BB=B7=E8=AF=A6=E6=83=85?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/goods/comment.js | 28 +++ src/store/modules/goods/comment.js | 97 +++++++++ src/views/goods/comment/detail/index.vue | 137 ++++++++++++ src/views/goods/comment/list/index.vue | 258 +++++++++++++++++++++++ vite.config.js | 4 +- 5 files changed, 522 insertions(+), 2 deletions(-) create mode 100644 src/api/goods/comment.js create mode 100644 src/store/modules/goods/comment.js create mode 100644 src/views/goods/comment/detail/index.vue create mode 100644 src/views/goods/comment/list/index.vue diff --git a/src/api/goods/comment.js b/src/api/goods/comment.js new file mode 100644 index 0000000..54364dd --- /dev/null +++ b/src/api/goods/comment.js @@ -0,0 +1,28 @@ +/* + * @Author: ch + * @Date: 2022-06-15 17:55:43 + * @LastEditors: ch + * @LastEditTime: 2022-06-17 10:43:30 + * @Description: file content + */ +import request from '@/utils/request.js'; +//获取评论列表 +export const commentList = (params) => + request({ + url: '/mall/comment/admin/comment', + method: 'get', + params, + }); +// 获取评价详情 +export const commentDetail = ({ id }) => + request({ + url: `/mall/comment/admin/comment/getCommentDetail/${id}`, + method: 'get', + }); +// 更新评价显示状态 +export const updateCommentShow = (data) => + request({ + url: '/mall/comment/admin/comment', + method: 'put', + data, + }); diff --git a/src/store/modules/goods/comment.js b/src/store/modules/goods/comment.js new file mode 100644 index 0000000..e24e1ae --- /dev/null +++ b/src/store/modules/goods/comment.js @@ -0,0 +1,97 @@ +import * as api from '@/api/goods/comment.js'; +import { ElMessage } from 'element-plus/es'; +const state = { + list: [], + detail: {}, + total: 0, + opts: { + isShow: [ + { + value: true, + label: '显示', + }, + { + value: false, + label: '隐藏', + }, + ], + score: [ + { + value: 1, + label: '1星', + }, + { + value: 2, + label: '2星', + }, + { + value: 3, + label: '3星', + }, + { + value: 4, + label: '4星', + }, + { + value: 5, + label: '5星', + }, + ], + }, +}; +const getters = {}; +const mutations = { + setList: (state, data) => (state.list = data), + setTotal: (state, data) => (state.total = data), + setDetail: (state, data) => (state.detail = data), +}; +const actions = { + async search({ state, commit, rootGetters }, params) { + let data = { ...params }; + let pagingCode = params.pagingCode; + if (data.dateRange?.length) { + data.commentTimeBegin = data.dateRange[0]; + data.commentTimeEnd = data.dateRange[1]; + } + delete data.dateRange; + delete data.pagingCode; + const res = await api.commentList({ + ...rootGetters['local/page'](pagingCode), + ...data, + }); + if (!res) { + ElMessage.error('评价列表查询失败'); + } + 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) { + const res = await api.updateCommentShow(params); + if (!res) { + ElMessage.error('状态更新失败!'); + return Promise.reject('更新失败'); + } + return Promise.resolve(res); + }, + async getDetail({ state, commit }, id) { + const res = await api.commentDetail({ id }); + if (!res) { + ElMessage.error('获取详情失败'); + } + commit('setDetail', res); + }, +}; + +export default { + state, + getters, + mutations, + actions, +}; diff --git a/src/views/goods/comment/detail/index.vue b/src/views/goods/comment/detail/index.vue new file mode 100644 index 0000000..ca9f7a0 --- /dev/null +++ b/src/views/goods/comment/detail/index.vue @@ -0,0 +1,137 @@ + + + diff --git a/src/views/goods/comment/list/index.vue b/src/views/goods/comment/list/index.vue new file mode 100644 index 0000000..ff40212 --- /dev/null +++ b/src/views/goods/comment/list/index.vue @@ -0,0 +1,258 @@ + + + + diff --git a/vite.config.js b/vite.config.js index 5291516..d7cc896 100644 --- a/vite.config.js +++ b/vite.config.js @@ -24,9 +24,9 @@ export default (configEnv) => { // target: 'http://192.168.10.5:4500', // 高玉 // target: 'http://192.168.10.87:8090', // 罗战 // target: 'http://192.168.10.93:8090', // 周渺 - // target: 'http://192.168.10.124:8090', // 舒梦娇 + target: 'http://192.168.10.106:8090', // 舒梦娇 // target: 'https://k8s-horse-gateway.mashibing.cn/', // 测试地址 - target: 'https://you-gateway.mashibing.com', // 生产环境 + // target: 'https://you-gateway.mashibing.com', // 生产环境 changeOrigin: true, rewrite: (path) => path.replace(/^\/api/, ''), }, From 0da91cd614b4e06711062274bbf873406ede4832 Mon Sep 17 00:00:00 2001 From: ch Date: Mon, 20 Jun 2022 10:41:47 +0800 Subject: [PATCH 5/5] =?UTF-8?q?fat:=E8=AF=84=E4=BB=B7=E8=AF=A6=E6=83=85?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/goods/comment.js | 10 +- src/store/modules/goods/comment.js | 109 ++++++++- src/views/goods/comment/detail/index.vue | 269 ++++++++++++++++++++--- 3 files changed, 358 insertions(+), 30 deletions(-) diff --git a/src/api/goods/comment.js b/src/api/goods/comment.js index 54364dd..167dd21 100644 --- a/src/api/goods/comment.js +++ b/src/api/goods/comment.js @@ -2,7 +2,7 @@ * @Author: ch * @Date: 2022-06-15 17:55:43 * @LastEditors: ch - * @LastEditTime: 2022-06-17 10:43:30 + * @LastEditTime: 2022-06-17 18:13:27 * @Description: file content */ import request from '@/utils/request.js'; @@ -19,6 +19,14 @@ export const commentDetail = ({ id }) => url: `/mall/comment/admin/comment/getCommentDetail/${id}`, method: 'get', }); + +//获取评论列表 +export const commentAdd = (data) => + request({ + url: '/mall/comment/admin/comment', + method: 'post', + data, + }); // 更新评价显示状态 export const updateCommentShow = (data) => request({ diff --git a/src/store/modules/goods/comment.js b/src/store/modules/goods/comment.js index e24e1ae..88dee1d 100644 --- a/src/store/modules/goods/comment.js +++ b/src/store/modules/goods/comment.js @@ -2,7 +2,96 @@ import * as api from '@/api/goods/comment.js'; import { ElMessage } from 'element-plus/es'; const state = { list: [], - detail: {}, + detail: { + id: 18, + originId: 0, + parentId: 0, + userId: 97, + userName: 'ocean', + commentContent: '用户超时未做出评价,系统默认好评', + isShow: false, + createTime: '2022-06-17 15:27:09', + commentType: 1, + userAvatar: 'https://msb-edu-dev.oss-cn-beijing.aliyuncs.com/default-headimg.png', + skuName: '测试SKU', + productName: '测试虚拟111', + phone: '151****5744', + pictureUrl: 'https://msb-edu-dev.oss-cn-beijing.aliyuncs.com/uc/account-avatar/120x120.png', + commentScore: 5, + followComment: { + id: 19, + originId: 18, + parentId: 18, + userId: 97, + userName: 'ocean', + commentContent: '新增一条追评', + isShow: true, + createTime: '2022-06-17 17:13:32', + commentType: 2, + }, + answerCommentList: [ + { + id: 20, + originId: 18, + parentId: 18, + userId: 8, + userName: '随机昵称', + commentContent: '新增一条回复', + isShow: true, + createTime: '2022-06-17 17:14:02', + commentType: 3, + parentUserName: 'ocean', + }, + { + id: 21, + originId: 18, + parentId: 18, + userId: 8, + userName: '随机昵称', + commentContent: '1232321', + isShow: true, + createTime: '2022-06-17 18:31:48', + commentType: 3, + parentUserName: 'ocean', + }, + { + id: 22, + originId: 18, + parentId: 18, + userId: 8, + userName: '随机昵称', + commentContent: '我回复我回复我回复我回复我回复', + isShow: true, + createTime: '2022-06-17 18:32:39', + commentType: 3, + parentUserName: 'ocean', + }, + { + id: 23, + originId: 18, + parentId: 22, + userId: 8, + userName: '随机昵称', + commentContent: '222222222222', + isShow: true, + createTime: '2022-06-17 18:34:30', + commentType: 3, + parentUserName: '随机昵称', + }, + { + id: 24, + originId: 18, + parentId: 18, + userId: 8, + userName: '随机昵称', + commentContent: '直接评论直接评论', + isShow: true, + createTime: '2022-06-17 18:36:03', + commentType: 3, + parentUserName: 'ocean', + }, + ], + }, total: 0, opts: { isShow: [ @@ -37,6 +126,14 @@ const state = { label: '5星', }, ], + commentType: { + //  评论 + comment: 1, + // 追评 + addComment: 2, + // 回复 + reply: 3, + }, }, }; const getters = {}; @@ -84,8 +181,18 @@ const actions = { const res = await api.commentDetail({ id }); if (!res) { ElMessage.error('获取详情失败'); + return Promise.reject('获取详情失败'); } commit('setDetail', res); + return Promise.resolve(res); + }, + async add({ state, commit }, data) { + const res = await api.commentAdd(data); + if (!res) { + ElMessage.error('回复失败'); + return Promise.reject(false); + } + return Promise.resolve(res); }, }; diff --git a/src/views/goods/comment/detail/index.vue b/src/views/goods/comment/detail/index.vue index ca9f7a0..6b5cfd7 100644 --- a/src/views/goods/comment/detail/index.vue +++ b/src/views/goods/comment/detail/index.vue @@ -17,7 +17,7 @@

- +

@@ -25,52 +25,172 @@

-
-
+
+
评价内容 - +
-
-

{{ detailData.commentContent }}

-
+
+

{{ detailData.commentContent }}

+
+
-
    -
  • -
    +
    + 全部回复({{ detailData.answerCommentList?.length || 0 }}条) +
    +
      +
    • +
      {{ item.userName }} - 回复 {{ item.parentUserName }}: + 回复 {{ item.parentUserName }}:
      -

      {{ item.commentContent }}

      -
      - {{ item.createTime }} +

      {{ item.commentContent }}

      +
    +
    暂无内容