index.js 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. import { connect } from 'herculex';
  2. import { activeCert } from './../../services';
  3. const successIcon = 'https://gw.alipayobjects.com/mdn/rms_9641e0/afts/img/A*pK84SYdzj0QAAAAAAAAAAAAAARQnAQ';
  4. const failIcon = 'https://gw.alipayobjects.com/mdn/rms_9641e0/afts/img/A*hsLtSpixS84AAAAAAAAAAAAAARQnAQ';
  5. Component(connect({
  6. mapStateToProps: {}
  7. })({
  8. data: {
  9. result: {
  10. success: true,
  11. text: ''
  12. },
  13. loading: true,
  14. successIcon,
  15. failIcon
  16. },
  17. props: {
  18. componentData: {}
  19. },
  20. didMount() {
  21. this.fetchActiveCert();
  22. },
  23. methods: {
  24. async fetchActiveCert() {
  25. const {
  26. certType
  27. } = this.$page.options;
  28. const params = {
  29. certType,
  30. userCertifyResult: true
  31. };
  32. const [err, result] = await activeCert(params);
  33. if (err) return;
  34. const {
  35. grantOrg,
  36. activeDesc,
  37. activeResult
  38. } = result;
  39. const success = activeResult === 'suc';
  40. const text = success ? `由${grantOrg}颁发` : activeDesc;
  41. this.setData({
  42. result: {
  43. success,
  44. text
  45. },
  46. loading: false
  47. });
  48. },
  49. toHomeHandel() {
  50. my.navigateBack();
  51. }
  52. }
  53. }));