|
@@ -1,461 +1,528 @@
|
|
|
<template>
|
|
|
- <div class="record-container">
|
|
|
- <div class="exam-action-wrap">
|
|
|
- <Checkbox v-model="filterExpire" style="margin-right:35px;user-select:none" @on-change="handleFilterExpire">
|
|
|
- {{$t('cusMgt.filterExp')}}
|
|
|
- </Checkbox>
|
|
|
- <span>
|
|
|
- <Tooltip :max-width="180" :content="$t('cusMgt.autoShareTips')">
|
|
|
- <Icon type="ios-information-circle-outline" />
|
|
|
- </Tooltip>
|
|
|
- {{$t('cusMgt.autoShare')}}
|
|
|
+ <div class="record-container">
|
|
|
+ <div class="exam-action-wrap">
|
|
|
+ <Checkbox v-model="filterExpire" style="margin-right:35px;user-select:none" @on-change="handleFilterExpire">
|
|
|
+ {{$t('cusMgt.filterExp')}}
|
|
|
+ </Checkbox>
|
|
|
+ <span>
|
|
|
+ <Tooltip :max-width="180" :content="$t('cusMgt.autoShareTips')">
|
|
|
+ <Icon type="ios-information-circle-outline" />
|
|
|
+ </Tooltip>
|
|
|
+ {{$t('cusMgt.autoShare')}}
|
|
|
+ </span>
|
|
|
+ <i-switch :loading="sLoading" v-model="isAuto" size="small" @on-change="setAutoPublish" />
|
|
|
+ </div>
|
|
|
+ <vuescroll>
|
|
|
+ <Alert v-show="rcdParams.scope == 'private'" show-icon type="warning" closable>
|
|
|
+ {{$t('cusMgt.recordTips')}}
|
|
|
+ </Alert>
|
|
|
+ <div class="rcd-item" v-for="(item,index) in recordList" :key="index" @click="toClassRecoerd(index)">
|
|
|
+ <RcdPoster class="record-poster-wrap" :poster="item.poster"></RcdPoster>
|
|
|
+ <div style="flex:1">
|
|
|
+ <p class="record-name" style="padding-left:10px">
|
|
|
+ {{item.name}}
|
|
|
+ <span class="item-icon-wrap">
|
|
|
+ <Icon type="md-create" class="common-item-icon ed-name" @click.stop="editRecordName(index)" :title="$t('cusMgt.edRdName')" />
|
|
|
+ <Icon type="md-trash" class="common-item-icon delete-item" @click.stop="delRecord(item)" :title="$t('cusMgt.delRcd')" />
|
|
|
+ <Icon :type="item.isShare ? 'ios-share-alt':'ios-share-alt-outline'" :size="20" :class="['common-item-icon','share-student',item.isShare ? 'share-active':'']" @click.stop="toggleShare(item)" :title="item.isShare ? $t('cusMgt.unShare') : $t('cusMgt.shareToStu')" />
|
|
|
+ <Icon :type="isFavorite(item.id) ? 'md-heart':'md-heart-outline'" :class="['common-item-icon','heart-item',isFavorite(item.id) ? 'heart-active':'']" @click.stop="toggleFavorite(item)" :title="isFavorite(item.id) ? $t('cusMgt.unfvt') : $t('cusMgt.fvt')" />
|
|
|
</span>
|
|
|
- <i-switch :loading="sLoading" v-model="isAuto" size="small" @on-change="setAutoPublish" />
|
|
|
- </div>
|
|
|
- <vuescroll>
|
|
|
- <Alert v-show="rcdParams.scope == 'private'" show-icon type="warning" closable>
|
|
|
- {{$t('cusMgt.recordTips')}}
|
|
|
- </Alert>
|
|
|
- <div class="rcd-item" v-for="(item,index) in recordList" :key="index" @click="toClassRecoerd(index)">
|
|
|
- <RcdPoster class="record-poster-wrap" :poster="item.poster"></RcdPoster>
|
|
|
- <div style="flex:1">
|
|
|
- <p class="record-name" style="padding-left:10px">
|
|
|
- {{item.name}}
|
|
|
- <span class="item-icon-wrap">
|
|
|
- <Icon type="md-create" class="common-item-icon ed-name" @click.stop="editRecordName(index)" :title="$t('cusMgt.edRdName')" />
|
|
|
- <Icon type="md-trash" class="common-item-icon delete-item" @click.stop="delRecord(item)" :title="$t('cusMgt.delRcd')" />
|
|
|
- <Icon :type="item.isShare ? 'ios-share-alt':'ios-share-alt-outline'" :size="20" :class="['common-item-icon','share-student',item.isShare ? 'share-active':'']" @click.stop="toggleShare(item)" :title="item.isShare ? $t('cusMgt.unShare') : $t('cusMgt.shareToStu')" />
|
|
|
- <Icon :type="isFavorite(item.id) ? 'md-heart':'md-heart-outline'" :class="['common-item-icon','heart-item',isFavorite(item.id) ? 'heart-active':'']" @click.stop="toggleFavorite(item)" :title="isFavorite(item.id) ? $t('cusMgt.unfvt') : $t('cusMgt.fvt')" />
|
|
|
- </span>
|
|
|
- </p>
|
|
|
- <div style="padding-left:10px;margin-top:10px">
|
|
|
- <!-- 出席人数 -->
|
|
|
- <span class="record-info">
|
|
|
- <span>{{$t('cusMgt.rcd.attendCount')}}:</span>
|
|
|
- <span class="record-info-value"> {{item.attendCount}}{{$t('unit.text7')}}</span>
|
|
|
- </span>
|
|
|
- <!-- 总计分 -->
|
|
|
- <span class="record-info">
|
|
|
- <span>{{$t('cusMgt.rcdScore')}}</span>
|
|
|
- <span class="record-info-value">
|
|
|
- {{item.totalPoint}}
|
|
|
- </span>
|
|
|
- </span>
|
|
|
- <!-- 作品总数 -->
|
|
|
- <span class="record-info">
|
|
|
- <span>{{$t('cusMgt.rcd.colctCount')}}: </span>
|
|
|
- <span class="record-info-value">
|
|
|
- {{item.collateCount}}
|
|
|
- </span>
|
|
|
- </span>
|
|
|
- <!-- 测验得分率 -->
|
|
|
- <span class="record-info">
|
|
|
- <span>{{$t('cusMgt.rcd.scoreRate')}}: </span>
|
|
|
- <span class="record-info-value">
|
|
|
- {{item.examPointRate}}
|
|
|
- </span>
|
|
|
- </span>
|
|
|
- <!-- 互动总数 -->
|
|
|
- <span class="record-info">
|
|
|
- <span>{{$t('cusMgt.rcd.interactionCount')}}: </span>
|
|
|
- <span class="record-info-value">
|
|
|
- {{item.clientInteractionCount}}
|
|
|
- </span>
|
|
|
- </span>
|
|
|
- <!-- 时长 -->
|
|
|
- <span class="record-info">
|
|
|
- <span>{{$t('cusMgt.duration')}}</span>
|
|
|
- <span class="record-info-value">{{handleDuration(item.duration)}}</span>
|
|
|
- </span>
|
|
|
- <!-- 过期时间 -->
|
|
|
- <span class="record-info" v-if="item.expire > -1">
|
|
|
- <span style="color:red">
|
|
|
- {{$tools.getRelativeTime(item.expire)}}
|
|
|
- </span>
|
|
|
- <span style="color:red">
|
|
|
- {{$t('cusMgt.rcdExpired')}}
|
|
|
- </span>
|
|
|
- </span>
|
|
|
- <!-- 时间 -->
|
|
|
- <span class="record-info" style="float:right">
|
|
|
- <span>
|
|
|
- <Icon type="md-time" color="#70B1E7" />
|
|
|
- </span>
|
|
|
- <span class="record-info-value">
|
|
|
- {{$jsFn.timeFormat(item.startTime)}}
|
|
|
- </span>
|
|
|
- </span>
|
|
|
- <div class="record-action-wrap">
|
|
|
- </div>
|
|
|
- </div>
|
|
|
- </div>
|
|
|
- </div>
|
|
|
- <EmptyData v-show="recordList.length == 0" :textContent="$t('cusMgt.noRecord')" :top="150"></EmptyData>
|
|
|
- </vuescroll>
|
|
|
- <!-- 修改课堂记录名称 -->
|
|
|
- <Modal v-model="editRdStatus" className="ed-name-modal" footer-hide>
|
|
|
- <div slot="header" class="modal-header">
|
|
|
- {{$t('cusMgt.edRdName')}}
|
|
|
- </div>
|
|
|
- <div class="edit-name-content">
|
|
|
- <p class="edit-name-label">
|
|
|
- {{$t('cusMgt.listName')}}
|
|
|
- </p>
|
|
|
- <Input v-model="editName" :placeholder="$t('cusMgt.edRdName')" />
|
|
|
- <Button :loading="btnLoading" @click="confirmEditRd" long type="primary" class="confirm-btn">{{ $t('syllabus.confirm') }}</Button>
|
|
|
+ </p>
|
|
|
+ <div style="padding-left:10px;margin-top:10px">
|
|
|
+ <!-- 出席人数 -->
|
|
|
+ <span class="record-info">
|
|
|
+ <span>{{$t('cusMgt.rcd.attendCount')}}:</span>
|
|
|
+ <span class="record-info-value"> {{item.attendCount}}{{$t('unit.text7')}}</span>
|
|
|
+ </span>
|
|
|
+ <!-- 总计分 -->
|
|
|
+ <span class="record-info">
|
|
|
+ <span>{{$t('cusMgt.rcdScore')}}</span>
|
|
|
+ <span class="record-info-value">
|
|
|
+ {{item.totalPoint}}
|
|
|
+ </span>
|
|
|
+ </span>
|
|
|
+ <!-- 作品总数 -->
|
|
|
+ <span class="record-info">
|
|
|
+ <span>{{$t('cusMgt.rcd.colctCount')}}: </span>
|
|
|
+ <span class="record-info-value">
|
|
|
+ {{item.collateCount}}
|
|
|
+ </span>
|
|
|
+ </span>
|
|
|
+ <!-- 测验得分率 -->
|
|
|
+ <span class="record-info">
|
|
|
+ <span>{{$t('cusMgt.rcd.scoreRate')}}: </span>
|
|
|
+ <span class="record-info-value">
|
|
|
+ {{item.examPointRate}}
|
|
|
+ </span>
|
|
|
+ </span>
|
|
|
+ <!-- 互动总数 -->
|
|
|
+ <span class="record-info">
|
|
|
+ <span>{{$t('cusMgt.rcd.interactionCount')}}: </span>
|
|
|
+ <span class="record-info-value">
|
|
|
+ {{item.clientInteractionCount}}
|
|
|
+ </span>
|
|
|
+ </span>
|
|
|
+ <!-- 时长 -->
|
|
|
+ <span class="record-info">
|
|
|
+ <span>{{$t('cusMgt.duration')}}</span>
|
|
|
+ <span class="record-info-value">{{handleDuration(item.duration)}}</span>
|
|
|
+ </span>
|
|
|
+ <!-- 过期时间 -->
|
|
|
+ <span class="record-info" v-if="item.expire > -1">
|
|
|
+ <span style="color:red">
|
|
|
+ {{$tools.getRelativeTime(item.expire)}}
|
|
|
+ </span>
|
|
|
+ <span style="color:red">
|
|
|
+ {{$t('cusMgt.rcdExpired')}}
|
|
|
+ </span>
|
|
|
+ </span>
|
|
|
+ <!-- 时间 -->
|
|
|
+ <span class="record-info" style="float:right">
|
|
|
+ <span>
|
|
|
+ <Icon type="md-time" color="#70B1E7" />
|
|
|
+ </span>
|
|
|
+ <span class="record-info-value">
|
|
|
+ {{$jsFn.timeFormat(item.startTime)}}
|
|
|
+ </span>
|
|
|
+ </span>
|
|
|
+ <div class="record-action-wrap">
|
|
|
</div>
|
|
|
- </Modal>
|
|
|
- </div>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ <EmptyData v-show="recordList.length == 0" :textContent="$t('cusMgt.noRecord')" :top="150"></EmptyData>
|
|
|
+ </vuescroll>
|
|
|
+ <!-- 修改课堂记录名称 -->
|
|
|
+ <Modal v-model="editRdStatus" className="ed-name-modal" footer-hide>
|
|
|
+ <div slot="header" class="modal-header">
|
|
|
+ {{$t('cusMgt.edRdName')}}
|
|
|
+ </div>
|
|
|
+ <div class="edit-name-content">
|
|
|
+ <p class="edit-name-label">
|
|
|
+ {{$t('cusMgt.listName')}}
|
|
|
+ </p>
|
|
|
+ <Input v-model="editName" :placeholder="$t('cusMgt.edRdName')" />
|
|
|
+ <p class="edit-name-label" style="margin-top:10px">
|
|
|
+ {{ $t('cusMgt.rcd.cover.cover')}}
|
|
|
+ </p>
|
|
|
+ <div>
|
|
|
+ <div class="ed-cover">
|
|
|
+ <RcdPoster class="record-poster-wrap" :poster="editCover"></RcdPoster>
|
|
|
+ <Upload action="" :before-upload="onBeforeUpload" :show-upload-list="false">
|
|
|
+ <span class="upload-btn">
|
|
|
+ <Icon type="md-add" />
|
|
|
+ <p>{{ $t('cusMgt.rcd.cover.title') }}</p>
|
|
|
+ </span>
|
|
|
+ </Upload>
|
|
|
+ </div>
|
|
|
+ <p style="margin:10px 0;color:red">* {{ $t('cusMgt.rcd.cover.tip') }}</p>
|
|
|
+ <div v-show="previewCover">
|
|
|
+ <p style="margin-bottom:10px">{{ $t('cusMgt.rcd.cover.preview') }} <span style="text-decoration:underline;color:gray;cursor: pointer;" @click="previewCover = ''">{{ $t('cusMgt.rcd.cover.undo') }}</span></p>
|
|
|
+ <img :src="previewCover" alt="" style="width: 430px;height:242px">
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ <Button :loading="btnLoading" @click="confirmEditRd" long type="primary" class="confirm-btn">{{ $t('syllabus.confirm') }}</Button>
|
|
|
+ </div>
|
|
|
+ </Modal>
|
|
|
+ </div>
|
|
|
</template>
|
|
|
<script>
|
|
|
+import BlobTool from '@/utils/blobTool.js'
|
|
|
import { mapGetters } from 'vuex'
|
|
|
import RcdPoster from "../../homepage/RcdPoster.vue"
|
|
|
export default {
|
|
|
- components: {
|
|
|
- RcdPoster
|
|
|
+ components: {
|
|
|
+ RcdPoster
|
|
|
+ },
|
|
|
+ props: {
|
|
|
+ //收藏id,双向绑定
|
|
|
+ value: {
|
|
|
+ type: Array,
|
|
|
+ default: () => {
|
|
|
+ return []
|
|
|
+ }
|
|
|
},
|
|
|
- props: {
|
|
|
- //收藏id,双向绑定
|
|
|
- value: {
|
|
|
- type: Array,
|
|
|
- default: () => {
|
|
|
- return []
|
|
|
- }
|
|
|
- },
|
|
|
- rcdParams: {
|
|
|
- type: Object,
|
|
|
- default: () => {
|
|
|
- return {}
|
|
|
- }
|
|
|
- }
|
|
|
+ rcdParams: {
|
|
|
+ type: Object,
|
|
|
+ default: () => {
|
|
|
+ return {}
|
|
|
+ }
|
|
|
+ }
|
|
|
+ },
|
|
|
+ data() {
|
|
|
+ return {
|
|
|
+ filterExpire: false,
|
|
|
+ fIds: [],
|
|
|
+ isAuto: false,//是否自动发布课堂记录
|
|
|
+ sLoading: false,
|
|
|
+ btnLoading: false,
|
|
|
+ editName: '',
|
|
|
+ editCover: '',
|
|
|
+ previewCover: '',
|
|
|
+ previewFile: null,
|
|
|
+ recordList: [],
|
|
|
+ editRdStatus: false,
|
|
|
+ }
|
|
|
+ },
|
|
|
+ computed: {
|
|
|
+ ...mapGetters({
|
|
|
+ lessonShow: 'user/getTeacherLessonShow',//是否自动发布课堂记录
|
|
|
+ }),
|
|
|
+ getDataUrl() {
|
|
|
+ return file => {
|
|
|
+ var windowURL = window.URL || window.webkitURL;
|
|
|
+ var dataURL = windowURL.createObjectURL(file)
|
|
|
+ return dataURL
|
|
|
+ }
|
|
|
},
|
|
|
- data() {
|
|
|
- return {
|
|
|
- filterExpire: false,
|
|
|
- fIds: [],
|
|
|
- isAuto: false,//是否自动发布课堂记录
|
|
|
- sLoading: false,
|
|
|
- btnLoading: false,
|
|
|
- editName: '',
|
|
|
- recordList: [],
|
|
|
- editRdStatus: false,
|
|
|
- }
|
|
|
+ },
|
|
|
+ methods: {
|
|
|
+ onBeforeUpload(file) {
|
|
|
+ let maxSize = 2 * 1024 * 1024
|
|
|
+ let nameType = file.name.split('.')[file.name.split('.').length - 1]
|
|
|
+ if (!['jpg', 'png', 'jpeg'].includes(nameType.toLowerCase())) {
|
|
|
+ this.$Message.warning(this.$t('cusMgt.rcd.cover.tip2'));
|
|
|
+ return false
|
|
|
+ }
|
|
|
+ if (file.size > maxSize) {
|
|
|
+ this.$Message.warning(this.$t('cusMgt.rcd.cover.tip3'));
|
|
|
+ return false
|
|
|
+ }
|
|
|
+ this.previewFile = file
|
|
|
+ this.previewCover = this.getDataUrl(file)
|
|
|
},
|
|
|
- computed: {
|
|
|
- ...mapGetters({
|
|
|
- lessonShow: 'user/getTeacherLessonShow',//是否自动发布课堂记录
|
|
|
- }),
|
|
|
+
|
|
|
+ uploadCover() {
|
|
|
+ return new Promise(async (r, j) => {
|
|
|
+ let curRecord = this.recordList[this.edRdIndex]
|
|
|
+ let n = curRecord.scope === 'school' ? await this.$tools.getSchoolSas() : await this.$tools.getPrivateSas()
|
|
|
+ let containerClient = new BlobTool(n.url, n.name, n.sas, curRecord.scope)
|
|
|
+ var newFile = new File([this.previewFile], 'CoverImage.jpg', { type: this.previewFile.type });
|
|
|
+ containerClient.upload(newFile, { path: `records/${curRecord.id}/Record` }).then(res => {
|
|
|
+ r(res.url)
|
|
|
+ }).catch(e => {
|
|
|
+ j(500)
|
|
|
+ })
|
|
|
+ })
|
|
|
},
|
|
|
- methods: {
|
|
|
- handleFilterExpire() {
|
|
|
- this.getRecordList(this.filterExpire)
|
|
|
- },
|
|
|
- delRecord(record) {
|
|
|
- this.$Modal.confirm({
|
|
|
- title: this.$t('cusMgt.delRcdTitle'),
|
|
|
- content: this.$t('cusMgt.delRcdContent'),
|
|
|
- onOk: () => {
|
|
|
- let params = {
|
|
|
- "scope": record.scope,
|
|
|
- "tmdid": this.$store.state.userInfo.TEAMModelId,
|
|
|
- "delete_id": record.id,
|
|
|
- "opt": "delete",
|
|
|
- "school": this.$store.state.userInfo.schoolCode
|
|
|
- }
|
|
|
- this.$api.lessonRecord.delRcd(params).then(
|
|
|
- res => {
|
|
|
- this.$Message.success(this.$t('cusMgt.delOk'))
|
|
|
- const index = this.recordList.findIndex(item => item.id == record.id)
|
|
|
- if (index > -1) {
|
|
|
- this.recordList.splice(index, 1)
|
|
|
- }
|
|
|
- },
|
|
|
- err => {
|
|
|
- this.$Message.error(this.$t('cusMgt.delErr'))
|
|
|
- }
|
|
|
- )
|
|
|
- }
|
|
|
- })
|
|
|
- },
|
|
|
- //切换是否自动发布课堂记录
|
|
|
- setAutoPublish() {
|
|
|
- this.sLoading = true
|
|
|
- let show = this.lessonShow
|
|
|
- if (this.isAuto) {
|
|
|
- show.push('student')
|
|
|
- } else {
|
|
|
- let index = show.findIndex(item => item === 'student')
|
|
|
- if (index > -1) show.splice(index, 1)
|
|
|
- }
|
|
|
- let params = {
|
|
|
- "opt": "UpdateLessonShow",
|
|
|
- "lessonShow": show
|
|
|
+
|
|
|
+ handleFilterExpire() {
|
|
|
+ this.getRecordList(this.filterExpire)
|
|
|
+ },
|
|
|
+ delRecord(record) {
|
|
|
+ this.$Modal.confirm({
|
|
|
+ title: this.$t('cusMgt.delRcdTitle'),
|
|
|
+ content: this.$t('cusMgt.delRcdContent'),
|
|
|
+ onOk: () => {
|
|
|
+ let params = {
|
|
|
+ "scope": record.scope,
|
|
|
+ "tmdid": this.$store.state.userInfo.TEAMModelId,
|
|
|
+ "delete_id": record.id,
|
|
|
+ "opt": "delete",
|
|
|
+ "school": this.$store.state.userInfo.schoolCode
|
|
|
+ }
|
|
|
+ this.$api.lessonRecord.delRcd(params).then(
|
|
|
+ res => {
|
|
|
+ this.$Message.success(this.$t('cusMgt.delOk'))
|
|
|
+ const index = this.recordList.findIndex(item => item.id == record.id)
|
|
|
+ if (index > -1) {
|
|
|
+ this.recordList.splice(index, 1)
|
|
|
+ }
|
|
|
+ },
|
|
|
+ err => {
|
|
|
+ this.$Message.error(this.$t('cusMgt.delErr'))
|
|
|
}
|
|
|
- this.$api.schoolUser.setTeacherInfo(params).then(
|
|
|
- res => {
|
|
|
- this.$Message.success(this.$t('teachermgmt.setOk'))
|
|
|
- this.$store.commit('user/setLessonShow', show)
|
|
|
- },
|
|
|
- err => {
|
|
|
- this.$Message.error(this.$t('teachermgmt.setErr'))
|
|
|
- this.isAuto = !this.isAuto
|
|
|
- }
|
|
|
- ).finally(() => {
|
|
|
- this.sLoading = false
|
|
|
- })
|
|
|
+ )
|
|
|
+ }
|
|
|
+ })
|
|
|
+ },
|
|
|
+ //切换是否自动发布课堂记录
|
|
|
+ setAutoPublish() {
|
|
|
+ this.sLoading = true
|
|
|
+ let show = this.lessonShow
|
|
|
+ if (this.isAuto) {
|
|
|
+ show.push('student')
|
|
|
+ } else {
|
|
|
+ let index = show.findIndex(item => item === 'student')
|
|
|
+ if (index > -1) show.splice(index, 1)
|
|
|
+ }
|
|
|
+ let params = {
|
|
|
+ "opt": "UpdateLessonShow",
|
|
|
+ "lessonShow": show
|
|
|
+ }
|
|
|
+ this.$api.schoolUser.setTeacherInfo(params).then(
|
|
|
+ res => {
|
|
|
+ this.$Message.success(this.$t('teachermgmt.setOk'))
|
|
|
+ this.$store.commit('user/setLessonShow', show)
|
|
|
},
|
|
|
- //分享、取消分享给学生
|
|
|
- toggleShare(data) {
|
|
|
- if (data && data.id) {
|
|
|
- let show = []
|
|
|
- if (!data.isShare) show = ['student']
|
|
|
- this.$api.lessonRecord.updateLesson({
|
|
|
- "lesson_id": data.id,
|
|
|
- "tmdid": data.tmdid,
|
|
|
- "school": data.school,
|
|
|
- "scope": data.scope,
|
|
|
- "grant_types": [{
|
|
|
- "grant_type": "up-baseinfo",
|
|
|
- "data": {
|
|
|
- "show": show
|
|
|
- }
|
|
|
- }]
|
|
|
- }).then(
|
|
|
- res => {
|
|
|
- if (!res.error) {
|
|
|
- if (data.isShare) {
|
|
|
- this.$Message.success(this.$t('cusMgt.unShareOk'))
|
|
|
- } else {
|
|
|
- this.$Message.success(this.$t('cusMgt.shareOk'))
|
|
|
- }
|
|
|
- let info = this.recordList.find(item => item.id == data.id)
|
|
|
- if (info) {
|
|
|
- info.show = show
|
|
|
- info.isShare = !info.isShare
|
|
|
- }
|
|
|
- } else {
|
|
|
- if (data.isShare) {
|
|
|
- this.$Message.error(this.$t('cusMgt.unShareErr'))
|
|
|
- } else {
|
|
|
- this.$Message.error(this.$t('cusMgt.shareErr'))
|
|
|
- }
|
|
|
- }
|
|
|
- },
|
|
|
- err => {
|
|
|
- if (data.isShare) {
|
|
|
- this.$Message.error(this.$t('cusMgt.unShareErr'))
|
|
|
- } else {
|
|
|
- this.$Message.error(this.$t('cusMgt.shareErr'))
|
|
|
- }
|
|
|
- }
|
|
|
- )
|
|
|
+ err => {
|
|
|
+ this.$Message.error(this.$t('teachermgmt.setErr'))
|
|
|
+ this.isAuto = !this.isAuto
|
|
|
+ }
|
|
|
+ ).finally(() => {
|
|
|
+ this.sLoading = false
|
|
|
+ })
|
|
|
+ },
|
|
|
+ //分享、取消分享给学生
|
|
|
+ toggleShare(data) {
|
|
|
+ if (data && data.id) {
|
|
|
+ let show = []
|
|
|
+ if (!data.isShare) show = ['student']
|
|
|
+ this.$api.lessonRecord.updateLesson({
|
|
|
+ "lesson_id": data.id,
|
|
|
+ "tmdid": data.tmdid,
|
|
|
+ "school": data.school,
|
|
|
+ "scope": data.scope,
|
|
|
+ "grant_types": [{
|
|
|
+ "grant_type": "up-baseinfo",
|
|
|
+ "data": {
|
|
|
+ "show": show
|
|
|
}
|
|
|
- },
|
|
|
- //收藏 取消
|
|
|
- toggleFavorite(data) {
|
|
|
- if (data && data.id) {
|
|
|
- if (this.isFavorite(data.id)) {
|
|
|
- this.delCollection(data) //取消收藏
|
|
|
- } else {
|
|
|
- this.collection(data) //收藏
|
|
|
- }
|
|
|
+ }]
|
|
|
+ }).then(
|
|
|
+ res => {
|
|
|
+ if (!res.error) {
|
|
|
+ if (data.isShare) {
|
|
|
+ this.$Message.success(this.$t('cusMgt.unShareOk'))
|
|
|
+ } else {
|
|
|
+ this.$Message.success(this.$t('cusMgt.shareOk'))
|
|
|
+ }
|
|
|
+ let info = this.recordList.find(item => item.id == data.id)
|
|
|
+ if (info) {
|
|
|
+ info.show = show
|
|
|
+ info.isShare = !info.isShare
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ if (data.isShare) {
|
|
|
+ this.$Message.error(this.$t('cusMgt.unShareErr'))
|
|
|
+ } else {
|
|
|
+ this.$Message.error(this.$t('cusMgt.shareErr'))
|
|
|
+ }
|
|
|
}
|
|
|
- },
|
|
|
- collection(data) {
|
|
|
- let params = {
|
|
|
- favorite: {
|
|
|
- "name": data.name,
|
|
|
- "id": data.id,
|
|
|
- "code": this.$store.state.userInfo.TEAMModelId,
|
|
|
- "fromId": data.id,
|
|
|
- "fromCode": data.code,
|
|
|
- "scope": data.scope,
|
|
|
- "owner": data.scope == 'school' ? this.$store.state.userInfo.schoolCode : this.$store.state.userInfo.TEAMModelId,
|
|
|
- "type": data.pk
|
|
|
- }
|
|
|
+ },
|
|
|
+ err => {
|
|
|
+ if (data.isShare) {
|
|
|
+ this.$Message.error(this.$t('cusMgt.unShareErr'))
|
|
|
+ } else {
|
|
|
+ this.$Message.error(this.$t('cusMgt.shareErr'))
|
|
|
}
|
|
|
- this.$api.courseMgmt.FavoriteUpsert(params).then(
|
|
|
- res => {
|
|
|
- this.$Message.success(this.$t('cusMgt.fvtOk'))
|
|
|
- this.fIds.push(data.id)
|
|
|
- this.$emit("on-favorite-change", this.fIds)
|
|
|
- },
|
|
|
- err => {
|
|
|
- this.$Message.error(this.$t('cusMgt.fvtOk'))
|
|
|
- }
|
|
|
- )
|
|
|
+ }
|
|
|
+ )
|
|
|
+ }
|
|
|
+ },
|
|
|
+ //收藏 取消
|
|
|
+ toggleFavorite(data) {
|
|
|
+ if (data && data.id) {
|
|
|
+ if (this.isFavorite(data.id)) {
|
|
|
+ this.delCollection(data) //取消收藏
|
|
|
+ } else {
|
|
|
+ this.collection(data) //收藏
|
|
|
+ }
|
|
|
+ }
|
|
|
+ },
|
|
|
+ collection(data) {
|
|
|
+ let params = {
|
|
|
+ favorite: {
|
|
|
+ "name": data.name,
|
|
|
+ "id": data.id,
|
|
|
+ "code": this.$store.state.userInfo.TEAMModelId,
|
|
|
+ "fromId": data.id,
|
|
|
+ "fromCode": data.code,
|
|
|
+ "scope": data.scope,
|
|
|
+ "owner": data.scope == 'school' ? this.$store.state.userInfo.schoolCode : this.$store.state.userInfo.TEAMModelId,
|
|
|
+ "type": data.pk
|
|
|
+ }
|
|
|
+ }
|
|
|
+ this.$api.courseMgmt.FavoriteUpsert(params).then(
|
|
|
+ res => {
|
|
|
+ this.$Message.success(this.$t('cusMgt.fvtOk'))
|
|
|
+ this.fIds.push(data.id)
|
|
|
+ this.$emit("on-favorite-change", this.fIds)
|
|
|
},
|
|
|
- delCollection(data) {
|
|
|
- let params = {
|
|
|
- "id": data.id,
|
|
|
- "code": this.$store.state.userInfo.TEAMModelId,
|
|
|
- }
|
|
|
- this.$api.courseMgmt.FavoriteDelete(params).then(
|
|
|
- res => {
|
|
|
- this.$Message.success(this.$t('cusMgt.unfvtOk'))
|
|
|
- let index = this.fIds.findIndex(item => item == data.id)
|
|
|
- if (index > -1) {
|
|
|
- this.fIds.splice(index, 1)
|
|
|
- this.$emit("on-favorite-change", this.fIds)
|
|
|
- }
|
|
|
- },
|
|
|
- err => {
|
|
|
- this.$Message.error(this.$t('cusMgt.unfvtErr'))
|
|
|
- }
|
|
|
- )
|
|
|
+ err => {
|
|
|
+ this.$Message.error(this.$t('cusMgt.fvtOk'))
|
|
|
+ }
|
|
|
+ )
|
|
|
+ },
|
|
|
+ delCollection(data) {
|
|
|
+ let params = {
|
|
|
+ "id": data.id,
|
|
|
+ "code": this.$store.state.userInfo.TEAMModelId,
|
|
|
+ }
|
|
|
+ this.$api.courseMgmt.FavoriteDelete(params).then(
|
|
|
+ res => {
|
|
|
+ this.$Message.success(this.$t('cusMgt.unfvtOk'))
|
|
|
+ let index = this.fIds.findIndex(item => item == data.id)
|
|
|
+ if (index > -1) {
|
|
|
+ this.fIds.splice(index, 1)
|
|
|
+ this.$emit("on-favorite-change", this.fIds)
|
|
|
+ }
|
|
|
},
|
|
|
- //根据时长换算时间
|
|
|
- handleDuration(duration) {
|
|
|
- if (!duration) return this.$t('cusMgt.noData')
|
|
|
- let calc = duration
|
|
|
- //天
|
|
|
- let dayC = 24 * 60 * 60
|
|
|
- let day = parseInt(calc / dayC)
|
|
|
- calc = calc % dayC
|
|
|
+ err => {
|
|
|
+ this.$Message.error(this.$t('cusMgt.unfvtErr'))
|
|
|
+ }
|
|
|
+ )
|
|
|
+ },
|
|
|
+ //根据时长换算时间
|
|
|
+ handleDuration(duration) {
|
|
|
+ if (!duration) return this.$t('cusMgt.noData')
|
|
|
+ let calc = duration
|
|
|
+ //天
|
|
|
+ let dayC = 24 * 60 * 60
|
|
|
+ let day = parseInt(calc / dayC)
|
|
|
+ calc = calc % dayC
|
|
|
|
|
|
- //时
|
|
|
- let hourC = 60 * 60
|
|
|
- let hour = parseInt(calc / hourC)
|
|
|
- calc = calc % hourC
|
|
|
+ //时
|
|
|
+ let hourC = 60 * 60
|
|
|
+ let hour = parseInt(calc / hourC)
|
|
|
+ calc = calc % hourC
|
|
|
|
|
|
- //分
|
|
|
- let minC = 60
|
|
|
- let min = parseInt(calc / minC)
|
|
|
- calc = calc % minC
|
|
|
+ //分
|
|
|
+ let minC = 60
|
|
|
+ let min = parseInt(calc / minC)
|
|
|
+ calc = calc % minC
|
|
|
|
|
|
- //秒
|
|
|
- let sec = calc
|
|
|
- return `${day > 0 ? day + this.$t('unit.day') : ''} ${hour > 0 ? hour + this.$t('unit.hour') : ''} ${min > 0 ? min + this.$t('unit.text5') : ''} ${sec > 0 ? sec + this.$t('unit.second') : ''}`
|
|
|
- },
|
|
|
- isFavorite(id) {
|
|
|
- return this.fIds.includes(id)
|
|
|
- },
|
|
|
- // 修改记录名称
|
|
|
- confirmEditRd() {
|
|
|
- if (this.editName) {
|
|
|
- let recordInfo = this.recordList[this.edRdIndex]
|
|
|
- this.btnLoading = true
|
|
|
- this.$api.lessonRecord.updateLesson({
|
|
|
- "lesson_id": recordInfo.id,
|
|
|
- "tmdid": recordInfo.tmdid,
|
|
|
- "school": recordInfo.school,
|
|
|
- "scope": recordInfo.scope,
|
|
|
- "grant_types": [{
|
|
|
- "grant_type": "up-baseinfo",
|
|
|
- "data": {
|
|
|
- "name": this.editName,
|
|
|
- }
|
|
|
- }]
|
|
|
- }).then(
|
|
|
- res => {
|
|
|
- if (!res.error) {
|
|
|
- this.$Message.success(this.$t('cusMgt.editOk'))
|
|
|
- let i = this.recordList.findIndex(item => item.id == recordInfo.id)
|
|
|
- if (i > -1) {
|
|
|
- this.$set(this.recordList[i], 'name', this.editName)
|
|
|
- }
|
|
|
- this.editRdStatus = false
|
|
|
- }
|
|
|
- }).finally(() => {
|
|
|
- this.btnLoading = false
|
|
|
- })
|
|
|
- } else {
|
|
|
- this.$Message.warning(this.$t('learnActivity.mgtScEv.edNameHolder'))
|
|
|
- }
|
|
|
- },
|
|
|
- editRecordName(index) {
|
|
|
- this.editRdStatus = true
|
|
|
- this.edRdIndex = index
|
|
|
- this.editName = this.recordList[index]?.name
|
|
|
- },
|
|
|
- //查看课堂记录详情
|
|
|
- toClassRecoerd(index) {
|
|
|
- this.$router.push({
|
|
|
- name: 'classRecord',
|
|
|
- params: {
|
|
|
- record: this.recordList[index]
|
|
|
- }
|
|
|
- })
|
|
|
- },
|
|
|
- getRecordList(isFilterExpire) {
|
|
|
- let params = {
|
|
|
- "tmdid": this.$store.state.userInfo.TEAMModelId,
|
|
|
- "scope": this.rcdParams.scope,
|
|
|
- "school": this.$store.state.userInfo.schoolCode,
|
|
|
- "DESC": "startTime",
|
|
|
- "pageCount": 50,
|
|
|
- "courseId": this.rcdParams.courseId,
|
|
|
- "groupIds": [this.rcdParams.classId]
|
|
|
+ //秒
|
|
|
+ let sec = calc
|
|
|
+ return `${day > 0 ? day + this.$t('unit.day') : ''} ${hour > 0 ? hour + this.$t('unit.hour') : ''} ${min > 0 ? min + this.$t('unit.text5') : ''} ${sec > 0 ? sec + this.$t('unit.second') : ''}`
|
|
|
+ },
|
|
|
+ isFavorite(id) {
|
|
|
+ return this.fIds.includes(id)
|
|
|
+ },
|
|
|
+ // 修改记录名称
|
|
|
+ confirmEditRd() {
|
|
|
+ if (this.editName) {
|
|
|
+ let recordInfo = this.recordList[this.edRdIndex]
|
|
|
+ this.btnLoading = true
|
|
|
+ this.$api.lessonRecord.updateLesson({
|
|
|
+ "lesson_id": recordInfo.id,
|
|
|
+ "tmdid": recordInfo.tmdid,
|
|
|
+ "school": recordInfo.school,
|
|
|
+ "scope": recordInfo.scope,
|
|
|
+ "grant_types": [{
|
|
|
+ "grant_type": "up-baseinfo",
|
|
|
+ "data": {
|
|
|
+ "name": this.editName,
|
|
|
}
|
|
|
- if (isFilterExpire) {
|
|
|
- params.expire = true
|
|
|
+ }]
|
|
|
+ }).then(
|
|
|
+ async res => {
|
|
|
+ if (!res.error) {
|
|
|
+ let newPoster = ''
|
|
|
+ if (this.previewCover && this.previewFile) {
|
|
|
+ newPoster = await this.uploadCover()
|
|
|
+ }
|
|
|
+ this.$Message.success(this.$t('cusMgt.editOk'))
|
|
|
+ let i = this.recordList.findIndex(item => item.id == recordInfo.id)
|
|
|
+ if (i > -1) {
|
|
|
+ this.$set(this.recordList[i], 'name', this.editName)
|
|
|
+ this.$set(this.recordList[i], 'poster', newPoster + '?' + this.recordList[i].poster.split('?')[1] + '&t=' + Math.random())
|
|
|
+ }
|
|
|
+ this.editRdStatus = false
|
|
|
}
|
|
|
- this.$api.lessonRecord.getLessonList(params).then(
|
|
|
- res => {
|
|
|
- if (res.lessonRecords) {
|
|
|
- res.lessonRecords.forEach(item => {
|
|
|
- item.show = item.show ? item.show : []
|
|
|
- item.isShare = item.show.includes('student')
|
|
|
- })
|
|
|
- this.recordList = res.lessonRecords
|
|
|
- let sasInfo = {}
|
|
|
- let blobInfo = this.rcdParams.scope === 'school' ? this.$store.state.user.schoolProfile : this.$store.state.user.userProfile
|
|
|
- sasInfo.sas = '?' + blobInfo.blob_sas
|
|
|
- sasInfo.name = this.rcdParams.scope === 'school' ? this.$store.state.userInfo.schoolCode : this.$store.state.userInfo.TEAMModelId
|
|
|
- sasInfo.url = blobInfo.blob_uri.slice(0, blobInfo.blob_uri.lastIndexOf(sasInfo.name) - 1)
|
|
|
- this.recordList.forEach(item => {
|
|
|
- item.sokrateImg = `${sasInfo.url}/${sasInfo.name}/records/${item.id}/Sokrates/SokratesResults/event.png${sasInfo.sas}`
|
|
|
- item.eNote = `${sasInfo.url}/${sasInfo.name}/records/${item.id}/Note.pdf${sasInfo.sas}`
|
|
|
- item.video = `${sasInfo.url}/${sasInfo.name}/records/${item.id}/Record/CourseRecord.mp4${sasInfo.sas}`
|
|
|
- item.poster = `${sasInfo.url}/${sasInfo.name}/records/${item.id}/Record/CoverImage.jpg${sasInfo.sas}`
|
|
|
- })
|
|
|
- this.recordList.sort((a, b) => {
|
|
|
- return a.startTime - b.startTime > 0 ? -1 : 1
|
|
|
- })
|
|
|
- }
|
|
|
- },
|
|
|
- err => {
|
|
|
- this.$Message.error(this.$t('cusMgt.rcdErr'))
|
|
|
- }
|
|
|
- )
|
|
|
+ }).finally(() => {
|
|
|
+ this.btnLoading = false
|
|
|
+ })
|
|
|
+ } else {
|
|
|
+ this.$Message.warning(this.$t('learnActivity.mgtScEv.edNameHolder'))
|
|
|
+ }
|
|
|
+ },
|
|
|
+ editRecordName(index) {
|
|
|
+ this.editRdStatus = true
|
|
|
+ this.edRdIndex = index
|
|
|
+ this.editName = this.recordList[index]?.name
|
|
|
+ this.editCover = this.recordList[index]?.poster
|
|
|
+ this.previewCover = ''
|
|
|
+ console.error(this.recordList[index])
|
|
|
+ },
|
|
|
+ //查看课堂记录详情
|
|
|
+ toClassRecoerd(index) {
|
|
|
+ this.$router.push({
|
|
|
+ name: 'classRecord',
|
|
|
+ params: {
|
|
|
+ record: this.recordList[index]
|
|
|
+ }
|
|
|
+ })
|
|
|
+ },
|
|
|
+ getRecordList(isFilterExpire) {
|
|
|
+ let params = {
|
|
|
+ "tmdid": this.$store.state.userInfo.TEAMModelId,
|
|
|
+ "scope": this.rcdParams.scope,
|
|
|
+ "school": this.$store.state.userInfo.schoolCode,
|
|
|
+ "DESC": "startTime",
|
|
|
+ "pageCount": 50,
|
|
|
+ "courseId": this.rcdParams.courseId,
|
|
|
+ "groupIds": [this.rcdParams.classId]
|
|
|
+ }
|
|
|
+ if (isFilterExpire) {
|
|
|
+ params.expire = true
|
|
|
+ }
|
|
|
+ this.$api.lessonRecord.getLessonList(params).then(
|
|
|
+ res => {
|
|
|
+ if (res.lessonRecords) {
|
|
|
+ res.lessonRecords.forEach(item => {
|
|
|
+ item.show = item.show ? item.show : []
|
|
|
+ item.isShare = item.show.includes('student')
|
|
|
+ })
|
|
|
+ this.recordList = res.lessonRecords
|
|
|
+ let sasInfo = {}
|
|
|
+ let blobInfo = this.rcdParams.scope === 'school' ? this.$store.state.user.schoolProfile : this.$store.state.user.userProfile
|
|
|
+ sasInfo.sas = '?' + blobInfo.blob_sas
|
|
|
+ sasInfo.name = this.rcdParams.scope === 'school' ? this.$store.state.userInfo.schoolCode : this.$store.state.userInfo.TEAMModelId
|
|
|
+ sasInfo.url = blobInfo.blob_uri.slice(0, blobInfo.blob_uri.lastIndexOf(sasInfo.name) - 1)
|
|
|
+ this.recordList.forEach(item => {
|
|
|
+ item.sokrateImg = `${sasInfo.url}/${sasInfo.name}/records/${item.id}/Sokrates/SokratesResults/event.png${sasInfo.sas}`
|
|
|
+ item.eNote = `${sasInfo.url}/${sasInfo.name}/records/${item.id}/Note.pdf${sasInfo.sas}`
|
|
|
+ item.video = `${sasInfo.url}/${sasInfo.name}/records/${item.id}/Record/CourseRecord.mp4${sasInfo.sas}`
|
|
|
+ item.poster = `${sasInfo.url}/${sasInfo.name}/records/${item.id}/Record/CoverImage.jpg${sasInfo.sas}`
|
|
|
+ })
|
|
|
+ this.recordList.sort((a, b) => {
|
|
|
+ return a.startTime - b.startTime > 0 ? -1 : 1
|
|
|
+ })
|
|
|
+ }
|
|
|
},
|
|
|
+ err => {
|
|
|
+ this.$Message.error(this.$t('cusMgt.rcdErr'))
|
|
|
+ }
|
|
|
+ )
|
|
|
},
|
|
|
- watch: {
|
|
|
- rcdParams: {
|
|
|
- deep: true,
|
|
|
- immediate: true,
|
|
|
- handler(n, o) {
|
|
|
- if (n) {
|
|
|
- let { scope, courseId, classId } = n
|
|
|
- if (scope && courseId, classId) {
|
|
|
- this.getRecordList()
|
|
|
- } else {
|
|
|
- this.recordList = []
|
|
|
- }
|
|
|
- }
|
|
|
+ },
|
|
|
+ watch: {
|
|
|
+ rcdParams: {
|
|
|
+ deep: true,
|
|
|
+ immediate: true,
|
|
|
+ handler(n, o) {
|
|
|
+ if (n) {
|
|
|
+ let { scope, courseId, classId } = n
|
|
|
+ if (scope && courseId, classId) {
|
|
|
+ this.getRecordList()
|
|
|
+ } else {
|
|
|
+ this.recordList = []
|
|
|
+ }
|
|
|
+ }
|
|
|
|
|
|
- }
|
|
|
- },
|
|
|
- lessonShow: {
|
|
|
- deep: true,
|
|
|
- immediate: true,
|
|
|
- handler(n, o) {
|
|
|
- console.log(typeof n)
|
|
|
- if (n && Array.isArray(n)) {
|
|
|
- this.isAuto = n.includes('student')
|
|
|
- } else {
|
|
|
- this.isAuto = false
|
|
|
- }
|
|
|
- }
|
|
|
- },
|
|
|
- value: {
|
|
|
- deep: true,
|
|
|
- immediate: true,
|
|
|
- handler(n, o) {
|
|
|
- this.fIds = n
|
|
|
- }
|
|
|
+ }
|
|
|
+ },
|
|
|
+ lessonShow: {
|
|
|
+ deep: true,
|
|
|
+ immediate: true,
|
|
|
+ handler(n, o) {
|
|
|
+ console.log(typeof n)
|
|
|
+ if (n && Array.isArray(n)) {
|
|
|
+ this.isAuto = n.includes('student')
|
|
|
+ } else {
|
|
|
+ this.isAuto = false
|
|
|
}
|
|
|
+ }
|
|
|
+ },
|
|
|
+ value: {
|
|
|
+ deep: true,
|
|
|
+ immediate: true,
|
|
|
+ handler(n, o) {
|
|
|
+ this.fIds = n
|
|
|
+ }
|
|
|
}
|
|
|
+ }
|
|
|
}
|
|
|
</script>
|
|
|
<style lang="less" scoped>
|