1 files modified
21 files added
| | |
| | | <swagger.ui>2.9.2</swagger.ui> |
| | | <tomcat.version>9.0.31</tomcat.version> |
| | | <hutool.version>5.3.1</hutool.version> |
| | | <aliyun-oss.version>3.8.0</aliyun-oss.version> |
| | | </properties> |
| | | |
| | | <dependencies> |
| | | <dependency> |
| | | <groupId>com.aliyun.oss</groupId> |
| | | <artifactId>aliyun-sdk-oss</artifactId> |
| | | <version>${aliyun-oss.version}</version> |
| | | </dependency> |
| | | <dependency> |
| | | <groupId>cn.hutool</groupId> |
| | | <artifactId>hutool-all</artifactId> |
New file |
| | |
| | | package com.xcong.excoin.common.utils;
|
| | |
|
| | | import java.io.ByteArrayInputStream;
|
| | | import com.aliyun.oss.OSS;
|
| | | import com.aliyun.oss.OSSClientBuilder;
|
| | |
|
| | | import sun.misc.BASE64Decoder;
|
| | |
|
| | | import lombok.extern.slf4j.Slf4j;
|
| | |
|
| | | @Slf4j
|
| | | public class OssUtils {
|
| | |
|
| | | private static String END_POINT = "https://oss-cn-hangzhou.aliyuncs.com";
|
| | | private static String ACCESS_KEY_ID = "LTAI4GBuydqbJ5bTsDP97Lpd";
|
| | | private static String ACCESS_KEY_SECRET = "vbCjQtPxABWjqtUlQfzjlA0qAY96fh";
|
| | | private static String bucket_name = "https://excoin.oss-cn-hangzhou.aliyuncs.com";
|
| | |
|
| | | public static boolean uploadFileWithBase64(String base64, String pathName) {
|
| | | ByteArrayInputStream stream = null;
|
| | | try {
|
| | | OSS ossClient = new OSSClientBuilder().build(END_POINT, ACCESS_KEY_ID,ACCESS_KEY_SECRET);
|
| | | BASE64Decoder decoder = new BASE64Decoder();
|
| | | byte[] bytes = decoder.decodeBuffer(base64);
|
| | | stream = new ByteArrayInputStream(bytes);
|
| | | ossClient.putObject("excoin", pathName, stream);
|
| | | return true;
|
| | | } catch (Exception e) {
|
| | | log.error("#上传失败:{}#", e);
|
| | | return false;
|
| | | }
|
| | | }
|
| | | |
| | | |
| | | }
|
New file |
| | |
| | | package com.xcong.excoin.common.utils;
|
| | | import org.springframework.beans.BeansException;
|
| | | import org.springframework.beans.factory.DisposableBean;
|
| | | import org.springframework.context.ApplicationContext;
|
| | | import org.springframework.context.ApplicationContextAware;
|
| | | import org.springframework.stereotype.Component;
|
| | |
|
| | | import lombok.extern.slf4j.Slf4j;
|
| | | @Component
|
| | | @Slf4j
|
| | | public class SpringContextHolder implements ApplicationContextAware, DisposableBean {
|
| | |
|
| | | private static ApplicationContext applicationContext = null;
|
| | |
|
| | | /**
|
| | | * 从静态变量applicationContext中取得Bean, 自动转型为所赋值对象的类型.
|
| | | */
|
| | | @SuppressWarnings("unchecked")
|
| | | public static <T> T getBean(String name) {
|
| | | assertContextInjected();
|
| | | return (T) applicationContext.getBean(name);
|
| | | }
|
| | |
|
| | | /**
|
| | | * 从静态变量applicationContext中取得Bean, 自动转型为所赋值对象的类型.
|
| | | */
|
| | | public static <T> T getBean(Class<T> requiredType) {
|
| | | assertContextInjected();
|
| | | return applicationContext.getBean(requiredType);
|
| | | }
|
| | |
|
| | | private static void assertContextInjected() {
|
| | | if (applicationContext == null) {
|
| | | throw new IllegalStateException("applicaitonContext属性未注入, 请在applicationContext" +
|
| | | ".xml中定义SpringContextHolder或在SpringBoot启动类中注册SpringContextHolder.");
|
| | | }
|
| | | }
|
| | |
|
| | | /**
|
| | | * 检查ApplicationContext不为空.
|
| | | */
|
| | | private static void clearHolder() {
|
| | | log.debug("清除SpringContextHolder中的ApplicationContext:" + applicationContext);
|
| | | applicationContext = null;
|
| | | }
|
| | |
|
| | | @Override
|
| | | public void destroy() throws Exception {
|
| | | SpringContextHolder.clearHolder();
|
| | | }
|
| | |
|
| | | @Override
|
| | | public void setApplicationContext(ApplicationContext applicationContext) throws BeansException {
|
| | | if (SpringContextHolder.applicationContext != null) {
|
| | | log.warn("SpringContextHolder中的ApplicationContext被覆盖, 原有ApplicationContext为:" + SpringContextHolder.applicationContext);
|
| | | }
|
| | | SpringContextHolder.applicationContext = applicationContext;
|
| | | }
|
| | | }
|
New file |
| | |
| | | package com.xcong.excoin.modules.helpCenter.controller;
|
| | |
|
| | | import java.io.IOException;
|
| | | import java.util.HashMap;
|
| | | import java.util.Map;
|
| | |
|
| | | import javax.validation.Valid;
|
| | | import javax.validation.constraints.NotNull;
|
| | |
|
| | | import org.springframework.validation.annotation.Validated;
|
| | | import org.springframework.web.bind.annotation.GetMapping;
|
| | | import org.springframework.web.bind.annotation.PathVariable;
|
| | | import org.springframework.web.bind.annotation.PostMapping;
|
| | | import org.springframework.web.bind.annotation.RequestBody;
|
| | | import org.springframework.web.bind.annotation.RequestMapping;
|
| | | import org.springframework.web.bind.annotation.RestController;
|
| | | import org.springframework.web.multipart.MultipartFile;
|
| | |
|
| | | import com.xcong.excoin.common.annotation.ControllerEndpoint;
|
| | | import com.xcong.excoin.common.controller.BaseController;
|
| | | import com.xcong.excoin.common.entity.FebsResponse;
|
| | | import com.xcong.excoin.common.entity.QueryRequest;
|
| | | import com.xcong.excoin.common.utils.OssUtils;
|
| | | import com.xcong.excoin.modules.helpCenter.entity.HelpCenterArticleEntity;
|
| | | import com.xcong.excoin.modules.helpCenter.entity.HelpCenterNoticeEntity;
|
| | | import com.xcong.excoin.modules.helpCenter.service.HelpCenterService;
|
| | | import sun.misc.BASE64Encoder;
|
| | |
|
| | | import cn.hutool.core.util.IdUtil;
|
| | | import lombok.RequiredArgsConstructor;
|
| | | import lombok.extern.slf4j.Slf4j;
|
| | |
|
| | | @Slf4j
|
| | | @Validated
|
| | | @RestController
|
| | | @RequiredArgsConstructor
|
| | | @RequestMapping(value = "/helpCenter")
|
| | | public class HelpCenterController extends BaseController {
|
| | | |
| | | private final HelpCenterService helpCenterService;
|
| | | |
| | | /**
|
| | | * 帮助中心---列表
|
| | | * @return
|
| | | */
|
| | | @GetMapping("getHelpCenterList")
|
| | | public FebsResponse getHelpCenterList(HelpCenterNoticeEntity helpCenterNoticeEntity, QueryRequest request) {
|
| | | Map<String, Object> data = getDataTable(helpCenterService.findHelpCenterListInPage(helpCenterNoticeEntity, request));
|
| | | return new FebsResponse().success().data(data);
|
| | | }
|
| | | |
| | | /**
|
| | | * 帮助中心---删除公告
|
| | | * @param id
|
| | | * @return
|
| | | */
|
| | | @GetMapping("helpCenterDelete/{id}")
|
| | | @ControllerEndpoint(operation = "删除公告", exceptionMessage = "删除失败")
|
| | | public FebsResponse helpCenterDelete(@NotNull(message = "{required}") @PathVariable Long id) {
|
| | | return helpCenterService.helpCenterDelete(id);
|
| | | }
|
| | | |
| | | /**
|
| | | * 帮助中心---新增
|
| | | */
|
| | | @PostMapping("helpCenterAdds")
|
| | | @ControllerEndpoint(operation = " 帮助中心---新增", exceptionMessage = "新增失败")
|
| | | public FebsResponse helpCenterAdds(@Valid HelpCenterNoticeEntity helpCenterNoticeEntity) {
|
| | | helpCenterService.helpCenterAdds(helpCenterNoticeEntity);
|
| | | return new FebsResponse().success();
|
| | | }
|
| | | |
| | | /**
|
| | | * 帮助中心---中文确认
|
| | | * @return
|
| | | */
|
| | | @PostMapping("helpCenterConfirm")
|
| | | @ControllerEndpoint(operation = "帮助中心---确认", exceptionMessage = "设置失败")
|
| | | public FebsResponse helpCenterConfirm(@Valid HelpCenterArticleEntity helpCenterArticleEntity) {
|
| | | return helpCenterService.helpCenterConfirm(helpCenterArticleEntity);
|
| | | }
|
| | | |
| | | /**
|
| | | * 帮助中心---英文确认
|
| | | * @return
|
| | | */
|
| | | @PostMapping("helpCenterUsConfirm")
|
| | | @ControllerEndpoint(operation = "帮助中心---确认", exceptionMessage = "设置失败")
|
| | | public FebsResponse helpCenterUsConfirm(@Valid HelpCenterArticleEntity helpCenterArticleEntity) {
|
| | | return helpCenterService.helpCenterUsConfirm(helpCenterArticleEntity);
|
| | | }
|
| | | |
| | | /**
|
| | | * 帮助中心---图片上传
|
| | | * @param uploadDto
|
| | | * @return
|
| | | */
|
| | | @PostMapping(value = "/uploadFileBase64")
|
| | | @ControllerEndpoint(operation = "帮助中心---图片上传", exceptionMessage = "上传失败")
|
| | | public Map<String,Object> uploadFileBase64(@RequestBody @Validated MultipartFile file) {
|
| | | if (file.isEmpty()) {
|
| | | new FebsResponse().message("上传文件为空");
|
| | | }
|
| | | |
| | | //文件加密
|
| | | BASE64Encoder base64Encoder =new BASE64Encoder();
|
| | | String base64EncoderImg = null;
|
| | | try {
|
| | | base64EncoderImg = base64Encoder.encode(file.getBytes());
|
| | | } catch (IOException e) {
|
| | | e.printStackTrace();
|
| | | }
|
| | |
|
| | | String imageFuffix = ".jpg";
|
| | | String imageNames = System.currentTimeMillis() + IdUtil.simpleUUID() + imageFuffix;
|
| | | String imageName = "uploadeFile/image/" + 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;
|
| | | }
|
| | | |
| | | |
| | |
|
| | | }
|
New file |
| | |
| | | package com.xcong.excoin.modules.helpCenter.controller;
|
| | |
|
| | | import org.apache.shiro.authz.annotation.RequiresPermissions;
|
| | | import org.springframework.stereotype.Controller;
|
| | | import org.springframework.ui.Model;
|
| | | import org.springframework.web.bind.annotation.GetMapping;
|
| | | import org.springframework.web.bind.annotation.PathVariable;
|
| | | import org.springframework.web.bind.annotation.RequestMapping;
|
| | |
|
| | | import com.xcong.excoin.common.entity.FebsConstant;
|
| | | import com.xcong.excoin.common.utils.FebsUtil;
|
| | | import com.xcong.excoin.modules.helpCenter.entity.HelpCenterArticleEntity;
|
| | | import com.xcong.excoin.modules.helpCenter.service.HelpCenterService;
|
| | |
|
| | | import lombok.RequiredArgsConstructor;
|
| | |
|
| | | @Controller("helpCenterView")
|
| | | @RequestMapping(FebsConstant.VIEW_PREFIX + "modules/helpCenter")
|
| | | @RequiredArgsConstructor
|
| | | public class ViewController {
|
| | | |
| | | private final HelpCenterService helpCenterService;
|
| | | |
| | | /**
|
| | | * 帮助中心---列表
|
| | | * @return
|
| | | */
|
| | | @GetMapping("helpCenterList")
|
| | | @RequiresPermissions("helpCenterList:view")
|
| | | public String traderUpdate() {
|
| | | return FebsUtil.view("modules/helpCenter/helpCenterList");
|
| | | }
|
| | | |
| | | /**
|
| | | * 帮助中心---中文版修改
|
| | | */
|
| | | @GetMapping("helpCenterUpdate/{id}")
|
| | | @RequiresPermissions("helpCenterUpdate:update")
|
| | | public String helpCenterUpdate(@PathVariable long id, Model model) {
|
| | | HelpCenterArticleEntity data = helpCenterService.selectHelpCenterServiceById(id);
|
| | | model.addAttribute("member", data);
|
| | | return FebsUtil.view("modules/helpCenter/helpCenterUpdate");
|
| | | }
|
| | | /**
|
| | | * 帮助中心---英文版修改
|
| | | */
|
| | | @GetMapping("helpCenterUpdateUs/{id}")
|
| | | @RequiresPermissions("helpCenterUpdateUs:update")
|
| | | public String helpCenterUpdateUs(@PathVariable long id, Model model) {
|
| | | HelpCenterArticleEntity data = helpCenterService.selectHelpCenterUsServiceById(id);
|
| | | model.addAttribute("member", data);
|
| | | return FebsUtil.view("modules/helpCenter/helpCenterUpdateUs");
|
| | | }
|
| | | |
| | | /**
|
| | | * 帮助中心---新增
|
| | | */
|
| | | @GetMapping("helpCenterAdd")
|
| | | @RequiresPermissions("helpCenterAdd:add")
|
| | | public String helpCenterAdd() {
|
| | | return FebsUtil.view("modules/helpCenter/helpCenterAdd");
|
| | | }
|
| | |
|
| | | }
|
New file |
| | |
| | | package com.xcong.excoin.modules.helpCenter.dto;
|
| | |
|
| | | import org.springframework.boot.context.properties.ConfigurationProperties;
|
| | | import org.springframework.context.annotation.Configuration;
|
| | |
|
| | | import lombok.Data;
|
| | |
|
| | | @Data
|
| | | @Configuration
|
| | | @ConfigurationProperties(prefix = "aliyun.oss")
|
| | | public class AliOssProperties {
|
| | | private String endPoint;
|
| | |
|
| | | private String bucketName;
|
| | |
|
| | | private String accessKeyId;
|
| | |
|
| | | private String accessKeySecret;
|
| | | }
|
| | |
|
New file |
| | |
| | | package com.xcong.excoin.modules.helpCenter.dto;
|
| | |
|
| | | import javax.validation.constraints.NotBlank;
|
| | |
|
| | | import io.swagger.annotations.ApiModel;
|
| | | import io.swagger.annotations.ApiModelProperty;
|
| | | import lombok.Data;
|
| | |
|
| | | @Data
|
| | | @ApiModel(value = "Base64UploadDto", description = "base64文件上传参数类")
|
| | | public class Base64UploadDto {
|
| | |
|
| | | @NotBlank
|
| | | @ApiModelProperty(value = "base64字符串")
|
| | | public String base64Str;
|
| | |
|
| | | }
|
New file |
| | |
| | | package com.xcong.excoin.modules.helpCenter.entity;
|
| | |
|
| | | import java.util.Date;
|
| | |
|
| | | import com.baomidou.mybatisplus.annotation.IdType;
|
| | | import com.baomidou.mybatisplus.annotation.TableId;
|
| | | import com.baomidou.mybatisplus.annotation.TableName;
|
| | | import com.fasterxml.jackson.annotation.JsonFormat;
|
| | |
|
| | | import lombok.Data;
|
| | |
|
| | | /**
|
| | | * 文章内容
|
| | | */
|
| | | @Data
|
| | | @TableName("help_center_article")
|
| | | public class HelpCenterArticleEntity {
|
| | | |
| | | @TableId(value = "id",type = IdType.AUTO)
|
| | | private Long id;
|
| | | /**
|
| | | * 创建者
|
| | | */
|
| | | private String createBy;
|
| | | /**
|
| | | * 创建时间
|
| | | */
|
| | | @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
|
| | | private Date createTime;
|
| | | /**
|
| | | * 语言类型(1:简体中文2:英文)
|
| | | */
|
| | | private int typeLanguage;
|
| | | /**
|
| | | * 标题
|
| | | */
|
| | | private String title;
|
| | | /**
|
| | | * 内容
|
| | | */
|
| | | private String content;
|
| | |
|
| | | }
|
New file |
| | |
| | | package com.xcong.excoin.modules.helpCenter.entity;
|
| | |
|
| | | import java.util.Date;
|
| | |
|
| | |
|
| | | import com.baomidou.mybatisplus.annotation.IdType;
|
| | | import com.baomidou.mybatisplus.annotation.TableField;
|
| | | import com.baomidou.mybatisplus.annotation.TableId;
|
| | | import com.baomidou.mybatisplus.annotation.TableName;
|
| | | import com.fasterxml.jackson.annotation.JsonFormat;
|
| | |
|
| | | import lombok.Data;
|
| | |
|
| | | /**
|
| | | * 帮助中心公告
|
| | | */
|
| | | @Data
|
| | | @TableName("help_center_notice")
|
| | | public class HelpCenterNoticeEntity {
|
| | | |
| | | @TableId(value = "id",type = IdType.AUTO)
|
| | | private Long id;
|
| | | /**
|
| | | * 创建者
|
| | | */
|
| | | private String createBy;
|
| | | /**
|
| | | * 创建时间
|
| | | */
|
| | | @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
|
| | | private Date createTime;
|
| | | /**
|
| | | * 所属类别(1:最新公告2:重要公告)
|
| | | */
|
| | | private int articleNotice;
|
| | | /**
|
| | | * 文章id
|
| | | */
|
| | | private Long articleId;
|
| | | /**
|
| | | *文章标题
|
| | | */
|
| | | private String articleTitle;
|
| | | /**
|
| | | * 文章id
|
| | | */
|
| | | private Long articleIdUs;
|
| | | /**
|
| | | *文章标题
|
| | | */
|
| | | private String articleTitleUs;
|
| | | |
| | | @TableField(exist = false)
|
| | | private String createTimeString;
|
| | | |
| | | |
| | |
|
| | | }
|
New file |
| | |
| | | package com.xcong.excoin.modules.helpCenter.entity;
|
| | |
|
| | | import com.baomidou.mybatisplus.annotation.IdType;
|
| | | import com.baomidou.mybatisplus.annotation.TableId;
|
| | | import com.baomidou.mybatisplus.annotation.TableName;
|
| | |
|
| | | import lombok.Data;
|
| | |
|
| | | /**
|
| | | * 帮助中心类别
|
| | | */
|
| | | @Data
|
| | | @TableName("help_center_type")
|
| | | public class HelpCenterTypeEntity {
|
| | | |
| | | @TableId(value = "id",type = IdType.AUTO)
|
| | | private Long id;
|
| | | /**
|
| | | * 所属类别(1:公告类型2:语言类型)
|
| | | */
|
| | | private int status;
|
| | | /**
|
| | | * 类型标识
|
| | | */
|
| | | private int type;
|
| | | /**
|
| | | * 语言类型(1:简体中文2:英文)
|
| | | */
|
| | | private int typeLanguage;
|
| | | /**
|
| | | *类型内容
|
| | | */
|
| | | private String content;
|
| | |
|
| | | }
|
New file |
| | |
| | | package com.xcong.excoin.modules.helpCenter.mapper;
|
| | |
|
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
| | | import com.xcong.excoin.modules.helpCenter.entity.HelpCenterArticleEntity;
|
| | |
|
| | | public interface HelpCenterArticleMapper extends BaseMapper<HelpCenterArticleEntity> {
|
| | |
|
| | | }
|
New file |
| | |
| | | package com.xcong.excoin.modules.helpCenter.mapper;
|
| | |
|
| | | import org.apache.ibatis.annotations.Param;
|
| | |
|
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
| | | import com.baomidou.mybatisplus.core.metadata.IPage;
|
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
| | | import com.xcong.excoin.modules.helpCenter.entity.HelpCenterNoticeEntity;
|
| | |
|
| | | public interface HelpCenterNoticeMapper extends BaseMapper<HelpCenterNoticeEntity> {
|
| | |
|
| | | IPage<HelpCenterNoticeEntity> findHelpCenterListInPage(Page<HelpCenterNoticeEntity> page,
|
| | | @Param("record") HelpCenterNoticeEntity helpCenterNoticeEntity);
|
| | |
|
| | | }
|
New file |
| | |
| | | package com.xcong.excoin.modules.helpCenter.mapper;
|
| | |
|
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
| | | import com.xcong.excoin.modules.helpCenter.entity.HelpCenterTypeEntity;
|
| | |
|
| | | public interface HelpCenterTypeMapper extends BaseMapper<HelpCenterTypeEntity> {
|
| | |
|
| | | }
|
New file |
| | |
| | | package com.xcong.excoin.modules.helpCenter.service;
|
| | |
|
| | | import javax.validation.Valid;
|
| | | import javax.validation.constraints.NotNull;
|
| | |
|
| | | import com.baomidou.mybatisplus.core.metadata.IPage;
|
| | | import com.baomidou.mybatisplus.extension.service.IService;
|
| | | import com.xcong.excoin.common.entity.FebsResponse;
|
| | | import com.xcong.excoin.common.entity.QueryRequest;
|
| | | import com.xcong.excoin.modules.helpCenter.entity.HelpCenterArticleEntity;
|
| | | import com.xcong.excoin.modules.helpCenter.entity.HelpCenterNoticeEntity;
|
| | |
|
| | | public interface HelpCenterService extends IService<HelpCenterNoticeEntity> {
|
| | |
|
| | | IPage<HelpCenterNoticeEntity> findHelpCenterListInPage(HelpCenterNoticeEntity helpCenterNoticeEntity, QueryRequest request);
|
| | |
|
| | | FebsResponse helpCenterDelete(@NotNull(message = "{required}") Long id);
|
| | |
|
| | | HelpCenterArticleEntity selectHelpCenterServiceById(long id);
|
| | |
|
| | | HelpCenterArticleEntity selectHelpCenterUsServiceById(long id);
|
| | |
|
| | | void helpCenterAdds(@Valid HelpCenterNoticeEntity helpCenterNoticeEntity);
|
| | |
|
| | | FebsResponse helpCenterConfirm(@Valid HelpCenterArticleEntity helpCenterArticleEntity);
|
| | |
|
| | | FebsResponse helpCenterUsConfirm(@Valid HelpCenterArticleEntity helpCenterArticleEntity);
|
| | |
|
| | | }
|
New file |
| | |
| | | package com.xcong.excoin.modules.helpCenter.service.impl;
|
| | |
|
| | |
|
| | | import java.text.SimpleDateFormat;
|
| | | import java.util.Date;
|
| | | import java.util.HashMap;
|
| | | import java.util.List;
|
| | | import java.util.Map;
|
| | |
|
| | | import javax.validation.Valid;
|
| | | import javax.validation.constraints.NotNull;
|
| | |
|
| | | import org.springframework.stereotype.Service;
|
| | | import org.springframework.transaction.annotation.Transactional;
|
| | |
|
| | | import com.baomidou.mybatisplus.core.metadata.IPage;
|
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
| | | import com.xcong.excoin.common.entity.FebsResponse;
|
| | | import com.xcong.excoin.common.entity.QueryRequest;
|
| | | import com.xcong.excoin.modules.helpCenter.entity.HelpCenterArticleEntity;
|
| | | import com.xcong.excoin.modules.helpCenter.entity.HelpCenterNoticeEntity;
|
| | | import com.xcong.excoin.modules.helpCenter.mapper.HelpCenterArticleMapper;
|
| | | import com.xcong.excoin.modules.helpCenter.mapper.HelpCenterNoticeMapper;
|
| | | import com.xcong.excoin.modules.helpCenter.service.HelpCenterService;
|
| | |
|
| | | import cn.hutool.core.collection.CollUtil;
|
| | | import cn.hutool.core.util.ObjectUtil;
|
| | | import lombok.RequiredArgsConstructor;
|
| | | import lombok.extern.slf4j.Slf4j;
|
| | |
|
| | | @Slf4j
|
| | | @Service
|
| | | @RequiredArgsConstructor
|
| | | public class HelpCenterServiceImpl extends ServiceImpl<HelpCenterNoticeMapper, HelpCenterNoticeEntity> implements HelpCenterService {
|
| | | |
| | | private final HelpCenterNoticeMapper helpCenterNoticeMapper;
|
| | | |
| | | private final HelpCenterArticleMapper helpCenterArticleMapper;
|
| | | |
| | | @Override
|
| | | public IPage<HelpCenterNoticeEntity> findHelpCenterListInPage(HelpCenterNoticeEntity helpCenterNoticeEntity,
|
| | | QueryRequest request) {
|
| | | Page<HelpCenterNoticeEntity> page = new Page<>(request.getPageNum(), request.getPageSize());
|
| | | IPage<HelpCenterNoticeEntity> helpCenterNoticeEntitys = helpCenterNoticeMapper.findHelpCenterListInPage(page, helpCenterNoticeEntity);
|
| | | return helpCenterNoticeEntitys;
|
| | | }
|
| | |
|
| | | @Override
|
| | | @Transactional
|
| | | public FebsResponse helpCenterDelete(@NotNull(message = "{required}") Long id) {
|
| | |
|
| | | HelpCenterNoticeEntity helpCenterNoticeEntity = helpCenterNoticeMapper.selectById(id);
|
| | | if(ObjectUtil.isEmpty(helpCenterNoticeEntity)) {
|
| | | return new FebsResponse().fail().message("该公告不存在");
|
| | | }
|
| | | Long articleId = helpCenterNoticeEntity.getArticleId();
|
| | | if(ObjectUtil.isNotEmpty(articleId)) {
|
| | | helpCenterArticleMapper.deleteById(articleId);
|
| | | }
|
| | | Long articleIdUs = helpCenterNoticeEntity.getArticleIdUs();
|
| | | if(ObjectUtil.isNotEmpty(articleId)) {
|
| | | helpCenterArticleMapper.deleteById(articleIdUs);
|
| | | }
|
| | | |
| | | helpCenterNoticeMapper.deleteById(id);
|
| | | return new FebsResponse().success();
|
| | | }
|
| | |
|
| | | @Override
|
| | | public HelpCenterArticleEntity selectHelpCenterServiceById(long id) {
|
| | | HelpCenterNoticeEntity helpCenterNoticeEntity = helpCenterNoticeMapper.selectById(id);
|
| | | Long articleId = helpCenterNoticeEntity.getArticleId();
|
| | | HelpCenterArticleEntity selectById = helpCenterArticleMapper.selectById(articleId);
|
| | | return selectById;
|
| | | }
|
| | |
|
| | | @Override
|
| | | public HelpCenterArticleEntity selectHelpCenterUsServiceById(long id) {
|
| | | HelpCenterNoticeEntity helpCenterNoticeEntity = helpCenterNoticeMapper.selectById(id);
|
| | | Long articleId = helpCenterNoticeEntity.getArticleIdUs();
|
| | | HelpCenterArticleEntity selectById = helpCenterArticleMapper.selectById(articleId);
|
| | | return selectById;
|
| | | }
|
| | |
|
| | | @Override
|
| | | @Transactional
|
| | | public void helpCenterAdds(@Valid HelpCenterNoticeEntity helpCenterNoticeEntity) {
|
| | | //新增【文章内容】
|
| | | HelpCenterArticleEntity helpCenterArticleEntity = new HelpCenterArticleEntity();
|
| | | helpCenterArticleEntity.setCreateBy(helpCenterNoticeEntity.getCreateBy());
|
| | | |
| | | Date date = new Date();
|
| | | try {
|
| | | SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
|
| | | date = sdf.parse(helpCenterNoticeEntity.getCreateTimeString());
|
| | | } catch (Exception e) {
|
| | | e.printStackTrace();
|
| | | }
|
| | | helpCenterArticleEntity.setCreateTime(date);
|
| | | helpCenterArticleEntity.setTypeLanguage(1);
|
| | | helpCenterArticleMapper.insert(helpCenterArticleEntity);
|
| | | Long articleId = helpCenterArticleEntity.getId();
|
| | | |
| | | helpCenterArticleEntity.setTypeLanguage(2);
|
| | | helpCenterArticleMapper.insert(helpCenterArticleEntity);
|
| | | Long articleIdUs = helpCenterArticleEntity.getId();
|
| | | |
| | | HelpCenterNoticeEntity helpCenterNotice = new HelpCenterNoticeEntity();
|
| | | helpCenterNotice.setCreateBy(helpCenterNoticeEntity.getCreateBy());
|
| | | helpCenterNotice.setCreateTime(date);
|
| | | helpCenterNotice.setArticleNotice(helpCenterNoticeEntity.getArticleNotice());
|
| | | helpCenterNotice.setArticleId(articleId);
|
| | | helpCenterNotice.setArticleTitle(helpCenterNoticeEntity.getArticleTitle() == null ? "":helpCenterNoticeEntity.getArticleTitle());
|
| | | helpCenterNotice.setArticleIdUs(articleIdUs);
|
| | | helpCenterNotice.setArticleTitleUs(helpCenterNoticeEntity.getArticleTitleUs() == null ? "":helpCenterNoticeEntity.getArticleTitleUs());
|
| | | helpCenterNoticeMapper.insert(helpCenterNotice);
|
| | | }
|
| | |
|
| | | @Override
|
| | | @Transactional
|
| | | public FebsResponse helpCenterConfirm(@Valid HelpCenterArticleEntity helpCenterArticleEntity) {
|
| | | |
| | | Long id = helpCenterArticleEntity.getId();
|
| | | HelpCenterArticleEntity selectById = helpCenterArticleMapper.selectById(id);
|
| | | selectById.setContent(helpCenterArticleEntity.getContent());
|
| | | selectById.setTitle(helpCenterArticleEntity.getTitle());
|
| | | helpCenterArticleMapper.updateById(selectById);
|
| | | |
| | | Map<String, Object> columnMap = new HashMap<String, Object>();
|
| | | columnMap.put("article_id", id);
|
| | | List<HelpCenterNoticeEntity> selectByMap = helpCenterNoticeMapper.selectByMap(columnMap);
|
| | | if(CollUtil.isNotEmpty(selectByMap)) {
|
| | | HelpCenterNoticeEntity helpCenterNoticeEntity = selectByMap.get(0);
|
| | | String title = selectById.getTitle();
|
| | | helpCenterNoticeEntity.setArticleTitle(title);
|
| | | helpCenterNoticeMapper.updateById(helpCenterNoticeEntity);
|
| | | }
|
| | | return new FebsResponse().success();
|
| | | }
|
| | |
|
| | | @Override
|
| | | @Transactional
|
| | | public FebsResponse helpCenterUsConfirm(@Valid HelpCenterArticleEntity helpCenterArticleEntity) {
|
| | | |
| | | Long id = helpCenterArticleEntity.getId();
|
| | | HelpCenterArticleEntity selectById = helpCenterArticleMapper.selectById(id);
|
| | | selectById.setContent(helpCenterArticleEntity.getContent());
|
| | | selectById.setTitle(helpCenterArticleEntity.getTitle());
|
| | | helpCenterArticleMapper.updateById(selectById);
|
| | | |
| | | Map<String, Object> columnMap = new HashMap<String, Object>();
|
| | | columnMap.put("article_id_us", id);
|
| | | List<HelpCenterNoticeEntity> selectByMap = helpCenterNoticeMapper.selectByMap(columnMap);
|
| | | if(CollUtil.isNotEmpty(selectByMap)) {
|
| | | HelpCenterNoticeEntity helpCenterNoticeEntity = selectByMap.get(0);
|
| | | String title = selectById.getTitle();
|
| | | helpCenterNoticeEntity.setArticleTitleUs(title);
|
| | | helpCenterNoticeMapper.updateById(helpCenterNoticeEntity);
|
| | | }
|
| | | return new FebsResponse().success();
|
| | | }
|
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | |
|
| | | }
|
New file |
| | |
| | | <?xml version="1.0" encoding="UTF-8"?>
|
| | | <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
| | | <mapper namespace="com.xcong.excoin.modules.helpCenter.mapper.HelpCenterArticleMapper">
|
| | |
|
| | |
|
| | | <select id="findPlatformTradeSettingInPage" resultType="com.xcong.excoin.modules.systemSetting.entity.PlatformTradeSettingEntity">
|
| | | SELECT
|
| | | *
|
| | | FROM
|
| | | platform_trade_setting
|
| | | </select>
|
| | |
|
| | | </mapper> |
New file |
| | |
| | | <?xml version="1.0" encoding="UTF-8"?>
|
| | | <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
| | | <mapper namespace="com.xcong.excoin.modules.helpCenter.mapper.HelpCenterNoticeMapper">
|
| | |
|
| | | <select id="findHelpCenterListInPage" resultType="com.xcong.excoin.modules.helpCenter.entity.HelpCenterNoticeEntity">
|
| | | select * from help_center_notice order by create_time desc |
| | | </select>
|
| | |
|
| | | </mapper> |
New file |
| | |
| | | <?xml version="1.0" encoding="UTF-8"?>
|
| | | <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
| | | <mapper namespace="com.xcong.excoin.modules.helpCenter.mapper.HelpCenterTypeMapper">
|
| | |
|
| | |
|
| | | <select id="findPlatformTradeSettingInPage" resultType="com.xcong.excoin.modules.systemSetting.entity.PlatformTradeSettingEntity">
|
| | | SELECT
|
| | | *
|
| | | FROM
|
| | | platform_trade_setting
|
| | | </select>
|
| | |
|
| | | </mapper> |
New file |
| | |
| | | <style>
|
| | | #user-add {
|
| | | padding: 20px 25px 25px 0;
|
| | | }
|
| | |
|
| | | #user-add .layui-treeSelect .ztree li a, .ztree li span {
|
| | | margin: 0 0 2px 3px !important;
|
| | | }
|
| | | #user-add #data-permission-tree-block {
|
| | | border: 1px solid #eee;
|
| | | border-radius: 2px;
|
| | | padding: 3px 0;
|
| | | }
|
| | | #user-add .layui-treeSelect .ztree li span.button.switch {
|
| | | top: 1px;
|
| | | left: 3px;
|
| | | }
|
| | |
|
| | | </style>
|
| | | <div class="layui-fluid" id="user-add">
|
| | | <form class="layui-form" action="" lay-filter="user-add-form">
|
| | | <div class="layui-form-item">
|
| | | <label class="layui-form-label febs-form-item-require">创建者:</label>
|
| | | <div class="layui-input-block">
|
| | | <input type="text" name="createBy" minlength="4" maxlength="10" |
| | | lay-verify="range|createBy" autocomplete="off" class="layui-input" >
|
| | | </div>
|
| | | </div>
|
| | | <div class="layui-form-item">
|
| | | <label class="layui-form-label febs-form-item-require">所属类别:</label>
|
| | | <div class="layui-input-block">
|
| | | <input type="radio" name="articleNotice" value="1" title="最新公告" checked="">
|
| | | <input type="radio" name="articleNotice" value="2" title="重要公告">
|
| | | </div>
|
| | | </div>
|
| | | <div class="layui-inline">
|
| | | <label class="layui-form-label febs-form-item-require">创建时间:</label>
|
| | | <div class="layui-input-inline">
|
| | | <input type="text" name="createTimeString" id="febs-form-group-date"
|
| | | lay-verify="date" placeholder="yyyy-MM-dd" autocomplete="off" class="layui-input">
|
| | | </div>
|
| | | </div>
|
| | | <div class="layui-form-item febs-hide">
|
| | | <button class="layui-btn" lay-submit="" lay-filter="user-add-form-submit" id="submit"></button>
|
| | | </div>
|
| | | </form>
|
| | | </div>
|
| | |
|
| | | <script data-th-inline="javascript">
|
| | | layui.use(['febs', 'form', 'formSelects', 'validate', 'treeSelect', 'eleTree', 'laydate'], function () {
|
| | | var $ = layui.$,
|
| | | febs = layui.febs,
|
| | | layer = layui.layer,
|
| | | formSelects = layui.formSelects,
|
| | | treeSelect = layui.treeSelect,
|
| | | form = layui.form,
|
| | | laydate = layui.laydate,
|
| | | eleTree = layui.eleTree,
|
| | | member = [[${member}]],
|
| | | $view = $('#user-add'),
|
| | | validate = layui.validate;
|
| | |
|
| | | form.render();
|
| | | laydate.render({
|
| | | elem: '#febs-form-group-date'
|
| | | });
|
| | |
|
| | | formSelects.render();
|
| | |
|
| | | form.on('submit(user-add-form-submit)', function (data) {
|
| | | febs.post(ctx + 'helpCenter/helpCenterAdds', data.field, function () {
|
| | | layer.closeAll();
|
| | | febs.alert.success('新增成功');
|
| | | $('#febs-user').find('#reset').click();
|
| | | });
|
| | | return false;
|
| | | });
|
| | | });
|
| | | </script> |
New file |
| | |
| | | <div class="layui-fluid layui-anim febs-anim" id="febs-user" lay-title="帮助中心">
|
| | | <div class="layui-row febs-container">
|
| | | <div class="layui-col-md12">
|
| | | <div class="layui-card">
|
| | | <div class="layui-card-body febs-table-full">
|
| | | <form class="layui-form layui-table-form" lay-filter="user-table-form">
|
| | | <div class="layui-row">
|
| | | <div class="layui-col-md2 layui-col-sm12 layui-col-xs12 table-action-area">
|
| | | <div class="layui-btn layui-btn-sm layui-btn-primary febs-button-green-plain table-action" id="add">
|
| | | 新增
|
| | | </div>
|
| | | <div class="layui-btn layui-btn-sm layui-btn-primary febs-button-green-plain table-action" id="reset">
|
| | | <i class="layui-icon"></i>
|
| | | </div>
|
| | | </div>
|
| | | </div>
|
| | | </form>
|
| | | <table lay-filter="userTable" lay-data="{id: 'userTable'}"></table>
|
| | | </div>
|
| | | </div>
|
| | | </div>
|
| | | </div>
|
| | | </div>
|
| | |
|
| | | <!-- 表格操作栏 start -->
|
| | | <script type="text/html" id="user-option">
|
| | | <span shiro:lacksPermission="user:view,user:update,user:delete">
|
| | | <span class="layui-badge-dot febs-bg-orange"></span> 无权限
|
| | | </span>
|
| | | <a lay-event="edit" shiro:hasPermission="user:update">编辑
|
| | | <i class="layui-icon febs-edit-area febs-blue"></i>
|
| | | </a>
|
| | | <a lay-event="delete" shiro:hasPermission="user:update">删除
|
| | | <i class="layui-icon febs-edit-area febs-blue"></i>
|
| | | </a>
|
| | | </script>
|
| | | <!-- 表格操作栏 end -->
|
| | | <script data-th-inline="none" type="text/javascript">
|
| | | // 引入组件并初始化
|
| | | layui.use(['jquery', 'form', 'table', 'febs'], function () {
|
| | | var $ = layui.jquery,
|
| | | febs = layui.febs,
|
| | | form = layui.form,
|
| | | table = layui.table,
|
| | | $view = $('#febs-user'),
|
| | | $add = $view.find('#add'),
|
| | | $reset = $view.find('#reset'),
|
| | | $searchForm = $view.find('form'),
|
| | | tableIns
|
| | | ;
|
| | |
|
| | | form.render();
|
| | |
|
| | | // 表格初始化
|
| | | initTable();
|
| | |
|
| | | // 初始化表格操作栏各个按钮功能
|
| | | table.on('tool(userTable)', function (obj) {
|
| | | var data = obj.data,
|
| | | layEvent = obj.event;
|
| | | |
| | | if (layEvent === 'editCN') {
|
| | | febs.modal.open('中文版', 'modules/helpCenter/helpCenterUpdate/' + data.id, {
|
| | | btn: ['提交', '取消'],
|
| | | yes: function (index, layero) {
|
| | | $('#user-update').find('#submit').trigger('click');
|
| | | },
|
| | | btn2: function () {
|
| | | layer.closeAll();
|
| | | }
|
| | | });
|
| | | }
|
| | | if (layEvent === 'editUS') {
|
| | | febs.modal.open('英文版', 'modules/helpCenter/helpCenterUpdateUs/' + data.id, {
|
| | | btn: ['提交', '取消'],
|
| | | yes: function (index, layero) {
|
| | | $('#user-update').find('#submit').trigger('click');
|
| | | },
|
| | | btn2: function () {
|
| | | layer.closeAll();
|
| | | }
|
| | | });
|
| | | }
|
| | | if (layEvent === 'delete') {
|
| | | febs.modal.confirm('删除', '您是否确认删除?', function () {
|
| | | deleteUsers(data.id);
|
| | | });
|
| | | }
|
| | | });
|
| | | |
| | | function deleteUsers(id) {
|
| | | febs.get(ctx + 'helpCenter/helpCenterDelete/' + id, null, function () {
|
| | | febs.alert.success('删除成功');
|
| | | $reset.click();
|
| | | });
|
| | | }
|
| | | |
| | | // 刷新按钮
|
| | | $reset.on('click', function () {
|
| | | tableIns.reload({where: getQueryParams(), page: {curr: 1}});
|
| | | });
|
| | | // 获取查询参数
|
| | | function getQueryParams() {
|
| | | return {};
|
| | | }
|
| | | |
| | | $add.on('click', function () {
|
| | | febs.modal.open('新增', 'modules/helpCenter/helpCenterAdd/', {
|
| | | btn: ['提交', '取消'],
|
| | | yes: function (index, layero) {
|
| | | $('#user-add').find('#submit').trigger('click');
|
| | | },
|
| | | btn2: function () {
|
| | | layer.closeAll();
|
| | | }
|
| | | });
|
| | | });
|
| | |
|
| | | |
| | | function initTable() {
|
| | | tableIns = febs.table.init({
|
| | | elem: $view.find('table'),
|
| | | id: 'userTable',
|
| | | url: ctx + 'helpCenter/getHelpCenterList',
|
| | | cols: [[
|
| | | {field: 'createBy', title: '创建者', minWidth: 100,align:'left'},
|
| | | {field: 'createTime', title: '创建时间', minWidth: 200,align:'left'},
|
| | | {field: 'articleTitle', title: '中文标题', minWidth: 200,align:'left'},
|
| | | {field: 'articleTitleUs', title: '英文标题', minWidth: 200,align:'left'},
|
| | | {field: 'articleNotice', title: '所属类别',
|
| | | templet: function (d) {
|
| | | if (d.articleNotice === 1) {
|
| | | return '<span style="color:green;">最新公告</span>'
|
| | | } else if (d.articleNotice === 2) {
|
| | | return '<span style="color:red;">重要公告</span>'
|
| | | }else{
|
| | | return ''
|
| | | }
|
| | | }, minWidth: 80,align:'center'},
|
| | | {title: '操作', |
| | | templet: function (d) {
|
| | | return '<a lay-event="editCN" shiro:hasPermission="user:update">中文上传</a>'
|
| | | +'<i class="layui-icon febs-edit-area febs-blue"></i>'
|
| | | +'<a lay-event="editUS" shiro:hasPermission="user:update">英文上传</a>'
|
| | | +'<i class="layui-icon febs-edit-area febs-blue"></i>'
|
| | | +'<a lay-event="delete" shiro:hasPermission="user:update">删除</a>'
|
| | | },minWidth: 200,align:'center'}
|
| | | ]]
|
| | | });
|
| | | }
|
| | | })
|
| | | </script> |
New file |
| | |
| | | <style>
|
| | | #user-update {
|
| | | padding: 20px 25px 25px 0;
|
| | | }
|
| | |
|
| | | #user-update .layui-treeSelect .ztree li a, .ztree li span {
|
| | | margin: 0 0 2px 3px !important;
|
| | | }
|
| | | #user-update #data-permission-tree-block {
|
| | | border: 1px solid #eee;
|
| | | border-radius: 2px;
|
| | | padding: 3px 0;
|
| | | }
|
| | | #user-add .layui-treeSelect .ztree li span.button.switch {
|
| | | top: 1px;
|
| | | left: 3px;
|
| | | }
|
| | |
|
| | | </style>
|
| | | <div class="layui-fluid" id="user-update">
|
| | | <form class="layui-form" action="" lay-filter="user-update-form">
|
| | | <div class="layui-form-item febs-hide">
|
| | | <label class="layui-form-label febs-form-item-require">用户id:</label>
|
| | | <div class="layui-input-block">
|
| | | <input type="text" name="id" data-th-value="${member.id}">
|
| | | </div>
|
| | | </div>
|
| | | <div class="layui-form-item">
|
| | | <label class="layui-form-label febs-form-item-require">标题:</label>
|
| | | <div class="layui-input-block">
|
| | | <input type="text" name="title" minlength="4" maxlength="10" data-th-id="${member.title}"
|
| | | lay-verify="range|title" autocomplete="off" class="layui-input" >
|
| | | </div>
|
| | | </div>
|
| | | <div class="layui-form-item">
|
| | | <label class="layui-form-label febs-form-item-require">内容:</label>
|
| | | <div class="layui-input-block">
|
| | | <textarea id="lay_edit" lay-verify="content" name = "content" class="layui-textarea">${model.content}</textarea>
|
| | | </div>
|
| | | </div>
|
| | | <div class="layui-form-item febs-hide">
|
| | | <button class="layui-btn" lay-submit="" lay-filter="user-update-form-submit" id="submit"></button>
|
| | | |
| | | </div>
|
| | | </form>
|
| | | </div>
|
| | |
|
| | | <script data-th-inline="javascript">
|
| | | layui.use(['febs', 'form', 'formSelects', 'validate', 'treeSelect', 'eleTree', 'layedit'], function () {
|
| | | var $ = layui.$,
|
| | | febs = layui.febs,
|
| | | layer = layui.layer,
|
| | | formSelects = layui.formSelects,
|
| | | treeSelect = layui.treeSelect,
|
| | | form = layui.form,
|
| | | eleTree = layui.eleTree,
|
| | | member = [[${member}]],
|
| | | $view = $('#user-update'),
|
| | | validate = layui.validate,
|
| | | layedit = layui.layedit,
|
| | | _deptTree;
|
| | |
|
| | | form.render();
|
| | |
|
| | | initUserValue();
|
| | | |
| | | layedit.set({ //设置图片接口
|
| | | uploadImage: {
|
| | | url: 'helpCenter/uploadFileBase64', //接口url
|
| | | type: 'post',
|
| | | }
|
| | | });
|
| | | //创建一个编辑器
|
| | | var index = layedit.build('lay_edit',{
|
| | | height: 400
|
| | | });
|
| | | //提交时把值同步到文本域中
|
| | | form.verify({
|
| | | //content富文本域中的lay-verify值
|
| | | content: function(value) {
|
| | | return layedit.sync(index);
|
| | | }
|
| | | });
|
| | |
|
| | | formSelects.render();
|
| | |
|
| | | function initUserValue() {
|
| | | form.val("user-update-form", {
|
| | | "id": member.id,
|
| | | "content": member.content,
|
| | | "title": member.title
|
| | | });
|
| | | }
|
| | |
|
| | | form.on('submit(user-update-form-submit)', function (data) {
|
| | | febs.post(ctx + 'helpCenter/helpCenterConfirm', data.field, function () {
|
| | | layer.closeAll();
|
| | | febs.alert.success('设置成功');
|
| | | $('#febs-user').find('#reset').click();
|
| | | });
|
| | | return false;
|
| | | });
|
| | | });
|
| | | </script> |
New file |
| | |
| | | <style>
|
| | | #user-update {
|
| | | padding: 20px 25px 25px 0;
|
| | | }
|
| | |
|
| | | #user-update .layui-treeSelect .ztree li a, .ztree li span {
|
| | | margin: 0 0 2px 3px !important;
|
| | | }
|
| | | #user-update #data-permission-tree-block {
|
| | | border: 1px solid #eee;
|
| | | border-radius: 2px;
|
| | | padding: 3px 0;
|
| | | }
|
| | | #user-add .layui-treeSelect .ztree li span.button.switch {
|
| | | top: 1px;
|
| | | left: 3px;
|
| | | }
|
| | |
|
| | | </style>
|
| | | <div class="layui-fluid" id="user-update">
|
| | | <form class="layui-form" action="" lay-filter="user-update-form">
|
| | | <div class="layui-form-item febs-hide">
|
| | | <label class="layui-form-label febs-form-item-require">用户id:</label>
|
| | | <div class="layui-input-block">
|
| | | <input type="text" name="id" data-th-value="${member.id}">
|
| | | </div>
|
| | | </div>
|
| | | <div class="layui-form-item">
|
| | | <label class="layui-form-label febs-form-item-require">标题:</label>
|
| | | <div class="layui-input-block">
|
| | | <input type="text" name="title" minlength="4" maxlength="10" data-th-id="${member.title}"
|
| | | lay-verify="range|title" autocomplete="off" class="layui-input" >
|
| | | </div>
|
| | | </div>
|
| | | <div class="layui-form-item">
|
| | | <label class="layui-form-label febs-form-item-require">内容:</label>
|
| | | <div class="layui-input-block">
|
| | | <textarea id="lay_edit" lay-verify="content" name = "content" class="layui-textarea">${model.content}</textarea>
|
| | | </div>
|
| | | </div>
|
| | | <div class="layui-form-item febs-hide">
|
| | | <button class="layui-btn" lay-submit="" lay-filter="user-update-form-submit" id="submit"></button>
|
| | | </div>
|
| | | </form>
|
| | | </div>
|
| | |
|
| | | <script data-th-inline="javascript">
|
| | | layui.use(['febs', 'form', 'formSelects', 'validate', 'treeSelect', 'eleTree', 'layedit'], function () {
|
| | | var $ = layui.$,
|
| | | febs = layui.febs,
|
| | | layer = layui.layer,
|
| | | formSelects = layui.formSelects,
|
| | | treeSelect = layui.treeSelect,
|
| | | form = layui.form,
|
| | | eleTree = layui.eleTree,
|
| | | member = [[${member}]],
|
| | | $view = $('#user-update'),
|
| | | validate = layui.validate,
|
| | | layedit = layui.layedit,
|
| | | _deptTree;
|
| | |
|
| | | form.render();
|
| | |
|
| | | initUserValue();
|
| | | |
| | | layedit.set({ //设置图片接口
|
| | | uploadImage: {
|
| | | url: 'helpCenter/uploadFileBase64', //接口url
|
| | | type: 'post',
|
| | | }
|
| | | });
|
| | | //创建一个编辑器
|
| | | var index = layedit.build('lay_edit',{
|
| | | height: 400
|
| | | });
|
| | | //提交时把值同步到文本域中
|
| | | form.verify({
|
| | | //content富文本域中的lay-verify值
|
| | | content: function(value) {
|
| | | return layedit.sync(index);
|
| | | }
|
| | | });
|
| | |
|
| | | formSelects.render();
|
| | |
|
| | | function initUserValue() {
|
| | | form.val("user-update-form", {
|
| | | "id": member.id,
|
| | | "content": member.content,
|
| | | "title": member.title
|
| | | });
|
| | | }
|
| | |
|
| | | form.on('submit(user-update-form-submit)', function (data) {
|
| | | febs.post(ctx + 'helpCenter/helpCenterUsConfirm', data.field, function () {
|
| | | layer.closeAll();
|
| | | febs.alert.success('设置成功');
|
| | | $('#febs-user').find('#reset').click();
|
| | | });
|
| | | return false;
|
| | | });
|
| | | });
|
| | | </script> |