From 8891cc6734704c3d9a8143c7681051e615fd0a8a Mon Sep 17 00:00:00 2001 From: ch Date: Thu, 23 Jun 2022 17:12:37 +0800 Subject: [PATCH] =?UTF-8?q?=E8=AF=84=E4=BB=B7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- env.config.js | 6 +- src/common/api/comment.js | 50 +++++ src/common/api/order.js | 9 +- src/common/dicts/comment.js | 32 +++ src/common/dicts/order.js | 32 ++- src/common/store/index.js | 23 +- src/common/utils/index.js | 6 +- src/common/utils/uploadFileOss.js | 46 ++++ src/common/utils/utils.js | 25 ++- src/components/BsChoiceGoods.vue | 4 +- src/components/BsCommentFollowInfo.vue | 69 ++++++ src/components/BsCommentGoodsInfo.vue | 64 ++++++ src/components/BsCommentInfo.vue | 78 +++++++ src/components/BsCommentMerchant.vue | 47 ++++ src/components/BsCommentSubmit.vue | 130 +++++++++++ src/components/BsCommentThumbup.vue | 52 +++++ src/components/BsCommentUserInfo.vue | 47 ++++ src/components/UiWhiteBox.vue | 6 +- src/main.js | 15 +- src/manifest.json | 5 +- src/pages.json | 53 +++++ src/pages/goods/comment/detail.vue | 209 ++++++++++++++++++ src/pages/goods/comment/list.vue | 192 ++++++++++++++++ src/pages/goods/comment/otherList.vue | 105 +++++++++ src/pages/goods/comment/preview.vue | 76 +++++++ src/pages/goods/detail/index.vue | 70 ++++-- src/pages/goods/detail/modules/Comment.vue | 87 ++++++++ src/pages/index/index.vue | 4 +- src/pages/index/modules/Banner.vue | 4 +- src/pages/order/comment/index/index.vue | 122 ++++++++++ .../comment/index/modules/SubmitComment.vue | 106 +++++++++ .../index/modules/SubmitFollowComment.vue | 70 ++++++ src/pages/order/comment/submitFollow.vue | 156 +++++++++++++ src/pages/order/comment/success.vue | 119 ++++++++++ src/pages/order/detail/index.vue | 10 +- src/pages/order/list.vue | 33 ++- src/pages/order/logisitcsInfo.vue | 8 +- src/pages/order/payResult.vue | 4 +- src/static/comment/sort.png | Bin 0 -> 341 bytes src/static/comment/sort_active.png | Bin 0 -> 341 bytes 40 files changed, 2085 insertions(+), 89 deletions(-) create mode 100644 src/common/api/comment.js create mode 100644 src/common/dicts/comment.js create mode 100644 src/common/utils/uploadFileOss.js create mode 100644 src/components/BsCommentFollowInfo.vue create mode 100644 src/components/BsCommentGoodsInfo.vue create mode 100644 src/components/BsCommentInfo.vue create mode 100644 src/components/BsCommentMerchant.vue create mode 100644 src/components/BsCommentSubmit.vue create mode 100644 src/components/BsCommentThumbup.vue create mode 100644 src/components/BsCommentUserInfo.vue create mode 100644 src/pages/goods/comment/detail.vue create mode 100644 src/pages/goods/comment/list.vue create mode 100644 src/pages/goods/comment/otherList.vue create mode 100644 src/pages/goods/comment/preview.vue create mode 100644 src/pages/goods/detail/modules/Comment.vue create mode 100644 src/pages/order/comment/index/index.vue create mode 100644 src/pages/order/comment/index/modules/SubmitComment.vue create mode 100644 src/pages/order/comment/index/modules/SubmitFollowComment.vue create mode 100644 src/pages/order/comment/submitFollow.vue create mode 100644 src/pages/order/comment/success.vue create mode 100644 src/static/comment/sort.png create mode 100644 src/static/comment/sort_active.png diff --git a/env.config.js b/env.config.js index 3e547a6..77444f1 100644 --- a/env.config.js +++ b/env.config.js @@ -2,7 +2,7 @@ * @Author: ch * @Date: 2022-05-05 14:40:00 * @LastEditors: ch - * @LastEditTime: 2022-06-09 11:25:44 + * @LastEditTime: 2022-06-22 17:26:10 * @Description: 根据git分支生成对应环境的环境变量 * 开发时如果环境变量换了,可以不用重启服务,直接运行node env.config.js即可 */ @@ -11,7 +11,9 @@ const path = require('path'); const envConfig = { dev : { - baseUrl: 'https://k8s-horse-gateway.mashibing.cn', + // baseUrl: 'https://you-gateway.mashibing.com', + // baseUrl: 'https://k8s-horse-gateway.mashibing.cn', + baseUrl: '', staticUrl : 'https://k8s-shop-app.mashibing.cn', // imUrl : 'ws://192.168.10.94:8090' imUrl : 'wss://k8s-horse-gateway.mashibing.cn' diff --git a/src/common/api/comment.js b/src/common/api/comment.js new file mode 100644 index 0000000..5cc5c6e --- /dev/null +++ b/src/common/api/comment.js @@ -0,0 +1,50 @@ +/* + * @Author: ch + * @Date: 2022-06-20 11:38:48 + * @LastEditors: ch + * @LastEditTime: 2022-06-22 20:53:16 + * @Description: file content + */ + +import {ToAsyncAwait, MsbRequest, MsbRequestTk} from '@/common/utils'; + +const BASE_URL = '/mall/comment'; + +/** + * 根据商品获取评论列表 + * @param {*} param0 + */ +export const ApiGetCommentList = (params) => + ToAsyncAwait(MsbRequest.get(`${BASE_URL}/app/comment`, params)); +/** + * 根据商品获取评论总数 + * @param {*} param0 + */ +export const ApiGetCommentCount = ({productId}) => + ToAsyncAwait(MsbRequest.get(`${BASE_URL}/app/comment/getAllCommentCountByProductId/${productId}`)); +/** + * 根据商品获取标签评论总数 + * @param {*} param0 + */ +export const ApiGetCommentTabCount = ({productId}) => + ToAsyncAwait(MsbRequest.get(`${BASE_URL}/app/comment/listCommentLabel/${productId}`)); +/** + * 获取订单评论详情 + * @param {*} param0 + */ +export const ApiGetOrderCommentDetail = ({orderId}) => + ToAsyncAwait(MsbRequestTk.get(`${BASE_URL}/app/comment/listOrderCommentByOrderId/${orderId}`)); +/** + * 获取评论详情 + * @param {*} param0 + */ +export const ApiGetCommentDetail = ({commentId}) => + ToAsyncAwait(MsbRequest.get(`${BASE_URL}/app/comment/getCommentDetail/${commentId}`)); +/** + * 新增评论 + * @param {*} param0 + */ +export const ApiPostComment = (data) => + ToAsyncAwait(MsbRequestTk.post(`${BASE_URL}/app/comment`, data)); + + diff --git a/src/common/api/order.js b/src/common/api/order.js index e534f7f..66a2881 100644 --- a/src/common/api/order.js +++ b/src/common/api/order.js @@ -2,7 +2,7 @@ * @Author: ch * @Date: 2022-03-29 17:38:17 * @LastEditors: ch - * @LastEditTime: 2022-05-10 16:14:53 + * @LastEditTime: 2022-06-23 16:21:32 * @Description: file content */ import {ToAsyncAwait, MsbRequestTk} from '@/common/utils'; @@ -84,8 +84,11 @@ export const ApiPutCancelOrder = (data) => export const ApiGetOrderStatistics = () => ToAsyncAwait(MsbRequestTk.get(`${BASE_URL}/app/tradeOrder/statistics`)); - - +/** + * 获取待评价订单详请列表 + */ +export const ApiGetCommentOrderDetailList = (params) => + ToAsyncAwait(MsbRequestTk.get(`${BASE_URL}/app/tradeOrder/listOrderProductWaitComment`,params)) /** diff --git a/src/common/dicts/comment.js b/src/common/dicts/comment.js new file mode 100644 index 0000000..2d36112 --- /dev/null +++ b/src/common/dicts/comment.js @@ -0,0 +1,32 @@ +/* + * @Author: ch + * @Date: 2022-06-20 11:10:23 + * @LastEditors: ch + * @LastEditTime: 2022-06-22 18:05:27 + * @Description: file content + */ +export default { + TYPE : { + // 评价 + COMMENT: 1, + // 追评 + FOLLOW_COMMENT: 2, + // 回复 + ANSWER: 3, + }, + // 是否显示 + DISPLAY: { + SHOW: 1, + HIDE : 0 + }, + // 用户类型 + USER_TYPE: { + STORE : 1, + USER : 2 + }, + // 是否默认评价 + IS_DEFAULT_COMMENT: { + YES: 1, + NOT : 0 + } +} \ No newline at end of file diff --git a/src/common/dicts/order.js b/src/common/dicts/order.js index f9adb0b..a7ed1af 100644 --- a/src/common/dicts/order.js +++ b/src/common/dicts/order.js @@ -2,7 +2,7 @@ * @Author: ch * @Date: 2022-05-26 11:49:16 * @LastEditors: ch - * @LastEditTime: 2022-05-26 17:00:06 + * @LastEditTime: 2022-06-22 11:23:02 * @Description: file content */ @@ -11,13 +11,25 @@ export const ORDER_STATUS = { // 待支付 AWAIT_PAY: 1 } -export const ORDER_TYPE = { - //(1, "普通订单"), - NORMAL: 1, - //(2, "免费订单"), - FREE: 2, - //(3, "秒杀订单"), - SECKILL: 3, - //(4, "虚拟商品订单"), - VIRTUAL : 4 +export default { + TYPE : { + //(1, "普通订单"), + NORMAL: 1, + //(2, "免费订单"), + FREE: 2, + //(3, "秒杀订单"), + SECKILL: 3, + //(4, "虚拟商品订单"), + VIRTUAL : 4 + }, + // 订单状态 1:待支付,2:已关闭,3:已支付,4:已发货,5:已收货,6:已完成,7:已追评 + STATUS: { + AWAIT_PAY: 1, + CLOSE: 2, + FINISH_PAY: 3, + FINISH_SEND_GOODS: 4, + FINISH_TAKE_GOODS: 5, + FINISH: 6, + FINISH_FOLLOW_COMMENT : 7 + } } \ No newline at end of file diff --git a/src/common/store/index.js b/src/common/store/index.js index 004d46b..493a738 100644 --- a/src/common/store/index.js +++ b/src/common/store/index.js @@ -2,7 +2,7 @@ * @Author: ch * @Date: 2022-03-22 18:28:52 * @LastEditors: ch - * @LastEditTime: 2022-06-14 17:33:42 + * @LastEditTime: 2022-06-22 15:31:09 * @Description: file content */ import Vue from 'vue' @@ -19,15 +19,18 @@ const // oppenId OPPED_ID = 'oi', // 每个浏览器创建一个UUID作为同一个用户的标识 - UUID = 'uid';; + UUID = 'uid', + // 评价图片预览数据 + COMMENT_PREVIEW = 'comment_preview'; export default new Vuex.Store({ - state : { - token : uni.getStorageSync(TOKEN) || '', - userInfo : JSON.parse(uni.getStorageSync(USER_INFO) || '{}'), - address : JSON.parse(uni.getStorageSync(ADDRESS) || '[]'), - openId : uni.getStorageSync(OPPED_ID) || '', - uuid : uni.getStorageSync(UUID) || '', + state: { + token: uni.getStorageSync(TOKEN) || '', + userInfo: JSON.parse(uni.getStorageSync(USER_INFO) || '{}'), + address: JSON.parse(uni.getStorageSync(ADDRESS) || '[]'), + openId: uni.getStorageSync(OPPED_ID) || '', + uuid: uni.getStorageSync(UUID) || '', + comment_preview: JSON.parse(uni.getStorageSync(COMMENT_PREVIEW) || '{}'), imData : [], imMsgCount : 0 }, @@ -52,6 +55,10 @@ export default new Vuex.Store({ state.openId = data; uni.setStorageSync(OPPED_ID, data); }, + SET_COMMENT_PREVIEW(state, data) { + state.comment_preview = data; + uni.setStorageSync(COMMENT_PREVIEW, JSON.stringify(data)); + }, SET_IM_DATA (state, data){ state.imData = data ; }, diff --git a/src/common/utils/index.js b/src/common/utils/index.js index 75ac9ef..c5520fc 100644 --- a/src/common/utils/index.js +++ b/src/common/utils/index.js @@ -2,17 +2,19 @@ * @Author: ch * @Date: 2022-03-22 16:52:28 * @LastEditors: ch - * @LastEditTime: 2022-05-20 11:42:33 + * @LastEditTime: 2022-06-21 15:12:11 * @Description: 所有工具类统一在这输出 */ import * as util from './utils'; import * as requset from './requset'; import * as im from './im'; import * as wxpay from './wxpay'; +import * as uploadFileOss from './uploadFileOss'; export * from './utils'; export * from './requset'; export * from './im'; export * from './wxpay'; +export * from './uploadFileOss'; -export default { ...util, ...requset, ...im, ...wxpay} \ No newline at end of file +export default { ...util, ...requset, ...im, ...wxpay, ...uploadFileOss} \ No newline at end of file diff --git a/src/common/utils/uploadFileOss.js b/src/common/utils/uploadFileOss.js new file mode 100644 index 0000000..ed0680c --- /dev/null +++ b/src/common/utils/uploadFileOss.js @@ -0,0 +1,46 @@ +/* + * @Author: ch + * @Date: 2022-06-21 15:03:11 + * @LastEditors: ch + * @LastEditTime: 2022-06-22 14:49:20 + * @Description: file content + */ +import { ApiPostGetOssConfig } from '@/common/api/oss'; +import {ToAsyncAwait} from '@/common/utils' +/** + * + * @param {*} file 文件 + * @param {*} param1 获取OSS鉴权信息参数,参考ApiPostGetOssConfig接口 + * @returns {Promise} + */ +export const uploadFileOss = (file, {configId, serviceName}) =>{ + return ToAsyncAwait(new Promise(async (resolve, reject) => { + const urlArr = file.url.split('/'); + const fileName = file.name || urlArr[urlArr.length - 1]; + const { error, result:oss } = await ApiPostGetOssConfig({ configId : `${configId}/`, serviceName }); + if (error) { + reject(error); + return false + } + uni.uploadFile({ + name : 'file', + filePath : file.url, + url : oss.host, + formData : { + name : fileName, + key : `${oss.dir}${'${filename}'}`, + policy : oss.policy, + OSSAccessKeyId : oss.accessId, + success_action_status : 200, + signature : oss.signature + }, + success : async (res)=>{ + resolve(`${oss.host}/${oss.dir}${fileName}`); + }, + fail(e) { + reject(e); + } + }) + } + )) +} \ No newline at end of file diff --git a/src/common/utils/utils.js b/src/common/utils/utils.js index 3b1ea3b..0fb9969 100644 --- a/src/common/utils/utils.js +++ b/src/common/utils/utils.js @@ -2,7 +2,7 @@ * @Author: ch * @Date: 2022-03-17 19:15:10 * @LastEditors: ch - * @LastEditTime: 2022-06-02 14:55:45 + * @LastEditTime: 2022-06-22 10:39:15 * @Description: 一些无法归类的公共方法容器 */ @@ -43,11 +43,6 @@ const Debounce = (fn, delay) => { * @param {*} link */ const AdJump = (item) => { - // if (!/^(http|https):\/\/./.test(link)) { - // uni.$u.toast('非法链接,暂不跳转!'); - // return false; - // } - console.log(item); switch (item.jumpType) { case AD_JUMP_TYPE.GOODS: uni.navigateTo({ @@ -71,6 +66,21 @@ const AdJump = (item) => { break } } +/** + * api接口错误处理 + * @param {*} error 错误体 + * @param {*} name 接口名 非必传,如操作时错误提示不需要提示接口名时可不传 + * @return Boolean true 存在错误并处理 false无错误 + */ +const HandleApiError = (error, name) => { + let result = false + if (error) { + const tip = name ? `${name}错误:` : ``; + uni.$u.toast(`${tip}${error.message}`); + result = true; + } + return result; +} // 工具类的文件需要把文件提供的工具类统一放最下方做一个统一输出 export { // async await 标识结果处理 @@ -85,5 +95,6 @@ export { // 防抖函数 Debounce, // 广告跳转 - AdJump + AdJump, + HandleApiError } \ No newline at end of file diff --git a/src/components/BsChoiceGoods.vue b/src/components/BsChoiceGoods.vue index 4a008db..e72743d 100644 --- a/src/components/BsChoiceGoods.vue +++ b/src/components/BsChoiceGoods.vue @@ -2,7 +2,7 @@ * @Author: ch * @Date: 2022-03-20 16:45:27 * @LastEditors: ch - * @LastEditTime: 2022-05-06 14:26:57 + * @LastEditTime: 2022-06-22 19:34:13 * @Description: file content -->