门店多轮播图
This commit is contained in:
@ -96,7 +96,6 @@ public class CompanyStoreServiceImpl implements ICompanyStoreService
|
||||
companyStore.setCreateTime(DateUtils.getNowDate());
|
||||
companyStore.setUpdateTime(DateUtils.getNowDate());
|
||||
companyStore.setStatus("0");
|
||||
companyStore.setAddress(companyStore.getProvinceName()+companyStore.getCityName()+companyStore.getAreaName());
|
||||
setAreaInfo(companyStore);
|
||||
int flag = companyStoreMapper.insertCompanyStore(companyStore);
|
||||
if(flag > 0){
|
||||
@ -120,6 +119,8 @@ public class CompanyStoreServiceImpl implements ICompanyStoreService
|
||||
companyStore.setCityName(areaHn.getName());
|
||||
companyStore.setProvinceId(areaHn.getParentCode());
|
||||
companyStore.setProvinceName(areaHn.getParentName());
|
||||
companyStore.setAddress(companyStore.getProvinceName()+companyStore.getCityName()+companyStore.getAreaName());
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
@ -133,7 +134,6 @@ public class CompanyStoreServiceImpl implements ICompanyStoreService
|
||||
{
|
||||
companyStore.setUpdateTime(DateUtils.getNowDate());
|
||||
companyStore.setStatus("0");
|
||||
companyStore.setAddress(companyStore.getProvinceName()+companyStore.getCityName()+companyStore.getAreaName());
|
||||
setAreaInfo(companyStore);
|
||||
return companyStoreMapper.updateCompanyStore(companyStore);
|
||||
}
|
||||
|
||||
@ -355,15 +355,31 @@ public class CommonController
|
||||
String filePath = RuoYiConfig.getUploadPath();
|
||||
|
||||
for (MultipartFile file : files) {
|
||||
|
||||
/** oss --------------- */
|
||||
// 检查文件是否为空
|
||||
if (file.isEmpty()) {
|
||||
return AjaxResult.error("上传文件不能为空");
|
||||
}
|
||||
|
||||
// 检查文件类型(可选)
|
||||
String contentType = file.getContentType();
|
||||
if (contentType == null || !contentType.startsWith("image/")) {
|
||||
return AjaxResult.error("只允许上传图片文件");
|
||||
}
|
||||
|
||||
// 上传到 OSS
|
||||
String url = ossService.uploadImage(file);
|
||||
// 返回文件访问 URL
|
||||
String[] str = url.split("/");
|
||||
String fileName = str[str.length - 1];
|
||||
|
||||
/** 原文件上传 --------------- */
|
||||
// 上传并返回新文件名称
|
||||
String fileName = FileUploadUtils.upload(filePath, fileType, file);
|
||||
|
||||
// String fileName = FileUploadUtils.upload(filePath, fileType, file);
|
||||
// String url = serverConfig.getUrl() + fileName;
|
||||
/** -------------------------- */
|
||||
String uuid = UUID.randomUUID().toString();
|
||||
|
||||
// String url = serverConfig.getUrl() + "/common/newDownload?uuid=" + uuid;
|
||||
|
||||
String url = serverConfig.getUrl() + fileName;
|
||||
|
||||
CommonAttachment insert = new CommonAttachment();
|
||||
insert.setUuid(uuid);
|
||||
insert.setDataId(dataId);
|
||||
|
||||
@ -172,9 +172,9 @@
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">门店图片:</label>
|
||||
<div class="col-sm-8">
|
||||
<input type="hidden" name="image">
|
||||
<input name="image" type="hidden">
|
||||
<div class="file-loading">
|
||||
<input class="form-control file-upload" id="image" name="file" type="file">
|
||||
<input id="image" name="files" type="file" multiple>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@ -218,42 +218,35 @@
|
||||
focusCleanup: true
|
||||
});
|
||||
$(document).ready(function () {
|
||||
// 单图上传
|
||||
|
||||
|
||||
$("#image").fileinput({
|
||||
uploadUrl: ctx + 'common/newUpload',
|
||||
uploadUrl: ctx + 'common/newBatchUpload',
|
||||
uploadExtraData: {
|
||||
dataType: '30'
|
||||
dataType: '40'
|
||||
},
|
||||
maxFileCount: 1,
|
||||
autoReplace: true,
|
||||
showClose: false,
|
||||
uploadAsync: false,
|
||||
overwriteInitial:false,
|
||||
layoutTemplates :{
|
||||
actionDelete:'', //去除上传预览的缩略图中的删除图标
|
||||
actionUpload:'',//去除上传预览缩略图中的上传图片图标;
|
||||
actionZoom:'' //去除上传预览缩略图中的查看详情预览的缩略图标。
|
||||
},
|
||||
}).on('fileuploaded', function (event, data, previewId, index) {
|
||||
$("input[name='" + event.currentTarget.id + "']").val(data.response.url)
|
||||
preId = previewId;
|
||||
}).on('fileremoved', function (event, id, index) {
|
||||
$("input[name='" + event.currentTarget.id + "']").val('')
|
||||
}).on("filebatchselected", function(event, files) {
|
||||
if(preId !== ''){
|
||||
document.getElementById(preId).remove()
|
||||
}).on('filebatchuploadsuccess', function (event, data, previewId, index) {
|
||||
let rsp = data.response;
|
||||
let imgList = rsp.data;
|
||||
let imageUrlList = $("input[name='" + event.currentTarget.id + "']");
|
||||
let urlList = ('' === imageUrlList.val()) ? [] : imageUrlList.val().split(",");
|
||||
for(let i = 0;i < imgList.length; i++){
|
||||
urlList.push(imgList[i].url);
|
||||
}
|
||||
$("#image").fileinput("upload");
|
||||
}).on('fileerror', function (event,data,msg){
|
||||
$("input[name='" + event.currentTarget.id + "']").val('')
|
||||
// 清除当前的预览图 ,并隐藏 【移除】 按钮
|
||||
$(event.target).fileinput('clear').fileinput('unlock')
|
||||
$(event.target).parent().siblings('.fileinput-remove').hide()
|
||||
// 打开失败的信息弹窗
|
||||
$.modal.alertError('上传失败,请稍后重试')
|
||||
}
|
||||
).on("filecleared",function(event, data, msg){
|
||||
$("input[name='" + event.currentTarget.id + "']").val('')
|
||||
let urls = urlList.join(",");
|
||||
imageUrlList.val(urls);
|
||||
}).on("filecleared",function(event, data, msg){
|
||||
$("input[name='" + event.currentTarget.id + "']").val('');
|
||||
});
|
||||
|
||||
|
||||
|
||||
$("#businessLicenseImg").fileinput({
|
||||
uploadUrl: ctx + 'common/newUpload',
|
||||
uploadExtraData: {
|
||||
|
||||
@ -172,9 +172,9 @@
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">门店图片:</label>
|
||||
<div class="col-sm-8">
|
||||
<input type="hidden" name="image" th:value="*{image}">
|
||||
<input name="image" th:value="*{image}" type="hidden">
|
||||
<div class="file-loading">
|
||||
<input class="form-control file-upload" id="image" name="file" type="file">
|
||||
<input id="image" name="files" type="file" multiple>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@ -229,46 +229,53 @@
|
||||
});
|
||||
|
||||
let preId = '';
|
||||
let initUrl = new Array();
|
||||
initUrl.push([[${companyStore.image}]]);
|
||||
|
||||
let initUrl = [[${companyStore.image}]].split(",");
|
||||
let initConfig = [];
|
||||
for (const url of initUrl) {
|
||||
let config = {
|
||||
type: 'image',
|
||||
caption: '', // 展示的文件名
|
||||
url: 'idcardremove', // 删除url 必填,可以写一个空方法,不然无法删除初始化图片
|
||||
key: '', // 删除时Ajax向后台传递的参数
|
||||
};
|
||||
initConfig.push(config);
|
||||
}
|
||||
let clear = true;
|
||||
$("#image").fileinput({
|
||||
uploadUrl: ctx + 'common/newUpload',
|
||||
uploadUrl: ctx + 'common/newBatchUpload',
|
||||
uploadExtraData: {
|
||||
dataType: '30'
|
||||
dataType: '40'
|
||||
},
|
||||
maxFileCount: 1,
|
||||
autoReplace: true,
|
||||
showClose: false,
|
||||
uploadAsync: false,
|
||||
initialPreview: initUrl,
|
||||
initialPreviewFileType: 'image',
|
||||
initialPreviewAsData: true,
|
||||
// initialPreviewShowDelete:true, //是否显示初始化数据的删除按钮
|
||||
// initialPreviewConfig:initConfig, //初始化图片配置
|
||||
// overwriteInitial:false,
|
||||
layoutTemplates :{
|
||||
actionDelete:'', //去除上传预览的缩略图中的删除图标
|
||||
actionUpload:'',//去除上传预览缩略图中的上传图片图标;
|
||||
// actionZoom:'' //去除上传预览缩略图中的查看详情预览的缩略图标。
|
||||
},
|
||||
}).on('fileuploaded', function (event, data, previewId, index) {
|
||||
$("input[name='" + event.currentTarget.id + "']").val(data.response.url)
|
||||
preId = previewId;
|
||||
}).on('fileremoved', function (event, id, index) {
|
||||
$("input[name='" + event.currentTarget.id + "']").val('')
|
||||
}).on("filebatchselected", function(event, files) {
|
||||
if(preId !== ''){
|
||||
document.getElementById(preId).remove()
|
||||
}).on('filebatchuploadsuccess', function (event, data, previewId, index) {
|
||||
let rsp = data.response;
|
||||
let imgList = rsp.data;
|
||||
let imageUrlList = $("input[name='" + event.currentTarget.id + "']");
|
||||
let urlList = ('' === imageUrlList.val()) ? [] : imageUrlList.val().split(",");
|
||||
for(let i = 0;i < imgList.length; i++){
|
||||
urlList.push(imgList[i].url);
|
||||
}
|
||||
$("#image").fileinput("upload");
|
||||
}).on('fileerror', function (event,data,msg){
|
||||
$("input[name='" + event.currentTarget.id + "']").val('')
|
||||
// 清除当前的预览图 ,并隐藏 【移除】 按钮
|
||||
$(event.target).fileinput('clear').fileinput('unlock')
|
||||
$(event.target).parent().siblings('.fileinput-remove').hide()
|
||||
// 打开失败的信息弹窗
|
||||
$.modal.alertError('上传失败,请稍后重试')
|
||||
let urls = urlList.join(",");
|
||||
imageUrlList.val(urls);
|
||||
}).on("filecleared",function(event, data, msg){
|
||||
$("input[name='" + event.currentTarget.id + "']").val('');
|
||||
}).on("filebatchselected",function(event, data, msg){
|
||||
if(clear){
|
||||
$("input[name='" + event.currentTarget.id + "']").val('');
|
||||
clear = false;
|
||||
}
|
||||
).on("filecleared",function(event, data, msg){
|
||||
$("input[name='" + event.currentTarget.id + "']").val('')
|
||||
});
|
||||
})
|
||||
|
||||
let preId2 = '';
|
||||
let initUrl2 = new Array();
|
||||
|
||||
@ -67,7 +67,7 @@
|
||||
</div>
|
||||
|
||||
<div class="btn-group-sm" id="toolbar" role="group">
|
||||
<a class="btn btn-success" onclick="$.operate.add()" shiro:hasPermission="operation:store:add">
|
||||
<a class="btn btn-success" onclick="$.operate.addCustomize(null,1300,700)" shiro:hasPermission="operation:store:add">
|
||||
<i class="fa fa-plus"></i> 添加
|
||||
</a>
|
||||
<a class="btn btn-primary single disabled" onclick="$.operate.edit()" shiro:hasPermission="operation:store:edit">
|
||||
@ -192,7 +192,7 @@
|
||||
formatter: function(value, row, index) {
|
||||
var actions = [];
|
||||
actions.push('<a class="btn btn-success btn-xs ' + editFlag + ' btnOption" href="javascript:void(0)" onclick="assStoreUser(\'' + row.id + '\')"><i class="fa fa-edit"></i>门店用户</a> ');
|
||||
actions.push('<a class="btn btn-success btn-xs ' + editFlag + ' btnOption" href="javascript:void(0)" onclick="$.operate.edit(\'' + row.id + '\')"><i class="fa fa-edit"></i>修改</a> ');
|
||||
actions.push('<a class="btn btn-success btn-xs ' + editFlag + ' btnOption" href="javascript:void(0)" onclick="$.operate.editCustomize(\'' + row.id + '\',1300,700)"><i class="fa fa-edit"></i>修改</a> ');
|
||||
actions.push('<a class="btn btn-danger btn-xs ' + removeFlag + ' btnOption" href="javascript:void(0)" onclick="$.operate.remove(\'' + row.id + '\')"><i class="fa fa-remove"></i>删除</a>');
|
||||
if (row.status == 1) {
|
||||
actions.push('<a class="btn btn-success btn-xs ' + editFlag + ' btnOption" href="javascript:void(0)" onclick="enable(\'' + row.id + '\')"><i class="fa fa-edit"></i>启用</a> ');
|
||||
|
||||
Reference in New Issue
Block a user