diff --git a/apps/web-antd/src/api/system/mail/account/index.ts b/apps/web-antd/src/api/system/mail/account/index.ts new file mode 100644 index 000000000..5c03f4f9b --- /dev/null +++ b/apps/web-antd/src/api/system/mail/account/index.ts @@ -0,0 +1,77 @@ +import type { PageResult } from '@vben/request'; + +import { requestClient } from '#/api/request'; + +export namespace SystemMailAccountApi { + export interface MailAccountVO { + id: number; + mail: string; + username: string; + password: string; + host: string; + port: number; + sslEnable: boolean; + starttlsEnable: boolean; + status: number; + createTime: Date; + remark: string; + } +} + +// 查询邮箱账号列表 +export const getMailAccountPage = async (params: any) => { + return await requestClient.get< + PageResult + >('/system/mail-account/page', { params }); +}; + +// 查询邮箱账号详情 +export const getMailAccount = async (id: number) => { + return await requestClient.get( + '/system/mail-account/get', + { + params: { id }, + }, + ); +}; + +// 新增邮箱账号 +export const createMailAccount = async ( + data: SystemMailAccountApi.MailAccountVO, +) => { + return await requestClient.post( + '/system/mail-account/create', + data, + ); +}; + +// 修改邮箱账号 +export const updateMailAccount = async ( + data: SystemMailAccountApi.MailAccountVO, +) => { + return await requestClient.put( + '/system/mail-account/update', + data, + ); +}; + +// 删除邮箱账号 +export const deleteMailAccount = async (id: number) => { + return await requestClient.delete('/system/mail-account/delete', { + params: { id }, + }); +}; + +// 获得邮箱账号精简列表 +export const getSimpleMailAccountList = async () => { + return await requestClient.get( + '/system/mail-account/simple-list', + ); +}; + +// 测试邮箱连接 +export const testMailAccount = async (id: number) => { + return await requestClient.post('/system/mail-account/test', null, { + params: { id }, + }); +}; diff --git a/apps/web-antd/src/api/system/mail/log/index.ts b/apps/web-antd/src/api/system/mail/log/index.ts new file mode 100644 index 000000000..505ba471e --- /dev/null +++ b/apps/web-antd/src/api/system/mail/log/index.ts @@ -0,0 +1,57 @@ +import type { PageResult } from '@vben/request'; + +import { requestClient } from '#/api/request'; + +export namespace SystemMailLogApi { + export interface MailLogVO { + id: number; + userId: number; + userType: number; + toMail: string; + accountId: number; + fromMail: string; + templateId: number; + templateCode: string; + templateNickname: string; + templateTitle: string; + templateContent: string; + templateParams: string; + sendStatus: number; + sendTime: Date; + sendMessageId: string; + sendException: string; + createTime: Date; + } +} + +// 查询邮件日志列表 +export const getMailLogPage = async (params: any) => { + return await requestClient.get>( + '/system/mail-log/page', + { params }, + ); +}; + +// 查询邮件日志详情 +export const getMailLog = async (id: number) => { + return await requestClient.get( + '/system/mail-log/get', + { + params: { id }, + }, + ); +}; + +// 重新发送邮件 +export const resendMail = async (id: number) => { + return await requestClient.put('/system/mail-log/resend', null, { + params: { id }, + }); +}; + +// 批量删除邮件日志 +export const deleteMailLogs = async (ids: number[]) => { + return await requestClient.delete('/system/mail-log/delete', { + data: { ids }, + }); +}; diff --git a/apps/web-antd/src/api/system/mail/template/index.ts b/apps/web-antd/src/api/system/mail/template/index.ts new file mode 100644 index 000000000..bf85bab97 --- /dev/null +++ b/apps/web-antd/src/api/system/mail/template/index.ts @@ -0,0 +1,77 @@ +import type { PageResult } from '@vben/request'; + +import { requestClient } from '#/api/request'; + +export namespace SystemMailTemplateApi { + export interface MailTemplateVO { + id: number; + name: string; + code: string; + accountId: number; + nickname: string; + title: string; + content: string; + params: string; + status: number; + remark: string; + createTime: Date; + } + + export interface MailSendReqVO { + mail: string; + templateCode: string; + templateParams: Record; + } +} + +// 查询邮件模版列表 +export const getMailTemplatePage = async (params: any) => { + return await requestClient.get< + PageResult + >('/system/mail-template/page', { params }); +}; + +// 查询邮件模版详情 +export const getMailTemplate = async (id: number) => { + return await requestClient.get( + '/system/mail-template/get', + { + params: { id }, + }, + ); +}; + +// 新增邮件模版 +export const createMailTemplate = async ( + data: SystemMailTemplateApi.MailTemplateVO, +) => { + return await requestClient.post( + '/system/mail-template/create', + data, + ); +}; + +// 修改邮件模版 +export const updateMailTemplate = async ( + data: SystemMailTemplateApi.MailTemplateVO, +) => { + return await requestClient.put( + '/system/mail-template/update', + data, + ); +}; + +// 删除邮件模版 +export const deleteMailTemplate = async (id: number) => { + return await requestClient.delete('/system/mail-template/delete', { + params: { id }, + }); +}; + +// 发送邮件 +export const sendMail = async (data: SystemMailTemplateApi.MailSendReqVO) => { + return await requestClient.post( + '/system/mail-template/send-mail', + data, + ); +}; diff --git a/apps/web-antd/src/api/system/sms/channel/index.ts b/apps/web-antd/src/api/system/sms/channel/index.ts new file mode 100644 index 000000000..93be7aca7 --- /dev/null +++ b/apps/web-antd/src/api/system/sms/channel/index.ts @@ -0,0 +1,60 @@ +import type { PageResult } from '@vben/request'; + +import { requestClient } from '#/api/request'; + +export namespace SystemSmsChannelApi { + /** 短信渠道信息 */ + export interface SmsChannelVO { + id?: number; + code: string; + status: number; + signature: string; + remark: string; + apiKey: string; + apiSecret: string; + callbackUrl: string; + createTime?: Date; + } +} + +/** 查询短信渠道列表 */ +export function getSmsChannelPage(params: any) { + return requestClient.get>( + '/system/sms-channel/page', + { params }, + ); +} + +/** 获得短信渠道精简列表 */ +export function getSimpleSmsChannelList() { + return requestClient.get( + '/system/sms-channel/simple-list', + ); +} + +/** 查询短信渠道详情 */ +export function getSmsChannel(id: number) { + return requestClient.get( + `/system/sms-channel/get?id=${id}`, + ); +} + +/** 新增短信渠道 */ +export function createSmsChannel(data: SystemSmsChannelApi.SmsChannelVO) { + return requestClient.post('/system/sms-channel/create', data); +} + +/** 修改短信渠道 */ +export function updateSmsChannel(data: SystemSmsChannelApi.SmsChannelVO) { + return requestClient.put('/system/sms-channel/update', data); +} + +/** 删除短信渠道 */ +export function deleteSmsChannel(id: number) { + return requestClient.delete(`/system/sms-channel/delete?id=${id}`); +} + +/** 导出短信渠道 */ +export function exportSmsChannel(params: any) { + return requestClient.download('/system/sms-channel/export', { params }); +} diff --git a/apps/web-antd/src/api/system/sms/log/index.ts b/apps/web-antd/src/api/system/sms/log/index.ts new file mode 100644 index 000000000..e4aa01796 --- /dev/null +++ b/apps/web-antd/src/api/system/sms/log/index.ts @@ -0,0 +1,45 @@ +import type { PageResult } from '@vben/request'; + +import { requestClient } from '#/api/request'; + +export namespace SystemSmsLogApi { + /** 短信日志信息 */ + export interface SmsLogVO { + id?: number; + channelId?: number; + channelCode: string; + templateId?: number; + templateCode: string; + templateType?: number; + templateContent: string; + templateParams?: Record; + apiTemplateId: string; + mobile: string; + userId?: number; + userType?: number; + sendStatus?: number; + sendTime?: Date; + apiSendCode: string; + apiSendMsg: string; + apiRequestId: string; + apiSerialNo: string; + receiveStatus?: number; + receiveTime?: Date; + apiReceiveCode: string; + apiReceiveMsg: string; + createTime?: Date; + } +} + +/** 查询短信日志列表 */ +export function getSmsLogPage(params: any) { + return requestClient.get>( + '/system/sms-log/page', + { params }, + ); +} + +/** 导出短信日志 */ +export function exportSmsLog(params: any) { + return requestClient.download('/system/sms-log/export-excel', { params }); +} diff --git a/apps/web-antd/src/api/system/sms/template/index.ts b/apps/web-antd/src/api/system/sms/template/index.ts new file mode 100644 index 000000000..336398474 --- /dev/null +++ b/apps/web-antd/src/api/system/sms/template/index.ts @@ -0,0 +1,70 @@ +import type { PageResult } from '@vben/request'; + +import { requestClient } from '#/api/request'; + +export namespace SystemSmsTemplateApi { + /** 短信模板信息 */ + export interface SmsTemplateVO { + id?: number; + type?: number; + status: number; + code: string; + name: string; + content: string; + remark: string; + apiTemplateId: string; + channelId?: number; + channelCode?: string; + params?: string[]; + createTime?: Date; + } + + /** 发送短信请求 */ + export interface SendSmsReqVO { + mobile: string; + templateCode: string; + templateParams: Record; + } +} + +/** 查询短信模板列表 */ +export function getSmsTemplatePage(params: any) { + return requestClient.get>( + '/system/sms-template/page', + { params }, + ); +} + +/** 查询短信模板详情 */ +export function getSmsTemplate(id: number) { + return requestClient.get( + `/system/sms-template/get?id=${id}`, + ); +} + +/** 新增短信模板 */ +export function createSmsTemplate(data: SystemSmsTemplateApi.SmsTemplateVO) { + return requestClient.post('/system/sms-template/create', data); +} + +/** 修改短信模板 */ +export function updateSmsTemplate(data: SystemSmsTemplateApi.SmsTemplateVO) { + return requestClient.put('/system/sms-template/update', data); +} + +/** 删除短信模板 */ +export function deleteSmsTemplate(id: number) { + return requestClient.delete(`/system/sms-template/delete?id=${id}`); +} + +/** 导出短信模板 */ +export function exportSmsTemplate(params: any) { + return requestClient.download('/system/sms-template/export-excel', { + params, + }); +} + +/** 发送短信 */ +export function sendSms(data: SystemSmsTemplateApi.SendSmsReqVO) { + return requestClient.post('/system/sms-template/send-sms', data); +} diff --git a/apps/web-antd/src/api/system/user/index.ts b/apps/web-antd/src/api/system/user/index.ts index e69610626..2ef22f292 100644 --- a/apps/web-antd/src/api/system/user/index.ts +++ b/apps/web-antd/src/api/system/user/index.ts @@ -1,6 +1,7 @@ -import { requestClient } from '#/api/request'; import type { PageParam } from '@vben/request'; +import { requestClient } from '#/api/request'; + export namespace SystemUserApi { /** 用户信息 */ export interface SystemUser { diff --git a/apps/web-antd/src/views/system/sms/channel/data.ts b/apps/web-antd/src/views/system/sms/channel/data.ts new file mode 100644 index 000000000..d7cda29f7 --- /dev/null +++ b/apps/web-antd/src/views/system/sms/channel/data.ts @@ -0,0 +1,184 @@ +import type { VbenFormSchema } from '#/adapter/form'; +import type { OnActionClickFn, VxeTableGridOptions } from '#/adapter/vxe-table'; +import type { SystemSmsChannelApi } from '#/api/system/sms/channel'; + +import { z } from '#/adapter/form'; +import { CommonStatusEnum } from '#/utils/constants'; +import { DICT_TYPE, getDictOptions } from '#/utils/dict'; + +/** 新增/修改的表单 */ +export function useFormSchema(): VbenFormSchema[] { + return [ + { + fieldName: 'id', + label: 'id', + component: 'Input', + dependencies: { + triggerFields: [''], + show: () => false, + }, + }, + { + fieldName: 'signature', + label: '短信签名', + component: 'Input', + rules: 'required', + }, + { + fieldName: 'code', + label: '渠道编码', + component: 'Select', + componentProps: { + class: 'w-full', + options: getDictOptions(DICT_TYPE.SYSTEM_SMS_CHANNEL_CODE, 'string'), + }, + rules: 'required', + }, + { + fieldName: 'status', + label: '启用状态', + component: 'RadioGroup', + componentProps: { + options: getDictOptions(DICT_TYPE.COMMON_STATUS, 'number'), + buttonStyle: 'solid', + optionType: 'button', + }, + rules: z.number().default(CommonStatusEnum.ENABLE), + }, + { + fieldName: 'remark', + label: '备注', + component: 'Textarea', + }, + { + fieldName: 'apiKey', + label: '短信 API 的账号', + component: 'Input', + rules: 'required', + }, + { + fieldName: 'apiSecret', + label: '短信 API 的密钥', + component: 'Input', + }, + { + fieldName: 'callbackUrl', + label: '短信发送回调 URL', + component: 'Input', + }, + ]; +} + +/** 列表的搜索表单 */ +export function useGridFormSchema(): VbenFormSchema[] { + return [ + { + fieldName: 'signature', + label: '短信签名', + component: 'Input', + }, + { + fieldName: 'code', + label: '渠道编码', + component: 'Select', + componentProps: { + allowClear: true, + options: getDictOptions(DICT_TYPE.SYSTEM_SMS_CHANNEL_CODE, 'string'), + }, + }, + { + fieldName: 'status', + label: '状态', + component: 'Select', + componentProps: { + allowClear: true, + options: getDictOptions(DICT_TYPE.COMMON_STATUS, 'number'), + }, + }, + { + fieldName: 'createTime', + label: '创建时间', + component: 'RangePicker', + componentProps: { + allowClear: true, + }, + }, + ]; +} + +/** 列表的字段 */ +export function useGridColumns( + onActionClick: OnActionClickFn, +): VxeTableGridOptions['columns'] { + return [ + { + field: 'id', + title: '编号', + minWidth: 100, + }, + { + field: 'signature', + title: '短信签名', + minWidth: 120, + }, + { + field: 'code', + title: '渠道编码', + minWidth: 120, + cellRender: { + name: 'CellDict', + props: { type: DICT_TYPE.SYSTEM_SMS_CHANNEL_CODE }, + }, + }, + { + field: 'status', + title: '启用状态', + minWidth: 100, + cellRender: { + name: 'CellDict', + props: { type: DICT_TYPE.COMMON_STATUS }, + }, + }, + { + field: 'remark', + title: '备注', + minWidth: 120, + }, + { + field: 'apiKey', + title: '短信 API 的账号', + minWidth: 180, + }, + { + field: 'apiSecret', + title: '短信 API 的密钥', + minWidth: 180, + }, + { + field: 'callbackUrl', + title: '短信发送回调 URL', + minWidth: 180, + }, + { + field: 'createTime', + title: '创建时间', + minWidth: 180, + formatter: 'formatDateTime', + }, + { + field: 'operation', + title: '操作', + minWidth: 180, + align: 'center', + fixed: 'right', + cellRender: { + attrs: { + nameField: 'signature', + nameTitle: '短信渠道', + onClick: onActionClick, + }, + name: 'CellOperation', + }, + }, + ]; +} diff --git a/apps/web-antd/src/views/system/sms/channel/index.vue b/apps/web-antd/src/views/system/sms/channel/index.vue new file mode 100644 index 000000000..866ee605c --- /dev/null +++ b/apps/web-antd/src/views/system/sms/channel/index.vue @@ -0,0 +1,133 @@ + + + diff --git a/apps/web-antd/src/views/system/sms/channel/modules/form.vue b/apps/web-antd/src/views/system/sms/channel/modules/form.vue new file mode 100644 index 000000000..3cacd6732 --- /dev/null +++ b/apps/web-antd/src/views/system/sms/channel/modules/form.vue @@ -0,0 +1,84 @@ + + + diff --git a/apps/web-antd/src/views/system/sms/log/data.ts b/apps/web-antd/src/views/system/sms/log/data.ts new file mode 100644 index 000000000..5a8e3b69e --- /dev/null +++ b/apps/web-antd/src/views/system/sms/log/data.ts @@ -0,0 +1,170 @@ +import type { VbenFormSchema } from '#/adapter/form'; +import type { OnActionClickFn, VxeTableGridOptions } from '#/adapter/vxe-table'; +import type { SystemSmsLogApi } from '#/api/system/sms/log'; + +import { getSimpleSmsChannelList } from '#/api/system/sms/channel'; +import { DICT_TYPE, getDictOptions } from '#/utils/dict'; + +/** 列表的搜索表单 */ +export function useGridFormSchema(): VbenFormSchema[] { + return [ + { + fieldName: 'mobile', + label: '手机号', + component: 'Input', + }, + { + fieldName: 'channelId', + label: '短信渠道', + component: 'ApiSelect', + componentProps: { + api: async () => await getSimpleSmsChannelList(), + labelField: 'signature', + valueField: 'id', + allowClear: true, + }, + }, + { + fieldName: 'templateId', + label: '模板编号', + component: 'Input', + }, + { + fieldName: 'sendStatus', + label: '发送状态', + component: 'Select', + componentProps: { + allowClear: true, + options: getDictOptions(DICT_TYPE.SYSTEM_SMS_SEND_STATUS, 'number'), + }, + }, + { + fieldName: 'sendTime', + label: '发送时间', + component: 'RangePicker', + componentProps: { + allowClear: true, + }, + }, + { + fieldName: 'receiveStatus', + label: '接收状态', + component: 'Select', + componentProps: { + allowClear: true, + options: getDictOptions(DICT_TYPE.SYSTEM_SMS_RECEIVE_STATUS, 'number'), + }, + }, + { + fieldName: 'receiveTime', + label: '接收时间', + component: 'RangePicker', + componentProps: { + allowClear: true, + }, + }, + ]; +} + +/** 列表的字段 */ +export function useGridColumns( + onActionClick: OnActionClickFn, +): VxeTableGridOptions['columns'] { + return [ + { + field: 'id', + title: '编号', + minWidth: 100, + }, + { + field: 'createTime', + title: '创建时间', + minWidth: 180, + formatter: 'formatDateTime', + }, + { + field: 'mobile', + title: '手机号', + minWidth: 120, + }, + { + field: 'templateContent', + title: '短信内容', + minWidth: 300, + }, + { + field: 'sendStatus', + title: '发送状态', + minWidth: 120, + cellRender: { + name: 'CellDict', + props: { type: DICT_TYPE.SYSTEM_SMS_SEND_STATUS }, + }, + }, + { + field: 'sendTime', + title: '发送时间', + minWidth: 180, + formatter: 'formatDateTime', + }, + { + field: 'receiveStatus', + title: '接收状态', + minWidth: 120, + cellRender: { + name: 'CellDict', + props: { type: DICT_TYPE.SYSTEM_SMS_RECEIVE_STATUS }, + }, + }, + { + field: 'receiveTime', + title: '接收时间', + minWidth: 180, + formatter: 'formatDateTime', + }, + { + field: 'channelCode', + title: '短信渠道', + minWidth: 120, + cellRender: { + name: 'CellDict', + props: { type: DICT_TYPE.SYSTEM_SMS_CHANNEL_CODE }, + }, + }, + { + field: 'templateId', + title: '模板编号', + minWidth: 100, + }, + { + field: 'templateType', + title: '短信类型', + minWidth: 100, + cellRender: { + name: 'CellDict', + props: { type: DICT_TYPE.SYSTEM_SMS_TEMPLATE_TYPE }, + }, + }, + { + field: 'operation', + title: '操作', + minWidth: 120, + align: 'center', + fixed: 'right', + cellRender: { + attrs: { + nameField: 'mobile', + nameTitle: '短信日志', + onClick: onActionClick, + }, + name: 'CellOperation', + options: [ + { + code: 'view', + text: '查看', + }, + ], + }, + }, + ]; +} diff --git a/apps/web-antd/src/views/system/sms/log/index.vue b/apps/web-antd/src/views/system/sms/log/index.vue new file mode 100644 index 000000000..fc55da7be --- /dev/null +++ b/apps/web-antd/src/views/system/sms/log/index.vue @@ -0,0 +1,97 @@ + + + diff --git a/apps/web-antd/src/views/system/sms/log/modules/form.vue b/apps/web-antd/src/views/system/sms/log/modules/form.vue new file mode 100644 index 000000000..a3de58d45 --- /dev/null +++ b/apps/web-antd/src/views/system/sms/log/modules/form.vue @@ -0,0 +1,122 @@ + + + + + diff --git a/apps/web-antd/src/views/system/sms/template/data.ts b/apps/web-antd/src/views/system/sms/template/data.ts new file mode 100644 index 000000000..1d197ec84 --- /dev/null +++ b/apps/web-antd/src/views/system/sms/template/data.ts @@ -0,0 +1,252 @@ +import type { VbenFormSchema } from '#/adapter/form'; +import type { OnActionClickFn, VxeTableGridOptions } from '#/adapter/vxe-table'; +import type { SystemSmsTemplateApi } from '#/api/system/sms/template'; + +import { z } from '#/adapter/form'; +import { getSimpleSmsChannelList } from '#/api/system/sms/channel'; +import { CommonStatusEnum } from '#/utils/constants'; +import { DICT_TYPE, getDictOptions } from '#/utils/dict'; + +/** 新增/修改的表单 */ +export function useFormSchema(): VbenFormSchema[] { + return [ + { + fieldName: 'id', + label: 'id', + component: 'Input', + dependencies: { + triggerFields: [''], + show: () => false, + }, + }, + { + fieldName: 'type', + label: '短信类型', + component: 'Select', + componentProps: { + class: 'w-full', + options: getDictOptions(DICT_TYPE.SYSTEM_SMS_TEMPLATE_TYPE, 'number'), + }, + rules: 'required', + }, + { + fieldName: 'name', + label: '模板名称', + component: 'Input', + rules: 'required', + }, + { + fieldName: 'code', + label: '模板编码', + component: 'Input', + rules: 'required', + }, + { + fieldName: 'channelId', + label: '短信渠道', + component: 'ApiSelect', + componentProps: { + api: async () => await getSimpleSmsChannelList(), + class: 'w-full', + labelField: 'signature', + valueField: 'id', + }, + rules: 'required', + }, + { + fieldName: 'status', + label: '开启状态', + component: 'RadioGroup', + componentProps: { + options: getDictOptions(DICT_TYPE.COMMON_STATUS, 'number'), + buttonStyle: 'solid', + optionType: 'button', + }, + rules: z.number().default(CommonStatusEnum.ENABLE), + }, + { + fieldName: 'content', + label: '模板内容', + component: 'Textarea', + rules: 'required', + }, + { + fieldName: 'apiTemplateId', + label: '短信 API 的模板编号', + component: 'Input', + }, + { + fieldName: 'remark', + label: '备注', + component: 'Textarea', + }, + ]; +} + +/** 列表的搜索表单 */ +export function useGridFormSchema(): VbenFormSchema[] { + return [ + { + fieldName: 'type', + label: '短信类型', + component: 'Select', + componentProps: { + allowClear: true, + options: getDictOptions(DICT_TYPE.SYSTEM_SMS_TEMPLATE_TYPE, 'number'), + }, + }, + { + fieldName: 'status', + label: '开启状态', + component: 'Select', + componentProps: { + allowClear: true, + options: getDictOptions(DICT_TYPE.COMMON_STATUS, 'number'), + }, + }, + { + fieldName: 'code', + label: '模板编码', + component: 'Input', + }, + { + fieldName: 'name', + label: '模板名称', + component: 'Input', + }, + { + fieldName: 'channelId', + label: '短信渠道', + component: 'ApiSelect', + componentProps: { + api: async () => await getSimpleSmsChannelList(), + labelField: 'signature', + valueField: 'id', + allowClear: true, + }, + }, + { + fieldName: 'createTime', + label: '创建时间', + component: 'RangePicker', + componentProps: { + allowClear: true, + }, + }, + ]; +} + +/** 发送短信表单 */ +export function useSendSmsFormSchema(): VbenFormSchema[] { + return [ + { + fieldName: 'mobile', + label: '手机号码', + component: 'Input', + rules: 'required', + }, + { + fieldName: 'templateParams', + label: '模板参数', + component: 'Input', + dependencies: { + triggerFields: [''], + show: () => false, + }, + }, + ]; +} + +/** 列表的字段 */ +export function useGridColumns( + onActionClick: OnActionClickFn, +): VxeTableGridOptions['columns'] { + return [ + { + field: 'id', + title: '编号', + minWidth: 100, + }, + { + field: 'type', + title: '短信类型', + minWidth: 120, + cellRender: { + name: 'CellDict', + props: { type: DICT_TYPE.SYSTEM_SMS_TEMPLATE_TYPE }, + }, + }, + { + field: 'name', + title: '模板名称', + minWidth: 120, + }, + { + field: 'code', + title: '模板编码', + minWidth: 120, + }, + { + field: 'content', + title: '模板内容', + minWidth: 200, + }, + { + field: 'status', + title: '开启状态', + minWidth: 100, + cellRender: { + name: 'CellDict', + props: { type: DICT_TYPE.COMMON_STATUS }, + }, + }, + { + field: 'remark', + title: '备注', + minWidth: 120, + }, + { + field: 'apiTemplateId', + title: '短信 API 的模板编号', + minWidth: 180, + }, + { + field: 'channelCode', + title: '短信渠道', + minWidth: 100, + cellRender: { + name: 'CellDict', + props: { type: DICT_TYPE.SYSTEM_SMS_CHANNEL_CODE }, + }, + }, + { + field: 'createTime', + title: '创建时间', + minWidth: 180, + formatter: 'formatDateTime', + }, + { + field: 'operation', + title: '操作', + minWidth: 300, + align: 'center', + fixed: 'right', + cellRender: { + attrs: { + nameField: 'name', + nameTitle: '短信模板', + onClick: onActionClick, + }, + name: 'CellOperation', + options: [ + 'edit', // 默认的编辑按钮 + 'delete', // 默认的删除按钮 + { + code: 'sms-send', + text: '发送短信', + }, + ], + }, + }, + ]; +} diff --git a/apps/web-antd/src/views/system/sms/template/index.vue b/apps/web-antd/src/views/system/sms/template/index.vue new file mode 100644 index 000000000..ccc5d8ae2 --- /dev/null +++ b/apps/web-antd/src/views/system/sms/template/index.vue @@ -0,0 +1,149 @@ + + + diff --git a/apps/web-antd/src/views/system/sms/template/modules/form.vue b/apps/web-antd/src/views/system/sms/template/modules/form.vue new file mode 100644 index 000000000..3960a4970 --- /dev/null +++ b/apps/web-antd/src/views/system/sms/template/modules/form.vue @@ -0,0 +1,84 @@ + + + diff --git a/apps/web-antd/src/views/system/sms/template/modules/send-form.vue b/apps/web-antd/src/views/system/sms/template/modules/send-form.vue new file mode 100644 index 000000000..8042bad2a --- /dev/null +++ b/apps/web-antd/src/views/system/sms/template/modules/send-form.vue @@ -0,0 +1,109 @@ + + + diff --git a/packages/effects/request/src/request-client/preset-interceptors.ts b/packages/effects/request/src/request-client/preset-interceptors.ts index e5c677abf..de0f5bdcc 100644 --- a/packages/effects/request/src/request-client/preset-interceptors.ts +++ b/packages/effects/request/src/request-client/preset-interceptors.ts @@ -61,7 +61,7 @@ export const authenticateResponseInterceptor = ({ rejected: async (error) => { const { config, response, data: responseData } = error; // 如果不是 401 错误,直接抛出异常 - if (response?.status !== 401 && responseData.code !== 401) { + if (response?.status !== 401 && responseData?.code !== 401) { throw error; } // 判断是否启用了 refreshToken 功能 @@ -131,7 +131,8 @@ export const errorMessageResponseInterceptor = ( } let errorMessage = ''; - const status = error?.code || error?.response?.data?.code || error?.response?.status; + const status = + error?.code || error?.response?.data?.code || error?.response?.status; switch (status) { case 400: {