From ba0e9d5018f306d1d981a79ec8b93cd14772b2e6 Mon Sep 17 00:00:00 2001 From: Xc Date: Tue, 15 Aug 2023 12:53:01 +0800 Subject: [PATCH] =?UTF-8?q?=E5=8E=BB=E6=8E=89=E4=BA=86=E5=8E=9F=E6=9D=A5?= =?UTF-8?q?=E5=AF=B9i18next=E7=9A=84=E4=BE=9D=E8=B5=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/components/common/qrCode/index.js | 6 +++--- lib/hooks/useFeatures.d.ts | 3 ++- lib/locales/Common/zh_CN.json | 4 ---- lib/oak-app-domain/ActionAuth/Storage.js | 5 +---- src/components/common/qrCode/index.tsx | 6 +++--- src/hooks/useFeatures.ts | 3 ++- src/locales/Common/zh_CN.json | 4 ---- src/oak-app-domain/ActionAuth/Storage.ts | 5 +---- 8 files changed, 12 insertions(+), 24 deletions(-) diff --git a/lib/components/common/qrCode/index.js b/lib/components/common/qrCode/index.js index a2923db6d..749adb897 100644 --- a/lib/components/common/qrCode/index.js +++ b/lib/components/common/qrCode/index.js @@ -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, diff --git a/lib/hooks/useFeatures.d.ts b/lib/hooks/useFeatures.d.ts index 794dc8b53..f9427cca3 100644 --- a/lib/hooks/useFeatures.d.ts +++ b/lib/hooks/useFeatures.d.ts @@ -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; +export default function useFeatures(): GeneralFeatures & BasicFeatures; diff --git a/lib/locales/Common/zh_CN.json b/lib/locales/Common/zh_CN.json index 5cbbd3c49..a5183e22e 100644 --- a/lib/locales/Common/zh_CN.json +++ b/lib/locales/Common/zh_CN.json @@ -1,8 +1,4 @@ { - "ptrActivate": "松开刷新", - "ptrDeactivate": "下拉刷新", - "ptrRelease": "正在刷新...", - "ptrFinish": "刷新完成", "noData": "暂无数据", "areYouSure": "请确认", "action": { diff --git a/lib/oak-app-domain/ActionAuth/Storage.js b/lib/oak-app-domain/ActionAuth/Storage.js index e7779f3f4..a7373ccc4 100644 --- a/lib/oak-app-domain/ActionAuth/Storage.js +++ b/lib/oak-app-domain/ActionAuth/Storage.js @@ -36,10 +36,7 @@ exports.desc = { { name: "relationId" }, - ], - config: { - unique: true - } + ] } ] }; diff --git a/src/components/common/qrCode/index.tsx b/src/components/common/qrCode/index.tsx index 0ebc5babf..945db9d9c 100644 --- a/src/components/common/qrCode/index.tsx +++ b/src/components/common/qrCode/index.tsx @@ -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) {
) diff --git a/src/hooks/useFeatures.ts b/src/hooks/useFeatures.ts index 7ea528b79..a7cd4002d 100644 --- a/src/hooks/useFeatures.ts +++ b/src/hooks/useFeatures.ts @@ -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 + GeneralFeatures & BasicFeatures >(); }; \ No newline at end of file diff --git a/src/locales/Common/zh_CN.json b/src/locales/Common/zh_CN.json index e1a8b103e..dc1e24cac 100644 --- a/src/locales/Common/zh_CN.json +++ b/src/locales/Common/zh_CN.json @@ -1,8 +1,4 @@ { - "ptrActivate": "松开刷新", - "ptrDeactivate": "下拉刷新", - "ptrRelease": "正在刷新...", - "ptrFinish": "刷新完成", "noData": "暂无数据", "areYouSure": "请确认", "action": { diff --git a/src/oak-app-domain/ActionAuth/Storage.ts b/src/oak-app-domain/ActionAuth/Storage.ts index dd263c90e..7d6f95a98 100644 --- a/src/oak-app-domain/ActionAuth/Storage.ts +++ b/src/oak-app-domain/ActionAuth/Storage.ts @@ -35,10 +35,7 @@ export const desc: StorageDesc = { { name: "relationId" }, - ], - config: { - unique: true - } + ] } ] }; \ No newline at end of file