commit
d7934d6197
@ -1,11 +1,13 @@
|
||||
package com.stdiet.web.controller;
|
||||
|
||||
import com.stdiet.common.config.AliyunOSSConfig;
|
||||
import com.stdiet.common.core.domain.AjaxResult;
|
||||
import com.stdiet.common.core.domain.entity.SysUser;
|
||||
import com.stdiet.common.utils.StringUtils;
|
||||
import com.stdiet.common.utils.oss.AliyunOSSUtils;
|
||||
import com.stdiet.common.utils.poi.ExcelUtil;
|
||||
import com.stdiet.custom.domain.SysNutritionQuestion;
|
||||
import com.stdiet.custom.domain.SysNutritionalVideo;
|
||||
import com.stdiet.custom.domain.SysWxUserInfo;
|
||||
import com.stdiet.custom.domain.SysWxUserLog;
|
||||
import com.stdiet.custom.mapper.SysCustomerPhysicalSignsMapper;
|
||||
@ -13,6 +15,7 @@ import com.stdiet.custom.mapper.SysNutritionQuestionMapper;
|
||||
import com.stdiet.custom.mapper.SysWxUserInfoMapper;
|
||||
import com.stdiet.custom.mapper.SysWxUserLogMapper;
|
||||
import com.stdiet.custom.service.ISysNutritionQuestionService;
|
||||
import com.stdiet.custom.service.ISysNutritionalVideoService;
|
||||
import com.stdiet.custom.service.ISysWxUserLogService;
|
||||
import com.stdiet.custom.utils.LuceneIndexUtils;
|
||||
import com.stdiet.framework.web.domain.server.Sys;
|
||||
@ -28,6 +31,7 @@ import org.springframework.stereotype.Component;
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@Component
|
||||
@Order(value = 1)
|
||||
@ -42,6 +46,9 @@ public class MyApplicationRunner implements ApplicationRunner {
|
||||
@Autowired
|
||||
private ISysNutritionQuestionService sysNutritionQuestionService;
|
||||
|
||||
@Autowired
|
||||
private ISysNutritionalVideoService sysNutritionalVideoService;
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
@ -105,4 +112,19 @@ public class MyApplicationRunner implements ApplicationRunner {
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public void updateVideo(){
|
||||
Map<String, Object> map = sysNutritionalVideoService.searchVideo(null, null, 1,100, null);
|
||||
if(map != null){
|
||||
List<SysNutritionalVideo> list = (List<SysNutritionalVideo>)map.get("nutritionalVideoList");
|
||||
if(list != null && list.size() > 0){
|
||||
for (SysNutritionalVideo video : list) {
|
||||
sysNutritionalVideoService.insertSysNutritionalVideo(video);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
@ -23,7 +23,7 @@ public class SysFileUploadController extends BaseController {
|
||||
* 上传文件到OSS返回URL
|
||||
*/
|
||||
@PostMapping(value = "/{prefix}")
|
||||
@PreAuthorize("@ss.hasPermi('custom:file:upload')")
|
||||
//@PreAuthorize("@ss.hasPermi('custom:file:upload')")
|
||||
public AjaxResult uploadCseFile(MultipartFile file, @PathVariable String prefix) throws Exception {
|
||||
|
||||
try {
|
||||
|
@ -2,11 +2,11 @@ package com.stdiet.web.controller.custom;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import com.aliyun.vod20170321.models.CreateUploadVideoResponse;
|
||||
import com.aliyun.vod20170321.models.GetVideoListResponseBody;
|
||||
import com.stdiet.common.core.page.TableDataInfo;
|
||||
import com.stdiet.common.utils.AliyunVideoUtils;
|
||||
import com.stdiet.common.utils.oss.AliyunOSSUtils;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
@ -35,15 +35,18 @@ public class SysNutritionalVideoController extends BaseController
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('custom:nutritionalVideo:list')")
|
||||
@GetMapping("/list")
|
||||
public AjaxResult list(SysNutritionalVideo sysNutritionalVideo, @RequestParam(value = "pageNum", defaultValue = "1") int pageNum, @RequestParam(value = "pageSize", defaultValue = "5")int pageSize)
|
||||
public TableDataInfo list(SysNutritionalVideo sysNutritionalVideo)
|
||||
{
|
||||
AjaxResult result = AjaxResult.success();
|
||||
/*AjaxResult result = AjaxResult.success();
|
||||
Map<String, Object> map = sysNutritionalVideoService.searchVideo(sysNutritionalVideo.getKey(), sysNutritionalVideo.getShowFlag(), pageNum, pageSize, null);
|
||||
if(map != null){
|
||||
result.put("total", map.get("total"));
|
||||
result.put("rows", map.get("nutritionalVideoList"));
|
||||
}
|
||||
return result;
|
||||
return result;*/
|
||||
startPage();
|
||||
List<SysNutritionalVideo> list = sysNutritionalVideoService.selectSysNutritionalVideoList(sysNutritionalVideo, true);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -64,6 +67,7 @@ public class SysNutritionalVideoController extends BaseController
|
||||
@PostMapping
|
||||
public AjaxResult add(@RequestBody SysNutritionalVideo sysNutritionalVideo)
|
||||
{
|
||||
sysNutritionalVideo.setShowFlag(1);
|
||||
return toAjax(sysNutritionalVideoService.insertSysNutritionalVideo(sysNutritionalVideo));
|
||||
}
|
||||
|
||||
@ -77,7 +81,7 @@ public class SysNutritionalVideoController extends BaseController
|
||||
{
|
||||
AjaxResult result = AjaxResult.error();
|
||||
try {
|
||||
CreateUploadVideoResponse response = AliyunVideoUtils.createUploadVideoRequest(sysNutritionalVideo.getCateId(), sysNutritionalVideo.getFileName(), sysNutritionalVideo.getTitle(), sysNutritionalVideo.getCoverUrl(), sysNutritionalVideo.getTags(), sysNutritionalVideo.getDescription());
|
||||
CreateUploadVideoResponse response = AliyunVideoUtils.createUploadVideoRequest(null, sysNutritionalVideo.getFileName(), sysNutritionalVideo.getTitle(), null, sysNutritionalVideo.getTags(), sysNutritionalVideo.getDescription());
|
||||
if(response != null){
|
||||
result = AjaxResult.success();
|
||||
result.put("uploadAuth", response.body);
|
||||
|
@ -0,0 +1,113 @@
|
||||
package com.stdiet.web.controller.custom;
|
||||
|
||||
import java.util.List;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.PutMapping;
|
||||
import org.springframework.web.bind.annotation.DeleteMapping;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import com.stdiet.common.annotation.Log;
|
||||
import com.stdiet.common.core.controller.BaseController;
|
||||
import com.stdiet.common.core.domain.AjaxResult;
|
||||
import com.stdiet.common.enums.BusinessType;
|
||||
import com.stdiet.custom.domain.SysVideoClassify;
|
||||
import com.stdiet.custom.service.ISysVideoClassifyService;
|
||||
import com.stdiet.common.utils.poi.ExcelUtil;
|
||||
import com.stdiet.common.core.page.TableDataInfo;
|
||||
|
||||
/**
|
||||
* 视频分类Controller
|
||||
*
|
||||
* @author xzj
|
||||
* @date 2021-05-05
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/custom/videoClassify")
|
||||
public class SysVideoClassifyController extends BaseController
|
||||
{
|
||||
@Autowired
|
||||
private ISysVideoClassifyService sysVideoClassifyService;
|
||||
|
||||
/**
|
||||
* 查询视频分类列表
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('custom:videoClassify:list')")
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo list(SysVideoClassify sysVideoClassify)
|
||||
{
|
||||
startPage();
|
||||
List<SysVideoClassify> list = sysVideoClassifyService.selectSysVideoClassifyList(sysVideoClassify);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出视频分类列表
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('custom:videoClassify:export')")
|
||||
@Log(title = "视频分类", businessType = BusinessType.EXPORT)
|
||||
@GetMapping("/export")
|
||||
public AjaxResult export(SysVideoClassify sysVideoClassify)
|
||||
{
|
||||
List<SysVideoClassify> list = sysVideoClassifyService.selectSysVideoClassifyList(sysVideoClassify);
|
||||
ExcelUtil<SysVideoClassify> util = new ExcelUtil<SysVideoClassify>(SysVideoClassify.class);
|
||||
return util.exportExcel(list, "videoClassify");
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取视频分类详细信息
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('custom:videoClassify:query')")
|
||||
@GetMapping(value = "/{id}")
|
||||
public AjaxResult getInfo(@PathVariable("id") Long id)
|
||||
{
|
||||
return AjaxResult.success(sysVideoClassifyService.selectSysVideoClassifyById(id));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增视频分类
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('custom:videoClassify:add')")
|
||||
@Log(title = "视频分类", businessType = BusinessType.INSERT)
|
||||
@PostMapping
|
||||
public AjaxResult add(@RequestBody SysVideoClassify sysVideoClassify)
|
||||
{
|
||||
return toAjax(sysVideoClassifyService.insertSysVideoClassify(sysVideoClassify));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改视频分类
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('custom:videoClassify:edit')")
|
||||
@Log(title = "视频分类", businessType = BusinessType.UPDATE)
|
||||
@PutMapping
|
||||
public AjaxResult edit(@RequestBody SysVideoClassify sysVideoClassify)
|
||||
{
|
||||
return toAjax(sysVideoClassifyService.updateSysVideoClassify(sysVideoClassify));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除视频分类
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('custom:videoClassify:remove')")
|
||||
@Log(title = "视频分类", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{ids}")
|
||||
public AjaxResult remove(@PathVariable Long[] ids)
|
||||
{
|
||||
return toAjax(sysVideoClassifyService.deleteSysVideoClassifyByIds(ids));
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询视频分类列表
|
||||
*/
|
||||
@GetMapping("/getAllClassify")
|
||||
public AjaxResult getAllClassify()
|
||||
{
|
||||
List<SysVideoClassify> list = sysVideoClassifyService.getAllClassify();
|
||||
return AjaxResult.success(list);
|
||||
}
|
||||
}
|
@ -366,12 +366,16 @@ public class WechatAppletController extends BaseController {
|
||||
* 获取视频列表
|
||||
*/
|
||||
@GetMapping(value = "/getVideoList")
|
||||
public AjaxResult getVideoList(SysNutritionalVideo sysNutritionalVideo, @RequestParam(value = "pageNum", defaultValue = "1") int pageNum, @RequestParam(value = "pageSize", defaultValue = "5")int pageSize) {
|
||||
AjaxResult result = AjaxResult.success();
|
||||
public TableDataInfo getVideoList(SysNutritionalVideo sysNutritionalVideo) {
|
||||
/* AjaxResult result = AjaxResult.success();
|
||||
Map<String, Object> map = sysNutritionalVideoService.searchVideo(sysNutritionalVideo.getKey(), 1, pageNum, pageSize, null);
|
||||
result.put("total", map.get("total"));
|
||||
result.put("rows", map.get("nutritionalVideoList"));
|
||||
return result;
|
||||
return result;*/
|
||||
startPage();
|
||||
sysNutritionalVideo.setShowFlag(1);
|
||||
List<SysNutritionalVideo> list = sysNutritionalVideoService.selectSysNutritionalVideoList(sysNutritionalVideo, true);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
|
||||
|
@ -137,6 +137,7 @@ public class AliyunVideoUtils {
|
||||
.setFields(search_field)
|
||||
.setPageNo(pageNo == null ? 1 : pageNo)
|
||||
.setPageSize(pageSize == null ? 10 : pageSize)
|
||||
.setSortBy("CateId:Asc,CreationTime:Desc")
|
||||
.setScrollToken(scrollToken);
|
||||
if(StringUtils.isNotEmpty(key) || StringUtils.isNotEmpty(status)){
|
||||
String matchString = null;
|
||||
|
@ -22,6 +22,8 @@ public class SysNutritionalVideo extends BaseEntity
|
||||
@Excel(name = "视频分类ID")
|
||||
private Long cateId;
|
||||
|
||||
private String cateName;
|
||||
|
||||
/** 阿里云视频ID */
|
||||
@Excel(name = "阿里云视频ID")
|
||||
private String videoId;
|
||||
@ -50,6 +52,16 @@ public class SysNutritionalVideo extends BaseEntity
|
||||
@Excel(name = "是否显示,0不显示 1显示,默认0")
|
||||
private Integer showFlag;
|
||||
|
||||
/** 优先级,默认0 */
|
||||
@Excel(name = "优先级,默认0")
|
||||
private Long priorityLevel;
|
||||
|
||||
/** 视频付费等级,0无需付费 1客户可看 2付费可看 */
|
||||
@Excel(name = "视频付费等级,0无需付费 1客户可看 2付费可看")
|
||||
private Long payLevel;
|
||||
|
||||
private String payLevelName;
|
||||
|
||||
/** 删除标识,0未删除 1已删除,默认0 */
|
||||
private Integer delFlag;
|
||||
|
||||
|
@ -0,0 +1,33 @@
|
||||
package com.stdiet.custom.domain;
|
||||
|
||||
import lombok.Data;
|
||||
import org.apache.commons.lang3.builder.ToStringBuilder;
|
||||
import org.apache.commons.lang3.builder.ToStringStyle;
|
||||
import com.stdiet.common.annotation.Excel;
|
||||
import com.stdiet.common.core.domain.BaseEntity;
|
||||
|
||||
/**
|
||||
* 视频分类对象 sys_video_classify
|
||||
*
|
||||
* @author xzj
|
||||
* @date 2021-05-05
|
||||
*/
|
||||
@Data
|
||||
public class SysVideoClassify extends BaseEntity
|
||||
{
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/** $column.columnComment */
|
||||
private Long id;
|
||||
|
||||
/** 分类名称 */
|
||||
@Excel(name = "分类名称")
|
||||
private String cateName;
|
||||
|
||||
/** 类型标识,0全部可看 1客户可看 2额外付费观看 */
|
||||
@Excel(name = "类型标识,0全部可看 1客户可看 2额外付费观看")
|
||||
private Integer payFlag;
|
||||
|
||||
/** 删除标识 0未删除 1已删除 */
|
||||
private Integer delFlag;
|
||||
}
|
@ -0,0 +1,67 @@
|
||||
package com.stdiet.custom.mapper;
|
||||
|
||||
import java.util.List;
|
||||
import com.stdiet.custom.domain.SysVideoClassify;
|
||||
|
||||
/**
|
||||
* 视频分类Mapper接口
|
||||
*
|
||||
* @author xzj
|
||||
* @date 2021-05-05
|
||||
*/
|
||||
public interface SysVideoClassifyMapper
|
||||
{
|
||||
/**
|
||||
* 查询视频分类
|
||||
*
|
||||
* @param id 视频分类ID
|
||||
* @return 视频分类
|
||||
*/
|
||||
public SysVideoClassify selectSysVideoClassifyById(Long id);
|
||||
|
||||
/**
|
||||
* 查询视频分类列表
|
||||
*
|
||||
* @param sysVideoClassify 视频分类
|
||||
* @return 视频分类集合
|
||||
*/
|
||||
public List<SysVideoClassify> selectSysVideoClassifyList(SysVideoClassify sysVideoClassify);
|
||||
|
||||
/**
|
||||
* 新增视频分类
|
||||
*
|
||||
* @param sysVideoClassify 视频分类
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertSysVideoClassify(SysVideoClassify sysVideoClassify);
|
||||
|
||||
/**
|
||||
* 修改视频分类
|
||||
*
|
||||
* @param sysVideoClassify 视频分类
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateSysVideoClassify(SysVideoClassify sysVideoClassify);
|
||||
|
||||
/**
|
||||
* 删除视频分类
|
||||
*
|
||||
* @param id 视频分类ID
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteSysVideoClassifyById(Long id);
|
||||
|
||||
/**
|
||||
* 批量删除视频分类
|
||||
*
|
||||
* @param ids 需要删除的数据ID
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteSysVideoClassifyByIds(Long[] ids);
|
||||
|
||||
/**
|
||||
* 获取所有类别
|
||||
* @return
|
||||
*/
|
||||
public List<SysVideoClassify> getAllClassify();
|
||||
}
|
@ -27,7 +27,7 @@ public interface ISysNutritionalVideoService
|
||||
* @param sysNutritionalVideo 营养视频
|
||||
* @return 营养视频集合
|
||||
*/
|
||||
public List<SysNutritionalVideo> selectSysNutritionalVideoList(SysNutritionalVideo sysNutritionalVideo);
|
||||
public List<SysNutritionalVideo> selectSysNutritionalVideoList(SysNutritionalVideo sysNutritionalVideo, boolean flag);
|
||||
|
||||
/**
|
||||
* 新增营养视频
|
||||
|
@ -0,0 +1,67 @@
|
||||
package com.stdiet.custom.service;
|
||||
|
||||
import java.util.List;
|
||||
import com.stdiet.custom.domain.SysVideoClassify;
|
||||
|
||||
/**
|
||||
* 视频分类Service接口
|
||||
*
|
||||
* @author xzj
|
||||
* @date 2021-05-05
|
||||
*/
|
||||
public interface ISysVideoClassifyService
|
||||
{
|
||||
/**
|
||||
* 查询视频分类
|
||||
*
|
||||
* @param id 视频分类ID
|
||||
* @return 视频分类
|
||||
*/
|
||||
public SysVideoClassify selectSysVideoClassifyById(Long id);
|
||||
|
||||
/**
|
||||
* 查询视频分类列表
|
||||
*
|
||||
* @param sysVideoClassify 视频分类
|
||||
* @return 视频分类集合
|
||||
*/
|
||||
public List<SysVideoClassify> selectSysVideoClassifyList(SysVideoClassify sysVideoClassify);
|
||||
|
||||
/**
|
||||
* 新增视频分类
|
||||
*
|
||||
* @param sysVideoClassify 视频分类
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertSysVideoClassify(SysVideoClassify sysVideoClassify);
|
||||
|
||||
/**
|
||||
* 修改视频分类
|
||||
*
|
||||
* @param sysVideoClassify 视频分类
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateSysVideoClassify(SysVideoClassify sysVideoClassify);
|
||||
|
||||
/**
|
||||
* 批量删除视频分类
|
||||
*
|
||||
* @param ids 需要删除的视频分类ID
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteSysVideoClassifyByIds(Long[] ids);
|
||||
|
||||
/**
|
||||
* 删除视频分类信息
|
||||
*
|
||||
* @param id 视频分类ID
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteSysVideoClassifyById(Long id);
|
||||
|
||||
/**
|
||||
* 获取所有类别
|
||||
* @return
|
||||
*/
|
||||
public List<SysVideoClassify> getAllClassify();
|
||||
}
|
@ -296,7 +296,7 @@ public class SysCommissionDayServiceImpl implements ISysCommissionDayService {
|
||||
//该笔订单当月的成交总额
|
||||
sysOrderCommisionDayDetail.setMonthOrderTotalAmount(everyMonthTotalAmountMap.get(yearMonth));
|
||||
//该笔订单对应提成比例
|
||||
sysOrderCommisionDayDetail.setCommissionRate(rateMap.get(yearMonth));
|
||||
sysOrderCommisionDayDetail.setCommissionRate(rateMap.get(yearMonth) == null ? rateMap.get("190001") : rateMap.get(yearMonth));
|
||||
//计算该笔订单总提成
|
||||
sysOrderCommisionDayDetail.setOrderCommission(getMoney(sysOrderCommisionDayDetail.getOrderAmount().doubleValue() * sysOrderCommisionDayDetail.getCommissionRate() / 100D));
|
||||
//每年每月提成
|
||||
@ -357,6 +357,8 @@ public class SysCommissionDayServiceImpl implements ISysCommissionDayService {
|
||||
tmpQueryCom.setPostId(postId);
|
||||
List<SysCommision> tmpComList = sysCommisionMapper.selectSysCommisionList(tmpQueryCom);
|
||||
Map<String, Float> rateMap = new TreeMap<>(new MyComparator());
|
||||
//取第一个区间为默认提成比例
|
||||
rateMap.put("190001", (tmpComList != null && tmpComList.size() > 0) ? tmpComList.get(0).getRate() : 0.0F);
|
||||
for(String yearMonth : amountMap.keySet()){
|
||||
BigDecimal orderAmount = amountMap.get(yearMonth);
|
||||
rateMap.put(yearMonth, 0F);
|
||||
|
@ -9,6 +9,7 @@ import com.aliyun.vod20170321.models.SearchMediaResponse;
|
||||
import com.aliyun.vod20170321.models.SearchMediaResponseBody;
|
||||
import com.stdiet.common.utils.AliyunVideoUtils;
|
||||
import com.stdiet.common.utils.DateUtils;
|
||||
import com.stdiet.common.utils.oss.AliyunOSSUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import com.stdiet.custom.mapper.SysNutritionalVideoMapper;
|
||||
@ -46,9 +47,24 @@ public class SysNutritionalVideoServiceImpl implements ISysNutritionalVideoServi
|
||||
* @return 营养视频
|
||||
*/
|
||||
@Override
|
||||
public List<SysNutritionalVideo> selectSysNutritionalVideoList(SysNutritionalVideo sysNutritionalVideo)
|
||||
public List<SysNutritionalVideo> selectSysNutritionalVideoList(SysNutritionalVideo sysNutritionalVideo, boolean flag)
|
||||
{
|
||||
return sysNutritionalVideoMapper.selectSysNutritionalVideoList(sysNutritionalVideo);
|
||||
List<SysNutritionalVideo> list = sysNutritionalVideoMapper.selectSysNutritionalVideoList(sysNutritionalVideo);
|
||||
if(flag && list != null && list.size() > 0){
|
||||
List<String> fileUrl = new ArrayList<>();
|
||||
for (SysNutritionalVideo video : list) {
|
||||
fileUrl.add(video.getCoverUrl());
|
||||
}
|
||||
List<String> downUrlList = AliyunOSSUtils.generatePresignedUrl(fileUrl);
|
||||
if(downUrlList != null && downUrlList.size() > 0){
|
||||
int index = 0;
|
||||
for (String downUrl : downUrlList) {
|
||||
list.get(index).setCoverUrl(downUrl);
|
||||
index++;
|
||||
}
|
||||
}
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -133,8 +149,7 @@ public class SysNutritionalVideoServiceImpl implements ISysNutritionalVideoServi
|
||||
sysNutritionalVideo.setCoverUrl(media.video.coverURL);
|
||||
sysNutritionalVideo.setShowFlag(getStatus(media.video.getStatus()));
|
||||
sysNutritionalVideo.setTags(media.video.tags);
|
||||
String createTime = media.video.creationTime;
|
||||
System.out.println(createTime);
|
||||
//String createTime = media.video.creationTime;
|
||||
sysNutritionalVideo.setDescription(media.video.description);
|
||||
sysNutritionalVideo.setVideoId(media.video.videoId);
|
||||
nutritionalVideoList.add(sysNutritionalVideo);
|
||||
|
@ -0,0 +1,105 @@
|
||||
package com.stdiet.custom.service.impl;
|
||||
|
||||
import java.util.List;
|
||||
import com.stdiet.common.utils.DateUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import com.stdiet.custom.mapper.SysVideoClassifyMapper;
|
||||
import com.stdiet.custom.domain.SysVideoClassify;
|
||||
import com.stdiet.custom.service.ISysVideoClassifyService;
|
||||
|
||||
/**
|
||||
* 视频分类Service业务层处理
|
||||
*
|
||||
* @author xzj
|
||||
* @date 2021-05-05
|
||||
*/
|
||||
@Service
|
||||
public class SysVideoClassifyServiceImpl implements ISysVideoClassifyService
|
||||
{
|
||||
@Autowired
|
||||
private SysVideoClassifyMapper sysVideoClassifyMapper;
|
||||
|
||||
/**
|
||||
* 查询视频分类
|
||||
*
|
||||
* @param id 视频分类ID
|
||||
* @return 视频分类
|
||||
*/
|
||||
@Override
|
||||
public SysVideoClassify selectSysVideoClassifyById(Long id)
|
||||
{
|
||||
return sysVideoClassifyMapper.selectSysVideoClassifyById(id);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询视频分类列表
|
||||
*
|
||||
* @param sysVideoClassify 视频分类
|
||||
* @return 视频分类
|
||||
*/
|
||||
@Override
|
||||
public List<SysVideoClassify> selectSysVideoClassifyList(SysVideoClassify sysVideoClassify)
|
||||
{
|
||||
return sysVideoClassifyMapper.selectSysVideoClassifyList(sysVideoClassify);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增视频分类
|
||||
*
|
||||
* @param sysVideoClassify 视频分类
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int insertSysVideoClassify(SysVideoClassify sysVideoClassify)
|
||||
{
|
||||
sysVideoClassify.setCreateTime(DateUtils.getNowDate());
|
||||
return sysVideoClassifyMapper.insertSysVideoClassify(sysVideoClassify);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改视频分类
|
||||
*
|
||||
* @param sysVideoClassify 视频分类
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int updateSysVideoClassify(SysVideoClassify sysVideoClassify)
|
||||
{
|
||||
sysVideoClassify.setUpdateTime(DateUtils.getNowDate());
|
||||
return sysVideoClassifyMapper.updateSysVideoClassify(sysVideoClassify);
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除视频分类
|
||||
*
|
||||
* @param ids 需要删除的视频分类ID
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deleteSysVideoClassifyByIds(Long[] ids)
|
||||
{
|
||||
return sysVideoClassifyMapper.deleteSysVideoClassifyByIds(ids);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除视频分类信息
|
||||
*
|
||||
* @param id 视频分类ID
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deleteSysVideoClassifyById(Long id)
|
||||
{
|
||||
return sysVideoClassifyMapper.deleteSysVideoClassifyById(id);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取所有类别
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public List<SysVideoClassify> getAllClassify(){
|
||||
return sysVideoClassifyMapper.getAllClassify();
|
||||
}
|
||||
}
|
@ -14,22 +14,39 @@
|
||||
<result property="videoSize" column="video_size" />
|
||||
<result property="tags" column="tags" />
|
||||
<result property="showFlag" column="show_flag" />
|
||||
<result property="priorityLevel" column="priority_level" />
|
||||
<result property="payLevel" column="pay_level" />
|
||||
<result property="createTime" column="create_time" />
|
||||
<result property="createBy" column="create_by" />
|
||||
<result property="updateTime" column="update_time" />
|
||||
<result property="updateBy" column="update_by" />
|
||||
<result property="delFlag" column="del_flag" />
|
||||
|
||||
<result property="payLevelName" column="pay_level_name"></result>
|
||||
<result property="cateName" column="cate_name"></result>
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectSysNutritionalVideoVo">
|
||||
select id, cate_id, video_id, cover_url, title, description, video_size, tags, show_flag, create_time, create_by, update_time, update_by, del_flag from sys_nutritional_video
|
||||
select id, cate_id, video_id, cover_url, title, description, priority_level,pay_level,video_size, tags, show_flag, create_time, create_by, update_time, update_by, del_flag from sys_nutritional_video
|
||||
</sql>
|
||||
|
||||
<select id="selectSysNutritionalVideoList" parameterType="SysNutritionalVideo" resultMap="SysNutritionalVideoResult">
|
||||
<include refid="selectSysNutritionalVideoVo"/> where del_flag = 0
|
||||
select snv.id, snv.cate_id, snv.video_id, snv.cover_url, snv.title, snv.description, snv.priority_level,snv.pay_level,snv.video_size, snv.tags, snv.show_flag, snv.create_time,
|
||||
pay.dict_label as pay_level_name, svc.cate_name
|
||||
from sys_nutritional_video snv
|
||||
left join (SELECT dict_label, dict_value FROM sys_dict_data WHERE dict_type = 'video_pay_level') AS pay ON pay.dict_value = snv.pay_level
|
||||
left join sys_video_classify svc on svc.id = snv.cate_id and svc.del_flag = 0
|
||||
where snv.del_flag = 0
|
||||
<if test="showFlag != null">
|
||||
and show_flag = #{showFlag}
|
||||
and snv.show_flag = #{showFlag}
|
||||
</if>
|
||||
<if test="cateId != null">
|
||||
and snv.cate_id = #{cateId}
|
||||
</if>
|
||||
<if test="key != null and key != ''">
|
||||
and (snv.title like concat('%',#{key},'%') or snv.description like concat('%',#{key},'%'))
|
||||
</if>
|
||||
order by snv.priority_level DESC,snv.create_time DESC
|
||||
</select>
|
||||
|
||||
<select id="selectSysNutritionalVideoById" parameterType="Long" resultMap="SysNutritionalVideoResult">
|
||||
@ -48,8 +65,10 @@
|
||||
<if test="videoSize != null">video_size,</if>
|
||||
<if test="tags != null">tags,</if>
|
||||
<if test="showFlag != null">show_flag,</if>
|
||||
<if test="priorityLevel != null">priority_level,</if>
|
||||
<if test="createTime != null">create_time,</if>
|
||||
<if test="createBy != null">create_by,</if>
|
||||
<if test="payLevel != null">pay_level,</if>
|
||||
<if test="updateTime != null">update_time,</if>
|
||||
<if test="updateBy != null">update_by,</if>
|
||||
<if test="delFlag != null">del_flag,</if>
|
||||
@ -63,8 +82,10 @@
|
||||
<if test="videoSize != null">#{videoSize},</if>
|
||||
<if test="tags != null">#{tags},</if>
|
||||
<if test="showFlag != null">#{showFlag},</if>
|
||||
<if test="priorityLevel != null">#{priorityLevel},</if>
|
||||
<if test="createTime != null">#{createTime},</if>
|
||||
<if test="createBy != null">#{createBy},</if>
|
||||
<if test="payLevel != null">#{payLevel},</if>
|
||||
<if test="updateTime != null">#{updateTime},</if>
|
||||
<if test="updateBy != null">#{updateBy},</if>
|
||||
<if test="delFlag != null">#{delFlag},</if>
|
||||
@ -82,8 +103,10 @@
|
||||
<if test="videoSize != null">video_size = #{videoSize},</if>
|
||||
<if test="tags != null">tags = #{tags},</if>
|
||||
<if test="showFlag != null">show_flag = #{showFlag},</if>
|
||||
<if test="priorityLevel != null">priority_level = #{priorityLevel},</if>
|
||||
<if test="createTime != null">create_time = #{createTime},</if>
|
||||
<if test="createBy != null">create_by = #{createBy},</if>
|
||||
<if test="payLevel != null">pay_level = #{payLevel},</if>
|
||||
<if test="updateTime != null">update_time = #{updateTime},</if>
|
||||
<if test="updateBy != null">update_by = #{updateBy},</if>
|
||||
<if test="delFlag != null">del_flag = #{delFlag},</if>
|
||||
|
@ -0,0 +1,85 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<!DOCTYPE mapper
|
||||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.stdiet.custom.mapper.SysVideoClassifyMapper">
|
||||
|
||||
<resultMap type="SysVideoClassify" id="SysVideoClassifyResult">
|
||||
<result property="id" column="id" />
|
||||
<result property="cateName" column="cate_name" />
|
||||
<result property="payFlag" column="pay_flag" />
|
||||
<result property="createTime" column="create_time" />
|
||||
<result property="createBy" column="create_by" />
|
||||
<result property="updateTime" column="update_time" />
|
||||
<result property="updateBy" column="update_by" />
|
||||
<result property="delFlag" column="del_flag" />
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectSysVideoClassifyVo">
|
||||
select id, cate_name, pay_flag, create_time, create_by, update_time, update_by, del_flag from sys_video_classify
|
||||
</sql>
|
||||
|
||||
<select id="selectSysVideoClassifyList" parameterType="SysVideoClassify" resultMap="SysVideoClassifyResult">
|
||||
<include refid="selectSysVideoClassifyVo"/>
|
||||
where del_flag = 0
|
||||
</select>
|
||||
|
||||
<select id="selectSysVideoClassifyById" parameterType="Long" resultMap="SysVideoClassifyResult">
|
||||
<include refid="selectSysVideoClassifyVo"/>
|
||||
where id = #{id} and del_flag = 0
|
||||
</select>
|
||||
|
||||
<insert id="insertSysVideoClassify" parameterType="SysVideoClassify">
|
||||
insert into sys_video_classify
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="id != null">id,</if>
|
||||
<if test="cateName != null">cate_name,</if>
|
||||
<if test="payFlag != null">pay_flag,</if>
|
||||
<if test="createTime != null">create_time,</if>
|
||||
<if test="createBy != null">create_by,</if>
|
||||
<if test="updateTime != null">update_time,</if>
|
||||
<if test="updateBy != null">update_by,</if>
|
||||
<if test="delFlag != null">del_flag,</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="id != null">#{id},</if>
|
||||
<if test="cateName != null">#{cateName},</if>
|
||||
<if test="payFlag != null">#{payFlag},</if>
|
||||
<if test="createTime != null">#{createTime},</if>
|
||||
<if test="createBy != null">#{createBy},</if>
|
||||
<if test="updateTime != null">#{updateTime},</if>
|
||||
<if test="updateBy != null">#{updateBy},</if>
|
||||
<if test="delFlag != null">#{delFlag},</if>
|
||||
</trim>
|
||||
</insert>
|
||||
|
||||
<update id="updateSysVideoClassify" parameterType="SysVideoClassify">
|
||||
update sys_video_classify
|
||||
<trim prefix="SET" suffixOverrides=",">
|
||||
<if test="cateName != null">cate_name = #{cateName},</if>
|
||||
<if test="payFlag != null">pay_flag = #{payFlag},</if>
|
||||
<if test="createTime != null">create_time = #{createTime},</if>
|
||||
<if test="createBy != null">create_by = #{createBy},</if>
|
||||
<if test="updateTime != null">update_time = #{updateTime},</if>
|
||||
<if test="updateBy != null">update_by = #{updateBy},</if>
|
||||
<if test="delFlag != null">del_flag = #{delFlag},</if>
|
||||
</trim>
|
||||
where id = #{id}
|
||||
</update>
|
||||
|
||||
<update id="deleteSysVideoClassifyById" parameterType="Long">
|
||||
update sys_video_classify set del_flag = 1 where id = #{id}
|
||||
</update>
|
||||
|
||||
<update id="deleteSysVideoClassifyByIds" parameterType="String">
|
||||
update sys_video_classify set del_flag = 1 where id in
|
||||
<foreach item="id" collection="array" open="(" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
</update>
|
||||
|
||||
<select id="getAllClassify" resultMap="SysVideoClassifyResult">
|
||||
select id,cate_name from sys_video_classify where del_flag = 0
|
||||
</select>
|
||||
|
||||
</mapper>
|
61
stdiet-ui/src/api/custom/videoClassify.js
Normal file
61
stdiet-ui/src/api/custom/videoClassify.js
Normal file
@ -0,0 +1,61 @@
|
||||
import request from '@/utils/request'
|
||||
|
||||
// 查询视频分类列表
|
||||
export function listVideoClassify(query) {
|
||||
return request({
|
||||
url: '/custom/videoClassify/list',
|
||||
method: 'get',
|
||||
params: query
|
||||
})
|
||||
}
|
||||
|
||||
// 查询视频分类详细
|
||||
export function getVideoClassify(id) {
|
||||
return request({
|
||||
url: '/custom/videoClassify/' + id,
|
||||
method: 'get'
|
||||
})
|
||||
}
|
||||
|
||||
// 新增视频分类
|
||||
export function addVideoClassify(data) {
|
||||
return request({
|
||||
url: '/custom/videoClassify',
|
||||
method: 'post',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
||||
// 修改视频分类
|
||||
export function updateVideoClassify(data) {
|
||||
return request({
|
||||
url: '/custom/videoClassify',
|
||||
method: 'put',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
||||
// 删除视频分类
|
||||
export function delVideoClassify(id) {
|
||||
return request({
|
||||
url: '/custom/videoClassify/' + id,
|
||||
method: 'delete'
|
||||
})
|
||||
}
|
||||
|
||||
// 导出视频分类
|
||||
export function exportVideoClassify(query) {
|
||||
return request({
|
||||
url: '/custom/videoClassify/export',
|
||||
method: 'get',
|
||||
params: query
|
||||
})
|
||||
}
|
||||
|
||||
//获取所有分类
|
||||
export function getAllClassify(){
|
||||
return request({
|
||||
url: '/custom/videoClassify/getAllClassify',
|
||||
method: 'get'
|
||||
})
|
||||
}
|
109
stdiet-ui/src/components/FileUpload/UploadFile.vue
Normal file
109
stdiet-ui/src/components/FileUpload/UploadFile.vue
Normal file
@ -0,0 +1,109 @@
|
||||
<template>
|
||||
<el-upload
|
||||
class="avatar-uploader"
|
||||
:headers="upload.headers"
|
||||
:action="upload.url"
|
||||
:show-file-list="false"
|
||||
:on-success="handleFileSuccess"
|
||||
:accept="'.png,.jpg'"
|
||||
:before-upload="beforeAvatarUpload">
|
||||
<img v-if="imageUrl" :src="imageUrl" class="avatar">
|
||||
<i v-else class="el-icon-plus avatar-uploader-icon"></i>
|
||||
<div class="el-upload__tip" slot="tip">
|
||||
1、只能上传png、jpg文件,且每个文件不超过{{
|
||||
upload.fileSize / (1024 * 1024)
|
||||
}}M
|
||||
</div>
|
||||
</el-upload>
|
||||
</template>
|
||||
<script>
|
||||
import { getToken } from "@/utils/auth";
|
||||
export default {
|
||||
name: "DragUpload",
|
||||
components: {},
|
||||
data() {
|
||||
return {
|
||||
upload: {
|
||||
// 上传的地址
|
||||
url: process.env.VUE_APP_BASE_API + "/custom/fileUpload/" + this.prefix,
|
||||
// 设置上传的请求头部
|
||||
headers: { Authorization: "Bearer " + getToken() },
|
||||
// 其他需要携带的数据
|
||||
data: {},
|
||||
//每个文件大小(单位:byte)
|
||||
fileSize: 1024 * 1024 * 10,
|
||||
},
|
||||
//上传之后的路径
|
||||
imageUrl: null,
|
||||
fileUrl: null
|
||||
};
|
||||
},
|
||||
methods: {
|
||||
resetUpload(){
|
||||
this.imageUrl = null;
|
||||
this.fileUrl = null
|
||||
},
|
||||
// 文件上传成功处理
|
||||
handleFileSuccess(response, file, fileList) {
|
||||
if (response != null && response.code === 200) {
|
||||
this.fileUrl = response.fileUrl;
|
||||
this.imageUrl = response.previewUrl;
|
||||
//this.imageUrl = URL.createObjectURL(file.raw);
|
||||
//文件全部上传成功,则调用回调方法
|
||||
this.$emit("callbackMethod", this.fileUrl);
|
||||
} else {
|
||||
this.$message.error("文件上传失败");
|
||||
}
|
||||
},
|
||||
// 文件上传失败处理
|
||||
handleFileFail(err, file, fileList) {
|
||||
this.$message.error("文件上传失败");
|
||||
},
|
||||
beforeAvatarUpload(file) {
|
||||
if(file.type != 'image/jpeg' && file.type != 'image/png') {
|
||||
this.$message.error('文件格式错误');
|
||||
return false;
|
||||
}
|
||||
if (file.size > this.upload.fileSize) {
|
||||
this.$message.error('文件大小超过最大限制');
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
},
|
||||
props: {
|
||||
prefix: {
|
||||
type: String,
|
||||
default: "videoCover",
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
|
||||
.avatar-uploader .el-upload {
|
||||
border: 1px dashed #d7e236;
|
||||
border-radius: 6px;
|
||||
cursor: pointer;
|
||||
position: relative;
|
||||
overflow: hidden;
|
||||
}
|
||||
.avatar-uploader .el-upload:hover {
|
||||
border-color: #409EFF;
|
||||
}
|
||||
.avatar-uploader-icon {
|
||||
font-size: 28px;
|
||||
color: #8c939d;
|
||||
width: 178px;
|
||||
height: 178px;
|
||||
line-height: 178px;
|
||||
text-align: center;
|
||||
}
|
||||
.avatar {
|
||||
width: 300px;
|
||||
height: 200px;
|
||||
display: block;
|
||||
}
|
||||
</style>
|
||||
|
@ -7,7 +7,7 @@
|
||||
placeholder="请输入视频标题"
|
||||
v-model="videoFrom.title"
|
||||
maxlength="50"
|
||||
rows="3"
|
||||
rows="1"
|
||||
show-word-limit
|
||||
/>
|
||||
</el-form-item>
|
||||
@ -16,11 +16,37 @@
|
||||
type="textarea"
|
||||
placeholder="请输入视频描述"
|
||||
v-model="videoFrom.description"
|
||||
maxlength="2000"
|
||||
rows="10"
|
||||
maxlength="1000"
|
||||
rows="3"
|
||||
show-word-limit
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="视频封面" prop="coverUrl">
|
||||
<UploadFile ref="uploadFile" :prefix="'videoCover'" @callbackMethod="handleCoverUrl"></UploadFile>
|
||||
</el-form-item>
|
||||
<el-form-item label="视频类别" prop="cateId">
|
||||
<el-select v-model="videoFrom.cateId" clearable filterable placeholder="请选择类别">
|
||||
<el-option
|
||||
v-for="classify in classifyList"
|
||||
:key="classify.id"
|
||||
:label="classify.cateName"
|
||||
:value="classify.id"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
|
||||
|
||||
<el-form-item label="视频权限" prop="payLevel">
|
||||
<el-select v-model="videoFrom.payLevel" clearable filterable placeholder="请选择权限">
|
||||
<el-option
|
||||
v-for="dict in payVideoLevelList"
|
||||
:key="dict.dictValue"
|
||||
:label="dict.dictLabel"
|
||||
:value="parseInt(dict.dictValue)"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item label="视频文件" prop="file">
|
||||
<div>
|
||||
<input type="file" accept=".mp4" ref="videoFile" id="videoFile" @change="fileChange($event)">
|
||||
@ -39,17 +65,32 @@
|
||||
</template>
|
||||
<script>
|
||||
import axios from 'axios'
|
||||
import {getUploadVideoAuth } from "@/api/custom/nutritionalVideo";
|
||||
|
||||
import {getUploadVideoAuth,addNutritionalVideo } from "@/api/custom/nutritionalVideo";
|
||||
import {getAllClassify } from "@/api/custom/videoClassify";
|
||||
import UploadFile from "@/components/FileUpload/UploadFile";
|
||||
export default {
|
||||
name: "UploadVideo",
|
||||
data () {
|
||||
return {
|
||||
open: false,
|
||||
videoFrom:{},
|
||||
videoRules:{},
|
||||
videoRules:{
|
||||
title: [
|
||||
{ required: true, message: "标题不能为空", trigger: "blur" },
|
||||
],
|
||||
coverUrl: [
|
||||
{ required: true, message: "封面不能为空", trigger: "blur" },
|
||||
],
|
||||
cateId:[
|
||||
{ required: true, message: "视频类别不能为空", trigger: "blur" },
|
||||
],
|
||||
payLevel:[
|
||||
{ required: true, message: "视频权限不能为空", trigger: "blur" },
|
||||
]
|
||||
},
|
||||
callback: null,
|
||||
|
||||
classifyList: [],
|
||||
payVideoLevelList:[],
|
||||
uploadAuth:{
|
||||
|
||||
},
|
||||
@ -72,20 +113,42 @@
|
||||
uploading: false
|
||||
}
|
||||
},
|
||||
created(){
|
||||
getAllClassify().then(response => {
|
||||
if(response.code == 200){
|
||||
this.classifyList = response.data;
|
||||
}
|
||||
});
|
||||
this.getDicts("video_pay_level").then((response) => {
|
||||
this.payVideoLevelList = response.data;
|
||||
});
|
||||
|
||||
},
|
||||
components: {
|
||||
UploadFile
|
||||
},
|
||||
methods: {
|
||||
showDialog(callback){
|
||||
this.resetVideoFrom();
|
||||
this.open = true;
|
||||
this.callback = callback;
|
||||
},
|
||||
handleCoverUrl(url){
|
||||
this.videoFrom.coverUrl = url;
|
||||
},
|
||||
resetVideoFrom(){
|
||||
this.videoFrom = {
|
||||
cateId: null,
|
||||
coverUrl: null,
|
||||
title: null,
|
||||
description: null,
|
||||
tags: null,
|
||||
tags: null,
|
||||
payLevel: null,
|
||||
videoId: null
|
||||
};
|
||||
if(this.$refs.uploadFile){
|
||||
this.$refs.uploadFile.resetUpload();
|
||||
}
|
||||
this.authProgress = 0;
|
||||
this.file = null;
|
||||
this.videoFileList = [];
|
||||
@ -112,55 +175,53 @@
|
||||
},
|
||||
|
||||
fileChange (e) {
|
||||
if(this.videoFrom.title == null || this.videoFrom.title.trim().length == 0){
|
||||
this.$message({
|
||||
message: "标题不能为空",
|
||||
type: "warning",
|
||||
});
|
||||
return;
|
||||
}
|
||||
if(this.uploading){
|
||||
this.$message({
|
||||
message: "文件正在上传,请勿取消",
|
||||
type: "warning",
|
||||
});
|
||||
return;
|
||||
}
|
||||
this.file = e.target.files[0];
|
||||
var userData = '{"Vod":{}}'
|
||||
/**if (this.uploader) {
|
||||
this.uploader.stopUpload()
|
||||
this.authProgress = 0
|
||||
this.statusText = ""
|
||||
}**/
|
||||
this.videoFrom.fileName = this.file.name;
|
||||
if(this.videoFrom.fileName == null || this.videoFrom.fileName.length == 0 || this.videoFrom.fileName.lastIndexOf(".") == -1){
|
||||
this.$message({
|
||||
message: "当前文件名称错误",
|
||||
type: "warning",
|
||||
});
|
||||
return;
|
||||
}
|
||||
let fileType = this.videoFrom.fileName.substring(this.videoFrom.fileName.lastIndexOf(".")+1);
|
||||
if(this.fileType.indexOf(fileType) == -1){
|
||||
this.$message({
|
||||
message: "当前文件格式错误",
|
||||
type: "warning",
|
||||
});
|
||||
return;
|
||||
}
|
||||
|
||||
getUploadVideoAuth(this.videoFrom).then(response => {
|
||||
if(response.code == 200){
|
||||
this.uploadAuth = response.uploadAuth;
|
||||
this.uploader = this.createUploader()
|
||||
this.uploader.addFile(this.file, null, null, null, userData)
|
||||
this.uploadDisabled = false
|
||||
this.pauseDisabled = true
|
||||
this.resumeDisabled = true
|
||||
}
|
||||
})
|
||||
|
||||
this.$refs["videoFrom"].validate((valid) => {
|
||||
if (valid) {
|
||||
if(this.uploading){
|
||||
this.$message({
|
||||
message: "文件正在上传,请勿取消",
|
||||
type: "warning",
|
||||
});
|
||||
return;
|
||||
}
|
||||
this.file = e.target.files[0];
|
||||
var userData = '{"Vod":{}}'
|
||||
/**if (this.uploader) {
|
||||
this.uploader.stopUpload()
|
||||
this.authProgress = 0
|
||||
this.statusText = ""
|
||||
}**/
|
||||
this.videoFrom.fileName = this.file.name;
|
||||
if(this.videoFrom.fileName == null || this.videoFrom.fileName.length == 0 || this.videoFrom.fileName.lastIndexOf(".") == -1){
|
||||
this.$message({
|
||||
message: "当前文件名称错误",
|
||||
type: "warning",
|
||||
});
|
||||
return;
|
||||
}
|
||||
let fileType = this.videoFrom.fileName.substring(this.videoFrom.fileName.lastIndexOf(".")+1);
|
||||
if(this.fileType.indexOf(fileType) == -1){
|
||||
this.$message({
|
||||
message: "当前文件格式错误",
|
||||
type: "warning",
|
||||
});
|
||||
return;
|
||||
}
|
||||
|
||||
getUploadVideoAuth(this.videoFrom).then(response => {
|
||||
if(response.code == 200){
|
||||
this.uploadAuth = response.uploadAuth;
|
||||
console.log(this.uploadAuth);
|
||||
this.videoFrom.videoId = this.uploadAuth.videoId;
|
||||
this.uploader = this.createUploader()
|
||||
this.uploader.addFile(this.file, null, null, null, userData)
|
||||
this.uploadDisabled = false
|
||||
this.pauseDisabled = true
|
||||
this.resumeDisabled = true
|
||||
}
|
||||
})
|
||||
}
|
||||
});
|
||||
},
|
||||
authUpload () {
|
||||
// 然后调用 startUpload 方法, 开始上传
|
||||
@ -259,9 +320,14 @@
|
||||
onUploadEnd: function (uploadInfo) {
|
||||
self.statusText = '文件上传完毕'
|
||||
self.uploading = false;
|
||||
self.msgSuccess("上传成功");
|
||||
self.open = false;
|
||||
self.callback && self.callback();
|
||||
//self.msgSuccess("上传成功");
|
||||
addNutritionalVideo(self.videoFrom).then(response => {
|
||||
if (response.code === 200) {
|
||||
self.msgSuccess("视频上传成功");
|
||||
self.open = false;
|
||||
self.callback && self.callback();
|
||||
}
|
||||
})
|
||||
}
|
||||
})
|
||||
return uploader
|
||||
|
@ -1,6 +1,25 @@
|
||||
<template>
|
||||
<div class="app-container">
|
||||
<!--<el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch" label-width="68px">
|
||||
<el-form-item label="关键词" prop="title">
|
||||
<el-input
|
||||
v-model="queryParams.key"
|
||||
placeholder="请输入关键词"
|
||||
clearable
|
||||
size="small"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="状态" prop="showFlag">
|
||||
<el-select
|
||||
v-model="queryParams.showFlag"
|
||||
placeholder="请选示状态"
|
||||
clearable
|
||||
size="small"
|
||||
>
|
||||
<el-option key="0" label="屏蔽" value="0"/>
|
||||
<el-option key="1" label="正常" value="1"/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button type="cyan" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
|
||||
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
|
||||
@ -52,21 +71,23 @@
|
||||
<el-table v-loading="loading" :data="nutritionalVideoList" @selection-change="handleSelectionChange">
|
||||
<el-table-column type="selection" width="55" align="center" />
|
||||
<!--<el-table-column label="视频分类ID" align="center" prop="cateId" />-->
|
||||
<el-table-column label="封面" align="center" prop="coverUrl">
|
||||
<el-table-column label="封面" align="center" prop="coverUrl" width="300">
|
||||
<template slot-scope="scope">
|
||||
<el-image title="点击大图预览"
|
||||
style="width: 200px; height: 200px"
|
||||
<el-image
|
||||
style="width: 300px; height: 200px"
|
||||
:src="scope.row.coverUrl"
|
||||
:preview-src-list="coverImageList">
|
||||
</el-image>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="标题" align="center" prop="title" />
|
||||
<el-table-column label="标题" align="center" prop="title" width="200"/>
|
||||
<el-table-column label="描述" align="center" prop="description" />
|
||||
<el-table-column label="标签" align="center" prop="tags" />
|
||||
<el-table-column label="显示状态" align="center" prop="showFlag">
|
||||
<el-table-column label="标签" align="center" prop="tags" width="100"/>
|
||||
<el-table-column label="分类" align="center" prop="cateName" width="100"/>
|
||||
<el-table-column label="权限等级" align="center" prop="payLevelName" width="100"/>
|
||||
<el-table-column label="显示状态" align="center" prop="showFlag" width="100">
|
||||
<template slot-scope="scope">
|
||||
{{scope.row.showFlag == 1 ? '正常' : '屏蔽'}}
|
||||
{{scope.row.showFlag == 1 ? '正常' : '不显示'}}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<!--<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
|
||||
@ -166,6 +187,8 @@
|
||||
queryParams: {
|
||||
pageNum: 1,
|
||||
pageSize: 5,
|
||||
key: null,
|
||||
showFlag: null
|
||||
},
|
||||
// 表单参数
|
||||
form: {},
|
||||
@ -187,8 +210,8 @@
|
||||
this.loading = true;
|
||||
listNutritionalVideo(this.queryParams).then(response => {
|
||||
this.nutritionalVideoList = response.rows;
|
||||
this.total = response.total;
|
||||
this.loading = false;
|
||||
this.total = response.total;
|
||||
this.loading = false;
|
||||
});
|
||||
},
|
||||
// 取消按钮
|
||||
|
Loading…
x
Reference in New Issue
Block a user