feat(mall): 新增活动管理功能
- 添加活动分类管理功能,包括新增、删除、修改分类
- 实现活动列表查询、新增、编辑和删除功能
- 增加活动选项管理,支持添加、编辑和删除选项
- 实现活动关注列表查询功能
- 优化图片上传逻辑,支持 base64 编码图片上传
5 files added
1 files deleted
19 files modified
| | |
| | | public class OssUtils { |
| | | |
| | | private static String END_POINT = "https://oss-cn-hangzhou.aliyuncs.com"; |
| | | private static String ACCESS_KEY_ID = "LTAI5tCZ5MZT3372gGq4oC62"; |
| | | private static String ACCESS_KEY_SECRET = "IJkBOYotXQrfrv73PyN6OGHg5NNya9"; |
| | | private static String ACCESS_KEY_ID = "LTAI5tCH5Ld2n72QmF1A2zXm"; |
| | | private static String ACCESS_KEY_SECRET = "RNIf3J90mV1WdbgraesLusjF7TRRb9"; |
| | | private static String bucket_name = "https://excoin.oss-cn-hangzhou.aliyuncs.com"; |
| | | |
| | | public static boolean uploadFileWithBase64(String base64, String pathName) { |
| | |
| | | // 文件保存目录URL |
| | | @Value("${static.resource.path}") |
| | | private String resourcePath; |
| | | |
| | | /** |
| | | * 图片上传 |
| | | * @return |
| | |
| | | @PostMapping(value = "/uploadFileBase64") |
| | | @ControllerEndpoint(operation = "图片上传", exceptionMessage = "上传失败") |
| | | public Map<String,Object> uploadFileBase64(@RequestBody @Validated MultipartFile file) throws IOException { |
| | | if (file.isEmpty()) { |
| | | new FebsResponse().message("上传文件为空"); |
| | | } |
| | | return FileUtil.fileUploadEsc(file,resourceUrl,resourcePath); |
| | | // if (file.isEmpty()) { |
| | | // new FebsResponse().message("上传文件为空"); |
| | | // } |
| | | // return FileUtil.fileUploadEsc(file,resourceUrl,resourcePath); |
| | | |
| | | // String base64EncoderImg = ""; |
| | | // BASE64Encoder base64Encoder =new BASE64Encoder(); |
| | | // List<String> imageFuffixStr = CollUtil.toList(StrUtil.split(file.getOriginalFilename(), ".")); |
| | | // String imageFuffix = file.getOriginalFilename().substring(file.getOriginalFilename().lastIndexOf(".")); |
| | | // if("jpg".equals(imageFuffixStr.get(1))){ |
| | | // try { |
| | | // //输出到BufferedImage |
| | | // BufferedImage bufferedImage = Thumbnails.of(file.getInputStream()) |
| | | // // 图片大小(长宽)压缩比例 从0-1,1表示原图 |
| | | // .scale(1f) |
| | | // // 图片质量压缩比例 从0-1,越接近1质量越好 |
| | | // .outputQuality(0.9f) |
| | | // .asBufferedImage(); |
| | | // //对内存中的图片文件进行Base64处理 |
| | | // ByteArrayOutputStream newBaos = new ByteArrayOutputStream();//io流 |
| | | // ImageIO.write(bufferedImage, "jpg", newBaos);//写入流中 |
| | | // byte[] bytes = newBaos.toByteArray();//转换成字节 |
| | | // base64EncoderImg = base64Encoder.encode(bytes); |
| | | //// base64EncoderImg = URLEncoder.encode(new BASE64Encoder().encode(bytes), "UTF-8"); |
| | | // } catch (Exception e) { |
| | | // e.printStackTrace(); |
| | | // } |
| | | // }else{ |
| | | // try { |
| | | // base64EncoderImg = base64Encoder.encode(file.getBytes()); |
| | | // } catch (IOException e) { |
| | | // e.printStackTrace(); |
| | | // } |
| | | // } |
| | | // //文件加密 |
| | | //// String imageFuffix = file.getOriginalFilename().substring(file.getOriginalFilename().lastIndexOf(".")); |
| | | //// String imageFuffix = ".png"; |
| | | // String imageNames = System.currentTimeMillis() + IdUtil.simpleUUID() + imageFuffix; |
| | | // String imageName = "uploadeFile/" + imageNames; |
| | | // OssUtils.uploadFileWithBase64(base64EncoderImg, imageName); |
| | | // String bucket_name ="https://excoin.oss-cn-hangzhou.aliyuncs.com"; |
| | | // String url = bucket_name + "/" + imageName; |
| | | // |
| | | // Map<String,Object> map = new HashMap<String,Object>(); |
| | | // Map<String,Object> map2 = new HashMap<String,Object>(); |
| | | // map.put("code",0);//0表示成功,1失败 |
| | | // map.put("msg","上传成功");//提示消息 |
| | | // map.put("data",map2); |
| | | // map2.put("src",url);//图片url |
| | | // map2.put("title",imageNames);//图片名称,这个会显示在输入框里 |
| | | // return map; |
| | | if (file == null || file.isEmpty()) { |
| | | return new FebsResponse().message("上传文件为空").fail(); |
| | | } |
| | | |
| | | try { |
| | | byte[] fileBytes = file.getBytes(); |
| | | String base64Str = java.util.Base64.getEncoder().encodeToString(fileBytes); |
| | | String imageSuffix = "." + file.getOriginalFilename().substring(file.getOriginalFilename().lastIndexOf(".") + 1); |
| | | String imageNames = System.currentTimeMillis() + IdUtil.simpleUUID() + imageSuffix; |
| | | String imageName = "hc/" + imageNames; |
| | | OssUtils.uploadFileWithBase64(base64Str, imageName); |
| | | String bucket_name = "https://excoin.oss-cn-hangzhou.aliyuncs.com"; |
| | | String url = bucket_name + "/" + imageName; |
| | | |
| | | Map<String,Object> map = new HashMap<String,Object>(); |
| | | Map<String,Object> map2 = new HashMap<String,Object>(); |
| | | map2.put("src",url);//图片url |
| | | map2.put("title",imageNames);//图片名称,这个会显示在输入框里 |
| | | map.put("code",0);//0表示成功,1失败 |
| | | map.put("msg","上传成功");//提示消息 |
| | | map.put("data",map2); |
| | | return map; |
| | | } catch (IOException e) { |
| | | log.error("上传失败: {}", e.getMessage()); |
| | | return new FebsResponse().message("上传失败").fail(); |
| | | } |
| | | } |
| | | // /** |
| | | // * 图片上传 |
| | | // * @return |
| | | // */ |
| | | // @PostMapping(value = "/uploadFileBase64") |
| | | // @ControllerEndpoint(operation = "图片上传", exceptionMessage = "上传失败") |
| | | // public Map<String,Object> uploadFileBase64(@RequestBody @Validated MultipartFile file) throws IOException { |
| | | // if (file.isEmpty()) { |
| | | // new FebsResponse().message("上传文件为空"); |
| | | // } |
| | | // return FileUtil.fileUploadEsc(file,resourceUrl,resourcePath); |
| | | // |
| | | //// String base64EncoderImg = ""; |
| | | //// BASE64Encoder base64Encoder =new BASE64Encoder(); |
| | | //// List<String> imageFuffixStr = CollUtil.toList(StrUtil.split(file.getOriginalFilename(), ".")); |
| | | //// String imageFuffix = file.getOriginalFilename().substring(file.getOriginalFilename().lastIndexOf(".")); |
| | | //// if("jpg".equals(imageFuffixStr.get(1))){ |
| | | //// try { |
| | | //// //输出到BufferedImage |
| | | //// BufferedImage bufferedImage = Thumbnails.of(file.getInputStream()) |
| | | //// // 图片大小(长宽)压缩比例 从0-1,1表示原图 |
| | | //// .scale(1f) |
| | | //// // 图片质量压缩比例 从0-1,越接近1质量越好 |
| | | //// .outputQuality(0.9f) |
| | | //// .asBufferedImage(); |
| | | //// //对内存中的图片文件进行Base64处理 |
| | | //// ByteArrayOutputStream newBaos = new ByteArrayOutputStream();//io流 |
| | | //// ImageIO.write(bufferedImage, "jpg", newBaos);//写入流中 |
| | | //// byte[] bytes = newBaos.toByteArray();//转换成字节 |
| | | //// base64EncoderImg = base64Encoder.encode(bytes); |
| | | ////// base64EncoderImg = URLEncoder.encode(new BASE64Encoder().encode(bytes), "UTF-8"); |
| | | //// } catch (Exception e) { |
| | | //// e.printStackTrace(); |
| | | //// } |
| | | //// }else{ |
| | | //// try { |
| | | //// base64EncoderImg = base64Encoder.encode(file.getBytes()); |
| | | //// } catch (IOException e) { |
| | | //// e.printStackTrace(); |
| | | //// } |
| | | //// } |
| | | //// //文件加密 |
| | | ////// String imageFuffix = file.getOriginalFilename().substring(file.getOriginalFilename().lastIndexOf(".")); |
| | | ////// String imageFuffix = ".png"; |
| | | //// String imageNames = System.currentTimeMillis() + IdUtil.simpleUUID() + imageFuffix; |
| | | //// String imageName = "uploadeFile/" + imageNames; |
| | | //// OssUtils.uploadFileWithBase64(base64EncoderImg, imageName); |
| | | //// String bucket_name ="https://excoin.oss-cn-hangzhou.aliyuncs.com"; |
| | | //// String url = bucket_name + "/" + imageName; |
| | | //// |
| | | //// Map<String,Object> map = new HashMap<String,Object>(); |
| | | //// Map<String,Object> map2 = new HashMap<String,Object>(); |
| | | //// map.put("code",0);//0表示成功,1失败 |
| | | //// map.put("msg","上传成功");//提示消息 |
| | | //// map.put("data",map2); |
| | | //// map2.put("src",url);//图片url |
| | | //// map2.put("title",imageNames);//图片名称,这个会显示在输入框里 |
| | | //// return map; |
| | | // } |
| | | |
| | | public String Base64ImageByMemory(BufferedImage pic) { |
| | | String imgString = ""; |
| | | ByteArrayOutputStream newBaos = new ByteArrayOutputStream();//io流 |
New file |
| | |
| | | package cc.mrbird.febs.mall.controller.activity; |
| | | |
| | | import cc.mrbird.febs.common.annotation.ControllerEndpoint; |
| | | import cc.mrbird.febs.common.controller.BaseController; |
| | | import cc.mrbird.febs.common.entity.FebsResponse; |
| | | import cc.mrbird.febs.common.entity.QueryRequest; |
| | | import cc.mrbird.febs.common.utils.RedisUtils; |
| | | import cc.mrbird.febs.mall.dto.AdminHappyActivityCategoryDto; |
| | | import cc.mrbird.febs.mall.dto.activity.AdminActivityOptionAddDto; |
| | | import cc.mrbird.febs.mall.dto.activity.AdminCategoryAddDto; |
| | | import cc.mrbird.febs.mall.dto.activity.AdminCategoryUpdateDto; |
| | | import cc.mrbird.febs.mall.entity.HappyActivity; |
| | | import cc.mrbird.febs.mall.entity.HappyActivityOption; |
| | | import cc.mrbird.febs.mall.service.IAdminHappyActivityService; |
| | | import cn.hutool.core.util.StrUtil; |
| | | import lombok.RequiredArgsConstructor; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.validation.annotation.Validated; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import javax.validation.Valid; |
| | | import javax.validation.constraints.NotNull; |
| | | import java.util.Map; |
| | | |
| | | @Slf4j |
| | | @Validated |
| | | @RestController |
| | | @RequiredArgsConstructor |
| | | @RequestMapping(value = "/admin/happyActivity") |
| | | public class AdminVotesActivityCategoryController extends BaseController { |
| | | |
| | | private final IAdminHappyActivityService adminHappyActivityService; |
| | | private final RedisUtils redisUtils; |
| | | |
| | | /** |
| | | * 分类列表 |
| | | * @return |
| | | */ |
| | | @GetMapping("groupList") |
| | | public FebsResponse groupList(AdminHappyActivityCategoryDto dto, QueryRequest request) { |
| | | |
| | | Map<String, Object> data = getDataTable(adminHappyActivityService.getGroupList(dto, request)); |
| | | return new FebsResponse().success().data(data); |
| | | } |
| | | /** |
| | | * 分类-新增 |
| | | */ |
| | | @PostMapping("addGroup") |
| | | @ControllerEndpoint(operation = "分类-新增", exceptionMessage = "操作失败") |
| | | public FebsResponse addGroup(@RequestBody @Valid AdminCategoryAddDto dto) { |
| | | |
| | | return adminHappyActivityService.addGroup(dto); |
| | | } |
| | | |
| | | /** |
| | | * 分类-删除 |
| | | */ |
| | | @GetMapping("groupDelete/{id}") |
| | | @ControllerEndpoint(operation = "选项-删除", exceptionMessage = "操作失败") |
| | | public FebsResponse groupDelete(@NotNull(message = "{required}") @PathVariable Long id) { |
| | | |
| | | return adminHappyActivityService.groupDelete(id); |
| | | } |
| | | |
| | | /** |
| | | * 分类-更新 |
| | | */ |
| | | @PostMapping("groupUpdate") |
| | | @ControllerEndpoint(operation = "分类-更新", exceptionMessage = "操作失败") |
| | | public FebsResponse groupUpdate(@RequestBody @Valid AdminCategoryUpdateDto dto) { |
| | | |
| | | return adminHappyActivityService.groupUpdate(dto); |
| | | } |
| | | /** |
| | | * 分类-开启 |
| | | */ |
| | | @GetMapping("groupState/{id}/{type}") |
| | | @ControllerEndpoint(operation = "分类-开启", exceptionMessage = "操作失败") |
| | | public FebsResponse groupState( |
| | | @NotNull(message = "{required}") @PathVariable Long id, |
| | | @NotNull(message = "{required}") @PathVariable Integer type) { |
| | | |
| | | return adminHappyActivityService.groupState(id,type); |
| | | } |
| | | |
| | | /** |
| | | * 获取分类 |
| | | * @return |
| | | */ |
| | | @GetMapping(value = "/allGroup") |
| | | public FebsResponse allGroup() { |
| | | |
| | | return new FebsResponse().success().data(adminHappyActivityService.allGroup()); |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * 活动-列表 |
| | | */ |
| | | @GetMapping("list") |
| | | public FebsResponse getAdminActivityListInPage(HappyActivity dto, QueryRequest request) { |
| | | Map<String, Object> data = getDataTable(adminHappyActivityService.getAdminActivityListInPage(dto, request)); |
| | | return new FebsResponse().success().data(data); |
| | | } |
| | | |
| | | /** |
| | | * 活动-新增 |
| | | */ |
| | | @PostMapping("add") |
| | | @ControllerEndpoint(operation = "新增", exceptionMessage = "操作失败") |
| | | public FebsResponse addActivity(@RequestBody HappyActivity dto) { |
| | | return adminHappyActivityService.addActivity(dto); |
| | | } |
| | | |
| | | /** |
| | | * 活动-删除 |
| | | */ |
| | | @GetMapping("delActivity/{id}") |
| | | @ControllerEndpoint(operation = "活动-删除", exceptionMessage = "删除失败") |
| | | public FebsResponse delActivity(@NotNull(message = "{required}") @PathVariable Long id) { |
| | | return adminHappyActivityService.delActivity(id); |
| | | } |
| | | /** |
| | | * 活动-开启 |
| | | */ |
| | | @GetMapping("changeState/{id}/{state}") |
| | | @ControllerEndpoint(operation = "活动-开启", exceptionMessage = "操作失败") |
| | | public FebsResponse changeState(@NotNull(message = "{required}") @PathVariable Long id |
| | | ,@NotNull(message = "{required}") @PathVariable Integer state) { |
| | | return adminHappyActivityService.changeState(id,state); |
| | | } |
| | | |
| | | /** |
| | | * 活动-更新 |
| | | */ |
| | | @PostMapping("activityUpdate") |
| | | @ControllerEndpoint(operation = "活动-更新", exceptionMessage = "操作失败") |
| | | public FebsResponse activityUpdate(@RequestBody HappyActivity dto) { |
| | | |
| | | return adminHappyActivityService.activityUpdate(dto); |
| | | } |
| | | |
| | | /** |
| | | * 获取全部活动 |
| | | * @return |
| | | */ |
| | | @GetMapping(value = "/allActivities") |
| | | public FebsResponse allActivities() { |
| | | return new FebsResponse().success().data(adminHappyActivityService.allActivities()); |
| | | } |
| | | |
| | | /** |
| | | * 选项-列表 |
| | | * @return |
| | | */ |
| | | @GetMapping("optionList") |
| | | public FebsResponse optionList(HappyActivityOption dto, QueryRequest request) { |
| | | |
| | | Map<String, Object> data = getDataTable(adminHappyActivityService.getOptionListInPage(dto, request)); |
| | | return new FebsResponse().success().data(data); |
| | | } |
| | | |
| | | /** |
| | | * 选项-新增 |
| | | */ |
| | | @PostMapping("addOption") |
| | | @ControllerEndpoint(operation = "选项-新增", exceptionMessage = "操作失败") |
| | | public FebsResponse addOption(@RequestBody @Valid AdminActivityOptionAddDto dto) { |
| | | |
| | | return adminHappyActivityService.addOption(dto); |
| | | } |
| | | |
| | | /** |
| | | * 选项-更新 |
| | | */ |
| | | @PostMapping("optionUpdate") |
| | | @ControllerEndpoint(operation = "选项-更新", exceptionMessage = "操作失败") |
| | | public FebsResponse optionUpdate(@RequestBody HappyActivityOption dto) { |
| | | |
| | | return adminHappyActivityService.optionUpdate(dto); |
| | | } |
| | | |
| | | /** |
| | | * 选项-删除 |
| | | */ |
| | | @GetMapping("optionDelete/{id}") |
| | | @ControllerEndpoint(operation = "选项-删除", exceptionMessage = "操作失败") |
| | | public FebsResponse optionDelete(@NotNull(message = "{required}") @PathVariable Long id) { |
| | | |
| | | return adminHappyActivityService.optionDelete(id); |
| | | } |
| | | /** |
| | | * 选项-得票记录 |
| | | */ |
| | | @GetMapping("voteRecord") |
| | | public FebsResponse voteRecord(QueryRequest request, Integer parentId) { |
| | | HappyActivityOption voteRecord = new HappyActivityOption(); |
| | | String existToken = redisUtils.getString("voteRecord"); |
| | | if (StrUtil.isNotBlank(existToken)) { |
| | | redisUtils.del(existToken); |
| | | } |
| | | voteRecord.setId(Long.parseLong(existToken)); |
| | | Map<String, Object> data = getDataTable(adminHappyActivityService.getFollowVoteInPage(voteRecord,request)); |
| | | return new FebsResponse().success().data(data); |
| | | } |
| | | |
| | | } |
| | |
| | | |
| | | import cc.mrbird.febs.common.controller.BaseController; |
| | | import cc.mrbird.febs.common.entity.FebsConstant; |
| | | import cc.mrbird.febs.common.entity.FebsResponse; |
| | | import cc.mrbird.febs.common.entity.QueryRequest; |
| | | import cc.mrbird.febs.common.utils.FebsUtil; |
| | | import cc.mrbird.febs.common.utils.RedisUtils; |
| | | import cc.mrbird.febs.mall.entity.HappyActivity; |
| | |
| | | import org.springframework.web.bind.annotation.PathVariable; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | |
| | | import java.util.Map; |
| | | |
| | | @Controller("votesActivityView") |
| | | @RequestMapping(FebsConstant.VIEW_PREFIX + "modules/votesActivity") |
| | | @RequiredArgsConstructor |
| | | public class ViewHappyActivityController extends BaseController { |
| | | |
| | | private final IAdminHappyActivityService iVoteActivityService; |
| | | private final IAdminHappyActivityService iAdminHappyActivityService; |
| | | private final HappyActivityCategoryMapper happyActivityCategoryMapper; |
| | | private final HappyActivityOptionMapper happyActivityOptionMapper; |
| | | private final RedisUtils redisUtils; |
| | |
| | | @RequiresPermissions("groupInfo:view") |
| | | public String groupInfo(@PathVariable long id, Model model) { |
| | | HappyActivityCategory voteActivityGroup = happyActivityCategoryMapper.selectById(id); |
| | | model.addAttribute("groupInfo", voteActivityGroup); |
| | | model.addAttribute("voteActivityGroup", voteActivityGroup); |
| | | return FebsUtil.view("modules/votesActivity/groupInfo"); |
| | | } |
| | | |
| | | /** |
| | | * 活动选项列表 |
| | | * 活动-列表 |
| | | */ |
| | | @GetMapping("list") |
| | | @RequiresPermissions("list:view") |
| | | public String activityList() { |
| | | return FebsUtil.view("modules/votesActivity/list"); |
| | | } |
| | | |
| | | /** |
| | | * 活动-新增 |
| | | */ |
| | | @GetMapping("add") |
| | | @RequiresPermissions("add:add") |
| | | public String activityAdd() { |
| | | return FebsUtil.view("modules/votesActivity/add"); |
| | | } |
| | | |
| | | /** |
| | | * 活动-修改 |
| | | */ |
| | | @GetMapping("votesActivityUpdate/{id}") |
| | | @RequiresPermissions("votesActivityUpdate:update") |
| | | public String votesActivityctivityUpdate(@PathVariable long id, Model model) { |
| | | HappyActivity happyActivity = iAdminHappyActivityService.getBaseMapper().selectById(id); |
| | | model.addAttribute("activity", happyActivity); |
| | | |
| | | return FebsUtil.view("modules/votesActivity/discountUpdate"); |
| | | } |
| | | |
| | | /** |
| | | * 活动-选项列表 |
| | | */ |
| | | @GetMapping("optionList") |
| | | @RequiresPermissions("optionList:view") |
| | |
| | | } |
| | | |
| | | /** |
| | | * 活动选项新增 |
| | | * 活动-选项新增 |
| | | * @return |
| | | */ |
| | | @GetMapping(value = "/optionAdd") |
| | |
| | | } |
| | | |
| | | /** |
| | | * 活动选项新增编辑 |
| | | * 活动-选项编辑 |
| | | * @param id |
| | | * @param model |
| | | * @return |
| | |
| | | @GetMapping("optionInfo/{id}") |
| | | @RequiresPermissions("optionInfo:view") |
| | | public String optionInfo(@PathVariable long id, Model model) { |
| | | HappyActivityOption voteOption = happyActivityOptionMapper.selectById(id); |
| | | model.addAttribute("voteOption", voteOption); |
| | | HappyActivityOption happyActivityOption = happyActivityOptionMapper.selectById(id); |
| | | model.addAttribute("voteOption", happyActivityOption); |
| | | return FebsUtil.view("modules/votesActivity/optionInfo"); |
| | | } |
| | | /** |
| | | * 活动-得票记录 |
| | | * @return |
| | | */ |
| | | @GetMapping("voteRecord/{id}") |
| | | @RequiresPermissions("voteRecord:view") |
| | | public String moneyFlow(@PathVariable long id, Model model) { |
| | | String existToken = redisUtils.getString("voteRecord"); |
| | | if (StrUtil.isNotBlank(existToken)) { |
| | | redisUtils.del(existToken); |
| | | } |
| | | redisUtils.set("voteRecord", id, -1); |
| | | return FebsUtil.view("modules/votesActivity/voteRecord"); |
| | | } |
| | | } |
| | |
| | | public class AdminHappyActivityCategoryDto { |
| | | private String name; |
| | | private Integer status; |
| | | private Integer hotState; |
| | | } |
New file |
| | |
| | | package cc.mrbird.febs.mall.dto.activity; |
| | | |
| | | import lombok.Data; |
| | | |
| | | import javax.validation.constraints.NotBlank; |
| | | import javax.validation.constraints.NotNull; |
| | | |
| | | @Data |
| | | public class AdminActivityOptionAddDto { |
| | | @NotNull(message = "所属活动不能为空") |
| | | private Long activityId;//投票活动ID |
| | | |
| | | @NotBlank(message = "选项名称不能为空") |
| | | private String optionName;//佳丽姓名 |
| | | |
| | | private String realName;//注册姓名 |
| | | |
| | | private String image;//投票选项图片 URL |
| | | |
| | | private String description;//投票活动描述 |
| | | |
| | | private String videoUrl; //视频url |
| | | |
| | | private String mobilePhone;//手机 |
| | | |
| | | private String sex;//性别 |
| | | |
| | | private String hobby;//兴趣爱好 |
| | | |
| | | private String mcnState;//是否签约MCN机构 0否 1是 |
| | | |
| | | private String address;//地址 |
| | | |
| | | private String province;//省份 |
| | | |
| | | private String city;//城市 |
| | | |
| | | private String email;//邮箱 |
| | | } |
New file |
| | |
| | | package cc.mrbird.febs.mall.dto.activity; |
| | | |
| | | import lombok.Data; |
| | | |
| | | import javax.validation.constraints.NotBlank; |
| | | import javax.validation.constraints.NotNull; |
| | | |
| | | @Data |
| | | public class AdminCategoryAddDto { |
| | | |
| | | @NotBlank(message = "名称不能为空") |
| | | private String name; |
| | | |
| | | @NotNull(message = "排序不能为空") |
| | | private Integer orderCnt; |
| | | } |
New file |
| | |
| | | package cc.mrbird.febs.mall.dto.activity; |
| | | |
| | | import lombok.Data; |
| | | |
| | | import javax.validation.constraints.NotBlank; |
| | | import javax.validation.constraints.NotNull; |
| | | |
| | | @Data |
| | | public class AdminCategoryUpdateDto { |
| | | |
| | | @NotNull(message = "ID不能为空") |
| | | private Long id; |
| | | |
| | | @NotBlank(message = "名称不能为空") |
| | | private String name; |
| | | |
| | | @NotNull(message = "排序不能为空") |
| | | private Integer orderCnt; |
| | | } |
| | |
| | | package cc.mrbird.febs.mall.entity; |
| | | |
| | | import cc.mrbird.febs.common.entity.BaseEntity; |
| | | import com.baomidou.mybatisplus.annotation.TableField; |
| | | import com.baomidou.mybatisplus.annotation.TableName; |
| | | import com.fasterxml.jackson.annotation.JsonFormat; |
| | | import lombok.Data; |
| | |
| | | `back_img` varchar(500) DEFAULT NULL COMMENT '背景图片', |
| | | `DELETE_FLAG` int(11) DEFAULT '0' COMMENT '删除标识 0-未删除 1-已删除', |
| | | `vote_cnt` int(11) DEFAULT NULL COMMENT '投票数量', |
| | | `add_state` int(11) DEFAULT '0' COMMENT '是否允许报名 0-不允许 1-允许', |
| | | */ |
| | | private Long categoryId; |
| | | @TableField(exist = false) |
| | | private String categoryName;// |
| | | private String code; |
| | | private String name; |
| | | private Integer type; |
| | |
| | | private String backImg; |
| | | private Integer deleteFlag; |
| | | private Integer voteCnt; |
| | | private Integer addState; |
| | | |
| | | |
| | | } |
| | |
| | | package cc.mrbird.febs.mall.entity; |
| | | |
| | | import cc.mrbird.febs.common.entity.BaseEntity; |
| | | import com.baomidou.mybatisplus.annotation.TableField; |
| | | import com.baomidou.mybatisplus.annotation.TableName; |
| | | import lombok.Data; |
| | | |
| | |
| | | `DELETE_FLAG` int(11) DEFAULT '0' COMMENT '删除标识 0-未删除 1-已删除', |
| | | */ |
| | | private Long memberId; |
| | | //用户昵称 |
| | | @TableField(exist = false) |
| | | private String memberName; |
| | | |
| | | private Integer sourceType; |
| | | private Long sourceId; |
| | | //活动名称 |
| | | @TableField(exist = false) |
| | | private String activityName; |
| | | |
| | | private Long sourceOptionId; |
| | | //选项名称 |
| | | @TableField(exist = false) |
| | | private String optionName; |
| | | |
| | | private Integer type; |
| | | private Integer deleteFlag; |
| | | |
| | |
| | | package cc.mrbird.febs.mall.service; |
| | | |
| | | import cc.mrbird.febs.common.entity.FebsResponse; |
| | | import cc.mrbird.febs.common.entity.QueryRequest; |
| | | import cc.mrbird.febs.mall.dto.AdminHappyActivityCategoryDto; |
| | | import cc.mrbird.febs.mall.dto.activity.AdminActivityOptionAddDto; |
| | | import cc.mrbird.febs.mall.dto.activity.AdminCategoryAddDto; |
| | | import cc.mrbird.febs.mall.dto.activity.AdminCategoryUpdateDto; |
| | | import cc.mrbird.febs.mall.entity.HappyActivity; |
| | | import cc.mrbird.febs.mall.entity.HappyActivityCategory; |
| | | import cc.mrbird.febs.mall.entity.HappyActivityOption; |
| | | import cc.mrbird.febs.mall.entity.HappyFollow; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | |
| | | import javax.validation.Valid; |
| | | import javax.validation.constraints.NotNull; |
| | | import java.util.List; |
| | | |
| | | public interface IAdminHappyActivityService extends IService<HappyActivity>{ |
| | | |
| | | |
| | | IPage<HappyActivityCategory> getGroupList(AdminHappyActivityCategoryDto dto, QueryRequest request); |
| | | |
| | | FebsResponse addGroup(AdminCategoryAddDto dto); |
| | | |
| | | FebsResponse groupDelete(@NotNull(message = "{required}") Long id); |
| | | |
| | | FebsResponse groupUpdate(@Valid AdminCategoryUpdateDto dto); |
| | | |
| | | FebsResponse groupState(@NotNull(message = "{required}") Long id, @NotNull(message = "{required}") Integer type); |
| | | |
| | | List<HappyActivityCategory> allGroup(); |
| | | |
| | | IPage<HappyActivity> getAdminActivityListInPage(HappyActivity dto, QueryRequest request); |
| | | |
| | | FebsResponse addActivity(HappyActivity dto); |
| | | |
| | | FebsResponse delActivity(Long id); |
| | | |
| | | FebsResponse changeState(Long id, Integer state); |
| | | |
| | | FebsResponse activityUpdate(HappyActivity dto); |
| | | |
| | | IPage<HappyActivityOption> getOptionListInPage(HappyActivityOption dto, QueryRequest request); |
| | | |
| | | List<HappyActivity> allActivities(); |
| | | |
| | | FebsResponse addOption(AdminActivityOptionAddDto dto); |
| | | |
| | | FebsResponse optionUpdate(HappyActivityOption dto); |
| | | |
| | | FebsResponse optionDelete(Long id); |
| | | |
| | | IPage<HappyFollow> getFollowVoteInPage(HappyActivityOption voteRecord, QueryRequest request); |
| | | } |
| | |
| | | package cc.mrbird.febs.mall.service.impl; |
| | | |
| | | import cc.mrbird.febs.common.entity.FebsResponse; |
| | | import cc.mrbird.febs.common.entity.QueryRequest; |
| | | import cc.mrbird.febs.common.enumerates.StateUpDownEnum; |
| | | import cc.mrbird.febs.common.utils.MallUtils; |
| | | import cc.mrbird.febs.mall.dto.AdminHappyActivityCategoryDto; |
| | | import cc.mrbird.febs.mall.entity.HappyActivity; |
| | | import cc.mrbird.febs.mall.entity.HappyActivityCategory; |
| | | import cc.mrbird.febs.mall.mapper.HappyActivityCategoryMapper; |
| | | import cc.mrbird.febs.mall.mapper.HappyActivityMapper; |
| | | import cc.mrbird.febs.mall.dto.activity.AdminActivityOptionAddDto; |
| | | import cc.mrbird.febs.mall.dto.activity.AdminCategoryAddDto; |
| | | import cc.mrbird.febs.mall.dto.activity.AdminCategoryUpdateDto; |
| | | import cc.mrbird.febs.mall.entity.*; |
| | | import cc.mrbird.febs.mall.mapper.*; |
| | | import cc.mrbird.febs.mall.service.IAdminHappyActivityService; |
| | | import cn.hutool.core.bean.BeanUtil; |
| | | import cn.hutool.core.collection.CollUtil; |
| | | import cn.hutool.core.util.ObjectUtil; |
| | | import cn.hutool.core.util.StrUtil; |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | |
| | | import java.util.Collections; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.Set; |
| | | import java.util.stream.Collectors; |
| | | |
| | | @Slf4j |
| | | @Service |
| | | @RequiredArgsConstructor |
| | |
| | | public class AdminHappyActivityServiceImpl extends ServiceImpl<HappyActivityMapper, HappyActivity> implements IAdminHappyActivityService { |
| | | |
| | | private final HappyActivityCategoryMapper happyActivityCategoryMapper; |
| | | private final HappyActivityOptionMapper happyActivityOptionMapper; |
| | | private final HappyFollowMapper happyFollowMapper; |
| | | private final MallMemberMapper mallMemberMapper; |
| | | |
| | | @Override |
| | | public IPage<HappyActivityCategory> getGroupList(AdminHappyActivityCategoryDto dto, QueryRequest request) { |
| | | Page<HappyActivityCategory> page = new Page<>(request.getPageNum(), request.getPageSize()); |
| | |
| | | if(ObjectUtil.isNotEmpty(dto.getStatus())){ |
| | | voteOptionLambdaQueryWrapper.eq(HappyActivityCategory::getState,dto.getStatus()); |
| | | } |
| | | if(ObjectUtil.isNotEmpty(dto.getHotState())){ |
| | | voteOptionLambdaQueryWrapper.eq(HappyActivityCategory::getHotState,dto.getHotState()); |
| | | } |
| | | voteOptionLambdaQueryWrapper.eq(HappyActivityCategory::getDeleteFlag, StateUpDownEnum.DOWN.getCode()); |
| | | voteOptionLambdaQueryWrapper.orderByDesc(HappyActivityCategory::getCreatedTime); |
| | | Page<HappyActivityCategory> adminOptionVoIPage = happyActivityCategoryMapper.selectPage(page, voteOptionLambdaQueryWrapper); |
| | | return adminOptionVoIPage; |
| | | } |
| | | |
| | | @Override |
| | | public FebsResponse addGroup(AdminCategoryAddDto dto) { |
| | | |
| | | HappyActivityCategory happyActivityCategory = new HappyActivityCategory(); |
| | | happyActivityCategory.setName(dto.getName()); |
| | | happyActivityCategory.setOrderCnt(dto.getOrderCnt()); |
| | | happyActivityCategoryMapper.insert(happyActivityCategory); |
| | | return new FebsResponse().success().message("操作成功"); |
| | | } |
| | | |
| | | @Override |
| | | public FebsResponse groupDelete(Long id) { |
| | | HappyActivityCategory happyActivityCategory = happyActivityCategoryMapper.selectById(id); |
| | | happyActivityCategory.setDeleteFlag(StateUpDownEnum.UP.getCode()); |
| | | happyActivityCategoryMapper.updateById(happyActivityCategory); |
| | | return new FebsResponse().success().message("操作成功"); |
| | | } |
| | | |
| | | @Override |
| | | public FebsResponse groupUpdate(AdminCategoryUpdateDto dto) { |
| | | |
| | | HappyActivityCategory happyActivityCategory = happyActivityCategoryMapper.selectById(dto.getId()); |
| | | happyActivityCategory.setName(dto.getName()); |
| | | happyActivityCategory.setOrderCnt(dto.getOrderCnt()); |
| | | happyActivityCategoryMapper.updateById(happyActivityCategory); |
| | | return new FebsResponse().success().message("操作成功"); |
| | | } |
| | | |
| | | @Override |
| | | public FebsResponse groupState(Long id, Integer type) { |
| | | |
| | | HappyActivityCategory happyActivityCategory = happyActivityCategoryMapper.selectById(id); |
| | | if(StateUpDownEnum.UP.getCode() == happyActivityCategory.getDeleteFlag()){ |
| | | throw new RuntimeException("该分组已删除,无法操作"); |
| | | } |
| | | |
| | | if(type == 1){ |
| | | happyActivityCategory.setHotState(happyActivityCategory.getHotState() == StateUpDownEnum.UP.getCode() ? StateUpDownEnum.DOWN.getCode() : StateUpDownEnum.UP.getCode()); |
| | | } |
| | | |
| | | if(type == 2){ |
| | | happyActivityCategory.setState(happyActivityCategory.getState() == StateUpDownEnum.UP.getCode() ? StateUpDownEnum.DOWN.getCode() : StateUpDownEnum.UP.getCode()); |
| | | } |
| | | happyActivityCategoryMapper.updateById(happyActivityCategory); |
| | | return new FebsResponse().success().message("操作成功"); |
| | | } |
| | | |
| | | @Override |
| | | public List<HappyActivityCategory> allGroup() { |
| | | List<HappyActivityCategory> happyActivityCategories = |
| | | happyActivityCategoryMapper.selectList( |
| | | new LambdaQueryWrapper<HappyActivityCategory>() |
| | | .eq(HappyActivityCategory::getState, StateUpDownEnum.UP.getCode()) |
| | | .eq(HappyActivityCategory::getDeleteFlag, StateUpDownEnum.DOWN.getCode()) |
| | | .orderByDesc(HappyActivityCategory::getOrderCnt) |
| | | ); |
| | | if(CollUtil.isNotEmpty(happyActivityCategories)){ |
| | | return happyActivityCategories; |
| | | } |
| | | return Collections.emptyList(); |
| | | } |
| | | |
| | | @Override |
| | | public IPage<HappyActivity> getAdminActivityListInPage(HappyActivity dto, QueryRequest request) { |
| | | Page<HappyActivity> page = new Page<>(request.getPageNum(), request.getPageSize()); |
| | | LambdaQueryWrapper<HappyActivity> voteActivityLambdaQueryWrapper = new LambdaQueryWrapper<>(); |
| | | if(StrUtil.isNotEmpty(dto.getName())){ |
| | | voteActivityLambdaQueryWrapper.like(HappyActivity::getName,dto.getName()); |
| | | } |
| | | if(ObjectUtil.isNotEmpty(dto.getState())){ |
| | | voteActivityLambdaQueryWrapper.eq(HappyActivity::getState,dto.getState()); |
| | | } |
| | | |
| | | if(ObjectUtil.isNotEmpty(dto.getCategoryId())){ |
| | | voteActivityLambdaQueryWrapper.eq(HappyActivity::getCategoryId,dto.getCategoryId()); |
| | | } |
| | | voteActivityLambdaQueryWrapper.eq(HappyActivity::getDeleteFlag, StateUpDownEnum.DOWN.getCode()); |
| | | voteActivityLambdaQueryWrapper.orderByDesc(HappyActivity::getCreatedTime); |
| | | Page<HappyActivity> voteActivityPage = this.baseMapper.selectPage(page, voteActivityLambdaQueryWrapper); |
| | | |
| | | List<HappyActivity> records = voteActivityPage.getRecords(); |
| | | if(CollUtil.isNotEmpty(records)){ |
| | | //stream流获取records的全部categoryId |
| | | Set<Long> categoryIds = records.stream().map(HappyActivity::getCategoryId).collect(Collectors.toSet()); |
| | | if(CollUtil.isNotEmpty(categoryIds)){ |
| | | //stream流操作categoryIds得到一个Map<categoryId,HappyActivityCategory>的map对象 |
| | | List<HappyActivityCategory> happyActivityCategories = happyActivityCategoryMapper.selectList( |
| | | new LambdaQueryWrapper<HappyActivityCategory>() |
| | | .select(HappyActivityCategory::getId, HappyActivityCategory::getName) |
| | | .in(HappyActivityCategory::getId,categoryIds) |
| | | ); |
| | | Map<Long, HappyActivityCategory> categoryMap = happyActivityCategories.stream().collect(Collectors.toMap(HappyActivityCategory::getId, happyActivityCategory -> happyActivityCategory)); |
| | | |
| | | for (HappyActivity happyActivity : records){ |
| | | happyActivity.setCategoryName(categoryMap.get(happyActivity.getCategoryId()).getName()); |
| | | } |
| | | } |
| | | } |
| | | return voteActivityPage; |
| | | } |
| | | |
| | | @Override |
| | | public FebsResponse addActivity(HappyActivity dto) { |
| | | |
| | | String code = MallUtils.getOrderNum("AC"); |
| | | |
| | | HappyActivity happyActivity = new HappyActivity(); |
| | | BeanUtil.copyProperties(dto, happyActivity); |
| | | happyActivity.setCode(code); |
| | | this.baseMapper.insert(happyActivity); |
| | | |
| | | return new FebsResponse().success().message("操作成功"); |
| | | } |
| | | |
| | | @Override |
| | | public FebsResponse delActivity(Long id) { |
| | | HappyActivity happyActivity = this.baseMapper.selectById(id); |
| | | |
| | | happyActivity.setDeleteFlag(StateUpDownEnum.UP.getCode()); |
| | | this.baseMapper.updateById(happyActivity); |
| | | |
| | | return new FebsResponse().success().message("操作成功"); |
| | | } |
| | | |
| | | @Override |
| | | public FebsResponse changeState(Long id, Integer state) { |
| | | HappyActivity happyActivity = this.baseMapper.selectById(id); |
| | | |
| | | happyActivity.setState(state); |
| | | this.baseMapper.updateById(happyActivity); |
| | | |
| | | return new FebsResponse().success().message("操作成功"); |
| | | } |
| | | |
| | | @Override |
| | | public FebsResponse activityUpdate(HappyActivity dto) { |
| | | |
| | | HappyActivity happyActivity = this.baseMapper.selectById(dto.getId()); |
| | | happyActivity.setCategoryId(dto.getCategoryId()); |
| | | happyActivity.setName(dto.getName()); |
| | | happyActivity.setType(dto.getType()); |
| | | happyActivity.setJoinCnt(dto.getJoinCnt()); |
| | | happyActivity.setStartTime(dto.getStartTime()); |
| | | happyActivity.setEndTime(dto.getEndTime()); |
| | | happyActivity.setPhone(dto.getPhone()); |
| | | happyActivity.setAddress(dto.getAddress()); |
| | | happyActivity.setPayState(dto.getPayState()); |
| | | happyActivity.setPayAmount(dto.getPayAmount()); |
| | | happyActivity.setTextRemark(dto.getTextRemark()); |
| | | happyActivity.setIndexImg(dto.getIndexImg()); |
| | | happyActivity.setOrderCnt(dto.getOrderCnt()); |
| | | happyActivity.setHotState(dto.getHotState()); |
| | | happyActivity.setBackImg(dto.getBackImg()); |
| | | happyActivity.setVoteCnt(dto.getVoteCnt()); |
| | | happyActivity.setAddState(dto.getAddState()); |
| | | this.baseMapper.updateById(happyActivity); |
| | | |
| | | return new FebsResponse().success().message("操作成功"); |
| | | } |
| | | |
| | | @Override |
| | | public IPage<HappyActivityOption> getOptionListInPage(HappyActivityOption dto, QueryRequest request) { |
| | | List<HappyActivity> happyActivities = this.baseMapper.selectList( |
| | | new LambdaQueryWrapper<HappyActivity>() |
| | | .select(HappyActivity::getId) |
| | | .eq(HappyActivity::getType, StateUpDownEnum.ACTIVITY_TYPE_VOTE.getCode()) |
| | | ); |
| | | if(CollUtil.isEmpty(happyActivities)){ |
| | | return new Page<>(); |
| | | } |
| | | |
| | | //stream流操作happyActivities得到一个set<id>集合 |
| | | Set<Long> activityIds = happyActivities.stream().map(HappyActivity::getId).collect(Collectors.toSet()); |
| | | |
| | | Page<HappyActivityOption> page = new Page<>(request.getPageNum(), request.getPageSize()); |
| | | LambdaQueryWrapper<HappyActivityOption> voteOptionLambdaQueryWrapper = new LambdaQueryWrapper<>(); |
| | | if(ObjectUtil.isNotEmpty(dto.getActivityId())){ |
| | | voteOptionLambdaQueryWrapper.eq(HappyActivityOption::getActivityId,dto.getActivityId()); |
| | | } |
| | | if(ObjectUtil.isNotEmpty(dto.getState())){ |
| | | voteOptionLambdaQueryWrapper.eq(HappyActivityOption::getState,dto.getState()); |
| | | } |
| | | if(ObjectUtil.isNotEmpty(dto.getOptionName())){ |
| | | voteOptionLambdaQueryWrapper.eq(HappyActivityOption::getOptionName,dto.getOptionName()); |
| | | } |
| | | voteOptionLambdaQueryWrapper.in(HappyActivityOption::getActivityId,activityIds); |
| | | voteOptionLambdaQueryWrapper.eq(HappyActivityOption::getDeleteFlag, StateUpDownEnum.DOWN.getCode()); |
| | | voteOptionLambdaQueryWrapper.orderByDesc(HappyActivityOption::getCreatedTime); |
| | | Page<HappyActivityOption> adminOptionVoIPage = happyActivityOptionMapper.selectPage(page, voteOptionLambdaQueryWrapper); |
| | | return adminOptionVoIPage; |
| | | } |
| | | |
| | | @Override |
| | | public List<HappyActivity> allActivities() { |
| | | List<HappyActivity> happyActivities = this.baseMapper.selectList( |
| | | new LambdaQueryWrapper<HappyActivity>() |
| | | .select(HappyActivity::getId, HappyActivity::getName) |
| | | .eq(HappyActivity::getType, StateUpDownEnum.ACTIVITY_TYPE_VOTE.getCode()) |
| | | .eq(HappyActivity::getDeleteFlag, StateUpDownEnum.DOWN.getCode()) |
| | | ); |
| | | return happyActivities; |
| | | } |
| | | |
| | | @Override |
| | | public FebsResponse addOption(AdminActivityOptionAddDto dto) { |
| | | |
| | | |
| | | if(ObjectUtil.isEmpty(dto.getActivityId())){ |
| | | return new FebsResponse().fail().message("请选择投票活动"); |
| | | } |
| | | |
| | | List<HappyActivityOption> happyActivityOptions = happyActivityOptionMapper.selectList( |
| | | new LambdaQueryWrapper<HappyActivityOption>() |
| | | .eq(HappyActivityOption::getActivityId, dto.getActivityId()) |
| | | .eq(HappyActivityOption::getDeleteFlag, StateUpDownEnum.DOWN.getCode()) |
| | | ); |
| | | |
| | | HappyActivityOption happyActivityOption = new HappyActivityOption(); |
| | | BeanUtil.copyProperties(dto, happyActivityOption); |
| | | |
| | | happyActivityOption.setOrderCnt(CollUtil.isEmpty(happyActivityOptions) ? 1 : happyActivityOptions.size() + 1); |
| | | happyActivityOptionMapper.insert(happyActivityOption); |
| | | return new FebsResponse().success().message("操作成功"); |
| | | } |
| | | |
| | | @Override |
| | | public FebsResponse optionUpdate(HappyActivityOption dto) { |
| | | |
| | | HappyActivityOption happyActivityOption = happyActivityOptionMapper.selectById(dto.getId()); |
| | | BeanUtil.copyProperties(dto, happyActivityOption); |
| | | happyActivityOptionMapper.updateById(happyActivityOption); |
| | | return new FebsResponse().success().message("操作成功"); |
| | | } |
| | | |
| | | @Override |
| | | public FebsResponse optionDelete(Long id) { |
| | | |
| | | HappyActivityOption happyActivityOption = happyActivityOptionMapper.selectById(id); |
| | | |
| | | happyActivityOption.setDeleteFlag(StateUpDownEnum.UP.getCode()); |
| | | happyActivityOptionMapper.updateById(happyActivityOption); |
| | | return new FebsResponse().success().message("操作成功"); |
| | | } |
| | | |
| | | @Override |
| | | public IPage<HappyFollow> getFollowVoteInPage(HappyActivityOption voteRecord, QueryRequest request) { |
| | | Long id = voteRecord.getId(); |
| | | HappyActivityOption happyActivityOption = happyActivityOptionMapper.selectById(id); |
| | | if(ObjectUtil.isEmpty(happyActivityOption)){ |
| | | return null; |
| | | } |
| | | HappyActivity happyActivity = this.baseMapper.selectById(happyActivityOption.getActivityId()); |
| | | if(ObjectUtil.isEmpty(happyActivity)){ |
| | | return null; |
| | | } |
| | | //获取活动名称 |
| | | String activityName = happyActivity.getName(); |
| | | |
| | | //获取选项名称 |
| | | String optionName = happyActivityOption.getOptionName(); |
| | | |
| | | Page<HappyFollow> page = new Page<>(request.getPageNum(), request.getPageSize()); |
| | | LambdaQueryWrapper<HappyFollow> voteRecordLambdaQueryWrapper = new LambdaQueryWrapper<>(); |
| | | voteRecordLambdaQueryWrapper.eq(HappyFollow::getSourceId, happyActivity.getId()); |
| | | voteRecordLambdaQueryWrapper.eq(HappyFollow::getSourceOptionId, happyActivityOption.getId()); |
| | | voteRecordLambdaQueryWrapper.eq(HappyFollow::getType,StateUpDownEnum.VOTE.getCode()); |
| | | voteRecordLambdaQueryWrapper.orderByDesc(HappyFollow::getCreatedTime); |
| | | Page<HappyFollow> adminIPage = happyFollowMapper.selectPage(page, voteRecordLambdaQueryWrapper); |
| | | if(CollUtil.isNotEmpty(adminIPage.getRecords())){ |
| | | List<HappyFollow> records = adminIPage.getRecords(); |
| | | //stream流获取records的memberId的set集合 |
| | | Set<Long> memberIds = records.stream().map(HappyFollow::getMemberId).collect(Collectors.toSet()); |
| | | List<MallMember> mallMembers = mallMemberMapper.selectList(new LambdaQueryWrapper<MallMember>().in(MallMember::getId, memberIds)); |
| | | Map<Long, MallMember> mallMemberMap = mallMembers.stream().collect(Collectors.toMap(MallMember::getId, mallMember -> mallMember)); |
| | | for(HappyFollow record : records){ |
| | | record.setActivityName(activityName); |
| | | record.setOptionName(optionName); |
| | | String memberName = mallMemberMap.get(record.getMemberId()).getName(); |
| | | record.setMemberName(StrUtil.isEmpty(memberName) ? "未知用户" : memberName); |
| | | } |
| | | } |
| | | return adminIPage; |
| | | } |
| | | } |
| | |
| | | <div class="layui-fluid layui-anim febs-anim" id="febs-activity-add" lay-title="新增"> |
| | | <div class="layui-fluid layui-anim febs-anim" id="febs-activity-add" lay-title="活动新增"> |
| | | <div class="layui-row febs-container"> |
| | | <div class="layui-col-md12"> |
| | | <div class="layui-fluid" id="activity-add"> |
| | |
| | | <blockquote class="layui-elem-quote blue-border">基础信息</blockquote> |
| | | <div class="layui-row layui-col-space10 layui-form-item"> |
| | | <div class="layui-col-lg6"> |
| | | <label class="layui-form-label febs-form-item-require">所属分类:</label> |
| | | <label class="layui-form-label febs-form-item-require">分类:</label> |
| | | <div class="layui-input-block"> |
| | | <div id="activity-group"></div> |
| | | </div> |
| | |
| | | </div> |
| | | <div class="layui-row layui-col-space10 layui-form-item"> |
| | | <div class="layui-col-lg6"> |
| | | <label class="layui-form-label febs-form-item-require">排序:</label> |
| | | <div class="layui-input-block"> |
| | | <input type="text" name="orderCnt" lay-verify="required" |
| | | placeholder="" autocomplete="off" class="layui-input"> |
| | | </div> |
| | | </div> |
| | | <div class="layui-col-lg6"> |
| | | <label class="layui-form-label febs-form-item-require">名称:</label> |
| | | <div class="layui-input-block"> |
| | | <input type="text" name="name" lay-verify="required" |
| | | placeholder="" autocomplete="off" class="layui-input"> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | <div class="layui-row layui-col-space10 layui-form-item"> |
| | | <div class="layui-col-lg6"> |
| | | <label class="layui-form-label febs-form-item-require">活动类型:</label> |
| | | <label class="layui-form-label febs-form-item-require">类型:</label> |
| | | <div class="layui-input-block"> |
| | | <select name="activityType" class="activity-type"> |
| | | <option value="1">文字</option> |
| | | <option value="2">图片</option> |
| | | <option value="3">视频</option> |
| | | <option value="4">二维码</option> |
| | | <select name="type" class="activity-type"> |
| | | <option value="1">普通活动</option> |
| | | <option value="2">众筹活动</option> |
| | | <option value="3">投票活动</option> |
| | | </select> |
| | | </div> |
| | | </div> |
| | | <div class="layui-col-lg6"> |
| | | <label class="layui-form-label febs-form-item-require">推荐首页:</label> |
| | | <div class="layui-input-block"> |
| | | <select name="hotState" class="activity-type"> |
| | | <option value="0">不推荐</option> |
| | | <option value="1">推荐</option> |
| | | </select> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | <div class="layui-row layui-col-space10 layui-form-item"> |
| | | <div class="layui-col-lg6"> |
| | | <label class="layui-form-label ">票数总数:</label> |
| | | <label class="layui-form-label febs-form-item-require">联系方式:</label> |
| | | <div class="layui-input-block"> |
| | | <input type="text" name="totalVote" |
| | | placeholder="" autocomplete="off" class="layui-input" disabled> |
| | | <input type="text" name="phone" lay-verify="required" |
| | | placeholder="" autocomplete="off" class="layui-input"> |
| | | </div> |
| | | </div> |
| | | <div class="layui-col-lg6"> |
| | | <label class="layui-form-label ">参与人数:</label> |
| | | <label class="layui-form-label febs-form-item-require">地址:</label> |
| | | <div class="layui-input-block"> |
| | | <input type="text" name="totalParticipants" |
| | | placeholder="" autocomplete="off" class="layui-input" disabled> |
| | | <input type="text" name="address" lay-verify="required" |
| | | placeholder="" autocomplete="off" class="layui-input"> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | <div class="layui-row layui-col-space10 layui-form-item"> |
| | | <div class="layui-col-lg6"> |
| | | <label class="layui-form-label febs-form-item-require">投票次数:</label> |
| | | <div class="layui-input-block"> |
| | | <input type="text" name="voteCnt" lay-verify="required" |
| | | placeholder="" autocomplete="off" class="layui-input"> |
| | | <div class="layui-form-mid layui-word-aux">投票活动,单个ID每天投票次数</div> |
| | | </div> |
| | | </div> |
| | | <div class="layui-col-lg6"> |
| | | <label class="layui-form-label febs-form-item-require">自主报名:</label> |
| | | <div class="layui-input-block"> |
| | | <select name="hotState" class="activity-type"> |
| | | <option value="0">不允许</option> |
| | | <option value="1">允许</option> |
| | | </select> |
| | | <div class="layui-form-mid layui-word-aux">投票活动,是否允许用户小程序自主报名</div> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | |
| | | <div class="layui-row layui-col-space10 layui-form-item"> |
| | | <div class="layui-col-lg6"> |
| | | <label class="layui-form-label febs-form-item-require">开始时间:</label> |
| | |
| | | </div> |
| | | </div> |
| | | |
| | | |
| | | <div class="layui-row layui-col-space10 layui-form-item"> |
| | | <div class="layui-col-lg6"> |
| | | <label class="layui-form-label febs-form-item-require">是否多选:</label> |
| | | <label class="layui-form-label febs-form-item-require">门票售卖:</label> |
| | | <div class="layui-input-block"> |
| | | <select name="isMultiple" class="activity-type"> |
| | | <option value="1">是</option> |
| | | <option value="2">否</option> |
| | | <select name="payState" class="activity-type"> |
| | | <option value="0">关闭</option> |
| | | <option value="1">开启</option> |
| | | </select> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | |
| | | <div class="layui-row layui-col-space10 layui-form-item"> |
| | | <div class="layui-col-lg6"> |
| | | <label class="layui-form-label febs-form-item-require">门票总数:</label> |
| | | <div class="layui-input-block"> |
| | | <input type="text" name="joinCnt" lay-verify="required" |
| | | placeholder="" autocomplete="off" class="layui-input"> |
| | | <div class="layui-form-mid layui-word-aux">门票总数</div> |
| | | </div> |
| | | </div> |
| | | <div class="layui-col-lg6"> |
| | | <label class="layui-form-label febs-form-item-require">投票方式:</label> |
| | | <label class="layui-form-label febs-form-item-require">门票价格:</label> |
| | | <div class="layui-input-block"> |
| | | <select name="votesType" class="activity-type" > |
| | | <option value="1">一天一次</option> |
| | | </select> |
| | | <input type="text" name="payAmount" lay-verify="required" |
| | | placeholder="" autocomplete="off" class="layui-input"> |
| | | <div class="layui-form-mid layui-word-aux">门票价格(关闭众筹,或者免费参与,请填写0)</div> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | <div class="layui-form-item"> |
| | | <label class="layui-form-label febs-form-item-require">背景图片:</label> |
| | | |
| | | <div class="layui-row layui-col-space10 layui-form-item"> |
| | | <div class="layui-col-lg6"> |
| | | <label class="layui-form-label febs-form-item-require">封面:</label> |
| | | <div class="layui-input-block"> |
| | | <div class="layui-upload"> |
| | | <button type="button" class="layui-btn layui-btn-normal layui-btn" id="test1Max">上传</button> |
| | | <blockquote class="layui-elem-quote layui-quote-nm" style="margin-top: 10px;"> |
| | | <div class="layui-upload-list" id="demo1Max"></div> |
| | | </blockquote> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | <div class="layui-col-lg6"> |
| | | <label class="layui-form-label febs-form-item-require">背景:</label> |
| | | <div class="layui-input-block"> |
| | | <div class="layui-upload"> |
| | | <button type="button" class="layui-btn layui-btn-normal layui-btn" id="testMax">上传</button> |
| | |
| | | </div> |
| | | </div> |
| | | </div> |
| | | <div class="layui-form-item febs-hide"> |
| | | <label class="layui-form-label">图片链接:</label> |
| | | </div> |
| | | |
| | | <div class="layui-row layui-col-space10 layui-form-item febs-hide"> |
| | | <div class="layui-col-lg6"> |
| | | <label class="layui-form-label">封面链接:</label> |
| | | <div class="layui-input-block"> |
| | | <input type="text" id="coverImage" lay-verify="required" name="coverImage" autocomplete="off" class="layui-input" readonly> |
| | | <input type="text" id="indexImg" lay-verify="required" name="indexImg" autocomplete="off" class="layui-input" readonly> |
| | | </div> |
| | | </div> |
| | | <div class="layui-col-lg6"> |
| | | <label class="layui-form-label">背景链接:</label> |
| | | <div class="layui-input-block"> |
| | | <input type="text" id="backImg" lay-verify="required" name="backImg" autocomplete="off" class="layui-input" readonly> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | |
| | |
| | | var form = new FormData(); |
| | | form.append("file", files[0]); |
| | | $.ajax({ |
| | | url:'/admin/goods/uploadFileBaseEsc', |
| | | url:'/admin/goods/uploadFileBase64', |
| | | type: "post", |
| | | processData: false, |
| | | contentType: false, |
| | |
| | | data: [] |
| | | }) |
| | | |
| | | febs.get(ctx + 'admin/votesActivity/allGroup', null, function(res) { |
| | | febs.get(ctx + 'admin/happyActivity/allGroup', null, function(res) { |
| | | activityGroup.update({ |
| | | data : res.data, |
| | | autoRow: true, |
| | | }); |
| | | }) |
| | | |
| | | //图片上传 |
| | | upload.render({ |
| | | elem: '#test1Max' |
| | | ,url: ctx + 'admin/goods/uploadFileBase64' //改成您自己的上传接口 |
| | | ,accept: 'file' //普通文件 |
| | | ,size: 10240 //限制文件大小,单位 KB |
| | | ,before: function(obj){ |
| | | //预读本地文件示例,不支持ie8 |
| | | obj.preview(function(index, file, result){ |
| | | $('#demo1Max').html('<img src="'+ result +'" alt="'+ file.name +'" class="layui-upload-img single-image" style="width: 130px">') |
| | | }); |
| | | } |
| | | ,done: function(res){ |
| | | $("#indexImg").val(res.data.src); |
| | | } |
| | | }); |
| | | |
| | | //图片上传 |
| | | upload.render({ |
| | |
| | | }); |
| | | } |
| | | ,done: function(res){ |
| | | $("#coverImage").val(res.data.src); |
| | | $("#backImg").val(res.data.src); |
| | | } |
| | | }); |
| | | |
| | | form.on('submit(activity-add-form-submit)', function (data) { |
| | | data.field.groupId = activityGroup.getValue('valueStr'); |
| | | data.field.introduce = editor.txt.html(); |
| | | data.field.categoryId = activityGroup.getValue('valueStr'); |
| | | data.field.textRemark = editor.txt.html(); |
| | | $.ajax({ |
| | | 'url':ctx + 'admin/votesActivity/add', |
| | | 'url':ctx + 'admin/happyActivity/add', |
| | | 'type':'post', |
| | | 'dataType':'json', |
| | | 'headers' : {'Content-Type' : 'application/json;charset=utf-8'}, //接口json格式 |
| | |
| | | return false; |
| | | }); |
| | | |
| | | // form.on('select(activity-type-select)', function(data){ |
| | | // $('.discount-size').each(function() { |
| | | // if (data.value == 1) { |
| | | // $(this).show(); |
| | | // } else { |
| | | // $(this).hide(); |
| | | // } |
| | | // }) |
| | | // $('.coupon-size').each(function() { |
| | | // if (data.value == 2) { |
| | | // $(this).show(); |
| | | // } else { |
| | | // $(this).hide(); |
| | | // } |
| | | // }) |
| | | // }); |
| | | }); |
| | | </script> |
| | |
| | | </ul> |
| | | <div class="layui-tab-content"> |
| | | <div class="layui-tab-item layui-show"> |
| | | <blockquote class="layui-elem-quote blue-border">基础信息</blockquote> |
| | | <!-- 隐藏的 ID 项 --> |
| | | <div class="layui-form-item febs-hide"> |
| | | <label class="layui-form-label">ID:</label> |
| | |
| | | </div> |
| | | <div class="layui-row layui-col-space10 layui-form-item"> |
| | | <div class="layui-col-lg6"> |
| | | <label class="layui-form-label febs-form-item-require">所属分类:</label> |
| | | <label class="layui-form-label febs-form-item-require">分类:</label> |
| | | <div class="layui-input-block"> |
| | | <div id="activity-group"></div> |
| | | </div> |
| | |
| | | </div> |
| | | <div class="layui-row layui-col-space10 layui-form-item"> |
| | | <div class="layui-col-lg6"> |
| | | <label class="layui-form-label febs-form-item-require">排序:</label> |
| | | <div class="layui-input-block"> |
| | | <input type="text" name="orderCnt" lay-verify="required" |
| | | placeholder="" autocomplete="off" class="layui-input"> |
| | | </div> |
| | | </div> |
| | | <div class="layui-col-lg6"> |
| | | <label class="layui-form-label febs-form-item-require">名称:</label> |
| | | <div class="layui-input-block"> |
| | | <input type="text" name="name" lay-verify="required" |
| | | placeholder="" autocomplete="off" class="layui-input"> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | <div class="layui-row layui-col-space10 layui-form-item"> |
| | | <div class="layui-col-lg6"> |
| | | <label class="layui-form-label febs-form-item-require">活动类型:</label> |
| | | <label class="layui-form-label febs-form-item-require">类型:</label> |
| | | <div class="layui-input-block"> |
| | | <select name="activityType" class="activity-type"> |
| | | <option value="1">文字</option> |
| | | <option value="2">图片</option> |
| | | <option value="3">视频</option> |
| | | <option value="4">二维码</option> |
| | | <select name="type"> |
| | | <option value="1">普通活动</option> |
| | | <option value="2">众筹活动</option> |
| | | <option value="3">投票活动</option> |
| | | </select> |
| | | </div> |
| | | </div> |
| | | <div class="layui-col-lg6"> |
| | | <label class="layui-form-label febs-form-item-require">推荐首页:</label> |
| | | <div class="layui-input-block"> |
| | | <select name="hotState"> |
| | | <option value="0">不推荐</option> |
| | | <option value="1">推荐</option> |
| | | </select> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | <div class="layui-row layui-col-space10 layui-form-item"> |
| | | <div class="layui-col-lg6"> |
| | | <label class="layui-form-label">票数总数:</label> |
| | | <label class="layui-form-label febs-form-item-require">联系方式:</label> |
| | | <div class="layui-input-block"> |
| | | <input type="text" name="totalVotes" lay-verify="required" |
| | | placeholder="" autocomplete="off" class="layui-input" disabled> |
| | | <input type="text" name="phone" lay-verify="required" |
| | | placeholder="" autocomplete="off" class="layui-input"> |
| | | </div> |
| | | </div> |
| | | <div class="layui-col-lg6"> |
| | | <label class="layui-form-label">参与人数:</label> |
| | | <label class="layui-form-label febs-form-item-require">地址:</label> |
| | | <div class="layui-input-block"> |
| | | <input type="text" name="totalParticipants" lay-verify="required" |
| | | placeholder="" autocomplete="off" class="layui-input" disabled> |
| | | <input type="text" name="address" lay-verify="required" |
| | | placeholder="" autocomplete="off" class="layui-input"> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | <div class="layui-row layui-col-space10 layui-form-item"> |
| | | <div class="layui-col-lg6"> |
| | | <label class="layui-form-label febs-form-item-require">投票次数:</label> |
| | | <div class="layui-input-block"> |
| | | <input type="text" name="voteCnt" lay-verify="required" |
| | | placeholder="" autocomplete="off" class="layui-input"> |
| | | <div class="layui-form-mid layui-word-aux">投票活动,单个ID每天投票次数</div> |
| | | </div> |
| | | </div> |
| | | <div class="layui-col-lg6"> |
| | | <label class="layui-form-label febs-form-item-require">自主报名:</label> |
| | | <div class="layui-input-block"> |
| | | <select name="addState"> |
| | | <option value="0">不允许</option> |
| | | <option value="1">允许</option> |
| | | </select> |
| | | <div class="layui-form-mid layui-word-aux">投票活动,是否允许用户小程序自主报名</div> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | |
| | | <div class="layui-row layui-col-space10 layui-form-item"> |
| | | <div class="layui-col-lg6"> |
| | | <label class="layui-form-label febs-form-item-require">开始时间:</label> |
| | |
| | | </div> |
| | | </div> |
| | | |
| | | |
| | | <div class="layui-row layui-col-space10 layui-form-item"> |
| | | <div class="layui-col-lg6"> |
| | | <label class="layui-form-label febs-form-item-require">是否多选:</label> |
| | | <label class="layui-form-label febs-form-item-require">门票售卖:</label> |
| | | <div class="layui-input-block"> |
| | | <select name="isMultiple" class="activity-type"> |
| | | <option value="1">是</option> |
| | | <option value="2">否</option> |
| | | <select name="payState"> |
| | | <option value="0">关闭</option> |
| | | <option value="1">开启</option> |
| | | </select> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | |
| | | <div class="layui-row layui-col-space10 layui-form-item"> |
| | | <div class="layui-col-lg6"> |
| | | <label class="layui-form-label febs-form-item-require">门票总数:</label> |
| | | <div class="layui-input-block"> |
| | | <input type="text" name="joinCnt" lay-verify="required" |
| | | placeholder="" autocomplete="off" class="layui-input"> |
| | | <div class="layui-form-mid layui-word-aux">门票总数</div> |
| | | </div> |
| | | </div> |
| | | <div class="layui-col-lg6"> |
| | | <label class="layui-form-label febs-form-item-require">投票方式:</label> |
| | | <label class="layui-form-label febs-form-item-require">门票价格:</label> |
| | | <div class="layui-input-block"> |
| | | <select name="votesType" class="activity-type" > |
| | | <option value="1">一天一次</option> |
| | | </select> |
| | | <input type="text" name="payAmount" lay-verify="required" |
| | | placeholder="" autocomplete="off" class="layui-input"> |
| | | <div class="layui-form-mid layui-word-aux">门票价格(关闭众筹,或者免费参与,请填写0)</div> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | <div class="layui-form-item"> |
| | | <label class="layui-form-label febs-form-item-require">背景图片:</label> |
| | | |
| | | <div class="layui-row layui-col-space10 layui-form-item"> |
| | | <div class="layui-col-lg6"> |
| | | <label class="layui-form-label febs-form-item-require">封面:</label> |
| | | <div class="layui-input-block"> |
| | | <div class="layui-upload"> |
| | | <button type="button" class="layui-btn layui-btn-normal layui-btn" id="test1Max">上传</button> |
| | | <blockquote class="layui-elem-quote layui-quote-nm" style="margin-top: 10px;"> |
| | | <div class="layui-upload-list" id="demo1Max"></div> |
| | | </blockquote> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | <div class="layui-col-lg6"> |
| | | <label class="layui-form-label febs-form-item-require">背景:</label> |
| | | <div class="layui-input-block"> |
| | | <div class="layui-upload"> |
| | | <button type="button" class="layui-btn layui-btn-normal layui-btn" id="testMax">上传</button> |
| | |
| | | </div> |
| | | </div> |
| | | </div> |
| | | <div class="layui-form-item febs-hide"> |
| | | <label class="layui-form-label">图片链接:</label> |
| | | </div> |
| | | |
| | | <div class="layui-row layui-col-space10 layui-form-item febs-hide"> |
| | | <div class="layui-col-lg6"> |
| | | <label class="layui-form-label">封面链接:</label> |
| | | <div class="layui-input-block"> |
| | | <input type="text" id="coverImage" lay-verify="required" name="coverImage" autocomplete="off" class="layui-input" readonly> |
| | | <input type="text" id="indexImg" lay-verify="required" name="indexImg" autocomplete="off" class="layui-input" readonly> |
| | | </div> |
| | | </div> |
| | | <div class="layui-col-lg6"> |
| | | <label class="layui-form-label">背景链接:</label> |
| | | <div class="layui-input-block"> |
| | | <input type="text" id="backImg" lay-verify="required" name="backImg" autocomplete="off" class="layui-input" readonly> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | |
| | |
| | | </div> |
| | | </div> |
| | | </div> |
| | | |
| | | </div> |
| | | </div> |
| | | </div> |
| | |
| | | var form = new FormData(); |
| | | form.append("file", files[0]); |
| | | $.ajax({ |
| | | url:'/admin/goods/uploadFileBaseEsc', |
| | | url:'/admin/goods/uploadFileBase64', |
| | | type: "post", |
| | | processData: false, |
| | | contentType: false, |
| | |
| | | data: [] |
| | | }) |
| | | |
| | | febs.get(ctx + 'admin/votesActivity/allGroup', null, function(res) { |
| | | febs.get(ctx + 'admin/happyActivity/allGroup', null, function(res) { |
| | | activityGroup.update({ |
| | | data : res.data, |
| | | autoRow: true, |
| | |
| | | |
| | | //图片上传 |
| | | upload.render({ |
| | | elem: '#test1Max' |
| | | ,url: ctx + 'admin/goods/uploadFileBase64' //改成您自己的上传接口 |
| | | ,accept: 'file' //普通文件 |
| | | ,size: 10240 //限制文件大小,单位 KB |
| | | ,before: function(obj){ |
| | | //预读本地文件示例,不支持ie8 |
| | | obj.preview(function(index, file, result){ |
| | | $('#demo1Max').html('<img src="'+ result +'" alt="'+ file.name +'" class="layui-upload-img single-image" style="width: 130px">') |
| | | }); |
| | | } |
| | | ,done: function(res){ |
| | | $("#indexImg").val(res.data.src); |
| | | } |
| | | }); |
| | | |
| | | //图片上传 |
| | | upload.render({ |
| | | elem: '#testMax' |
| | | ,url: ctx + 'admin/goods/uploadFileBase64' //改成您自己的上传接口 |
| | | ,multiple: true |
| | | ,accept: 'file' //普通文件 |
| | | ,size: 10240 //限制文件大小,单位 KB |
| | | ,before: function(obj){ |
| | | //预读本地文件示例,不支持ie8 |
| | | obj.preview(function(index, file, result){ |
| | |
| | | }); |
| | | } |
| | | ,done: function(res){ |
| | | $("#coverImage").val(res.data.src); |
| | | $("#backImg").val(res.data.src); |
| | | } |
| | | }); |
| | | |
| | |
| | | form.val("activity-discount-update-form", { |
| | | "id": activity.id || '', |
| | | "name": activity.name || '', |
| | | "coverImage": activity.coverImage || '', |
| | | "activityType": activity.activityType || '1', // 默认选中文字 |
| | | "votesType": activity.votesType || '1', // 默认一天一次 |
| | | "isMultiple": activity.isMultiple || '2', // 默认否 |
| | | "introduce": activity.introduce || '', |
| | | "type": activity.type || '', |
| | | "joinCnt": activity.joinCnt || '', |
| | | "startTime": activity.startTime || '', |
| | | "endTime": activity.endTime || '', |
| | | "totalVotes": activity.totalVotes || '', |
| | | "totalParticipants": activity.totalParticipants || '', |
| | | "phone": activity.phone || '', |
| | | "address": activity.address || '', |
| | | "payState": activity.payState || '', |
| | | "payAmount": activity.payAmount || '', |
| | | "orderCnt": activity.orderCnt || '', |
| | | "hotState": activity.hotState || '', |
| | | "voteCnt": activity.voteCnt || '', |
| | | "addState": activity.addState || '' |
| | | }); |
| | | $('#demoMax').append('<img src="' + activity.coverImage + '" alt="" class="layui-upload-img single-image" style="width: 130px">') |
| | | $("#coverImage").val(activity.coverImage); |
| | | |
| | | $('#demoMax').append('<img src="' + activity.backImg + '" alt="" class="layui-upload-img single-image" style="width: 130px">') |
| | | $("#backImg").val(activity.backImg); |
| | | $('#demo1Max').append('<img src="' + activity.indexImg + '" alt="" class="layui-upload-img single-image" style="width: 130px">') |
| | | $("#indexImg").val(activity.indexImg); |
| | | |
| | | var arr = []; |
| | | arr.push(activity.groupId) |
| | | arr.push(activity.categoryId) |
| | | activityGroup.setValue(arr); |
| | | |
| | | editor.txt.html(activity.introduce); |
| | | |
| | | editor.txt.html(activity.textRemark); |
| | | } |
| | | |
| | | |
| | |
| | | data.field.groupId = activityGroup.getValue('valueStr'); |
| | | data.field.introduce = editor.txt.html(); |
| | | $.ajax({ |
| | | 'url':ctx + 'admin/votesActivity/activityUpdate', |
| | | 'url':ctx + 'admin/happyActivity/activityUpdate', |
| | | 'type':'post', |
| | | 'dataType':'json', |
| | | 'headers' : {'Content-Type' : 'application/json;charset=utf-8'}, //接口json格式 |
| | |
| | | <div class="layui-row layui-col-space10 layui-form-item"> |
| | | |
| | | <div class="layui-col-lg6"> |
| | | <label class="layui-form-label febs-form-item-require">排序:</label> |
| | | <div class="layui-input-block"> |
| | | <input type="text" name="orderCnt" lay-verify="required" placeholder="" autocomplete="off" class="layui-input"> |
| | | </div> |
| | | </div> |
| | | |
| | | <div class="layui-col-lg6"> |
| | | <label class="layui-form-label febs-form-item-require">名称:</label> |
| | | <div class="layui-input-block"> |
| | | <input type="text" name="name" lay-verify="required" placeholder="" autocomplete="off" class="layui-input"> |
| | |
| | | |
| | | form.on('submit(group-add-form-submit)', function (data) { |
| | | $.ajax({ |
| | | 'url':ctx + 'admin/votesActivity/addGroup', |
| | | 'url':ctx + 'admin/happyActivity/addGroup', |
| | | 'type':'post', |
| | | 'dataType':'json', |
| | | 'headers' : {'Content-Type' : 'application/json;charset=utf-8'}, //接口json格式 |
| | |
| | | <div class="layui-row layui-col-space10 layui-form-item"> |
| | | |
| | | <div class="layui-col-lg6"> |
| | | <label class="layui-form-label febs-form-item-require">排序:</label> |
| | | <div class="layui-input-block"> |
| | | <input type="text" name="orderCnt" lay-verify="required" placeholder="" autocomplete="off" class="layui-input"> |
| | | </div> |
| | | </div> |
| | | |
| | | <div class="layui-col-lg6"> |
| | | <label class="layui-form-label febs-form-item-require">名称:</label> |
| | | <div class="layui-input-block"> |
| | | <input type="text" name="name" lay-verify="required" placeholder="" autocomplete="off" class="layui-input"> |
| | |
| | | </style> |
| | | <!-- 表格操作栏 end --> |
| | | <script data-th-inline="javascript"> |
| | | layui.use(['febs', 'form', 'formSelects', 'validate', 'laydate', 'layedit', 'upload', 'table', 'xmSelect', 'layarea'], function () { |
| | | layui.use(['febs', 'form', 'validate','formSelects', 'table'], function () { |
| | | var $ = layui.jquery, |
| | | febs = layui.febs, |
| | | layer = layui.layer, |
| | | table = layui.table, |
| | | formSelects = layui.formSelects, |
| | | form = layui.form, |
| | | formSelects = layui.formSelects, |
| | | $view = $('#group-info'), |
| | | groupInfo = [[${groupInfo}]], |
| | | layedit = layui.layedit, |
| | | upload = layui.upload, |
| | | layarea = layui.layarea, |
| | | voteActivityGroup = [[${voteActivityGroup}]], |
| | | validate = layui.validate; |
| | | |
| | | form.render(); |
| | | initGroupInfo(); |
| | | initVoteActivityGroup(); |
| | | |
| | | formSelects.render(); |
| | | |
| | | function initGroupInfo() { |
| | | console.log("groupInfo:", groupInfo); // 调试信息 |
| | | function initVoteActivityGroup() { |
| | | console.log("voteActivityGroup:", voteActivityGroup); // 调试信息 |
| | | form.val("group-info-form", { |
| | | "id": groupInfo.id, |
| | | "name": groupInfo.name, |
| | | "id": voteActivityGroup.id, |
| | | "name": voteActivityGroup.name, |
| | | "orderCnt": voteActivityGroup.orderCnt, |
| | | }); |
| | | |
| | | } |
| | | |
| | | form.on('submit(group-info-form-submit)', function (data) { |
| | | $.ajax({ |
| | | 'url':ctx + 'admin/votesActivity/groupUpdate', |
| | | 'url':ctx + 'admin/happyActivity/groupUpdate', |
| | | 'type':'post', |
| | | 'dataType':'json', |
| | | 'headers' : {'Content-Type' : 'application/json;charset=utf-8'}, //接口json格式 |
| | |
| | | <div class="layui-fluid layui-anim febs-anim" id="febs-activity-group" lay-title="活动分类列表"> |
| | | <div class="layui-fluid layui-anim febs-anim" id="febs-activity-group" lay-title="活动分类管理"> |
| | | <div class="layui-row febs-container"> |
| | | <div class="layui-col-md12"> |
| | | <div class="layui-card"> |
| | |
| | | <option value="">请选择</option> |
| | | <option value="0">未开启</option> |
| | | <option value="1">开启</option> |
| | | </select> |
| | | </div> |
| | | </div> |
| | | <div class="layui-inline"> |
| | | <label class="layui-form-label layui-form-label-sm">推荐首页</label> |
| | | <div class="layui-input-inline"> |
| | | <select name="hotState"> |
| | | <option value="">请选择</option> |
| | | <option value="0">不推荐</option> |
| | | <option value="1">推荐</option> |
| | | </select> |
| | | </div> |
| | | </div> |
| | |
| | | <a lay-event="edit" shiro:hasPermission="votesActivityUpdate:update"><i |
| | | class="layui-icon febs-edit-area febs-blue"></i></a> |
| | | </script> |
| | | <script type="text/html" id="hotStateSwitch"> |
| | | {{# if(d.hotState === 1) { }} |
| | | <input type="checkbox" value={{d.id}} lay-text="推荐|不推荐" checked lay-skin="switch" lay-filter="hotStateSwitch"> |
| | | {{# } else { }} |
| | | <input type="checkbox" value={{d.id}} lay-text="推荐|不推荐" lay-skin="switch" lay-filter="hotStateSwitch"> |
| | | {{# } }} |
| | | </script> |
| | | <script type="text/html" id="groupStatusSwitch"> |
| | | {{# if(d.status === 1) { }} |
| | | {{# if(d.state === 1) { }} |
| | | <input type="checkbox" value={{d.id}} lay-text="开启|关闭" checked lay-skin="switch" lay-filter="groupStatusSwitch"> |
| | | {{# } else { }} |
| | | <input type="checkbox" value={{d.id}} lay-text="开启|关闭" lay-skin="switch" lay-filter="groupStatusSwitch"> |
| | |
| | | <script type="text/html" id="groupOption"> |
| | | <button class="layui-btn layui-btn-normal layui-btn-sm" type="button" shiro:hasPermission="groupInfo:view" lay-event="groupInfo">编辑</button> |
| | | <button class="layui-btn layui-btn-danger layui-btn-sm" type="button" shiro:hasPermission="groupDelete:delete" lay-event="groupDelete">删除</button> |
| | | </script> |
| | | <script type="text/html" id="deleteFlag"> |
| | | {{# |
| | | var deleteFlag = { |
| | | 0: {title: '生效中', color: 'green'}, |
| | | 1: {title: '已删除', color: 'red'}, |
| | | }[d.deleteFlag]; |
| | | }} |
| | | <span class="layui-badge febs-bg-{{deleteFlag.color}}">{{ deleteFlag.title }}</span> |
| | | </script> |
| | | |
| | | <style> |
| | |
| | | }); |
| | | } |
| | | if (layEvent === 'groupInfo') { |
| | | febs.modal.open('审核编辑','modules/votesActivity/groupInfo/' + data.id, { |
| | | febs.modal.open('编辑','modules/votesActivity/groupInfo/' + data.id, { |
| | | btn: ['提交', '取消'], |
| | | area: ['100%', '100%'], |
| | | yes: function (index, layero) { |
| | |
| | | } |
| | | }); |
| | | function groupDelete(id) { |
| | | febs.get(ctx + 'admin/votesActivity/groupDelete/' + id, null, function (data) { |
| | | febs.get(ctx + 'admin/happyActivity/groupDelete/' + id, null, function (data) { |
| | | febs.alert.success(data.message); |
| | | $query.click(); |
| | | }); |
| | |
| | | tableIns = febs.table.init({ |
| | | elem: $view.find('table'), |
| | | id: 'groupTable', |
| | | url: ctx + 'admin/votesActivity/groupList', |
| | | url: ctx + 'admin/happyActivity/groupList', |
| | | toolbar:"#groupToolbar", |
| | | defaultToolbar:[], |
| | | cols: [[ |
| | | {type: 'numbers', title: '序号', width: 80}, |
| | | {type: 'numbers', title: '', width: 80}, |
| | | {title: '操作', toolbar: '#groupOption', minWidth: 200, align: 'center'}, |
| | | {field: 'orderCnt', title: '排序', minWidth: 100,align:'center'}, |
| | | {field: 'name', title: '名称', minWidth: 100,align:'center'}, |
| | | {title: '审核状态', templet: '#groupStatusSwitch', minWidth: 100,align:'center'}, |
| | | {title: '推荐首页', templet: '#hotStateSwitch', minWidth: 100,align:'center'}, |
| | | {title: '状态', templet: '#groupStatusSwitch', minWidth: 100,align:'center'}, |
| | | {title: '是否删除', templet: '#deleteFlag', minWidth: 100,align:'center'}, |
| | | {field: 'createdTime', title: '创建时间', minWidth: 150,align:'left'} |
| | | ]] |
| | | }); |
| | | } |
| | | |
| | | form.on('switch(groupStatusSwitch)', function (data) { |
| | | form.on('switch(hotStateSwitch)', function (data) { |
| | | if (data.elem.checked) { |
| | | groupState(data.value,1); |
| | | } else { |
| | | groupState(data.value,0); |
| | | groupState(data.value,1); |
| | | } |
| | | }) |
| | | function groupState(id,state) { |
| | | febs.get(ctx + 'admin/votesActivity/groupState/' + id+'/' + state, null, function (data) { |
| | | |
| | | form.on('switch(groupStatusSwitch)', function (data) { |
| | | if (data.elem.checked) { |
| | | groupState(data.value,2); |
| | | } else { |
| | | groupState(data.value,2); |
| | | } |
| | | }) |
| | | function groupState(id,type) { |
| | | febs.get(ctx + 'admin/happyActivity/groupState/' + id+'/' + type, null, function (data) { |
| | | febs.alert.success(data.message); |
| | | $query.click(); |
| | | }); |
| | |
| | | return { |
| | | name: $searchForm.find('input[name="name"]').val().trim(), |
| | | status: $searchForm.find("select[name='status']").val(), |
| | | hotState: $searchForm.find("select[name='hotState']").val(), |
| | | }; |
| | | } |
| | | |
| | |
| | | <div class="layui-inline"> |
| | | <label class="layui-form-label layui-form-label-sm">分类</label> |
| | | <div class="layui-input-inline"> |
| | | <select name="groupId" class="group-type"> |
| | | <select name="categoryId" class="group-type"> |
| | | <option value="">请选择</option> |
| | | </select> |
| | | </div> |
| | |
| | | <div class="layui-inline"> |
| | | <label class="layui-form-label layui-form-label-sm">状态</label> |
| | | <div class="layui-input-inline"> |
| | | <select name="status"> |
| | | <select name="state"> |
| | | <option value="">请选择</option> |
| | | <option value="0">未开启</option> |
| | | <option value="1">已开启</option> |
| | | <option value="2">已结束</option> |
| | | </select> |
| | | </div> |
| | | </div> |
| | |
| | | </div> |
| | | </form> |
| | | <table lay-filter="activityTable" lay-data="{id: 'activityTable'}"></table> |
| | | <!-- <style type="text/css">--> |
| | | <!-- ::-webkit-scrollbar {--> |
| | | <!-- height: 20px !important;--> |
| | | <!-- background-color: #f4f4f4;--> |
| | | <!-- }--> |
| | | <!-- </style>--> |
| | | </div> |
| | | </div> |
| | | </div> |
| | |
| | | class="layui-icon febs-edit-area febs-blue"></i></a> |
| | | </script> |
| | | <script type="text/html" id="activityStateSwitch"> |
| | | {{# if(d.status === 1) { }} |
| | | {{# if(d.state === 1) { }} |
| | | <input type="checkbox" value={{d.id}} lay-text="开启|关闭" checked lay-skin="switch" lay-filter="activityStateSwitch"> |
| | | {{# } else if(d.status === 2) { }} |
| | | <input type="checkbox" value={{d.id}} lay-text="进行中|关闭" checked lay-skin="switch" lay-filter="activityStateSwitch"> |
| | | {{# } else if(d.state === 2) { }} |
| | | <span class="layui-badge febs-bg-red">已结束</span> |
| | | {{# } else { }} |
| | | <input type="checkbox" value={{d.id}} lay-text="开启|关闭" lay-skin="switch" lay-filter="activityStateSwitch"> |
| | | {{# } }} |
| | |
| | | </script> |
| | | |
| | | <script type="text/html" id="activityOption"> |
| | | <button class="layui-btn layui-btn-normal layui-btn-sm" type="button" lay-event="activityUpdateEvent">编辑</button> |
| | | <button class="layui-btn layui-btn-danger layui-btn-sm" type="button" lay-event="activityDeleteEvent">删除</button> |
| | | <button class="layui-btn layui-btn-normal layui-btn-sm" type="button" shiro:hasPermission="votesActivityUpdate:update" lay-event="activityUpdateEvent">编辑</button> |
| | | <button class="layui-btn layui-btn-danger layui-btn-sm" type="button" shiro:hasPermission="votesActivityUpdate:update" lay-event="activityDeleteEvent">删除</button> |
| | | </script> |
| | | |
| | | <style> |
| | |
| | | |
| | | form.render(); |
| | | //(下拉框) |
| | | $.get(ctx + 'admin/votesActivity/allGroup', function (res) { |
| | | $.get(ctx + 'admin/happyActivity/allGroup', function (res) { |
| | | var data = res.data; |
| | | for (let k in data) |
| | | { |
| | |
| | | } |
| | | }); |
| | | |
| | | form.on('switch(activityStateSwitch)', function (data) { |
| | | if (data.elem.checked) { |
| | | changeState(data.value,1); |
| | | } else { |
| | | changeState(data.value,0); |
| | | } |
| | | }) |
| | | function changeState(id,state) { |
| | | febs.get(ctx + 'admin/votesActivity/changeState/' + id+'/' + state, null, function (data) { |
| | | febs.get(ctx + 'admin/happyActivity/changeState/' + id+'/' + state, null, function (data) { |
| | | febs.alert.success(data.message); |
| | | $query.click(); |
| | | }); |
| | | } |
| | | function delAct(id) { |
| | | febs.get(ctx + 'admin/votesActivity/delActivity/' + id, null, function (data) { |
| | | febs.get(ctx + 'admin/happyActivity/delActivity/' + id, null, function (data) { |
| | | febs.alert.success(data.message); |
| | | $query.click(); |
| | | }); |
| | |
| | | tableIns = febs.table.init({ |
| | | elem: $view.find('table'), |
| | | id: 'activityTable', |
| | | url: ctx + 'admin/votesActivity/list', |
| | | url: ctx + 'admin/happyActivity/list', |
| | | toolbar:"#activityToolbar", |
| | | defaultToolbar:[], |
| | | cols: [[ |
| | | |
| | | {type: 'numbers', title: '序号', width: 80}, |
| | | {type: 'numbers', title: '', width: 80}, |
| | | {title: '操作', toolbar: '#activityOption', minWidth: 200, align: 'center'}, |
| | | {field: 'name', title: '名称', minWidth: 150,align:'left'}, |
| | | {field: 'groupby', title: '分类', minWidth: 150,align:'left'}, |
| | | {field: 'categoryName', title: '分类', minWidth: 150,align:'left'}, |
| | | { |
| | | field: 'coverImage', |
| | | title: '图片', |
| | | field: 'indexImg', |
| | | title: '封面', |
| | | templet: function (d) { |
| | | return '<a lay-event="seeImgThumb">' + |
| | | '<img id="seeImgThumb' + d.id + '" src="' + d.coverImage + |
| | | '<img id="seeImgThumb' + d.id + '" src="' + d.indexImg + |
| | | '" alt="图片" style="width: 50px; height: 50px; object-fit: cover; border-radius: 5px; cursor: pointer;">' + |
| | | '</a>'; |
| | | }, |
| | | minWidth: 150, |
| | | align: 'center' |
| | | }, |
| | | {field: 'activityType', title: '类型', minWidth: 90,align:'left',templet: function(d){ |
| | | if (d.activityType === '1') { |
| | | return '文字'; |
| | | } else if (d.activityType === '2') { |
| | | return `图片`; |
| | | } else if (d.activityType === '3') { |
| | | return `视频`; |
| | | } else { |
| | | return '二维码'; |
| | | } |
| | | } |
| | | }, |
| | | {field: 'isMultiple', title: '是否多选', minWidth: 90,align:'left',templet: function(d){ |
| | | if (d.activityType === '1') { |
| | | return '是'; |
| | | }else { |
| | | return '否'; |
| | | } |
| | | } |
| | | }, |
| | | {field: 'totalVotes', title: '总投票数', minWidth: 90,align:'left'}, |
| | | {field: 'startTime', title: '开始时间', minWidth: 200,align:'left'}, |
| | | {field: 'endTime', title: '结束时间', minWidth: 200,align:'left'}, |
| | | {field: 'status', title: '状态', templet: '#activityStateSwitch', minWidth: 130,align:'center'} |
| | | {field: 'state', title: '状态', templet: '#activityStateSwitch', minWidth: 130,align:'center'} |
| | | ]] |
| | | }); |
| | | } |
| | | |
| | | |
| | | form.on('switch(activityStateSwitch)', function (data) { |
| | | if (data.elem.checked) { |
| | | changeState(data.value,1); |
| | | } else { |
| | | changeState(data.value,0); |
| | | } |
| | | }) |
| | | |
| | | |
| | | // 查询按钮 |
| | |
| | | function getQueryParams() { |
| | | return { |
| | | name: $searchForm.find('input[name="name"]').val().trim(), |
| | | status: $searchForm.find("select[name='status']").val(), |
| | | groupId: $searchForm.find("select[name='groupId']").val(), |
| | | state: $searchForm.find("select[name='state']").val(), |
| | | categoryId: $searchForm.find("select[name='categoryId']").val(), |
| | | }; |
| | | } |
| | | |
| | |
| | | <div id="activity-option"></div> |
| | | </div> |
| | | </div> |
| | | |
| | | <div class="layui-col-lg6"> |
| | | <label class="layui-form-label">序号:</label> |
| | | <div class="layui-input-block"> |
| | | <input type="number" name="number" placeholder="" autocomplete="off" class="layui-input" disabled> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | <div class="layui-form-item"> |
| | | <div class="layui-col-lg6"> |
| | | <label class="layui-form-label febs-form-item-require">报名名称:</label> |
| | | <div class="layui-input-block"> |
| | | <input type="text" name="registeredName" lay-verify="required" autocomplete="off" class="layui-input" > |
| | | </div> |
| | | </div> |
| | | |
| | | <div class="layui-col-lg6"> |
| | | <label class="layui-form-label febs-form-item-require">选项名称:</label> |
| | | <div class="layui-input-block"> |
| | | <input type="text" name="beautyName" lay-verify="required" autocomplete="off" class="layui-input" > |
| | | <input type="text" name="optionName" lay-verify="required" autocomplete="off" class="layui-input" > |
| | | </div> |
| | | </div> |
| | | <div class="layui-col-lg6"> |
| | | <label class="layui-form-label febs-form-item-require">姓名:</label> |
| | | <div class="layui-input-block"> |
| | | <input type="text" name="realName" lay-verify="required" autocomplete="off" class="layui-input" > |
| | | <div class="layui-form-mid layui-word-aux">姓名和选项名称可一致</div> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | <div class="layui-row layui-col-space10 layui-form-item"> |
| | | <div class="layui-col-lg6"> |
| | | <label class="layui-form-label">性别:</label> |
| | | <div class="layui-input-block"> |
| | | <input type="radio" name="sex" value="1" title="男" /> |
| | | <input type="radio" name="sex" value="2" title="女" /> |
| | | <input type="radio" name="sex" value="2" title="保密" checked /> |
| | | </div> |
| | | </div> |
| | | <div class="layui-form-item" id="area-picker"> |
| | | <div class="layui-form-label">选择省/市</div> |
| | | <div class="layui-input-inline" style="width: 200px;"> |
| | |
| | | </div> |
| | | <div class="layui-row layui-col-space10 layui-form-item"> |
| | | <div class="layui-col-lg6"> |
| | | <label class="layui-form-label">性别:</label> |
| | | <div class="layui-input-block"> |
| | | <input type="radio" name="sex" value="1" title="男" /> |
| | | <input type="radio" name="sex" value="2" title="女" /> |
| | | <input type="radio" name="sex" value="2" title="保密" checked /> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | <div class="layui-row layui-col-space10 layui-form-item"> |
| | | <div class="layui-col-lg6"> |
| | | <label class="layui-form-label">邮箱:</label> |
| | | <div class="layui-input-block"> |
| | | <input type="text" name="email" autocomplete="off" class="layui-input" > |
| | |
| | | <div class="layui-col-lg6"> |
| | | <label class="layui-form-label febs-form-item-require" style="white-space: nowrap;">是否签约MCN:</label> |
| | | <div class="layui-input-block"> |
| | | <select name="ismcn" lay-verify="required" class="layui-input"> |
| | | <select name="mcnState" lay-verify="required" class="layui-input"> |
| | | <option value="0">否</option> |
| | | <option value="1">是</option> |
| | | </select> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | |
| | | <!-- <div class="layui-row layui-col-space10 layui-form-item">--> |
| | | <!-- <div class="layui-col-lg6">--> |
| | | <!-- <label class="layui-form-label febs-form-item-require">排名:</label>--> |
| | | <!-- <div class="layui-input-block">--> |
| | | <!-- <input type="number" name="rank" lay-verify="required" autocomplete="off" class="layui-input" >--> |
| | | <!-- </div>--> |
| | | <!-- </div>--> |
| | | |
| | | <!-- <div class="layui-col-lg6">--> |
| | | <!-- <label class="layui-form-label febs-form-item-require">票数差:</label>--> |
| | | <!-- <div class="layui-input-block">--> |
| | | <!-- <input type="number" name="diffPrevious" lay-verify="required" autocomplete="off" class="layui-input" >--> |
| | | <!-- </div>--> |
| | | <!-- </div>--> |
| | | <!-- </div>--> |
| | | |
| | | <div class="layui-form-item"> |
| | | <label class="layui-form-label">爱好:</label> |
| | |
| | | |
| | | <div class="layui-tab-item"> |
| | | <div class="layui-form-item"> |
| | | <label class="layui-form-label febs-form-item-require">选项图片:</label> |
| | | <label class="layui-form-label febs-form-item-require">封面:</label> |
| | | <div class="layui-input-block"> |
| | | <div class="layui-upload"> |
| | | <button type="button" class="layui-btn layui-btn-normal layui-btn" id="test2">上传</button> |
| | |
| | | </div> |
| | | </div> |
| | | <div class="layui-form-item"> |
| | | <label class="layui-form-label febs-form-item-require">选项视频:</label> |
| | | <label class="layui-form-label febs-form-item-require">参赛作品:</label> |
| | | <div class="layui-input-block"> |
| | | <div class="layui-upload"> |
| | | <button type="button" class="layui-btn upload" id="upload" style="background-color: #009688; margin-bottom: 2px">上传文件</button> |
| | |
| | | </div> |
| | | </div> |
| | | <div class="layui-form-item"> |
| | | <label class="layui-form-label">视频链接:</label> |
| | | <label class="layui-form-label">作品链接:</label> |
| | | <div class="layui-input-block"> |
| | | <input type="text" id="videoUrl" lay-verify="required" name="videoUrl" autocomplete="off" class="layui-input" readonly> |
| | | </div> |
| | |
| | | </style> |
| | | <!-- 表格操作栏 end --> |
| | | <script data-th-inline="javascript"> |
| | | layui.use(['febs', 'form', 'formSelects', 'validate', 'laydate', 'layedit', 'upload', 'table', 'xmSelect', 'layarea'], function () { |
| | | layui.use(['febs', 'form', 'formSelects', 'validate', 'layedit', 'upload', 'table', 'xmSelect', 'layarea'], function () { |
| | | var $ = layui.jquery, |
| | | febs = layui.febs, |
| | | layer = layui.layer, |
| | |
| | | var form = new FormData(); |
| | | form.append("file", files[0]); |
| | | $.ajax({ |
| | | url:'/admin/goods/uploadFileBaseEsc', |
| | | url:'/admin/goods/uploadFileBase64', |
| | | type: "post", |
| | | processData: false, |
| | | contentType: false, |
| | |
| | | data: [] |
| | | }) |
| | | |
| | | febs.get(ctx + 'admin/votesActivity/allActivities', null, function(res) { |
| | | febs.get(ctx + 'admin/happyActivity/allActivities', null, function(res) { |
| | | activityOptions.update({ |
| | | data : res.data, |
| | | autoRow: true, |
| | |
| | | data.field.description = editor.txt.html(); |
| | | console.log(data.field); |
| | | $.ajax({ |
| | | 'url':ctx + 'admin/votesActivity/addOption', |
| | | 'url':ctx + 'admin/happyActivity/addOption', |
| | | 'type':'post', |
| | | 'dataType':'json', |
| | | 'headers' : {'Content-Type' : 'application/json;charset=utf-8'}, //接口json格式 |
| | |
| | | <div class="layui-col-lg6"> |
| | | <label class="layui-form-label febs-form-item-require">审核:</label> |
| | | <div class="layui-input-block"> |
| | | <input type="radio" name="audit" value="1" title="待审核" checked /> |
| | | <input type="radio" name="audit" value="2" title="同意" /> |
| | | <input type="radio" name="audit" value="3" title="拒绝" /> |
| | | <input type="radio" name="state" value="0" title="待审核" checked /> |
| | | <input type="radio" name="state" value="1" title="同意" /> |
| | | <input type="radio" name="state" value="2" title="拒绝" /> |
| | | </div> |
| | | </div> |
| | | <div class="layui-row layui-col-space10 layui-form-item"> |
| | | <div class="layui-col-lg6"> |
| | | <label class="layui-form-label febs-form-item-require">选项图片:</label> |
| | | <label class="layui-form-label febs-form-item-require">封面:</label> |
| | | <div class="layui-input-block"> |
| | | <input type="text" lay-verify="required" name="image" autocomplete="off" class="layui-input" readonly> |
| | | </div> |
| | | </div> |
| | | <div class="layui-col-lg6"> |
| | | <button type="button" class="layui-btn layui-btn-normal layui-btn" id="openImg">图片审核</button> |
| | | <button type="button" class="layui-btn layui-btn-normal layui-btn" id="openImg">封面审核</button> |
| | | </div> |
| | | </div> |
| | | |
| | | |
| | | <div class="layui-row layui-col-space10 layui-form-item"> |
| | | <div class="layui-col-lg6"> |
| | | <label class="layui-form-label febs-form-item-require">选项视频:</label> |
| | | <label class="layui-form-label febs-form-item-require">参赛作品:</label> |
| | | <div class="layui-input-block"> |
| | | <input type="text" lay-verify="required" name="videoUrl" autocomplete="off" class="layui-input" readonly> |
| | | </div> |
| | | </div> |
| | | <div class="layui-col-lg6"> |
| | | <button type="button" class="layui-btn layui-btn-normal layui-btn" id="openVideo">视频审核</button> |
| | | <button type="button" class="layui-btn layui-btn-normal layui-btn" id="openVideo">作品审核</button> |
| | | </div> |
| | | </div> |
| | | </div> |
| | |
| | | <div class="layui-col-lg6"> |
| | | <label class="layui-form-label">序号:</label> |
| | | <div class="layui-input-block"> |
| | | <!-- <input type="number" name="number" lay-verify="required" placeholder="" autocomplete="off" class="layui-input" data-value="{$voteOption.number}">--> |
| | | <input type="number" name="number" placeholder="" autocomplete="off" class="layui-input" data-value="{$voteOption.number}" disabled> |
| | | <input type="number" name="orderCnt" placeholder="" autocomplete="off" class="layui-input" data-value="{$voteOption.number}"> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | <div class="layui-form-item"> |
| | | <div class="layui-col-lg6"> |
| | | <label class="layui-form-label febs-form-item-require">报名名称:</label> |
| | | <label class="layui-form-label febs-form-item-require">选项名称:</label> |
| | | <div class="layui-input-block"> |
| | | <input type="text" name="registeredName" lay-verify="required" autocomplete="off" class="layui-input" > |
| | | <input type="text" name="optionName" lay-verify="required" autocomplete="off" class="layui-input" > |
| | | </div> |
| | | </div> |
| | | <div class="layui-col-lg6"> |
| | | <label class="layui-form-label febs-form-item-require">选项名称:</label> |
| | | <label class="layui-form-label febs-form-item-require">姓名:</label> |
| | | <div class="layui-input-block"> |
| | | <input type="text" name="beautyName" lay-verify="required" autocomplete="off" class="layui-input" > |
| | | <input type="text" name="realName" lay-verify="required" autocomplete="off" class="layui-input" > |
| | | </div> |
| | | </div> |
| | | |
| | | </div> |
| | | <!-- <div class="layui-row layui-col-space10 layui-form-item">--> |
| | | <!-- <div class="layui-col-lg6">--> |
| | | <!-- <label class="layui-form-label febs-form-item-require">省:</label>--> |
| | | <!-- <div class="layui-input-block">--> |
| | | <!-- <input type="text" name="province" lay-verify="required" autocomplete="off" class="layui-input" >--> |
| | | <!-- </div>--> |
| | | <!-- </div>--> |
| | | |
| | | <!-- <div class="layui-col-lg6">--> |
| | | <!-- <label class="layui-form-label febs-form-item-require">市:</label>--> |
| | | <!-- <div class="layui-input-block">--> |
| | | <!-- <input type="text" name="city" lay-verify="required" autocomplete="off" class="layui-input" >--> |
| | | <!-- </div>--> |
| | | <!-- </div>--> |
| | | <!-- </div>--> |
| | | <div class="layui-row layui-col-space10 layui-form-item"> |
| | | <div class="layui-col-lg6"> |
| | | <label class="layui-form-label">性别:</label> |
| | |
| | | <option value="">--选择市--</option> |
| | | </select> |
| | | </div> |
| | | <!-- <div class="layui-input-inline" style="width: 200px;" >--> |
| | | <!-- <select name="area" class="county-selector" data-value="浦东新区">--> |
| | | <!-- <option value="">--选择区--</option>--> |
| | | <!-- </select>--> |
| | | <!-- </div>--> |
| | | </div> |
| | | |
| | | </div> |
| | |
| | | <div class="layui-col-lg6"> |
| | | <label class="layui-form-label febs-form-item-require" style="white-space: nowrap;">是否签约MCN:</label> |
| | | <div class="layui-input-block"> |
| | | <select name="ismcn" lay-verify="required" class="layui-input"> |
| | | <select name="mcnState" lay-verify="required" class="layui-input"> |
| | | <option value="0">否</option> |
| | | <option value="1">是</option> |
| | | </select> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | |
| | | <!-- <div class="layui-row layui-col-space10 layui-form-item">--> |
| | | <!-- <div class="layui-col-lg6">--> |
| | | <!-- <label class="layui-form-label febs-form-item-require">排名:</label>--> |
| | | <!-- <div class="layui-input-block">--> |
| | | <!-- <input type="number" name="rank" autocomplete="off" class="layui-input" >--> |
| | | <!-- </div>--> |
| | | <!-- </div>--> |
| | | |
| | | <!-- <div class="layui-col-lg6">--> |
| | | <!-- <label class="layui-form-label febs-form-item-require">票数差:</label>--> |
| | | <!-- <div class="layui-input-block">--> |
| | | <!-- <input type="number" name="diffPrevious" autocomplete="off" class="layui-input" >--> |
| | | <!-- </div>--> |
| | | <!-- </div>--> |
| | | <!-- </div>--> |
| | | <div class="layui-row layui-col-space10 layui-form-item"> |
| | | <div class="layui-col-lg6"> |
| | | <label class="layui-form-label febs-form-item-require">票数统计:</label> |
| | | <div class="layui-input-block"> |
| | | <input type="number" name="voteCount" autocomplete="off" class="layui-input" > |
| | | </div> |
| | | </div> |
| | | </div> |
| | |
| | | </style> |
| | | <!-- 表格操作栏 end --> |
| | | <script data-th-inline="javascript"> |
| | | layui.use(['febs', 'form', 'formSelects', 'validate', 'laydate', 'layedit', 'upload', 'table', 'xmSelect', 'layarea'], function () { |
| | | layui.use(['febs', 'form', 'formSelects', 'validate', 'laydate', 'layedit', 'table', 'xmSelect', 'layarea'], function () { |
| | | var $ = layui.jquery, |
| | | febs = layui.febs, |
| | | layer = layui.layer, |
| | |
| | | $view = $('#option-info'), |
| | | voteOption = [[${voteOption}]], |
| | | layedit = layui.layedit, |
| | | upload = layui.upload, |
| | | layarea = layui.layarea, |
| | | validate = layui.validate; |
| | | |
| | |
| | | var form = new FormData(); |
| | | form.append("file", files[0]); |
| | | $.ajax({ |
| | | url:'/admin/goods/uploadFileBaseEsc', |
| | | url:'/admin/goods/uploadFileBase64', |
| | | type: "post", |
| | | processData: false, |
| | | contentType: false, |
| | |
| | | data: [] |
| | | }) |
| | | |
| | | febs.get(ctx + 'admin/votesActivity/allActivities', null, function(res) { |
| | | febs.get(ctx + 'admin/happyActivity/allActivities', null, function(res) { |
| | | activityOptions.update({ |
| | | data : res.data, |
| | | autoRow: true, |
| | |
| | | form.val("option-info-form", { |
| | | "id": voteOption.id, |
| | | "activityId": voteOption.activityId, |
| | | "beautyName": voteOption.beautyName, |
| | | "registeredName": voteOption.registeredName, |
| | | "optionName": voteOption.optionName, |
| | | "realName": voteOption.realName, |
| | | "description": voteOption.description, |
| | | "voteCount": voteOption.voteCount, |
| | | "rank": voteOption.rank, |
| | | "diffPrevious": voteOption.diffPrevious, |
| | | "number": voteOption.number, |
| | | "orderCnt": voteOption.orderCnt, |
| | | "mobilePhone": voteOption.mobilePhone, |
| | | "sex": voteOption.sex, |
| | | "hobby": voteOption.hobby, |
| | | "ismcn": voteOption.ismcn, |
| | | "mcnState": voteOption.mcnState, |
| | | "address": voteOption.address, |
| | | "province": voteOption.province, |
| | | "city": voteOption.city, |
| | | "videoUrl": voteOption.videoUrl, |
| | | "audit": voteOption.audit, |
| | | "state": voteOption.state, |
| | | "image": voteOption.image, |
| | | "email": voteOption.email |
| | | }); |
| | |
| | | data.field.description = editor.txt.html(); |
| | | console.log(data.field); |
| | | $.ajax({ |
| | | 'url':ctx + 'admin/votesActivity/optionUpdate', |
| | | 'url':ctx + 'admin/happyActivity/optionUpdate', |
| | | 'type':'post', |
| | | 'dataType':'json', |
| | | 'headers' : {'Content-Type' : 'application/json;charset=utf-8'}, //接口json格式 |
| | |
| | | <div class="layui-fluid layui-anim febs-anim" id="febs-activity-option" lay-title="活动选手列表"> |
| | | <div class="layui-fluid layui-anim febs-anim" id="febs-activity-option" lay-title="活动选项列表"> |
| | | <div class="layui-row febs-container"> |
| | | <div class="layui-col-md12"> |
| | | <div class="layui-card"> |
| | |
| | | <div class="layui-inline"> |
| | | <label class="layui-form-label layui-form-label-sm">选项名称</label> |
| | | <div class="layui-input-inline"> |
| | | <input type="text" placeholder="选项名称" name="beautyName" autocomplete="off" class="layui-input"> |
| | | <input type="text" placeholder="选项名称" name="optionName" autocomplete="off" class="layui-input"> |
| | | </div> |
| | | </div> |
| | | <div class="layui-inline"> |
| | |
| | | </div> |
| | | </div> |
| | | <div class="layui-inline"> |
| | | <label class="layui-form-label layui-form-label-sm">审核状态</label> |
| | | <label class="layui-form-label layui-form-label-sm">状态</label> |
| | | <div class="layui-input-inline"> |
| | | <select name="audit"> |
| | | <select name="state"> |
| | | <option value="">请选择</option> |
| | | <option value="1">待审核</option> |
| | | <option value="2">同意</option> |
| | | <option value="3">拒绝</option> |
| | | <option value="0">待审核</option> |
| | | <option value="1">同意</option> |
| | | <option value="2">拒绝</option> |
| | | </select> |
| | | </div> |
| | | </div> |
| | |
| | | </div> |
| | | </form> |
| | | <table lay-filter="optionTable" lay-data="{id: 'optionTable'}"></table> |
| | | <!-- <style type="text/css">--> |
| | | <!-- ::-webkit-scrollbar {--> |
| | | <!-- height: 20px !important;--> |
| | | <!-- background-color: #f4f4f4;--> |
| | | <!-- }--> |
| | | <!-- </style>--> |
| | | </div> |
| | | </div> |
| | | </div> |
| | |
| | | <a lay-event="edit" shiro:hasPermission="votesActivityUpdate:update"><i |
| | | class="layui-icon febs-edit-area febs-blue"></i></a> |
| | | </script> |
| | | <script type="text/html" id="auditType"> |
| | | <script type="text/html" id="optionStateType"> |
| | | {{# |
| | | var audit = { |
| | | var state = { |
| | | 0: {title: '待审核', color: 'blue'}, |
| | | 1: {title: '待审核', color: 'blue'}, |
| | | 2: {title: '同意', color: 'green'}, |
| | | 3: {title: '拒绝', color: 'red'}, |
| | | 4: {title: '进行中', color: 'purple'}, |
| | | 5: {title: '已完成', color: 'gray'} |
| | | }[d.audit]; |
| | | 1: {title: '同意', color: 'green'}, |
| | | 2: {title: '拒绝', color: 'red'}, |
| | | }[d.state]; |
| | | }} |
| | | <span class="layui-badge febs-bg-{{audit.color}}">{{ audit.title }}</span> |
| | | <span class="layui-badge febs-bg-{{state.color}}">{{ state.title }}</span> |
| | | </script> |
| | | <script type="text/html" id="optionToolbar"> |
| | | <div class="layui-btn-container"> |
| | |
| | | |
| | | form.render(); |
| | | //(下拉框) |
| | | $.get(ctx + 'admin/votesActivity/allActivities', function (res) { |
| | | $.get(ctx + 'admin/happyActivity/allActivities', function (res) { |
| | | var data = res.data; |
| | | for (let k in data) |
| | | { |
| | |
| | | } |
| | | }); |
| | | function optionDelete(id) { |
| | | febs.get(ctx + 'admin/votesActivity/optionDelete/' + id, null, function (data) { |
| | | febs.get(ctx + 'admin/happyActivity/optionDelete/' + id, null, function (data) { |
| | | febs.alert.success(data.message); |
| | | $query.click(); |
| | | }); |
| | |
| | | }); |
| | | |
| | | function changeState(id,state) { |
| | | febs.get(ctx + 'admin/votesActivity/changeState/' + id+'/' + state, null, function (data) { |
| | | febs.get(ctx + 'admin/happyActivity/changeOptionState/' + id+'/' + state, null, function (data) { |
| | | febs.alert.success(data.message); |
| | | $query.click(); |
| | | }); |
| | |
| | | tableIns = febs.table.init({ |
| | | elem: $view.find('table'), |
| | | id: 'optionTable', |
| | | url: ctx + 'admin/votesActivity/optionList', |
| | | url: ctx + 'admin/happyActivity/optionList', |
| | | toolbar:"#optionToolbar", |
| | | defaultToolbar:[], |
| | | cols: [[ |
| | | {type: 'numbers', title: '序号', width: 80}, |
| | | {type: 'numbers', title: '', width: 80}, |
| | | {title: '操作', toolbar: '#optionOption', minWidth: 200, align: 'center'}, |
| | | {field: 'number', title: '编号', minWidth: 100,align:'center'}, |
| | | {field: 'beautyName', title: '选项名称', minWidth: 200,align:'center'}, |
| | | // {field: 'rank', title: '排名', minWidth: 150,align:'center'}, |
| | | {field: 'voteCount', title: '总票数', minWidth: 100,align:'center'}, |
| | | // {field: 'diffPrevious', title: '票数差', minWidth: 150,align:'center'}, |
| | | // {field: 'description', title: '选项描述', minWidth: 100,align:'center'}, |
| | | {title: '审核状态', templet: '#auditType', minWidth: 100,align:'center'}, |
| | | {field: 'orderCnt', title: '编号', minWidth: 100,align:'center'}, |
| | | {field: 'optionName', title: '选项名称', minWidth: 200,align:'center'}, |
| | | {title: '审核状态', templet: '#optionStateType', minWidth: 100,align:'center'}, |
| | | {field: 'createdTime', title: '创建时间', minWidth: 150,align:'left'} |
| | | ]] |
| | | }); |
| | |
| | | // 获取查询参数 |
| | | function getQueryParams() { |
| | | return { |
| | | beautyName: $searchForm.find('input[name="beautyName"]').val().trim(), |
| | | optionName: $searchForm.find('input[name="optionName"]').val().trim(), |
| | | activityId: $searchForm.find("select[name='activityId']").val(), |
| | | audit: $searchForm.find("select[name='audit']").val(), |
| | | state: $searchForm.find("select[name='state']").val(), |
| | | }; |
| | | } |
| | | |
| | |
| | | tableIns = febs.table.init({ |
| | | elem: $view.find('table'), |
| | | id: 'voteRecordTable', |
| | | url: ctx + 'admin/votesActivity/voteRecord?parentId=1', |
| | | url: ctx + 'admin/happyActivity/voteRecord?parentId=1', |
| | | cols: [[ |
| | | {field: 'memberName', title: '昵称', minWidth: 150,align:'center'}, |
| | | {field: 'activityName', title: '活动', minWidth: 150,align:'center'}, |
| | | {field: 'optionName', title: '选项', minWidth: 150,align:'center'}, |
| | | {field: 'voteTime', title: '投票时间', minWidth: 150,align:'center'} |
| | | {field: 'createdTime', title: '投票时间', minWidth: 150,align:'center'} |
| | | ]] |
| | | }); |
| | | } |
| | |
| | | treeSelect: 'lay/extends/treeSelect', |
| | | apexcharts: 'lay/extends/apexcharts.min', |
| | | eleTree: 'lay/extends/eleTree', |
| | | xmSelect: 'lay/extends/xm-select' |
| | | xmSelect: 'lay/extends/xm-select', |
| | | layarea: 'layarea', |
| | | }).use(['index']); |
| | | </script> |
| | | </body> |