| | |
| | | import { |
| | | loginInfo |
| | | } from '../../../../assets/js/login'; |
| | | import moment from 'moment' |
| | | Page({ |
| | | |
| | | /** |
| | |
| | | buyIdList: [], |
| | | buyList: [], |
| | | learnClassData: null, |
| | | bookDetail: null |
| | | bookDetail: null, |
| | | learnStartTime: 0, |
| | | learnTimeList: [], |
| | | learnTimeData: 0 |
| | | }, |
| | | // 格式化笔记时间 |
| | | convertTimestamp(timestamp) { |
| | |
| | | } else { |
| | | this.resourceDetailsData() |
| | | } |
| | | if (options.formPath == 'jsek_cloudLearning') this.getBookInfo(options.bookId) |
| | | if (options.formPath == 'jsek_cloudLearning') { |
| | | this.setData({ |
| | | learnStartTime: Date.now(), |
| | | }) |
| | | this.getLearnTime() |
| | | } |
| | | this.getBookInfo(options.bookId) |
| | | }, |
| | | |
| | | /** |
| | |
| | | this.count(duration) |
| | | } |
| | | this.setPlayerList() |
| | | if (this.data.fromPath == 'jsek_cloudLearning') { |
| | | let cloudDuration = this.data.pauseTime - this.data.learnStartTime |
| | | this.cloudCount(cloudDuration) |
| | | } |
| | | }, |
| | | getLearnTime() { |
| | | app.MG.identity |
| | | .getUserKey({ |
| | | domain: 'cloudLearningTime', |
| | | keys: [this.data.bookId] |
| | | }) |
| | | .then((res) => { |
| | | if (res.length > 0) { |
| | | if (JSON.parse(res[0].value) && JSON.parse(res[0].value).length > 0) { |
| | | this.setData({ |
| | | learnTimeList: JSON.parse(res[0].value), |
| | | learnTimeData: JSON.parse(res[0].value)[0].learnTime, |
| | | }) |
| | | } else { |
| | | this.setData({ |
| | | learnTimeList: [], |
| | | learnTimeData: 0 |
| | | }) |
| | | } |
| | | } |
| | | }) |
| | | }, |
| | | cloudCount(timeStr) { |
| | | let time = Number(this.data.learnTimeData) + Number(timeStr) |
| | | this.setData({ |
| | | learnTimeList: [{ |
| | | learnTime: time |
| | | }], |
| | | }) |
| | | app.MG.identity |
| | | .setUserKey({ |
| | | setKeyRequests: [{ |
| | | domain: 'cloudLearningTime', |
| | | key: this.data.bookId, |
| | | value: JSON.stringify(this.data.learnTimeList) |
| | | }] |
| | | }) |
| | | .then((res) => { |
| | | console.log(timeStr, '学习时长') |
| | | }) |
| | | }, |
| | | |
| | | |
| | | // 获取图书详情 |
| | | getBookInfo(id) { |
| | |
| | | res.datas.forEach((item) => { |
| | | // item.compliceHover = false |
| | | // item.deleteHover = false |
| | | item.createDate = this.convertTimestamp(item.createDate) |
| | | item.createDate = moment(item.createDate).format('YYYY-MM-DD HH:mm:ss') |
| | | }) |
| | | this.setData({ |
| | | "pageCount.total": res.totalSize, |