适配subDataEvents变动
This commit is contained in:
parent
3294b23930
commit
e68ed07c4c
|
|
@ -229,17 +229,20 @@ export default OakComponent({
|
|||
setDepPriceMp(price: number | null) { this.setDepPrice(price) },
|
||||
setDepositChannelMp(depositChannel: PayChannel | null) { this.setDepositChannel(depositChannel) },
|
||||
focus: false,
|
||||
unsub: undefined as undefined | (() => void),
|
||||
},
|
||||
lifetimes: {
|
||||
ready() {
|
||||
async ready() {
|
||||
const { oakId } = this.props;
|
||||
assert(typeof oakId === 'string');
|
||||
this.subDataEvents([`${DATA_SUBSCRIBER_KEYS.accountNumberChanged}-${oakId}`], 'opb-c-account-detail');
|
||||
const unsub = await this.subDataEvents([`${DATA_SUBSCRIBER_KEYS.accountNumberChanged}-${oakId}`]);
|
||||
this.setState({
|
||||
unsub,
|
||||
})
|
||||
},
|
||||
detached() {
|
||||
const { oakId } = this.props;
|
||||
assert(typeof oakId === 'string');
|
||||
this.unsubDataEvents([`${DATA_SUBSCRIBER_KEYS.accountNumberChanged}-${oakId}`], 'opb-c-account-detail');
|
||||
const { unsub } = this.state;
|
||||
unsub && unsub();
|
||||
}
|
||||
}
|
||||
})
|
||||
|
|
@ -31,11 +31,11 @@ const PayRoutineDict: Record<string, {
|
|||
if (prepayMeta) {
|
||||
try {
|
||||
const result = await wx.requestPayment(prepayMeta);
|
||||
process.env.NODE_ENV === 'development' && console.log(result);
|
||||
process.env.NODE_ENV === 'development' && console.log(result);
|
||||
}
|
||||
catch (err: any) {
|
||||
throw new StartPayFailure(
|
||||
err.errMsg.includes('cancel')
|
||||
err.errMsg.includes('cancel')
|
||||
? features.locales.t('startPayError.userCancel')
|
||||
: features.locales.t('startPayError.unknown')
|
||||
);
|
||||
|
|
@ -138,6 +138,7 @@ export default OakComponent({
|
|||
data: {
|
||||
showCloseConfirmMp: false,
|
||||
showChannelSelectMp: false,
|
||||
unsub: undefined as undefined | (() => void),
|
||||
},
|
||||
formData({ data }) {
|
||||
const application = this.features.application.getApplication();
|
||||
|
|
@ -260,7 +261,7 @@ export default OakComponent({
|
|||
},
|
||||
}
|
||||
]);
|
||||
onClose && onClose();
|
||||
onClose && onClose();
|
||||
}
|
||||
else {
|
||||
onPayFailure && onPayFailure();
|
||||
|
|
@ -320,16 +321,17 @@ export default OakComponent({
|
|||
}
|
||||
},
|
||||
lifetimes: {
|
||||
ready() {
|
||||
async ready() {
|
||||
const { oakId } = this.props;
|
||||
assert(typeof oakId === 'string');
|
||||
this.subDataEvents([`${DATA_SUBSCRIBER_KEYS.payStateChanged}-${oakId}`], 'opb-c-pay-detail');
|
||||
|
||||
const unsub = await this.subDataEvents([`${DATA_SUBSCRIBER_KEYS.payStateChanged}-${oakId}`]);
|
||||
this.setState({
|
||||
unsub,
|
||||
})
|
||||
},
|
||||
detached() {
|
||||
const { oakId } = this.props;
|
||||
assert(typeof oakId === 'string');
|
||||
this.unsubDataEvents([`${DATA_SUBSCRIBER_KEYS.payStateChanged}-${oakId}`], 'opb-c-pay-detail');
|
||||
const { unsub } = this.state;
|
||||
unsub && unsub();
|
||||
}
|
||||
},
|
||||
listeners: {
|
||||
|
|
|
|||
Loading…
Reference in New Issue