diff --git a/src/components/r-form/index.tsx b/src/components/r-form/index.tsx index 4c9a3cf..41dcc30 100644 --- a/src/components/r-form/index.tsx +++ b/src/components/r-form/index.tsx @@ -14,6 +14,7 @@ import { useApiContext } from '@/context.ts' import { useDeepCompareEffect } from 'react-use' import { RFormTypes } from '@/types/r-form/model' import { ProCoreActionType } from '@ant-design/pro-utils/es/typing' +import { getI18nTitle } from '@/i18n.ts' export interface RFormProps { @@ -66,7 +67,7 @@ const RForm = ( useDeepCompareEffect(() => { - let res = transformAntdTableProColumns(curdModal?.columns || [], propColumns) + let res = transformAntdTableProColumns(curdModal?.columns || [], propColumns, curdModal?.config?.i18n) if (resolveColumns) { res = resolveColumns(res) } @@ -101,7 +102,7 @@ const RForm = ( formItemProps: { hidden: true } } ].concat(res as any).concat([ { - title: '操作', + title: getI18nTitle(curdModal?.config?.i18n, { dataIndex: 'option', title: '操作' },), dataIndex: 'option', valueType: 'option', fixed: 'right', @@ -114,7 +115,7 @@ const RForm = ( } as any ]) setColumns(_columns) - }, [ curdModal?.columns, propColumns, renderColumnOptions, resolveColumns, deleteModel, form, isDeleting, setOpen, ]) + }, [ curdModal?.columns, curdModal?.config?.i18n, propColumns, renderColumnOptions, resolveColumns, deleteModel, form, isDeleting, setOpen, ]) useEffect(() => { if (apiCtx.isApi && apiCtx.api) { @@ -170,7 +171,7 @@ const RForm = ( }) setOpen(true) }} - type={'primary'}>{'添加'} + type={'primary'}>{getI18nTitle('actions.add','添加')} const _renderActions = () => { @@ -209,7 +210,7 @@ const RForm = ( placeholder: '输入关键字搜索', },*/ actions: [ - + , + ]} + > +

{item.description}

+ + + )} + /> + + ) +} + +export default AppPackage \ No newline at end of file diff --git a/src/pages/app/plugin/style.ts b/src/pages/app/plugin/style.ts new file mode 100644 index 0000000..6255d3b --- /dev/null +++ b/src/pages/app/plugin/style.ts @@ -0,0 +1,15 @@ +import { createStyles } from '@/theme' + +export const useStyle = createStyles(({ token, css, cx, prefixCls }, props: any) => { + const prefix = `${prefixCls}-${token?.proPrefix}-appPackage-plugin-page` + + const container = css` + .zcss-kfly0u{ + background: transparent; + } + ` + + return { + container: cx(prefix, props?.className, container), + } +}) \ No newline at end of file diff --git a/src/service/app/package.ts b/src/service/app/package.ts index 602bf19..844039f 100644 --- a/src/service/app/package.ts +++ b/src/service/app/package.ts @@ -28,6 +28,18 @@ const appPackage = { getPkgStatus: async (params: any) => { return await request.get(`/package/status`, { ...params }) }, + + getPluginList: async () => { + return await request.get>(`/package/plugin/list`) + }, + + getAppAllList: async () => { + return await request.get>(`/package/allList`) + }, + + buyPlugin: async (params: any) => { + return await request.post(`/package/plugin/buy`, { ...params }) + }, } export default appPackage \ No newline at end of file diff --git a/src/store/app/package.ts b/src/store/app/package.ts index 8ae35b4..9627e00 100644 --- a/src/store/app/package.ts +++ b/src/store/app/package.ts @@ -114,3 +114,45 @@ export const packageAppAtom = atomWithMutation((get) => { } } }) + +/** + * 插件列表 + */ +export const appPluginListAtom = atomWithQuery(() => { + return { + queryKey: [ 'appPlugin' ], + queryFn: async ({ queryKey: [ , ] }) => { + const list = await aPPServ.getPluginList() + return list.data + } + } +}) + +/** + * 插件购买 + */ +export const appPluginBuyAtom = atomWithMutation(() => { + return { + mutationKey: [ 'appPlugin' ], + mutationFn: async (param: any) => { + const list = await aPPServ.buyPlugin(param) + return list.data + }, + onSuccess: () => { + message.success('购买成功') + } + } +}) + +/** + * 获取所有应用 + */ +export const appAllListAtom = atomWithQuery(() => { + return { + queryKey: [ 'appAllList' ], + queryFn: async ({ queryKey: [ , ] }) => { + const list = await aPPServ.getAppAllList() + return list.data.list + } + } +}) diff --git a/src/types/app/package.d.ts b/src/types/app/package.d.ts index 6def281..c1002a4 100644 --- a/src/types/app/package.d.ts +++ b/src/types/app/package.d.ts @@ -32,6 +32,13 @@ export namespace APP { } /** + * Bool类型返回结果 + */ + export interface IBaseArrRes { + list: T[]; + } + + /** * 打包状态 */ export interface IAppPkgStatus { @@ -44,4 +51,24 @@ export namespace APP { position: number; total: number; } + + /** + * 打包状态 + */ + export interface IAppPlugin { + id: number; + name: string; + description: string; + status: number; + month_price: number; + quarter_price: number; + half_year_price: number; + year_price: number; + two_year_price: number; + three_year_price: number; + onetime_price: number; + reset_price: number; + extra: number; //备用字段,如果是流量套餐则是流量额度 + code: string; + } } \ No newline at end of file diff --git a/src/types/r-form/model.d.ts b/src/types/r-form/model.d.ts index b5c1cc3..10a635c 100644 --- a/src/types/r-form/model.d.ts +++ b/src/types/r-form/model.d.ts @@ -27,6 +27,9 @@ export namespace RFormTypes { params?: any; resultPath?: string; + //是否需要转换成下拉框的数据或者树形数据格式, 默认为true + transform: boolean; + fieldNames?: { label: string; value: string; diff --git a/src/utils/index.ts b/src/utils/index.ts index 3abb93f..d75d7c4 100644 --- a/src/utils/index.ts +++ b/src/utils/index.ts @@ -216,3 +216,5 @@ export const genProTableColumnWidthProps = (width: string | number) => { } } + +