From 9a3253ad20fd384c3692941ea2fb44323bf6db00 Mon Sep 17 00:00:00 2001 From: dongshanshan Date: Tue, 31 Oct 2023 16:53:44 +0800 Subject: [PATCH 1/7] =?UTF-8?q?feat:=20=E4=BC=9A=E5=91=98=E5=95=86?= =?UTF-8?q?=E5=93=81=E6=94=B6=E8=97=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/mall/product/favorite.ts | 28 +++ src/hooks/web/useMessage.ts | 12 ++ src/locales/en.ts | 8 +- src/locales/zh-CN.ts | 8 +- .../member/user/detail/UserFavoriteList.vue | 195 ++++++++++++++++++ src/views/member/user/detail/index.vue | 5 +- 6 files changed, 253 insertions(+), 3 deletions(-) create mode 100644 src/api/mall/product/favorite.ts create mode 100644 src/views/member/user/detail/UserFavoriteList.vue diff --git a/src/api/mall/product/favorite.ts b/src/api/mall/product/favorite.ts new file mode 100644 index 00000000..2e54ec78 --- /dev/null +++ b/src/api/mall/product/favorite.ts @@ -0,0 +1,28 @@ +import request from '@/config/axios' + +export interface Favorite { + id?: number + userId?: string // 用户编号 + spuId?: number | null // 商品 SPU 编号 +} + +// 获得 ProductFavorite 列表 +export const getFavoritePage = (params: PageParam) => { + params.keyword = params.name + return request.get({ url: '/product/favorite/page', params }) +} + +// 收藏商品 Favorite +export const createFavorite = (data: Favorite) => { + return request.post({ url: '/product/favorite/create', data }) +} + +// 取消商品收藏 Favorite +export const delFavorite = (data: Favorite) => { + return request.delete({ url: '/product/favorite/delete', data }) +} + +// 是否收藏过商品 Favorite +export const exitsFavorite = (data: Favorite) => { + return request.post({ url: '/product/favorite/exits', data }) +} diff --git a/src/hooks/web/useMessage.ts b/src/hooks/web/useMessage.ts index ac2b552e..9bfb7a3a 100644 --- a/src/hooks/web/useMessage.ts +++ b/src/hooks/web/useMessage.ts @@ -90,6 +90,18 @@ export const useMessage = () => { cancelButtonText: t('common.cancel'), type: 'warning' }) + }, + // 取消收藏窗体 + delStarConfirm(content?: string, tip?: string) { + return ElMessageBox.confirm( + content ? content : t('common.confirmDelStar'), + tip ? tip : t('common.confirmTitle'), + { + confirmButtonText: t('common.ok'), + cancelButtonText: t('common.cancel'), + type: 'warning' + } + ) } } } diff --git a/src/locales/en.ts b/src/locales/en.ts index 4f4d4895..d82e616e 100644 --- a/src/locales/en.ts +++ b/src/locales/en.ts @@ -54,7 +54,13 @@ export default { updateTime: 'Update Time', copy: 'Copy', copySuccess: 'Copy Success', - copyError: 'Copy Error' + copyError: 'Copy Error', + confirmDelStar: 'Delete the Star?', + starSuccess: 'Star Success', + starFail: 'Star Error', + delStarSuccess: 'Del Star Success', + delStarFail: 'Del Star Error', + existStar: 'exist Star' }, error: { noPermission: `Sorry, you don't have permission to access this page.`, diff --git a/src/locales/zh-CN.ts b/src/locales/zh-CN.ts index 4f95852f..49a3f895 100644 --- a/src/locales/zh-CN.ts +++ b/src/locales/zh-CN.ts @@ -54,7 +54,13 @@ export default { updateTime: '更新时间', copy: '复制', copySuccess: '复制成功', - copyError: '复制失败' + copyError: '复制失败', + confirmDelStar: '是否取消收藏?', + starSuccess: '收藏成功', + starFail: '收藏失败', + delStarSuccess: '取消收藏成功', + delStarFail: '取消收藏失败', + existStar: '收藏已存在' }, error: { noPermission: `抱歉,您无权访问此页面。`, diff --git a/src/views/member/user/detail/UserFavoriteList.vue b/src/views/member/user/detail/UserFavoriteList.vue new file mode 100644 index 00000000..009a8b10 --- /dev/null +++ b/src/views/member/user/detail/UserFavoriteList.vue @@ -0,0 +1,195 @@ + + + diff --git a/src/views/member/user/detail/index.vue b/src/views/member/user/detail/index.vue index 1bac010e..6237cca6 100644 --- a/src/views/member/user/detail/index.vue +++ b/src/views/member/user/detail/index.vue @@ -48,7 +48,9 @@ 售后管理(WIP) - 收藏记录(WIP) + + + @@ -76,6 +78,7 @@ import UserExperienceRecordList from './UserExperienceRecordList.vue' import UserOrderList from './UserOrderList.vue' import UserPointList from './UserPointList.vue' import UserSignList from './UserSignList.vue' +import UserFavoriteList from './UserFavoriteList.vue' import { CardTitle } from '@/components/Card/index' import { ElMessage } from 'element-plus' From f2c71d5836895b7d4ff6520388709f5426d88559 Mon Sep 17 00:00:00 2001 From: niou233 <2922564446@qq.com> Date: Wed, 8 Nov 2023 17:29:57 +0800 Subject: [PATCH 2/7] =?UTF-8?q?refactor:=20=E4=BC=9A=E5=91=98=E5=95=86?= =?UTF-8?q?=E5=93=81=E6=94=B6=E8=97=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/mall/product/favorite.ts | 16 --- .../member/user/detail/UserFavoriteList.vue | 99 ------------------- 2 files changed, 115 deletions(-) diff --git a/src/api/mall/product/favorite.ts b/src/api/mall/product/favorite.ts index 2e54ec78..3834eed0 100644 --- a/src/api/mall/product/favorite.ts +++ b/src/api/mall/product/favorite.ts @@ -8,21 +8,5 @@ export interface Favorite { // 获得 ProductFavorite 列表 export const getFavoritePage = (params: PageParam) => { - params.keyword = params.name return request.get({ url: '/product/favorite/page', params }) } - -// 收藏商品 Favorite -export const createFavorite = (data: Favorite) => { - return request.post({ url: '/product/favorite/create', data }) -} - -// 取消商品收藏 Favorite -export const delFavorite = (data: Favorite) => { - return request.delete({ url: '/product/favorite/delete', data }) -} - -// 是否收藏过商品 Favorite -export const exitsFavorite = (data: Favorite) => { - return request.post({ url: '/product/favorite/exits', data }) -} diff --git a/src/views/member/user/detail/UserFavoriteList.vue b/src/views/member/user/detail/UserFavoriteList.vue index 009a8b10..afab9a08 100644 --- a/src/views/member/user/detail/UserFavoriteList.vue +++ b/src/views/member/user/detail/UserFavoriteList.vue @@ -1,46 +1,4 @@ - - - { handleQuery() } -/** 取消收藏按钮操作 */ -const handleDelete = async (row: object) => { - try { - console.log(row) - // 取消的二次确认 - await message.delStarConfirm() - // 发起取消 - await FavoriteApi.delFavorite({ userId: queryParams.userId, spuId: row.spuId }) - message.success(t('common.delStarSuccess')) - row.favoriteStatus = 0 - // 刷新列表 - // await getList() - } catch {} -} - -/** 收藏按钮操作 */ -const handleAdd = async (row: object) => { - try { - const data = { userId: queryParams.userId, spuId: row.spuId } - // 发起收藏 - const result = await FavoriteApi.exitsFavorite(data) - if (result === false) { - // 发起收藏 - await FavoriteApi.createFavorite(data) - message.success(t('common.starSuccess')) - row.favoriteStatus = 1 - // 刷新列表 - // await getList() - } else { - message.warning(t('common.existStar')) - row.favoriteStatus = 1 - } - } catch {} -} - const { userId } = defineProps({ userId: { type: Number, From 2ff97758fd720b281e2b76afa56f2fc637476916 Mon Sep 17 00:00:00 2001 From: niou233 <2922564446@qq.com> Date: Fri, 10 Nov 2023 11:34:32 +0000 Subject: [PATCH 3/7] update src/hooks/web/useMessage.ts. Signed-off-by: niou233 <2922564446@qq.com> --- src/hooks/web/useMessage.ts | 12 ------------ 1 file changed, 12 deletions(-) diff --git a/src/hooks/web/useMessage.ts b/src/hooks/web/useMessage.ts index 9bfb7a3a..ac2b552e 100644 --- a/src/hooks/web/useMessage.ts +++ b/src/hooks/web/useMessage.ts @@ -90,18 +90,6 @@ export const useMessage = () => { cancelButtonText: t('common.cancel'), type: 'warning' }) - }, - // 取消收藏窗体 - delStarConfirm(content?: string, tip?: string) { - return ElMessageBox.confirm( - content ? content : t('common.confirmDelStar'), - tip ? tip : t('common.confirmTitle'), - { - confirmButtonText: t('common.ok'), - cancelButtonText: t('common.cancel'), - type: 'warning' - } - ) } } } From 1ab5b44254415e050615d91128df0afb703ccc1d Mon Sep 17 00:00:00 2001 From: niou233 <2922564446@qq.com> Date: Fri, 10 Nov 2023 11:35:54 +0000 Subject: [PATCH 4/7] update src/locales/en.ts. Signed-off-by: niou233 <2922564446@qq.com> --- src/locales/en.ts | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/src/locales/en.ts b/src/locales/en.ts index d82e616e..4f4d4895 100644 --- a/src/locales/en.ts +++ b/src/locales/en.ts @@ -54,13 +54,7 @@ export default { updateTime: 'Update Time', copy: 'Copy', copySuccess: 'Copy Success', - copyError: 'Copy Error', - confirmDelStar: 'Delete the Star?', - starSuccess: 'Star Success', - starFail: 'Star Error', - delStarSuccess: 'Del Star Success', - delStarFail: 'Del Star Error', - existStar: 'exist Star' + copyError: 'Copy Error' }, error: { noPermission: `Sorry, you don't have permission to access this page.`, From af5d1cf25ee8898cab5e1d1b520b288021d982bc Mon Sep 17 00:00:00 2001 From: niou233 <2922564446@qq.com> Date: Fri, 10 Nov 2023 11:36:11 +0000 Subject: [PATCH 5/7] update src/locales/zh-CN.ts. Signed-off-by: niou233 <2922564446@qq.com> --- src/locales/zh-CN.ts | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/src/locales/zh-CN.ts b/src/locales/zh-CN.ts index 49a3f895..4f95852f 100644 --- a/src/locales/zh-CN.ts +++ b/src/locales/zh-CN.ts @@ -54,13 +54,7 @@ export default { updateTime: '更新时间', copy: '复制', copySuccess: '复制成功', - copyError: '复制失败', - confirmDelStar: '是否取消收藏?', - starSuccess: '收藏成功', - starFail: '收藏失败', - delStarSuccess: '取消收藏成功', - delStarFail: '取消收藏失败', - existStar: '收藏已存在' + copyError: '复制失败' }, error: { noPermission: `抱歉,您无权访问此页面。`, From f74ddf46ae518c02ebcb1900ca39e39f97b524af Mon Sep 17 00:00:00 2001 From: YunaiV Date: Tue, 21 Nov 2023 22:53:49 +0800 Subject: [PATCH 6/7] =?UTF-8?q?sms=EF=BC=9A=E7=A7=BB=E9=99=A4=20sendCode?= =?UTF-8?q?=E3=80=81sendMsg=20=E5=AD=97=E6=AE=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/system/sms/smsLog/index.ts | 2 -- src/views/system/sms/log/SmsLogDetail.vue | 3 --- 2 files changed, 5 deletions(-) diff --git a/src/api/system/sms/smsLog/index.ts b/src/api/system/sms/smsLog/index.ts index 3d54fac1..f9891716 100644 --- a/src/api/system/sms/smsLog/index.ts +++ b/src/api/system/sms/smsLog/index.ts @@ -15,8 +15,6 @@ export interface SmsLogVO { userType: number | null sendStatus: number | null sendTime: Date | null - sendCode: number | null - sendMsg: string apiSendCode: string apiSendMsg: string apiRequestId: string diff --git a/src/views/system/sms/log/SmsLogDetail.vue b/src/views/system/sms/log/SmsLogDetail.vue index 34c5e58e..b0d22c2d 100644 --- a/src/views/system/sms/log/SmsLogDetail.vue +++ b/src/views/system/sms/log/SmsLogDetail.vue @@ -37,9 +37,6 @@ {{ formatDate(detailData.sendTime) }} - - {{ detailData.sendCode }} | {{ detailData.sendMsg }} - {{ detailData.apiSendCode }} | {{ detailData.apiSendMsg }} From 1744c6ec6fea5897ee202d42c5e6198285ba09e4 Mon Sep 17 00:00:00 2001 From: YunaiV Date: Fri, 24 Nov 2023 00:33:05 +0800 Subject: [PATCH 7/7] =?UTF-8?q?websocket=20=E9=87=8D=E6=96=B0=E5=B0=81?= =?UTF-8?q?=E8=A3=85?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .env.base | 4 +- src/api/system/notice/index.ts | 5 + src/locales/zh-CN.ts | 3 +- src/views/infra/webSocket/index.vue | 142 ++++++++++++++++++++-------- src/views/system/notice/index.vue | 14 +++ 5 files changed, 125 insertions(+), 43 deletions(-) diff --git a/.env.base b/.env.base index fdb26d85..cf433822 100644 --- a/.env.base +++ b/.env.base @@ -4,10 +4,10 @@ NODE_ENV=development VITE_DEV=true # 请求路径 -VITE_BASE_URL='http://localhost:48080' +VITE_BASE_URL='http://127.0.0.1:48080' # 上传路径 -VITE_UPLOAD_URL='http://localhost:48080/admin-api/infra/file/upload' +VITE_UPLOAD_URL='http://127.0.0.1:48080/admin-api/infra/file/upload' # 接口前缀 VITE_API_BASEPATH=/dev-api diff --git a/src/api/system/notice/index.ts b/src/api/system/notice/index.ts index 62bf5259..f6434697 100644 --- a/src/api/system/notice/index.ts +++ b/src/api/system/notice/index.ts @@ -35,3 +35,8 @@ export const updateNotice = (data: NoticeVO) => { export const deleteNotice = (id: number) => { return request.delete({ url: '/system/notice/delete?id=' + id }) } + +// 推送公告 +export const pushNotice = (id: number) => { + return request.post({ url: '/system/notice/push?id=' + id }) +} diff --git a/src/locales/zh-CN.ts b/src/locales/zh-CN.ts index 4f95852f..6346a3d3 100644 --- a/src/locales/zh-CN.ts +++ b/src/locales/zh-CN.ts @@ -437,5 +437,6 @@ export default { btn_zoom_in: '放大', btn_zoom_out: '缩小', preview: '预览' - } + }, + 'OAuth 2.0': 'OAuth 2.0' // 避免菜单名是 OAuth 2.0 时,一直 warn 报错 } diff --git a/src/views/infra/webSocket/index.vue b/src/views/infra/webSocket/index.vue index ce6db798..0f609213 100644 --- a/src/views/infra/webSocket/index.vue +++ b/src/views/infra/webSocket/index.vue @@ -1,5 +1,6 @@ @@ -168,6 +171,17 @@ const handleDelete = async (id: number) => { } catch {} } +/** 推送按钮操作 */ +const handlePush = async (id: number) => { + try { + // 推送的二次确认 + await message.confirm('是否推送所选中通知?') + // 发起推送 + await NoticeApi.pushNotice(id) + message.success(t('推送成功')) + } catch {} +} + /** 初始化 **/ onMounted(() => { getList()