fix bug
This commit is contained in:
@@ -1,5 +1,7 @@
|
||||
package io.v.nutz.mobile.trainEducation;
|
||||
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.wizzer.framework.base.Result;
|
||||
import io.v.nutz.annontation.ViReturn;
|
||||
import io.v.nutz.base.service.BaseService;
|
||||
import io.v.nutz.trainEducation.models.TrainEduVideo;
|
||||
@@ -20,6 +22,8 @@ import org.nutz.mvc.annotation.At;
|
||||
import org.nutz.mvc.annotation.Ok;
|
||||
import org.nutz.mvc.annotation.Param;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
@IocBean
|
||||
@At("/mobile/trainEducation")
|
||||
@Ok("json:full")
|
||||
@@ -70,6 +74,7 @@ public class MTrainEducationController {
|
||||
$condition
|
||||
""");
|
||||
Cnd cnd = Cnd.NEW();
|
||||
cnd.and("tea.disabled", "=", 0);
|
||||
cnd.and(new Static("tea.id = (select albumId from train_edu_video order by createdAt desc LIMIT 0,1)"));
|
||||
sql.setCondition(cnd);
|
||||
sql.setCallback(Sqls.callback.map());
|
||||
@@ -103,6 +108,7 @@ public class MTrainEducationController {
|
||||
$condition
|
||||
""");
|
||||
Cnd cnd = Cnd.NEW();
|
||||
cnd.and("tea.disabled","=",0);
|
||||
cnd.andEX("tea.typeId", "=", typeId);
|
||||
cnd.groupBy("tea.id");
|
||||
sql.setCondition(cnd);
|
||||
@@ -182,28 +188,40 @@ public class MTrainEducationController {
|
||||
@Param(value = "albumId", required = false) String albumId,
|
||||
@Param(value = "currentTime", required = false) long currentTime) {
|
||||
String userId = (String) ShiroUtil.getPrincipalProperty("id");
|
||||
TrainEduVideo video = dao.fetch(TrainEduVideo.class, Cnd.where("id", "=", videoId));
|
||||
TrainEduVideoWatchRecord thisVideoRecord = dao.fetch(TrainEduVideoWatchRecord.class, Cnd.where("userId", "=", userId).and("videoId", "=", videoId));
|
||||
TrainEduVideo video = dao.fetch(TrainEduVideo.class, videoId);
|
||||
// if (video.getEveryDayMaxWatchNum() != null && video.getEveryDayMaxWatchNum() > 0) {
|
||||
// //限制了每天的观看次数
|
||||
// //查询今天的观看次数
|
||||
// int count = dao.count(TrainEduVideoWatchRecord.class, Cnd.where("userId", "=", userId).and("videoId", "=", videoId).and("watchTime", "=", DateUtil.today()));
|
||||
// if (count == video.getEveryDayMaxWatchNum()) {
|
||||
// return Result.error("每天最多只能打卡学习" + video.getEveryDayMaxWatchNum() + "次,明天再来吧!");
|
||||
// }
|
||||
// }
|
||||
|
||||
if(Lang.isNotEmpty(thisVideoRecord) && thisVideoRecord.getFinish()){
|
||||
//已看完的就不要更改了
|
||||
return null;
|
||||
//继续判断是否有未看完的记录
|
||||
Cnd cnd = Cnd.where("userId", "=", userId).and("videoId", "=", videoId).and("finish", "=", 0);
|
||||
if (video.getEveryDayMaxWatchNum() != null && video.getEveryDayMaxWatchNum() > 0) {
|
||||
cnd.and("watchTime", "=", DateUtil.today());
|
||||
}
|
||||
|
||||
if (Lang.isEmpty(thisVideoRecord)) {
|
||||
TrainEduVideoWatchRecord notWatchFinishRecord = dao.fetch(TrainEduVideoWatchRecord.class, cnd);
|
||||
if (Lang.isNotEmpty(notWatchFinishRecord)) {
|
||||
//做更新
|
||||
notWatchFinishRecord.setFinish(video.getFileDuration() == currentTime);
|
||||
notWatchFinishRecord.setWatchDuration(currentTime);
|
||||
dao.update(notWatchFinishRecord, "finish|watchDuration");
|
||||
} else {
|
||||
//新插入一条
|
||||
TrainEduVideoWatchRecord videoWatchRecord = new TrainEduVideoWatchRecord();
|
||||
videoWatchRecord.setVideoId(videoId);
|
||||
videoWatchRecord.setWatchDuration(currentTime);
|
||||
videoWatchRecord.setAlbumId(albumId);
|
||||
videoWatchRecord.setUserId((String) ShiroUtil.getPrincipalProperty("id"));
|
||||
videoWatchRecord.setFinish(video.getFileDuration() == currentTime);
|
||||
videoWatchRecord.setWatchTime(new Date());
|
||||
dao.insert(videoWatchRecord);
|
||||
} else {
|
||||
Chain updateChain = Chain.make("watchDuration", currentTime);
|
||||
updateChain.add("finish", video.getFileDuration() == currentTime ? 1 : 0);
|
||||
Cnd cnd = Cnd.where("userId", "=", userId).and("videoId", "=", videoId);
|
||||
dao.update(TrainEduVideoWatchRecord.class, updateChain, cnd);
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
+50
-15
@@ -1,7 +1,7 @@
|
||||
package io.v.nutz.trainEducation.controller.statistics;
|
||||
|
||||
import cn.wizzer.framework.page.Pagination;
|
||||
import io.v.nutz.annontation.ViReturn;
|
||||
import io.v.nutz.base.page.Pagination;
|
||||
import io.v.nutz.base.service.BaseService;
|
||||
import io.v.nutz.base.utils.Vi;
|
||||
import io.v.nutz.modules.models.PageForm;
|
||||
@@ -12,11 +12,13 @@ import org.nutz.dao.Cnd;
|
||||
import org.nutz.dao.Dao;
|
||||
import org.nutz.dao.Sqls;
|
||||
import org.nutz.dao.sql.Sql;
|
||||
import org.nutz.dao.util.cri.Static;
|
||||
import org.nutz.ioc.loader.annotation.Inject;
|
||||
import org.nutz.ioc.loader.annotation.IocBean;
|
||||
import org.nutz.mvc.annotation.At;
|
||||
import org.nutz.mvc.annotation.Ok;
|
||||
import org.nutz.mvc.annotation.Param;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@@ -44,26 +46,53 @@ public class TrainEduStatisticsVideoController {
|
||||
@At
|
||||
@ViReturn
|
||||
@RequiresPermissions("trainEdu.statistics.video")
|
||||
public Object pageData() {
|
||||
public Object pageData(String albumId, PageForm pageForm) {
|
||||
// Sql sql = Sqls.create("""
|
||||
// SELECT
|
||||
// tea.*,
|
||||
// tet.typeName,
|
||||
// ( SELECT sum( fileDuration ) FROM train_edu_video WHERE albumId = tea.id ) AS sumDuration,
|
||||
// ( SELECT count( DISTINCT ( userid )) FROM train_edu_video_watch_record WHERE albumId = tea.id ) AS studyNum
|
||||
// FROM
|
||||
// train_edu_album tea
|
||||
// LEFT JOIN train_edu_type tet ON tet.id = tea.typeId\s
|
||||
// $condition
|
||||
// """);
|
||||
// Cnd cnd = Cnd.NEW();
|
||||
// if (!ShiroUtil.hasAnyRoles("sysadmin, A06")) {
|
||||
// cnd.and("tea.createType", "=", 1).and("tea.unionId", "=", Vi.getUnionId());
|
||||
// }
|
||||
// sql.setCondition(cnd);
|
||||
// List list = baseService.listMap(sql);
|
||||
// Pagination pagination = new Pagination();
|
||||
// pagination.setList(list);
|
||||
// return pagination;
|
||||
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
tea.*,
|
||||
tet.typeName,
|
||||
( SELECT sum( fileDuration ) FROM train_edu_video WHERE albumId = tea.id ) AS sumDuration,
|
||||
( SELECT count( DISTINCT ( userid )) FROM train_edu_video_watch_record WHERE albumId = tea.id ) AS studyNum
|
||||
u.username,
|
||||
u.loginname,
|
||||
u.unitname,
|
||||
u.unionname,
|
||||
(
|
||||
SELECT
|
||||
SUM(IF( cnt > 2, 2, cnt )) AS count
|
||||
FROM
|
||||
( SELECT watchTime, COUNT( 1 ) AS cnt FROM train_edu_video_watch_record where userId = tevwr.userId and albumId = tevwr.albumId GROUP BY watchTime ) AS subquery
|
||||
) as watchCount
|
||||
|
||||
FROM
|
||||
train_edu_album tea
|
||||
LEFT JOIN train_edu_type tet ON tet.id = tea.typeId\s
|
||||
`train_edu_video_watch_record` tevwr
|
||||
LEFT JOIN train_edu_album tea on tea.id = tevwr.albumId
|
||||
LEFT JOIN `user` u ON u.id = tevwr.userId
|
||||
$condition
|
||||
""");
|
||||
Cnd cnd = Cnd.NEW();
|
||||
if(!ShiroUtil.hasAnyRoles("sysadmin, A06")) {
|
||||
cnd.and("tea.createType", "=", 1).and("tea.unionId", "=", Vi.getUnionId());
|
||||
}
|
||||
cnd.and("tevwr.albumId", "=", albumId);
|
||||
cnd.and(new Static("IF(tea.createType = 1, u.unionId = tea.unionId , 1=1)"));
|
||||
cnd.groupBy("tevwr.userId");
|
||||
sql.setCondition(cnd);
|
||||
List list = baseService.listMap(sql);
|
||||
Pagination pagination = new Pagination();
|
||||
pagination.setList(list);
|
||||
Pagination pagination = baseService.listPageMap(pageForm.getPageNumber(), pageForm.getPageSize(), sql);
|
||||
return pagination;
|
||||
}
|
||||
|
||||
@@ -86,7 +115,13 @@ public class TrainEduStatisticsVideoController {
|
||||
u.loginname,
|
||||
u.unitname,
|
||||
u.unionname,
|
||||
sum( tevwr.watchDuration ) AS studyDuration
|
||||
(
|
||||
SELECT
|
||||
SUM(IF( cnt > 2, 2, cnt )) AS count
|
||||
FROM
|
||||
( SELECT watchTime, COUNT( 1 ) AS cnt FROM train_edu_video_watch_record where userId = tevwr.userId and albumId = tevwr.albumId GROUP BY watchTime ) AS subquery
|
||||
) as watchCount
|
||||
|
||||
FROM
|
||||
`train_edu_video_watch_record` tevwr
|
||||
LEFT JOIN train_edu_album tea on tea.id = tevwr.albumId
|
||||
|
||||
@@ -57,4 +57,9 @@ public class TrainEduAlbum {
|
||||
@Comment("单位id")
|
||||
private String unitId;
|
||||
|
||||
@Column
|
||||
@ColDefine(type = ColType.BOOLEAN)
|
||||
@Comment("是否禁用")
|
||||
private Boolean disabled;
|
||||
|
||||
}
|
||||
|
||||
@@ -9,6 +9,7 @@ import org.nutz.dao.interceptor.annotation.PrevInsert;
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@Table
|
||||
@Data
|
||||
@Comment("教育培训视频")
|
||||
public class TrainEduVideo extends BaseModel {
|
||||
|
||||
@Name
|
||||
@@ -43,12 +44,12 @@ public class TrainEduVideo extends BaseModel {
|
||||
@Column
|
||||
@ColDefine(type = ColType.INT)
|
||||
@Comment("排序编号")
|
||||
private int sortNo;
|
||||
private Integer sortNo;
|
||||
|
||||
@Column
|
||||
@Comment("是否禁用")
|
||||
@ColDefine(type = ColType.BOOLEAN)
|
||||
private boolean disabled;
|
||||
private Boolean disabled;
|
||||
|
||||
@Column
|
||||
@Comment("视频大小")
|
||||
@@ -59,4 +60,9 @@ public class TrainEduVideo extends BaseModel {
|
||||
@Comment("视频时常")
|
||||
private Long fileDuration;
|
||||
|
||||
@Column
|
||||
@Comment("每天最多观看次数")
|
||||
@ColDefine(type = ColType.INT)
|
||||
private Integer everyDayMaxWatchNum;
|
||||
|
||||
}
|
||||
|
||||
@@ -1,14 +1,25 @@
|
||||
package io.v.nutz.trainEducation.models;
|
||||
|
||||
import io.v.nutz.base.model.BaseModel;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import org.nutz.dao.entity.annotation.*;
|
||||
import org.nutz.dao.interceptor.annotation.PrevInsert;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* 视频播放记录
|
||||
*/
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@Table
|
||||
@Data
|
||||
public class TrainEduVideoWatchRecord {
|
||||
@Comment("教育培训学习记录")
|
||||
public class TrainEduVideoWatchRecord extends BaseModel {
|
||||
|
||||
@Name
|
||||
@PrevInsert(uu32 = true)
|
||||
private String id;
|
||||
|
||||
@Column
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
@@ -34,4 +45,9 @@ public class TrainEduVideoWatchRecord {
|
||||
@Comment("是否看完")
|
||||
private Boolean finish;
|
||||
|
||||
@Column
|
||||
@ColDefine(type = ColType.DATE)
|
||||
@Comment("观看日期")
|
||||
private Date watchTime;
|
||||
|
||||
}
|
||||
|
||||
@@ -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