文章管理

This commit is contained in:
zkr_liushenlu 2021-04-01 10:06:29 +08:00
parent 777fc2b301
commit 1dbbb76eb3
17 changed files with 563 additions and 180 deletions

View File

@ -7,11 +7,16 @@ package com.ruoyi.content.constants;
*/
public class PropertiesConstants {
public static final String TEMPLATE_VIEW_PATH = "/WEB-INF/static/template/view.flt";
public static final String TEMPLATE_EDIT_PATH = "/WEB-INF/static/template/edit.flt";
// public static final String TEMPLATE_VIEW_PATH = "/WEB-INF/static/template/view.flt";
// public static final String TEMPLATE_EDIT_PATH = "/WEB-INF/static/template/edit.flt";
//
// public static final String FILE_PATH = "/app/contentMKTCms/webapp/WEB-INF/static/";
// public static final String PROJECT_LOCALPATH = "/app/contentMKTCms/webapp";
public static final String TEMPLATE_VIEW_PATH = "view.flt";
public static final String TEMPLATE_EDIT_PATH = "edit.flt";
public static final String FILE_PATH = "/app/contentMKTCms/webapp/WEB-INF/static/";
public static final String PROJECT_LOCALPATH = "/app/contentMKTCms/webapp";
public static final String FILE_PATH = "/Users/liushenlu/Desktop/";
public static final String PROJECT_LOCALPATH = "/Users/liushenlu/Desktop";
public static final String ONLINE_IMG_PATH = "network/article/";
public static final String OSS_URL = "http://cdn.sinosoftec.com/";
public static final String OSS_URL_HTTPS = "https://cdn.sinosoftec.com/";

View File

@ -6,7 +6,9 @@ import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.content.domain.ArticleAdInfo;
import com.ruoyi.content.domain.CmsArticleAdInfo;
import com.ruoyi.content.message.Message;
import com.ruoyi.content.service.ICmsArticleAdInfoService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
@ -14,7 +16,9 @@ import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import java.util.List;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.util.*;
/**
* 文章广告Controller
@ -36,6 +40,30 @@ public class AdvertisementController extends BaseController {
return prefix + "/adverts";
}
/**
* 查询所有广告列表本程序调用
*
* @param request
* @param response
* @return
*/
@RequestMapping("/queryAdvertisements")
@ResponseBody
public Message queryAdvertisements(HttpServletRequest request, HttpServletResponse response) {
response.setHeader("Access-Control-Allow-Origin", "*");
Thread.currentThread().setName(UUID.randomUUID().toString());
Message msg = new Message();
Map<String, Object> adMap = new HashMap<>();
String companyId = "1";
// 广告列表信息
List<ArticleAdInfo> advertiseAdList = cmsArticleAdInfoService.queryAdByCompanyId(companyId);
adMap.put("advertiseAdList", advertiseAdList);
msg.setInfo("成功");
msg.setObject(adMap);
msg.setResult(true);
return msg;
}
/**
* 查询文章广告列表
*/

View File

@ -151,13 +151,15 @@ public class ArticleManageController extends BaseController {
Thread.currentThread().setName(UUID.randomUUID().toString());
Message msg = new Message();
logger.info("通过文章链接获取文章内容控制层方法开始");
String createUser = request.getParameter("createUser");
// String createUser = request.getParameter("createUser");
String createUser = "13152783264";
if (StringUtils.isBlank(createUser)) {
logger.info("用户已离线");
throw new BusinessException("通过文章链接获取文章内容,用户已离线");
}
String originalUrl = request.getParameter("originalUrl"); // 文章连接,如果是通过连接导入文章,则必传
String author = request.getParameter("author"); // 作者
// String author = request.getParameter("author"); // 作者
String author = "13152783264";
String ids = request.getParameter("ids"); // 广告ids
String isAuthorization = request.getParameter("isAuthorization"); // 是否授权
String isReserve = request.getParameter("isReserve"); // 是否预约

View File

@ -5,6 +5,7 @@ import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.content.domain.BaseCode;
import com.ruoyi.content.domain.BaseCodeTree;
import com.ruoyi.content.domain.ZtreeDto;
import com.ruoyi.content.message.Message;
import com.ruoyi.content.service.BaseCodeService;
import com.ruoyi.content.utils.DateUtil;
@ -20,7 +21,6 @@ import org.springframework.web.bind.annotation.ResponseBody;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.Serializable;
import java.util.*;
/**
@ -68,12 +68,11 @@ public class BaseCodeController extends BaseController {
* 添加栏目
*
* @param request
* @param response
* @return
*/
@RequestMapping("/addColumn")
@ResponseBody
public Message addColumn(HttpServletRequest request, HttpServletResponse response) {
public Message addColumn(HttpServletRequest request) {
logger.info("进入新建栏目控制层方法");
Message msg = new Message();
Thread.currentThread().setName(UUID.randomUUID().toString());
@ -115,12 +114,11 @@ public class BaseCodeController extends BaseController {
* 更新栏目信息
*
* @param request
* @param response
* @return
*/
@RequestMapping("/updateColumn")
@ResponseBody
public Message updateColumn(HttpServletRequest request, HttpServletResponse response) {
public Message updateColumn(HttpServletRequest request) {
logger.info("进入更新栏目控制层方法");
Message msg = new Message();
Thread.currentThread().setName(UUID.randomUUID().toString());
@ -166,12 +164,11 @@ public class BaseCodeController extends BaseController {
* 修改栏目信息
*
* @param request
* @param response
* @return
*/
@RequestMapping("/changeState")
@ResponseBody
public Message changeState(HttpServletRequest request, HttpServletResponse response) {
public Message changeState(HttpServletRequest request) {
logger.info("进入修改栏目状态栏目控制层方法");
Message msg = new Message();
Thread.currentThread().setName(UUID.randomUUID().toString());
@ -220,8 +217,7 @@ public class BaseCodeController extends BaseController {
Message msg = new Message();
Map<String, Object> policyMap = new HashMap<String, Object>();
// 银行列表信息
List<BaseCode> bankList = new ArrayList<BaseCode>();
bankList = baseCodeService.queryBaseCodeByType(basicType);
List<BaseCode> bankList = baseCodeService.queryBaseCodeByType(basicType);
policyMap.put("baseList", bankList);
msg.setInfo("成功");
msg.setObject(policyMap);
@ -232,14 +228,12 @@ public class BaseCodeController extends BaseController {
/**
* 获取栏目全部信息
*
* @param request
* @param response
* @return
* @throws Exception
*/
@RequestMapping(value = "/queryColumn")
@ResponseBody
public Message getColumn(HttpServletRequest request, HttpServletResponse response) throws Exception {
public Message getColumn(HttpServletResponse response) {
response.setHeader("Access-Control-Allow-Origin", "*");
Message msg = new Message();
Map<String, Object> policyMap = new HashMap<String, Object>();
@ -262,148 +256,57 @@ public class BaseCodeController extends BaseController {
*/
@RequestMapping(value = "/columnTree")
@ResponseBody
public List<Ztree> columnTree(HttpServletRequest request, HttpServletResponse response) throws Exception {
public List<ZtreeDto> columnTree(HttpServletRequest request, HttpServletResponse response) {
response.setHeader("Access-Control-Allow-Origin", "*");
Message msg = new Message();
Map<String, Object> policyMap = new HashMap<String, Object>();
String codeCode = request.getParameter("codeCode");
String codeType = request.getParameter("codeType");
String flag = request.getParameter("flag");
// 查询栏目树
List<BaseCodeTree> columnList = baseCodeService.columnTree(codeCode, codeType);
// policyMap.put("columnList", columnList);
// msg.setInfo("成功");
// msg.setObject(policyMap);
// msg.setResult(true);
List<ZtreeDto> columnList = baseCodeService.columnTree(codeCode, codeType);
return initZtree(columnList, flag);
}
public List<Ztree> initZtree(List<BaseCodeTree> deptList, String flag) {
/**
* 获取栏目树
*
* @param request
* @param response
* @return
* @throws Exception
*/
@RequestMapping(value = "/columnTrees")
@ResponseBody
public List<ZtreeDto> columnTrees(HttpServletRequest request, HttpServletResponse response) {
response.setHeader("Access-Control-Allow-Origin", "*");
String codeCode = request.getParameter("codeCode");
String codeType = request.getParameter("codeType");
String flag = request.getParameter("flag");
// 查询栏目树
List<ZtreeDto> columnList = baseCodeService.columnTrees(codeCode, codeType);
List<Ztree> ztreeList = new ArrayList<>();
return initZtree(columnList, flag);
}
public List<ZtreeDto> initZtree(List<ZtreeDto> deptList, String flag) {
if (deptList != null && deptList.size() > 0) {
if (StringUtils.isBlank(flag)) {
Ztree z = new Ztree();
ZtreeDto z = new ZtreeDto();
z.setId("FIRST_COLUMN");
z.setpId("");
z.setName("栏目");
z.setTitle("栏目");
ztreeList.add(z);
deptList.add(z);
} else if (StringUtils.equals(flag, "1")) {
Ztree z = new Ztree();
ZtreeDto z = new ZtreeDto();
z.setId("ARTICLE");
z.setpId("");
z.setName("文库");
z.setTitle("文库");
ztreeList.add(z);
}
for (BaseCodeTree dept : deptList) {
Ztree ztree = new Ztree();
ztree.setId(dept.getCodeCode());
ztree.setpId(dept.getCodeType());
ztree.setName(dept.getCodeCname());
ztree.setTitle(dept.getCodeCname());
ztreeList.add(ztree);
deptList.add(z);
}
}
return ztreeList;
}
static class Ztree implements Serializable {
private static final long serialVersionUID = 1L;
/**
* 节点ID
*/
private String id;
/**
* 节点父ID
*/
private String pId;
/**
* 节点名称
*/
private String name;
/**
* 节点标题
*/
private String title;
/**
* 是否勾选
*/
private boolean checked = false;
/**
* 是否展开
*/
private boolean open = false;
/**
* 是否能勾选
*/
private boolean nocheck = false;
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public String getpId() {
return pId;
}
public void setpId(String pId) {
this.pId = pId;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getTitle() {
return title;
}
public void setTitle(String title) {
this.title = title;
}
public boolean isChecked() {
return checked;
}
public void setChecked(boolean checked) {
this.checked = checked;
}
public boolean isOpen() {
return open;
}
public void setOpen(boolean open) {
this.open = open;
}
public boolean isNocheck() {
return nocheck;
}
public void setNocheck(boolean nocheck) {
this.nocheck = nocheck;
}
return deptList;
}
/**

View File

@ -0,0 +1,107 @@
package com.ruoyi.content.domain;
import java.io.Serializable;
/**
* @program: ruoyi->ZtreeDto
* @description:
* @author: LiuShenlu
* @create: 2021-03-31 10:16
**/
public class ZtreeDto implements Serializable {
private static final long serialVersionUID = 1L;
/**
* 节点ID
*/
private String id;
/**
* 节点父ID
*/
private String pId;
/**
* 节点名称
*/
private String name;
/**
* 节点标题
*/
private String title;
/**
* 是否勾选
*/
private boolean checked = false;
/**
* 是否展开
*/
private boolean open = false;
/**
* 是否能勾选
*/
private boolean nocheck = false;
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public String getpId() {
return pId;
}
public void setpId(String pId) {
this.pId = pId;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getTitle() {
return title;
}
public void setTitle(String title) {
this.title = title;
}
public boolean isChecked() {
return checked;
}
public void setChecked(boolean checked) {
this.checked = checked;
}
public boolean isOpen() {
return open;
}
public void setOpen(boolean open) {
this.open = open;
}
public boolean isNocheck() {
return nocheck;
}
public void setNocheck(boolean nocheck) {
this.nocheck = nocheck;
}
}

View File

@ -2,6 +2,7 @@ package com.ruoyi.content.mapper;
import com.ruoyi.content.domain.BaseCode;
import com.ruoyi.content.domain.BaseCodeTree;
import com.ruoyi.content.domain.ZtreeDto;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;
@ -23,4 +24,7 @@ public interface BaseCodeExMapper {
public List<BaseCodeTree> getNextNodeTree(HashMap<String, String> parMap);
List<ZtreeDto> columnTrees(HashMap<String, String> parMap);
List<ZtreeDto> getNextNodeTrees(HashMap map);
}

View File

@ -2,6 +2,7 @@ package com.ruoyi.content.service;
import com.ruoyi.content.domain.BaseCode;
import com.ruoyi.content.domain.BaseCodeTree;
import com.ruoyi.content.domain.ZtreeDto;
import com.ruoyi.content.message.Message;
import java.util.List;
@ -87,7 +88,7 @@ public interface BaseCodeService {
* @param codeType
* @return
*/
public List<BaseCodeTree> columnTree(String codeCode, String codeType);
public List<ZtreeDto> columnTree(String codeCode, String codeType);
/**
* 操作栏目排序
@ -106,4 +107,5 @@ public interface BaseCodeService {
*/
List<BaseCodeTree> baseColumnTree(String codeCode);
List<ZtreeDto> columnTrees(String codeCode, String codeType);
}

View File

@ -2,6 +2,7 @@ package com.ruoyi.content.service;
import java.util.List;
import com.ruoyi.content.domain.ArticleAdInfo;
import com.ruoyi.content.domain.CmsArticleAdInfo;
import org.springframework.web.multipart.MultipartFile;
@ -61,4 +62,6 @@ public interface ICmsArticleAdInfoService {
* @return 结果
*/
public int deleteCmsArticleAdInfoById(Long adId);
List<ArticleAdInfo> queryAdByCompanyId(String companyId);
}

View File

@ -3,6 +3,7 @@ package com.ruoyi.content.service.impl;
import com.ruoyi.content.domain.BaseCode;
import com.ruoyi.content.domain.BaseCodeExample;
import com.ruoyi.content.domain.BaseCodeTree;
import com.ruoyi.content.domain.ZtreeDto;
import com.ruoyi.content.exception.ParameterException;
import com.ruoyi.content.mapper.BaseCodeExMapper;
import com.ruoyi.content.mapper.BaseCodeMapper;
@ -31,6 +32,17 @@ import java.util.Set;
@Service
public class BaseCodeServiceImpl implements BaseCodeService {
private static final Logger logger = LoggerFactory.getLogger(BaseCodeServiceImpl.class);
static List<String> columnList = new ArrayList<>();
static {
columnList.add("INCREASE_ARTICLE");
columnList.add("ARTICLE");
columnList.add("GALLERY");
columnList.add("FIRST_COLUMN");
columnList.add("INCREASE_GALLERY");
}
@Autowired
private BaseCodeMapper baseCodeMapper;
@Autowired
@ -350,6 +362,7 @@ public class BaseCodeServiceImpl implements BaseCodeService {
logger.info("删除的redis的key是" + "baseCode_companyId" + companyId + "_branchId" + baseCode.getBranchId() + "_" + delCodeType);
redisManager.delete("baseCode_companyId" + companyId + "_branchId" + baseCode.getBranchId() + "_" + delCodeType);
}
recursionDelete(baseCode);
logger.info("成功删除栏目状态!");
} else {
logger.info("删除栏目状态失败!");
@ -370,6 +383,25 @@ public class BaseCodeServiceImpl implements BaseCodeService {
return 1;
}
private void recursionDelete(BaseCode baseCode) {
if (!columnList.contains(baseCode.getCodeType())) {
return;
}
BaseCodeExample example = new BaseCodeExample();
example.createCriteria().andCodeTypeEqualTo(baseCode.getCodeCode());
List<BaseCode> baseCodeList = baseCodeMapper.selectByExample(example);
if (baseCodeList != null && baseCodeList.size() > 0) {
for (BaseCode base : baseCodeList) {
//标志位0:有效1:无效;2删除
base.setState("2");
base.setUpdateTime(DateUtil.getDate());
base.setUpdateUser("");
baseCodeMapper.updateByPrimaryKeySelective(base);
recursionDelete(base);
}
}
}
/**
* 分页查询栏目信息
*/
@ -454,45 +486,35 @@ public class BaseCodeServiceImpl implements BaseCodeService {
}
@Override
public List<BaseCodeTree> columnTree(String codeCode, String codeType) {
public List<ZtreeDto> columnTree(String codeCode, String codeType) {
logger.info("进入查询栏目树的方法");
if (StringUtils.isAllBlank(codeCode, codeType)) {
logger.info("查询栏目树请求参数不正确codeCode【{}】", codeCode);
throw new ParameterException("创建失败,参数不足!");
}
List<BaseCodeTree> list = null;
String companyId = "1";
String branchId = "86";
String state = "0";
HashMap<String, String> parMap = new HashMap<String, String>();
HashMap<String, String> parMap = new HashMap<>();
parMap.put("codeCode", codeCode);
parMap.put("companyId", companyId);
parMap.put("companyId", "1");
parMap.put("state", state);
parMap.put("codeType", codeType);
if (!"86".equals(branchId)) {
parMap.put("branchId", branchId);
}
list = baseCodeExMapper.columnTree(parMap);
List<BaseCodeTree> baseCodeList = new ArrayList<>();
if (list != null && list.size() > 0) {
recursion(list, baseCodeList);
}
List<ZtreeDto> list = baseCodeExMapper.columnTrees(parMap);
logger.info("查询栏目树结束,查询到的结果为【{}】" + JsonUtil.objectToJackson(list));
logger.info("查询栏目信息的方法结束!");
return baseCodeList;
return list;
}
private void recursion(List<BaseCodeTree> baseCodeList, List<BaseCodeTree> list1) {
for (BaseCodeTree baseCode : baseCodeList) {
private void recursion(List<ZtreeDto> baseCodeList, List<ZtreeDto> list1, String companyId, String state, String branchId) {
for (ZtreeDto baseCode : baseCodeList) {
HashMap map = new HashMap();
map.put("CODE_CODE", baseCode.getCodeCode());
map.put("parentCompanyId", baseCode.getCompanyId());
map.put("parentState", baseCode.getState());
map.put("parentBranchId", baseCode.getBranchId());
List<BaseCodeTree> list = baseCodeExMapper.getNextNodeTree(map);
map.put("CODE_CODE", baseCode.getId());
map.put("parentCompanyId", companyId);
map.put("parentState", state);
map.put("parentBranchId", branchId);
List<ZtreeDto> list = baseCodeExMapper.getNextNodeTrees(map);
list1.add(baseCode);
if (list != null && list.size() > 0) {
recursion(list, list1);
recursion(list, list1, companyId, state, branchId);
}
}
}
@ -587,6 +609,26 @@ public class BaseCodeServiceImpl implements BaseCodeService {
return msg;
}
@Override
public List<ZtreeDto> columnTrees(String codeCode, String codeType) {
logger.info("进入查询栏目树的方法");
String branchId = "86";
String state = "0";
HashMap<String, String> parMap = new HashMap<>();
parMap.put("codeCode", codeCode);
parMap.put("companyId", "1");
parMap.put("state", state);
parMap.put("codeType", codeType);
if (!"86".equals(branchId)) {
parMap.put("branchId", branchId);
}
List<ZtreeDto> list = baseCodeExMapper.columnTrees(parMap);
List<ZtreeDto> list1 = new ArrayList<>();
recursion(list, list1, "1", state, branchId);
logger.info("查询栏目信息的方法结束!");
return list1;
}
@Override
public List<BaseCodeTree> baseColumnTree(String codeCode) {
logger.info("进入查询栏目树的方法");

View File

@ -2,7 +2,9 @@ package com.ruoyi.content.service.impl;
import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.content.constants.PropertiesConstants;
import com.ruoyi.content.domain.ArticleAdInfo;
import com.ruoyi.content.domain.CmsArticleAdInfo;
import com.ruoyi.content.mapper.ArticleAdQueryMapper;
import com.ruoyi.content.mapper.CmsArticleAdInfoMapper;
import com.ruoyi.content.redis.RedisManager;
import com.ruoyi.content.service.ICmsArticleAdInfoService;
@ -14,6 +16,7 @@ import org.springframework.stereotype.Service;
import org.springframework.web.multipart.MultipartFile;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
/**
@ -30,6 +33,8 @@ public class CmsArticleAdInfoServiceImpl implements ICmsArticleAdInfoService {
@Autowired
private CmsArticleAdInfoMapper cmsArticleAdInfoMapper;
@Autowired
private ArticleAdQueryMapper articleAdQueryMapper;
@Autowired
private RedisManager redisManager;
/**
@ -171,4 +176,12 @@ public class CmsArticleAdInfoServiceImpl implements ICmsArticleAdInfoService {
public int deleteCmsArticleAdInfoById(Long adId) {
return cmsArticleAdInfoMapper.deleteCmsArticleAdInfoById(adId);
}
@Override
public List<ArticleAdInfo> queryAdByCompanyId(String companyId) {
LOGGER.info("获取到的公司companyId[{}]",companyId);
List<ArticleAdInfo> adList = articleAdQueryMapper.queryAdByCompanyId(companyId);
LOGGER.info("该公司查询到的广告【{}】", adList.size());
return adList;
}
}

View File

@ -121,4 +121,49 @@
order by ORDER_NO*1,CREATE_TIME
</select>
<select id="columnTrees" resultType="com.ruoyi.content.domain.ZtreeDto" parameterType="map">
select CODE_CODE id,
CODE_TYPE pId,
CODE_CNAME name,
CODE_CNAME title
from base_code
<where>
<if test="codeCode != null and codeCode !=''">
and CODE_CODE = #{codeCode,jdbcType=VARCHAR}
</if>
<if test="codeType != null and codeType !=''">
and CODE_TYPE = #{codeType,jdbcType=VARCHAR}
</if>
<if test="companyId != null and companyId !=''">
and COMPANY_ID = #{companyId,jdbcType=VARCHAR}
</if>
<if test="state != null and state !=''">
and STATE = #{state,jdbcType=VARCHAR}
</if>
<if test="branchId != null and branchId !=''">
and BRANCH_ID like concat("%",concat(#{branchId,jdbcType=VARCHAR},"%"))
</if>
</where>
order by ORDER_NO*1,CREATE_TIME
</select>
<select id="getNextNodeTrees" resultType="com.ruoyi.content.domain.ZtreeDto" parameterType="map">
select CODE_CODE id,
CODE_TYPE pId,
CODE_CNAME name,
CODE_CNAME title
from base_code
WHERE CODE_TYPE = #{CODE_CODE}
<if test="parentCompanyId != null and parentCompanyId !=''">
and COMPANY_ID = #{parentCompanyId}
</if>
<if test="parentState != null and parentState !=''">
and STATE = #{parentState}
</if>
<if test="parentBranchId != null and parentBranchId !=''">
and BRANCH_ID like concat("%",concat(#{parentBranchId},"%"))
</if>
order by ORDER_NO*1,CREATE_TIME
</select>
</mapper>

View File

@ -44,7 +44,7 @@
<a class="btn btn-success" onclick="$.operate.add()">
<i class="fa fa-plus"></i> 添加
</a>
<a class="btn btn-danger multiple disabled" onclick="$.operate.removeAll()">
<a class="btn btn-danger multiple" onclick="$.operate.removeAll()">
<i class="fa fa-remove"></i> 删除
</a>
</div>

View File

@ -49,10 +49,10 @@
<a class="btn btn-primary" onclick="includeArticle(1)">
<i class="fa fa-plus"></i> 批量收录
</a>
<a class="btn btn-danger single disabled" style="margin-left: 15px;" onclick="includeArticle(2)">
<a class="btn btn-danger" style="margin-left: 15px;" onclick="includeArticle(2)">
<i class="fa fa-remove"></i> 批量移除
</a>
<a class="btn btn-success single disabled" style="margin-left: 15px;" onclick="includeArticle(2)">
<a class="btn btn-success" style="margin-left: 15px;" data-toggle="modal" data-target="#myModal4">
<i class="fa fa-newspaper-o"></i> 创建文章
</a>
</div>
@ -180,6 +180,72 @@
</div>
</div>
</div>
<div class="modal inmodal" id="myModal4" tabindex="-1" role="dialog" aria-hidden="true">
<div class="modal-dialog" style="width: 800px;">
<div class="modal-content animated fadeIn">
<div class="modal-header" style="border-bottom: 0px solid #e5e5e5; padding: 15px 15px;">
<button type="button" class="close" data-dismiss="modal"><span aria-hidden="true">&times;</span><span
class="sr-only">Close</span>
</button>
<h5 class="modal-title" style="text-align: left; font-size: 23px;">创建文章</h5>
</div>
<div class="modal-body" style="background: #ffffff;">
<form class="form-horizontal m" id="form-picAdverts-add3">
<div class="col-md-12" style="margin-top: -15px;">
<div class="form-group">
<label class="col-sm-4 control-label">广告添加:</label>
<div class="col-sm-8">
<select th:name="advertisementTypeInit" th:id="advertisementTypeInit"
class="form-control">
</select>
</div>
</div>
<div class="form-group">
<label class="col-sm-4 control-label">标签添加:</label>
<div class="col-sm-8">
<select th:name="labelTypeInit" th:id="labelTypeInit"
class="form-control">
</select>
</div>
</div>
<div class="form-group">
<label class="col-sm-4 control-label">必须授权才能观看:</label>
<div class="col-sm-8">
<input type="checkbox" id="isAuthorization" style="margin-top: 9px;">
</div>
</div>
<div class="form-group">
<label class="col-sm-4 control-label">是否添加预约按钮:</label>
<div class="col-sm-8">
<input type="checkbox" id="isReserve" style="margin-top: 9px;">
</div>
</div>
<div class="form-group">
<label class="col-sm-4 control-label">优选活动报名:</label>
<div class="col-sm-8">
<input type="checkbox" id="isJoinActive" style="margin-top: 9px;">
</div>
</div>
<div class="form-group">
<label class="col-sm-4 control-label is-required">创建文章地址:</label>
<div class="col-sm-8">
<textarea style="height: 70px;" id="ccomment" name="comment" class="form-control"
placeholder="复制任意微信文章链接格式类似http://mp.weixin.qq.com/s/XXXXXX一键导入重新发布即可实现对文章观看情况的追踪。"
required></textarea>
</div>
</div>
</div>
</form>
</div>
<div class="modal-footer" style="border-top: 0px solid #e5e5e5;">
<button type="button" class="btn btn-white" data-dismiss="modal" th:id="modalColse">关闭</button>
<button type="button" class="btn btn-primary" th:onclick="importArticle()">导入文章</button>
</div>
</div>
</div>
</div>
<th:block th:include="include :: footer"/>
<th:block th:include="include :: layout-latest-js"/>
<th:block th:include="include :: ztree-js"/>
@ -371,6 +437,9 @@
cloumnTreeInit();
ldcomList();
advertisementTypeInit();
labelTypeInit();
layui.use('laydate', function () {
var laydate = layui.laydate;
@ -590,7 +659,7 @@
//移除绑定事件
$('#sure').unbind('click');
$('#myModal1').modal('show');
const url = ctx + "column/columnTree?codeType=ARTICLE&flag=1";
const url = ctx + "column/columnTrees?codeType=ARTICLE&flag=1";
let options = {
url: url,
expandLevel: 1, // 展开等级节点
@ -939,27 +1008,188 @@
function loadPreviewData(id) {
$.ajax({
url : prefix + "/preview",
data : {
"publishId" : id
url: prefix + "/preview",
data: {
"publishId": id
},
dataType : "json",
type : "post",
cache : false,
success : function(data) {
dataType: "json",
type: "post",
cache: false,
success: function (data) {
if (data.result) {
$.modal.open('文章预览', data.object.editUrl)
}else{
} else {
$.modal.alertError("预览失败,请稍后重试!");
}
},
error : function(textStatus, e) {
error: function (textStatus, e) {
$.modal.alertError('系统异常,请稍后重试!');
}
});
}
//广告列表初始化
function advertisementTypeInit() {
$.ajax({
type: "post",
url: path + 'content/adverts/queryAdvertisements',
data: {},
async: false,
success: function (data) {
if (data.result) {
let obj = data.object.advertiseAdList;
for (let i = 0; i < obj.length; i++) {
if (i > 0) {
if (obj[i].adTypeName == obj[i - 1].adTypeName) {
$("#advertisementTypeInit").append(
"<option value='" + obj[i].adId + "'>"
+ obj[i].adTitle + "</option>");
} else {
// 除了名片的其他类型都按类型名显示
$("#advertisementTypeInit").append(
"<optgroup label=" + obj[i].adTypeName
+ "></optgroup>");
$("#advertisementTypeInit").append(
"<option value='" + obj[i].adId + "'>"
+ obj[i].adTypeName + "</option>");
}
} else {
$("#advertisementTypeInit").append(
"<optgroup label=" + obj[i].adTypeName
+ "></optgroup>");
$("#advertisementTypeInit").append(
"<option value='" + obj[i].adId + "'>"
+ obj[i].adTitle + "</option>");
}
}
} else {
$.modal.alertError("网络异常,请稍后再试!");
}
}
});
}
/* 查询标签信息 */
function labelTypeInit() {
$.ajax({
type: "post",
url: path + 'label/queryLabel',
data: {},
async: false,
success: function (data) {
if (data.result) {
var obj = data.object.labelList;
$("#labelTypeInit").append(
"<optgroup id=" + "LABEL" + " label=" + "标签"
+ "></optgroup>");
for (var i = 0; i < obj.length; i++) {
$("#LABEL").append(
"<option value='" + obj[i].labelId + "'>"
+ obj[i].labelName + "</option>");
}
} else {
$.modal.alertError("网络异常,请稍后再试!");
}
}
});
}
function importArticle() {
let ids = [];
let labelIds = [];
let length = $("#advertisementTypeInit option:selected").length;
if (length > 1) {
$.modal.alertError("请选择一条广告!")
return false;
}
$("#advertisementTypeInit option:selected").each(function () {
ids.push($(this).val())
})
$("#labelTypeInit option:selected").each(function () {
labelIds.push($(this).val())
})
let email = $("#email").val();
let isWarrant = $("#isAuthorization").prop('checked');
let isReservation = $("#isReserve").prop('checked');
let isAddActive = $("#isJoinActive").prop('checked');
if (isWarrant) { // 1授权 0未授权
var isAuthorization = "1";
} else {
var isAuthorization = "0";
}
let automaticName = "";
let introduction = "";
if (isReservation) { // 1预约 0不预约
var isReserve = "1";
if (automaticName == '' || introduction == '') {
$.modal.alertError('您填写的按钮名称或预约介绍为空,请重新输入');
return;
}
} else {
var isReserve = "0";
}
if (isAddActive) {//1添加活动0不添加
var isJoinActive = "1";
} else {
var isJoinActive = "0";
}
let originalUrl = $("#ccomment").val();
// if (originalUrl.indexOf("mp.weixin.qq.com") == -1) {
// $.modal.alertError("文章链接格式不正确!应为微信文章链接");
// return;
// }
$('#myModal4').modal('hide');
$.modal.loading("导入中请等待。。。");
$.ajax({
url: path + "article/getArticleContentByUrl",
data: {
'author': email,
'createUser': email,
'ids': ids.join(','),
'isAuthorization': isAuthorization,
'isReserve': isReserve,
'automaticName': automaticName,
'introduction': introduction,
'labelIds': labelIds.join(','),
'isJoinActive': isJoinActive,
'originalUrl': originalUrl
},
type: "post",
success: function (data) {
$.modal.closeLoading();
if (data.result) {
debugger
localStorage.setItem("nryx_articleContent", data.object.articleContent); // 文章内容
localStorage.setItem("nryx_originalUrl", data.object.originalUrl); // 文章链接
// //文章名称
localStorage.setItem("nryx_articleName", data.object.articleName); // 文章名称
localStorage.setItem("nryx_shareImgUrl", data.object.shareImgUrl); // 文章分享图片
// //文章分享标题
localStorage.setItem("nryx_shareTitle", data.object.shareTitle); // 文章分享标题
localStorage.setItem("nryx_shareDes", data.object.shareDes); // 文章分享描述
localStorage.setItem("nryx_listPicUrl", data.object.listPicUrl); // 文章列表展示图片
localStorage.setItem("nryx_adId", data.object.adId); // 广告id
localStorage.setItem("nryx_isAuthorization", data.object.isAuthorization); // 是否授权
localStorage.setItem("nryx_isJoinActive", data.object.isJoinActive); // 是否添加优选活动
localStorage['nryx_editahref'] = data.object.articleEditUrl;
$.table.refresh();
$.modal.open('创建文章', localStorage['nryx_editahref'])
} else {
$.modal.alertError(data.info)
}
},
error: function () {
$.modal.closeLoading();
}
});
};
</script>
</body>
</html>

View File

@ -270,7 +270,7 @@
});
function queryColumnTree() {
var url = ctx + "column/columnTree?codeType=FIRST_COLUMN";
var url = ctx + "column/columnTree";
var options = {
url: url,
expandLevel: 1,
@ -654,7 +654,6 @@
// 编辑后保存操作
function editColum() {
debugger
let id = $('#asdid').val();
let rowData = $("#" + table.options.id).bootstrapTable('getRowByUniqueId', id);
let cName = $("#cName").val();

View File

@ -70,7 +70,7 @@
<div class="modal-body">恭喜,创建成功!</div>
<div class="modal-footer">
<a type="button" id="continueAdd" th:href="@{/content/gallery}" class="btn btn-sm btn-primary">继续创建</a>
<a type="button" id="goList" th:href="@{/content/gallery}" class="btn btn-sm btn-primary">去查看</a>
<a type="button" id="goList" th:href="@{/content/gallery/page}" class="btn btn-sm btn-primary">去查看</a>
</div>
</div>
</div>

View File

@ -39,7 +39,7 @@
</div>
<div class="btn-group-sm" id="toolbar" role="group">
<a class="btn btn-danger multiple disabled" onclick="$.operate.removeAll()">
<a class="btn btn-danger multiple" onclick="$.operate.removeAll()">
<i class="fa fa-remove"></i> 删除
</a>
</div>

View File

@ -29,7 +29,7 @@
<a class="btn btn-success" onclick="$.operate.add()">
<i class="fa fa-plus"></i> 添加
</a>
<a class="btn btn-danger multiple disabled" onclick="$.operate.removeAll()">
<a class="btn btn-danger multiple" onclick="$.operate.removeAll()">
<i class="fa fa-remove"></i> 删除
</a>
</div>