fix bug
This commit is contained in:
@@ -75,6 +75,10 @@ layout("/mobile/platform.html"){
|
||||
word-break: break-all;
|
||||
}
|
||||
|
||||
.myWatchRecord{
|
||||
font-size: 14px;
|
||||
}
|
||||
|
||||
|
||||
</style>
|
||||
|
||||
@@ -135,7 +139,7 @@ layout("/mobile/platform.html"){
|
||||
</span>
|
||||
</template>
|
||||
<template #label>
|
||||
{{getWatchStatus(o)}}
|
||||
<!-- {{getWatchStatus(o)}}-->
|
||||
</template>
|
||||
<template>
|
||||
|
||||
@@ -143,10 +147,45 @@ layout("/mobile/platform.html"){
|
||||
</van-cell>
|
||||
</van-cell-group>
|
||||
</van-tab>
|
||||
<van-tab title="学习记录">
|
||||
<div style="height: 5px;background-color: #f6f7f9"></div>
|
||||
<van-cell-group class="video-list">
|
||||
<van-cell v-for="(o,i) in videoList" :key="o.id" @click="playVideo(o)">
|
||||
<template #title>
|
||||
<van-tag plain type="primary" style="margin-right: 10px">视频</van-tag>
|
||||
<span style="margin-right: 10px">
|
||||
{{i+1}}.
|
||||
</span>
|
||||
<span>
|
||||
{{o.title}}
|
||||
</span>
|
||||
</template>
|
||||
<template #label>
|
||||
<div v-if="o.everyDayMaxWatchNum && o.everyDayMaxWatchNum>0" style="padding: 10px 0;color: #0a84ff;white-space: normal">
|
||||
本视频在活动结束时每天最多只会统计
|
||||
<span style="color: #0a84ff;font-weight: bold">{{o.everyDayMaxWatchNum}}</span>
|
||||
次完整观看记录,您可以无限制的观看。
|
||||
</div>
|
||||
<div v-for="(v,k) in Object.groupBy(watchRecordList,v=>v.watchTime)" :key="k" class="myWatchRecord">
|
||||
<div style="display: flex;justify-content: space-between">
|
||||
<div>
|
||||
{{moment(k).format('YYYY年MM月DD日')}}
|
||||
</div>
|
||||
<div style="color: #000000;">
|
||||
观看次数
|
||||
<span style="font-weight: bold">{{v.length}}</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
</van-cell>
|
||||
</van-cell-group>
|
||||
|
||||
</van-tab>
|
||||
</van-tabs>
|
||||
|
||||
<div class="bottom-wrap">
|
||||
<van-button type="danger" block @click="endLearn">结束本次学习</van-button>
|
||||
<div class="bottom-wrap" v-show="isPlay">
|
||||
<van-button type="info" block @click="endLearn">上传学习记录</van-button>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
@@ -176,6 +215,9 @@ layout("/mobile/platform.html"){
|
||||
|
||||
}
|
||||
},
|
||||
|
||||
computed: {},
|
||||
|
||||
methods: {
|
||||
async getVideoInfo() {
|
||||
const {data} = await $.get('/mobile/trainEducation/getVideoList', {albumId: this.albumId})
|
||||
@@ -197,7 +239,6 @@ layout("/mobile/platform.html"){
|
||||
return
|
||||
}
|
||||
|
||||
|
||||
this.currentVideo = o
|
||||
|
||||
const playVideo_ = (time = 0) => {
|
||||
@@ -223,9 +264,10 @@ layout("/mobile/platform.html"){
|
||||
const v = this.watchRecordList.find(v => v.videoId === o.id)
|
||||
|
||||
if (v && v.finish) {
|
||||
this.$modal.confirm('本视频您已学习完成,是否重新观看,不会影响到完成的学习记录').then(() => {
|
||||
playVideo_(0)
|
||||
})
|
||||
playVideo_(0)
|
||||
// this.$modal.confirm('本视频您已学习完成,是否重新观看,不会影响到完成的学习记录').then(() => {
|
||||
// playVideo_(0)
|
||||
// })
|
||||
} else if (v && !v.finish) {
|
||||
playVideo_(v.watchDuration)
|
||||
} else {
|
||||
@@ -235,10 +277,10 @@ layout("/mobile/platform.html"){
|
||||
|
||||
playEnd() {
|
||||
this.player.on('ended', async () => {
|
||||
const v = this.watchRecordList.find(v => v.videoId === this.currentVideo.id)
|
||||
if (v.finish) {
|
||||
return
|
||||
}
|
||||
// const v = this.watchRecordList.find(v => v.videoId === this.currentVideo.id)
|
||||
// if (v.finish) {
|
||||
// return
|
||||
// }
|
||||
|
||||
const loading = this.$toast.loading({
|
||||
duration: 0,
|
||||
@@ -253,14 +295,6 @@ layout("/mobile/platform.html"){
|
||||
setTimeout(() => {
|
||||
loading.clear()
|
||||
}, 2000)
|
||||
|
||||
// this.addWatchRecord()
|
||||
// this.getMyWatchRecord()
|
||||
// const currentIndex = this.videoList.findIndex(v => v.id === this.currentVideo.id)
|
||||
// const nextVideo = this.videoList[currentIndex + 1]
|
||||
// if (nextVideo) {
|
||||
// this.playVideo(nextVideo)
|
||||
// }
|
||||
})
|
||||
},
|
||||
|
||||
@@ -272,19 +306,23 @@ layout("/mobile/platform.html"){
|
||||
albumId: this.currentVideo.albumId
|
||||
}
|
||||
const resp = await $.post('/mobile/trainEducation/addWatchRecord', params)
|
||||
this.getMyWatchRecord()
|
||||
return resp
|
||||
if (resp.code === 0) {
|
||||
this.getMyWatchRecord()
|
||||
return resp
|
||||
} else {
|
||||
this.$modal.msgError(resp.msg)
|
||||
}
|
||||
},
|
||||
//监听页面关闭 隐藏
|
||||
watchPage() {
|
||||
document.addEventListener('visibilitychange', () => {
|
||||
if (document.visibilityState === 'hidden') {
|
||||
if (this.player && this.currentVideo) {
|
||||
this.addWatchRecord()
|
||||
}
|
||||
}
|
||||
})
|
||||
},
|
||||
// watchPage() {
|
||||
// document.addEventListener('visibilitychange', () => {
|
||||
// if (document.visibilityState === 'hidden') {
|
||||
// if (this.player && this.currentVideo) {
|
||||
// this.addWatchRecord()
|
||||
// }
|
||||
// }
|
||||
// })
|
||||
// },
|
||||
async getMyWatchRecord() {
|
||||
const {data} = await $.get('/mobile/trainEducation/getMyWatchRecord')
|
||||
this.watchRecordList = data
|
||||
@@ -310,10 +348,10 @@ layout("/mobile/platform.html"){
|
||||
endLearn() {
|
||||
const v = this.watchRecordList.find(v => v.videoId === this.currentVideo.id)
|
||||
console.log(v)
|
||||
if (v && v.finish) {
|
||||
this.$modal.msg('本视频您已学习完成,无需重复上传')
|
||||
return
|
||||
}
|
||||
// if (v && v.finish) {
|
||||
// this.$modal.msg('本视频您已学习完成,无需重复上传')
|
||||
// return
|
||||
// }
|
||||
|
||||
this.$modal.confirm('您是否要结束本视频学习?').then(() => {
|
||||
//暂停
|
||||
@@ -336,7 +374,7 @@ layout("/mobile/platform.html"){
|
||||
|
||||
},
|
||||
created() {
|
||||
this.watchPage()
|
||||
// this.watchPage()
|
||||
const id = this.GetQueryString("id")
|
||||
if (id) {
|
||||
this.albumId = id
|
||||
|
||||
@@ -113,12 +113,16 @@ layout("/layouts/platform.html"){
|
||||
<span v-if="row.createType === 1">分工会</span>
|
||||
<span v-else>校工会</span>
|
||||
</template>
|
||||
<template v-else-if="column.prop==='disabled'" scope="{row}">
|
||||
<span v-if="row.disabled" class="text-danger">否</span>
|
||||
<span v-else class="text-success">是</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column align="center" header-align="center" label="操作" width="250">
|
||||
<template scope="{row}">
|
||||
<el-button size="small" @click="openView(row)">查看</el-button>
|
||||
<el-button size="small" type="primary" @click="openEdit(row)">编辑</el-button>
|
||||
<el-button size="small" type="danger" @click="doDelete(row.id)">删除
|
||||
<el-button size="mini" @click="openView(row)">查看</el-button>
|
||||
<el-button size="mini" type="primary" @click="openEdit(row)">编辑</el-button>
|
||||
<el-button size="mini" type="danger" @click="doDelete(row.id)">删除
|
||||
</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
@@ -128,7 +132,7 @@ layout("/layouts/platform.html"){
|
||||
|
||||
<template #edit>
|
||||
<el-form :model="formData" :rules="rules" ref="ruleForm" label-width="100px"
|
||||
>
|
||||
>
|
||||
<el-form-item label="专辑标题" prop="title">
|
||||
<el-input v-model="formData.title" maxlength="30" placeholder="请输入专辑标题"></el-input>
|
||||
</el-form-item>
|
||||
@@ -165,6 +169,17 @@ layout("/layouts/platform.html"){
|
||||
<i v-else class="el-icon-plus avatar-uploader-icon"></i>
|
||||
</el-upload>
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item label="是否开启" prop="disabled">
|
||||
<el-switch
|
||||
v-model="formData.disabled"
|
||||
active-color="#13ce66"
|
||||
inactive-color="#ff4949"
|
||||
:active-value="false"
|
||||
:inactive-value="true">
|
||||
</el-switch>
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item class="text-right">
|
||||
<el-button type="primary" @click="doHandle">确定</el-button>
|
||||
<el-button @click="$refs.guava.index()">取消</el-button>
|
||||
@@ -231,6 +246,7 @@ layout("/layouts/platform.html"){
|
||||
{prop: 'videoCount', label: '视频数量'},
|
||||
{prop: 'typeName', label: '专辑类型'},
|
||||
{prop: 'createType', label: '创建类型'},
|
||||
{prop: 'disabled', label: '是否开启'}
|
||||
],
|
||||
rules: {
|
||||
title: [{required: true, message: '请输入标题', trigger: ['change', 'blur']}],
|
||||
|
||||
@@ -5,6 +5,33 @@ layout("/layouts/platform.html"){
|
||||
<div id="app" v-cloak>
|
||||
<guava ref="guava">
|
||||
|
||||
<el-card shadow="never">
|
||||
<div class="btn-group tool-button mt5">
|
||||
<el-select v-model="pageForm.albumId" placeholder="请选择专辑" filterable clearable @change="doSearch">
|
||||
<el-option
|
||||
v-for="item in albumList"
|
||||
:key="item.id"
|
||||
:label="item.title"
|
||||
:value="item.id">
|
||||
</el-option>
|
||||
</el-select>
|
||||
</div>
|
||||
|
||||
<div class="btn-group tool-button mt5">
|
||||
<el-input placeholder="请输入内容" v-model="pageForm.searchKeyword" clearable
|
||||
@keyup.enter.native="doSearch">
|
||||
<el-select v-model="pageForm.searchName" slot="prepend" placeholder="查询类型"
|
||||
style="width: 120px;">
|
||||
<el-option label="标题" value="tev.title"></el-option>
|
||||
</el-select>
|
||||
</el-input>
|
||||
</div>
|
||||
|
||||
<div class="btn-group tool-button mt5">
|
||||
<el-button type="primary" icon="el-icon-search" @click="doSearch">搜索</el-button>
|
||||
</div>
|
||||
</el-card>
|
||||
|
||||
|
||||
<el-card shadow="never" class="mt10">
|
||||
<table-tool label="统计" :app="this"></table-tool>
|
||||
@@ -23,68 +50,75 @@ layout("/layouts/platform.html"){
|
||||
{{(row.sumDuration / 60 / 60).toFixed(2) + 'h'}}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column align="center" header-align="center" label="操作" width="200">
|
||||
<template scope="{row}">
|
||||
<el-button size="small" type="primary" @click="openView(row)">查看具体学习情况</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<!-- <el-table-column align="center" header-align="center" label="操作" width="200">-->
|
||||
<!-- <template scope="{row}">-->
|
||||
<!-- <el-button size="mini" type="primary" @click="openView(row)">查看具体学习情况</el-button>-->
|
||||
<!-- </template>-->
|
||||
<!-- </el-table-column>-->
|
||||
</el-table>
|
||||
<!--#include("/layouts/pagination.html"){}#-->
|
||||
</el-card>
|
||||
|
||||
<template #view>
|
||||
<el-table :data="viewTableData" stripe border style="width: 100%">
|
||||
<el-table-column type="index" label="序号" width="80px">
|
||||
<template scope="scope">
|
||||
<span>{{ scope.$index + (viewPageForm.pageNumber - 1) * viewPageForm.pageSize + 1 }} </span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
align="center"
|
||||
header-align="center"
|
||||
v-for="column in viewTableColumns"
|
||||
show-overflow-tooltip
|
||||
:label="column.label"
|
||||
:prop="column.prop"
|
||||
:sortable="column.sortable"
|
||||
>
|
||||
<template v-if="column.prop==='studyDuration'" scope="{row}">
|
||||
{{(row.studyDuration / 60 / 60).toFixed(2) + 'h'}}
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
<!-- <template #view>-->
|
||||
<!-- <el-table :data="viewTableData" stripe border style="width: 100%">-->
|
||||
<!-- <el-table-column type="index" label="序号" width="80px">-->
|
||||
<!-- <template scope="scope">-->
|
||||
<!-- <span>{{ scope.$index + (viewPageForm.pageNumber - 1) * viewPageForm.pageSize + 1 }} </span>-->
|
||||
<!-- </template>-->
|
||||
<!-- </el-table-column>-->
|
||||
<!-- <el-table-column-->
|
||||
<!-- align="center"-->
|
||||
<!-- header-align="center"-->
|
||||
<!-- v-for="column in viewTableColumns"-->
|
||||
<!-- show-overflow-tooltip-->
|
||||
<!-- :label="column.label"-->
|
||||
<!-- :prop="column.prop"-->
|
||||
<!-- :sortable="column.sortable"-->
|
||||
<!-- >-->
|
||||
<!-- <template v-if="column.prop==='studyDuration'" scope="{row}">-->
|
||||
<!-- {{(row.studyDuration / 60 / 60).toFixed(2) + 'h'}}-->
|
||||
<!-- </template>-->
|
||||
<!-- </el-table-column>-->
|
||||
<!-- </el-table>-->
|
||||
|
||||
<el-row class="el-pagination-container" style="margin-bottom: 0px">
|
||||
<el-pagination
|
||||
@current-change="(val)=>{viewPageForm.pageNumber=val;viewPageData()}"
|
||||
:current-page="viewPageForm.pageNumber"
|
||||
:page-size="viewPageForm.pageSize"
|
||||
layout="total, sizes, prev, pager, next"
|
||||
:total="viewPageForm.totalCount">
|
||||
</el-pagination>
|
||||
</el-row>
|
||||
<!-- <el-row class="el-pagination-container" style="margin-bottom: 0px">-->
|
||||
<!-- <el-pagination-->
|
||||
<!-- @current-change="(val)=>{viewPageForm.pageNumber=val;viewPageData()}"-->
|
||||
<!-- :current-page="viewPageForm.pageNumber"-->
|
||||
<!-- :page-size="viewPageForm.pageSize"-->
|
||||
<!-- layout="total, sizes, prev, pager, next"-->
|
||||
<!-- :total="viewPageForm.totalCount">-->
|
||||
<!-- </el-pagination>-->
|
||||
<!-- </el-row>-->
|
||||
|
||||
</template>
|
||||
<!-- </template>-->
|
||||
</guava>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
|
||||
<!--#include("/platform/trainEdu/include/include.js"){}#-->
|
||||
|
||||
const vue = new Vue({
|
||||
el: '#app',
|
||||
mixins: [initTableMixins],
|
||||
data() {
|
||||
return {
|
||||
tableColumns: [
|
||||
{prop: 'title', label: '专辑名称'},
|
||||
{prop: 'typeName', label: '类型'},
|
||||
{prop: 'studyNum', label: '已看人数', sortable: true},
|
||||
{prop: 'sumDuration', label: '课程总时长', sortable: true},
|
||||
{prop: 'username', label: '姓名'},
|
||||
{prop: 'loginname', label: '工号'},
|
||||
{prop: 'unitname', label: '单位'},
|
||||
{prop: 'unionname', label: '分工会'},
|
||||
// {prop: 'studyDuration', label: '观看总时长'},
|
||||
{prop: 'watchCount', label: '学习总次数'}
|
||||
],
|
||||
viewTableColumns: [
|
||||
{prop: 'username', label: '姓名'},
|
||||
{prop: 'loginname', label: '工号'},
|
||||
{prop: 'unitname', label: '单位'},
|
||||
{prop: 'unionname', label: '分工会'},
|
||||
{prop: 'studyDuration', label: '观看总时长'},
|
||||
// {prop: 'studyDuration', label: '观看总时长'},
|
||||
{prop: 'watchCount', label: '学习总次数'}
|
||||
],
|
||||
viewPageForm: {
|
||||
pageNumber: 1,
|
||||
@@ -92,7 +126,10 @@ layout("/layouts/platform.html"){
|
||||
totalCount: 0,
|
||||
albumId: null
|
||||
},
|
||||
viewTableData: []
|
||||
viewTableData: [],
|
||||
|
||||
albumList: [],
|
||||
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
@@ -111,12 +148,16 @@ layout("/layouts/platform.html"){
|
||||
viewPageNumberChange(val) {
|
||||
}
|
||||
},
|
||||
created() {
|
||||
this.pageData()
|
||||
async created() {
|
||||
this.albumList = await getAllAlbum()
|
||||
if (this.albumList) {
|
||||
this.pageForm.albumId = this.albumList[0].id
|
||||
await this.pageData()
|
||||
}
|
||||
}
|
||||
})
|
||||
</script>
|
||||
|
||||
<!--#
|
||||
}
|
||||
#-->
|
||||
#-->
|
||||
|
||||
@@ -101,7 +101,7 @@ layout("/layouts/platform.html"){
|
||||
</el-card>
|
||||
|
||||
<template #edit>
|
||||
<el-form :model="formData" :rules="rules" ref="ruleForm" label-width="100px">
|
||||
<el-form :model="formData" :rules="rules" ref="ruleForm" label-width="150px">
|
||||
|
||||
<el-form-item label="所属专辑" prop="albumId">
|
||||
<el-select v-model="formData.albumId" placeholder="请选择专辑" style="width: 100%">
|
||||
@@ -136,6 +136,10 @@ layout("/layouts/platform.html"){
|
||||
<el-input-number :min="1" :max="128" v-model="formData.sortNo"></el-input-number>
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item label="每天最多观看次数" prop="everyDayMaxWatchNum">
|
||||
<el-input-number :min="1" :max="100" v-model="formData.everyDayMaxWatchNum"></el-input-number>
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item label="是否启用" prop="disabled">
|
||||
<el-switch
|
||||
v-model="formData.disabled"
|
||||
|
||||
Reference in New Issue
Block a user