init-behavior.js 769 B

12345678910111213141516171819202122232425262728293031
  1. import { themeToRGB, themeToSeal } from '../../constant/theme';
  2. import TITLE_ENUM from '../../constant/title';
  3. import CATEGORY_ENUM from '../../constant/category';
  4. module.exports = Behavior({
  5. data: {
  6. theme: null,
  7. themeColor: null,
  8. sealTheme: null,
  9. resultPage: false,
  10. },
  11. attached() {
  12. const { theme, resultPage, ocrType } = wx.clientInfo;
  13. wx.setNavigationBarTitle({
  14. title: TITLE_ENUM[ocrType],
  15. });
  16. this.setData({
  17. theme,
  18. themeColor: themeToRGB(theme),
  19. sealTheme: themeToSeal(theme),
  20. resultPage,
  21. });
  22. if (ocrType === CATEGORY_ENUM.ID_CARD_FRONT) {
  23. this.setData({ side: 'FRONT' });
  24. }
  25. if (ocrType === CATEGORY_ENUM.ID_CARD_BACK) {
  26. this.setData({ side: 'BACK' });
  27. }
  28. },
  29. });