• 基于HTML语言的环保网站的设计与实现 前后端分离 Java毕业设计·文档报告·代码讲解·安装调试


    🍊作者:计算机编程-吉哥
    🍊简介:专业从事JavaWeb程序开发,微信小程序开发,定制化项目、 源码、代码讲解、文档撰写、ppt制作。做自己喜欢的事,生活就是快乐的。
    🍊心愿:点赞 👍 收藏 ⭐评论 📝
    🍅 文末获取源码联系

    👇🏻 精彩专栏推荐订阅 👇🏻 不然下次找不到哟~
    Java毕业设计项目~热门选题推荐《1000套》

    目录

    1.技术选型

    2.数据库表结构

    3.开发工具

    4.功能介绍

    4.1【角色】

    4.2【前台功能模块】

    4.3【后台功能模块】

    5.项目演示截图

    5.1 首页

    5.2濒危生物

    ​5.3 论坛信息

    ​5.4 环保健康

    ​5.5 环境保护

    ​5.6 公告信息

    ​5.7 个人中心

    ​5.8 濒危生物留言管理

    ​5.9 论坛管理

    ​5.10 环保健康类型管理

    6.数据库文件设计

    7.核心代码 

    7.1 环保健康Controller

    7.2 环保健康Service

    7.3 环保健康ServiceImpl

    7.4 环保健康Dao

    7.5 环保健康list.html

    8.参考文档

    1.技术选型

    springboot、mybatisplus、vue、elementui、html、css、js、mysql、jdk1.8

    2.数据库表结构

    14张 

    3.开发工具

    idea、navicat

    4.功能介绍

    4.1【角色】

    管理员、用户

    4.2【前台功能模块】

    • 登录注册
    • 首页
    • 濒危生物
    • 论坛
    • 环保健康
    • 环境保护
    • 濒危生物法
    • 公告信息
    • 个人中心
    • 后台管理

    4.3【后台功能模块】

    • 登录
    • 首页
    • 个人中心
    • 管理员管理
    • 濒危生物管理
    • 基础数据管理
    • 论坛管理
    • 环保健康管理
    • 环境保护管理
    • 环境保护法管理
    • 公告信息管理
    • 轮播图管理

    5.项目演示截图

    5.1 首页

    5.2濒危生物

     5.3 论坛信息

     5.4 环保健康

     5.5 环境保护

     5.6 公告信息

     5.7 个人中心

     5.8 濒危生物留言管理

     5.9 论坛管理

     5.10 环保健康类型管理

     

    6.数据库文件设计

    1. CREATE TABLE `binweishengwu` (
    2. `id` int(11) NOT NULL AUTO_INCREMENT COMMENT '主键',
    3. `binweishengwu_name` varchar(200) DEFAULT NULL COMMENT '动物 Search111',
    4. `address_types` int(11) DEFAULT NULL COMMENT '所在地区 Search111',
    5. `binweishengwu_photo` varchar(200) DEFAULT NULL COMMENT '图片',
    6. `binweishengwu_size` varchar(200) DEFAULT NULL COMMENT '现存数量',
    7. `zan_number` int(11) DEFAULT NULL COMMENT '赞',
    8. `cai_number` int(11) DEFAULT NULL COMMENT '踩',
    9. `binweishengwu_content` text COMMENT '介绍',
    10. `insert_time` timestamp NULL DEFAULT NULL COMMENT '添加时间',
    11. `create_time` timestamp NULL DEFAULT NULL COMMENT '创建时间 show1 show2 photoShow',
    12. PRIMARY KEY (`id`)
    13. ) ENGINE=InnoDB AUTO_INCREMENT=6 DEFAULT CHARSET=utf8 COMMENT='濒危生物';
    14. CREATE TABLE `binweishengwu_collection` (
    15. `id` int(11) NOT NULL AUTO_INCREMENT COMMENT '主键',
    16. `binweishengwu_id` int(11) DEFAULT NULL COMMENT '濒危生物',
    17. `yonghu_id` int(11) DEFAULT NULL COMMENT '用户',
    18. `binweishengwu_collection_types` int(11) DEFAULT NULL COMMENT '类型',
    19. `insert_time` timestamp NULL DEFAULT NULL COMMENT '收藏时间',
    20. `create_time` timestamp NULL DEFAULT NULL COMMENT '创建时间 show3 photoShow',
    21. PRIMARY KEY (`id`)
    22. ) ENGINE=InnoDB AUTO_INCREMENT=8 DEFAULT CHARSET=utf8 COMMENT='濒危生物收藏';
    23. CREATE TABLE `binweishengwu_liuyan` (
    24. `id` int(11) NOT NULL AUTO_INCREMENT COMMENT '主键',
    25. `binweishengwu_id` int(11) DEFAULT NULL COMMENT '濒危生物',
    26. `yonghu_id` int(11) DEFAULT NULL COMMENT '用户',
    27. `binweishengwu_liuyan_text` text COMMENT '留言内容',
    28. `insert_time` timestamp NULL DEFAULT NULL COMMENT '留言时间',
    29. `reply_text` text COMMENT '回复内容',
    30. `update_time` timestamp NULL DEFAULT NULL COMMENT '回复时间',
    31. `create_time` timestamp NULL DEFAULT NULL COMMENT '创建时间',
    32. PRIMARY KEY (`id`)
    33. ) ENGINE=InnoDB AUTO_INCREMENT=7 DEFAULT CHARSET=utf8 COMMENT='濒危生物留言';
    34. CREATE TABLE `config` (
    35. `id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '主键',
    36. `name` varchar(100) NOT NULL COMMENT '配置参数名称',
    37. `value` varchar(100) DEFAULT NULL COMMENT '配置参数值',
    38. PRIMARY KEY (`id`)
    39. ) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=utf8 COMMENT='配置文件';
    40. CREATE TABLE `dictionary` (
    41. `id` int(20) NOT NULL AUTO_INCREMENT COMMENT '主键',
    42. `dic_code` varchar(200) DEFAULT NULL COMMENT '字段',
    43. `dic_name` varchar(200) DEFAULT NULL COMMENT '字段名',
    44. `code_index` int(11) DEFAULT NULL COMMENT '编码',
    45. `index_name` varchar(200) DEFAULT NULL COMMENT '编码名字 Search111 ',
    46. `super_id` int(11) DEFAULT NULL COMMENT '父字段id',
    47. `beizhu` varchar(200) DEFAULT NULL COMMENT '备注',
    48. `create_time` timestamp NULL DEFAULT NULL COMMENT '创建时间',
    49. PRIMARY KEY (`id`)
    50. ) ENGINE=InnoDB AUTO_INCREMENT=26 DEFAULT CHARSET=utf8 COMMENT='字典表';
    51. CREATE TABLE `forum` (
    52. `id` int(11) NOT NULL AUTO_INCREMENT COMMENT '主键',
    53. `forum_name` varchar(200) DEFAULT NULL COMMENT '帖子标题 Search111 ',
    54. `yonghu_id` int(11) DEFAULT NULL COMMENT '用户',
    55. `users_id` int(11) DEFAULT NULL COMMENT '管理员',
    56. `forum_content` text COMMENT '发布内容',
    57. `super_ids` int(11) DEFAULT NULL COMMENT '父id',
    58. `forum_state_types` int(11) DEFAULT NULL COMMENT '帖子状态',
    59. `insert_time` timestamp NULL DEFAULT NULL COMMENT '发帖时间',
    60. `update_time` timestamp NULL DEFAULT NULL COMMENT '修改时间',
    61. `create_time` timestamp NULL DEFAULT NULL COMMENT '创建时间 show2',
    62. PRIMARY KEY (`id`)
    63. ) ENGINE=InnoDB AUTO_INCREMENT=9 DEFAULT CHARSET=utf8 COMMENT='论坛';
    64. CREATE TABLE `huanbaojiankang` (
    65. `id` int(11) NOT NULL AUTO_INCREMENT COMMENT '主键',
    66. `huanbaojiankang_name` varchar(200) DEFAULT NULL COMMENT '标题 Search111',
    67. `huanbaojiankang_types` int(11) DEFAULT NULL COMMENT '环保健康类型 Search111',
    68. `huanbaojiankang_photo` varchar(200) DEFAULT NULL COMMENT '封面',
    69. `zan_number` int(11) DEFAULT NULL COMMENT '赞',
    70. `cai_number` int(11) DEFAULT NULL COMMENT '踩',
    71. `huanbaojiankang_content` text COMMENT '介绍',
    72. `insert_time` timestamp NULL DEFAULT NULL COMMENT '添加时间',
    73. `create_time` timestamp NULL DEFAULT NULL COMMENT '创建时间 show1 show2 photoShow',
    74. PRIMARY KEY (`id`)
    75. ) ENGINE=InnoDB AUTO_INCREMENT=6 DEFAULT CHARSET=utf8 COMMENT='环保健康';
    76. CREATE TABLE `huanbaojiankang_collection` (
    77. `id` int(11) NOT NULL AUTO_INCREMENT COMMENT '主键',
    78. `huanbaojiankang_id` int(11) DEFAULT NULL COMMENT '环保健康',
    79. `yonghu_id` int(11) DEFAULT NULL COMMENT '用户',
    80. `huanbaojiankang_collection_types` int(11) DEFAULT NULL COMMENT '类型',
    81. `insert_time` timestamp NULL DEFAULT NULL COMMENT '收藏时间',
    82. `create_time` timestamp NULL DEFAULT NULL COMMENT '创建时间 show3 photoShow',
    83. PRIMARY KEY (`id`)
    84. ) ENGINE=InnoDB AUTO_INCREMENT=8 DEFAULT CHARSET=utf8 COMMENT='环保健康收藏';
    85. CREATE TABLE `huanbaojiankang_liuyan` (
    86. `id` int(11) NOT NULL AUTO_INCREMENT COMMENT '主键',
    87. `huanbaojiankang_id` int(11) DEFAULT NULL COMMENT '环保健康',
    88. `yonghu_id` int(11) DEFAULT NULL COMMENT '用户',
    89. `huanbaojiankang_liuyan_text` text COMMENT '留言内容',
    90. `insert_time` timestamp NULL DEFAULT NULL COMMENT '留言时间',
    91. `reply_text` text COMMENT '回复内容',
    92. `update_time` timestamp NULL DEFAULT NULL COMMENT '回复时间',
    93. `create_time` timestamp NULL DEFAULT NULL COMMENT '创建时间',
    94. PRIMARY KEY (`id`)
    95. ) ENGINE=InnoDB AUTO_INCREMENT=7 DEFAULT CHARSET=utf8 COMMENT='环保健康留言';
    96. CREATE TABLE `huanjingbaohu` (
    97. `id` int(11) NOT NULL AUTO_INCREMENT COMMENT '主键',
    98. `huanjingbaohu_name` varchar(200) DEFAULT NULL COMMENT '名称 Search111',
    99. `address_types` int(11) DEFAULT NULL COMMENT '地区 Search111',
    100. `huanjingbaohu_photo` varchar(200) DEFAULT NULL COMMENT '图片',
    101. `huanjingbaohu_size` varchar(200) DEFAULT NULL COMMENT '大小',
    102. `zan_number` int(11) DEFAULT NULL COMMENT '赞',
    103. `cai_number` int(11) DEFAULT NULL COMMENT '踩',
    104. `huanjingbaohu_content` text COMMENT '介绍',
    105. `insert_time` timestamp NULL DEFAULT NULL COMMENT '添加时间',
    106. `create_time` timestamp NULL DEFAULT NULL COMMENT '创建时间 show1 show2 photoShow',
    107. PRIMARY KEY (`id`)
    108. ) ENGINE=InnoDB AUTO_INCREMENT=6 DEFAULT CHARSET=utf8 COMMENT='环境保护';
    109. CREATE TABLE `huanjingbaohu_collection` (
    110. `id` int(11) NOT NULL AUTO_INCREMENT COMMENT '主键',
    111. `huanjingbaohu_id` int(11) DEFAULT NULL COMMENT '环境保护',
    112. `yonghu_id` int(11) DEFAULT NULL COMMENT '用户',
    113. `huanjingbaohu_collection_types` int(11) DEFAULT NULL COMMENT '类型',
    114. `insert_time` timestamp NULL DEFAULT NULL COMMENT '收藏时间',
    115. `create_time` timestamp NULL DEFAULT NULL COMMENT '创建时间 show3 photoShow',
    116. PRIMARY KEY (`id`)
    117. ) ENGINE=InnoDB AUTO_INCREMENT=7 DEFAULT CHARSET=utf8 COMMENT='环境保护收藏';
    118. CREATE TABLE `huanjingbaohu_liuyan` (
    119. `id` int(11) NOT NULL AUTO_INCREMENT COMMENT '主键',
    120. `huanjingbaohu_id` int(11) DEFAULT NULL COMMENT '环境保护',
    121. `yonghu_id` int(11) DEFAULT NULL COMMENT '用户',
    122. `huanjingbaohu_liuyan_text` text COMMENT '留言内容',
    123. `insert_time` timestamp NULL DEFAULT NULL COMMENT '留言时间',
    124. `reply_text` text COMMENT '回复内容',
    125. `update_time` timestamp NULL DEFAULT NULL COMMENT '回复时间',
    126. `create_time` timestamp NULL DEFAULT NULL COMMENT '创建时间',
    127. PRIMARY KEY (`id`)
    128. ) ENGINE=InnoDB AUTO_INCREMENT=6 DEFAULT CHARSET=utf8 COMMENT='环境保护留言';
    129. CREATE TABLE `huanjingbaohufa` (
    130. `id` int(11) NOT NULL AUTO_INCREMENT COMMENT '主键',
    131. `huanjingbaohufa_name` varchar(200) DEFAULT NULL COMMENT '标题 Search111',
    132. `huanjingbaohufa_types` int(11) DEFAULT NULL COMMENT '保护法类型 Search111',
    133. `huanjingbaohufa_photo` varchar(200) DEFAULT NULL COMMENT '封面',
    134. `huanjingbaohufa_content` text COMMENT '详情',
    135. `insert_time` timestamp NULL DEFAULT NULL COMMENT '添加时间',
    136. `create_time` timestamp NULL DEFAULT NULL COMMENT '创建时间 show1 show2 nameShow',
    137. PRIMARY KEY (`id`)
    138. ) ENGINE=InnoDB AUTO_INCREMENT=6 DEFAULT CHARSET=utf8 COMMENT='濒危生物法';
    139. CREATE TABLE `news` (
    140. `id` int(11) NOT NULL AUTO_INCREMENT COMMENT '主键',
    141. `news_name` varchar(200) DEFAULT NULL COMMENT '公告标题 Search111 ',
    142. `news_types` int(11) DEFAULT NULL COMMENT '公告类型 Search111 ',
    143. `news_photo` varchar(200) DEFAULT NULL COMMENT '公告图片',
    144. `insert_time` timestamp NULL DEFAULT NULL COMMENT '添加时间',
    145. `news_content` text COMMENT '公告详情',
    146. `create_time` timestamp NULL DEFAULT NULL COMMENT '创建时间 show1 show2 nameShow',
    147. PRIMARY KEY (`id`)
    148. ) ENGINE=InnoDB AUTO_INCREMENT=6 DEFAULT CHARSET=utf8 COMMENT='公告信息';
    149. CREATE TABLE `token` (
    150. `id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '主键',
    151. `userid` bigint(20) NOT NULL COMMENT '用户id',
    152. `username` varchar(100) NOT NULL COMMENT '用户名',
    153. `tablename` varchar(100) DEFAULT NULL COMMENT '表名',
    154. `role` varchar(100) DEFAULT NULL COMMENT '角色',
    155. `token` varchar(200) NOT NULL COMMENT '密码',
    156. `addtime` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '新增时间',
    157. `expiratedtime` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '过期时间',
    158. PRIMARY KEY (`id`)
    159. ) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8 COMMENT='token表';
    160. CREATE TABLE `users` (
    161. `id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '主键',
    162. `username` varchar(100) NOT NULL COMMENT '用户名',
    163. `password` varchar(100) NOT NULL COMMENT '密码',
    164. `role` varchar(100) DEFAULT '管理员' COMMENT '角色',
    165. `addtime` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '新增时间',
    166. PRIMARY KEY (`id`)
    167. ) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8 COMMENT='用户表';
    168. CREATE TABLE `yonghu` (
    169. `id` int(11) NOT NULL AUTO_INCREMENT COMMENT '主键',
    170. `username` varchar(200) DEFAULT NULL COMMENT '账户',
    171. `password` varchar(200) DEFAULT NULL COMMENT '密码',
    172. `yonghu_name` varchar(200) DEFAULT NULL COMMENT '用户姓名 Search111 ',
    173. `yonghu_photo` varchar(200) DEFAULT NULL COMMENT '头像',
    174. `yonghu_phone` varchar(200) DEFAULT NULL COMMENT '手机号',
    175. `yonghu_email` varchar(200) DEFAULT NULL COMMENT '电子邮箱',
    176. `sex_types` int(11) DEFAULT NULL COMMENT '性别 Search111 ',
    177. `yonghu_delete` int(11) DEFAULT '1' COMMENT '假删',
    178. `create_time` timestamp NULL DEFAULT NULL COMMENT '创建时间',
    179. PRIMARY KEY (`id`)
    180. ) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=utf8 COMMENT='用户';

    7.核心代码 

    7.1 环保健康Controller

    1. package com.controller;
    2. import java.io.File;
    3. import java.math.BigDecimal;
    4. import java.net.URL;
    5. import java.text.SimpleDateFormat;
    6. import com.alibaba.fastjson.JSONObject;
    7. import java.util.*;
    8. import org.springframework.beans.BeanUtils;
    9. import javax.servlet.http.HttpServletRequest;
    10. import org.springframework.web.context.ContextLoader;
    11. import javax.servlet.ServletContext;
    12. import com.service.TokenService;
    13. import com.utils.*;
    14. import java.lang.reflect.InvocationTargetException;
    15. import com.service.DictionaryService;
    16. import org.apache.commons.lang3.StringUtils;
    17. import com.annotation.IgnoreAuth;
    18. import org.slf4j.Logger;
    19. import org.slf4j.LoggerFactory;
    20. import org.springframework.beans.factory.annotation.Autowired;
    21. import org.springframework.stereotype.Controller;
    22. import org.springframework.web.bind.annotation.*;
    23. import com.baomidou.mybatisplus.mapper.EntityWrapper;
    24. import com.baomidou.mybatisplus.mapper.Wrapper;
    25. import com.entity.*;
    26. import com.entity.view.*;
    27. import com.service.*;
    28. import com.utils.PageUtils;
    29. import com.utils.R;
    30. import com.alibaba.fastjson.*;
    31. /**
    32. * 环保健康
    33. * 后端接口
    34. * @author 计算机编程-吉哥
    35. * @email
    36. */
    37. @RestController
    38. @Controller
    39. @RequestMapping("/huanbaojiankang")
    40. public class HuanbaojiankangController {
    41. private static final Logger logger = LoggerFactory.getLogger(HuanbaojiankangController.class);
    42. @Autowired
    43. private HuanbaojiankangService huanbaojiankangService;
    44. @Autowired
    45. private TokenService tokenService;
    46. @Autowired
    47. private DictionaryService dictionaryService;
    48. //级联表service
    49. @Autowired
    50. private YonghuService yonghuService;
    51. /**
    52. * 后端列表
    53. */
    54. @RequestMapping("/page")
    55. public R page(@RequestParam Map params, HttpServletRequest request){
    56. logger.debug("page方法:,,Controller:{},,params:{}",this.getClass().getName(),JSONObject.toJSONString(params));
    57. String role = String.valueOf(request.getSession().getAttribute("role"));
    58. if(false)
    59. return R.error(511,"永不会进入");
    60. else if("用户".equals(role))
    61. params.put("yonghuId",request.getSession().getAttribute("userId"));
    62. if(params.get("orderBy")==null || params.get("orderBy")==""){
    63. params.put("orderBy","id");
    64. }
    65. PageUtils page = huanbaojiankangService.queryPage(params);
    66. //字典表数据转换
    67. List list =(List)page.getList();
    68. for(HuanbaojiankangView c:list){
    69. //修改对应字典表字段
    70. dictionaryService.dictionaryConvert(c, request);
    71. }
    72. return R.ok().put("data", page);
    73. }
    74. /**
    75. * 后端详情
    76. */
    77. @RequestMapping("/info/{id}")
    78. public R info(@PathVariable("id") Long id, HttpServletRequest request){
    79. logger.debug("info方法:,,Controller:{},,id:{}",this.getClass().getName(),id);
    80. HuanbaojiankangEntity huanbaojiankang = huanbaojiankangService.selectById(id);
    81. if(huanbaojiankang !=null){
    82. //entity转view
    83. HuanbaojiankangView view = new HuanbaojiankangView();
    84. BeanUtils.copyProperties( huanbaojiankang , view );//把实体数据重构到view中
    85. //修改对应字典表字段
    86. dictionaryService.dictionaryConvert(view, request);
    87. return R.ok().put("data", view);
    88. }else {
    89. return R.error(511,"查不到数据");
    90. }
    91. }
    92. /**
    93. * 后端保存
    94. */
    95. @RequestMapping("/save")
    96. public R save(@RequestBody HuanbaojiankangEntity huanbaojiankang, HttpServletRequest request){
    97. logger.debug("save方法:,,Controller:{},,huanbaojiankang:{}",this.getClass().getName(),huanbaojiankang.toString());
    98. String role = String.valueOf(request.getSession().getAttribute("role"));
    99. if(false)
    100. return R.error(511,"永远不会进入");
    101. Wrapper queryWrapper = new EntityWrapper()
    102. .eq("huanbaojiankang_name", huanbaojiankang.getHuanbaojiankangName())
    103. .eq("huanbaojiankang_types", huanbaojiankang.getHuanbaojiankangTypes())
    104. .eq("zan_number", huanbaojiankang.getZanNumber())
    105. .eq("cai_number", huanbaojiankang.getCaiNumber())
    106. ;
    107. logger.info("sql语句:"+queryWrapper.getSqlSegment());
    108. HuanbaojiankangEntity huanbaojiankangEntity = huanbaojiankangService.selectOne(queryWrapper);
    109. if(huanbaojiankangEntity==null){
    110. huanbaojiankang.setInsertTime(new Date());
    111. huanbaojiankang.setCreateTime(new Date());
    112. huanbaojiankangService.insert(huanbaojiankang);
    113. return R.ok();
    114. }else {
    115. return R.error(511,"表中有相同数据");
    116. }
    117. }
    118. /**
    119. * 后端修改
    120. */
    121. @RequestMapping("/update")
    122. public R update(@RequestBody HuanbaojiankangEntity huanbaojiankang, HttpServletRequest request){
    123. logger.debug("update方法:,,Controller:{},,huanbaojiankang:{}",this.getClass().getName(),huanbaojiankang.toString());
    124. String role = String.valueOf(request.getSession().getAttribute("role"));
    125. //根据字段查询是否有相同数据
    126. Wrapper queryWrapper = new EntityWrapper()
    127. .notIn("id",huanbaojiankang.getId())
    128. .andNew()
    129. .eq("huanbaojiankang_name", huanbaojiankang.getHuanbaojiankangName())
    130. .eq("huanbaojiankang_types", huanbaojiankang.getHuanbaojiankangTypes())
    131. .eq("zan_number", huanbaojiankang.getZanNumber())
    132. .eq("cai_number", huanbaojiankang.getCaiNumber())
    133. ;
    134. logger.info("sql语句:"+queryWrapper.getSqlSegment());
    135. HuanbaojiankangEntity huanbaojiankangEntity = huanbaojiankangService.selectOne(queryWrapper);
    136. if("".equals(huanbaojiankang.getHuanbaojiankangPhoto()) || "null".equals(huanbaojiankang.getHuanbaojiankangPhoto())){
    137. huanbaojiankang.setHuanbaojiankangPhoto(null);
    138. }
    139. if(huanbaojiankangEntity==null){
    140. huanbaojiankangService.updateById(huanbaojiankang);//根据id更新
    141. return R.ok();
    142. }else {
    143. return R.error(511,"表中有相同数据");
    144. }
    145. }
    146. /**
    147. * 删除
    148. */
    149. @RequestMapping("/delete")
    150. public R delete(@RequestBody Integer[] ids){
    151. logger.debug("delete:,,Controller:{},,ids:{}",this.getClass().getName(),ids.toString());
    152. huanbaojiankangService.deleteBatchIds(Arrays.asList(ids));
    153. return R.ok();
    154. }
    155. /**
    156. * 批量上传
    157. */
    158. @RequestMapping("/batchInsert")
    159. public R save( String fileName, HttpServletRequest request){
    160. logger.debug("batchInsert方法:,,Controller:{},,fileName:{}",this.getClass().getName(),fileName);
    161. Integer yonghuId = Integer.valueOf(String.valueOf(request.getSession().getAttribute("userId")));
    162. SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
    163. try {
    164. List huanbaojiankangList = new ArrayList<>();//上传的东西
    165. Map> seachFields= new HashMap<>();//要查询的字段
    166. Date date = new Date();
    167. int lastIndexOf = fileName.lastIndexOf(".");
    168. if(lastIndexOf == -1){
    169. return R.error(511,"该文件没有后缀");
    170. }else{
    171. String suffix = fileName.substring(lastIndexOf);
    172. if(!".xls".equals(suffix)){
    173. return R.error(511,"只支持后缀为xls的excel文件");
    174. }else{
    175. URL resource = this.getClass().getClassLoader().getResource("static/upload/" + fileName);//获取文件路径
    176. File file = new File(resource.getFile());
    177. if(!file.exists()){
    178. return R.error(511,"找不到上传文件,请联系管理员");
    179. }else{
    180. List> dataList = PoiUtil.poiImport(file.getPath());//读取xls文件
    181. dataList.remove(0);//删除第一行,因为第一行是提示
    182. for(List data:dataList){
    183. //循环
    184. HuanbaojiankangEntity huanbaojiankangEntity = new HuanbaojiankangEntity();
    185. huanbaojiankangList.add(huanbaojiankangEntity);
    186. }
    187. //查询是否重复
    188. huanbaojiankangService.insertBatch(huanbaojiankangList);
    189. return R.ok();
    190. }
    191. }
    192. }
    193. }catch (Exception e){
    194. e.printStackTrace();
    195. return R.error(511,"批量插入数据异常,请联系管理员");
    196. }
    197. }
    198. /**
    199. * 前端列表
    200. */
    201. @IgnoreAuth
    202. @RequestMapping("/list")
    203. public R list(@RequestParam Map params, HttpServletRequest request){
    204. logger.debug("list方法:,,Controller:{},,params:{}",this.getClass().getName(),JSONObject.toJSONString(params));
    205. // 没有指定排序字段就默认id倒序
    206. if(StringUtil.isEmpty(String.valueOf(params.get("orderBy")))){
    207. params.put("orderBy","id");
    208. }
    209. PageUtils page = huanbaojiankangService.queryPage(params);
    210. //字典表数据转换
    211. List list =(List)page.getList();
    212. for(HuanbaojiankangView c:list)
    213. dictionaryService.dictionaryConvert(c, request); //修改对应字典表字段
    214. return R.ok().put("data", page);
    215. }
    216. /**
    217. * 前端详情
    218. */
    219. @RequestMapping("/detail/{id}")
    220. public R detail(@PathVariable("id") Long id, HttpServletRequest request){
    221. logger.debug("detail方法:,,Controller:{},,id:{}",this.getClass().getName(),id);
    222. HuanbaojiankangEntity huanbaojiankang = huanbaojiankangService.selectById(id);
    223. if(huanbaojiankang !=null){
    224. //entity转view
    225. HuanbaojiankangView view = new HuanbaojiankangView();
    226. BeanUtils.copyProperties( huanbaojiankang , view );//把实体数据重构到view中
    227. //修改对应字典表字段
    228. dictionaryService.dictionaryConvert(view, request);
    229. return R.ok().put("data", view);
    230. }else {
    231. return R.error(511,"查不到数据");
    232. }
    233. }
    234. /**
    235. * 前端保存
    236. */
    237. @RequestMapping("/add")
    238. public R add(@RequestBody HuanbaojiankangEntity huanbaojiankang, HttpServletRequest request){
    239. logger.debug("add方法:,,Controller:{},,huanbaojiankang:{}",this.getClass().getName(),huanbaojiankang.toString());
    240. Wrapper queryWrapper = new EntityWrapper()
    241. .eq("huanbaojiankang_name", huanbaojiankang.getHuanbaojiankangName())
    242. .eq("huanbaojiankang_types", huanbaojiankang.getHuanbaojiankangTypes())
    243. .eq("zan_number", huanbaojiankang.getZanNumber())
    244. .eq("cai_number", huanbaojiankang.getCaiNumber())
    245. ;
    246. logger.info("sql语句:"+queryWrapper.getSqlSegment());
    247. HuanbaojiankangEntity huanbaojiankangEntity = huanbaojiankangService.selectOne(queryWrapper);
    248. if(huanbaojiankangEntity==null){
    249. huanbaojiankang.setInsertTime(new Date());
    250. huanbaojiankang.setCreateTime(new Date());
    251. huanbaojiankangService.insert(huanbaojiankang);
    252. return R.ok();
    253. }else {
    254. return R.error(511,"表中有相同数据");
    255. }
    256. }
    257. }

    7.2 环保健康Service

    1. package com.service;
    2. import com.baomidou.mybatisplus.service.IService;
    3. import com.utils.PageUtils;
    4. import com.entity.HuanbaojiankangEntity;
    5. import java.util.Map;
    6. import javax.servlet.http.HttpServletRequest;
    7. /**
    8. * 环保健康 服务类
    9. */
    10. public interface HuanbaojiankangService extends IService {
    11. /**
    12. * @param params 查询参数
    13. * @return 带分页的查询出来的数据
    14. */
    15. PageUtils queryPage(Map params);
    16. }

    7.3 环保健康ServiceImpl

    1. package com.service.impl;
    2. import com.utils.StringUtil;
    3. import org.springframework.stereotype.Service;
    4. import java.lang.reflect.Field;
    5. import java.util.*;
    6. import com.baomidou.mybatisplus.plugins.Page;
    7. import com.baomidou.mybatisplus.service.impl.ServiceImpl;
    8. import org.springframework.transaction.annotation.Transactional;
    9. import com.utils.PageUtils;
    10. import com.utils.Query;
    11. import org.springframework.web.context.ContextLoader;
    12. import javax.servlet.ServletContext;
    13. import javax.servlet.http.HttpServletRequest;
    14. import com.dao.HuanbaojiankangDao;
    15. import com.entity.HuanbaojiankangEntity;
    16. import com.service.HuanbaojiankangService;
    17. import com.entity.view.HuanbaojiankangView;
    18. /**
    19. * 环保健康 服务实现类
    20. */
    21. @Service("huanbaojiankangService")
    22. @Transactional
    23. public class HuanbaojiankangServiceImpl extends ServiceImpl implements HuanbaojiankangService {
    24. @Override
    25. public PageUtils queryPage(Map params) {
    26. if(params != null && (params.get("limit") == null || params.get("page") == null)){
    27. params.put("page","1");
    28. params.put("limit","10");
    29. }
    30. Page page =new Query(params).getPage();
    31. page.setRecords(baseMapper.selectListView(page,params));
    32. return new PageUtils(page);
    33. }
    34. }

    7.4 环保健康Dao

    1. package com.dao;
    2. import com.entity.HuanbaojiankangEntity;
    3. import com.baomidou.mybatisplus.mapper.BaseMapper;
    4. import java.util.List;
    5. import java.util.Map;
    6. import com.baomidou.mybatisplus.plugins.pagination.Pagination;
    7. import org.apache.ibatis.annotations.Param;
    8. import com.entity.view.HuanbaojiankangView;
    9. /**
    10. * 环保健康 Dao 接口
    11. *
    12. * @author
    13. */
    14. public interface HuanbaojiankangDao extends BaseMapper {
    15. List selectListView(Pagination page,@Param("params")Map params);
    16. }

    7.5 环保健康list.html

    1. html>
    2. <html>
    3. <head lang="en">
    4. <meta charset="utf-8">
    5. <title>环保健康title>
    6. <meta name="keywords" content=""/>
    7. <meta name="description" content=""/>
    8. <meta name="renderer" content="webkit">
    9. <meta http-equiv="X-UA-Compatible" content="IE=edge"/>
    10. <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
    11. <link rel="stylesheet" href="../../layui/css/layui.css">
    12. <link rel="stylesheet" href="../../xznstatic/css/common.css"/>
    13. <link rel="stylesheet" href="../../xznstatic/css/style.css"/>
    14. <script type="text/javascript" src="../../xznstatic/js/jquery-1.11.3.min.js">script>
    15. <script type="text/javascript" src="../../xznstatic/js/jquery.SuperSlide.2.1.1.js">script>
    16. <link rel="stylesheet" href="../../xznstatic/css/bootstrap.min.css" />
    17. <link rel="stylesheet" href="../../css/theme.css"/>
    18. head>
    19. <style>
    20. html::after {
    21. position: fixed;
    22. top: 0;
    23. right: 0;
    24. left: 0;
    25. bottom: 0;
    26. content: '';
    27. display: block;
    28. background-attachment: fixed;
    29. background-size: cover;
    30. background-position: center;
    31. }
    32. /*轮播图相关 start*/
    33. #swiper {
    34. overflow: hidden;
    35. }
    36. #swiper .layui-carousel-ind li {
    37. width: 20px;
    38. height: 10px;
    39. border-width: 0;
    40. border-style: solid;
    41. border-color: rgba(0, 0, 0, .3);
    42. border-radius: 6px;
    43. background-color: #f7f7f7;
    44. box-shadow: 0 0 6px rgba(255, 0, 0, .8);
    45. }
    46. #swiper .layui-carousel-ind li.layui-this {
    47. width: 30px;
    48. height: 10px;
    49. border-width: 0;
    50. border-style: solid;
    51. border-color: rgba(0, 0, 0, .3);
    52. border-radius: 6px;
    53. }
    54. /*轮播图相关 end*/
    55. /*列表*/
    56. .recommend {
    57. padding: 10px 0;
    58. display: flex;
    59. justify-content: center;
    60. background-repeat: no-repeat;
    61. background-position: center center;
    62. background-size: cover;
    63. }
    64. .recommend .box {
    65. width: 1002px;
    66. margin: 0 auto;
    67. }
    68. .recommend .box .title {
    69. padding: 10px 5px;
    70. display: flex;
    71. justify-content: space-between;
    72. align-items: center;
    73. box-sizing: border-box;
    74. }
    75. .recommend .box .title span {
    76. padding: 0 10px;
    77. font-size: 16px;
    78. line-height: 1.4;
    79. }
    80. .recommend .box .filter {
    81. padding: 0 10px;
    82. display: flex;
    83. align-items: center;
    84. box-sizing: border-box;
    85. width: 100%;
    86. flex-wrap: wrap;
    87. }
    88. .recommend .box .filter .item-list {
    89. display: flex;
    90. align-items: center;
    91. }
    92. .recommend .box .filter .item-list .lable {
    93. font-size: 14px;
    94. color: #333;
    95. box-sizing: border-box;
    96. }
    97. .recommend .box .filter .item-list input {
    98. padding: 0 10px;
    99. box-sizing: border-box;
    100. outline: none;
    101. }
    102. .recommend .box .filter button {
    103. display: flex;
    104. padding: 0 10px;
    105. box-sizing: border-box;
    106. align-items: center;
    107. justify-content: center;
    108. outline: none;
    109. }
    110. .recommend .box .filter button i {
    111. margin-right: 4px;
    112. }
    113. .recommend .box .list {
    114. display: flex;
    115. flex-wrap: wrap;
    116. }
    117. .recommend .box .list .list-item {
    118. flex: 0 0 25%;
    119. padding: 0 5px;
    120. box-sizing: border-box;
    121. }
    122. .recommend .box .list .list-item .list-item-body {
    123. cursor: pointer;
    124. border: 1px solid rgba(0, 0, 0, 3);
    125. padding: 5px;
    126. box-sizing: border-box;
    127. }
    128. .recommend .box .list .list-item-body img {
    129. width: 100%;
    130. height: 100px;
    131. display: block;
    132. margin: 0 auto;
    133. }
    134. .recommend .box .list .list-item-body .info {
    135. display: flex;
    136. flex-wrap: wrap;
    137. }
    138. .recommend .box .list .list-item-body .info .price {
    139. padding-top: 5px;
    140. color: red;
    141. font-size: 14px;
    142. text-align: center;
    143. box-sizing: border-box;
    144. }
    145. .recommend .box .list .list-item-body .info .name {
    146. padding-top: 5px;
    147. color: red;
    148. font-size: 14px;
    149. text-align: center;
    150. box-sizing: border-box;
    151. }
    152. .recommend .box .list .list-item3 {
    153. flex: 0 0 33.33%;
    154. }
    155. .recommend .box .list .list-item5 {
    156. flex: 0 0 25%;
    157. }
    158. .recommend .box .news {
    159. display: flex;
    160. flex-wrap: wrap;
    161. padding: 0;
    162. width: 100%;
    163. }
    164. .recommend .box .news .list-item {
    165. flex: 0 0 50%;
    166. padding: 0 10px;
    167. box-sizing: border-box;
    168. }
    169. .recommend .box .news .list-item .list-item-body {
    170. cursor: pointer;
    171. border: 1px solid rgba(0, 0, 0, 3);
    172. padding: 10px;
    173. box-sizing: border-box;
    174. display: flex;
    175. }
    176. .recommend .box .news .list-item .list-item-body img {
    177. width: 120px;
    178. height: 100%;
    179. display: block;
    180. margin: 0 auto;
    181. }
    182. .recommend .box .news .list-item .list-item-body .item-info {
    183. flex: 1;
    184. display: flex;
    185. justify-content: space-between;
    186. flex-direction: column;
    187. padding-left: 10px;
    188. box-sizing: border-box;
    189. }
    190. .recommend .box .news .list-item .list-item-body .item-info .name {
    191. padding-top: 5px;
    192. color: red;
    193. font-size: 14px;
    194. box-sizing: border-box;
    195. overflow: hidden;
    196. text-overflow: ellipsis;
    197. display: -webkit-box;
    198. -webkit-line-clamp: 1;
    199. -webkit-box-orient: vertical;
    200. }
    201. .recommend .box .news .list-item .list-item-body .item-info .time {
    202. padding-top: 5px;
    203. color: red;
    204. font-size: 14px;
    205. overflow: hidden;
    206. text-overflow: ellipsis;
    207. display: -webkit-box;
    208. -webkit-line-clamp: 1;
    209. -webkit-box-orient: vertical;
    210. box-sizing: border-box;
    211. }
    212. .recommend .box .news .list-item1 {
    213. flex: 0 0 100%;
    214. }
    215. .recommend .box .news .list-item3 {
    216. flex: 0 0 33.33%;
    217. }
    218. .index-pv1 .animation-box:hover {
    219. transform: perspective(1000px) translate3d(0px, 0px, 0px) scale(1.01) rotate(0deg) skew(-2deg, 0deg);
    220. transition: all 0.3s;
    221. }
    222. .layui-laypage .layui-laypage-count {
    223. padding: 0 10px;
    224. }
    225. .layui-laypage .layui-laypage-skip {
    226. padding-left: 10px;
    227. }
    228. style>
    229. <body>
    230. <div id="app">
    231. <div class="banner">
    232. <div class="layui-carousel" id="swiper"
    233. :style='{"boxShadow":"0 0 0px rgba(255,0,0,.8)","margin":"0 auto","borderColor":"rgba(0,0,0,.3)","borderRadius":"0px","borderWidth":"0","width":"100%","borderStyle":"solid"}'>
    234. <div carousel-item>
    235. <div v-for="(item,index) in swiperList" :key="index">
    236. <img style="width: 100%;height: 100%;object-fit:cover;" :src="item.img"/>
    237. div>
    238. div>
    239. div>
    240. div>
    241. <div class="recommend index-pv1"
    242. :style='{"padding":"10px 0 10px 0","boxShadow":"0 0 0px ","margin":"10px 0 0 0","borderColor":"rgba(0,0,0,.3)","backgroundColor":"rgba(255, 0, 0, 0)","borderRadius":"0","borderWidth":"0","borderStyle":"solid"}'>
    243. <div class="box" style='width:80%'>
    244. <div :style='{"padding":"0","boxShadow":"0 0 6px rgba(255,0,0,0)","margin":"0","borderColor":"rgba(0,0,0,1)","backgroundColor":"rgba(0,0,0,0)","borderRadius":"10px","borderWidth":"0","width":"100%","borderStyle":"solid","height":"auto"}'>
    245. <div style="display: inline-block;text-align: center;cursor: pointer;"
    246. class="thisTableType-search main_backgroundColor" index=""
    247. :style='searchForm.huanbaojiankangTypes==""?{"padding":"0 10px","boxShadow":"0 0 6px rgba(0,0,0,.3)","margin":"0 10px 0 0","borderColor":"rgba(0,0,0,1)","color":"#fff","borderRadius":"10px","borderWidth":"0","lineHeight":"34px","fontSize":"14px","borderStyle":"solid"}:{"padding":"0 10px","boxShadow":"0 0 6px rgba(0,0,0,.3)","margin":"0 10px 0 0","borderColor":"rgba(0,0,0,1)","backgroundColor":"#fff","color":"#333","borderRadius":"10px","borderWidth":"0","lineHeight":"34px","fontSize":"14px","borderStyle":"solid"}'>
    248. 环保健康类型全部
    249. div>
    250. <div v-for="(item,index) in huanbaojiankangTypesList" :key="item.codeIndex"
    251. class="thisTableType-search main_backgroundColor" :index="item.codeIndex"
    252. :style='searchForm.huanbaojiankangTypes==item.codeIndex?{"padding":"0 10px","boxShadow":"0 0 6px rgba(0,0,0,.3)","margin":"0 10px 0 0","borderColor":"rgba(0,0,0,1)","color":"#fff","borderRadius":"10px","borderWidth":"0","lineHeight":"34px","fontSize":"14px","borderStyle":"solid"}:{"padding":"0 10px","boxShadow":"0 0 6px rgba(0,0,0,.3)","margin":"0 10px 0 0","borderColor":"rgba(0,0,0,1)","backgroundColor":"#fff","color":"#333","borderRadius":"10px","borderWidth":"0","lineHeight":"34px","fontSize":"14px","borderStyle":"solid"}'
    253. style="display: inline-block;text-align: center;cursor: pointer;">
    254. {{item.indexName}}
    255. div>
    256. div>
    257. <div class="title sub_backgroundColor sub_borderColor"
    258. :style='{"padding":"10px 0 10px 0","margin":"10px 0 10px 0","borderRadius":"4px","borderWidth":"1px","borderStyle":"solid","justifyContent":"space-between","height":"54px"}'>
    259. <span :style='{"padding":"0 10px","boxShadow":"0 0 6px rgba(255,0,0,0)","borderColor":"rgba(255,0,0,1)","backgroundColor":"rgba(0,0,0,0)","color":"rgba(11, 11, 11, 1)","borderRadius":"0 0 2px 0","borderWidth":"0","fontSize":"18px","borderStyle":"solid"}'>
    260. 环保健康
    261. span>
    262. <span :style='{"padding":"0 10px","boxShadow":"0 0 6px rgba(255,0,0,0)","borderColor":"rgba(0,0,0,0)","backgroundColor":"rgba(0,0,0,0)","color":"rgba(255, 255, 255, 1)","borderRadius":"0","borderWidth":"0","fontSize":"16px","borderStyle":"solid"}'>
    263. 您现在的位置:环保健康
    264. span>
    265. div>
    266. <form class="layui-form filter main_backgroundColor"
    267. :style='{"padding":"0 10px","boxShadow":"0 0 0px rgba(255,0,0,.8)","margin":"10px 0 10px 0","borderColor":"rgba(0,0,0,.3)","borderRadius":"4px","alignItems":"center","borderWidth":"0","borderStyle":"solid","justifyContent":"flex-end","height":"64px"}'>
    268. <div class="item-list">
    269. <div class="lable"
    270. :style='{"padding":"0 10px","boxShadow":"0 0 6px rgba(255,0,0,0)","margin":"0","borderColor":"rgba(0,0,0,0)","backgroundColor":"transparent","color":"rgba(17, 16, 16, 1)","borderRadius":"0","textAlign":"right","borderWidth":"0","width":"auto","fontSize":"16px","borderStyle":"solid"}'>
    271. 标题
    272. div>
    273. <input type="text" v-model="searchForm.huanbaojiankangName"
    274. :style='{"boxShadow":"0 0 6px rgba(255,0,0,0)","borderColor":"#ccc","backgroundColor":"#fff","color":"rgba(135, 206, 250, 1)","borderRadius":"8px","textAlign":"center","borderWidth":"0","width":"140px","fontSize":"14px","borderStyle":"solid","height":"44px"}'
    275. placeholder="标题" autocomplete="off"
    276. class="layui-input">
    277. div>
    278. <button id="btn-search" :style='{"padding":"0 15px","boxShadow":"0 0 8px rgba(0,0,0,0)","margin":"0 0 0 10px","borderColor":"rgba(135, 206, 250, 1)","color":"#fff","borderRadius":"4px","borderWidth":"0","width":"auto","fontSize":"14px","borderStyle":"solid","height":"40px"}' type="button" class="layui-btn layui-btn-normal sub_backgroundColor">
    279. <i v-if="true" class="layui-icon layui-icon-search">i>搜索
    280. button>
    281. <button v-if="isAuth('huanbaojiankang','新增')" @click="jump('../huanbaojiankang/add.html')" :style='{"padding":"0 15px","boxShadow":"0 0 8px rgba(0,0,0,0)","margin":"0 0 0 10px","borderColor":"rgba(135, 206, 250, 1)","backgroundColor":"rgba(135, 206, 250, 1)","color":"#fff","borderRadius":"4px","borderWidth":"0","width":"auto","fontSize":"14px","borderStyle":"solid","height":"40px"}' type="button" class="layui-btn btn-theme">
    282. <i v-if="true" class="layui-icon">i>添加
    283. button>
    284. form>
    285. <div class="travel-gallery-wrapper">
    286. <div class="row">
    287. <div v-for="(item,index) in dataList" v-bind:key="index" class="col-md-3 col-sm-6 col-xs-6 col-lg-3 single-box">
    288. <div @click="jumpCheck('../huanbaojiankang/detail.html?id='+item.id , item.aaaaaaaaaa == null?'':item.aaaaaaaaaa , item.shangxiaTypes == null?'':item.shangxiaTypes)">
    289. <div class="part-img">
    290. <img :src="item.huanbaojiankangPhoto?item.huanbaojiankangPhoto.split(',')[0]:''" style="height: 350px;width:100%;">
    291. div>
    292. <div class="part-txt">
    293. <a href="javascript:return false;" style="font-size: 24px"><i class="layui-icon layui-icon-link">i>a>
    294. <div class="title">
    295. <h3>{{item.huanbaojiankangName}}h3>
    296. <p v-if="item.huanbaojiankangNewMoney">
    297. {{item.huanbaojiankangNewMoney}} RMB
    298. p>
    299. <p v-else>
    300. {{item.huanbaojiankangValue}}
    301. p>
    302. div>
    303. div>
    304. div>
    305. div>
    306. div>
    307. div>
    308. div>
    309. div>
    310. <div class="pager" id="pager" :style="{textAlign:'center'}">div>
    311. div>
    312. <script src="../../xznstatic/js/bootstrap.min.js" type="text/javascript" charset="utf-8">script>
    313. <script src="../../layui/layui.js">script>
    314. <script src="../../js/vue.js">script>
    315. <script src="../../xznstatic/js/element.min.js">script>
    316. <link rel="stylesheet" href="../../xznstatic/css/element.min.css">
    317. <script src="../../js/config.js">script>
    318. <script src="../../modules/config.js">script>
    319. <script src="../../js/utils.js">script>
    320. <script type="text/javascript">
    321. var vue = new Vue({
    322. el: '#app',
    323. data: {
    324. swiperList: [],
    325. huanbaojiankangTypesList: [],
    326. //查询条件
    327. searchForm: {
    328. page: 1
    329. ,limit: 8
    330. ,huanbaojiankangName: ""
    331. ,huanbaojiankangTypes: ""
    332. ,huanbaojiankangPhoto: ""
    333. ,huanbaojiankangContent: ""
    334. },
    335. dataList: [],
    336. },
    337. filters: {
    338. subString: function(val) {
    339. if (val) {
    340. val = val.replace(/<[^<>]+>/g, '').replace(/undefined/g, '');
    341. if (val.length > 60) {
    342. val = val.substring(0, 60);
    343. val+='...';
    344. }
    345. return val;
    346. }
    347. return '';
    348. }
    349. },
    350. computed: {
    351. },
    352. methods: {
    353. isAuth(tablename, button) {
    354. return isFrontAuth(tablename, button);
    355. }
    356. ,jump(url) {
    357. jump(url);
    358. }
    359. ,jumpCheck(url,check1,check2) {
    360. if(check1 == "2" || check1 == 2){//级联表的逻辑删除字段[1:未删除 2:已删除]
    361. layui.layer.msg("已经被删除", {
    362. time: 2000,
    363. icon: 2
    364. });
    365. return false;
    366. }
    367. if(check2 == "2" || check2 == 2){//是否下架[1:上架 2:下架]
    368. layui.layer.msg("已经下架", {
    369. time: 2000,
    370. icon: 2
    371. });
    372. return false;
    373. }
    374. this.jump(url);
    375. }
    376. }
    377. });
    378. layui.use(['layer', 'element', 'carousel', 'laypage', 'http', 'jquery', 'laydate', 'tinymce'], function() {
    379. var layer = layui.layer;
    380. var element = layui.element;
    381. var carousel = layui.carousel;
    382. var laypage = layui.laypage;
    383. var http = layui.http;
    384. var laydate = layui.laydate;
    385. var tinymce = layui.tinymce;
    386. window.jQuery = window.$ = jquery = layui.jquery;
    387. // var id = http.getParam('id');
    388. // 获取轮播图 数据
    389. http.request('config/list', 'get', {
    390. page: 1,
    391. limit: 5
    392. }, function (res) {
    393. if (res.data.list.length > 0) {
    394. let swiperList = [];
    395. res.data.list.forEach(element => {
    396. if(element.value != null){
    397. swiperList.push({
    398. img: element.value
    399. });
    400. }
    401. });
    402. vue.swiperList = swiperList;
    403. vue.$nextTick(() => {
    404. carousel.render({
    405. elem: '#swiper',
    406. width: '100%',
    407. height: '450px',
    408. arrow: 'hover',
    409. anim: 'default',
    410. autoplay: 'true',
    411. interval: '3000',
    412. indicator: 'inside'
    413. });
    414. });
    415. }
    416. });
    417. //环保健康类型的动态搜素
    418. $(document).on("click", ".thisTableType-search", function (e) {
    419. vue.searchForm.huanbaojiankangTypes = $(this).attr('index');
    420. pageList();
    421. });
    422. //当前表的 环保健康类型 字段 字典表查询
    423. huanbaojiankangTypesSelect();
    424. //当前表的 环保健康类型 字段 字典表查询方法
    425. function huanbaojiankangTypesSelect() {
    426. http.request("dictionary/page?page=1&limit=100&sort=&order=&dicCode=huanbaojiankang_types", 'get', {}, function (res) {
    427. if(res.code == 0){
    428. vue.huanbaojiankangTypesList = res.data.list;
    429. }
    430. });
    431. }
    432. // 分页列表
    433. pageList();
    434. // 搜索按钮
    435. jquery('#btn-search').click(function (e) {
    436. pageList();
    437. });
    438. function pageList() {
    439. // 获取列表数据
    440. http.request('huanbaojiankang/list', 'get', vue.searchForm, function (res) {
    441. vue.dataList = res.data.list;
    442. // 分页
    443. laypage.render({
    444. elem: 'pager',
    445. count: res.data.total,
    446. limit: vue.searchForm.limit,
    447. groups: 3,
    448. layout: ["prev", "page", "next"],
    449. jump: function (obj, first) {
    450. vue.searchForm.page = obj.curr;//翻页
    451. //首次不执行
    452. if (!first) {
    453. http.request('huanbaojiankang/list', 'get', vue.searchForm, function (res1) {
    454. vue.dataList = res1.data.list;
    455. })
    456. }
    457. }
    458. });
    459. });
    460. }
    461. });
    462. window.xznSlide = function () {
    463. jQuery(".banner").slide({mainCell: ".bd ul", autoPlay: true, interTime: 5000});
    464. jQuery("#ifocus").slide({
    465. titCell: "#ifocus_btn li",
    466. mainCell: "#ifocus_piclist ul",
    467. effect: "leftLoop",
    468. delayTime: 200,
    469. autoPlay: true,
    470. triggerTime: 0
    471. });
    472. jQuery("#ifocus").slide({titCell: "#ifocus_btn li", mainCell: "#ifocus_tx ul", delayTime: 0, autoPlay: true});
    473. jQuery(".product_list").slide({
    474. mainCell: ".bd ul",
    475. autoPage: true,
    476. effect: "leftLoop",
    477. autoPlay: true,
    478. vis: 5,
    479. trigger: "click",
    480. interTime: 4000
    481. });
    482. };
    483. script>
    484. body>
    485. html>

    8.参考文档

    你可能还有感兴趣的项目👇🏻👇🏻👇🏻

    更多项目推荐:计算机毕业设计项目

    如果大家有任何疑虑,请在下方咨询或评论

  • 相关阅读:
    CodeForces Round #501 (div.3) A~E2
    RK3568平台开发系列讲解(驱动基础篇)驱动模块传参
    GitHub 下载量过百万,阿里 P8 秘密分享的「亿级并发系统设计」
    C++ 12:函数模板,模板函数,类模板
    IP协议-NAT机制(理解网络结构的关键要点)
    认证授权双保驾 身份管理的选择关键 ——华为云OneAccess应用身份管理服务 (第一篇 工具介绍)
    【HackTheBox】dancing(SMB)
    (学习日记)2022.7.26
    flutter系列之:在flutter中使用媒体播放器
    制作linux下grup启动背景图片
  • 原文地址:https://blog.csdn.net/weixin_51966461/article/details/133769847