图片管理
This commit is contained in:
parent
6adbcb3c71
commit
aca61b6b79
|
|
@ -1,6 +1,9 @@
|
||||||
package com.ruoyi.content.controller;
|
package com.ruoyi.content.controller;
|
||||||
|
|
||||||
import com.ruoyi.common.core.controller.BaseController;
|
import com.ruoyi.common.core.controller.BaseController;
|
||||||
|
import com.ruoyi.common.core.domain.AjaxResult;
|
||||||
|
import com.ruoyi.common.core.page.TableDataInfo;
|
||||||
|
import com.ruoyi.content.domain.GalleryPicInfoEx;
|
||||||
import com.ruoyi.content.message.Message;
|
import com.ruoyi.content.message.Message;
|
||||||
import com.ruoyi.content.service.GalleryService;
|
import com.ruoyi.content.service.GalleryService;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
|
|
@ -10,6 +13,9 @@ import org.springframework.stereotype.Controller;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
import org.springframework.web.multipart.MultipartFile;
|
import org.springframework.web.multipart.MultipartFile;
|
||||||
|
|
||||||
|
import javax.servlet.http.HttpServletRequest;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @program: ruoyi->GalleryController
|
* @program: ruoyi->GalleryController
|
||||||
* @description:
|
* @description:
|
||||||
|
|
@ -53,4 +59,56 @@ public class GalleryController extends BaseController {
|
||||||
return msg;
|
return msg;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据栏目图库列表
|
||||||
|
*
|
||||||
|
* @param request
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@RequestMapping("/galleryImgList")
|
||||||
|
@ResponseBody
|
||||||
|
public TableDataInfo galleryImgList(HttpServletRequest request) {
|
||||||
|
LOGGER.info("上传图库图片控制层方法开始");
|
||||||
|
String channel = request.getParameter("channel");
|
||||||
|
String picState = "0";
|
||||||
|
String special = "GALLERY";
|
||||||
|
startPage();
|
||||||
|
List<GalleryPicInfoEx> galleryPicInfos = galleryService.galleryImgList(channel, picState, special);
|
||||||
|
LOGGER.info("查询图库列表的控制层方法结束!");
|
||||||
|
return getDataTable(galleryPicInfos);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 图片删除
|
||||||
|
*
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@RequestMapping("/remove")
|
||||||
|
@ResponseBody
|
||||||
|
public AjaxResult delGalleryPic(String ids) {
|
||||||
|
LOGGER.info("删除图片信息控制层方法开始");
|
||||||
|
try {
|
||||||
|
return toAjax(galleryService.delGalleryPic(ids));
|
||||||
|
} catch (Exception e) {
|
||||||
|
LOGGER.info("删除文章信息失败【{}】", e.getMessage());
|
||||||
|
}
|
||||||
|
LOGGER.info("删除图片信息的控制层方法结束!");
|
||||||
|
return toAjax(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 图片图库栏目录入
|
||||||
|
*
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@PostMapping("/addGallery")
|
||||||
|
@ResponseBody
|
||||||
|
public Message addGallery(String channelId, String picId) {
|
||||||
|
LOGGER.info("图库图片分配栏目控制层方法开始");
|
||||||
|
LOGGER.info(channelId + "------" + picId);
|
||||||
|
Message msg = galleryService.addGallery(channelId, picId);
|
||||||
|
LOGGER.info("图库图片分配栏目控制层方法结束");
|
||||||
|
return msg;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,14 @@
|
||||||
|
package com.ruoyi.content.domain;
|
||||||
|
|
||||||
|
public class GalleryPicInfoEx extends GalleryPicInfo {
|
||||||
|
|
||||||
|
private String codeName;
|
||||||
|
|
||||||
|
public String getCodeName() {
|
||||||
|
return codeName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCodeName(String codeName) {
|
||||||
|
this.codeName = codeName;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -1,6 +1,7 @@
|
||||||
package com.ruoyi.content.mapper;
|
package com.ruoyi.content.mapper;
|
||||||
|
|
||||||
import com.ruoyi.content.domain.GalleryPicInfo;
|
import com.ruoyi.content.domain.GalleryPicInfo;
|
||||||
|
import com.ruoyi.content.domain.GalleryPicInfoEx;
|
||||||
import org.apache.ibatis.annotations.Param;
|
import org.apache.ibatis.annotations.Param;
|
||||||
import org.springframework.stereotype.Repository;
|
import org.springframework.stereotype.Repository;
|
||||||
|
|
||||||
|
|
@ -9,9 +10,8 @@ import java.util.List;
|
||||||
@Repository
|
@Repository
|
||||||
public interface GalleryQueryMapper {
|
public interface GalleryQueryMapper {
|
||||||
|
|
||||||
public List<GalleryPicInfo> selectAllWithLimit(@Param(value = "companyId") String companyId, @Param(value = "branchId") String branchId,
|
public List<GalleryPicInfoEx> selectAllWithLimit(@Param(value = "companyId") String companyId, @Param(value = "branchId") String branchId,
|
||||||
@Param(value = "picState") List<String> picState, @Param(value = "picId") List<Integer> picId,
|
@Param(value = "picState") List<String> picState, @Param(value = "picId") List<Integer> picId);
|
||||||
@Param(value = "startRow") int startRow, @Param(value = "rows") int rows);
|
|
||||||
|
|
||||||
public List<String> selectChannelId(@Param(value = "picId") Integer picId);
|
public List<String> selectChannelId(@Param(value = "picId") Integer picId);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
package com.ruoyi.content.service;
|
package com.ruoyi.content.service;
|
||||||
|
|
||||||
import com.ruoyi.content.domain.GalleryDTO;
|
import com.ruoyi.content.domain.GalleryPicInfoEx;
|
||||||
import com.ruoyi.content.message.Message;
|
import com.ruoyi.content.message.Message;
|
||||||
import org.springframework.web.multipart.MultipartFile;
|
import org.springframework.web.multipart.MultipartFile;
|
||||||
|
|
||||||
|
|
@ -25,7 +25,7 @@ public interface GalleryService {
|
||||||
* @param picState
|
* @param picState
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public List<GalleryDTO> galleryImgList(int startRow, int rows, String channelId, String picState, String special);
|
public List<GalleryPicInfoEx> galleryImgList(String channelId, String picState, String special);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 图片个数
|
* 图片个数
|
||||||
|
|
@ -60,5 +60,5 @@ public interface GalleryService {
|
||||||
* @param ids
|
* @param ids
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public Message delGalleryPic(String ids);
|
public Integer delGalleryPic(String ids);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -130,8 +130,8 @@ public class GalleryServiceImpl implements GalleryService {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<GalleryDTO> galleryImgList(int startRow, int rows, String channelId, String picState, String special) {
|
public List<GalleryPicInfoEx> galleryImgList(String channelId, String picState, String special) {
|
||||||
LOGGER.info("拿到的参数startRow【{}】,rows【{}】,所属栏目【{}】,图片状态【{}】", startRow, rows, channelId, picState);
|
LOGGER.info("拿到的参数,所属栏目【{}】,图片状态【{}】", channelId, picState);
|
||||||
String companyId = "1";// 公司id
|
String companyId = "1";// 公司id
|
||||||
String branchId = "86";
|
String branchId = "86";
|
||||||
List<String> list = new ArrayList<String>();
|
List<String> list = new ArrayList<String>();
|
||||||
|
|
@ -161,32 +161,15 @@ public class GalleryServiceImpl implements GalleryService {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
List<GalleryPicInfo> galleryList = galleryQueryMapper.selectAllWithLimit(companyId, branchId, list, picIds, startRow, rows);
|
List<GalleryPicInfoEx> galleryList = galleryQueryMapper.selectAllWithLimit(companyId, branchId, list, picIds);
|
||||||
if (galleryList == null || galleryList.size() < 1) {
|
if (galleryList == null || galleryList.size() < 1) {
|
||||||
LOGGER.info("未查询到数据");
|
LOGGER.info("未查询到数据");
|
||||||
throw new BusinessException("图库暂没有海报!");
|
throw new BusinessException("图库暂没有海报!");
|
||||||
}
|
}
|
||||||
|
|
||||||
//所属二级栏目
|
//所属二级栏目
|
||||||
List<GalleryDTO> galleryDTOs = new ArrayList<>();
|
for (GalleryPicInfoEx galleryPicInfo : galleryList) {
|
||||||
for (GalleryPicInfo galleryPicInfo : galleryList) {
|
String codeName = "";
|
||||||
GalleryDTO galleryDTO = new GalleryDTO();
|
|
||||||
galleryDTO.setPicId(galleryPicInfo.getPicId());
|
|
||||||
galleryDTO.setImgUrl(galleryPicInfo.getImgUrl());
|
|
||||||
galleryDTO.setPicAdId(galleryPicInfo.getPicAdId());
|
|
||||||
galleryDTO.setPicState(galleryPicInfo.getPicState());
|
|
||||||
galleryDTO.setCompanyId(galleryPicInfo.getCompanyId());
|
|
||||||
galleryDTO.setCreateDate(galleryPicInfo.getCreateDate());
|
|
||||||
galleryDTO.setCreateTime(galleryPicInfo.getCreateTime());
|
|
||||||
LOGGER.info("图库数据【{}】", JsonUtil.objectToJackson(galleryDTO));
|
|
||||||
List<String> codeName = new ArrayList<>();
|
|
||||||
// List<String> channelIds = galleryQueryMapper.selectChannelId(galleryPicInfo.getPicId());
|
|
||||||
// for (String string : channelIds) {
|
|
||||||
// LOGGER.info("栏目id【{}】", string);
|
|
||||||
// BaseCodeExample example = new BaseCodeExample();
|
|
||||||
// BaseCodeExample.Criteria criteria = example.createCriteria();
|
|
||||||
// criteria.andCodeCodeEqualTo(string).andStateEqualTo("0").andCodeTypeEqualTo("GALLERY");
|
|
||||||
|
|
||||||
GalleryChannelExample channelexample = new GalleryChannelExample();
|
GalleryChannelExample channelexample = new GalleryChannelExample();
|
||||||
channelexample.createCriteria().andPicIdEqualTo(galleryPicInfo.getPicId()).andStateEqualTo("0");
|
channelexample.createCriteria().andPicIdEqualTo(galleryPicInfo.getPicId()).andStateEqualTo("0");
|
||||||
List<GalleryChannel> galleryChannels = this.galleryChannelMapper.selectByExample(channelexample);
|
List<GalleryChannel> galleryChannels = this.galleryChannelMapper.selectByExample(channelexample);
|
||||||
|
|
@ -199,14 +182,13 @@ public class GalleryServiceImpl implements GalleryService {
|
||||||
List<BaseCode> baseCodes = this.baseCodeMapper.selectByExample(example);
|
List<BaseCode> baseCodes = this.baseCodeMapper.selectByExample(example);
|
||||||
LOGGER.info("栏目数据【{}】", JsonUtil.objectToJackson(baseCodes));
|
LOGGER.info("栏目数据【{}】", JsonUtil.objectToJackson(baseCodes));
|
||||||
if ((baseCodes != null) && (baseCodes.size() > 0)) {
|
if ((baseCodes != null) && (baseCodes.size() > 0)) {
|
||||||
codeName.add(((BaseCode) baseCodes.get(0)).getCodeCname());
|
codeName = codeName + baseCodes.get(0).getCodeCname() + ",";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
galleryDTO.setCodeName(codeName);
|
galleryPicInfo.setCodeName(StringUtils.isNotBlank(codeName) ? codeName.substring(0, codeName.length() - 1) : "");
|
||||||
galleryDTOs.add(galleryDTO);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return galleryDTOs;
|
return galleryList;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
@ -348,16 +330,13 @@ public class GalleryServiceImpl implements GalleryService {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Message delGalleryPic(String ids) {
|
public Integer delGalleryPic(String ids) {
|
||||||
LOGGER.info("删除图片信息的业务层方法开始!");
|
LOGGER.info("删除图片信息的业务层方法开始!");
|
||||||
LOGGER.info("删除图片信息的业务层方法中拿到的图片的id【{}】", ids);
|
LOGGER.info("删除图片信息的业务层方法中拿到的图片的id【{}】", ids);
|
||||||
Message msg = new Message();
|
|
||||||
if (StringUtils.isBlank(ids)) {
|
if (StringUtils.isBlank(ids)) {
|
||||||
LOGGER.info("删除图片信息失败,缺少参数");
|
LOGGER.info("删除图片信息失败,缺少参数");
|
||||||
throw new ParameterException("未查询到图片信息");
|
throw new ParameterException("未查询到图片信息");
|
||||||
}
|
}
|
||||||
msg.setInfo("删除失败!");
|
|
||||||
msg.setResult(false);
|
|
||||||
try {
|
try {
|
||||||
String[] arrId = ids.split(",");
|
String[] arrId = ids.split(",");
|
||||||
for (String picId : arrId) {
|
for (String picId : arrId) {
|
||||||
|
|
@ -369,8 +348,6 @@ public class GalleryServiceImpl implements GalleryService {
|
||||||
for (GalleryChannel galleryChannel : galleryChannels) {
|
for (GalleryChannel galleryChannel : galleryChannels) {
|
||||||
galleryChannel.setState("1");
|
galleryChannel.setState("1");
|
||||||
if (galleryChannelMapper.updateByPrimaryKey(galleryChannel) > 0) {
|
if (galleryChannelMapper.updateByPrimaryKey(galleryChannel) > 0) {
|
||||||
msg.setInfo("删除成功!");
|
|
||||||
msg.setResult(true);
|
|
||||||
LOGGER.info("删除此图片图库栏目关系成功!");
|
LOGGER.info("删除此图片图库栏目关系成功!");
|
||||||
//redisManager.deleteZSet("gallery_channel_"+galleryChannel.getChannelId(),picId);
|
//redisManager.deleteZSet("gallery_channel_"+galleryChannel.getChannelId(),picId);
|
||||||
// redisManager.delete("gallery_channel_"+galleryChannel.getChannelId());
|
// redisManager.delete("gallery_channel_"+galleryChannel.getChannelId());
|
||||||
|
|
@ -381,8 +358,6 @@ public class GalleryServiceImpl implements GalleryService {
|
||||||
if (galleryPicInfo != null) {
|
if (galleryPicInfo != null) {
|
||||||
galleryPicInfo.setPicState("1");
|
galleryPicInfo.setPicState("1");
|
||||||
if (galleryInfoMapper.updateByPrimaryKey(galleryPicInfo) > 0) {
|
if (galleryInfoMapper.updateByPrimaryKey(galleryPicInfo) > 0) {
|
||||||
msg.setInfo("删除成功!");
|
|
||||||
msg.setResult(true);
|
|
||||||
LOGGER.info("删除图片信息成功!");
|
LOGGER.info("删除图片信息成功!");
|
||||||
redisManager.delete("gallery_pic_Id" + galleryPicInfo.getPicId());
|
redisManager.delete("gallery_pic_Id" + galleryPicInfo.getPicId());
|
||||||
}
|
}
|
||||||
|
|
@ -391,13 +366,10 @@ public class GalleryServiceImpl implements GalleryService {
|
||||||
}
|
}
|
||||||
|
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
LOGGER.info("删除图片信息失败【{}】", e.getMessage());
|
LOGGER.error("删除图片信息失败【{}】", e);
|
||||||
e.printStackTrace();
|
|
||||||
msg.setInfo("删除失败,请稍候再试!");
|
|
||||||
msg.setResult(true);
|
|
||||||
}
|
}
|
||||||
LOGGER.info("删除图片信息的业务层方法结束!");
|
LOGGER.info("删除图片信息的业务层方法结束!");
|
||||||
return msg;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,22 +1,22 @@
|
||||||
<?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.ruoyi.content.mapper.GalleryQueryMapper">
|
<mapper namespace="com.ruoyi.content.mapper.GalleryQueryMapper">
|
||||||
<resultMap id="BaseResultMap" type="com.ruoyi.content.domain.GalleryPicInfo" >
|
<resultMap id="BaseResultMap" type="com.ruoyi.content.domain.GalleryPicInfoEx">
|
||||||
<!--
|
<!--
|
||||||
WARNING - @mbggenerated
|
WARNING - @mbggenerated
|
||||||
This element is automatically generated by MyBatis Generator, do not modify.
|
This element is automatically generated by MyBatis Generator, do not modify.
|
||||||
This element was generated on Mon Jun 11 10:57:31 CST 2018.
|
This element was generated on Mon Jun 11 10:57:31 CST 2018.
|
||||||
-->
|
-->
|
||||||
<id column="PIC_ID" property="picId" jdbcType="INTEGER" />
|
<id column="PIC_ID" property="picId" jdbcType="INTEGER"/>
|
||||||
<result column="IMG_URL" property="imgUrl" jdbcType="VARCHAR" />
|
<result column="IMG_URL" property="imgUrl" jdbcType="VARCHAR"/>
|
||||||
<result column="PIC_AD_ID" property="picAdId" jdbcType="VARCHAR" />
|
<result column="PIC_AD_ID" property="picAdId" jdbcType="VARCHAR"/>
|
||||||
<result column="PIC_STATE" property="picState" jdbcType="VARCHAR" />
|
<result column="PIC_STATE" property="picState" jdbcType="VARCHAR"/>
|
||||||
<result column="COMPANY_ID" property="companyId" jdbcType="VARCHAR" />
|
<result column="COMPANY_ID" property="companyId" jdbcType="VARCHAR"/>
|
||||||
<result column="CREATE_DATE" property="createDate" jdbcType="VARCHAR" />
|
<result column="CREATE_DATE" property="createDate" jdbcType="VARCHAR"/>
|
||||||
<result column="CREATE_TIME" property="createTime" jdbcType="VARCHAR" />
|
<result column="CREATE_TIME" property="createTime" jdbcType="VARCHAR"/>
|
||||||
<result column="CREATE_USER" property="createUser" jdbcType="VARCHAR" />
|
<result column="CREATE_USER" property="createUser" jdbcType="VARCHAR"/>
|
||||||
<result column="UPDATE_DATE" property="updateDate" jdbcType="VARCHAR" />
|
<result column="UPDATE_DATE" property="updateDate" jdbcType="VARCHAR"/>
|
||||||
<result column="UPDATE_TIME" property="updateTime" jdbcType="VARCHAR" />
|
<result column="UPDATE_TIME" property="updateTime" jdbcType="VARCHAR"/>
|
||||||
</resultMap>
|
</resultMap>
|
||||||
|
|
||||||
<sql id="adTitleSQL">
|
<sql id="adTitleSQL">
|
||||||
|
|
@ -30,7 +30,7 @@
|
||||||
pi.PIC_ID,
|
pi.PIC_ID,
|
||||||
pi.IMG_URL,
|
pi.IMG_URL,
|
||||||
(
|
(
|
||||||
<include refid="adTitleSQL" />
|
<include refid="adTitleSQL"/>
|
||||||
) as PIC_AD_ID,
|
) as PIC_AD_ID,
|
||||||
pi.PIC_STATE,
|
pi.PIC_STATE,
|
||||||
pi.COMPANY_ID,
|
pi.COMPANY_ID,
|
||||||
|
|
@ -63,13 +63,10 @@
|
||||||
#{picId}
|
#{picId}
|
||||||
</foreach>
|
</foreach>
|
||||||
</if>
|
</if>
|
||||||
order by pi.CREATE_DATE DESC,pi.CREATE_TIME DESC, pi.UPDATE_DATE
|
order by pi.CREATE_DATE DESC,pi.CREATE_TIME DESC, pi.UPDATE_DATE DESC,pi.UPDATE_TIME DESC
|
||||||
DESC,pi.UPDATE_TIME DESC
|
|
||||||
limit
|
|
||||||
#{startRow,jdbcType=DECIMAL},#{rows,jdbcType=DECIMAL}
|
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<select id="selectChannelId" resultType="java.lang.String" parameterType="java.lang.Integer" >
|
<select id="selectChannelId" resultType="java.lang.String" parameterType="java.lang.Integer">
|
||||||
SELECT distinct CHANNEL_ID
|
SELECT distinct CHANNEL_ID
|
||||||
FROM cms_gallery_channel
|
FROM cms_gallery_channel
|
||||||
WHERE PIC_ID = #{picId,jdbcType=INTEGER} and STATE = '0'
|
WHERE PIC_ID = #{picId,jdbcType=INTEGER} and STATE = '0'
|
||||||
|
|
@ -81,7 +78,7 @@
|
||||||
pi.PIC_ID,
|
pi.PIC_ID,
|
||||||
pi.IMG_URL,
|
pi.IMG_URL,
|
||||||
(
|
(
|
||||||
<include refid="adTitleSQL" />
|
<include refid="adTitleSQL"/>
|
||||||
) as PIC_AD_ID,
|
) as PIC_AD_ID,
|
||||||
pi.PIC_STATE,
|
pi.PIC_STATE,
|
||||||
pi.COMPANY_ID,
|
pi.COMPANY_ID,
|
||||||
|
|
|
||||||
|
|
@ -90,7 +90,7 @@
|
||||||
title: '跳转地址',
|
title: '跳转地址',
|
||||||
formatter: function (value, row, index) {
|
formatter: function (value, row, index) {
|
||||||
var actions = [];
|
var actions = [];
|
||||||
actions.push('<a class="btn btn-xs" href="javascript:void(0)" onclick="$.modal.msg(\'' + row.adLinkUrl + '\');" ><i class="fa"></i>展示</a> ');
|
actions.push('<a class="btn btn-xs" href="javascript:void(0)" onclick="$.modal.alertSuccess(\'' + row.adLinkUrl + '\');" ><i class="fa"></i>展示</a> ');
|
||||||
return actions.join('');
|
return actions.join('');
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,241 @@
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="zh" xmlns:th="http://www.thymeleaf.org">
|
||||||
|
<head>
|
||||||
|
<th:block th:include="include :: header('图片列表')"/>
|
||||||
|
</head>
|
||||||
|
<style>
|
||||||
|
.article-table-img {
|
||||||
|
width: 50px;
|
||||||
|
height: 50px;
|
||||||
|
border-radius: 4px;
|
||||||
|
display: block;
|
||||||
|
border-style: none;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
<body class="gray-bg">
|
||||||
|
<div class="container-div">
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-sm-12 search-collapse">
|
||||||
|
<form id="formId">
|
||||||
|
<div class="select-list">
|
||||||
|
<ul>
|
||||||
|
<li>
|
||||||
|
<label>所属栏目:</label>
|
||||||
|
<div class="col-sm-8">
|
||||||
|
<select name="channel" th:id="channel" class="form-control" required>
|
||||||
|
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
</li>
|
||||||
|
<li>
|
||||||
|
<a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i
|
||||||
|
class="fa fa-search"></i> 搜索</a>
|
||||||
|
<a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset()"><i
|
||||||
|
class="fa fa-refresh"></i> 重置</a>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="btn-group-sm" id="toolbar" role="group">
|
||||||
|
<a class="btn btn-danger multiple disabled" onclick="$.operate.removeAll()">
|
||||||
|
<i class="fa fa-remove"></i> 删除
|
||||||
|
</a>
|
||||||
|
</div>
|
||||||
|
<div class="col-sm-12 select-table table-striped">
|
||||||
|
<table id="bootstrap-table"></table>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="modal inmodal" id="myModal2" tabindex="-1" role="dialog" aria-hidden="true">
|
||||||
|
<div class="modal-dialog">
|
||||||
|
<div class="modal-content animated flipInY">
|
||||||
|
<div class="modal-header">
|
||||||
|
<input th:hidden="true" value="" th:id="pictureId"/>
|
||||||
|
<button type="button" class="close" data-dismiss="modal"><span aria-hidden="true">×</span><span
|
||||||
|
class="sr-only">Close</span>
|
||||||
|
</button>
|
||||||
|
<h5 class="modal-title" style="text-align: left;">分配栏目</h5>
|
||||||
|
</div>
|
||||||
|
<div class="modal-body">
|
||||||
|
<div class="select-list">
|
||||||
|
<ul style="margin-top: -15px;">
|
||||||
|
<li>
|
||||||
|
<label style="width: 80px;"><i style="color: #dc1212">*</i>专栏选择:</label>
|
||||||
|
<div class="col-sm-8">
|
||||||
|
<select th:id="columnId" class="form-control">
|
||||||
|
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="modal-footer">
|
||||||
|
<button type="button" class="btn btn-white" data-dismiss="modal">关闭</button>
|
||||||
|
<button type="button" class="btn btn-primary" th:onclick="saveData()">确定</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<th:block th:include="include :: footer"/>
|
||||||
|
<script th:inline="javascript">
|
||||||
|
var prefix = ctx + "content/gallery";
|
||||||
|
var prefix1 = ctx + "column/queryBasicData";
|
||||||
|
var prefix2 = ctx + "column/queryColumn";
|
||||||
|
var prefix3 = ctx + "content/gallery/addGallery";
|
||||||
|
|
||||||
|
$(function () {
|
||||||
|
var options = {
|
||||||
|
url: prefix + "/galleryImgList",
|
||||||
|
createUrl: prefix + "/add",
|
||||||
|
updateUrl: prefix + "/edit/{id}",
|
||||||
|
removeUrl: prefix + "/remove",
|
||||||
|
exportUrl: prefix + "/export",
|
||||||
|
modalName: "图片列表",
|
||||||
|
columns: [{
|
||||||
|
checkbox: true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
field: 'picId',
|
||||||
|
title: '图片编号',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
field: 'imgUrl',
|
||||||
|
title: '图片',
|
||||||
|
formatter: function (value, row, index) {
|
||||||
|
var actions = [];
|
||||||
|
actions.push('<img class="article-table-img" src="' + row.imgUrl + '" ></img> ');
|
||||||
|
return actions.join('');
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
field: 'picAdId',
|
||||||
|
title: '广告'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
field: 'codeName',
|
||||||
|
title: '所属栏目'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
field: 'picState',
|
||||||
|
title: '状态',
|
||||||
|
formatter: function (value, row, index) {
|
||||||
|
if (row.picState == '0') {
|
||||||
|
return '展示';
|
||||||
|
} else {
|
||||||
|
return '不展示';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
field: 'createDate',
|
||||||
|
title: '创建日期'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
field: 'createTime',
|
||||||
|
title: '创建时间'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '操作',
|
||||||
|
align: 'center',
|
||||||
|
formatter: function (value, row, index) {
|
||||||
|
var actions = [];
|
||||||
|
actions.push('<a class="btn btn-success btn-xs" data-toggle="modal" data-target="#myModal2" onclick="changeId(\'' + row.picId + '\')"><i class="fa fa-object-group"></i>分配栏目</a> ');
|
||||||
|
actions.push('<a class="btn btn-danger btn-xs" href="javascript:void(0)" onclick="$.operate.remove(\'' + row.picId + '\')"><i class="fa fa-remove"></i>删除</a>');
|
||||||
|
return actions.join('');
|
||||||
|
}
|
||||||
|
}]
|
||||||
|
};
|
||||||
|
$.table.init(options);
|
||||||
|
|
||||||
|
$.ajax({
|
||||||
|
type: "post",
|
||||||
|
url: prefix1,
|
||||||
|
data: {
|
||||||
|
"bType": "GALLERY"
|
||||||
|
},
|
||||||
|
async: false,
|
||||||
|
success: function (data) {
|
||||||
|
if (data.result) {// 跳转到列表页面
|
||||||
|
var baseDataList = data.object.baseList;
|
||||||
|
$("#channel").append("<option value=''>请选择</option>");
|
||||||
|
for (var i = 0; i < baseDataList.length; i++) {
|
||||||
|
$("#channel").append("<option value='" + baseDataList[i].codeCode + "' data-value='" + baseDataList[i].codeType + "'>" + baseDataList[i].codeCname + "</option>");
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
$.ajax({
|
||||||
|
type: "post",
|
||||||
|
url: prefix2,
|
||||||
|
data: {},
|
||||||
|
async: false,
|
||||||
|
success: function (data) {
|
||||||
|
if (data.result) {
|
||||||
|
var obj = data.object.columnList;
|
||||||
|
for (var i = 0; i < obj.length; i++) {
|
||||||
|
if (obj[i].codeType == "FIRST_COLUMN" && obj[i].codeCode.indexOf("GALLERY") != -1) {
|
||||||
|
$("#columnId").append("<optgroup id=" + obj[i].codeCode + " label=" + obj[i].codeCname + "></optgroup>");
|
||||||
|
}
|
||||||
|
//先循环出标签并给标签id
|
||||||
|
if (obj[i].codeType != "FIRST_COLUMN") {
|
||||||
|
if (obj[i].codeType == "GALLERY") {
|
||||||
|
$("#GALLERY").append("<option value='" + obj[i].id + "'>" + obj[i].codeCname + "</option>");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (obj[i].codeType == "INCREASE_GALLERY") {
|
||||||
|
if ($("#INCREASE_GALLERY").length == 0) {
|
||||||
|
$("#columnId").append("<optgroup id='INCREASE_GALLERY' label='增员图库'></optgroup>");
|
||||||
|
}
|
||||||
|
$("#INCREASE_GALLERY").append("<option value='" + obj[i].id + "'>" + obj[i].codeCname + "</option>");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
function changeId(id) {
|
||||||
|
$('#pictureId').val(id);
|
||||||
|
}
|
||||||
|
|
||||||
|
function saveData() {
|
||||||
|
// 打开遮罩层
|
||||||
|
$.modal.loading("请稍后...");
|
||||||
|
var channelId = $('#columnId').val();//栏目id
|
||||||
|
var picId = $('#pictureId').val();
|
||||||
|
$.ajax({
|
||||||
|
url: prefix3,
|
||||||
|
data: {
|
||||||
|
"channelId": channelId,
|
||||||
|
"picId": picId,
|
||||||
|
},
|
||||||
|
dataType: "json",
|
||||||
|
type: "post",
|
||||||
|
cache: false,
|
||||||
|
success: function (data) {
|
||||||
|
const code = {
|
||||||
|
'code': 0
|
||||||
|
};
|
||||||
|
$.operate.successCallback(code);
|
||||||
|
},
|
||||||
|
error: function (textStatus, e) {
|
||||||
|
const code = {
|
||||||
|
'code' : 500,
|
||||||
|
'msg' : '操作失败'
|
||||||
|
}
|
||||||
|
$.operate.successCallback(code);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
|
|
@ -71,7 +71,7 @@
|
||||||
title: '广告链接',
|
title: '广告链接',
|
||||||
formatter: function (value, row, index) {
|
formatter: function (value, row, index) {
|
||||||
var actions = [];
|
var actions = [];
|
||||||
actions.push('<a class="btn btn-xs" href="javascript:void(0)" onclick="$.modal.msg(\'' + row.picAdUrl + '\');" ><i class="fa"></i>展示</a> ');
|
actions.push('<a class="btn btn-xs" href="javascript:void(0)" onclick="$.modal.alertSuccess(\'' + row.picAdUrl + '\');" ><i class="fa"></i>展示</a> ');
|
||||||
return actions.join('');
|
return actions.join('');
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue