diff --git a/es/aspects/token.js b/es/aspects/token.js index 5441b1f01..936005d63 100644 --- a/es/aspects/token.js +++ b/es/aspects/token.js @@ -531,6 +531,7 @@ export async function loginByMobile(params, context) { } async function setUserInfoFromWechat(user, userInfo, context) { const application = context.getApplication(); + const applicationId = context.getApplicationId(); const config = application?.system?.config || application?.system?.platform?.config; const { nickname, gender, avatar } = userInfo; const { nickname: originalNickname, gender: originalGender, extraFile$entity, } = user; @@ -564,6 +565,7 @@ async function setUserInfoFromWechat(user, userInfo, context) { type: 'image', filename: '', bucket: '', + applicationId: applicationId, }), }, ]; @@ -1328,7 +1330,6 @@ function checkTokenEnvConsistency(env1, env2) { return false; } } - return true; } export async function refreshToken(params, context) { const { env, tokenValue } = params; diff --git a/es/components/changePassword/index.js b/es/components/changePassword/index.js index 761825727..7bf11aefe 100644 --- a/es/components/changePassword/index.js +++ b/es/components/changePassword/index.js @@ -2,39 +2,56 @@ const SEND_KEY = 'captcha:sendAt'; const SEND_CAPTCHA_LATENCY = process.env.NODE_ENV === 'development' ? 10 : 60; export default OakComponent({ isList: false, - entity: 'user', - projection: { - id: 1, - name: 1, - nickname: 1, - mobile$user: { - $entity: 'mobile', - data: { - id: 1, - mobile: 1, - }, - filter: { - ableState: 'enabled' - } - } - }, - formData: function ({ data: user, features, props }) { - return { - user, - }; - }, + // entity: 'user', + // projection: { + // id: 1, + // name: 1, + // nickname: 1, + // mobile$user: { + // $entity: 'mobile', + // data: { + // id: 1, + // mobile: 1, + // }, + // filter: { + // ableState: 'enabled' + // } + // } + // }, + // formData: function ({ data: user, features, props }) { + // return { + // user, + // }; + // }, data: { channels: [], }, + properties: { + oakId: '', + }, lifetimes: { async attached() { const userId = this.props.oakId; - const { result } = await this.features.cache.exec('getChangePasswordChannels', { - userId, - }); this.setState({ - channels: result + loading: true, }); + try { + const { result } = await this.features.cache.exec( + 'getChangePasswordChannels', + { + userId: userId, + } + ); + this.setState({ + channels: result, + loading: false, + }); + } catch { + this.setState({ + loading: false, + channels: [], + }); + } }, }, methods: { diff --git a/es/components/changePassword/web.d.ts b/es/components/changePassword/web.d.ts index c17eb3860..1a9cd689b 100644 --- a/es/components/changePassword/web.d.ts +++ b/es/components/changePassword/web.d.ts @@ -1,10 +1,18 @@ import React from 'react'; import { WebComponentProps } from 'oak-frontend-base'; import { EntityDict } from '../../oak-app-domain'; -export default function Render(props: WebComponentProps void; -}>): React.JSX.Element; +export default function Render( + props: WebComponentProps< + EntityDict, + 'user', + false, + { + loading: boolean; + channels: string[]; + oakId: string; + }, + { + goToMobile: () => void; + } + > +): React.JSX.Element; diff --git a/es/components/changePassword/web.js b/es/components/changePassword/web.js index 64e4313ab..e1ee3a5ea 100644 --- a/es/components/changePassword/web.js +++ b/es/components/changePassword/web.js @@ -4,18 +4,35 @@ import ByMobile from './byMobile'; import ByPassword from './byPassword'; export default function Render(props) { const { data, methods } = props; - const { channels, user, oakFullpath, oakId } = data; + const { channels, oakFullpath, oakId, loading } = data; const { goToMobile } = methods; + + if (loading) { + return null; + } + const items = [ { key: 'password', label: '原密码验证', - children: , + children: ( + + ), }, { key: 'mobile', label: '手机号验证', - children: , + children: ( + + ), }, ]; if (channels.length === 0) { diff --git a/es/components/token/me/index.js b/es/components/token/me/index.js index 294cbbb07..3e5a3090e 100644 --- a/es/components/token/me/index.js +++ b/es/components/token/me/index.js @@ -5,6 +5,7 @@ export default OakComponent({ id: 1, userId: 1, playerId: 1, + value: 1, user: { id: 1, nickname: 1, @@ -64,14 +65,9 @@ export default OakComponent({ filters: [ { filter() { - const tokenId = this.features.token.getTokenValue(); - if (tokenId) { - return { - id: tokenId, - }; - } + const value = this.features.token.getTokenValue(); return { - id: 'none', + value, }; }, }, diff --git a/es/components/userRelation/upsert/byMobile/web.d.ts b/es/components/userRelation/upsert/byMobile/web.d.ts index abd5a7d44..144b1ca8b 100644 --- a/es/components/userRelation/upsert/byMobile/web.d.ts +++ b/es/components/userRelation/upsert/byMobile/web.d.ts @@ -11,6 +11,7 @@ export default function Render(props: WebComponentProps Promise; onConfirm: () => Promise; diff --git a/es/components/userRelation/upsert/byMobile/web.js b/es/components/userRelation/upsert/byMobile/web.js index 7cdee2022..5b05d0342 100644 --- a/es/components/userRelation/upsert/byMobile/web.js +++ b/es/components/userRelation/upsert/byMobile/web.js @@ -3,7 +3,7 @@ import { Form, Input, Button } from 'antd-mobile'; import Style from './web.module.less'; import OnUser from '../onUser/index'; export default function Render(props) { - const { mobileValue, mobileValueReady, relations, entity, entityId, userId, oakFullpath, oakExecutable, oakDirty, passwordRequire, allowUpdateName, allowUpdateNickname, } = props.data; + const { mobileValue, mobileValueReady, relations, entity, entityId, userId, oakFullpath, oakExecutable, oakDirty, passwordRequire, allowUpdateName, allowUpdateNickname,isNew } = props.data; const { onConfirm, onMobileChange, onReset, t } = props.methods; return (