bookDetail.js 653 B

1234567891011121314151617181920212223242526272829
  1. import Api from "../../model/api";
  2. import {handleRichTextImgAuto} from "../../utils/utils";
  3. Page({
  4. data: {
  5. item: {},
  6. bookTag: '',
  7. bannerImgs: [],
  8. },
  9. async onLoad(options) {
  10. const {id, tag} = options;
  11. const res = await Api.getBookDetail(id, true);
  12. res.data.textbookIntro = handleRichTextImgAuto(res.data.textbookIntro);
  13. const bannerImgs = res.data.textbookPicturesList.map(item => {
  14. return {
  15. imgPath: item,
  16. }
  17. })
  18. this.setData({
  19. bookTag: tag,
  20. item: res.data,
  21. bannerImgs
  22. })
  23. },
  24. })