提交 1297991f authored 作者: 潘鹏's avatar 潘鹏

Merge remote-tracking branch 'origin/master'

...@@ -150,4 +150,30 @@ public class AdvertisementItemController { ...@@ -150,4 +150,30 @@ public class AdvertisementItemController {
} }
return R.error("操作失败"); return R.error("操作失败");
} }
/**
* 修改广告页商品
*/
@RequestMapping("/updateAdvertisementItem")
@ResponseBody
public R updateAdvertisementItem(@RequestParam Map<String, Object> map) {
int res = advertisementItemService.updateAdvertisementItem(map);
if (res > 0) {
return R.ok();
} else if (res == -1) {
return R.error("参数不能为空");
} else if (res == -2) {
return R.error("序号不能跟原来相同");
} else if (res == -3) {
return R.error("序号必须是正整数");
}
return R.error("操作失败");
}
@RequestMapping("/getAdSort")
@ResponseBody
public R getAdSort(@RequestParam Map<String, Object> map) {
Integer sort = advertisementItemService.getAdSort(map);
return R.ok().put("sort", sort);
}
} }
...@@ -29,7 +29,7 @@ public class uploadController { ...@@ -29,7 +29,7 @@ public class uploadController {
@RequestMapping(value = "/uploadFile", produces = "application/json;charset=UTF-8") @RequestMapping(value = "/uploadFile", produces = "application/json;charset=UTF-8")
public String upload(MultipartFile file) { public String upload(MultipartFile file) {
try { try {
String secondaryFolderName = "Afrishop"; String secondaryFolderName = "afrishop";
// 获取文件名 // 获取文件名
String fileName = file.getOriginalFilename(); String fileName = file.getOriginalFilename();
// 获取文件后缀 // 获取文件后缀
......
...@@ -3,6 +3,7 @@ package com.platform.dao; ...@@ -3,6 +3,7 @@ package com.platform.dao;
import com.platform.entity.AdvertisementItemEntity; import com.platform.entity.AdvertisementItemEntity;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
import java.util.List;
import java.util.Map; import java.util.Map;
/** /**
...@@ -17,11 +18,18 @@ public interface AdvertisementItemDao extends BaseDao<AdvertisementItemEntity> { ...@@ -17,11 +18,18 @@ public interface AdvertisementItemDao extends BaseDao<AdvertisementItemEntity> {
int deleteByItem(@Param("itemId") String itemId, @Param("adId") String adId); int deleteByItem(@Param("itemId") String itemId, @Param("adId") String adId);
int getMaxSort(); int getMaxSort(@Param("adId") String adId);
int setItemTop(@Param("top") Integer top, @Param("itemId") String itemId, @Param("adId") String adId); int setItemTop(@Param("top") Integer top, @Param("itemId") String itemId, @Param("adId") String adId);
AdvertisementItemEntity getAdItemById(@Param("itemId") String itemId, @Param("adId") String adId); AdvertisementItemEntity getAdItemById(@Param("itemId") String itemId, @Param("adId") String adId);
int updateAdItem(AdvertisementItemEntity advertisementItemEntity); int updateAdItem(AdvertisementItemEntity advertisementItemEntity);
int existItemSort(@Param("adId") String adId, @Param("sort") Integer sort);
List<AdvertisementItemEntity> changeSortBack(@Param("firstSort") Integer firstSort, @Param("endSort") Integer endSort, @Param("adId") String adId);
List<AdvertisementItemEntity> changeSortFront(@Param("firstSort") Integer firstSort, @Param("endSort") Integer endSort, @Param("adId") String adId);
} }
...@@ -8,7 +8,7 @@ import java.util.Date; ...@@ -8,7 +8,7 @@ import java.util.Date;
* 表名 advertisement_item * 表名 advertisement_item
* *
* @author lipengjun * @author lipengjun
* @date 2020-10-07 15:50:04 * @date 2020-10-13 17:30:21
*/ */
public class AdvertisementItemEntity implements Serializable { public class AdvertisementItemEntity implements Serializable {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
...@@ -22,13 +22,17 @@ public class AdvertisementItemEntity implements Serializable { ...@@ -22,13 +22,17 @@ public class AdvertisementItemEntity implements Serializable {
*/ */
private String itemId; private String itemId;
/** /**
* 置顶 * 是否置顶 0: 不置顶 1:置顶
*/ */
private Integer isTop; private Integer isTop;
/** /**
* 排序 * 排序
*/ */
private Integer sort; private Integer sort;
/**
* 商品添加时间
*/
private Date createTime;
/** /**
* 设置:广告投放ID * 设置:广告投放ID
...@@ -57,14 +61,14 @@ public class AdvertisementItemEntity implements Serializable { ...@@ -57,14 +61,14 @@ public class AdvertisementItemEntity implements Serializable {
return itemId; return itemId;
} }
/** /**
* 设置:置顶 * 设置:是否置顶 0: 不置顶 1:置顶
*/ */
public void setIsTop(Integer isTop) { public void setIsTop(Integer isTop) {
this.isTop = isTop; this.isTop = isTop;
} }
/** /**
* 获取:置顶 * 获取:是否置顶 0: 不置顶 1:置顶
*/ */
public Integer getIsTop() { public Integer getIsTop() {
return isTop; return isTop;
...@@ -82,4 +86,17 @@ public class AdvertisementItemEntity implements Serializable { ...@@ -82,4 +86,17 @@ public class AdvertisementItemEntity implements Serializable {
public Integer getSort() { public Integer getSort() {
return sort; return sort;
} }
/**
* 设置:商品添加时间
*/
public void setCreateTime(Date createTime) {
this.createTime = createTime;
}
/**
* 获取:商品添加时间
*/
public Date getCreateTime() {
return createTime;
}
} }
...@@ -14,6 +14,15 @@ public class TbCfStationItemEntityExtends extends TbCfStationItemEntity implemen ...@@ -14,6 +14,15 @@ public class TbCfStationItemEntityExtends extends TbCfStationItemEntity implemen
private String uname; private String uname;
private Integer isTop; private Integer isTop;
private Integer sort; private Integer sort;
private Integer itemSort;
public Integer getItemSort() {
return itemSort;
}
public void setItemSort(Integer itemSort) {
this.itemSort = itemSort;
}
public String getUname() { public String getUname() {
return uname; return uname;
......
package com.platform.service; package com.platform.service;
import com.platform.entity.AdvertisementItemEntity; import com.platform.entity.AdvertisementItemEntity;
import io.swagger.models.auth.In;
import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RequestParam;
import java.util.List; import java.util.List;
...@@ -75,4 +76,8 @@ public interface AdvertisementItemService { ...@@ -75,4 +76,8 @@ public interface AdvertisementItemService {
int deleteByItem(String itemId, String adId); int deleteByItem(String itemId, String adId);
int setItemTop(String itemId, String adId); int setItemTop(String itemId, String adId);
int updateAdvertisementItem(@RequestParam Map<String, Object> map);
Integer getAdSort(Map<String, Object> map);
} }
...@@ -4,13 +4,18 @@ import com.platform.dao.AdvertisementItemDao; ...@@ -4,13 +4,18 @@ import com.platform.dao.AdvertisementItemDao;
import com.platform.entity.AdvertisementItemEntity; import com.platform.entity.AdvertisementItemEntity;
import com.platform.service.AdvertisementItemService; import com.platform.service.AdvertisementItemService;
import com.platform.utils.IdUtil; import com.platform.utils.IdUtil;
import io.swagger.models.auth.In;
import org.apache.commons.lang.StringUtils; import org.apache.commons.lang.StringUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import java.util.Date;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.concurrent.locks.ReentrantLock;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
/** /**
* Service实现类 * Service实现类
...@@ -23,6 +28,8 @@ public class AdvertisementItemServiceImpl implements AdvertisementItemService { ...@@ -23,6 +28,8 @@ public class AdvertisementItemServiceImpl implements AdvertisementItemService {
@Autowired @Autowired
private AdvertisementItemDao advertisementItemDao; private AdvertisementItemDao advertisementItemDao;
final ReentrantLock lock = new ReentrantLock();
@Override @Override
public AdvertisementItemEntity queryObject(String adId) { public AdvertisementItemEntity queryObject(String adId) {
return advertisementItemDao.queryObject(adId); return advertisementItemDao.queryObject(adId);
...@@ -40,9 +47,14 @@ public class AdvertisementItemServiceImpl implements AdvertisementItemService { ...@@ -40,9 +47,14 @@ public class AdvertisementItemServiceImpl implements AdvertisementItemService {
@Override @Override
public int save(AdvertisementItemEntity advertisementItem) { public int save(AdvertisementItemEntity advertisementItem) {
advertisementItem.setIsTop(0); // advertisementItem.setIsTop(0);
advertisementItem.setSort(0); lock.lock();
return advertisementItemDao.save(advertisementItem); int maxSort = advertisementItemDao.getMaxSort(advertisementItem.getAdId());
advertisementItem.setSort(++maxSort);
advertisementItem.setCreateTime(new Date());
int res = advertisementItemDao.save(advertisementItem);
lock.unlock();
return res;
} }
@Override @Override
...@@ -90,7 +102,7 @@ public class AdvertisementItemServiceImpl implements AdvertisementItemService { ...@@ -90,7 +102,7 @@ public class AdvertisementItemServiceImpl implements AdvertisementItemService {
if (count >= 60) { if (count >= 60) {
return -1; return -1;
} }
int maxSort = advertisementItemDao.getMaxSort(); int maxSort = advertisementItemDao.getMaxSort(null);
byId.setSort(++maxSort); byId.setSort(++maxSort);
byId.setIsTop(1); byId.setIsTop(1);
} else { } else {
...@@ -100,4 +112,96 @@ public class AdvertisementItemServiceImpl implements AdvertisementItemService { ...@@ -100,4 +112,96 @@ public class AdvertisementItemServiceImpl implements AdvertisementItemService {
} }
return advertisementItemDao.updateAdItem(byId); return advertisementItemDao.updateAdItem(byId);
} }
//商品排序需求
//1、要更改的序号与原序号相同,不做处理
//2、要更改的序号没被商品占有,直接修改序号
//3、将序号调至后面
//4、将序号调至前面
@Override
public int updateAdvertisementItem(Map<String, Object> map) {
int res = 0;
String itemId = map.get("itemId").toString();
String adId = map.get("adId").toString();
String sort = map.get("sort").toString();
if (!StringUtils.isNumeric(sort)) {
return -3;
}
Integer itemSort = Integer.parseInt(sort);
String regex = "^[1-9]+[0-9]*$";
Pattern p = Pattern.compile(regex);
Matcher matcher = p.matcher(sort);
if (!matcher.matches()) {
return -3;
}
if (itemId == null || itemId == "") {
return -1;
}
if (adId == null || adId == "") {
return -1;
}
if (sort == null || sort == "") {
return -1;
}
AdvertisementItemEntity byId = advertisementItemDao.getAdItemById(itemId, adId);
if (byId == null) {
return res;
}
//情况1
String firstSort = String.valueOf(byId.getSort());
if (sort.equals(firstSort)) {
return -2;
}
//情况2
int count = advertisementItemDao.existItemSort(adId, itemSort);
if (count == 0) {
byId.setSort(itemSort);
res = advertisementItemDao.updateAdItem(byId);
} else {
//要更换的序号被占有
//情况3 (2-->8)
Integer sort1 = byId.getSort();
if (sort1 < itemSort) {
List<AdvertisementItemEntity> list = advertisementItemDao.changeSortBack(sort1 + 1, itemSort, adId);
for (AdvertisementItemEntity ad : list) {
ad.setSort(ad.getSort() - 1);
advertisementItemDao.updateAdItem(ad);
}
} else {
//情况4 (8-->2)
List<AdvertisementItemEntity> list = advertisementItemDao.changeSortFront(itemSort, sort1 - 1, adId);
for (AdvertisementItemEntity ad : list) {
ad.setSort(ad.getSort() + 1);
advertisementItemDao.updateAdItem(ad);
}
}
byId.setSort(itemSort);
res = advertisementItemDao.updateAdItem(byId);
}
return res;
}
@Override
public Integer getAdSort(Map<String, Object> map) {
String itemId = map.get("itemId").toString();
String adId = map.get("adId").toString();
if (itemId == null || itemId == "") {
return null;
}
if (adId == null || adId == "") {
return null;
}
AdvertisementItemEntity byId = advertisementItemDao.getAdItemById(itemId, adId);
if (byId != null) {
Integer sort = byId.getSort();
if (sort != null) {
return byId.getSort();
}
}
return 0;
}
} }
...@@ -8,6 +8,7 @@ ...@@ -8,6 +8,7 @@
<result property="itemId" column="item_id"/> <result property="itemId" column="item_id"/>
<result property="isTop" column="is_top"/> <result property="isTop" column="is_top"/>
<result property="sort" column="sort"/> <result property="sort" column="sort"/>
<result property="createTime" column="create_time"/>
</resultMap> </resultMap>
<select id="queryObject" resultType="com.platform.entity.AdvertisementItemEntity"> <select id="queryObject" resultType="com.platform.entity.AdvertisementItemEntity">
...@@ -15,7 +16,8 @@ ...@@ -15,7 +16,8 @@
`ad_id`, `ad_id`,
`item_id`, `item_id`,
`is_top`, `is_top`,
`sort` `sort`,
`create_time`
from advertisement_item from advertisement_item
where ad_id = #{id} where ad_id = #{id}
</select> </select>
...@@ -25,12 +27,18 @@ ...@@ -25,12 +27,18 @@
`ad_id`, `ad_id`,
`item_id`, `item_id`,
`is_top`, `is_top`,
`sort` `sort`,
`create_time`
from advertisement_item from advertisement_item
where ad_id = #{adId} where ad_id = #{adId}
and item_id=#{itemId} and item_id=#{itemId}
</select> </select>
<select id="existItemSort" resultType="int">
select count(1) from advertisement_item where ad_id = #{adId} and sort=#{sort}
</select>
<select id="getAdItemCount" resultType="int"> <select id="getAdItemCount" resultType="int">
select count(1) from advertisement_item where ad_id = #{adId} select count(1) from advertisement_item where ad_id = #{adId}
<if test="itemId != null and itemId.trim() != ''"> <if test="itemId != null and itemId.trim() != ''">
...@@ -43,7 +51,30 @@ ...@@ -43,7 +51,30 @@
</update> </update>
<select id="getMaxSort" resultType="int"> <select id="getMaxSort" resultType="int">
select max(sort) from advertisement_item select IFNULL(max(sort),0) from advertisement_item
<if test="adId != null and adId.trim() != ''">
where ad_id=#{adId}
</if>
</select>
<select id="changeSortBack" resultType="com.platform.entity.AdvertisementItemEntity">
select
`ad_id`,
`item_id`,
`is_top`,
`sort`,
`create_time`
from advertisement_item where sort BETWEEN #{firstSort} AND #{endSort} and ad_id=#{adId}
</select>
<select id="changeSortFront" resultType="com.platform.entity.AdvertisementItemEntity">
select
`ad_id`,
`item_id`,
`is_top`,
`sort`,
`create_time`
from advertisement_item where sort BETWEEN #{firstSort} AND #{endSort} and ad_id=#{adId}
</select> </select>
<delete id="deleteByItem"> <delete id="deleteByItem">
...@@ -55,7 +86,8 @@ ...@@ -55,7 +86,8 @@
`ad_id`, `ad_id`,
`item_id`, `item_id`,
`is_top`, `is_top`,
`sort` `sort`,
`create_time`
from advertisement_item from advertisement_item
WHERE 1=1 WHERE 1=1
<if test="name != null and name.trim() != ''"> <if test="name != null and name.trim() != ''">
...@@ -87,12 +119,14 @@ ...@@ -87,12 +119,14 @@
`ad_id`, `ad_id`,
`item_id`, `item_id`,
`is_top`, `is_top`,
`sort`) `sort`,
`create_time`)
values( values(
#{adId}, #{adId},
#{itemId}, #{itemId},
#{isTop}, #{isTop},
#{sort}) #{sort},
#{createTime})
</insert> </insert>
<update id="update" parameterType="com.platform.entity.AdvertisementItemEntity"> <update id="update" parameterType="com.platform.entity.AdvertisementItemEntity">
...@@ -100,7 +134,8 @@ ...@@ -100,7 +134,8 @@
<set> <set>
<if test="itemId != null">`item_id` = #{itemId},</if> <if test="itemId != null">`item_id` = #{itemId},</if>
<if test="isTop != null">`is_top` = #{isTop},</if> <if test="isTop != null">`is_top` = #{isTop},</if>
<if test="sort != null">`sort` = #{sort}</if> <if test="sort != null">`sort` = #{sort},</if>
<if test="createTime != null">`create_time` = #{createTime}</if>
</set> </set>
where ad_id = #{adId} where ad_id = #{adId}
</update> </update>
......
...@@ -95,14 +95,14 @@ ...@@ -95,14 +95,14 @@
t.goodstwotype_title title, t.goodstwotype_title title,
o.goodstype_title goodtype, o.goodstype_title goodtype,
a.is_top, a.is_top,
a.sort a.sort itemSort
from advertisement_item a from advertisement_item a
left join tb_cf_station_item i on i.item_id=a.item_id left join tb_cf_station_item i on i.item_id=a.item_id
left JOIN tb_cf_goodstype o ON o.goodstype_id = i.item_category left JOIN tb_cf_goodstype o ON o.goodstype_id = i.item_category
left JOIN tb_cf_goodstwotype t ON i.item_categorytwo=t.goodstwotype_id left JOIN tb_cf_goodstwotype t ON i.item_categorytwo=t.goodstwotype_id
left JOIN tb_cf_descripiton d ON i.item_descrition_id=d.descripition_id left JOIN tb_cf_descripiton d ON i.item_descrition_id=d.descripition_id
where a.ad_id=#{adId} and i.enable_flag!=0 where a.ad_id=#{adId}
order by a.is_top desc,a.sort desc,i.create_time desc order by itemSort asc
<if test="offset != null and limit != null"> <if test="offset != null and limit != null">
limit #{offset}, #{limit} limit #{offset}, #{limit}
</if> </if>
......
...@@ -2,13 +2,13 @@ ...@@ -2,13 +2,13 @@
#jdbc.username=root #jdbc.username=root
#jdbc.password=root #jdbc.password=root
jdbc.url=jdbc:mysql://47.106.242.175:3306/chinafrica?allowMultiQueries=true&useSSL=false&useUnicode=true&characterEncoding=UTF-8 #jdbc.url=jdbc:mysql://47.106.242.175:3306/chinafrica?allowMultiQueries=true&useSSL=false&useUnicode=true&characterEncoding=UTF-8
jdbc.username=root #jdbc.username=root
jdbc.password=diaoyun666 #jdbc.password=diaoyun666
#jdbc.url: jdbc:mysql://159.138.48.71:3306/chinafrica?useUnicode=true&characterEncoding=UTF-8&rewriteBatchedStatements=true&autoReconnect=true&failOverReadOnly=false&zeroDateTimeBehavior=convertToNull&useSSL=false jdbc.url: jdbc:mysql://159.138.48.71:3306/chinafrica?useUnicode=true&characterEncoding=UTF-8&rewriteBatchedStatements=true&autoReconnect=true&failOverReadOnly=false&zeroDateTimeBehavior=convertToNull&useSSL=false
#jdbc.username: root jdbc.username: root
#jdbc.password: Diaoyunnuli.8 jdbc.password: Diaoyunnuli.8
jdbc.initialSize=5 jdbc.initialSize=5
jdbc.maxActive=30 jdbc.maxActive=30
......
...@@ -2,13 +2,13 @@ ...@@ -2,13 +2,13 @@
#jdbc.username=root #jdbc.username=root
#jdbc.password=root #jdbc.password=root
jdbc.url=jdbc:mysql://47.106.242.175:3306/chinafrica?allowMultiQueries=true&useSSL=false&useUnicode=true&characterEncoding=UTF-8 #jdbc.url=jdbc:mysql://47.106.242.175:3306/chinafrica?allowMultiQueries=true&useSSL=false&useUnicode=true&characterEncoding=UTF-8
jdbc.username=root #jdbc.username=root
jdbc.password=diaoyun666 #jdbc.password=diaoyun666
#jdbc.url: jdbc:mysql://159.138.48.71:3306/chinafrica?useUnicode=true&characterEncoding=UTF-8&rewriteBatchedStatements=true&autoReconnect=true&failOverReadOnly=false&zeroDateTimeBehavior=convertToNull&useSSL=false jdbc.url: jdbc:mysql://159.138.48.71:3306/chinafrica?useUnicode=true&characterEncoding=UTF-8&rewriteBatchedStatements=true&autoReconnect=true&failOverReadOnly=false&zeroDateTimeBehavior=convertToNull&useSSL=false
#jdbc.username: root jdbc.username: root
#jdbc.password: Diaoyunnuli.8 jdbc.password: Diaoyunnuli.8
jdbc.initialSize=5 jdbc.initialSize=5
jdbc.maxActive=30 jdbc.maxActive=30
......
...@@ -24,6 +24,8 @@ import java.util.Date; ...@@ -24,6 +24,8 @@ import java.util.Date;
import java.util.List; import java.util.List;
import java.util.concurrent.ExecutorService; import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors; import java.util.concurrent.Executors;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
/** /**
* 商品导入功能 * 商品导入功能
...@@ -481,4 +483,6 @@ public class ImpartCode { ...@@ -481,4 +483,6 @@ public class ImpartCode {
return output.toByteArray(); return output.toByteArray();
} }
} }
...@@ -288,6 +288,18 @@ ...@@ -288,6 +288,18 @@
</Form-item> </Form-item>
</i-form> </i-form>
</Card> </Card>
<Modal
v-model="modal1"
title="商品排序"
@on-ok="deal"
width="600px"
@on-cancel="cancel">
<i-form ref="formValidate" :model="advertisement" :rules="ruleValidate" :label-width="80">
<Form-item label="序号" prop="sort">
<i-input v-model="sort" placeholder="序号" style="width: 160px"/>
</Form-item>
</i-form>
</Modal>
</div> </div>
<script src="${rc.contextPath}/js/sys/advertisement.js?_${date.systemTime}"></script> <script src="${rc.contextPath}/js/sys/advertisement.js?_${date.systemTime}"></script>
......
...@@ -52,9 +52,10 @@ ...@@ -52,9 +52,10 @@
<br/> <br/>
<Form-item label="答案" prop="answer" style="width: 800px"> <Form-item label="答案" prop="answer" style="width: 800px">
<!-- 加载编辑器的容器 --> <!-- 加载编辑器的容器 -->
<script id="container" name="content" type="text/plain"> <!-- <script id="container" name="content" type="text/plain">-->
</script> <!-- </script>-->
<!--<i-input v-model="tbCfProblem.answer" placeholder="答案"/>--> <!--<i-input v-model="tbCfProblem.answer" placeholder="答案"/>-->
<textarea v-model="tbCfProblem.answer" style="width: 600px;height: 300px;"></textarea>
</Form-item> </Form-item>
<Form-item label="是否展示" prop="enableFlag" style="width: 800px"> <Form-item label="是否展示" prop="enableFlag" style="width: 800px">
<i-select placeholder="请选择" v-model="tbCfProblem.enableFlag"> <i-select placeholder="请选择" v-model="tbCfProblem.enableFlag">
......
...@@ -5,7 +5,7 @@ $(function () { ...@@ -5,7 +5,7 @@ $(function () {
{label: 'problemId', name: 'problemId', index: 'problem_id', key: true, hidden: true}, {label: 'problemId', name: 'problemId', index: 'problem_id', key: true, hidden: true},
{label: '问题明细', name: 'question', index: 'question', width: 80}, {label: '问题明细', name: 'question', index: 'question', width: 80},
{label: '类型 ', name: 'type', index: 'type', width: 80, formatter: typeFormat}, {label: '类型 ', name: 'type', index: 'type', width: 80, formatter: typeFormat},
{label: '答案', name: 'answer', index: 'answer', width: 80, formatter: contentFormat}, // {label: '答案', name: 'answer', index: 'answer', width: 80, formatter: contentFormat},
{label: '是否展示', name: 'enableFlag', index: 'enable_flag', width: 80, formatter: validFormat}, {label: '是否展示', name: 'enableFlag', index: 'enable_flag', width: 80, formatter: validFormat},
{label: '排序', name: 'sort', index: 'sort', width: 80}, {label: '排序', name: 'sort', index: 'sort', width: 80},
{label: '创建时间', name: 'createTime', index: 'create_time', width: 80}], {label: '创建时间', name: 'createTime', index: 'create_time', width: 80}],
...@@ -17,25 +17,25 @@ $(function () { ...@@ -17,25 +17,25 @@ $(function () {
* 增加修改的编辑器 * 增加修改的编辑器
* @type {UE.ui.Editor|*} * @type {UE.ui.Editor|*}
*/ */
var ue = UE.getEditor('container'); // var ue = UE.getEditor('container');
//
/** // /**
* 获取文本框内容 // * 获取文本框内容
* @returns {*|String|void} // * @returns {*|String|void}
*/ // */
function getContent() { // function getContent() {
var htmlContent = ue.getContent(); // var htmlContent = ue.getContent();
return htmlContent; // return htmlContent;
} // }
//
/** // /**
* 显示内容 // * 显示内容
* @param content // * @param content
*/ // */
function showContent(problemId) { // function showContent(problemId) {
$('#contentModal').modal('show'); // $('#contentModal').modal('show');
vm.getInfo(problemId, true); // vm.getInfo(problemId, true);
}; // };
let vm = new Vue({ let vm = new Vue({
...@@ -93,8 +93,8 @@ let vm = new Vue({ ...@@ -93,8 +93,8 @@ let vm = new Vue({
vm.getInfo(problemId); vm.getInfo(problemId);
}, },
saveOrUpdate: function (event) { saveOrUpdate: function (event) {
var answer = getContent(); // var answer = getContent();
vm.tbCfProblem.answer = encodeURI(answer); // vm.tbCfProblem.answer = encodeURI(answer);
let url = vm.tbCfProblem.problemId == null ? "../tbcfproblem/save" : "../tbcfproblem/update"; let url = vm.tbCfProblem.problemId == null ? "../tbcfproblem/save" : "../tbcfproblem/update";
Ajax.request({ Ajax.request({
url: url, url: url,
...@@ -103,7 +103,7 @@ let vm = new Vue({ ...@@ -103,7 +103,7 @@ let vm = new Vue({
contentType: "application/json", contentType: "application/json",
successCallback: function (r) { successCallback: function (r) {
alert('操作成功', function (index) { alert('操作成功', function (index) {
ue.setContent(""); // ue.setContent("");
vm.reload(); vm.reload();
}); });
} }
...@@ -135,9 +135,9 @@ let vm = new Vue({ ...@@ -135,9 +135,9 @@ let vm = new Vue({
async: true, async: true,
successCallback: function (r) { successCallback: function (r) {
console.log(r) console.log(r)
r.tbCfProblem.answer = decodeURI(r.tbCfProblem.answer); // r.tbCfProblem.answer = decodeURI(r.tbCfProblem.answer);
vm.tbCfProblem = r.tbCfProblem; vm.tbCfProblem = r.tbCfProblem;
ue.setContent(vm.tbCfProblem.answer); // ue.setContent(vm.tbCfProblem.answer);
if (!!isShowDetail) { if (!!isShowDetail) {
var answer = "无内容,请点击修改,添加内容"; var answer = "无内容,请点击修改,添加内容";
if (!!vm.tbCfProblem.answer) { if (!!vm.tbCfProblem.answer) {
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论