12345678910111213141516171819202122232425262728293031323334353637383940414243 |
- import Api from "../../model/api";
- import {formatTime, handleRichTextImgAuto} from "../../utils/utils";
- import {videoTypes} from "../../model/enum";
- Page({
- data: {
- item: {},
- url: ''
- },
- async onLoad(options) {
- wx.setNavigationBarTitle({title: options.title})
- if (options.type == videoTypes.SCORE) {
- const res = await Api.getScore(options.id, true);
- res.data.courseIntro = handleRichTextImgAuto(res.data.courseIntro);
- const arrys = JSON.parse(res.data.courseUrl);
- let url = "";
- if (arrys && arrys.length && arrys.length > 0) {
- url = arrys[0].url;
- }
- const time = res.data.updateTime || res.data.createTime || '';
- res.data.time = formatTime(time);
- this.setData({
- item: res.data,
- url
- })
- } else if (options.type == videoTypes.COMMON) {
- const res = await Api.getVideoDetail(options.id, true);
- res.data.videoContent = handleRichTextImgAuto(res.data.videoContent);
- const arrys = JSON.parse(res.data.videoPath);
- let url = "";
- if (arrys && arrys.length && arrys.length > 0) {
- url = arrys[0].url;
- }
- const time = res.data.updateTime || res.data.createTime || '';
- res.data.time = formatTime(time);
- this.setData({
- item: res.data,
- url
- })
- }
- }
- })
|