import { connect } from 'herculex'; import { activeCert } from './../../services'; const successIcon = 'https://gw.alipayobjects.com/mdn/rms_9641e0/afts/img/A*pK84SYdzj0QAAAAAAAAAAAAAARQnAQ'; const failIcon = 'https://gw.alipayobjects.com/mdn/rms_9641e0/afts/img/A*hsLtSpixS84AAAAAAAAAAAAAARQnAQ'; Component(connect({ mapStateToProps: {} })({ data: { result: { success: true, text: '' }, loading: true, successIcon, failIcon }, props: { componentData: {} }, didMount() { this.fetchActiveCert(); }, methods: { async fetchActiveCert() { const { certType } = this.$page.options; const params = { certType, userCertifyResult: true }; const [err, result] = await activeCert(params); if (err) return; const { grantOrg, activeDesc, activeResult } = result; const success = activeResult === 'suc'; const text = success ? `由${grantOrg}颁发` : activeDesc; this.setData({ result: { success, text }, loading: false }); }, toHomeHandel() { my.navigateBack(); } } }));