diff --git a/zt-admin/src/main/java/com/wuzhen/web/controller/busi/ActiveInfoController.java b/zt-admin/src/main/java/com/wuzhen/web/controller/busi/ActiveInfoController.java index 2dbf4cc50..90c8e6cb0 100644 --- a/zt-admin/src/main/java/com/wuzhen/web/controller/busi/ActiveInfoController.java +++ b/zt-admin/src/main/java/com/wuzhen/web/controller/busi/ActiveInfoController.java @@ -90,7 +90,7 @@ public class ActiveInfoController extends BaseController if (!"".equals(filename)){ // 定义上传文件保存路径 - String path = RuoYiConfig.getUploadPath(); + String path = RuoYiConfig.getLPUploadPath(); // 新建文件 File filepath = new File(path, filename); // 判断路径是否存在,如果不存在就创建一个 @@ -125,6 +125,56 @@ public class ActiveInfoController extends BaseController return prefix + "/edit"; } + /** + * 修改活动 + */ + @RequiresPermissions("active:info:edit") + @GetMapping("/first/{id}") + public String first(@PathVariable("id") Long id, ModelMap mmap) + { + mmap.put("active", activeInfoService.selectActiveById(id)); + return prefix + "/first"; + } + + + /** + *保存首页 + */ + @RequiresPermissions("active:info:edit") + @Log(title = "保存首页", businessType = BusinessType.UPDATE) + @PostMapping("/firstSave") + @ResponseBody + public AjaxResult firstSave(@Validated ActiveInfo activeInfo) + { + MultipartFile file = activeInfo.getActiveFirstPic(); + // 获取上传文件名 + String filename = file.getOriginalFilename(); + if (!"".equals(filename)){ + + // 定义上传文件保存路径 + String path = RuoYiConfig.getFPUploadPath(); + // 新建文件 + File filepath = new File(path, filename); + // 判断路径是否存在,如果不存在就创建一个 + if (!filepath.getParentFile().exists()) { + filepath.getParentFile().mkdirs(); + } + String picUrl = path + File.separator + filename; + try { + // 写入文件 + file.transferTo(new File(picUrl)); + } catch (IOException e) { + e.printStackTrace(); + } + activeInfo.setActiveFirstPicUrl(filename); + } + activeInfo.setUpdateBy(getLoginName()); + AuthorizationUtils.clearAllCachedAuthorizationInfo(); + return toAjax(activeInfoService.saveFistPage(activeInfo)); + } + + + /** * 修改保存活动 */ @@ -134,16 +184,7 @@ public class ActiveInfoController extends BaseController @ResponseBody public AjaxResult editSave(@Validated ActiveInfo activeInfo) { -// roleService.checkRoleAllowed(role); -// roleService.checkRoleDataScope(role.getRoleId()); -// if (UserConstants.ROLE_NAME_NOT_UNIQUE.equals(roleService.checkRoleNameUnique(role))) -// { -// return error("修改角色'" + role.getRoleName() + "'失败,角色名称已存在"); -// } -// else if (UserConstants.ROLE_KEY_NOT_UNIQUE.equals(roleService.checkRoleKeyUnique(role))) -// { -// return error("修改角色'" + role.getRoleName() + "'失败,角色权限已存在"); -// } + activeInfo.setUpdateBy(getLoginName()); AuthorizationUtils.clearAllCachedAuthorizationInfo(); return toAjax(activeInfoService.updateActive(activeInfo)); diff --git a/zt-admin/src/main/resources/templates/active/info/add.html b/zt-admin/src/main/resources/templates/active/info/add.html index a24c67761..0d66e244d 100644 --- a/zt-admin/src/main/resources/templates/active/info/add.html +++ b/zt-admin/src/main/resources/templates/active/info/add.html @@ -63,12 +63,11 @@
- +
- +
diff --git a/zt-admin/src/main/resources/templates/active/info/edit.html b/zt-admin/src/main/resources/templates/active/info/edit.html index 262a7bdbd..de23ac839 100644 --- a/zt-admin/src/main/resources/templates/active/info/edit.html +++ b/zt-admin/src/main/resources/templates/active/info/edit.html @@ -63,12 +63,11 @@
- +
- +
diff --git a/zt-admin/src/main/resources/templates/active/info/first.html b/zt-admin/src/main/resources/templates/active/info/first.html new file mode 100644 index 000000000..4c8400d62 --- /dev/null +++ b/zt-admin/src/main/resources/templates/active/info/first.html @@ -0,0 +1,108 @@ + + + + + + + + +
+
+ +
+ +
+ +
+
+ +
+ +
+ + + +
+ +
+ +
+
+ + + + + + + + + diff --git a/zt-admin/src/main/resources/templates/active/info/index.html b/zt-admin/src/main/resources/templates/active/info/index.html index a48af8b6c..542d9be76 100644 --- a/zt-admin/src/main/resources/templates/active/info/index.html +++ b/zt-admin/src/main/resources/templates/active/info/index.html @@ -65,6 +65,7 @@