| | |
| | | name: '', |
| | | school: '', |
| | | class: '', |
| | | learnTime: '2', |
| | | learnTime: '0小时', |
| | | taskShow: false, |
| | | dataList: [], //任务单 |
| | | tasksListData: [], //已填写任务单messsge |
| | |
| | | userId: 0, |
| | | userName: '', |
| | | isUpdate: false, |
| | | taskId: 0, //默认选中目录id |
| | | taskId: '', //默认选中目录id |
| | | autosize: { |
| | | maxHeight: 120, |
| | | minHeight: 80, |
| | |
| | | disabled: false, |
| | | dialogVisible: false, |
| | | invitee: "", |
| | | teacherEvaluated: false, |
| | | evaluated: false |
| | | }, |
| | | onShow() { |
| | | var that = this; |
| | |
| | | taskId: options.bookId, |
| | | consumer: options.consumer, |
| | | userId: options.userId, |
| | | userName: JSON.parse(wx.getStorageSync(app.config.userInfoKey)).name |
| | | userName: JSON.parse(wx.getStorageSync(app.config.userInfoKey)).nickName |
| | | }); |
| | | if (options.consumer) { |
| | | this.setData({ |
| | |
| | | disabled: false |
| | | }); |
| | | } |
| | | console.log(options.consumer, 77) |
| | | this.getResourceData() |
| | | this.getLearnTime() |
| | | } |
| | | |
| | | }, |
| | | |
| | | getLearnTime() { |
| | | app.MG.identity |
| | | .getUserKey({ |
| | | domain: 'cloudLearningTime', |
| | | keys: [this.data.bookId + ''] |
| | | }) |
| | | .then((res) => { |
| | | if (res.length > 0 && JSON.parse(res[0].value) && JSON.parse(res[0].value).length > 0) { |
| | | let time = JSON.parse(res[0].value)[0].learnTime |
| | | let minutes = Number(time) / (1000 * 60) |
| | | let hours = Number(time) / (1000 * 60 * 60) |
| | | if (minutes > 0 && minutes < 60) { |
| | | this.setData({ |
| | | learnTime: Math.round(minutes) + '分钟', |
| | | }); |
| | | } else if (minutes > 60) { |
| | | this.setData({ |
| | | learnTime: Math.round(hours) + '小时', |
| | | }); |
| | | } else { |
| | | this.setData({ |
| | | learnTime: '0小时', |
| | | }); |
| | | } |
| | | } |
| | | }) |
| | | }, |
| | | |
| | | getResourceData() { |
| | | this.setData({ |
| | | menuList: [], |
| | | loading: true, |
| | | }); |
| | | let query = { |
| | |
| | | } |
| | | dataList.push(item) |
| | | }) |
| | | this.setData({ |
| | | menuList: dataList, |
| | | loading: false, |
| | | }); |
| | | setTimeout(() => { |
| | | this.setData({ |
| | | menuList: dataList, |
| | | loading: false, |
| | | }); |
| | | }, 500) |
| | | if (this.data.taskId) { |
| | | setTimeout(() => { |
| | | this.data.menuList.forEach((item) => { |
| | |
| | | this.getTasksList() |
| | | }) |
| | | }, |
| | | getTask(e) { |
| | | console.log(e) |
| | | let item = e.currentTarget.dataset.item |
| | | this.taskSelect(item) |
| | | }, |
| | | |
| | | onVisibleChange(e) { |
| | | this.setData({ |
| | |
| | | this.setData({ |
| | | tasksListData: res.datas, |
| | | }); |
| | | if (this.data.taskInfo) { |
| | | if (this.data.taskInfo.name) { |
| | | this.taskSelect(this.data.taskInfo) |
| | | } |
| | | }) |
| | |
| | | }); |
| | | this.getChildTasksList() |
| | | if (content.evaluate.length > 0) { |
| | | content.evaluate.forEach((element) => { |
| | | if (this.data.consumer == 'classmate') { |
| | | element.mateEvaluation = '' |
| | | } |
| | | if (this.data.consumer == 'teacher') { |
| | | element.teacherEvaluation = '' |
| | | } |
| | | }) |
| | | // content.evaluate.forEach((element) => { |
| | | // if (this.data.consumer == 'classmate') { |
| | | // element.mateEvaluation = '' |
| | | // } |
| | | // if (this.data.consumer == 'teacher') { |
| | | // element.teacherEvaluation = '' |
| | | // } |
| | | // }) |
| | | this.setData({ |
| | | dataList: content.evaluate, |
| | | }); |
| | | |
| | | } |
| | | } |
| | | } else { |
| | | this.goDetail(item) |
| | | return false |
| | | } |
| | | }) |
| | | |
| | | } else { |
| | | this.goDetail(item) |
| | | } |
| | | } |
| | | if (this.data.dataList.length == 0) { |
| | | this.goDetail(item) |
| | | } |
| | | }, |
| | | goDetail(item) { |
| | |
| | | } |
| | | this.setData({ |
| | | dataList: res.datas.cmsDatas[0].datas, |
| | | taskShow: true, |
| | | }); |
| | | }) |
| | | }, |
| | |
| | | if (res.datas.length > 0) { |
| | | let list = [] |
| | | this.data.dataList.forEach((item) => { |
| | | item.teacherEvaluation = [] |
| | | item.mateEvaluation = [] |
| | | res.datas.forEach((item1) => { |
| | | let content = JSON.parse(item1.content) |
| | | if (content.teacherComment) { |
| | | if (content.teacherComment.length > 0) { |
| | | content.teacherComment.forEach((item2) => { |
| | | if (item.id == item2.childTaskId) { |
| | | item.teacherEvaluation.push(item2) |
| | | item.mateEvaluation = [item2] |
| | | if (this.data.consumer == 'teacher') { |
| | | this.setData({ |
| | | evaluated: true |
| | | }); |
| | | } |
| | | } |
| | | }) |
| | | } |
| | | if (content.mateComment) { |
| | | if (item.teacherEvaluation && item.teacherEvaluation.length > 0) { |
| | | this.setData({ |
| | | teacherEvaluated: true |
| | | }); |
| | | } |
| | | if (content.mateComment.length > 0) { |
| | | content.mateComment.forEach((item3) => { |
| | | if (item.id == item3.childTaskId) { |
| | | item.mateEvaluation.push(item3) |
| | | item.mateEvaluation = [...item.mateEvaluation, item3] |
| | | console.log(item.mateEvaluation, 123) |
| | | if (this.data.consumer == 'classmate') { |
| | | if (item.mateEvaluation && item.mateEvaluation.length > 0) { |
| | | let data = item.mateEvaluation.find( |
| | | (item) => item.userId == this.data.userId |
| | | ) |
| | | if (data) { |
| | | this.setData({ |
| | | evaluated: true |
| | | }); |
| | | item.mateEvaluation = [data] |
| | | } else { |
| | | this.setData({ |
| | | evaluated: false |
| | | }); |
| | | item.mateEvaluation = '' |
| | | } |
| | | } |
| | | } |
| | | } |
| | | }) |
| | | } |
| | |
| | | //提交自己填写 |
| | | inviteBtn() { |
| | | let empty = false |
| | | console.log(this.data.dataList, 123) |
| | | this.data.dataList.forEach((item) => { |
| | | if (item.introspection == '' || item.completion == '' || item.selfEvaluation == '') { |
| | | empty = true |
| | |
| | | }, |
| | | updateSubmit() { |
| | | let evaluate = [] |
| | | console.log(this.data.dataList, 211) |
| | | this.data.dataList.forEach((item) => { |
| | | evaluate.push({ |
| | | id: item.id, |
| | |
| | | }, |
| | | |
| | | confirmBtn() { |
| | | if (this.data.invitee == 'teacher' && this.data.teacherEvaluated) { |
| | | wx.showToast({ |
| | | title: "教师已经评价,不能再邀请教师评价!", |
| | | icon: 'none', |
| | | duration: 1000 |
| | | }) |
| | | return false |
| | | } |
| | | wx.showShareMenu({ |
| | | withShareTicket: true |
| | | }); |
| | |
| | | let teacherEvaluationList = [] |
| | | this.data.dataList.forEach((item) => { |
| | | if (this.data.consumer == 'classmate') { |
| | | if (item.mateEvaluation == '') { |
| | | wx.showToast({ |
| | | title: "请先填评价", |
| | | icon: 'none', |
| | | duration: 1000 |
| | | }) |
| | | } else { |
| | | if (item.mateEvaluation && item.mateEvaluation != '') { |
| | | mateEvaluationList.push({ |
| | | childTaskId: item.id, |
| | | userId: this.data.userId, |
| | | userName: this.data.userName, |
| | | evaluation: item.mateEvaluation |
| | | }) |
| | | } |
| | | } |
| | | |
| | | if (this.data.consumer == 'teacher') { |
| | | if (item.teacherEvaluation == '') { |
| | | wx.showToast({ |
| | | title: "请先填评价", |
| | | icon: 'none', |
| | | duration: 1000 |
| | | }) |
| | | } else { |
| | | if (item.teacherEvaluation && item.teacherEvaluation != '') { |
| | | teacherEvaluationList.push({ |
| | | childTaskId: item.id, |
| | | userId: this.data.userId, |
| | | userName: this.data.userName, |
| | | evaluation: item.teacherEvaluation |
| | | }) |
| | | } |
| | | } |
| | | }) |
| | | if (this.data.consumer == 'classmate') { |
| | | if (mateEvaluationList.length < this.data.dataList.length) { |
| | | wx.showToast({ |
| | | title: "请先填写评价", |
| | | icon: 'none', |
| | | duration: 1000 |
| | | }) |
| | | } |
| | | } |
| | | if (this.data.consumer == 'teacher') { |
| | | if (teacherEvaluationList.length < this.data.dataList.length) { |
| | | wx.showToast({ |
| | | title: "请先填写评价", |
| | | icon: 'none', |
| | | duration: 1000 |
| | | }) |
| | | } |
| | | } |
| | | let content = { |
| | | id: this.data.taskInfo.id, |
| | | taskName: this.data.taskInfo.name, |
| | |
| | | onShareAppMessage() { |
| | | return { |
| | | title: '评价学习任务单', |
| | | path: `packageBookService/pages/bookServices/detail/components/learnTask/index?bookId=${this.data.bookId}&consumer=${this.data.invitee}&taskId=${this.data.taskInfo.id}&userId=${this.data.userId}`, |
| | | path: `packageBookService/pages/bookServices/detail/components/learnTask/index?bookId=${this.data.bookId}&consumer=${this.data.invitee}&taskId=${this.data.taskInfo.id}&userId=${this.data.userId}&cmsPath=${this.data.cmsPath}`, |
| | | imgUrl: 'https://jsek.bnuic.com/home/image/click-icon.png', |
| | | } |
| | | } |
| | |
| | | <view class="item-box" wx:if="{{menuList.length > 0 && !loading}}"> |
| | | <view wx:for="{{menuList}}" wx:for-item="item" wx:for-index="index" wx:key="id" class="item"> |
| | | <view class="itemCon"> |
| | | <view> |
| | | <div wx:if="{{!item.children}}" class="noChild"></div> |
| | | <view wx:if="{{item.children}}"> |
| | | <t-icon name="chevron-down" size="48rpx" data-name="chevron-down" /> |
| | | </view> |
| | | <view bind:tap="getTask" data-item="{{item}}">{{ item.name }}</view> |
| | | <view bind:tap="getTask" data-item="{{item}}" class="itemName">{{ item.name }}</view> |
| | | </view> |
| | | <view class="childBox" wx:if="{{item.children}}"> |
| | | <view wx:for="{{item.children}}" wx:for-item="item1" wx:for-index="index" wx:key="id" class="item"> |
| | | <view bind:tap="getTask" data-item="{{item}}">{{ item1.name }}</view> |
| | | <view bind:tap="getTask" data-item="{{item1}}" class="itemName">{{ item1.name }}</view> |
| | | </view> |
| | | </view> |
| | | </view> |
| | |
| | | <view class="box-list" wx:if="{{consumer == 'classmate' || !consumer}}"> |
| | | <view class="lable">同伴评:</view> |
| | | <view class="inputBox"> |
| | | <t-textarea placeholder="请输入评价" value="{{item.mateEvaluation}}" disableDefaultPadding="{{true}}" autosize="{{autosize}}" bindchange="onMateInput" data-index="{{index}}" wx:if="{{consumer == 'classmate'}}" /> |
| | | <t-textarea placeholder="请输入评价" value="{{item.mateEvaluation}}" disableDefaultPadding="{{true}}" autosize="{{autosize}}" bindchange="onMateInput" data-index="{{index}}" wx:if="{{consumer == 'classmate' && !evaluated}}" /> |
| | | <view wx:if="{{isUpdate && item.mateEvaluation.length > 0}}" class="rateList"> |
| | | <view wx:for="{{item.mateEvaluation}}" wx:for-item="mateItem" wx:key="index" class="li"> |
| | | <view class="userName">{{ mateItem.userName }}</view> |
| | |
| | | <view class="box-list" wx:if="{{consumer == 'teacher' || !consumer}}"> |
| | | <view class="lable">老师评:</view> |
| | | <view class="inputBox"> |
| | | <t-textarea placeholder="请输入评价" value="{{item.teacherEvaluation}}" disableDefaultPadding="{{true}}" autosize="{{autosize}}" bindchange="onTeacherInput" data-index="{{index}}" wx:if="{{consumer == 'teacher'}}" /> |
| | | <t-textarea placeholder="请输入评价" value="{{item.teacherEvaluation}}" disableDefaultPadding="{{true}}" autosize="{{autosize}}" bindchange="onTeacherInput" data-index="{{index}}" wx:if="{{consumer == 'teacher' && !evaluated}}" /> |
| | | <view wx:if="{{isUpdate && item.teacherEvaluation.length > 0}}" class="rateList"> |
| | | <view wx:for="{{item.teacherEvaluation}}" wx:for-item="mateItem" wx:key="index" class="li"> |
| | | <view class="userName"><text></text>{{ mateItem.userName }}</view> |
| | |
| | | <view wx:if="{{dataList.length == 0}}" class="empyt"> |
| | | <empty /> |
| | | </view> |
| | | <view class="buttonBox"> |
| | | <t-button class="btn" theme="primary" bind:tap="submitComment" wx:if="{{consumer}}"> |
| | | <view class="buttonBox" wx:if="{{dataList.length > 0}}"> |
| | | <t-button class="btn" theme="primary" bind:tap="submitComment" wx:if="{{consumer && !evaluated}}"> |
| | | <view slot="content" class="btn-content">提交</view> |
| | | </t-button> |
| | | <t-button class="btn" theme="primary" bind:tap="updateSubmit" wx:if="{{isUpdate && !consumer}}"> |
| | | <t-button class="btn" theme="primary" bind:tap="updateSubmit" wx:if="{{isUpdate && !consumer && dataList.length > 0}}"> |
| | | <view slot="content" class="btn-content">邀请评价</view> |
| | | </t-button> |
| | | <t-button class="btn" theme="primary" bind:tap="inviteBtn" wx:if="{{!isUpdate && !consumer}}"> |
| | | <t-button class="btn" theme="primary" bind:tap="inviteBtn" wx:if="{{!isUpdate && !consumer && dataList.length > 0}}"> |
| | | <view slot="content" class="btn-content">邀请评价</view> |
| | | </t-button> |
| | | </view> |
| | |
| | | <view class="info-center" style="top:{{height*0.3}}px;" wx:if="{{dialogVisible}}"> |
| | | <view class="block1"> |
| | | <t-radio-group value="{{invitee}}" borderless t-class="box" class="radioBox" bind:change="onInviteeChange"> |
| | | <t-radio block="{{false}}" label="同伴" value="mate" class="radio" /> |
| | | <t-radio block="{{false}}" label="同伴" value="classmate" class="radio" /> |
| | | <t-radio block="{{false}}" label="老师" value="teacher" class="radio" /> |
| | | </t-radio-group> |
| | | </view> |
| | |
| | | padding: 10rpx 0; |
| | | } |
| | | |
| | | .itemCon { |
| | | display: flex; |
| | | } |
| | | |
| | | .noChild { |
| | | width: 50rpx; |
| | | height: 40rpx; |
| | | } |
| | | |
| | | .itemName { |
| | | width: 100%; |
| | | background: #f1f1f1; |
| | | padding: 10rpx; |
| | | } |
| | | |
| | | .childBox { |
| | | margin-left: 80rpx; |
| | | margin-top: 10rpx; |
| | | overflow: hidden; |
| | | } |
| | | |
| | | .block { |
| | | position: relative; |
| | | width: 90vw; |
| | |
| | | buyIdList: [], |
| | | buyList: [], |
| | | learnClassData: null, |
| | | bookDetail: null |
| | | bookDetail: null, |
| | | learnStartTime: 0, |
| | | learnTimeList: [], |
| | | learnTimeData: 0 |
| | | }, |
| | | |
| | | format(time) { |
| | |
| | | this.resourceDetailsData() |
| | | this.getNoteList() |
| | | } |
| | | 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) |
| | | } |
| | | }, |
| | | count(timeStr) { |
| | | const data = { |
| | |
| | | console.log('统计', data) |
| | | app.MG.job.newJobWithApiNewEvent(data).then((res) => {}) |
| | | }, |
| | | |
| | | 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) { |
| | | const query = { |
| | |
| | | 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, |