代码提交
This commit is contained in:
parent
aead4835fe
commit
2f2be1c25a
10
pom.xml
10
pom.xml
|
|
@ -178,11 +178,11 @@
|
|||
</dependency>
|
||||
|
||||
<!-- 定时任务-->
|
||||
<dependency>
|
||||
<groupId>com.wuzhen</groupId>
|
||||
<artifactId>zt-quartz</artifactId>
|
||||
<version>${ruoyi.version}</version>
|
||||
</dependency>
|
||||
<!-- <dependency>-->
|
||||
<!-- <groupId>com.wuzhen</groupId>-->
|
||||
<!-- <artifactId>zt-quartz</artifactId>-->
|
||||
<!-- <version>${ruoyi.version}</version>-->
|
||||
<!-- </dependency>-->
|
||||
|
||||
<!-- 代码生成-->
|
||||
<dependency>
|
||||
|
|
|
|||
|
|
@ -4,8 +4,12 @@ import com.wuzhen.common.config.RuoYiConfig;
|
|||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
|
||||
import org.springframework.web.servlet.config.annotation.PathMatchConfigurer;
|
||||
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
|
||||
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
|
||||
import org.springframework.web.util.UrlPathHelper;
|
||||
|
||||
import java.nio.charset.StandardCharsets;
|
||||
|
||||
/**
|
||||
* 启动程序
|
||||
|
|
@ -44,4 +48,13 @@ public class ZtApplication implements WebMvcConfigurer
|
|||
// registry.addResourceHandler("/**").addResourceLocations("file:" + RuoYiConfig.getProfile());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void configurePathMatch(PathMatchConfigurer configurer) {
|
||||
UrlPathHelper urlPathHelper=new UrlPathHelper();
|
||||
urlPathHelper.setUrlDecode(false);
|
||||
urlPathHelper.setDefaultEncoding(StandardCharsets.UTF_8.name());
|
||||
configurer.setUrlPathHelper(urlPathHelper);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -7,6 +7,9 @@ import com.wuzhen.common.core.controller.BaseController;
|
|||
import com.wuzhen.common.core.domain.AjaxResult;
|
||||
import com.wuzhen.common.core.page.TableDataInfo;
|
||||
import com.wuzhen.common.enums.BusinessType;
|
||||
import com.wuzhen.common.utils.StringUtils;
|
||||
import com.wuzhen.common.utils.file.FileUploadUtils;
|
||||
import com.wuzhen.common.utils.file.FileUtils;
|
||||
import com.wuzhen.common.utils.poi.ExcelUtil;
|
||||
import com.wuzhen.framework.shiro.util.AuthorizationUtils;
|
||||
import com.wuzhen.system.domain.ActiveInfo;
|
||||
|
|
@ -106,8 +109,7 @@ public class ActiveInfoController extends BaseController
|
|||
logger.info(activeInfo.toString());
|
||||
activeInfo.setCreateBy(getLoginName());
|
||||
AuthorizationUtils.clearAllCachedAuthorizationInfo();
|
||||
// toAjax(activeInfoService.insertActive(activeInfo))
|
||||
return toAjax(2);
|
||||
return toAjax(activeInfoService.insertActive(activeInfo));
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -140,13 +142,17 @@ public class ActiveInfoController extends BaseController
|
|||
}
|
||||
|
||||
/**
|
||||
* 修改活动
|
||||
* 修改首页
|
||||
*/
|
||||
@RequiresPermissions("active:info:edit")
|
||||
@GetMapping("/first/{id}")
|
||||
public String first(@PathVariable("id") Long id, ModelMap mmap)
|
||||
|
||||
{
|
||||
mmap.put("active", activeInfoService.selectActiveById(id));
|
||||
ActiveInfo activeInfo = activeInfoService.selectActiveById(id);
|
||||
|
||||
activeInfo.setListFpNames("http://localhost:18000/profile/upload/fp/"+activeInfo.getFpFilesName());
|
||||
mmap.put("active", activeInfo);
|
||||
return prefix + "/first";
|
||||
}
|
||||
|
||||
|
|
@ -160,29 +166,30 @@ public class ActiveInfoController extends BaseController
|
|||
@ResponseBody
|
||||
public AjaxResult firstSave(@Validated ActiveInfo activeInfo)
|
||||
{
|
||||
MultipartFile file = activeInfo.getActiveFirstPic();
|
||||
// 获取上传文件名
|
||||
String filename = file.getOriginalFilename();
|
||||
if (!"".equals(filename)){
|
||||
|
||||
// 定义上传文件保存路径
|
||||
String path = RuoYiConfig.getFPUploadPath();
|
||||
// 新建文件
|
||||
File filepath = new File(path, filename);
|
||||
// 判断路径是否存在,如果不存在就创建一个
|
||||
if (!filepath.getParentFile().exists()) {
|
||||
filepath.getParentFile().mkdirs();
|
||||
}
|
||||
String picUrl = path + File.separator + filename;
|
||||
try {
|
||||
// 写入文件
|
||||
file.transferTo(new File(picUrl));
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
activeInfo.setActiveFirstPicUrl(fp+filename);
|
||||
activeInfo.setIsFristPage("1");
|
||||
}
|
||||
// MultipartFile file = activeInfo.getActiveFirstPic();
|
||||
// // 获取上传文件名
|
||||
// String filename = file.getOriginalFilename();
|
||||
// if (!"".equals(filename)){
|
||||
//
|
||||
// // 定义上传文件保存路径
|
||||
// String path = RuoYiConfig.getFPUploadPath();
|
||||
// // 新建文件
|
||||
// File filepath = new File(path, filename);
|
||||
// // 判断路径是否存在,如果不存在就创建一个
|
||||
// if (!filepath.getParentFile().exists()) {
|
||||
// filepath.getParentFile().mkdirs();
|
||||
// }
|
||||
// String picUrl = path + File.separator + filename;
|
||||
// try {
|
||||
// // 写入文件
|
||||
// file.transferTo(new File(picUrl));
|
||||
// } catch (IOException e) {
|
||||
// e.printStackTrace();
|
||||
// }
|
||||
// activeInfo.setActiveFirstPicUrl(fp+filename);
|
||||
// activeInfo.setIsFristPage("1");
|
||||
// }
|
||||
activeInfo.setIsFristPage("1");
|
||||
activeInfo.setUpdateBy(getLoginName());
|
||||
AuthorizationUtils.clearAllCachedAuthorizationInfo();
|
||||
return toAjax(activeInfoService.saveFistPage(activeInfo));
|
||||
|
|
@ -232,5 +239,4 @@ public class ActiveInfoController extends BaseController
|
|||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -141,31 +141,20 @@ public class CommonController
|
|||
*/
|
||||
@PostMapping("/uploadsFp")
|
||||
@ResponseBody
|
||||
public AjaxResult uploadFilesFp(List<MultipartFile> files) throws Exception
|
||||
public AjaxResult uploadFilesFp(MultipartFile file) throws Exception
|
||||
{
|
||||
try
|
||||
{
|
||||
// 上传文件路径
|
||||
String filePath = RuoYiConfig.getFPUploadPath();
|
||||
List<String> urls = new ArrayList<String>();
|
||||
List<String> fileNames = new ArrayList<String>();
|
||||
List<String> newFileNames = new ArrayList<String>();
|
||||
List<String> originalFilenames = new ArrayList<String>();
|
||||
for (MultipartFile file : files)
|
||||
{
|
||||
// 上传并返回新文件名称
|
||||
String fileName = FileUploadUtils.upload(filePath, file);
|
||||
String url = serverConfig.getUrl() + fileName;
|
||||
urls.add(url);
|
||||
fileNames.add(fileName);
|
||||
newFileNames.add(FileUtils.getName(fileName));
|
||||
originalFilenames.add(file.getOriginalFilename());
|
||||
}
|
||||
// 上传并返回新文件名称
|
||||
String fileName = FileUploadUtils.upload(filePath, file);
|
||||
String url = serverConfig.getUrl() + fileName;
|
||||
AjaxResult ajax = AjaxResult.success();
|
||||
ajax.put("urls", StringUtils.join(urls, FILE_DELIMETER));
|
||||
ajax.put("fileNames", StringUtils.join(fileNames, FILE_DELIMETER));
|
||||
ajax.put("newFileNames", StringUtils.join(newFileNames, FILE_DELIMETER));
|
||||
ajax.put("originalFilenames", StringUtils.join(originalFilenames, FILE_DELIMETER));
|
||||
ajax.put("url", url);
|
||||
ajax.put("fileName", fileName);
|
||||
ajax.put("newFileName", FileUtils.getName(fileName));
|
||||
ajax.put("originalFilename", file.getOriginalFilename());
|
||||
return ajax;
|
||||
}
|
||||
catch (Exception e)
|
||||
|
|
|
|||
|
|
@ -3,8 +3,12 @@ package com.wuzhen.web.core.config;
|
|||
|
||||
import com.wuzhen.common.config.RuoYiConfig;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.web.servlet.config.annotation.PathMatchConfigurer;
|
||||
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
|
||||
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
|
||||
import org.springframework.web.util.UrlPathHelper;
|
||||
|
||||
import java.nio.charset.StandardCharsets;
|
||||
|
||||
@Configuration
|
||||
public class WebConfig implements WebMvcConfigurer {
|
||||
|
|
@ -31,4 +35,13 @@ public class WebConfig implements WebMvcConfigurer {
|
|||
// registry.addResourceHandler("/**").addResourceLocations("file:" + RuoYiConfig.getProfile());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void configurePathMatch(PathMatchConfigurer configurer) {
|
||||
UrlPathHelper urlPathHelper=new UrlPathHelper();
|
||||
urlPathHelper.setUrlDecode(false);
|
||||
urlPathHelper.setDefaultEncoding(StandardCharsets.UTF_8.name());
|
||||
configurer.setUrlPathHelper(urlPathHelper);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -74,6 +74,9 @@ spring:
|
|||
restart:
|
||||
# 热部署开关
|
||||
enabled: true
|
||||
mvc:
|
||||
pathmatch:
|
||||
matching-strategy: ant-path-matcher
|
||||
|
||||
# MyBatis
|
||||
mybatis:
|
||||
|
|
@ -143,3 +146,4 @@ swagger:
|
|||
# 是否开启swagger
|
||||
enabled: true
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -166,13 +166,13 @@
|
|||
var list = [];
|
||||
var res = [];
|
||||
var r_val = rsp.newFileNames;
|
||||
res.push(r_val);
|
||||
var list = value.split(',');
|
||||
list.forEach(function (item) {
|
||||
if ((item !== r_val) && (item !=='') ) {
|
||||
res.push(item);
|
||||
}
|
||||
})
|
||||
res.push(r_val);
|
||||
console.log('end:', res);
|
||||
$("#lpFilesName").val(res);
|
||||
var c = $("#lpFilesName").val();
|
||||
|
|
|
|||
|
|
@ -9,8 +9,8 @@
|
|||
<body class="white-bg">
|
||||
<div class="wrapper wrapper-content animated fadeInRight ibox-content">
|
||||
<form class="form-horizontal m" id="form-role-edit" th:object="${active}">
|
||||
<input id="roleId" name="id" type="hidden" th:field="*{id}"/>
|
||||
<input id="lpFilesName" name="lpFilesName" type="hidden"/>
|
||||
<input id="roleId" name="id" type="hidden" th:field="*{id}" />
|
||||
<input id="lpFilesName" name="lpFilesName" type="hidden" th:field="*{lpFilesName}"/>
|
||||
<input id="listLpNames" name="listLpNames" type="hidden" th:field="*{listLpNames}"/>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label is-required">活动标题:</label>
|
||||
|
|
@ -121,7 +121,7 @@
|
|||
var activeEndDate = $("input[name='activeEndDate']").val();
|
||||
var activeType = $("select[name='activeType']").val();
|
||||
var isEnroll = $("select[name='isEnroll']").val();
|
||||
var activePic = $("input[name='activePic']").val();
|
||||
var lpFilesName = $("input[name='lpFilesName']").val();
|
||||
var status = $("select[name='status']").val();
|
||||
var remark = $("input[name='remark']").val();
|
||||
var address =$("textarea[name='address']").val();
|
||||
|
|
@ -138,7 +138,7 @@
|
|||
"activeEndDate": activeEndDate,
|
||||
"activeType": activeType,
|
||||
"isEnroll": isEnroll,
|
||||
"activePic": activePic,
|
||||
"lpFilesName": lpFilesName,
|
||||
"status": status,
|
||||
"remark": remark
|
||||
},
|
||||
|
|
@ -165,6 +165,7 @@
|
|||
if (initialList != null && initialList.length) {
|
||||
for (var i = 0; i < initialList.length; i++) {
|
||||
previewJson[i] = initialList[i].filepath;
|
||||
//alert(initialList[i].filepath);
|
||||
//组装图片配置
|
||||
var tjson = {
|
||||
type: getFileTypeFromUrl(initialList[i].filepath),
|
||||
|
|
@ -179,6 +180,9 @@
|
|||
}
|
||||
}
|
||||
// 多图上传
|
||||
var cacheImgs = {};
|
||||
var g_value = $("#lpFilesName").val() || '';
|
||||
var g_list = g_value.split(',');
|
||||
$("#multipleFile").fileinput({
|
||||
uploadUrl: ctx + 'common/uploadsLp',//上传路径
|
||||
fileActionSettings: {
|
||||
|
|
@ -199,14 +203,25 @@
|
|||
}).on('filebatchuploadsuccess', function (event, data, previewId, index) {
|
||||
var rsp = data.response;
|
||||
}).on('fileuploaded', function (event, data, previewId, index) {
|
||||
var resultObj = data.response;
|
||||
console.log(resultObj);
|
||||
if (resultObj != null && resultObj.code == 0) {
|
||||
$("#" + previewId).append("<span class='hidden_img hidden_img_upload' hidden >" + resultObj.fileNames + "</span>");
|
||||
$.modal.msgSuccess("上传成功");
|
||||
} else {
|
||||
$.modal.msgError("上传失败");
|
||||
}
|
||||
|
||||
cacheImgs[previewId] = data.response.newFileNames;
|
||||
var rsp = data.response;
|
||||
var value = $("#lpFilesName").val() || '';
|
||||
var list = [];
|
||||
var res = [];
|
||||
var r_val = rsp.newFileNames;
|
||||
var list = value.split(',');
|
||||
list.forEach(function (item) {
|
||||
if ((item !== r_val) && (item !=='') ) {
|
||||
res.push(item);
|
||||
}
|
||||
})
|
||||
res.push(r_val);
|
||||
console.log('end:', res);
|
||||
$("#lpFilesName").val(res);
|
||||
var c = $("#lpFilesName").val();
|
||||
console.log('fileuploaded: c:', c);
|
||||
|
||||
}).on('filebatchselected', function (event, files) {
|
||||
$(this).fileinput("upload");//这里会根据uploadAsync值自动去执行对应的回调函
|
||||
}).on('filebatchuploaderror', function (event, data, msg) {
|
||||
|
|
@ -230,8 +245,33 @@
|
|||
$.modal.msgSuccess("移除成功-1");
|
||||
}).on('filebeforedelete', function (event, key) {
|
||||
$.modal.msgSuccess("移除成功-2");
|
||||
console.log('filebeforedelete',event,key);
|
||||
var value = $("#lpFilesName").val() || '';
|
||||
var list = value.split(',');
|
||||
var res = [];
|
||||
for (var i = 0; i < list.length; i++) {
|
||||
if(list[i]!==g_list[key]){
|
||||
res.push(list[i]);
|
||||
}
|
||||
}
|
||||
$("#lpFilesName").val(res);
|
||||
var f = $("#lpFilesName").val();
|
||||
console.log('filesuccessremove: f:', f);
|
||||
}).on('filesuccessremove', function (event, data, previewId, index) {
|
||||
$.modal.msgSuccess("移除成功-3");
|
||||
var urls = cacheImgs[data];
|
||||
delete cacheImgs[data];
|
||||
var value = $("#lpFilesName").val() || '';
|
||||
var list = value.split(',');
|
||||
var res = [];
|
||||
list.forEach(function (item) {
|
||||
if ((item !== urls) && (item !=='')) {
|
||||
res.push(item);
|
||||
}
|
||||
})
|
||||
$("#lpFilesName").val(res);
|
||||
var d = $("#lpFilesName").val();
|
||||
console.log('filesuccessremove: d:', d);
|
||||
});
|
||||
|
||||
}
|
||||
|
|
@ -243,7 +283,6 @@
|
|||
|
||||
});
|
||||
function getFileTypeFromUrl(url) {
|
||||
console.log('getFileTypeFromUrl', url);
|
||||
if (url.endsWith('gif') || url.endsWith('jpg') || url.endsWith('jpeg') || url.endsWith('png')) {
|
||||
return 'image';
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4,11 +4,14 @@
|
|||
<th:block th:include="include :: header('修改活动信息')" />
|
||||
<th:block th:include="include :: ztree-css" />
|
||||
<th:block th:include="include :: datetimepicker-css" />
|
||||
<th:block th:include="include :: bootstrap-fileinput-css" />
|
||||
</head>
|
||||
<body class="white-bg">
|
||||
<div class="wrapper wrapper-content animated fadeInRight ibox-content">
|
||||
<form class="form-horizontal m" id="form-role-edit" th:object="${active}" enctype="multipart/form-data">
|
||||
<input id="roleId" name="id" type="hidden" th:field="*{id}"/>
|
||||
<input id="fpFilesName" name="fpFilesName" type="hidden" th:field="*{fpFilesName}"/>
|
||||
<input id="listFpNames" name="listFpNames" type="hidden" th:field="*{listFpNames}"/>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label is-required">活动标题:</label>
|
||||
<div class="col-sm-8">
|
||||
|
|
@ -17,13 +20,10 @@
|
|||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label is-required">首页活动图片:</label>
|
||||
<div class="col-sm-8">
|
||||
<!-- <label for="uploadFile">或者 上传本地文件</label>-->
|
||||
<input type="file" class="form-control-file" id="activeFirstPic" name="activeFirstPic">
|
||||
<!-- <input class="form-control" type="text" name="activePic" id="activePic" required>-->
|
||||
<label class="font-noraml">首页活动图片上传</label>
|
||||
<div class="file-loading">
|
||||
<input id="singleFile" name="file" type="file">
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
</form>
|
||||
|
|
@ -32,61 +32,19 @@
|
|||
<th:block th:include="include :: datetimepicker-js" />
|
||||
<script th:src="@{/js/jquery-ui-1.10.4.min.js}"></script>
|
||||
<th:block th:include="include :: datetimepicker-js" />
|
||||
<th:block th:include="include :: bootstrap-fileinput-js" />
|
||||
<script th:src="@{/ajax/libs/beautifyhtml/beautifyhtml.js}"></script>
|
||||
<script type="text/javascript">
|
||||
$(document).ready(function(){setup_draggable();$("#n-columns").on("change",function(){var v=$(this).val();if(v==="1"){var $col=$(".form-body .col-md-12").toggle(true);$(".form-body .col-md-6 .draggable").each(function(i,el){$(this).remove().appendTo($col)});$(".form-body .col-md-6").toggle(false)}else{var $col=$(".form-body .col-md-6").toggle(true);$(".form-body .col-md-12 .draggable").each(function(i,el){$(this).remove().appendTo(i%2?$col[1]:$col[0])});$(".form-body .col-md-12").toggle(false)}});$("#copy-to-clipboard").on("click",function(){var $copy=$(".form-body").clone().appendTo(document.body);$copy.find(".tools, :hidden").remove();$.each(["draggable","droppable","sortable","dropped","ui-sortable","ui-draggable","ui-droppable","form-body"],function(i,c){$copy.find("."+c).removeClass(c).removeAttr("style")});var html=html_beautify($copy.html());$copy.remove();$modal=get_modal(html).modal("show");$modal.find(".btn").remove();$modal.find(".modal-title").html("复制HTML代码");$modal.find(":input:first").select().focus();return false})});var setup_draggable=function(){$(".draggable").draggable({appendTo:"body",helper:"clone"});$(".droppable").droppable({accept:".draggable",helper:"clone",hoverClass:"droppable-active",drop:function(event,ui){$(".empty-form").remove();var $orig=$(ui.draggable);if(!$(ui.draggable).hasClass("dropped")){var $el=$orig.clone().addClass("dropped").css({"position":"static","left":null,"right":null}).appendTo(this);if($el.find("label").hasClass("radio-box")){$el=$el.html('<label class="col-sm-3 control-label">单选框:</label>'+'<div class="col-sm-9">'+'<label class="radio-box"><input type="radio" checked="" value="option1" id="optionsRadios1" name="optionsRadios">选项1</label>'+'<label class="radio-box"><input type="radio" value="option2" id="optionsRadios2" name="optionsRadios">选项2</label>'+"</div>")}else{if($el.find("label").hasClass("check-box")){$el=$el.html('<label class="col-sm-3 control-label">复选框:</label>'+'<div class="col-sm-9">'+'<label class="check-box">'+'<input type="checkbox" value="option1" id="inlineCheckbox1">选项1</label>'+'<label class="check-box">'+'<input type="checkbox" value="option2" id="inlineCheckbox2">选项2</label>'+'<label class="check-box">'+'<input type="checkbox" value="option3" id="inlineCheckbox3">选项3</label>'+"</div>")}}var id=$orig.find(":input").attr("id");if(id){id=id.split("-").slice(0,-1).join("-")+"-"+(parseInt(id.split("-").slice(-1)[0])+1);$orig.find(":input").attr("id",id);$orig.find("label").attr("for",id)}$('<p class="tools col-sm-12 col-sm-offset-3"> <a class="edit-link">编辑HTML<a> | <a class="remove-link">移除</a></p>').appendTo($el)}else{if($(this)[0]!=$orig.parent()[0]){var $el=$orig.clone().css({"position":"static","left":null,"right":null}).appendTo(this);$orig.remove()}}}}).sortable()};var get_modal=function(content){var modal=$('<div class="modal" style="overflow: auto;" tabindex="-1"> <div class="modal-dialog"><div class="modal-content"><div class="modal-header"><a type="button" class="close" data-dismiss="modal" aria-hidden="true">×</a><h4 class="modal-title">编辑HTML</h4></div><div class="modal-body ui-front"> <textarea class="form-control textarea-show-src" style="min-height: 200px; margin-bottom: 10px;font-family: Monaco, Fixed"></textarea><button class="btn btn-success">更新HTML</button></div></div></div></div>').appendTo(document.body);var doms=document.getElementsByClassName("textarea-show-src");for(var i=0;i<doms.length;i++){doms.item(i).innerHTML=content}return modal};$(document).on("click",".edit-link",function(ev){var $el=$(this).parent().parent();var $el_copy=$el.clone();var $edit_btn=$el_copy.find(".edit-link").parent().remove();var $modal=get_modal(html_beautify($el_copy.html())).modal("show");$modal.find(":input:first").focus();$modal.find(".btn-success").click(function(ev2){var html=$modal.find("textarea").val();if(!html){$el.remove()}else{$el.html(html);$edit_btn.appendTo($el)}$modal.modal("hide");return false})});$(document).on("click",".remove-link",function(ev){$(this).parent().parent().remove()});$(".input-group.date").datetimepicker({format:"yyyy-mm-dd",minView:"month",autoclose:true});
|
||||
</script>
|
||||
<script type="text/javascript">
|
||||
<!-- function edit() {-->
|
||||
<!--<!– var id = $("input[name='id']").val();–>-->
|
||||
<!--<!– var activeFirstPic = $("input[name='activeFirstPic']").val();–>-->
|
||||
<!--<!– var formData = new FormData($("#form-role-edit")[0])–>-->
|
||||
<!-- var formData = new FormData($("#form-role-edit")[0])-->
|
||||
<!-- formData.append('activeFirstPic', activeFirstPic);-->
|
||||
<!-- $.ajax({-->
|
||||
<!-- cache : true,-->
|
||||
<!-- type : "POST",-->
|
||||
<!-- url : ctx + "active/info/firstSave",-->
|
||||
<!-- data : formData,-->
|
||||
<!-- async : false,-->
|
||||
<!-- error : function(request) {-->
|
||||
<!-- $.modal.alertError("系统错误");-->
|
||||
<!-- },-->
|
||||
<!-- success : function(data) {-->
|
||||
<!-- $.operate.successCallback(data);-->
|
||||
<!-- }-->
|
||||
<!-- });-->
|
||||
<!-- }-->
|
||||
|
||||
|
||||
|
||||
<!-- function submitHandler() {-->
|
||||
<!-- edit();-->
|
||||
<!-- }-->
|
||||
<!-- -->
|
||||
<!-- -->
|
||||
function submitHandler() {
|
||||
add();
|
||||
}
|
||||
}
|
||||
|
||||
function add() {
|
||||
|
||||
<!-- var activeTitle = $("input[name='activeTitle']").val();-->
|
||||
<!-- var activeDesc =$("textarea[name='activeDesc']").val();-->
|
||||
<!-- var activeType = $("select[name='activeType']").val();-->
|
||||
<!-- var activeStartDate = $("input[name='activeStartDate']").val();-->
|
||||
<!-- var activeEndDate = $("input[name='activeEndDate']").val();-->
|
||||
<!-- var status = $("input[id='status']").is(':checked') == true ? 0 : 1;-->
|
||||
<!-- var remark = $("input[name='remark']").val();-->
|
||||
<!-- var activePic = $('#activePic')[0].files[0];-->
|
||||
var formData = new FormData($("#form-role-edit")[0])
|
||||
formData.append('activeFirstPic', activeFirstPic);
|
||||
<!-- formData.append('activeDesc', activeDesc);-->
|
||||
<!-- formData.append('activeType', activeType);-->
|
||||
<!-- formData.append('activeStartDate', activeStartDate);-->
|
||||
<!-- formData.append('activeEndDate', activeEndDate);-->
|
||||
<!-- formData.append('status', status);-->
|
||||
<!-- formData.append('remark', remark);-->
|
||||
$.ajax({
|
||||
cache: false,
|
||||
contentType: false,
|
||||
|
|
@ -103,6 +61,43 @@
|
|||
}
|
||||
});
|
||||
}
|
||||
|
||||
$(document).ready(function () {
|
||||
|
||||
var a = $("input[name='listFpNames']").val();
|
||||
var b= [];
|
||||
if (a.endsWith('null')){
|
||||
b= []
|
||||
}else{
|
||||
b= [a]
|
||||
}
|
||||
console.log('a:', a);
|
||||
// 单图上传
|
||||
$("#singleFile").fileinput({
|
||||
uploadUrl: ctx + 'common/uploadsFp',
|
||||
maxFileCount: 1,
|
||||
initialPreviewAsData: true,
|
||||
initialPreview: b,
|
||||
layoutTemplates: {
|
||||
footer: '',//隐藏全部小图标
|
||||
},
|
||||
showRemove: true, //不显示底部清空按钮
|
||||
autoReplace: true
|
||||
}).on('fileuploaded', function (event, data, previewId, index) {
|
||||
var rsp = data.response;
|
||||
$("#fpFilesName").val(rsp.newFileName);
|
||||
log.info("return url:" + rsp.url)
|
||||
log.info("reutrn fileName:" + rsp.fileName)
|
||||
log.info("reutrn newFileName:" + rsp.newFileName)
|
||||
log.info("return originalFilename:" + rsp.originalFilename)
|
||||
}).on('fileremoved', function (event, id, index) {
|
||||
$("input[name='" + event.currentTarget.id + "']").val('')
|
||||
}).on('filebeforedelete', function (event, key) {
|
||||
$.modal.msgSuccess("移除成功-2");
|
||||
|
||||
})
|
||||
});
|
||||
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
|
|
|
|||
|
|
@ -70,6 +70,8 @@
|
|||
$("input[name='" + event.currentTarget.id + "']").val('')
|
||||
})
|
||||
});
|
||||
|
||||
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
|
|
|
|||
|
|
@ -117,6 +117,8 @@ public class FileUploadUtils
|
|||
return getPathFileName(baseDir, fileName);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 编码文件名
|
||||
*/
|
||||
|
|
@ -125,8 +127,8 @@ public class FileUploadUtils
|
|||
// return StringUtils.format("{}/{}_{}.{}", DateUtils.datePath(),
|
||||
// FilenameUtils.getBaseName(file.getOriginalFilename()), Seq.getId(Seq.uploadSeqType), getExtension(file));
|
||||
|
||||
return StringUtils.format("{}_{}.{}",
|
||||
FilenameUtils.getBaseName(file.getOriginalFilename()), Seq.getId(Seq.uploadSeqType), getExtension(file));
|
||||
return StringUtils.format("{}.{}",
|
||||
Seq.getId(Seq.uploadSeqType), getExtension(file));
|
||||
}
|
||||
|
||||
public static final File getAbsoluteFile(String uploadDir, String fileName) throws IOException
|
||||
|
|
|
|||
|
|
@ -46,7 +46,7 @@ public class Seq
|
|||
{
|
||||
atomicInt = uploadSeq;
|
||||
}
|
||||
return getId(atomicInt, 3);
|
||||
return getId(atomicInt, 5);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -73,6 +73,8 @@ public class ActiveInfo extends BaseEntity {
|
|||
*/
|
||||
private String lpFilesName;
|
||||
|
||||
private String fpFilesName;
|
||||
|
||||
|
||||
public String getListLpNames() {
|
||||
return listLpNames;
|
||||
|
|
@ -84,6 +86,16 @@ public class ActiveInfo extends BaseEntity {
|
|||
|
||||
private String listLpNames ;
|
||||
|
||||
public String getListFpNames() {
|
||||
return listFpNames;
|
||||
}
|
||||
|
||||
public void setListFpNames(String listFpNames) {
|
||||
this.listFpNames = listFpNames;
|
||||
}
|
||||
|
||||
private String listFpNames ;
|
||||
|
||||
|
||||
public String getFpFilesName() {
|
||||
return fpFilesName;
|
||||
|
|
@ -93,10 +105,7 @@ public class ActiveInfo extends BaseEntity {
|
|||
this.fpFilesName = fpFilesName;
|
||||
}
|
||||
|
||||
/**
|
||||
* 首页列表
|
||||
*/
|
||||
private String fpFilesName;
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -29,7 +29,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
</resultMap>
|
||||
|
||||
<sql id="selectActiveVo">
|
||||
select r.id, r.active_title, r.active_desc,r.active_start_date,r.active_end_date, r.active_pic_url, r.active_frist_pic_url,r.is_frist_page, r.active_type, r.status, r.del_flag, r.create_time, r.remark, r.address,r.is_enroll,lp_files_name
|
||||
select r.id, r.active_title, r.active_desc,r.active_start_date,r.active_end_date, r.active_pic_url, r.active_frist_pic_url,r.is_frist_page, r.active_type, r.status, r.del_flag, r.create_time, r.remark, r.address,r.is_enroll,lp_files_name,fp_files_name
|
||||
from active_info r
|
||||
</sql>
|
||||
|
||||
|
|
@ -95,6 +95,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
<if test="remark != null">remark = #{remark},</if>
|
||||
<if test="updateBy != null and updateBy != ''">update_by = #{updateBy},</if>
|
||||
<if test="address != null and address != ''">address = #{address},</if>
|
||||
<if test="lpFilesName != null ">lp_files_name = #{lpFilesName},</if>
|
||||
<if test="isEnroll != null and isEnroll != ''">is_enroll = #{isEnroll},</if>
|
||||
update_time = sysdate()
|
||||
</set>
|
||||
|
|
@ -106,6 +107,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
update active_info
|
||||
<set>
|
||||
<if test="activeFirstPicUrl != null and activeFirstPicUrl != ''">active_frist_pic_url = #{activeFirstPicUrl},</if>
|
||||
<if test="fpFilesName != null and fpFilesName != ''">fp_files_name = #{fpFilesName},</if>
|
||||
<if test="isFristPage != null and isFristPage != ''">is_frist_page = #{isFristPage},</if>
|
||||
<if test="updateBy != null and updateBy != ''">update_by = #{updateBy},</if>
|
||||
update_time = sysdate()
|
||||
|
|
|
|||
Loading…
Reference in New Issue