Commit 1d656452 authored by daniel's avatar daniel

feat(richText+module): 迁移自助服务模块

parent ff8353d7
...@@ -3,13 +3,15 @@ package com.dlbridge.jadp.plugins.cmpt.bean; ...@@ -3,13 +3,15 @@ package com.dlbridge.jadp.plugins.cmpt.bean;
import lombok.Data; import lombok.Data;
@Data @Data
public class JoyfulRichTextBean { public class RichTextBean {
// 服务类型(3:特色民宿:4:旅游景点,5:特色餐饮 6:当地特产 7: 应急避险 8: 医疗点位 9:运动产品) // 服务类型(3:特色民宿:4:旅游景点,5:特色餐饮 6:当地特产 7: 应急避险 8: 医疗点位 9:运动产品)
private String type; private String type;
// 点位类型 (1:打卡点,2:服务驿站,3:民宿:4:景点,5:餐饮) // 点位类型 (1:打卡点,2:服务驿站,3:民宿:4:景点,5:餐饮)
private String category; private String category;
private String title; private String title;
private String lng; private String lng;
// 赛事id
private Integer cmptId;
private String lat; private String lat;
private String distance; private String distance;
} }
\ No newline at end of file
package com.dlbridge.jadp.plugins.cmpt.dao.mapper;
import com.dlbridge.jadp.plugins.cmpt.dao.model.JoyfulRichText;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
* 用户积分
*
* @author LI
*/
public interface JoyfulRichTextMapper {
int insJoyfulRichText(JoyfulRichText joyfulRichText);
int updJoyfulRichText(JoyfulRichText joyfulRichText);
int delJoyfulRichText(JoyfulRichText joyfulRichText);
List<JoyfulRichText> getJoyfulRichTextById(@Param("id") String id);
List<JoyfulRichText> getJoyfulRichTextList(@Param("type") String type, @Param("title") String title,@Param("category") String category);
}
\ No newline at end of file
package com.dlbridge.jadp.plugins.cmpt.dao.mapper;
import com.dlbridge.jadp.plugins.cmpt.dao.model.JoyfunModule;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
@Mapper
public interface JoyfunModuleMapper {
int insertModule(JoyfunModule joyfunModule);
int logicDeleteModule(JoyfunModule joyfunModule);
List<JoyfunModule> selectModuleList(@Param("status") Integer status);
int updateModuleStatus(JoyfunModule joyfunModule);
int updateModuleSort(JoyfunModule joyfunModule);
JoyfunModule getModuleById(Integer moduleId);
JoyfunModule getModuleByName(String name);
int updateModule(JoyfunModule joyfunModule);
}
package com.dlbridge.jadp.plugins.cmpt.dao.mapper;
import com.dlbridge.jadp.plugins.cmpt.dao.model.Module;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
@Mapper
public interface ModuleMapper {
int add(Module module);
int delete(Module module);
List<Module> getList(@Param("status") Integer status);
int update(Module module);
int updateSort(Module module);
Module getById(Integer moduleId);
Module getByName(String name);
int updateStatus(Module module);
}
<?xml version="1.0" encoding="UTF-8" ?> <?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"> <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.dlbridge.jadp.plugins.cmpt.dao.mapper.JoyfunModuleMapper"> <mapper namespace="com.dlbridge.jadp.plugins.cmpt.dao.mapper.ModuleMapper">
<insert id="insertModule"> <insert id="add">
INSERT INTO joyfun_module ( INSERT INTO gk_module (
icon, name, sort, path, is_deleted, status, create_time, update_time icon, name, sort, path, is_deleted, status, create_time, update_time
) VALUES ( ) VALUES (
#{icon}, #{name}, #{sort}, #{path}, #{isDeleted}, #{status}, NOW(), NOW() #{icon}, #{name}, #{sort}, #{path}, #{isDeleted}, #{status}, NOW(), NOW()
...@@ -11,45 +11,45 @@ ...@@ -11,45 +11,45 @@
</insert> </insert>
<update id="logicDeleteModule"> <update id="delete">
UPDATE joyfun_module UPDATE gk_module
SET is_deleted = true SET is_deleted = true
WHERE id = #{id} WHERE id = #{id}
</update> </update>
<select id="selectModuleList" resultType="com.dlbridge.jadp.plugins.cmpt.dao.model.JoyfunModule"> <select id="getList" resultType="com.dlbridge.jadp.plugins.cmpt.dao.model.Module">
SELECT id, icon, name,path, sort, is_deleted AS isDeleted, status, create_time AS createTime, update_time AS updateTime SELECT id, icon, name,path, sort, is_deleted AS isDeleted, status, create_time AS createTime, update_time AS updateTime
FROM joyfun_module FROM gk_module
WHERE is_deleted = 0 WHERE is_deleted = 0
<if test="status!= null"> <if test="status!= null">
AND status = #{status} AND status = #{status}
</if> </if>
ORDER BY sort ASC ORDER BY sort ASC
</select> </select>
<select id="getModuleById" resultType="com.dlbridge.jadp.plugins.cmpt.dao.model.JoyfunModule"> <select id="getById" resultType="com.dlbridge.jadp.plugins.cmpt.dao.model.Module">
SELECT id, icon, name,path, sort, is_deleted AS isDeleted, status, create_time AS createTime, update_time AS updateTime SELECT id, icon, name,path, sort, is_deleted AS isDeleted, status, create_time AS createTime, update_time AS updateTime
FROM joyfun_module FROM gk_module
WHERE id = #{id} AND is_deleted = 0 WHERE id = #{id} AND is_deleted = 0
</select> </select>
<select id="getModuleByName" resultType="com.dlbridge.jadp.plugins.cmpt.dao.model.JoyfunModule"> <select id="getByName" resultType="com.dlbridge.jadp.plugins.cmpt.dao.model.Module">
SELECT id, icon, name,path, sort, is_deleted AS isDeleted, status, create_time AS createTime, update_time AS updateTime SELECT id, icon, name,path, sort, is_deleted AS isDeleted, status, create_time AS createTime, update_time AS updateTime
FROM joyfun_module FROM gk_module
WHERE name = #{name} AND is_deleted = 0 WHERE name = #{name} AND is_deleted = 0
</select> </select>
<update id="updateModuleStatus"> <update id="updateStatus">
UPDATE joyfun_module UPDATE gk_module
SET status = #{status}, update_time = NOW() SET status = #{status}, update_time = NOW()
WHERE id = #{id} WHERE id = #{id}
</update> </update>
<update id="updateModuleSort"> <update id="updateSort">
UPDATE joyfun_module UPDATE gk_module
SET sort = #{sort}, update_time = NOW() SET sort = #{sort}, update_time = NOW()
WHERE id = #{id} WHERE id = #{id}
</update> </update>
<update id="updateModule"> <update id="update">
UPDATE joyfun_module UPDATE gk_module
<set> <set>
<if test="icon != null and icon != ''"> <if test="icon != null and icon != ''">
icon = #{icon}, icon = #{icon},
......
package com.dlbridge.jadp.plugins.cmpt.dao.mapper;
import com.dlbridge.jadp.plugins.cmpt.dao.model.RichText;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
* 用户积分
*
* @author LI
*/
public interface RichTextMapper {
int add(RichText richText);
int update(RichText richText);
int delete(RichText richText);
List<RichText> getById(@Param("id") String id);
List<RichText> getPage(@Param("type") String type, @Param("title") String title, @Param("category") String category,@Param("cmptId") Integer cmptId, @Param("page") Integer page, @Param("pageSize") Integer pageSize);
}
\ No newline at end of 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.dlbridge.jadp.plugins.cmpt.dao.mapper.RichTextMapper">
<insert id="add">
INSERT INTO gksite.gk_rich_text( userId
, type
, category
, title
, address
, lng
, lat
, content
, img_url
, remark1
, remark2
, remark3
, remark4
, status
, del_flg
, create_time
, create_user
, cmpt_id)
VALUES ( #{userId}
, #{type}
, #{category}
, #{title}
, #{address}
, #{lng}
, #{lat}
, #{content}
, #{imgUrl}
, #{remark1}
, #{remark2}
, #{remark3}
, #{remark4}
, #{status}
, '0'
, now()
, #{userId}
, #{cmptId})
</insert>
<update id="update">
UPDATE
gksite.gk_rich_text
SET
userId = #{userId}
,type = #{type}
,category = #{category}
,title = #{title}
,address = #{address}
,lng = #{lng}
,lat = #{lat}
,content = #{content}
,img_url = #{imgUrl}
,remark1 = #{remark1}
,remark2 = #{remark2}
,remark3 = #{remark3}
,remark4 = #{remark4}
,status = #{status}
,update_time = now()
,update_user = #{userId}
,cmpt_id = #{cmptId}
WHERE
id = #{id}
</update>
<update id="delete">
UPDATE
gksite.gk_rich_text
SET
del_flg = '1'
,update_time = now()
,update_user = #{userId}
WHERE
id = #{id}
</update>
<select id="getById" resultType="com.dlbridge.jadp.plugins.cmpt.dao.model.RichText">
SELECT id
, userId
, cmpt_id AS cmptId
, type
, title
, address
, lng
, lat
, content
, img_url AS imgUrl
, remark1
, remark2
, remark3
, remark4
, status
, category
FROM gksite.gk_rich_text
WHERE id = #{id}
</select>
<select id="getPage" resultType="com.dlbridge.jadp.plugins.cmpt.dao.model.RichText">
SELECT
id
,title
,address
,lng
,lat
,img_url AS imgUrl
,remark1
,remark2
,remark3
,remark4
,type
,status
,category
FROM
gksite.gk_rich_text
WHERE
del_flg = '0'
<if test="type != null and type != ''">
AND type = #{type}
</if>
<if test="cmptId != null and cmptId != ''">
AND cmpt_id = #{cmptId}
</if>
<if test="title != null and title != ''">
AND title like concat('%',#{title},'%')
</if>
<if test="category != null and category != ''">
AND FIND_IN_SET(#{category}, category)
</if>
LIMIT #{pageSize} OFFSET #{page}
</select>
</mapper>
\ No newline at end of file
...@@ -6,7 +6,7 @@ import lombok.Data; ...@@ -6,7 +6,7 @@ import lombok.Data;
import java.sql.Timestamp; import java.sql.Timestamp;
@Data @Data
public class JoyfunModule { public class Module {
private Long id; private Long id;
// 图标URL // 图标URL
......
...@@ -3,23 +3,24 @@ package com.dlbridge.jadp.plugins.cmpt.dao.model; ...@@ -3,23 +3,24 @@ package com.dlbridge.jadp.plugins.cmpt.dao.model;
import lombok.Data; import lombok.Data;
@Data @Data
public class JoyfulRichText { public class RichText {
private String id; private Integer id;
private String userId; private Integer userId;
private Integer cmptId;
// 服务类型(3:特色民宿:4:旅游景点,5:特色餐饮 6:当地特产 7: 应急避险 8: 医疗点位 9:运动产品) // 服务类型(3:特色民宿:4:旅游景点,5:特色餐饮 6:当地特产 7: 应急避险 8: 医疗点位 9:运动产品)
private String type; private Integer type;
// 点位类型 (1:打卡点,2:服务驿站,3:民宿:4:景点,5:餐饮) // 点位类型 (1:打卡点,2:服务驿站,3:民宿:4:景点,5:餐饮)
private String category; private String category;
private String title; private String title;
private String address; private String address;
private String lng; private Double lng;
private String lat; private Double lat;
private String content; private String content;
private String imgUrl; private String imgUrl;
private String remark1; private String remark1;
private String remark2; private String remark2;
private String remark3; private String remark3;
private String remark4; private String remark4;
private String status; private Integer status;
private String delFlg; private Integer delFlg;
} }
\ No newline at end of file
package com.dlbridge.jadp.plugins.cmpt.service;
import com.dlbridge.jadp.plugins.cmpt.dao.mapper.JoyfunModuleMapper;
import com.dlbridge.jadp.plugins.cmpt.dao.model.JoyfunModule;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.List;
@Service
public class JoyfunModuleService {
@Resource
private JoyfunModuleMapper joyfunModuleMapper;
public int addModule(JoyfunModule joyfunModule) {
return joyfunModuleMapper.insertModule(joyfunModule);
}
public int deleteModule(JoyfunModule joyfunModule) {
return joyfunModuleMapper.logicDeleteModule(joyfunModule);
}
public List<JoyfunModule> listModules(Integer status) {
return joyfunModuleMapper.selectModuleList(status);
}
public int updateModuleStatus(JoyfunModule joyfunModule) {
return joyfunModuleMapper.updateModuleStatus(joyfunModule);
}
public int updateModuleSort(JoyfunModule joyfunModule) {
return joyfunModuleMapper.updateModuleSort(joyfunModule);
}
public JoyfunModule getModuleByName(String name) {
return joyfunModuleMapper.getModuleByName(name);
}
public JoyfunModule getModuleById(Integer id) {
return joyfunModuleMapper.getModuleById(id);
}
public int updateModule(JoyfunModule joyfunModule) {
return joyfunModuleMapper.updateModule(joyfunModule);
}
}
package com.dlbridge.jadp.plugins.cmpt.service;
import com.dlbridge.jadp.plugins.cmpt.dao.mapper.ModuleMapper;
import com.dlbridge.jadp.plugins.cmpt.dao.model.Module;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.List;
@Service
public class ModuleService {
@Resource
private ModuleMapper moduleMapper;
public int addModule(Module module) {
return moduleMapper.add(module);
}
public int deleteModule(Module module) {
return moduleMapper.delete(module);
}
public List<Module> listModules(Integer status) {
return moduleMapper.getList(status);
}
public int updateModuleStatus(Module module) {
return moduleMapper.updateStatus(module);
}
public int updateModuleSort(Module module) {
return moduleMapper.updateSort(module);
}
public Module getModuleByName(String name) {
return moduleMapper.getByName(name);
}
public Module getModuleById(Integer id) {
return moduleMapper.getById(id);
}
public int updateModule(Module module) {
return moduleMapper.update(module);
}
}
package com.dlbridge.jadp.plugins.cmpt.service; package com.dlbridge.jadp.plugins.cmpt.service;
import com.dlbridge.jadp.plugins.cmpt.bean.JoyfulRichTextBean; import com.dlbridge.jadp.plugins.cmpt.bean.RichTextBean;
import com.dlbridge.jadp.plugins.cmpt.dao.mapper.JoyfulRichTextMapper; import com.dlbridge.jadp.plugins.cmpt.dao.mapper.RichTextMapper;
import com.dlbridge.jadp.plugins.cmpt.dao.model.JoyfulRichText; import com.dlbridge.jadp.plugins.cmpt.dao.model.RichText;
import com.dlbridge.jadp.plugins.cmpt.utils.GpsUtil; import com.dlbridge.jadp.plugins.cmpt.utils.GpsUtil;
import com.dlbridge.jadp.plugins.cmpt.utils.QRCodeUtil; import com.dlbridge.jadp.plugins.cmpt.utils.QRCodeUtil;
import com.google.gson.Gson; import com.google.gson.Gson;
...@@ -25,40 +25,40 @@ import java.util.stream.Collectors; ...@@ -25,40 +25,40 @@ import java.util.stream.Collectors;
* @author LI * @author LI
*/ */
@Service @Service
public class JoyfulRichTextService { public class RichTextService {
private static final Logger log = LoggerFactory.getLogger(JoyfulRichTextService.class); private static final Logger log = LoggerFactory.getLogger(RichTextService.class);
@Resource @Resource
JoyfulRichTextMapper joyfulRichTextMapper; RichTextMapper richTextMapper;
/** /**
* 悦行冬奥路富文本表 追加 * 悦行冬奥路富文本表 追加
* *
* @param joyfulRichText * @param RichText
* @return * @return
*/ */
public int insJoyfulRichText(JoyfulRichText joyfulRichText) { public int add(RichText RichText) {
return joyfulRichTextMapper.insJoyfulRichText(joyfulRichText); return richTextMapper.add(RichText);
} }
/** /**
* 悦行冬奥路富文本表 修改 * 悦行冬奥路富文本表 修改
* *
* @param joyfulRichText * @param RichText
* @return * @return
*/ */
public int updJoyfulRichText(JoyfulRichText joyfulRichText) { public int update(RichText RichText) {
return joyfulRichTextMapper.updJoyfulRichText(joyfulRichText); return richTextMapper.update(RichText);
} }
/** /**
* 悦行冬奥路富文本表 逻辑删除 * 悦行冬奥路富文本表 逻辑删除
* *
* @param joyfulRichText * @param RichText
* @return * @return
*/ */
public int delJoyfulRichText(JoyfulRichText joyfulRichText) { public int delete(RichText RichText) {
return joyfulRichTextMapper.delJoyfulRichText(joyfulRichText); return richTextMapper.delete(RichText);
} }
/** /**
...@@ -67,26 +67,26 @@ public class JoyfulRichTextService { ...@@ -67,26 +67,26 @@ public class JoyfulRichTextService {
* @param id * @param id
* @return * @return
*/ */
public JoyfulRichText getJoyfulRichText(String id) { public RichText detail(String id) {
List<JoyfulRichText> joyfulRichTextList = joyfulRichTextMapper.getJoyfulRichTextById(id); List<RichText> RichTextList = richTextMapper.getById(id);
if (joyfulRichTextList.isEmpty()) { if (RichTextList.isEmpty()) {
return null; return null;
} }
return joyfulRichTextList.get(0); return RichTextList.get(0);
} }
/** /**
* 悦行冬奥路富文本表 条件检索 * 悦行冬奥路富文本表 条件检索
* *
* @param joyfulRichTextBean * @param richTextBean
* @return * @return
*/ */
public List<JoyfulRichText> getJoyfulRichTextList(JoyfulRichTextBean joyfulRichTextBean) { public List<RichText> getPage(RichTextBean richTextBean, int page, int pageSize) {
List<JoyfulRichText> joyfulRichTextList = joyfulRichTextMapper.getJoyfulRichTextList(joyfulRichTextBean.getType(), joyfulRichTextBean.getTitle(),joyfulRichTextBean.getCategory()); List<RichText> RichTextList = richTextMapper.getPage(richTextBean.getType(), richTextBean.getTitle(),richTextBean.getCategory(),richTextBean.getCmptId(),page,pageSize);
if (StringUtils.isNotBlank(joyfulRichTextBean.getDistance())) { if (StringUtils.isNotBlank(richTextBean.getDistance())) {
joyfulRichTextList = joyfulRichTextList.stream().filter(model -> this.notGtDistance(model, joyfulRichTextBean)).collect(Collectors.toList()); RichTextList = RichTextList.stream().filter(model -> this.notGtDistance(model, richTextBean)).collect(Collectors.toList());
} }
return joyfulRichTextList; return RichTextList;
} }
/** /**
...@@ -95,7 +95,7 @@ public class JoyfulRichTextService { ...@@ -95,7 +95,7 @@ public class JoyfulRichTextService {
* @param id * @param id
* @return * @return
*/ */
public BufferedImage getJoyfulRichTextQrCode(int id) { public BufferedImage getQrCode(int id) {
Map<String, Integer> map = new HashMap(); Map<String, Integer> map = new HashMap();
map.put("id", id); map.put("id", id);
Gson gson = new Gson(); Gson gson = new Gson();
...@@ -103,8 +103,8 @@ public class JoyfulRichTextService { ...@@ -103,8 +103,8 @@ public class JoyfulRichTextService {
return QRCodeUtil.getBufferedImage(null, json); return QRCodeUtil.getBufferedImage(null, json);
} }
private boolean notGtDistance(JoyfulRichText model, JoyfulRichTextBean bean) { private boolean notGtDistance(RichText model, RichTextBean bean) {
double distance = GpsUtil.getDistance(Double.parseDouble(model.getLat()), Double.parseDouble(model.getLng()), Double.parseDouble(bean.getLat()), Double.parseDouble(bean.getLng())); double distance = GpsUtil.getDistance(model.getLat(), model.getLng(), Double.parseDouble(bean.getLat()), Double.parseDouble(bean.getLng()));
return distance <= Double.parseDouble(bean.getDistance()) * 1000.0; return distance <= Double.parseDouble(bean.getDistance()) * 1000.0;
} }
......
package com.dlbridge.jadp.plugins.cmpt.web;
import com.dlbridge.jadp.plugins.cmpt.dao.model.Module;
import com.dlbridge.jadp.plugins.cmpt.service.ModuleService;
import com.neusoft.www.utils.web.Result;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiSort;
import lombok.extern.log4j.Log4j2;
import org.apache.commons.lang3.StringUtils;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import java.util.List;
@Log4j2
@RestController
@RequestMapping(value = "gk/module")
@Api(value = "自助服务模块", tags = "自助服务模块")
@ApiSort(10)
public class ModuleController {
@Resource
private ModuleService moduleService;
//-------------------------自助服务模块-----------------------
@PostMapping("/add")
@ApiOperation(value = "新增服务模块", notes = "新增一个新的服务模块")
public Result addModule(@RequestBody Module module) {
// 判断内容
if (StringUtils.isBlank(module.getName())) {
return Result.fail().setMsg("服务模块名称不能为空!");
}
if (StringUtils.isBlank(module.getIcon())) {
return Result.fail().setMsg("服务模块图标不能为空!");
}
if (StringUtils.isBlank(module.getIcon())) {
return Result.fail().setMsg("服务模块图标不能为空!");
}
Module exitModule = moduleService.getModuleByName(module.getName());
if(exitModule != null){
return Result.fail().setMsg("服务模块已存在!");
}
int result = moduleService.addModule(module);
if (result != 1) {
return Result.fail().setMsg("新增失败!");
}
return Result.success().setMsg("新增成功。");
}
@PostMapping("/update")
@ApiOperation(value = "更新服务模块", notes = "更新服务模块")
public Result updateModule(@RequestBody Module module) {
// 判断内容
if (StringUtils.isBlank(module.getName())) {
return Result.fail().setMsg("服务模块名称不能为空!");
}
if (StringUtils.isBlank(module.getIcon())) {
return Result.fail().setMsg("服务模块图标不能为空!");
}
if (StringUtils.isBlank(module.getPath())) {
return Result.fail().setMsg("跳转路径不能为空!");
}
int result = moduleService.updateModule(module);
if (result != 1) {
return Result.fail().setMsg("更新失败!");
}
return Result.success().setMsg("更新成功。");
}
@PostMapping("/delete")
@ApiOperation(value = "逻辑删除服务模块", notes = "逻辑删除一个服务模块")
public Result deleteModule(@RequestBody Module module) {
int result = moduleService.deleteModule(module);
if (result != 1) {
return Result.fail().setMsg("删除失败!");
}
return Result.success().setMsg("删除成功。");
}
@GetMapping("/detail/{id}")
@ApiOperation(value = "获取服务模块详情", notes = "获取服务模块详情")
public Result getModule(@PathVariable("id") Integer id) {
Module data = moduleService.getModuleById(id);
return Result.success().setContent(data);
}
@GetMapping("/list")
@ApiOperation(value = "获取服务模块列表", notes = "获取所有服务模块列表")
public Result<List<Module>> listModules(@RequestParam(value = "status", required = false) Integer status) {
List<Module> serviceModules = moduleService.listModules(status);
return Result.success().setContent(serviceModules);
}
@PostMapping("/updateStatus")
@ApiOperation(value = "修改服务模块状态", notes = "修改服务模块的状态")
public Result updateModuleStatus(@RequestBody Module module) {
int result = moduleService.updateModuleStatus(module);
if (result != 1) {
return Result.fail().setMsg("状态修改失败!");
}
return Result.success().setMsg("状态修改成功。");
}
@PostMapping("/updateSort")
@ApiOperation(value = "更新服务模块排序", notes = "更新服务模块的排序序号")
public Result updateModuleSort(@RequestBody Module module) {
int result = moduleService.updateModuleSort(module);
if (result != 1) {
return Result.fail().setMsg("排序更新失败!");
}
return Result.success().setMsg("排序更新成功。");
}
}
package com.dlbridge.jadp.plugins.cmpt.web;
import com.dlbridge.jadp.plugins.cmpt.bean.RichTextBean;
import com.dlbridge.jadp.plugins.cmpt.dao.model.RichText;
import com.dlbridge.jadp.plugins.cmpt.service.RichTextService;
import com.neusoft.www.utils.web.Result;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiSort;
import lombok.extern.log4j.Log4j2;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import javax.imageio.ImageIO;
import javax.servlet.http.HttpServletResponse;
import java.awt.image.BufferedImage;
import java.io.IOException;
import java.io.OutputStream;
import java.util.List;
@Log4j2
@RestController
@RequestMapping(value = "gk/richText")
@Api(value = "自助服务详情", tags = "自助服务详情")
@ApiSort(10)
public class RichTextController {
@Resource
private RichTextService richTextService;
@PostMapping(value = "/add")
@ApiOperation(value = "自助服务管理新增", notes = "自助服务管理新增", tags = "自助服务管理新增")
public Result addRichText(@RequestBody RichText richText) {
int result = richTextService.add(richText);
if (result != 1) {
return Result.fail().setMsg("新增失败!");
}
return Result.success().setMsg("新增成功。");
}
@PostMapping(value = "/update")
@ApiOperation(value = "自助服务管理修改", notes = "自助服务管理修改", tags = "自助服务管理修改")
public Result updateRichText(@RequestBody RichText richText) {
int result = richTextService.update(richText);
if (result != 1) {
return Result.fail().setMsg("修改失败!");
}
return Result.success().setMsg("修改成功。");
}
@PostMapping(value = "/delete")
@ApiOperation(value = "自助服务管理删除", notes = "自助服务管理删除", tags = "自助服务管理删除")
public Result deleteRichText(@RequestBody RichText richText) {
int result = richTextService.delete(richText);
if (result != 1) {
return Result.fail().setMsg("删除失败!");
}
return Result.success().setMsg("删除成功。");
}
@GetMapping(value = "/detail/{id}")
@ApiOperation(value = "自助服务管理主键检索", notes = "自助服务管理主键检索", tags = "自助服务管理主键检索")
public Result<RichText> getRichText(@PathVariable("id") String id) {
RichText richText = richTextService.detail(id);
if (richText == null) {
return Result.fail().setMsg("数据不存在。");
}
return Result.success().setContent(richText);
}
@PostMapping(value = "/page/{page}/{pageSize}")
@ApiOperation(value = "自助服务管理条件检索", notes = "自助服务管理条件检索", tags = "自助服务管理条件检索")
public Result<List<RichText>> getRichTextList(@RequestBody RichTextBean richTextBean, @PathVariable("page") int page, @PathVariable("pageSize") int pageSize) {
List<RichText> richTextList = richTextService.getPage(richTextBean,page-1,pageSize);
//int fromIndex = pointService.getOffset(pageNo, pageCount);
//richTextList = JoyfulRichTextService.subList(richTextList, fromIndex, fromIndex + pageCount);
return Result.success().setContent(richTextList);
}
@GetMapping(value = "/qrCode/{id}")
@ApiOperation(value = "生成签到二维码", notes = "生成签到二维码", tags = "生成签到二维码")
public void getRichTextQrCode(@PathVariable("id") int id, HttpServletResponse response) {
log.info("Generating QR Code for ID: " + id);
response.setContentType("image/png");
response.setHeader("Pragma", "no-cache");
response.setHeader("Cache-Control", "no-cache");
response.setDateHeader("Expires", 0);
try (OutputStream os = response.getOutputStream()) {
BufferedImage buffImg = richTextService.getQrCode(id);
ImageIO.write(buffImg, "png", os);
} catch (IOException e) {
log.error("Error generating QR Code: " + e.getMessage(), e);
}
}
}
<%@ page language="java" contentType="text/html; charset=utf-8" pageEncoding="utf-8" %> <%@ page language="java" contentType="text/html; charset=utf-8" pageEncoding="utf-8" %>
<%@ include file="/WEB-INF/views/include/taglib.jsp" %> <%@ include file="/WEB-INF/views/include/taglib.jsp" %>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %> <%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %> <%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<!doctype html> <!doctype html>
<html> <html>
<head> <head>
<title>自助服务模块</title> <title>自助服务模块</title>
<!-- Bootstrap CSS--> <!-- Bootstrap CSS-->
<link rel="stylesheet" href="${ctxStatic}/newdermon/vendor/bootstrap/css/bootstrap.min.css"> <link rel="stylesheet" href="${ctxStatic}/newdermon/vendor/bootstrap/css/bootstrap.min.css">
<!-- Font Awesome CSS--> <!-- Font Awesome CSS-->
<link rel="stylesheet" <link rel="stylesheet"
href="${ctxStatic}/newdermon/vendor/font-awesome/css/font-awesome.min.css"> href="${ctxStatic}/newdermon/vendor/font-awesome/css/font-awesome.min.css">
<!-- Fontastic Custom icon font--> <!-- Fontastic Custom icon font-->
<link rel="stylesheet" href="${ctxStatic}/newdermon/css/fontastic.css"> <link rel="stylesheet" href="${ctxStatic}/newdermon/css/fontastic.css">
<!-- Google fonts - Poppins --> <!-- Google fonts - Poppins -->
<link rel="stylesheet" href="${ctxStatic}/newdermon/css/font-css.css"> <link rel="stylesheet" href="${ctxStatic}/newdermon/css/font-css.css">
<!-- theme stylesheet--> <!-- theme stylesheet-->
<link rel="stylesheet" <link rel="stylesheet"
href="${ctxStatic}/newdermon/css/style.default.css?v=<%=System.currentTimeMillis()%>" href="${ctxStatic}/newdermon/css/style.default.css?v=<%=System.currentTimeMillis()%>"
id="theme-stylesheet"> id="theme-stylesheet">
<!-- Custom stylesheet - for your changes--> <!-- Custom stylesheet - for your changes-->
<link rel="stylesheet" <link rel="stylesheet"
href="${ctxStatic}/newdermon/css/custom.css?v=<%=System.currentTimeMillis()%>"> href="${ctxStatic}/newdermon/css/custom.css?v=<%=System.currentTimeMillis()%>">
<link rel="stylesheet" href="${ctxStatic}/newdermon/css/juery-ui-1.12.css"> <link rel="stylesheet" href="${ctxStatic}/newdermon/css/juery-ui-1.12.css">
<!-- Favicon--> <!-- Favicon-->
<link rel="shortcut icon" href="https://img.geexek.com/files/home/favicon.ico"> <link rel="shortcut icon" href="https://img.geexek.com/files/home/favicon.ico">
<link rel="stylesheet" <link rel="stylesheet"
href="${ctxStatic}/newdermon/css/custom.css?v=<%=System.currentTimeMillis()%>"> href="${ctxStatic}/newdermon/css/custom.css?v=<%=System.currentTimeMillis()%>">
<link rel="stylesheet" <link rel="stylesheet"
href="${ctxStatic}/newdermon/css/main.css?v=<%=System.currentTimeMillis()%>"> href="${ctxStatic}/newdermon/css/main.css?v=<%=System.currentTimeMillis()%>">
<link rel="stylesheet" href="${ctxStatic}/cmpt/setting.css?v=<%=System.currentTimeMillis()%>"> <link rel="stylesheet" href="${ctxStatic}/cmpt/setting.css?v=<%=System.currentTimeMillis()%>">
<link rel="stylesheet" <link rel="stylesheet"
href="${ctxStatic}/leaflet/css/leaflet.css?v=<%=System.currentTimeMillis()%>" /> href="${ctxStatic}/leaflet/css/leaflet.css?v=<%=System.currentTimeMillis()%>" />
<link rel="stylesheet" href="${ctxStatic}/leaflet/css/leaflet_label.css" /> <link rel="stylesheet" href="${ctxStatic}/leaflet/css/leaflet_label.css" />
<script src="${ctxStatic}/My97DatePicker/WdatePicker.js" type="text/javascript"></script> <script src="${ctxStatic}/My97DatePicker/WdatePicker.js" type="text/javascript"></script>
<script src="${ctxStatic}/newdermon/vendor/jquery/jquery.min.js"></script> <script src="${ctxStatic}/newdermon/vendor/jquery/jquery.min.js"></script>
<script type="text/javascript" charset="utf-8" src="${ctxStatic}/layer/layer.js"></script> <script type="text/javascript" charset="utf-8" src="${ctxStatic}/layer/layer.js"></script>
<link rel="stylesheet" href="${ctxStatic}/layer/skin/layer.css"> <link rel="stylesheet" href="${ctxStatic}/layer/skin/layer.css">
<link rel="stylesheet" href="/static/cmpt/score.css?<%=System.currentTimeMillis()%>"> <link rel="stylesheet" href="/static/cmpt/score.css?<%=System.currentTimeMillis()%>">
<style> <style>
.action { .action {
display: flex; display: flex;
flex-direction: row; flex-direction: row;
align-items: center; align-items: center;
justify-content: space-around; justify-content: space-around;
} }
.action div { .action div {
display: flex; display: flex;
flex-direction: row; flex-direction: row;
align-items: center; align-items: center;
justify-content: center; justify-content: center;
user-select: none; user-select: none;
} }
.submit { .submit {
display: inline-block; display: inline-block;
width: 120px; width: 120px;
height: 45px; height: 45px;
text-align: center; text-align: center;
line-height: 45px; line-height: 45px;
color: white; color: white;
background: #ce3939; background: #ce3939;
border-radius: 4px; border-radius: 4px;
letter-spacing: 1px; letter-spacing: 1px;
cursor: pointer; cursor: pointer;
font-size: 16px; font-size: 16px;
} }
.cancel { .cancel {
width: 120px; width: 120px;
height: 45px; height: 45px;
background: #949494; background: #949494;
border-radius: 4px; border-radius: 4px;
font-size: 16px; font-size: 16px;
color: #FFFFFF; color: #FFFFFF;
line-height: 45px; line-height: 45px;
text-align: center; text-align: center;
margin-right: 20px; margin-right: 20px;
} }
.input { .input {
width: 100%; width: 100%;
height: 40px !important; height: 40px !important;
line-height: 40px !important; line-height: 40px !important;
; ;
border: 2px solid #F4F4F4; border: 2px solid #F4F4F4;
border-radius: 4px; border-radius: 4px;
margin-right: 30px; margin-right: 30px;
margin-left: 0px; margin-left: 0px;
padding-left: 12px; padding-left: 12px;
background: rgba(247, 247, 247, 1); background: rgba(247, 247, 247, 1);
border-radius: 4px; border-radius: 4px;
border: 1px solid rgba(229, 229, 229, 1); border: 1px solid rgba(229, 229, 229, 1);
} }
.title { .title {
font-size: 24px; font-size: 24px;
font-weight: 500; font-weight: 500;
color: rgba(51, 51, 51, 1); color: rgba(51, 51, 51, 1);
} }
.title-new { .title-new {
font-size: 20px; font-size: 20px;
color: rgba(51, 51, 51, 1); color: rgba(51, 51, 51, 1);
margin-right: 15px; margin-right: 15px;
margin-bottom: 15px; margin-bottom: 15px;
width: auto; width: auto;
} }
.section { .section {
display: flex; display: flex;
background: rgba(255, 255, 255, 1); background: rgba(255, 255, 255, 1);
border-radius: 4px; border-radius: 4px;
flex-direction: column; flex-direction: column;
} }
.func { .func {
display: flex; display: flex;
flex-direction: column; flex-direction: column;
/* height: 90px; */ /* height: 90px; */
padding: 5px 0; padding: 5px 0;
} }
.tip { .tip {
font-size: 16px; font-size: 16px;
color: rgba(51, 51, 51, 1); color: rgba(51, 51, 51, 1);
position: absolute; position: absolute;
right: 45px; right: 45px;
top: 10px; top: 10px;
} }
.road-notice {
top: 16px;
height: 15px; .saveDiv {
width: 15px; display: flex;
} justify-content: flex-end;
margin: 0 20px;
.road-notice-txt { padding-top: 10px;
color: rgb(206, 57, 57); }
font-size: 16px;
width: 430px; label {
display: inline-block; /* width: auto; */
} /* width: 200px; */
display: flex;
.saveDiv { flex-direction: row;
display: flex; align-items: center;
justify-content: flex-end; }
margin: 0 20px;
padding-top: 10px;
} .label-box {
display: flex;
label { flex-direction: row;
/* width: auto; */ align-items: center;
/* width: 200px; */ }
display: flex;
flex-direction: row; .dialog input {
align-items: center; width: 50vw !important;
} }
.dialog label input {
.label-box { width: 20px !important;
display: flex; height: 20px !important;
flex-direction: row; margin: 0 10px !important;
align-items: center; }
}
.cover {
.dialog input { width: 100%;
width: 50vw !important; height: 100px;
} background: rgba(247, 247, 247, 1);
border-radius: 4px;
.dialog label input { border: 1px solid rgba(238, 238, 238, 1);
width: 20px !important; display: flex;
height: 20px !important; justify-content: center;
margin: 0 10px !important; align-items: center;
}
}
.cover {
width: 100%; .cover-img {
height: 100px; width: 300px;
background: rgba(247, 247, 247, 1); cursor: pointer;
border-radius: 4px; background-repeat: no-repeat;
border: 1px solid rgba(238, 238, 238, 1); background-position: center;
display: flex; background-size: cover;
justify-content: center; height: 300px;
align-items: center; }
} .icon-cover {
width: 34px;
.cover-img { height: 34px;
width: 300px; background-image: url("/static/images/icon_cover.png");
cursor: pointer; background-size: 100%;
background-repeat: no-repeat; background-repeat: no-repeat;
background-position: center; }
background-size: cover;
height: 300px; .section {
} width: 100% !important;
display: flex;
.icon-cover { flex-direction: column;
width: 34px; }
height: 34px;
background-image: url("/static/images/icon_cover.png"); .section-box {
background-size: 100%; width: 100% !important;
background-repeat: no-repeat; display: flex;
} flex-direction: row;
align-items: center;
.section { }
width: 100% !important;
display: flex; .rule-field tbody tr td:first-child {
flex-direction: column; padding-left: 0 !important;
} height: auto !important;
}
.section-box {
width: 100% !important; tbody tr td {
display: flex; font-size: 15px !important;
flex-direction: row; }
align-items: center;
} input[type=checkbox]::before {
border: none !important;
.rule-field tbody tr td:first-child { background: none !important;
padding-left: 0 !important; }
height: auto !important;
} input[type=checkbox]:checked::before {
border: none !important;
tbody tr td { background: none !important;
font-size: 15px !important; }
}
input[type=checkbox] {
input[type=checkbox]::before { top: 0;
border: none !important; left: 0;
background: none !important; }
} </style>
</head>
input[type=checkbox]:checked::before {
border: none !important; <body>
background: none !important; <jsp:include page="../common/header.jsp"></jsp:include>
} <div class="page-content d-flex align-items-stretch main-body">
<jsp:include page="../common/menu.jsp"></jsp:include>
input[type=checkbox] { <div class="rght" id="module">
top: 0; <div class="section">
left: 0; <div>
} <h3 class="title">服务模块</h3>
</style> <div class="add-btn" @click="addModule">
</head> <span>+</span>
<span>添加服务模块</span>
<body> </div>
<jsp:include page="../common/header.jsp"></jsp:include> </div>
<div class="page-content d-flex align-items-stretch main-body"> </div>
<jsp:include page="../common/menu.jsp"></jsp:include> <div style="margin-top: -10px;margin-bottom: 50px">
<div class="rght" id="module"> <table style="width: 100%" class="rule-field">
<div class="section"> <colgroup>
<div> <col style="width:15%;">
<h3 class="title">服务模块</h3> <col style="width:20%;">
<div class="add-btn" @click="addModule"> <col style="width:10%;">
<span>+</span> <col style="width:20%;">
<span>添加服务模块</span> <col style="width:10%;">
</div> <col style="width:20%;">
</div> </colgroup>
</div> <thead>
<div style="margin-top: -10px;margin-bottom: 50px"> <tr>
<table style="width: 100%" class="rule-field"> <th style="text-align: center">图标</th>
<colgroup> <th style="text-align: left">模块名</th>
<col style="width:15%;"> <th style="text-align: left">排序</th>
<col style="width:20%;"> <th style="text-align: left">路径</th>
<col style="width:10%;"> <th style="text-align: center">状态</th>
<col style="width:20%;"> <th style="text-align: center">操作</th>
<col style="width:10%;"> </tr>
<col style="width:20%;"> </thead>
</colgroup> <tbody>
<thead> <tr v-if="" v-for="item in list" :data-id="item.id">
<tr> <td style="text-align: center">
<th style="text-align: center">图标</th> <img :src="item.icon" style="width:80px;height:80px;" />
<th style="text-align: left">模块名</th> </td>
<th style="text-align: left">排序</th>
<th style="text-align: left">路径</th> <td class="name" style="text-align: left;">
<th style="text-align: center">状态</th> <span v-text="item.name"></span>
<th style="text-align: center">操作</th> </td>
</tr> <td class="name" style="text-align: left;">
</thead> <span v-text="item.sort"></span>
<tbody> </td>
<tr v-if="" v-for="item in list" :data-id="item.id"> <td class="name" style="text-align: left;">
<td style="text-align: center"> <span v-text="item.path"></span>
<img :src="item.icon" style="width:80px;height:80px;" /> </td>
</td>
<td style="text-align: center">
<td class="name" style="text-align: left;">
<span v-text="item.name"></span>
</td>
<td class="name" style="text-align: left;">
<span v-text="item.sort"></span>
</td>
<td class="name" style="text-align: left;">
<span v-text="item.path"></span>
</td>
<td style="text-align: center">
<span class="badge badge-pill" <span class="badge badge-pill"
:class="[item.status==1?'badge-success':'badge-danger']" :class="[item.status==1?'badge-success':'badge-danger']"
v-text="statusType[item.status]"> v-text="statusType[item.status]">
</span> </span>
</td> </td>
<td style="text-align: center"> <td style="text-align: center">
<div class="action"> <div class="action">
<div class="opt edit.opt" @click="showEdit(item.id)"> <div class="opt edit.opt" @click="showEdit(item.id)">
<span class="icon-edit"></span> <span class="icon-edit"></span>
<span class="edit"> <span class="edit">
编辑 编辑
</span> </span>
</div> </div>
<div class="opt del" @click="delModule(item)"> <div class="opt del" @click="delModule(item)">
<span class="icon-del"></span> <span class="icon-del"></span>
<span class="del"> <span class="del">
删除 删除
</span> </span>
</div> </div>
</div> </div>
</td> </td>
</tr> </tr>
</tbody> </tbody>
</table> </table>
</div> </div>
<div class="dialog" v-show="dialog" style="width:40vw;height: 80vh; z-index: 99;display: flex;flex-direction: column;left: 50%; <div class="dialog" v-show="dialog" style="width:40vw;height: 80vh; z-index: 99;display: flex;flex-direction: column;left: 50%;
transform: translateX(-50%);margin-left:0;"> transform: translateX(-50%);margin-left:0;">
<div> <div>
<span class="title" style="margin-bottom: 10px; color: #CE3939">{{title}}</span> <span class="title" style="margin-bottom: 10px; color: #CE3939">{{title}}</span>
</div> </div>
<div style="display: flex;flex-direction: column;flex:1;overflow-y: auto;"> <div style="display: flex;flex-direction: column;flex:1;overflow-y: auto;">
<div class="func"> <div class="func">
<div> <div>
<span class="title-new">模块名称</span> <span class="title-new">模块名称</span>
</div> </div>
<div> <div>
<input class="input" type="text" v-model="module.name" <input class="input" type="text" v-model="module.name"
placeholder="请输入功能名称,最多五个字符"> placeholder="请输入功能名称,最多五个字符">
</div> </div>
</div> </div>
<div class="func"> <div class="func">
<div> <div>
<span class="title-new">跳转地址</span> <span class="title-new">跳转地址</span>
</div> </div>
<div> <div>
<input class="input" type="text" v-model="module.path" <input class="input" type="text" v-model="module.path"
placeholder="请输入跳转路径"> placeholder="请输入跳转路径">
</div> </div>
</div> </div>
<div class="func"> <div class="func">
<div> <div>
<span class="title-new">排序(越小越靠前)</span> <span class="title-new">排序(越小越靠前)</span>
</div> </div>
<div> <div>
<input class="input" type="number" v-model="module.sort" <input class="input" type="number" v-model="module.sort"
placeholder="请输入排序"> placeholder="请输入排序">
</div> </div>
</div> </div>
<div class="func"> <div class="func">
<span class="title-new">服务模块封面</span> <span class="title-new">服务模块封面</span>
<span style="font-size: 16px;color: #ce3939;margin:10px 0;"> <span style="font-size: 16px;color: #ce3939;margin:10px 0;">
<span <span
style="font-size: 12px;display: inline-block;border-radius: 50%;height: 18px;width: 18px;background: #ce3939;color: white;text-align: center;">注</span> style="font-size: 12px;display: inline-block;border-radius: 50%;height: 18px;width: 18px;background: #ce3939;color: white;text-align: center;">注</span>
<span style="display: inline">建议分辨率500*500</span> <span style="display: inline">建议分辨率500*500</span>
</span> </span>
<div> <div>
<label for="file"> <label for="file">
<div v-if="!module.icon" class="cover"> <div v-if="!module.icon" class="cover">
<span class="icon-cover"></span> <span class="icon-cover"></span>
</div>
<img v-else class="cover cover-img" :src="module.icon" />
</label>
<input id="file" type="file" style="display: none" @change="uploadFile">
</div>
</div>
<!-- 状态 (status) -->
<div class="func">
<span class="title-new">状态</span>
<div class="label-box">
<label>
<input type="radio" v-model="module.status" value="0"> 关闭
</label>
<label>
<input type="radio" v-model="module.status" value="1"> 开启
</label>
</div>
</div>
</div>
<div class="saveDiv">
<span @click="cancel" class="cancel">取消</span>
<span @click="submit" class="submit">保存</span>
</div>
</div>
<div v-show="dialog"
style="position: fixed;height: 100%;width: 100%;background: black;z-index: 10;opacity: 0.5;top:0px;left:0px">
</div>
</div> </div>
<script src="${ctxStatic}/vue/vue.js"></script> <img v-else class="cover cover-img" :src="module.icon" />
<script> </label>
var app = new Vue({ <input id="file" type="file" style="display: none" @change="uploadFile">
el: '#module', </div>
data: { </div>
list: [], <!-- 状态 (status) -->
dialog: false, <div class="func">
title: '新增服务模块', <span class="title-new">状态</span>
module: { <div class="label-box">
"id": null, <label>
"name": null, <input type="radio" v-model="module.status" value="0"> 关闭
"sort": 10, </label>
"path": null, <label>
"icon": null, <input type="radio" v-model="module.status" value="1"> 开启
"status": 1, // 状态(0:关闭 1:开启) </label>
"isDeleted": 0 // 删除状态(0:未删除 1:已删除) </div>
}, </div>
statusType: { </div>
0: '关闭', <div class="saveDiv">
1: '开启' <span @click="cancel" class="cancel">取消</span>
} <span @click="submit" class="submit">保存</span>
}, </div>
methods: { </div>
// 展示dialog <div v-show="dialog"
addModule() { style="position: fixed;height: 100%;width: 100%;background: black;z-index: 10;opacity: 0.5;top:0px;left:0px">
this.dialog = !this.dialog;
this.resetForm(); </div>
}, </div>
changePage(page) { <script src="${ctxStatic}/vue/vue.js"></script>
this.page = page <script>
this.queryAll() var app = new Vue({
}, el: '#module',
changeType(index) { data: {
this.page = 1 list: [],
this.typeIndex = index dialog: false,
this.queryAll() title: '新增服务模块',
}, module: {
next() { "id": null,
this.page += 1 "name": null,
this.queryAll() "sort": 10,
}, "path": null,
preview() { "icon": null,
this.page -= 1 "status": 1, // 状态(0:关闭 1:开启)
this.queryAll() "isDeleted": 0 // 删除状态(0:未删除 1:已删除)
}, },
// 重置表单 statusType: {
resetForm() { 0: '关闭',
this.module = { 1: '开启'
"id": null, }
"name": null, },
"icon": null, methods: {
"path": null, // 展示dialog
"sort":10, addModule() {
"status": 1, // 状态(0:关闭 1:开启) this.dialog = !this.dialog;
"isDeleted": 0 // 删除状态(0:未删除 1:已删除) this.resetForm();
}; },
}, changePage(page) {
// 编辑 this.page = page
showEdit(id) { this.queryAll()
this.getDetail(id); },
}, changeType(index) {
// 删除 this.page = 1
delModule(data) { this.typeIndex = index
layer.confirm("确认要删除吗?", function () { this.queryAll()
$.ajax({ },
url: '/api/joyfulRoad/delModule', next() {
data: JSON.stringify(data), // 将 data 转换为 JSON 字符串 this.page += 1
type: 'post', this.queryAll()
contentType: 'application/json', },
beforeSend: () => { preview() {
layer.load() this.page -= 1
}, this.queryAll()
success: () => { },
layer.msg('删除成功!'); // 重置表单
}, resetForm() {
complete: () => { this.module = {
layer.closeAll() "id": null,
app.queryAll(); "name": null,
} "icon": null,
}); "path": null,
}); "sort": 10,
}, "status": 1, // 状态(0:关闭 1:开启)
// 保存 "isDeleted": 0 // 删除状态(0:未删除 1:已删除)
submit() { };
const module = { ...this.module,status:Number(this.module.status),sort:Number(this.module.sort) } },
// 假设 service 对象已经定义并初始化 // 编辑
if (!module.icon) { showEdit(id) {
layer.msg("图标图片!", { icon: 5, duration: 1500 }); this.getDetail(id);
return; },
} // 删除
delModule(data) {
if (!module.name) { layer.confirm("确认要删除吗?", function () {
layer.msg("模块标题不能为空!", { icon: 5, duration: 1500 }); $.ajax({
return; url: '/gk/module/delete',
} data: JSON.stringify(data), // 将 data 转换为 JSON 字符串
if (!module.path) { type: 'post',
layer.msg("跳转路径不能为空!", { icon: 5, duration: 1500 }); contentType: 'application/json',
return; beforeSend: () => {
} layer.load()
},
const url = this.module.id ? '/api/joyfulRoad/updateModule' : '/api/joyfulRoad/addModule' success: () => {
$.ajax({ layer.msg('删除成功!');
url: url, },
data: JSON.stringify(module), // 将 data 转换为 JSON 字符串 complete: () => {
type: 'post', layer.closeAll()
contentType: 'application/json',
beforeSend: () => {
layer.load()
},
success: () => {
layer.msg('保存成功!');
app.$data.dialog = false;
app.queryAll();
},
complete: () => {
layer.closeAll()
}
})
},
// 返回
cancel() {
this.dialog = false;
},
// 查询所有
queryAll() {
if (!getCId) return
const url = '/api/joyfulRoad/modules'
$.ajax({
type: 'GET',
contentType: 'application/json',
url,
beforeSend: () => {
layer.load()
},
complete: () => {
layer.closeAll()
},
success: (data) => {
this.list = data.content
}
})
},
// 获取详情
getDetail(id) {
$.ajax({
url: '/api/joyfulRoad/getModule/' + id,
success: (data) => {
if (data.content) {
this.module = data.content;
this.dialog = true;
}
},
beforeSend: () => {
layer.load()
},
complete: () => {
layer.closeAll()
},
});
},
//文件上传处理
uploadFile(obj) {
logoFile = obj.target.files[0];
if (logoFile.type && logoFile.type.indexOf("image") == -1) {
return layer.msg('请上传图片', { icon: 5 })
}
var reads = new FileReader();
reads.readAsDataURL(logoFile);
reads.onload = function () {
//将处理完的图片文件上传到阿里云服务器
//上传LOGO图片
var formData = new FormData();
formData.append("uploadImg", logoFile);
$.ajax({
url: 'https://event.geexek.com/upload/file.do', /*接口域名地址*/
type: 'post',
data: formData,
contentType: false,
processData: false,
success: function (res) {
if (res.code == "1") {
layer.msg('上传成功', { icon: 1, time: 1500 });
app.$data.module.icon = res.result
} else {
console.log(res);
}
},
beforeSend: () => {
layer.load()
},
complete: () => {
layer.closeAll()
},
})
};
}
}
});
app.queryAll(); app.queryAll();
</script> }
</body> });
});
</html> },
\ No newline at end of file // 保存
submit() {
const module = { ...this.module, status: Number(this.module.status), sort: Number(this.module.sort) }
// 假设 service 对象已经定义并初始化
if (!module.icon) {
layer.msg("图标图片!", { icon: 5, duration: 1500 });
return;
}
if (!module.name) {
layer.msg("模块标题不能为空!", { icon: 5, duration: 1500 });
return;
}
if (!module.path) {
layer.msg("跳转路径不能为空!", { icon: 5, duration: 1500 });
return;
}
const url = this.module.id ? '/gk/module/update' : '/gk/module/add'
$.ajax({
url: url,
data: JSON.stringify(module), // 将 data 转换为 JSON 字符串
type: 'post',
contentType: 'application/json',
beforeSend: () => {
layer.load()
},
success: () => {
layer.msg('保存成功!');
app.$data.dialog = false;
app.queryAll();
},
complete: () => {
layer.closeAll()
}
})
},
// 返回
cancel() {
this.dialog = false;
},
// 查询所有
queryAll() {
if (!getCId) return
const url = '/gk/module/list?status=1'
$.ajax({
type: 'GET',
contentType: 'application/json',
url,
beforeSend: () => {
layer.load()
},
complete: () => {
layer.closeAll()
},
success: (data) => {
this.list = data.content
}
})
},
// 获取详情
getDetail(id) {
$.ajax({
url: '/gk/module/detail/' + id,
success: (data) => {
if (data.content) {
this.module = data.content;
this.dialog = true;
}
},
beforeSend: () => {
layer.load()
},
complete: () => {
layer.closeAll()
},
});
},
//文件上传处理
uploadFile(obj) {
logoFile = obj.target.files[0];
if (logoFile.type && logoFile.type.indexOf("image") == -1) {
return layer.msg('请上传图片', { icon: 5 })
}
var reads = new FileReader();
reads.readAsDataURL(logoFile);
reads.onload = function () {
//将处理完的图片文件上传到阿里云服务器
//上传LOGO图片
var formData = new FormData();
formData.append("uploadImg", logoFile);
$.ajax({
url: 'https://event.geexek.com/upload/file.do', /*接口域名地址*/
type: 'post',
data: formData,
contentType: false,
processData: false,
success: function (res) {
if (res.code == "1") {
layer.msg('上传成功', { icon: 1, time: 1500 });
app.$data.module.icon = res.result
} else {
console.log(res);
}
},
beforeSend: () => {
layer.load()
},
complete: () => {
layer.closeAll()
},
})
};
}
}
});
app.queryAll();
</script>
</body>
</html>
\ No newline at end of file
...@@ -33,8 +33,8 @@ ...@@ -33,8 +33,8 @@
href="${ctxStatic}/newdermon/css/main.css?v=<%=System.currentTimeMillis()%>"> href="${ctxStatic}/newdermon/css/main.css?v=<%=System.currentTimeMillis()%>">
<link rel="stylesheet" href="${ctxStatic}/cmpt/setting.css?v=<%=System.currentTimeMillis()%>"> <link rel="stylesheet" href="${ctxStatic}/cmpt/setting.css?v=<%=System.currentTimeMillis()%>">
<link rel="stylesheet" <link rel="stylesheet"
href="${ctxStatic}/leaflet/css/leaflet.css?v=<%=System.currentTimeMillis()%>"/> href="${ctxStatic}/leaflet/css/leaflet.css?v=<%=System.currentTimeMillis()%>" />
<link rel="stylesheet" href="${ctxStatic}/leaflet/css/leaflet_label.css"/> <link rel="stylesheet" href="${ctxStatic}/leaflet/css/leaflet_label.css" />
<script src="${ctxStatic}/My97DatePicker/WdatePicker.js" type="text/javascript"></script> <script src="${ctxStatic}/My97DatePicker/WdatePicker.js" type="text/javascript"></script>
<script src="${ctxStatic}/newdermon/vendor/jquery/jquery.min.js"></script> <script src="${ctxStatic}/newdermon/vendor/jquery/jquery.min.js"></script>
...@@ -95,7 +95,8 @@ ...@@ -95,7 +95,8 @@
.input { .input {
width: 100%; width: 100%;
height: 40px !important; height: 40px !important;
line-height: 40px !important;; line-height: 40px !important;
;
border: 2px solid #F4F4F4; border: 2px solid #F4F4F4;
border-radius: 4px; border-radius: 4px;
margin-right: 30px; margin-right: 30px;
...@@ -142,18 +143,7 @@ ...@@ -142,18 +143,7 @@
top: 10px; top: 10px;
} }
.road-notice {
top: 16px;
height: 15px;
width: 15px;
}
.road-notice-txt {
color: rgb(206, 57, 57);
font-size: 16px;
width: 430px;
display: inline-block;
}
.saveDiv { .saveDiv {
display: flex; display: flex;
...@@ -298,11 +288,11 @@ ...@@ -298,11 +288,11 @@
<table style="width: 100%" class="rule-field"> <table style="width: 100%" class="rule-field">
<colgroup> <colgroup>
<col style="width:15%;"> <col style="width:15%;">
<col style="width:40%;"> <col style="width:35%;">
<col style="width:10%;"> <col style="width:10%;">
<col style="width:10%;"> <col style="width:10%;">
<col style="width:10%;"> <col style="width:10%;">
<col style="width:15%;"> <col style="width:20%;">
</colgroup> </colgroup>
<thead> <thead>
<tr> <tr>
...@@ -317,14 +307,16 @@ ...@@ -317,14 +307,16 @@
<tbody> <tbody>
<tr v-if="" v-for="item in list" :data-id="item.id"> <tr v-if="" v-for="item in list" :data-id="item.id">
<td style="text-align: center"> <td style="text-align: center">
<img :src="item.imgUrl" style="width:80px;height:80px;"/> <img :src="item.imgUrl"
style="width:80px;height:80px;object-fit:cover;" />
</td> </td>
<td class="name" style="text-align: left;"> <td class="name" style="text-align: left;">
<span v-text="item.title"></span> <span v-text="item.title"></span>
</td> </td>
<td style="text-align: center"> <td style="text-align: center">
<span v-text="serviceTypes[item.type].name"></span> <span v-if="item.type" v-text="serviceTypes[item.type].name"></span>
<span v-else>未设置</span>
</td> </td>
<td style="text-align: center"> <td style="text-align: center">
<span v-text="item.categoryName"></span> <span v-text="item.categoryName"></span>
...@@ -348,6 +340,12 @@ ...@@ -348,6 +340,12 @@
删除 删除
</span> </span>
</div> </div>
<div class="opt download" @click="downloadService(item)"
v-if="item.type =='9'">
<span class="edit">
下载二维码
</span>
</div>
</div> </div>
</td> </td>
</tr> </tr>
...@@ -387,8 +385,9 @@ ...@@ -387,8 +385,9 @@
<span class="title-new">服务类型</span> <span class="title-new">服务类型</span>
<div class="label-box"> <div class="label-box">
<label v-for="item in modules" :key="item.value"> <label v-for="item in modules" :key="item.id">
<input type="radio" v-model="service.type" :value="item.value"> {{item.name}} <input type="radio" v-model="service.type" :value="item.id">
{{item.name}}
</label> </label>
</div> </div>
</div> </div>
...@@ -396,8 +395,9 @@ ...@@ -396,8 +395,9 @@
<div class="func"> <div class="func">
<span class="title-new">子类型</span> <span class="title-new">子类型</span>
<div class="label-box"> <div class="label-box">
<label v-for="item in categoryOptions" :key="item.value"> <label v-for="item in categoryOptions" :key="item.value">
<input type="checkbox" v-model="service.category" :value="item.value"> {{item.name}} <input type="checkbox" v-model="service.category"
:value="item.value"> {{item.name}}
</label> </label>
</div> </div>
</div> </div>
...@@ -434,7 +434,7 @@ ...@@ -434,7 +434,7 @@
<div v-if="!service.imgUrl" class="cover"> <div v-if="!service.imgUrl" class="cover">
<span class="icon-cover"></span> <span class="icon-cover"></span>
</div> </div>
<img v-else class="cover cover-img" :src="service.imgUrl"/> <img v-else class="cover cover-img" :src="service.imgUrl" />
</label> </label>
<input id="file" type="file" style="display: none" @change="uploadFile"> <input id="file" type="file" style="display: none" @change="uploadFile">
</div> </div>
...@@ -506,6 +506,7 @@ ...@@ -506,6 +506,7 @@
service: { service: {
"id": null, "id": null,
"userId": getUId(), "userId": getUId(),
"cmptId": getCId(),
"type": 3, // 服务类型(3:特色民宿:4:旅游景点,5:特色餐饮 6:当地特产 7: 应急避险 8: 医疗点位 9:运动产品) "type": 3, // 服务类型(3:特色民宿:4:旅游景点,5:特色餐饮 6:当地特产 7: 应急避险 8: 医疗点位 9:运动产品)
"category": 1, // 子类型(1:打卡点,2:服务驿站,3:民宿:4:景点,5:餐饮) "category": 1, // 子类型(1:打卡点,2:服务驿站,3:民宿:4:景点,5:餐饮)
"title": null, "title": null,
...@@ -562,6 +563,42 @@ ...@@ -562,6 +563,42 @@
this.editor = editor this.editor = editor
}, },
methods: { methods: {
// // 下载签到二维码
downloadService(item) {
const url = `/gk/richText/qrCode/` + item.id;
fetch(url, {
method: 'GET',
headers: {
'Content-Type': 'application/json'
}
})
.then(response => {
if (!response.ok) {
throw new Error('Network response was not ok');
}
return response.blob();
})
.then(blob => {
const url = window.URL.createObjectURL(blob);
const a = document.createElement('a');
a.style.display = 'none';
a.href = url;
a.download = 'qrcode.png'; // 设置下载文件的名称
document.body.appendChild(a);
a.click();
window.URL.revokeObjectURL(url);
layer.msg('下载成功!');
})
.catch(error => {
console.error('There was a problem with the fetch operation:', error);
layer.msg('下载失败,请重试!');
})
.finally(() => {
layer.closeAll();
app.queryAll();
});
layer.load();
},
// 展示dialog // 展示dialog
addService() { addService() {
this.dialog = !this.dialog; this.dialog = !this.dialog;
...@@ -589,7 +626,8 @@ ...@@ -589,7 +626,8 @@
this.service = { this.service = {
id: null, id: null,
userId: getUId(), userId: getUId(),
type: 3, cmptId: getCId(),
type: this.serviceTypes[this.typeIndex].id,
title: '', title: '',
address: null, address: null,
lng: null, lng: null,
...@@ -613,7 +651,7 @@ ...@@ -613,7 +651,7 @@
delService(data) { delService(data) {
layer.confirm("确认要删除吗?", function () { layer.confirm("确认要删除吗?", function () {
$.ajax({ $.ajax({
url: '/api/joyfulRoad/delJoyfulRichText', url: '/gk/richText/delete',
data: JSON.stringify(data), // 将 data 转换为 JSON 字符串 data: JSON.stringify(data), // 将 data 转换为 JSON 字符串
type: 'post', type: 'post',
contentType: 'application/json', contentType: 'application/json',
...@@ -632,37 +670,37 @@ ...@@ -632,37 +670,37 @@
}, },
// 保存 // 保存
submit() { submit() {
const service = {...this.service} const service = { ...this.service }
// 假设 service 对象已经定义并初始化 // 假设 service 对象已经定义并初始化
if (!service.imgUrl) { if (!service.imgUrl) {
layer.msg("封面不能为空!", {icon: 5, duration: 1500}); layer.msg("封面不能为空!", { icon: 5, duration: 1500 });
return; return;
} }
if (!service.title) { if (!service.title) {
layer.msg("标题不能为空!", {icon: 5, duration: 1500}); layer.msg("标题不能为空!", { icon: 5, duration: 1500 });
return; return;
} }
if (!service.address) { if (!service.address) {
layer.msg("地址不能为空!", {icon: 5, duration: 1500}); layer.msg("地址不能为空!", { icon: 5, duration: 1500 });
return; return;
} }
if (!service.lng || !service.lat) { if (!service.lng || !service.lat) {
layer.msg("经纬度不能为空!", {icon: 5, duration: 1500}); layer.msg("经纬度不能为空!", { icon: 5, duration: 1500 });
return; return;
} }
var content = this.editor.getContent(); var content = this.editor.getContent();
if (!content) { if (!content) {
layer.msg("内容不能为空!", {icon: 5, duration: 1500}); layer.msg("内容不能为空!", { icon: 5, duration: 1500 });
return; return;
} }
service.content = content service.content = content
service.category = service.category.join(',') service.category = service.category.join(',')
const url = this.service.id ? '/api/joyfulRoad/updJoyfulRichText' : '/api/joyfulRoad/insJoyfulRichText' const url = this.service.id ? '/gk/richText/update' : '/gk/richText/add'
$.ajax({ $.ajax({
url: url, url: url,
data: JSON.stringify(service), // 将 data 转换为 JSON 字符串 data: JSON.stringify(service), // 将 data 转换为 JSON 字符串
...@@ -687,7 +725,7 @@ ...@@ -687,7 +725,7 @@
}, },
queryModules() { queryModules() {
if (!getCId) return if (!getCId) return
const url = '/api/joyfulRoad/modules' const url = '/gk/module/list?status=1'
$.ajax({ $.ajax({
type: 'GET', type: 'GET',
contentType: 'application/json', contentType: 'application/json',
...@@ -699,7 +737,7 @@ ...@@ -699,7 +737,7 @@
layer.closeAll() layer.closeAll()
}, },
success: (data) => { success: (data) => {
const filters = data.content.filter(v=>v.name!=='天气服务') const filters = data.content.filter(v => v.name !== '天气服务')
let list = filters.map(item => { let list = filters.map(item => {
return { return {
[item.id]: { [item.id]: {
...@@ -710,12 +748,13 @@ ...@@ -710,12 +748,13 @@
}); });
this.modules = filters this.modules = filters
list.unshift({ list.unshift({
0:{ 0: {
value: 0, value: 0,
name: '全部' name: '全部'
} }
}) })
this.serviceTypes = Object.assign({}, ...list); this.serviceTypes = Object.assign({}, ...list);
console.log(this.serviceTypes)
this.queryAll() this.queryAll()
} }
}) })
...@@ -724,13 +763,14 @@ ...@@ -724,13 +763,14 @@
queryAll() { queryAll() {
if (!getCId) return if (!getCId) return
const type = this.serviceTypes[this.typeIndex].value === 0 ? null : this.serviceTypes[this.typeIndex].value const type = this.serviceTypes[this.typeIndex].value === 0 ? null : this.serviceTypes[this.typeIndex].value
const url = '/api/joyfulRoad/getJoyfulRichTextList/' + this.page + '/' + this.pageSize const url = '/gk/richText/page/' + this.page + '/' + this.pageSize
$.ajax({ $.ajax({
type: 'POST', type: 'POST',
contentType: 'application/json', contentType: 'application/json',
data: JSON.stringify({ data: JSON.stringify({
type, type,
title: this.keyword title: this.keyword,
cmptId: getCId(),
}), }),
url, url,
beforeSend: () => { beforeSend: () => {
...@@ -756,12 +796,10 @@ ...@@ -756,12 +796,10 @@
// 获取详情 // 获取详情
getDetail(id) { getDetail(id) {
$.ajax({ $.ajax({
url: '/api/joyfulRoad/getJoyfulRichText/' + id, url: '/gk/richText/detail/' + id,
success: (data) => { success: (data) => {
if (data.content) { if (data.content) {
this.service = {...data.content, category: data.content?.category?.split(',') ?? []}; this.service = { ...data.content, category: data.content?.category?.split(',') ?? [] };
this.editor.setContent(data.content.content) this.editor.setContent(data.content.content)
this.dialog = true; this.dialog = true;
} }
...@@ -778,7 +816,7 @@ ...@@ -778,7 +816,7 @@
uploadFile(obj) { uploadFile(obj) {
logoFile = obj.target.files[0]; logoFile = obj.target.files[0];
if (logoFile.type && logoFile.type.indexOf("image") == -1) { if (logoFile.type && logoFile.type.indexOf("image") == -1) {
return layer.msg('请上传图片', {icon: 5}) return layer.msg('请上传图片', { icon: 5 })
} }
var reads = new FileReader(); var reads = new FileReader();
reads.readAsDataURL(logoFile); reads.readAsDataURL(logoFile);
...@@ -795,7 +833,7 @@ ...@@ -795,7 +833,7 @@
processData: false, processData: false,
success: function (res) { success: function (res) {
if (res.code == "1") { if (res.code == "1") {
layer.msg('上传成功', {icon: 1, time: 1500}); layer.msg('上传成功', { icon: 1, time: 1500 });
app.$data.service.imgUrl = res.result app.$data.service.imgUrl = res.result
} else { } else {
console.log(res); console.log(res);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment