diff --git a/admin/src/api/channel/wx_oa.ts b/admin/src/api/channel/wx_oa.ts index 4546a4bc..67c84318 100644 --- a/admin/src/api/channel/wx_oa.ts +++ b/admin/src/api/channel/wx_oa.ts @@ -1,4 +1,5 @@ import request from '@/utils/request' +import { firstToUpperCase } from '@/utils/util' // 微信公众号配置保存 export function setOaConfig(params: any) { @@ -47,12 +48,11 @@ export function setOaMenuPublish(params: Menu | any) { } /** - * @return { Promise } - * @param { string } type - * @description 获取回复列表 + * @description 默认回复列表 */ -export function getOaReplyList(params: { type: string }) { - return request.get({ url: '/channel/oaReply/list', params }) +export function getOaReplyList(params: any) { + const type = firstToUpperCase(params.type) + return request.get({ url: `/channel/oaReply${type}/list`, params }) } /** @@ -60,8 +60,9 @@ export function getOaReplyList(params: { type: string }) { * @param { number } id * @description 回复列表删除 */ -export function oaReplyDel(params: { id: number }) { - return request.post({ url: '/channel/oaReply/del', params }) +export function oaReplyDel(params: any) { + const type = firstToUpperCase(params.type) + return request.post({ url: `/channel/oaReply${type}/del`, params }) } /** @@ -69,8 +70,9 @@ export function oaReplyDel(params: { id: number }) { * @param { number } id * @description 回复状态修改 */ -export function changeOaReplyStatus(params: { id: number }) { - return request.post({ url: '/channel/oaReply/status', params }) +export function changeOaReplyStatus(params: any) { + const type = firstToUpperCase(params.type) + return request.post({ url: `/channel/oaReply${type}/status`, params }) } export interface Reply { @@ -85,25 +87,26 @@ export interface Reply { } /** * @return { Promise } - * @description 回复添加 + * @description 默认回复编辑 */ export function oaReplyAdd(params: Reply) { - return request.post({ url: '/channel/oaReply/add', params }) + const type = firstToUpperCase(params.type) + return request.post({ url: `/channel/oaReply${type}/add`, params }) } /** * @return { Promise } - * @description 回复编辑 + * @description 默认回复编辑 */ export function oaReplyEdit(params: Reply) { - return request.post({ url: '/channel/oaReply/edit', params }) + const type = firstToUpperCase(params.type) + return request.post({ url: `/channel/oaReply${type}/edit`, params }) } /** - * @return { Promise } - * @param { string } type - * @description 获取回复详情 + * @description 默认回复详情 */ -export function getOaReplyDetail(params: { id: number }) { - return request.get({ url: '/channel/oaReply/detail', params }) +export function getOaReplyDetail(params: any) { + const type = firstToUpperCase(params.type) + return request.get({ url: `/channel/oaReply${type}/detail`, params }) } diff --git a/admin/src/config/index.ts b/admin/src/config/index.ts index 7995c377..4934e6d4 100644 --- a/admin/src/config/index.ts +++ b/admin/src/config/index.ts @@ -2,7 +2,7 @@ const config = { terminal: 1, //终端 title: '后台管理系统', //网站默认标题 version: '1.2.0', //版本号 - baseUrl: `${import.meta.env.VITE_APP_BASE_URL}/`, //请求接口域名 + baseUrl: `${import.meta.env.VITE_APP_BASE_URL || ''}/`, //请求接口域名 urlPrefix: 'api', //请求默认前缀 timeout: 10 * 1000 //请求超时时长 } diff --git a/admin/src/utils/util.ts b/admin/src/utils/util.ts index 57d9ab6e..1f54b8cc 100644 --- a/admin/src/utils/util.ts +++ b/admin/src/utils/util.ts @@ -160,3 +160,12 @@ export const getNonDuplicateID = (length = 8) => { idStr += Math.random().toString(36).substring(3, length) return idStr } + +/** + * @description 单词首字母大写 + * @param { String } str + * @return { String } id + */ +export const firstToUpperCase = (str = '') => { + return str.toLowerCase().replace(/( |^)[a-z]/g, ($1) => $1.toUpperCase()) +} diff --git a/admin/src/views/article/lists/index.vue b/admin/src/views/article/lists/index.vue index ba32e793..5670f274 100644 --- a/admin/src/views/article/lists/index.vue +++ b/admin/src/views/article/lists/index.vue @@ -37,9 +37,9 @@
@@ -89,10 +89,10 @@