From 6a7c6a72acb4f36107b8c776e3c6a29ab3db9fc4 Mon Sep 17 00:00:00 2001 From: xiezhijun <15270898033@163.com> Date: Sat, 12 Jun 2021 18:34:32 +0800 Subject: [PATCH 1/5] =?UTF-8?q?=E8=A7=86=E9=A2=91=E5=88=86=E7=B1=BB?= =?UTF-8?q?=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../custom/SysVideoClassifyController.java | 16 +-- .../custom/VideoWebInterfaceController.java | 31 ++++++ .../custom/WechatAppletController.java | 4 +- .../custom/domain/SysVideoClassify.java | 16 ++- .../dto/response/VideoClassifyResponse.java | 55 ++++++++++ .../response/VideoClassifyThreeResponse.java | 45 ++++++++ .../response/VideoClassifyTwoResponse.java | 56 ++++++++++ .../custom/mapper/SysVideoClassifyMapper.java | 10 +- .../service/ISysNutritionalVideoService.java | 1 + .../service/ISysVideoClassifyService.java | 10 +- .../service/impl/SysOrderServiceImpl.java | 17 ++- .../impl/SysRecipesPlanServiceImpl.java | 20 +++- .../impl/SysVideoClassifyServiceImpl.java | 25 ++++- .../mapper/custom/SysVideoClassifyMapper.xml | 74 ++++++++++++- .../framework/config/SecurityConfig.java | 3 +- .../src/components/UploadVideo/index.vue | 48 +++++++-- .../views/custom/nutritionalVideo/index.vue | 4 +- .../src/views/custom/videoClassify/index.vue | 100 ++++++++++++++---- 18 files changed, 480 insertions(+), 55 deletions(-) create mode 100644 stdiet-admin/src/main/java/com/stdiet/web/controller/custom/VideoWebInterfaceController.java create mode 100644 stdiet-custom/src/main/java/com/stdiet/custom/dto/response/VideoClassifyResponse.java create mode 100644 stdiet-custom/src/main/java/com/stdiet/custom/dto/response/VideoClassifyThreeResponse.java create mode 100644 stdiet-custom/src/main/java/com/stdiet/custom/dto/response/VideoClassifyTwoResponse.java diff --git a/stdiet-admin/src/main/java/com/stdiet/web/controller/custom/SysVideoClassifyController.java b/stdiet-admin/src/main/java/com/stdiet/web/controller/custom/SysVideoClassifyController.java index 13eff2c96..b677d5491 100644 --- a/stdiet-admin/src/main/java/com/stdiet/web/controller/custom/SysVideoClassifyController.java +++ b/stdiet-admin/src/main/java/com/stdiet/web/controller/custom/SysVideoClassifyController.java @@ -3,14 +3,7 @@ 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 org.springframework.web.bind.annotation.*; import com.stdiet.common.annotation.Log; import com.stdiet.common.core.controller.BaseController; import com.stdiet.common.core.domain.AjaxResult; @@ -40,7 +33,8 @@ public class SysVideoClassifyController extends BaseController @GetMapping("/list") public TableDataInfo list(SysVideoClassify sysVideoClassify) { - startPage(); + //startPage(); + //sysVideoClassify.setParentId(0L); List list = sysVideoClassifyService.selectSysVideoClassifyList(sysVideoClassify); return getDataTable(list); } @@ -105,9 +99,9 @@ public class SysVideoClassifyController extends BaseController * 查询视频分类列表 */ @GetMapping("/getAllClassify") - public AjaxResult getAllClassify() + public AjaxResult getAllClassify(SysVideoClassify sysVideoClassify) { - List list = sysVideoClassifyService.getAllClassify(); + List list = sysVideoClassifyService.getAllClassify(sysVideoClassify); return AjaxResult.success(list); } } \ No newline at end of file diff --git a/stdiet-admin/src/main/java/com/stdiet/web/controller/custom/VideoWebInterfaceController.java b/stdiet-admin/src/main/java/com/stdiet/web/controller/custom/VideoWebInterfaceController.java new file mode 100644 index 000000000..cca7e91ad --- /dev/null +++ b/stdiet-admin/src/main/java/com/stdiet/web/controller/custom/VideoWebInterfaceController.java @@ -0,0 +1,31 @@ +package com.stdiet.web.controller.custom; + +import com.stdiet.common.core.domain.AjaxResult; +import com.stdiet.custom.domain.SysVideoClassify; +import com.stdiet.custom.dto.response.VideoClassifyResponse; +import com.stdiet.custom.service.ISysVideoClassifyService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +import java.util.List; + + +@RestController +@RequestMapping("/web/video") +public class VideoWebInterfaceController { + + @Autowired + private ISysVideoClassifyService sysVideoClassifyService; + + /** + * 查询视频分类目录列表 + */ + @GetMapping("/getAllClassify") + public AjaxResult getClassifyAndVideo(SysVideoClassify sysVideoClassify) + { + List list = sysVideoClassifyService.getAllClassifyAndVideo(0L); + return AjaxResult.success(list); + } +} diff --git a/stdiet-admin/src/main/java/com/stdiet/web/controller/custom/WechatAppletController.java b/stdiet-admin/src/main/java/com/stdiet/web/controller/custom/WechatAppletController.java index 5a91d40bd..a22baae83 100644 --- a/stdiet-admin/src/main/java/com/stdiet/web/controller/custom/WechatAppletController.java +++ b/stdiet-admin/src/main/java/com/stdiet/web/controller/custom/WechatAppletController.java @@ -714,7 +714,9 @@ public class WechatAppletController extends BaseController { */ @GetMapping("/getVideoClassify") public AjaxResult getVideoClassify(@RequestParam("openid")String openid) { - List list = sysVideoClassifyService.selectSysVideoClassifyList(new SysVideoClassify()); + SysVideoClassify param = new SysVideoClassify(); + param.setParentId(0L); + List list = sysVideoClassifyService.getAllClassify(param); List>> result = new ArrayList<>(); int groupCount = 3; SysVideoClassify all = new SysVideoClassify(); diff --git a/stdiet-custom/src/main/java/com/stdiet/custom/domain/SysVideoClassify.java b/stdiet-custom/src/main/java/com/stdiet/custom/domain/SysVideoClassify.java index 8384a6de6..915f71ea5 100644 --- a/stdiet-custom/src/main/java/com/stdiet/custom/domain/SysVideoClassify.java +++ b/stdiet-custom/src/main/java/com/stdiet/custom/domain/SysVideoClassify.java @@ -1,11 +1,13 @@ package com.stdiet.custom.domain; +import com.stdiet.custom.dto.response.VideoClassifyTwoResponse; 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; +import java.util.List; +import java.util.Map; + /** * 视频分类对象 sys_video_classify * @@ -24,10 +26,20 @@ public class SysVideoClassify extends BaseEntity @Excel(name = "分类名称") private String cateName; + private Long parentId; + + private Integer orderNum; + /** 类型标识,0全部可看 1客户可看 2额外付费观看 */ @Excel(name = "类型标识,0全部可看 1客户可看 2额外付费观看") private Integer payFlag; /** 删除标识 0未删除 1已删除 */ private Integer delFlag; + + //子分类 + private List childrenClassify; + + //子视频 + private List> childrenVideo; } \ No newline at end of file diff --git a/stdiet-custom/src/main/java/com/stdiet/custom/dto/response/VideoClassifyResponse.java b/stdiet-custom/src/main/java/com/stdiet/custom/dto/response/VideoClassifyResponse.java new file mode 100644 index 000000000..515bf208a --- /dev/null +++ b/stdiet-custom/src/main/java/com/stdiet/custom/dto/response/VideoClassifyResponse.java @@ -0,0 +1,55 @@ +package com.stdiet.custom.dto.response; + +import lombok.Data; +import java.io.Serializable; +import java.util.List; +import java.util.Map; + +public class VideoClassifyResponse implements Serializable { + + private static final long serialVersionUID = 1L; + + //目录分类ID + private Long id; + + //目录分类名称 + private String cateName; + + //子分类 + private List childrenClassify; + + //子视频 + private List> childrenVideo; + + public Long getId() { + return id; + } + + public void setId(Long id) { + this.id = id; + } + + public String getCateName() { + return cateName; + } + + public void setCateName(String cateName) { + this.cateName = cateName; + } + + public List getChildrenClassify() { + return childrenClassify; + } + + public void setChildrenClassify(List childrenClassify) { + this.childrenClassify = childrenClassify; + } + + public List> getChildrenVideo() { + return childrenVideo; + } + + public void setChildrenVideo(List> childrenVideo) { + this.childrenVideo = childrenVideo; + } +} diff --git a/stdiet-custom/src/main/java/com/stdiet/custom/dto/response/VideoClassifyThreeResponse.java b/stdiet-custom/src/main/java/com/stdiet/custom/dto/response/VideoClassifyThreeResponse.java new file mode 100644 index 000000000..2347bb744 --- /dev/null +++ b/stdiet-custom/src/main/java/com/stdiet/custom/dto/response/VideoClassifyThreeResponse.java @@ -0,0 +1,45 @@ +package com.stdiet.custom.dto.response; + +import lombok.Data; + +import java.io.Serializable; +import java.util.List; +import java.util.Map; + +public class VideoClassifyThreeResponse implements Serializable { + + private static final long serialVersionUID = 1L; + + //目录分类ID + private Long id; + + //目录分类名称 + private String cateName; + + //子视频 + private List> childrenVideo; + + public Long getId() { + return id; + } + + public void setId(Long id) { + this.id = id; + } + + public String getCateName() { + return cateName; + } + + public void setCateName(String cateName) { + this.cateName = cateName; + } + + public List> getChildrenVideo() { + return childrenVideo; + } + + public void setChildrenVideo(List> childrenVideo) { + this.childrenVideo = childrenVideo; + } +} diff --git a/stdiet-custom/src/main/java/com/stdiet/custom/dto/response/VideoClassifyTwoResponse.java b/stdiet-custom/src/main/java/com/stdiet/custom/dto/response/VideoClassifyTwoResponse.java new file mode 100644 index 000000000..e88544e6a --- /dev/null +++ b/stdiet-custom/src/main/java/com/stdiet/custom/dto/response/VideoClassifyTwoResponse.java @@ -0,0 +1,56 @@ +package com.stdiet.custom.dto.response; + +import lombok.Data; + +import java.io.Serializable; +import java.util.List; +import java.util.Map; + +public class VideoClassifyTwoResponse implements Serializable { + + private static final long serialVersionUID = 1L; + + //目录分类ID + private Long id; + + //目录分类名称 + private String cateName; + + //子分类 + private List childrenClassify; + + //子视频 + private List> childrenVideo; + + public Long getId() { + return id; + } + + public void setId(Long id) { + this.id = id; + } + + public String getCateName() { + return cateName; + } + + public void setCateName(String cateName) { + this.cateName = cateName; + } + + public List getChildrenClassify() { + return childrenClassify; + } + + public void setChildrenClassify(List childrenClassify) { + this.childrenClassify = childrenClassify; + } + + public List> getChildrenVideo() { + return childrenVideo; + } + + public void setChildrenVideo(List> childrenVideo) { + this.childrenVideo = childrenVideo; + } +} diff --git a/stdiet-custom/src/main/java/com/stdiet/custom/mapper/SysVideoClassifyMapper.java b/stdiet-custom/src/main/java/com/stdiet/custom/mapper/SysVideoClassifyMapper.java index c1a905237..c173cbc72 100644 --- a/stdiet-custom/src/main/java/com/stdiet/custom/mapper/SysVideoClassifyMapper.java +++ b/stdiet-custom/src/main/java/com/stdiet/custom/mapper/SysVideoClassifyMapper.java @@ -2,6 +2,7 @@ package com.stdiet.custom.mapper; import java.util.List; import com.stdiet.custom.domain.SysVideoClassify; +import com.stdiet.custom.dto.response.VideoClassifyResponse; /** * 视频分类Mapper接口 @@ -63,5 +64,12 @@ public interface SysVideoClassifyMapper * 获取所有类别 * @return */ - public List getAllClassify(); + public List getAllClassify(SysVideoClassify sysVideoClassify); + + /** + * 根据父级ID获取下面子分类以及视频 + * @param parentId + * @return + */ + public List getOneAllClassifyAndVideo(Long parentId); } \ No newline at end of file diff --git a/stdiet-custom/src/main/java/com/stdiet/custom/service/ISysNutritionalVideoService.java b/stdiet-custom/src/main/java/com/stdiet/custom/service/ISysNutritionalVideoService.java index b288333b0..09b96e8e3 100644 --- a/stdiet-custom/src/main/java/com/stdiet/custom/service/ISysNutritionalVideoService.java +++ b/stdiet-custom/src/main/java/com/stdiet/custom/service/ISysNutritionalVideoService.java @@ -4,6 +4,7 @@ import java.util.List; import java.util.Map; import com.stdiet.custom.domain.SysNutritionalVideo; +import com.stdiet.custom.domain.SysVideoClassify; import org.apache.ibatis.annotations.Param; /** diff --git a/stdiet-custom/src/main/java/com/stdiet/custom/service/ISysVideoClassifyService.java b/stdiet-custom/src/main/java/com/stdiet/custom/service/ISysVideoClassifyService.java index a3eeacebb..0cdf33740 100644 --- a/stdiet-custom/src/main/java/com/stdiet/custom/service/ISysVideoClassifyService.java +++ b/stdiet-custom/src/main/java/com/stdiet/custom/service/ISysVideoClassifyService.java @@ -2,6 +2,7 @@ package com.stdiet.custom.service; import java.util.List; import com.stdiet.custom.domain.SysVideoClassify; +import com.stdiet.custom.dto.response.VideoClassifyResponse; /** * 视频分类Service接口 @@ -63,5 +64,12 @@ public interface ISysVideoClassifyService * 获取所有类别 * @return */ - public List getAllClassify(); + public List getAllClassify(SysVideoClassify sysVideoClassify); + + /** + * 按分类层级分类,返回视频目录列表 + * + * @return 视频分类集合 + */ + public List getAllClassifyAndVideo(Long parentId); } \ No newline at end of file diff --git a/stdiet-custom/src/main/java/com/stdiet/custom/service/impl/SysOrderServiceImpl.java b/stdiet-custom/src/main/java/com/stdiet/custom/service/impl/SysOrderServiceImpl.java index e58d884ee..f7fd404c5 100644 --- a/stdiet-custom/src/main/java/com/stdiet/custom/service/impl/SysOrderServiceImpl.java +++ b/stdiet-custom/src/main/java/com/stdiet/custom/service/impl/SysOrderServiceImpl.java @@ -378,7 +378,7 @@ public class SysOrderServiceImpl implements ISysOrderService { LocalDate newStartTime = null; //判断是否提成单,拆分单中的副单,体验单,定金单 if(sysOrder.getStartTime() == null || sysOrder.getAfterSaleCommissOrder().intValue() == 1 || sysOrder.getMainOrderId().intValue() != 0 || - "2".equals(sysOrder.getOrderType()) || "1".equals(sysOrder.getOrderMoneyType())){ + "2".equals(sysOrder.getOrderType()) || !isNeedByOrderMoneyType(sysOrder)){ continue; } //判断前一个订单的结束时间是否大于第二个订单的 @@ -404,6 +404,21 @@ public class SysOrderServiceImpl implements ISysOrderService { return row; } + //定金单或尾款单是否需要生成食谱计划,2021-01-12修改为6月11日之后成交的订单只生成定金单计划 + private boolean isNeedByOrderMoneyType(SysOrder sysOrder){ + if("0".equals(sysOrder.getOrderMoneyType())){ + return true; + }else{ + //成交时间 + LocalDate orderDate = DateUtils.dateToLocalDate(sysOrder.getOrderTime()); + if(ChronoUnit.DAYS.between(SysRecipesPlanServiceImpl.newVersionPlanStartDate, orderDate) >= 0){ + return "1".equals(sysOrder.getOrderMoneyType()); + }else{ + return "2".equals(sysOrder.getOrderMoneyType()); + } + } + } + /** * 给对象SysOrder对象设置服务到期时间 * diff --git a/stdiet-custom/src/main/java/com/stdiet/custom/service/impl/SysRecipesPlanServiceImpl.java b/stdiet-custom/src/main/java/com/stdiet/custom/service/impl/SysRecipesPlanServiceImpl.java index b0a01c0ce..58b09b2f8 100644 --- a/stdiet-custom/src/main/java/com/stdiet/custom/service/impl/SysRecipesPlanServiceImpl.java +++ b/stdiet-custom/src/main/java/com/stdiet/custom/service/impl/SysRecipesPlanServiceImpl.java @@ -44,6 +44,9 @@ public class SysRecipesPlanServiceImpl implements ISysRecipesPlanService { @Autowired private SysRecipesMapper sysRecipesMapper; + //2021-06-11之后(大于等于)成交的订单,只生成定金单食谱计划,不生成尾款食谱计划,之前成交的订单还是保持之前逻辑 + public static final LocalDate newVersionPlanStartDate = DateUtils.stringToLocalDate("2021-06-11", "yyyy-MM-dd"); + /** * 查询食谱计划 * @@ -172,7 +175,7 @@ public class SysRecipesPlanServiceImpl implements ISysRecipesPlanService { //判断是否提成单,拆分单中的副单,体验单,定金单 if (sysOrder.getAfterSaleCommissOrder().intValue() == 1 || sysOrder.getMainOrderId().intValue() != 0 || // "2".equals(sysOrder.getOrderType()) || // 体验单也需要生成计划 2021.05.29 - "1".equals(sysOrder.getOrderMoneyType()) || sysOrder.getCounted() == 1) { + !isNeedByOrderMoneyType(sysOrder) || sysOrder.getCounted() == 1) { System.out.println("---------------------" + sysOrder.getOrderId() + "不生成食谱------------------------"); continue; } @@ -208,6 +211,21 @@ public class SysRecipesPlanServiceImpl implements ISysRecipesPlanService { } } + //定金单或尾款单是否需要生成食谱计划,2021-01-12修改为6月11日之后成交的订单只生成定金单计划 + private boolean isNeedByOrderMoneyType(SysOrder sysOrder){ + if("0".equals(sysOrder.getOrderMoneyType())){ + return true; + }else{ + //成交时间 + LocalDate orderDate = DateUtils.dateToLocalDate(sysOrder.getOrderTime()); + if(ChronoUnit.DAYS.between(newVersionPlanStartDate, orderDate) >= 0){ + return "1".equals(sysOrder.getOrderMoneyType()); + }else{ + return "2".equals(sysOrder.getOrderMoneyType()); + } + } + } + /** * 查询食谱计划中对应食谱存在天数缺失的食谱计划,食谱计划发生变化时,可能会导致sys_customer_daily_menu表中天数缺失,需要查询出来进行补充 * @param cusId 客户ID diff --git a/stdiet-custom/src/main/java/com/stdiet/custom/service/impl/SysVideoClassifyServiceImpl.java b/stdiet-custom/src/main/java/com/stdiet/custom/service/impl/SysVideoClassifyServiceImpl.java index bb5e0a47c..827091fca 100644 --- a/stdiet-custom/src/main/java/com/stdiet/custom/service/impl/SysVideoClassifyServiceImpl.java +++ b/stdiet-custom/src/main/java/com/stdiet/custom/service/impl/SysVideoClassifyServiceImpl.java @@ -2,6 +2,8 @@ package com.stdiet.custom.service.impl; import java.util.List; import com.stdiet.common.utils.DateUtils; +import com.stdiet.custom.dto.response.VideoClassifyResponse; +import com.stdiet.custom.mapper.SysNutritionalVideoMapper; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import com.stdiet.custom.mapper.SysVideoClassifyMapper; @@ -20,6 +22,9 @@ public class SysVideoClassifyServiceImpl implements ISysVideoClassifyService @Autowired private SysVideoClassifyMapper sysVideoClassifyMapper; + @Autowired + private SysNutritionalVideoMapper sysNutritionalVideoMapper; + /** * 查询视频分类 * @@ -94,12 +99,28 @@ public class SysVideoClassifyServiceImpl implements ISysVideoClassifyService return sysVideoClassifyMapper.deleteSysVideoClassifyById(id); } + private boolean delChildrenClassify(Long id){ + //判断分类下是否存在视频,存在视频不能删除 + + return true; + } + /** * 获取所有类别 * @return */ @Override - public List getAllClassify(){ - return sysVideoClassifyMapper.getAllClassify(); + public List getAllClassify(SysVideoClassify sysVideoClassify){ + return sysVideoClassifyMapper.getAllClassify(sysVideoClassify); + } + + /** + * 按分类层级分类,返回视频目录列表 + * + * @param sysVideoClassify 视频分类 + * @return 视频分类集合 + */ + public List getAllClassifyAndVideo(Long parentId){ + return sysVideoClassifyMapper.getOneAllClassifyAndVideo(parentId); } } \ No newline at end of file diff --git a/stdiet-custom/src/main/resources/mapper/custom/SysVideoClassifyMapper.xml b/stdiet-custom/src/main/resources/mapper/custom/SysVideoClassifyMapper.xml index 688addef8..d25fc7347 100644 --- a/stdiet-custom/src/main/resources/mapper/custom/SysVideoClassifyMapper.xml +++ b/stdiet-custom/src/main/resources/mapper/custom/SysVideoClassifyMapper.xml @@ -7,6 +7,8 @@ + + @@ -16,12 +18,16 @@ - select id, cate_name, pay_flag, create_time, create_by, update_time, update_by, del_flag from sys_video_classify + select id, cate_name, parent_id, order_num, pay_flag, create_time, create_by, update_time, update_by, del_flag from sys_video_classify - select id,cate_name from sys_video_classify where del_flag = 0 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/stdiet-framework/src/main/java/com/stdiet/framework/config/SecurityConfig.java b/stdiet-framework/src/main/java/com/stdiet/framework/config/SecurityConfig.java index 07f5dc900..2358e498b 100644 --- a/stdiet-framework/src/main/java/com/stdiet/framework/config/SecurityConfig.java +++ b/stdiet-framework/src/main/java/com/stdiet/framework/config/SecurityConfig.java @@ -106,7 +106,8 @@ public class SecurityConfig extends WebSecurityConfigurerAdapter { "/wap/**", "/investigate/**", "/common/customerUploadFile", - "/custom/nutritionQuestion/regenerateNutritionQuestionIndex" + "/custom/nutritionQuestion/regenerateNutritionQuestionIndex", + "/web/**" ).anonymous() .antMatchers( HttpMethod.GET, diff --git a/stdiet-ui/src/components/UploadVideo/index.vue b/stdiet-ui/src/components/UploadVideo/index.vue index 9a5462a86..af0031d96 100644 --- a/stdiet-ui/src/components/UploadVideo/index.vue +++ b/stdiet-ui/src/components/UploadVideo/index.vue @@ -26,15 +26,14 @@
- - - + - @@ -78,6 +77,9 @@ import {getUploadVideoAuth,addNutritionalVideo } from "@/api/custom/nutritionalVideo"; import {getAllClassify } from "@/api/custom/videoClassify"; import UploadFile from "@/components/FileUpload/UploadFile"; + import Treeselect from "@riophae/vue-treeselect"; + import "@riophae/vue-treeselect/dist/vue-treeselect.css"; + import IconSelect from "@/components/IconSelect"; export default { name: "UploadVideo", data () { @@ -140,7 +142,7 @@ }, components: { - UploadFile + UploadFile,Treeselect, IconSelect }, methods: { showDialog(classifyList, callback){ @@ -150,7 +152,8 @@ this.resetVideoFrom(); this.open = true; this.callback = callback; - this.classifyList = classifyList; + this.dealClassify(classifyList); + //this.classifyList = classifyList; }, handleCoverUrl(url){ this.videoFrom.coverUrl = url; @@ -181,6 +184,23 @@ }, submitVideoForm(){ + }, + /** 转换菜单数据结构 */ + normalizer(node) { + if (node.children && !node.children.length) { + delete node.children; + } + return { + id: node.id, + label: node.cateName, + children: node.children + }; + }, + dealClassify(data){ + this.classifyList = []; + const classify = { id: 0, cateName: '主分类', children: [] }; + classify.children = this.handleTree(data, "id"); + this.classifyList.push(classify); }, cancel(){ if(this.uploading){ @@ -211,6 +231,14 @@ this.authProgress = 0 this.statusText = "" }**/ + //视频分类不能选择主分类 + if(this.videoFrom.cateId == 0){ + this.$message({ + message: "视频分类不能选择主分类", + type: "warning", + }); + return; + } this.videoFrom.fileName = this.file.name; if(this.videoFrom.fileName == null || this.videoFrom.fileName.length == 0 || this.videoFrom.fileName.lastIndexOf(".") == -1){ this.$message({ diff --git a/stdiet-ui/src/views/custom/nutritionalVideo/index.vue b/stdiet-ui/src/views/custom/nutritionalVideo/index.vue index 291731549..ff84e80bf 100644 --- a/stdiet-ui/src/views/custom/nutritionalVideo/index.vue +++ b/stdiet-ui/src/views/custom/nutritionalVideo/index.vue @@ -243,7 +243,9 @@ - +
+ +
diff --git a/stdiet-ui/src/views/custom/videoClassify/index.vue b/stdiet-ui/src/views/custom/videoClassify/index.vue index 0a1ada151..10c8d28e0 100644 --- a/stdiet-ui/src/views/custom/videoClassify/index.vue +++ b/stdiet-ui/src/views/custom/videoClassify/index.vue @@ -35,7 +35,7 @@ v-hasPermi="['custom:videoClassify:add']" >新增 - + + + + + + + +