bookDetail.js 682 B

123456789101112131415161718192021222324252627282930
  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 = options.id;
  11. const tag = options.tag;
  12. const res = await Api.getBookDetail(id, true);
  13. res.data.textbookIntro = handleRichTextImgAuto(res.data.textbookIntro);
  14. const bannerImgs = res.data.textbookPicturesList.map(item => {
  15. return {
  16. imgPath: item,
  17. }
  18. })
  19. this.setData({
  20. bookTag: tag,
  21. item: res.data,
  22. bannerImgs
  23. })
  24. },
  25. })