修正 进入修改密码页面报assert

This commit is contained in:
wkj 2024-02-03 17:52:59 +08:00
parent c86b55d952
commit 48a7758c2f
8 changed files with 142 additions and 76 deletions

View File

@ -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: {

View File

@ -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<EntityDict, 'message', false, {
user: EntityDict['user']['Schema'];
channels: string[];
oakId: string;
}, {
goToMobile: () => void;
}>): React.JSX.Element;
export default function Render(
props: WebComponentProps<
EntityDict,
'user',
false,
{
loading: boolean;
channels: string[];
oakId: string;
},
{
goToMobile: () => void;
}
>
): React.JSX.Element;

View File

@ -4,8 +4,13 @@ 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',

View File

@ -17,7 +17,7 @@ type ConfigOptions = {
jsApiList?: wx.jsApiList;
openTagList?: wx.openTagList;
};
type ParamOptions = wx.IcheckJsApi | wx.IaddCard | wx.IchooseCard | wx.IonMenuShareTimeline | wx.IonMenuShareAppMessage | wx.IonMenuShareQQ | wx.IonMenuShareWeibo | wx.IonMenuShareQZone | wx.IchooseImage | wx.IpreviewImage | wx.IuploadImage | wx.IdownloadImage | wx.IgetLocalImgData | wx.IplaypausestopVoice | wx.IupdownloadVoice | wx.IopenLocation | wx.IgetLocation | wx.IscanQRCode | wx.IopenProductSpecificView | wx.IchooseCard | wx.IopenCard | wx.IchooseWXPay;
type ParamOptions = wx.IcheckJsApi | wx.IaddCard | wx.IchooseCard | wx.IonMenuShareTimeline | wx.IonMenuShareAppMessage | wx.IonMenuShareQQ | wx.IonMenuShareWeibo | wx.IonMenuShareQZone | wx.IchooseImage | wx.IpreviewImage | wx.IgetLocalImgData | wx.IplaypausestopVoice | wx.IopenLocation | wx.IgetLocation | wx.IscanQRCode | wx.IopenProductSpecificView | wx.IchooseCard | wx.IopenCard | wx.IchooseWXPay;
export declare class WeiXinJsSdk<ED extends EntityDict, Cxt extends BackendRuntimeContext<ED>, FrontCxt extends FrontendRuntimeContext<ED, Cxt, AD>, AD extends AspectDict<ED, Cxt> & CommonAspectDict<ED, Cxt>> extends Feature {
private cache;
private storage;

View File

@ -17,7 +17,7 @@ type ConfigOptions = {
jsApiList?: wx.jsApiList;
openTagList?: wx.openTagList;
};
type ParamOptions = wx.IcheckJsApi | wx.IaddCard | wx.IchooseCard | wx.IonMenuShareTimeline | wx.IonMenuShareAppMessage | wx.IonMenuShareQQ | wx.IonMenuShareWeibo | wx.IonMenuShareQZone | wx.IchooseImage | wx.IpreviewImage | wx.IuploadImage | wx.IdownloadImage | wx.IgetLocalImgData | wx.IplaypausestopVoice | wx.IupdownloadVoice | wx.IopenLocation | wx.IgetLocation | wx.IscanQRCode | wx.IopenProductSpecificView | wx.IchooseCard | wx.IopenCard | wx.IchooseWXPay;
type ParamOptions = wx.IcheckJsApi | wx.IaddCard | wx.IchooseCard | wx.IonMenuShareTimeline | wx.IonMenuShareAppMessage | wx.IonMenuShareQQ | wx.IonMenuShareWeibo | wx.IonMenuShareQZone | wx.IchooseImage | wx.IpreviewImage | wx.IgetLocalImgData | wx.IplaypausestopVoice | wx.IopenLocation | wx.IgetLocation | wx.IscanQRCode | wx.IopenProductSpecificView | wx.IchooseCard | wx.IopenCard | wx.IchooseWXPay;
export declare class WeiXinJsSdk<ED extends EntityDict, Cxt extends BackendRuntimeContext<ED>, FrontCxt extends FrontendRuntimeContext<ED, Cxt, AD>, AD extends AspectDict<ED, Cxt> & CommonAspectDict<ED, Cxt>> extends Feature {
private cache;
private storage;

View File

@ -5,48 +5,64 @@ 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: [] as string[],
loading: false,
},
properties: {
oakId: '',
},
lifetimes: {
async attached() {
const userId = this.props.oakId as string;
const { result } = await this.features.cache.exec('getChangePasswordChannels', {
userId,
});
const userId = this.props.oakId;
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: {
goToMobile() {
this.navigateTo(
{
url: '/mobile/me',
}
)
this.navigateTo({
url: '/mobile/me',
});
},
},
});

View File

@ -9,12 +9,12 @@ import ByPassword from './byPassword';
export default function Render(
props: WebComponentProps<
EntityDict,
'message',
'user',
false,
{
user: EntityDict['user']['Schema'];
channels: string[];
oakId: string;
loading: boolean;
},
{
goToMobile: () => void;
@ -22,18 +22,36 @@ export default function Render(
>
) {
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: <ByPassword oakId={oakId} oakPath={oakFullpath} />,
children: (
<ByPassword
oakId={oakId}
oakPath={oakFullpath + '.user'}
oakAutoUnmount={true}
/>
),
},
{
key: 'mobile',
label: '手机号验证',
children: <ByMobile oakId={oakId} oakPath={oakFullpath} />,
children: (
<ByMobile
oakId={oakId}
oakPath={oakFullpath + '.user'}
oakAutoUnmount={true}
/>
),
},
];
if (channels.length === 0) {

View File

@ -40,11 +40,8 @@ type ParamOptions =
| wx.IonMenuShareQZone
| wx.IchooseImage
| wx.IpreviewImage
| wx.IuploadImage
| wx.IdownloadImage
| wx.IgetLocalImgData
| wx.IplaypausestopVoice
| wx.IupdownloadVoice
| wx.IopenLocation
| wx.IgetLocation
| wx.IscanQRCode
@ -112,12 +109,17 @@ export class WeiXinJsSdk<
async init(options?: {
jsApiList?: wx.jsApiList;
openTagList?: wx.openTagList;
debug?: boolean;
}) {
if (!isWeiXin) {
console.warn('只能在微信客户端初始化JSSDK');
return;
}
const { jsApiList, openTagList } = options || {};
const {
jsApiList,
openTagList,
debug = process.env.NODE_ENV === 'development',
} = options || {};
let url = window.location.href;
//在ios上 实际真正有效的的签名URL是【第一次进入应用时的URL】
@ -153,7 +155,7 @@ export class WeiXinJsSdk<
}
return this.getConfig({
debug: process.env.NODE_ENV === 'development',
debug: debug,
appId: result.appId,
timestamp: result.timestamp,
nonceStr: result.noncestr,