去掉了原来对i18next的依赖

This commit is contained in:
Xu Chang 2023-08-15 12:53:01 +08:00
parent 6d6e850da4
commit ba0e9d5018
8 changed files with 12 additions and 24 deletions

View File

@ -7,14 +7,14 @@ var icons_1 = require("@ant-design/icons");
var dayjs_1 = tslib_1.__importDefault(require("dayjs"));
var qrcode_react_1 = require("qrcode.react");
require("./index.less");
var react_i18next_1 = require("react-i18next");
var useFeatures_1 = tslib_1.__importDefault(require("../../../hooks/useFeatures"));
function isBase64(url) {
return /data:image\/[\w|\W]+(;base64,)[\w|\W]*/.test(url);
}
function QrCode(props) {
var _a = props.filename, filename = _a === void 0 ? 'qrCode.png' : _a, expiresAt = props.expiresAt, tips = props.tips, onDownload = props.onDownload, onRefresh = props.onRefresh, _b = props.size, size = _b === void 0 ? 280 : _b, url = props.url, _c = props.loading, loading = _c === void 0 ? false : _c, _d = props.disableDownload, disableDownload = _d === void 0 ? false : _d, successed = props.successed, type = props.type;
var prefixCls = 'oak';
var t = (0, react_i18next_1.useTranslation)().t;
var features = (0, useFeatures_1.default)();
var V;
if (expiresAt) {
var diff = (0, dayjs_1.default)(expiresAt).diff((0, dayjs_1.default)(), 'days');
@ -34,7 +34,7 @@ function QrCode(props) {
}
}
if (successed) {
return ((0, jsx_runtime_1.jsx)("div", tslib_1.__assign({ className: "".concat(prefixCls, "-qrCodeBox") }, { children: (0, jsx_runtime_1.jsx)(antd_1.Result, { status: "success", title: type === 'bind' ? t('weChat-account-successfully-bound') : t('weChat-authorization-login-successful') }) })));
return ((0, jsx_runtime_1.jsx)("div", tslib_1.__assign({ className: "".concat(prefixCls, "-qrCodeBox") }, { children: (0, jsx_runtime_1.jsx)(antd_1.Result, { status: "success", title: type === 'bind' ? features.locales.t('weChat-account-successfully-bound') : features.locales.t('weChat-authorization-login-successful') }) })));
}
return ((0, jsx_runtime_1.jsxs)("div", tslib_1.__assign({ id: "oakQrCode", className: "".concat(prefixCls, "-qrCodeBox") }, { children: [(0, jsx_runtime_1.jsx)("div", tslib_1.__assign({ className: "".concat(prefixCls, "-qrCodeBox_imgBox"), style: {
width: size,

View File

@ -1,4 +1,5 @@
import { BasicFeatures } from 'oak-frontend-base/lib/features/index';
import { GeneralFeatures } from '../features';
import { EntityDict } from '../oak-app-domain';
import { BRC, FrcAspectDict, FRC } from '../types/RuntimeCxt';
export default function useFeatures(): GeneralFeatures<EntityDict, BRC, FRC, FrcAspectDict>;
export default function useFeatures(): GeneralFeatures<EntityDict, BRC, FRC, FrcAspectDict> & BasicFeatures<EntityDict, BRC, FRC, FrcAspectDict>;

View File

@ -1,8 +1,4 @@
{
"ptrActivate": "松开刷新",
"ptrDeactivate": "下拉刷新",
"ptrRelease": "正在刷新...",
"ptrFinish": "刷新完成",
"noData": "暂无数据",
"areYouSure": "请确认",
"action": {

View File

@ -36,10 +36,7 @@ exports.desc = {
{
name: "relationId"
},
],
config: {
unique: true
}
]
}
]
};

View File

@ -6,7 +6,7 @@ import { QRCodeCanvas } from 'qrcode.react';
import './index.less';
import { EntityDict } from '../../../oak-app-domain';
import { useTranslation } from 'react-i18next';
import useFeatures from '../../../hooks/useFeatures';
type IQrCodeProps = {
filename?: string;
@ -42,7 +42,7 @@ function QrCode(props: IQrCodeProps) {
type,
} = props;
const prefixCls = 'oak';
const { t } = useTranslation();
const features = useFeatures();
let V;
if (expiresAt) {
const diff = dayjs(expiresAt).diff(dayjs(), 'days');
@ -86,7 +86,7 @@ function QrCode(props: IQrCodeProps) {
<div className={`${prefixCls}-qrCodeBox`}>
<Result
status="success"
title={type === 'bind' ? t('weChat-account-successfully-bound') : t('weChat-authorization-login-successful')}
title={type === 'bind' ? features.locales.t('weChat-account-successfully-bound') : features.locales.t('weChat-authorization-login-successful')}
/>
</div>
)

View File

@ -1,6 +1,7 @@
import { useFeatures as useCommonFeatures } from 'oak-frontend-base/lib/platforms/web/features';
import { BasicFeatures } from 'oak-frontend-base/lib/features/index';
import { GeneralFeatures } from '../features';
import { EntityDict } from '../oak-app-domain';
import { BRC, FrcAspectDict, FRC } from '../types/RuntimeCxt';
@ -8,6 +9,6 @@ import { BRC, FrcAspectDict, FRC } from '../types/RuntimeCxt';
// react 独有
export default function useFeatures() {
return useCommonFeatures<
GeneralFeatures<EntityDict, BRC, FRC, FrcAspectDict>
GeneralFeatures<EntityDict, BRC, FRC, FrcAspectDict> & BasicFeatures<EntityDict, BRC, FRC, FrcAspectDict>
>();
};

View File

@ -1,8 +1,4 @@
{
"ptrActivate": "松开刷新",
"ptrDeactivate": "下拉刷新",
"ptrRelease": "正在刷新...",
"ptrFinish": "刷新完成",
"noData": "暂无数据",
"areYouSure": "请确认",
"action": {

View File

@ -35,10 +35,7 @@ export const desc: StorageDesc<OpSchema> = {
{
name: "relationId"
},
],
config: {
unique: true
}
]
}
]
};