diff --git a/pom.xml b/pom.xml index bb389d57d..e2bcd8560 100644 --- a/pom.xml +++ b/pom.xml @@ -29,6 +29,7 @@ 5.7.0 2.5 1.3.3 + 2.6.2 4.1.2 1.7 @@ -146,6 +147,13 @@ + + org.apache.commons + commons-pool2 + ${commons.pool.version} + + + commons-io commons-io @@ -185,7 +193,14 @@ fastjson ${fastjson.version} - + + + + com.aliyun.oss + aliyun-sdk-oss + 3.8.0 + + com.ruoyi @@ -227,6 +242,13 @@ ${ruoyi.version} + + + com.ruoyi + ruoyi-content + ${ruoyi.version} + + @@ -238,8 +260,7 @@ ruoyi-generator sino-activity ruoyi-common - sino-act-web - + ruoyi-content pom diff --git a/ruoyi-admin/pom.xml b/ruoyi-admin/pom.xml index b71689827..be6f08134 100644 --- a/ruoyi-admin/pom.xml +++ b/ruoyi-admin/pom.xml @@ -84,6 +84,12 @@ sino-activity + + + com.ruoyi + ruoyi-content + + diff --git a/ruoyi-admin/src/main/resources/application-druid.yml b/ruoyi-admin/src/main/resources/application-druid.yml index a85d3da47..a8d7f670d 100644 --- a/ruoyi-admin/src/main/resources/application-druid.yml +++ b/ruoyi-admin/src/main/resources/application-druid.yml @@ -54,4 +54,17 @@ spring: merge-sql: true wall: config: - multi-statement-allow: true \ No newline at end of file + multi-statement-allow: true + # redis配置 + redis: + database: 5 + host: db.sinosoftec.com + port: 6379 + password: sinosoft@ec~123 + timeout: 6000ms # 连接超时时长(毫秒) + lettuce: + pool: + max-active: 1000 # 连接池最大连接数(使用负值表示没有限制) + max-wait: -1ms # 连接池最大阻塞等待时间(使用负值表示没有限制) + max-idle: 10 # 连接池中的最大空闲连接 + min-idle: 5 # 连接池中的最小空闲连接 \ No newline at end of file diff --git a/ruoyi-admin/src/main/resources/templates/index.html b/ruoyi-admin/src/main/resources/templates/index.html index 365bbba2d..832b70f5b 100644 --- a/ruoyi-admin/src/main/resources/templates/index.html +++ b/ruoyi-admin/src/main/resources/templates/index.html @@ -4,7 +4,7 @@ - 互联网营销平台首页 + 互联网营销平台 diff --git a/ruoyi-common/pom.xml b/ruoyi-common/pom.xml index 7148fca3a..97db55059 100644 --- a/ruoyi-common/pom.xml +++ b/ruoyi-common/pom.xml @@ -59,6 +59,12 @@ commons-lang3 + + + org.apache.commons + commons-pool2 + + com.fasterxml.jackson.core @@ -101,6 +107,18 @@ javax.servlet-api + + + com.aliyun.oss + aliyun-sdk-oss + + + + + org.springframework.boot + spring-boot-starter-data-redis + + \ No newline at end of file diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/utils/DateUtils.java b/ruoyi-common/src/main/java/com/ruoyi/common/utils/DateUtils.java index b97e44e57..dd977279f 100644 --- a/ruoyi-common/src/main/java/com/ruoyi/common/utils/DateUtils.java +++ b/ruoyi-common/src/main/java/com/ruoyi/common/utils/DateUtils.java @@ -19,9 +19,11 @@ public class DateUtils extends org.apache.commons.lang3.time.DateUtils public static String YYYY_MM_DD = "yyyy-MM-dd"; + public static String HH_MM_SS = "HH:mm:ss"; + public static String YYYYMMDDHHMMSS = "yyyyMMddHHmmss"; - public static String YYYYMMDDHHMMSSS = "yyyyMMddHHmmssSSS"; + public static String YYYYMMDDHHMMSSSSS = "yyyyMMddHHmmssSSS"; public static String YYYY_MM_DD_HH_MM_SS = "yyyy-MM-dd HH:mm:ss"; @@ -50,6 +52,16 @@ public class DateUtils extends org.apache.commons.lang3.time.DateUtils return dateTimeNow(YYYY_MM_DD); } + public static String getTimeNow() + { + return dateTimeNow(HH_MM_SS); + } + + public static String getMillisecond() + { + return dateTimeNow(YYYYMMDDHHMMSSSSS); + } + public static final String getTime() { return dateTimeNow(YYYY_MM_DD_HH_MM_SS); diff --git a/ruoyi-content/pom.xml b/ruoyi-content/pom.xml new file mode 100644 index 000000000..a5c6c22e5 --- /dev/null +++ b/ruoyi-content/pom.xml @@ -0,0 +1,28 @@ + + + + ruoyi + com.ruoyi + 4.6.0 + + 4.0.0 + + ruoyi-content + + + 内容中心模块 + + + + + + + com.ruoyi + ruoyi-common + + + + + \ No newline at end of file diff --git a/ruoyi-content/src/main/java/com/ruoyi/content/constants/PropertiesConstants.java b/ruoyi-content/src/main/java/com/ruoyi/content/constants/PropertiesConstants.java new file mode 100644 index 000000000..6de0cbd01 --- /dev/null +++ b/ruoyi-content/src/main/java/com/ruoyi/content/constants/PropertiesConstants.java @@ -0,0 +1,40 @@ +package com.ruoyi.content.constants; + +/** + * 配置文件常量 + * + * @author admin + */ +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 FILE_PATH = "/app/contentMKTCms/webapp/WEB-INF/static/"; + public static final String PROJECT_LOCALPATH = "/app/contentMKTCms/webapp"; + 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/"; + public static final String OSSENDPOINT = "oss-cn-qingdao.aliyuncs.com"; + public static final String OSSID = "LTAI4GFWLJ2Wtbyj1x5wDoA4"; + public static final String OSSKEY = "7n4eLwnFaHAh40hPMOfNpK4yYNvmLG"; + public static final String BUCKETNAME = "sinosoftec"; + public static final String OSSPATH = "mkt/YXPT/"; + + public static final String IS_NULL2 = "\"\""; + public static final String CURRENT_USER = "user"; + public static final String I_SUCC = "succ"; + public static final String GALLERY_IMG_PATH = "gallery/img/"; + public static final String GALLERY_MINIMG_PATH = "gallery/min-img/"; + public static final String REDIRECT_ARTICLE_VIEW = "http://uat-mktasst.ihxlife.com/api/v1.0/articleView?"; + public static final String GVQYH_ARTICLE_WRITE = "http://qyhgateway.ihxlife.com/api/v2/article/write?redirectUrl="; + public static final String GVQYH_INDEX = "http://qyhgateway.ihxlife.com/api/v1/oauth2/index?state="; + public static final String AD_IMG_PATH = "ad/"; + + //信鸽系统相关配置 + public static final String NOTIFY_UID = "pyqzs"; + public static final String NOTIFY_KEY = "a12dadf_12asdinktn0091d1fzxpyqzs1da249kk"; + public static final String NOTIFY_URL = "http://uat-notify.ihxlife.com/notify/api/v1/qyh/img/send"; + public static final String NOTIFY_AGENTID = "1000024"; + +} diff --git a/ruoyi-content/src/main/java/com/ruoyi/content/controller/AdvertisementController.java b/ruoyi-content/src/main/java/com/ruoyi/content/controller/AdvertisementController.java new file mode 100644 index 000000000..5e514be86 --- /dev/null +++ b/ruoyi-content/src/main/java/com/ruoyi/content/controller/AdvertisementController.java @@ -0,0 +1,111 @@ +package com.ruoyi.content.controller; + +import java.util.List; + +import org.apache.shiro.authz.annotation.RequiresPermissions; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Controller; +import org.springframework.ui.ModelMap; +import org.springframework.web.bind.annotation.*; +import com.ruoyi.common.annotation.Log; +import com.ruoyi.common.enums.BusinessType; +import com.ruoyi.content.domain.CmsArticleAdInfo; +import com.ruoyi.content.service.ICmsArticleAdInfoService; +import com.ruoyi.common.core.controller.BaseController; +import com.ruoyi.common.core.domain.AjaxResult; +import com.ruoyi.common.utils.poi.ExcelUtil; +import com.ruoyi.common.core.page.TableDataInfo; +import org.springframework.web.multipart.MultipartFile; + +/** + * 文章广告Controller + * + * @author ruoyi + * @date 2021-03-23 + */ +@Controller +@RequestMapping("/content/adverts") +public class AdvertisementController extends BaseController { + + private String prefix = "content/adverts"; + + @Autowired + private ICmsArticleAdInfoService cmsArticleAdInfoService; + + @GetMapping() + public String adverts() { + return prefix + "/adverts"; + } + + /** + * 查询文章广告列表 + */ + @PostMapping("/list") + @ResponseBody + public TableDataInfo list(CmsArticleAdInfo cmsArticleAdInfo) { + startPage(); + List list = cmsArticleAdInfoService.selectCmsArticleAdInfoList(cmsArticleAdInfo); + return getDataTable(list); + } + + /** + * 导出文章广告列表 + */ + @Log(title = "文章广告", businessType = BusinessType.EXPORT) + @PostMapping("/export") + @ResponseBody + public AjaxResult export(CmsArticleAdInfo cmsArticleAdInfo) { + List list = cmsArticleAdInfoService.selectCmsArticleAdInfoList(cmsArticleAdInfo); + ExcelUtil util = new ExcelUtil(CmsArticleAdInfo.class); + return util.exportExcel(list, "adverts"); + } + + /** + * 新增文章广告 + */ + @GetMapping("/add") + public String add() { + return prefix + "/add"; + } + + /** + * 新增保存文章广告 + */ + @Log(title = "文章广告", businessType = BusinessType.INSERT) + @RequestMapping("/add") + @ResponseBody + public AjaxResult addSave(@RequestParam("addImg") MultipartFile[] files, CmsArticleAdInfo cmsArticleAdInfo) { + MultipartFile file = files[0]; + return toAjax(cmsArticleAdInfoService.insertCmsArticleAdInfo(file, cmsArticleAdInfo)); + } + + /** + * 修改文章广告 + */ + @RequestMapping("/edit/{adId}") + public String edit(@PathVariable("adId") Long adId, ModelMap mmap) { + CmsArticleAdInfo cmsArticleAdInfo = cmsArticleAdInfoService.selectCmsArticleAdInfoById(adId); + mmap.put("cmsArticleAdInfo", cmsArticleAdInfo); + return prefix + "/edit"; + } + + /** + * 修改保存文章广告 + */ + @Log(title = "文章广告", businessType = BusinessType.UPDATE) + @PostMapping("/edit") + @ResponseBody + public AjaxResult editSave(CmsArticleAdInfo cmsArticleAdInfo) { + return toAjax(cmsArticleAdInfoService.updateCmsArticleAdInfo(cmsArticleAdInfo)); + } + + /** + * 删除文章广告 + */ + @Log(title = "文章广告", businessType = BusinessType.DELETE) + @PostMapping("/remove") + @ResponseBody + public AjaxResult remove(String ids) { + return toAjax(cmsArticleAdInfoService.deleteCmsArticleAdInfoByIds(ids)); + } +} diff --git a/ruoyi-content/src/main/java/com/ruoyi/content/domain/CmsArticleAdInfo.java b/ruoyi-content/src/main/java/com/ruoyi/content/domain/CmsArticleAdInfo.java new file mode 100644 index 000000000..cf1ad9be8 --- /dev/null +++ b/ruoyi-content/src/main/java/com/ruoyi/content/domain/CmsArticleAdInfo.java @@ -0,0 +1,277 @@ +package com.ruoyi.content.domain; + +import org.apache.commons.lang3.builder.ToStringBuilder; +import org.apache.commons.lang3.builder.ToStringStyle; +import com.ruoyi.common.annotation.Excel; +import com.ruoyi.common.core.domain.BaseEntity; + +/** + * 文章广告对象 cms_article_ad_info + * + * @author ruoyi + * @date 2021-03-23 + */ +public class CmsArticleAdInfo { + + private static final long serialVersionUID = 1L; + + /** + * + */ + private Long adId; + + /** + * 公司id + */ + @Excel(name = "公司id") + private String companyId; + + /** + * 广告类型 + */ + @Excel(name = "广告类型") + private String adType; + + /** + * 广告类型名 + */ + @Excel(name = "广告类型名") + private String adTypeName; + + /** + * 广告跳转地址 + */ + @Excel(name = "广告跳转地址") + private String adLinkUrl; + + /** + * 广告标题 + */ + @Excel(name = "广告标题") + private String adTitle; + + /** + * 广告名称 + */ + @Excel(name = "广告名称") + private String adName; + + /** + * 广告简介 + */ + @Excel(name = "广告简介") + private String adSummary; + + /** + * 广告背景颜色 + */ + @Excel(name = "广告背景颜色") + private String adColorType; + + /** + * 广告图片地址 + */ + @Excel(name = "广告图片地址") + private String adImageUrl; + + /** + * 广告状态 0:展示 1:不可用 + */ + @Excel(name = "广告状态 0:展示 1:不可用") + private String adState; + + /** + * + */ + @Excel(name = "") + private String createDate; + + /** + * + */ + @Excel(name = "") + private String createTime; + + /** + * 广告创建者 + */ + @Excel(name = "广告创建者") + private String createUser; + + /** + * + */ + @Excel(name = "") + private String updateUser; + + /** + * + */ + @Excel(name = "") + private String updateDate; + + public String getCreateTime() { + return createTime; + } + + public void setCreateTime(String createTime) { + this.createTime = createTime; + } + + public String getUpdateTime() { + return updateTime; + } + + public void setUpdateTime(String updateTime) { + this.updateTime = updateTime; + } + + /** + * + */ + @Excel(name = "") + private String updateTime; + + public void setAdId(Long adId) { + this.adId = adId; + } + + public Long getAdId() { + return adId; + } + + public void setCompanyId(String companyId) { + this.companyId = companyId; + } + + public String getCompanyId() { + return companyId; + } + + public void setAdType(String adType) { + this.adType = adType; + } + + public String getAdType() { + return adType; + } + + public void setAdTypeName(String adTypeName) { + this.adTypeName = adTypeName; + } + + public String getAdTypeName() { + return adTypeName; + } + + public void setAdLinkUrl(String adLinkUrl) { + this.adLinkUrl = adLinkUrl; + } + + public String getAdLinkUrl() { + return adLinkUrl; + } + + public void setAdTitle(String adTitle) { + this.adTitle = adTitle; + } + + public String getAdTitle() { + return adTitle; + } + + public void setAdName(String adName) { + this.adName = adName; + } + + public String getAdName() { + return adName; + } + + public void setAdSummary(String adSummary) { + this.adSummary = adSummary; + } + + public String getAdSummary() { + return adSummary; + } + + public void setAdColorType(String adColorType) { + this.adColorType = adColorType; + } + + public String getAdColorType() { + return adColorType; + } + + public void setAdImageUrl(String adImageUrl) { + this.adImageUrl = adImageUrl; + } + + public String getAdImageUrl() { + return adImageUrl; + } + + public void setAdState(String adState) { + this.adState = adState; + } + + public String getAdState() { + return adState; + } + + public void setCreateDate(String createDate) { + this.createDate = createDate; + } + + public String getCreateDate() { + return createDate; + } + + public void setCreateUser(String createUser) { + this.createUser = createUser; + } + + public String getCreateUser() { + return createUser; + } + + public void setUpdateUser(String updateUser) { + this.updateUser = updateUser; + } + + public String getUpdateUser() { + return updateUser; + } + + public void setUpdateDate(String updateDate) { + this.updateDate = updateDate; + } + + public String getUpdateDate() { + return updateDate; + } + + @Override + public String toString() { + return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE) + .append("adId", getAdId()) + .append("companyId", getCompanyId()) + .append("adType", getAdType()) + .append("adTypeName", getAdTypeName()) + .append("adLinkUrl", getAdLinkUrl()) + .append("adTitle", getAdTitle()) + .append("adName", getAdName()) + .append("adSummary", getAdSummary()) + .append("adColorType", getAdColorType()) + .append("adImageUrl", getAdImageUrl()) + .append("adState", getAdState()) + .append("createDate", getCreateDate()) + .append("createTime", getCreateTime()) + .append("createUser", getCreateUser()) + .append("updateUser", getUpdateUser()) + .append("updateDate", getUpdateDate()) + .append("updateTime", getUpdateTime()) + .toString(); + } +} diff --git a/ruoyi-content/src/main/java/com/ruoyi/content/mapper/CmsArticleAdInfoMapper.java b/ruoyi-content/src/main/java/com/ruoyi/content/mapper/CmsArticleAdInfoMapper.java new file mode 100644 index 000000000..f3af767b5 --- /dev/null +++ b/ruoyi-content/src/main/java/com/ruoyi/content/mapper/CmsArticleAdInfoMapper.java @@ -0,0 +1,64 @@ +package com.ruoyi.content.mapper; + + +import com.ruoyi.content.domain.CmsArticleAdInfo; +import org.springframework.stereotype.Repository; + +import java.util.List; + +/** + * 文章广告Mapper接口 + * + * @author ruoyi + * @date 2021-03-23 + */ +@Repository +public interface CmsArticleAdInfoMapper { + /** + * 查询文章广告 + * + * @param adId 文章广告ID + * @return 文章广告 + */ + public CmsArticleAdInfo selectCmsArticleAdInfoById(Long adId); + + /** + * 查询文章广告列表 + * + * @param cmsArticleAdInfo 文章广告 + * @return 文章广告集合 + */ + public List selectCmsArticleAdInfoList(CmsArticleAdInfo cmsArticleAdInfo); + + /** + * 新增文章广告 + * + * @param cmsArticleAdInfo 文章广告 + * @return 结果 + */ + public int insertCmsArticleAdInfo(CmsArticleAdInfo cmsArticleAdInfo); + + /** + * 修改文章广告 + * + * @param cmsArticleAdInfo 文章广告 + * @return 结果 + */ + public int updateCmsArticleAdInfo(CmsArticleAdInfo cmsArticleAdInfo); + + /** + * 删除文章广告 + * + * @param adId 文章广告ID + * @return 结果 + */ + public int deleteCmsArticleAdInfoById(Long adId); + + /** + * 批量删除文章广告 + * + * @param adIds 需要删除的数据ID + * @return 结果 + */ + public int deleteCmsArticleAdInfoByIds(String[] adIds); +} diff --git a/ruoyi-content/src/main/java/com/ruoyi/content/service/ICmsArticleAdInfoService.java b/ruoyi-content/src/main/java/com/ruoyi/content/service/ICmsArticleAdInfoService.java new file mode 100644 index 000000000..3ec547fc5 --- /dev/null +++ b/ruoyi-content/src/main/java/com/ruoyi/content/service/ICmsArticleAdInfoService.java @@ -0,0 +1,63 @@ +package com.ruoyi.content.service; + +import java.util.List; + +import com.ruoyi.content.domain.CmsArticleAdInfo; +import org.springframework.web.multipart.MultipartFile; + +/** + * 文章广告Service接口 + * + * @author ruoyi + * @date 2021-03-23 + */ +public interface ICmsArticleAdInfoService { + /** + * 查询文章广告 + * + * @param adId 文章广告ID + * @return 文章广告 + */ + public CmsArticleAdInfo selectCmsArticleAdInfoById(Long adId); + + /** + * 查询文章广告列表 + * + * @param cmsArticleAdInfo 文章广告 + * @return 文章广告集合 + */ + public List selectCmsArticleAdInfoList(CmsArticleAdInfo cmsArticleAdInfo); + + /** + * 新增文章广告 + * + * @param file 广告图片 + * @param cmsArticleAdInfo 文章广告 + * @return + */ + public int insertCmsArticleAdInfo(MultipartFile file, CmsArticleAdInfo cmsArticleAdInfo); + + /** + * 修改文章广告 + * + * @param cmsArticleAdInfo 文章广告 + * @return 结果 + */ + public int updateCmsArticleAdInfo(CmsArticleAdInfo cmsArticleAdInfo); + + /** + * 批量删除文章广告 + * + * @param ids 需要删除的数据ID + * @return 结果 + */ + public int deleteCmsArticleAdInfoByIds(String ids); + + /** + * 删除文章广告信息 + * + * @param adId 文章广告ID + * @return 结果 + */ + public int deleteCmsArticleAdInfoById(Long adId); +} diff --git a/ruoyi-content/src/main/java/com/ruoyi/content/service/impl/CmsArticleAdInfoServiceImpl.java b/ruoyi-content/src/main/java/com/ruoyi/content/service/impl/CmsArticleAdInfoServiceImpl.java new file mode 100644 index 000000000..b3f2f3b67 --- /dev/null +++ b/ruoyi-content/src/main/java/com/ruoyi/content/service/impl/CmsArticleAdInfoServiceImpl.java @@ -0,0 +1,132 @@ +package com.ruoyi.content.service.impl; + +import com.ruoyi.common.core.text.Convert; +import com.ruoyi.common.utils.DateUtils; +import com.ruoyi.content.constants.PropertiesConstants; +import com.ruoyi.content.domain.CmsArticleAdInfo; +import com.ruoyi.content.mapper.CmsArticleAdInfoMapper; +import com.ruoyi.content.service.ICmsArticleAdInfoService; +import com.ruoyi.content.utils.OSSUtil; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.web.multipart.MultipartFile; + +import java.io.IOException; +import java.util.List; + +/** + * 文章广告Service业务层处理 + * + * @author ruoyi + * @date 2021-03-23 + */ +@Service +public class CmsArticleAdInfoServiceImpl implements ICmsArticleAdInfoService { + + private static final Logger LOGGER = LoggerFactory.getLogger(CmsArticleAdInfoServiceImpl.class); + + @Autowired + private CmsArticleAdInfoMapper cmsArticleAdInfoMapper; + + /** + * 查询文章广告 + * + * @param adId 文章广告ID + * @return 文章广告 + */ + @Override + public CmsArticleAdInfo selectCmsArticleAdInfoById(Long adId) { + return cmsArticleAdInfoMapper.selectCmsArticleAdInfoById(adId); + } + + /** + * 查询文章广告列表 + * + * @param cmsArticleAdInfo 文章广告 + * @return 文章广告 + */ + @Override + public List selectCmsArticleAdInfoList(CmsArticleAdInfo cmsArticleAdInfo) { + cmsArticleAdInfo.setAdState("0"); + cmsArticleAdInfo.setCompanyId("1"); + return cmsArticleAdInfoMapper.selectCmsArticleAdInfoList(cmsArticleAdInfo); + } + + /** + * 新增文章广告 + * + * @param file 广告图片 + * @param cmsArticleAdInfo 文章广告 + * @return + */ + @Override + public int insertCmsArticleAdInfo(MultipartFile file, CmsArticleAdInfo cmsArticleAdInfo) { + if (!file.isEmpty()) { + String fileName = file.getOriginalFilename();// 文件名 + String ext = fileName.substring(fileName.lastIndexOf("."), fileName.length());// 文件后缀 + String fileTime = DateUtils.getMillisecond(); + fileName = PropertiesConstants.AD_IMG_PATH + fileTime + ext;// OSS保存路径 + String flag = null; + try { + flag = OSSUtil.uploadFileByInputStream(PropertiesConstants.OSSENDPOINT, PropertiesConstants.OSSID, PropertiesConstants.OSSKEY, + PropertiesConstants.BUCKETNAME, file.getInputStream(), PropertiesConstants.OSSPATH + fileName); + } catch (IOException e) { + LOGGER.error("上传阿里云失败!", e); + } + if (null == flag || flag.equals("false")) { + LOGGER.info("广告图片上传oss失败"); + return 0; + } else { + cmsArticleAdInfo.setAdImageUrl(PropertiesConstants.OSS_URL + PropertiesConstants.OSSPATH + fileName); + } + } + String date = DateUtils.getDate(); + String time = DateUtils.getTimeNow(); + cmsArticleAdInfo.setAdLinkUrl(cmsArticleAdInfo.getAdLinkUrl() + "("); + cmsArticleAdInfo.setCompanyId("1"); + cmsArticleAdInfo.setAdState("0"); + cmsArticleAdInfo.setCreateDate(date); + cmsArticleAdInfo.setCreateTime(time); + cmsArticleAdInfo.setCreateUser("company"); + cmsArticleAdInfo.setUpdateDate(date); + cmsArticleAdInfo.setUpdateTime(time); + cmsArticleAdInfo.setUpdateUser("company"); + return cmsArticleAdInfoMapper.insertCmsArticleAdInfo(cmsArticleAdInfo); + } + + /** + * 修改文章广告 + * + * @param cmsArticleAdInfo 文章广告 + * @return 结果 + */ + @Override + public int updateCmsArticleAdInfo(CmsArticleAdInfo cmsArticleAdInfo) { + cmsArticleAdInfo.setUpdateTime(DateUtils.getDate()); + return cmsArticleAdInfoMapper.updateCmsArticleAdInfo(cmsArticleAdInfo); + } + + /** + * 删除文章广告对象 + * + * @param ids 需要删除的数据ID + * @return 结果 + */ + @Override + public int deleteCmsArticleAdInfoByIds(String ids) { + return cmsArticleAdInfoMapper.deleteCmsArticleAdInfoByIds(Convert.toStrArray(ids)); + } + + /** + * 删除文章广告信息 + * + * @param adId 文章广告ID + * @return 结果 + */ + @Override + public int deleteCmsArticleAdInfoById(Long adId) { + return cmsArticleAdInfoMapper.deleteCmsArticleAdInfoById(adId); + } +} diff --git a/ruoyi-content/src/main/java/com/ruoyi/content/utils/OSSUtil.java b/ruoyi-content/src/main/java/com/ruoyi/content/utils/OSSUtil.java new file mode 100644 index 000000000..f358283f7 --- /dev/null +++ b/ruoyi-content/src/main/java/com/ruoyi/content/utils/OSSUtil.java @@ -0,0 +1,324 @@ +package com.ruoyi.content.utils; + +import com.aliyun.oss.OSSClient; +import com.aliyun.oss.model.*; +import com.ruoyi.content.constants.PropertiesConstants; +import org.apache.commons.lang3.StringUtils; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import java.io.*; +import java.util.HashMap; +import java.util.Map; + +public class OSSUtil { + + private static final Logger logger = LoggerFactory.getLogger(OSSUtil.class); + + /** + * 上传文件(文件输入流)到阿里云OSS + * + * @param ossEndPoint 阿里云OSS提供的ossEndPoint + * @param ossId 阿里云OSS提供的ossId + * @param ossKey 阿里云OSS提供的ossKey + * @param bucketName 阿里云OSS提供的ossBucket + * @param input 文件输入流 * @param ossPath oss上保存文件的路径 + * @throws Exception + */ + public static String uploadFileByInputStream(String ossEndPoint, String ossId, String ossKey, String bucketName, + InputStream input, String ossPath) { + try { + ObjectMetadata objectMeta = new ObjectMetadata(); + // objectMeta.setContentLength(file.length()); + // 可以在metadata中标记文件类型 + objectMeta.setContentType("multipart/form-data"); + OSSClient client = createOSSClient(ossEndPoint, ossId, ossKey); + PutObjectResult result = client.putObject(bucketName, ossPath, input, objectMeta); + client.shutdown(); + logger.info("上传阿里云OSS结果【{}】", result.getETag()); + return "success"; + } catch (Exception e) { + e.printStackTrace(); + logger.info("上传阿里云OSS出错!!"); + return "false"; + } finally { + if (null != input) { + try { + input.close(); + } catch (IOException e) { + e.printStackTrace(); + logger.info("上传阿里云OSS出错!"); + } + } + } + } + + /** + * 上传文件到阿里云OSS + * + * @param ossEndPoint 阿里云OSS提供的ossEndPoint + * @param ossId 阿里云OSS提供的ossId + * @param ossKey 阿里云OSS提供的ossKey + * @param bucketName 阿里云OSS提供的ossBucket + * @param localPath 本地文件的路径 + * @param ossPath oss上保存文件的路径 + * @throws Exception + */ + public static void uploadFile(String ossEndPoint, String ossId, String ossKey, String bucketName, String localPath, + String ossPath) { + InputStream input = null; + try { + File file = new File(localPath); + ObjectMetadata objectMeta = new ObjectMetadata(); + objectMeta.setContentLength(file.length()); + // 可以在metadata中标记文件类型 + objectMeta.setContentType("multipart/form-data"); + input = new FileInputStream(file); + OSSClient client = createOSSClient(ossEndPoint, ossId, ossKey); + PutObjectResult result = client.putObject(bucketName, ossPath, input, objectMeta); + client.shutdown(); + logger.info("上传阿里云OSS结果【{}】", result.getETag()); + } catch (Exception e) { + e.printStackTrace(); + logger.info("上传阿里云OSS出错!!"); + } finally { + if (null != input) { + try { + input.close(); + } catch (IOException e) { + e.printStackTrace(); + logger.info("上传阿里云OSS出错!"); + } + } + } + } + + /** + * 上传html文件到阿里云OSS + * + * @param ossEndPoint 阿里云OSS提供的ossEndPoint + * @param ossId 阿里云OSS提供的ossId + * @param ossKey 阿里云OSS提供的ossKey + * @param bucketName 阿里云OSS提供的ossBucket + * @param localPath 本地文件的路径 + * @param ossPath oss上保存文件的路径 + * @throws Exception + */ + public static void uploadFileHtml(String ossEndPoint, String ossId, String ossKey, String bucketName, String localPath, + String ossPath) { + InputStream input = null; + try { + File file = new File(localPath); + ObjectMetadata objectMeta = new ObjectMetadata(); + objectMeta.setContentLength(file.length()); + // 可以在metadata中标记文件类型 + objectMeta.setContentType("text/html"); + input = new FileInputStream(file); + OSSClient client = createOSSClient(ossEndPoint, ossId, ossKey); + PutObjectResult result = client.putObject(bucketName, ossPath, input, objectMeta); + client.shutdown(); + logger.info("上传阿里云OSS结果【{}】", result.getETag()); + } catch (Exception e) { + e.printStackTrace(); + logger.info("上传阿里云OSS出错!!"); + } finally { + if (null != input) { + try { + input.close(); + } catch (IOException e) { + e.printStackTrace(); + logger.info("上传阿里云OSS出错!"); + } + } + } + } + + /** + * 从阿里云OSS上下载文件 (不保存本地) + * + * @param ossEndPoint 阿里云OSS提供的ossEndPointOut + * @param ossId 阿里云OSS提供的ossId + * @param ossKey 阿里云OSS提供的ossKey + * @param ossBucket 阿里云OSS提供的ossBucket + * @param path 阿里云OSS上保存文件的路径 + * @return + */ + public static byte[] downloadFile(String ossEndPoint, String ossId, String ossKey, String ossBucket, String path) { + OSSClient client = createOSSClient(ossEndPoint, ossId, ossKey); + OSSObject ossObject = client.getObject(ossBucket, path); + ObjectMetadata meta = client.getObjectMetadata(ossBucket, path); + client.shutdown(); + meta.getContentEncoding(); + InputStream inputStream = null; + ByteArrayOutputStream bos = null; + byte[] b = new byte[1024]; + int len; + try { + inputStream = ossObject.getObjectContent(); + bos = new ByteArrayOutputStream(); + while ((len = inputStream.read(b)) != -1) { + bos.write(b, 0, len); + } + } catch (IOException e) { + e.printStackTrace(); + logger.info("从阿里云OSS下载文件出错!"); + } finally { + if (null != inputStream) { + try { + inputStream.close(); + } catch (IOException e) { + e.printStackTrace(); + logger.info("从阿里云OSS下载文件出错!"); + } + } + if (null != bos) { + try { + bos.close(); + } catch (IOException e) { + e.printStackTrace(); + logger.info("从阿里云OSS下载文件出错!"); + } + } + } + return bos.toByteArray(); + } + + /** + * 从阿里云OSS上下载文件 并保存指定路径下 + * + * @param ossEndPoint 阿里云OSS提供的ossEndPoint + * @param ossId 阿里云OSS提供的ossId + * @param ossKey 阿里云OSS提供的ossKey + * @param bucketName 阿里云OSS提供的ossBucket + * @param ossPath 阿里云OSS上保存文件的路径 + * @param localPath 保存本地的路径(包括文件名) + * @return oss上下载下来的文件的字节数组 + */ + public static void downloadAndSaveFile(String ossEndPoint, String ossId, String ossKey, String bucketName, + String ossPath, String localPath) { + OSSClient client = createOSSClient(ossEndPoint, ossId, ossKey); + + File localFileDir = new File(localPath); + if (!localFileDir.exists()) { + localFileDir.mkdirs(); + if (!localFileDir.exists()) { + logger.info("本地目录不存在,且尝试创建失败!"); + } + } + + File file = new File(localPath); + logger.info("创建文件目录:" + localPath); + client.getObject(new GetObjectRequest(bucketName, ossPath), file); + client.shutdown(); + + } + + /** + * 删除阿里云OSS文件 + * + * @param ossEndPoint 阿里云OSS提供的ossEndPoint + * @param ossId 阿里云OSS提供的ossId + * @param ossKey 阿里云OSS提供的ossKey + * @param ossBucket 阿里云OSS提供的ossBucket + * @param path 阿里云OSS上保存文件的路径 + * @return + */ + public static void deleteFile(String ossEndPoint, String ossId, String ossKey, String ossBucket, String path) { + OSSClient client = createOSSClient(ossEndPoint, ossId, ossKey); + client.deleteObject(ossBucket, path); + client.shutdown(); + } + + /** + * 查询OSS内的文件列表 + * + * @param ossEndPoint + * @param ossId + * @param ossKey + * @param bucketName + * @param path + */ + public static void findFileList(String ossEndPoint, String ossId, String ossKey, String bucketName, String path) { + OSSClient client = createOSSClient(ossEndPoint, ossId, ossKey); + // 构造ListObjectsRequest请求 + ListObjectsRequest listObjectsRequest = new ListObjectsRequest(bucketName); + if (StringUtils.isNotBlank(path)) { + listObjectsRequest.setPrefix(path); // fun/ + } + // 递归列出fun目录下的所有文件 + ObjectListing listing = client.listObjects(listObjectsRequest); + // 遍历所有Object + logger.info("Objects内的文件:"); + for (OSSObjectSummary objectSummary : listing.getObjectSummaries()) { + logger.info("文件名【{}】, 文件大小【{}】", objectSummary.getKey(), objectSummary.getSize()); + } + // 遍历所有CommonPrefix + logger.info("\nCommonPrefixs:"); + for (String commonPrefix : listing.getCommonPrefixes()) { + logger.info(commonPrefix); + } + } + + private static OSSClient createOSSClient(String ossEndPoint, String ossId, String ossKey) { + // ClientConfiguration config = new ClientConfiguration(); + // config.setProxyHost("10.0.251.94"); + // config.setProxyPort(8080); + // config.setProxyUsername("gaining"); + // config.setProxyPassword("abcd123%"); + // TODO + // 本地设置代理 + // OSSClient client = new OSSClient(ossEndPoint, ossId, ossKey, config); + OSSClient client = new OSSClient(ossEndPoint, ossId, ossKey); + return client; + } + + public static void main(String[] args) { + uploadFile("oss-cn-szfinance.aliyuncs.com", + "LTAIsVIQ8j9WueV2", "Il5Y1tugBi9u8giGi9n4lQhAWwkcih", + "hx-cdn-int", "G:\\111.jpg", "gv/YXPT/network/article/450.jpg"); +// uploadFile("oss-cn-beijing.aliyuncs.com", "6TpnBLywxITY6YNA", +// "dbYhx45upstobHmBBErQQkZlrC017X", "lifeilong", "F:\\图片\\460.jpg", +// "我的照片/460.jpg"); + } + + public static Map uploadFileByInputStreamReturnUrl(String ossEndPoint, String ossId, String ossKey, + String bucketName, InputStream input, String ossPath) { + Map map = new HashMap(); + try { + ObjectMetadata objectMeta = new ObjectMetadata(); + // objectMeta.setContentLength(file.length()); + // 可以在metadata中标记文件类型 + objectMeta.setContentType("multipart/form-data"); + OSSClient client = createOSSClient(ossEndPoint, ossId, ossKey); + PutObjectResult result = client.putObject(bucketName, ossPath, input, objectMeta); + client.shutdown(); + logger.info("上传阿里云OSS结果【{}】", result.getETag()); + map.put("ossFIleId", result.getETag()); + // 设置URL过期时间为10年 3600l* 1000*24*365*10 +// Date expiration = new Date(new Date().getTime() + 3600l * 1000 * 24 * 365 * 10); + // 生成URL +// URL url = client.generatePresignedUrl(bucketName, ossPath, expiration); +// if (url != null) { + map.put("result", true); + map.put("url", PropertiesConstants.OSS_URL + ossPath); +// } else { +// msg.setResult(false); +// msg.setInfo("上传阿里云获取访问地址失败!"); +// } + return map; + } catch (Exception e) { + logger.error("上传阿里云OSS出错!!", e); + map.put("result", false); + return map; + } finally { + if (null != input) { + try { + input.close(); + } catch (IOException e) { + logger.error("上传阿里云OSS出错!", e); + } + } + } + } + +} diff --git a/ruoyi-content/src/main/resources/mapper/content/CmsArticleAdInfoMapper.xml b/ruoyi-content/src/main/resources/mapper/content/CmsArticleAdInfoMapper.xml new file mode 100644 index 000000000..c56322d90 --- /dev/null +++ b/ruoyi-content/src/main/resources/mapper/content/CmsArticleAdInfoMapper.xml @@ -0,0 +1,133 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + select AD_ID, COMPANY_ID, AD_TYPE, AD_TYPE_NAME, AD_LINK_URL, AD_TITLE, AD_NAME, AD_SUMMARY, AD_COLOR_TYPE, AD_IMAGE_URL, AD_STATE, CREATE_DATE, CREATE_TIME, CREATE_USER, UPDATE_USER, UPDATE_DATE, UPDATE_TIME from cms_article_ad_info + + + + + + + + insert into cms_article_ad_info + + COMPANY_ID, + AD_TYPE, + AD_TYPE_NAME, + AD_LINK_URL, + AD_TITLE, + AD_NAME, + AD_SUMMARY, + AD_COLOR_TYPE, + AD_IMAGE_URL, + AD_STATE, + CREATE_DATE, + CREATE_TIME, + CREATE_USER, + UPDATE_USER, + UPDATE_DATE, + UPDATE_TIME, + + + #{companyId}, + #{adType}, + #{adTypeName}, + #{adLinkUrl}, + #{adTitle}, + #{adName}, + #{adSummary}, + #{adColorType}, + #{adImageUrl}, + #{adState}, + #{createDate}, + #{createTime}, + #{createUser}, + #{updateUser}, + #{updateDate}, + #{updateTime}, + + + + + update cms_article_ad_info + + COMPANY_ID = #{companyId}, + AD_TYPE = #{adType}, + AD_TYPE_NAME = #{adTypeName}, + AD_LINK_URL = #{adLinkUrl}, + AD_TITLE = #{adTitle}, + AD_NAME = #{adName}, + AD_SUMMARY = #{adSummary}, + AD_COLOR_TYPE = #{adColorType}, + AD_IMAGE_URL = #{adImageUrl}, + AD_STATE = #{adState}, + CREATE_DATE = #{createDate}, + CREATE_TIME = #{createTime}, + CREATE_USER = #{createUser}, + UPDATE_USER = #{updateUser}, + UPDATE_DATE = #{updateDate}, + UPDATE_TIME = #{updateTime}, + + where AD_ID = #{adId} + + + + delete from cms_article_ad_info where AD_ID = #{adId} + + + + delete from cms_article_ad_info where AD_ID in + + #{adId} + + + + \ No newline at end of file diff --git a/ruoyi-content/src/main/resources/static/css/fileinput.min.css b/ruoyi-content/src/main/resources/static/css/fileinput.min.css new file mode 100644 index 000000000..43839bc2b --- /dev/null +++ b/ruoyi-content/src/main/resources/static/css/fileinput.min.css @@ -0,0 +1,12 @@ +/*! + * bootstrap-fileinput v4.4.2 + * http://plugins.krajee.com/file-input + * + * Krajee default styling for bootstrap-fileinput. + * + * Author: Kartik Visweswaran + * Copyright: 2014 - 2017, Kartik Visweswaran, Krajee.com + * + * Licensed under the BSD 3-Clause + * https://github.com/kartik-v/bootstrap-fileinput/blob/master/LICENSE.md + */.file-drop-zone,.krajee-default .file-preview-audio audio,.krajee-default .file-preview-image,.krajee-default .file-preview-other{vertical-align:middle}.file-loading{top:0;right:0;width:25px;height:25px;font-size:999px;text-align:right;color:#fff;background:url(../img/loading.gif) top left no-repeat;border:none}.file-object{margin:0 0 -5px;padding:0}.btn-file{position:relative;overflow:hidden}.btn-file input[type=file]{position:absolute;top:0;right:0;min-width:100%;min-height:100%;text-align:right;opacity:0;background:none;cursor:inherit;display:block}.file-caption-name{display:inline-block;overflow:hidden;height:20px;word-break:break-all}.input-group-lg .file-caption-name{height:25px}.file-zoom-dialog{text-align:left}.file-error-message{color:#a94442;background-color:#f2dede;margin:5px;border:1px solid #ebccd1;border-radius:4px;padding:15px}.file-error-message pre,.file-error-message ul{margin:0;text-align:left}.file-error-message pre{margin:5px 0}.file-caption-disabled{background-color:#EEE;cursor:not-allowed;opacity:1}.file-preview{border-radius:5px;border:1px solid #ddd;padding:5px;width:100%;margin-bottom:5px}.file-preview-image{font:40px Impact,Charcoal,sans-serif;color:green}.krajee-default.file-preview-frame{position:relative;display:table;margin:8px;border:1px solid #ddd;box-shadow:1px 1px 5px 0 #a2958a;padding:6px;float:left;text-align:center}.krajee-default.file-preview-frame:not(.file-preview-error):hover{box-shadow:3px 3px 5px 0 #333}.krajee-default.file-preview-frame .kv-file-content{height:170px}.krajee-default.file-preview-frame .file-thumbnail-footer{height:70px}.krajee-default .file-preview-text{display:block;color:#428bca;border:1px solid #ddd;font-family:Menlo,Monaco,Consolas,"Courier New",monospace;outline:0;padding:8px;resize:none}.krajee-default .file-preview-html{border:1px solid #ddd;padding:8px;overflow:auto}.krajee-default[data-template=audio] .file-preview-audio{display:table-cell;vertical-align:middle;height:170px;border:1px solid #ddd;border-radius:5px}.krajee-default .file-zoom-dialog .file-preview-text{font-size:1.2em}.krajee-default .file-preview-other{left:0;top:0;right:0;bottom:0;margin:auto;text-align:center;padding:10px}.krajee-default .file-preview-other:hover{opacity:.8}.krajee-default .file-actions,.krajee-default .file-other-error{text-align:left}.krajee-default .file-other-icon{font-size:8em}.krajee-default .file-actions{margin-top:15px}.krajee-default .file-footer-buttons{float:right}.krajee-default .file-footer-caption{display:block;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;width:160px;text-align:center;padding-top:4px;font-size:11px;color:#777;margin:5px auto}.file-input-ajax-new .fileinput-remove-button,.file-input-ajax-new .fileinput-upload-button,.file-input-ajax-new .no-browse .input-group-btn,.file-input-new .close,.file-input-new .file-preview,.file-input-new .fileinput-remove-button,.file-input-new .fileinput-upload-button,.file-input-new .glyphicon-file,.file-input-new .no-browse .input-group-btn,.hide-content .kv-file-content{display:none}.krajee-default .file-preview-error{opacity:.65;box-shadow:none}.krajee-default .file-preview-frame:not(.file-preview-error) .file-footer-caption:hover{color:#000}.krajee-default .file-drag-handle,.krajee-default .file-upload-indicator{position:absolute;text-align:center;bottom:-6px;left:-6px;padding:8px 8px 1px 3px;border-left:none;border-bottom:none;border-right:1px solid #8a6d3b;border-top:1px solid #8a6d3b;border-top-right-radius:24px;font-size:12px}.krajee-default .file-drag-handle{background-color:#d9edf7;border-color:#bce8f1}.krajee-default .file-upload-indicator{font-size:13px;background-color:#fcf8e3;border-color:#faebcc;padding-bottom:0}.krajee-default.file-preview-error .file-upload-indicator{background-color:#f2dede;border-color:#ebccd1}.krajee-default.file-preview-success .file-upload-indicator{background-color:#dff0d8;border-color:#d6e9c6}.krajee-default.file-preview-loading .file-upload-indicator{background-color:#e5e5e5;border-color:#777}.krajee-default .file-thumb-progress .progress,.krajee-default .file-thumb-progress .progress-bar{height:10px;font-size:9px;line-height:10px}.krajee-default .file-thumbnail-footer{position:relative}.krajee-default .file-thumb-progress{height:10px;position:absolute;top:35px;left:0;right:0}.krajee-default.kvsortable-ghost{background:#e1edf7;border:2px solid #a1abff}.file-zoom-dialog .file-other-icon{font-size:22em;font-size:50vmin}.file-caption-main{width:100%}.file-input-ajax-new .no-browse .form-control,.file-input-new .no-browse .form-control{border-top-right-radius:4px;border-bottom-right-radius:4px}.file-thumb-loading{background:url(../img/loading.gif) center center no-repeat content-box!important}.file-sortable .file-drag-handle{cursor:move;cursor:-webkit-grabbing;opacity:1}.file-sortable .file-drag-handle:hover{opacity:.7}.file-drop-zone{border:1px dashed #aaa;border-radius:4px;height:100%;text-align:center;margin:12px 15px 12px 12px;padding:5px}.file-drop-zone-title{color:#aaa;font-size:1.6em;padding:85px 10px;cursor:default}.clickable .file-drop-zone-title,.file-preview .clickable{cursor:pointer}.file-drop-zone.clickable:hover{border:2px dashed #999}.file-drop-zone.clickable:focus{border:2px solid #5acde2}.file-drop-zone .file-preview-thumbnails{cursor:default}.file-highlighted{border:2px dashed #999!important;background-color:#f0f0f0}.file-uploading{background:url(../img/loading-sm.gif) center bottom 10px no-repeat;opacity:.65}.file-zoom-fullscreen.modal{position:fixed;top:0;right:0;bottom:0;left:0}.file-zoom-fullscreen .modal-dialog{position:fixed;margin:0;width:100%;height:100%;padding:0}.file-zoom-fullscreen .modal-content{border-radius:0;box-shadow:none}.file-zoom-fullscreen .modal-body{overflow-y:auto}.file-zoom-dialog .modal-body{position:relative!important}.file-zoom-dialog .btn-navigate{position:absolute;padding:0;margin:0;background:0 0;text-decoration:none;outline:0;opacity:.7;top:45%;font-size:4em;color:#1c94c4}.file-zoom-dialog .floating-buttons{position:absolute;top:5px;right:10px}.floating-buttons,.floating-buttons .btn{z-index:3000}.file-zoom-dialog .kv-zoom-actions .btn,.floating-buttons .btn{margin-left:3px}.file-zoom-dialog .btn-navigate:not([disabled]):focus,.file-zoom-dialog .btn-navigate:not([disabled]):hover{outline:0;box-shadow:none;opacity:.5}.file-zoom-dialog .btn-navigate[disabled]{opacity:.3}.file-zoom-dialog .btn-prev{left:1px}.file-zoom-dialog .btn-next{right:1px}.file-zoom-content{height:480px;text-align:center}.file-zoom-content .file-preview-image,.file-zoom-content .file-preview-video{max-height:100%}.file-zoom-content>.file-object.type-image{width:auto;height:auto;min-height:inherit;max-width:100%;max-height:100%}.file-zoom-content>.file-object.type-flash,.file-zoom-content>.file-object.type-video{width:auto;height:100%;max-width:100%;max-height:100%}.file-zoom-content>.file-object.type-audio{width:auto;height:30px}.file-zoom-content>.file-object.type-default,.file-zoom-content>.file-object.type-html,.file-zoom-content>.file-object.type-pdf,.file-zoom-content>.file-object.type-text{width:100%}.file-preview-initial.sortable-chosen{background-color:#d9edf7}.btn-file ::-ms-browse{font-size:10000px;width:100%;height:100%}.rotate-2{transform:rotateY(180deg)}.rotate-3{transform:rotate(180deg)}.rotate-4{transform:rotate(180deg) rotateY(180deg)}.rotate-5{transform:rotate(270deg) rotateY(180deg)}.rotate-6{transform:rotate(90deg)}.rotate-7{transform:rotate(90deg) rotateY(180deg)}.rotate-8{transform:rotate(270deg)}.file-zoom-content .is-portrait-gt4{margin-top:60px} \ No newline at end of file diff --git a/ruoyi-content/src/main/resources/static/js/fileinput.min.js b/ruoyi-content/src/main/resources/static/js/fileinput.min.js new file mode 100644 index 000000000..f182f0d79 --- /dev/null +++ b/ruoyi-content/src/main/resources/static/js/fileinput.min.js @@ -0,0 +1,12 @@ +/*! + * bootstrap-fileinput v4.4.2 + * http://plugins.krajee.com/file-input + * + * Author: Kartik Visweswaran + * Copyright: 2014 - 2017, Kartik Visweswaran, Krajee.com + * + * Licensed under the BSD 3-Clause + * https://github.com/kartik-v/bootstrap-fileinput/blob/master/LICENSE.md + */!function(e){"use strict";"function"==typeof define&&define.amd?define(["jquery"],e):"object"==typeof module&&module.exports?module.exports=e(require("jquery")):e(window.jQuery)}(function(e){"use strict";e.fn.fileinputLocales={},e.fn.fileinputThemes={},String.prototype.setTokens=function(e){var i,t,a=this.toString();for(i in e)e.hasOwnProperty(i)&&(t=new RegExp("{"+i+"}","g"),a=a.replace(t,e[i]));return a};var i,t;i={FRAMES:".kv-preview-thumb",SORT_CSS:"file-sortable",STYLE_SETTING:'style="width:{width};height:{height};"',OBJECT_PARAMS:'\n\n\n\n\n\n',DEFAULT_PREVIEW:'
\n{previewFileIcon}\n
',MODAL_ID:"kvFileinputModal",MODAL_EVENTS:["show","shown","hide","hidden","loaded"],objUrl:window.URL||window.webkitURL,compare:function(e,i,t){return void 0!==e&&(t?e===i:e.match(i))},isIE:function(e){if("Microsoft Internet Explorer"!==navigator.appName)return!1;if(10===e)return new RegExp("msie\\s"+e,"i").test(navigator.userAgent);var i,t=document.createElement("div");return t.innerHTML="",i=t.getElementsByTagName("i").length,document.body.appendChild(t),t.parentNode.removeChild(t),i},initModal:function(i){var t=e("body");t.length&&i.appendTo(t)},isEmpty:function(i,t){return void 0===i||null===i||0===i.length||t&&""===e.trim(i)},isArray:function(e){return Array.isArray(e)||"[object Array]"===Object.prototype.toString.call(e)},ifSet:function(e,i,t){return t=t||"",i&&"object"==typeof i&&e in i?i[e]:t},cleanArray:function(e){return e instanceof Array||(e=[]),e.filter(function(e){return void 0!==e&&null!==e})},spliceArray:function(e,i){var t,a=0,n=[];if(!(e instanceof Array))return[];for(t=0;t=0?atob(e.split(",")[1]):decodeURIComponent(e.split(",")[1]),a=new ArrayBuffer(t.length),n=new Uint8Array(a),r=0;r/g,">").replace(/"/g,""").replace(/'/g,"'")},replaceTags:function(i,t){var a=i;return t?(e.each(t,function(e,i){"function"==typeof i&&(i=i()),a=a.split(e).join(i)}),a):a},cleanMemory:function(e){var t=e.is("img")?e.attr("src"):e.find("source").attr("src");i.objUrl.revokeObjectURL(t)},findFileName:function(e){var i=e.lastIndexOf("/");return-1===i&&(i=e.lastIndexOf("\\")),e.split(e.substring(i,i+1)).pop()},checkFullScreen:function(){return document.fullscreenElement||document.mozFullScreenElement||document.webkitFullscreenElement||document.msFullscreenElement},toggleFullScreen:function(e){var t=document,a=t.documentElement;a&&e&&!i.checkFullScreen()?a.requestFullscreen?a.requestFullscreen():a.msRequestFullscreen?a.msRequestFullscreen():a.mozRequestFullScreen?a.mozRequestFullScreen():a.webkitRequestFullscreen&&a.webkitRequestFullscreen(Element.ALLOW_KEYBOARD_INPUT):t.exitFullscreen?t.exitFullscreen():t.msExitFullscreen?t.msExitFullscreen():t.mozCancelFullScreen?t.mozCancelFullScreen():t.webkitExitFullscreen&&t.webkitExitFullscreen()},moveArray:function(e,i,t){if(t>=e.length)for(var a=t-e.length;a--+1;)e.push(void 0);return e.splice(t,0,e.splice(i,1)[0]),e},cleanZoomCache:function(e){var i=e.closest(".kv-zoom-cache-theme");i.length||(i=e.closest(".kv-zoom-cache")),i.remove()},setOrientation:function(e,i){var t,a,n,r=new DataView(e),o=0,l=1;if(!(65496!==r.getUint16(o)||e.length<2)){for(o+=2,t=r.byteLength;t-2>o;)switch(a=r.getUint16(o),o+=2,a){case 65505:n=r.getUint16(o),t=n-o,o+=2;break;case 274:l=r.getUint16(o+6,!1),t=0}i&&i(l)}},validateOrientation:function(e,t){if(window.FileReader&&window.DataView){var a,n=new FileReader;n.onloadend=function(){a=n.result,i.setOrientation(a,t)},n.readAsArrayBuffer(e)}},adjustOrientedImage:function(e,i){var t,a,n;if(e.hasClass("is-portrait-gt4")){if(i)return void e.css({width:e.parent().height()});e.css({height:"auto",width:e.height()}),t=e.parent().offset().top,a=e.offset().top,n=t-a,e.css("margin-top",n)}}},t=function(t,a){var n=this;n.$element=e(t),n._validate()&&(n.isPreviewable=i.hasFileAPISupport(),n.isIE9=i.isIE(9),n.isIE10=i.isIE(10),n.isPreviewable||n.isIE9?(n._init(a),n._listen()):n.$element.removeClass("file-loading"))},t.prototype={constructor:t,_cleanup:function(){var e=this;e.reader=null,e.formdata={},e.uploadCount=0,e.uploadStatus={},e.uploadLog=[],e.uploadAsyncCount=0,e.loadedImages=[],e.totalImagesCount=0,e.ajaxRequests=[],e.clearStack(),e.fileInputCleared=!1,e.fileBatchCompleted=!0,e.isPreviewable||(e.showPreview=!1),e.isError=!1,e.ajaxAborted=!1,e.cancelling=!1},_init:function(t){var a,n,r,o=this,l=o.$element;o.options=t,e.each(t,function(e,t){switch(e){case"minFileCount":case"maxFileCount":case"minFileSize":case"maxFileSize":case"maxFilePreviewSize":case"resizeImageQuality":case"resizeIfSizeMoreThan":case"progressUploadThreshold":case"initialPreviewCount":case"zoomModalHeight":case"minImageHeight":case"maxImageHeight":case"minImageWidth":case"maxImageWidth":o[e]=i.getNum(t);break;default:o[e]=t}}),o.rtl&&(r=o.previewZoomButtonIcons.prev,o.previewZoomButtonIcons.prev=o.previewZoomButtonIcons.next,o.previewZoomButtonIcons.next=r),o._cleanup(),o.$form=l.closest("form"),o._initTemplateDefaults(),o.uploadFileAttr=i.isEmpty(l.attr("name"))?"file_data":l.attr("name"),n=o._getLayoutTemplate("progress"),o.progressTemplate=n.replace("{class}",o.progressClass),o.progressCompleteTemplate=n.replace("{class}",o.progressCompleteClass),o.progressErrorTemplate=n.replace("{class}",o.progressErrorClass),o.dropZoneEnabled=i.hasDragDropSupport()&&o.dropZoneEnabled,o.isDisabled=l.attr("disabled")||l.attr("readonly"),o.isDisabled&&l.attr("disabled",!0),o.isUploadable=i.hasFileUploadSupport()&&!i.isEmpty(o.uploadUrl),o.isClickable=o.browseOnZoneClick&&o.showPreview&&(o.isUploadable&&o.dropZoneEnabled||!i.isEmpty(o.defaultPreviewContent)),o.slug="function"==typeof t.slugCallback?t.slugCallback:o._slugDefault,o.mainTemplate=o.showCaption?o._getLayoutTemplate("main1"):o._getLayoutTemplate("main2"),o.captionTemplate=o._getLayoutTemplate("caption"),o.previewGenericTemplate=o._getPreviewTemplate("generic"),o.resizeImage&&(o.maxImageWidth||o.maxImageHeight)&&(o.imageCanvas=document.createElement("canvas"),o.imageCanvasContext=o.imageCanvas.getContext("2d")),i.isEmpty(l.attr("id"))&&l.attr("id",i.uniqId()),o.namespace=".fileinput_"+l.attr("id").replace(/-/g,"_"),void 0===o.$container?o.$container=o._createContainer():o._refreshContainer(),a=o.$container,o.$dropZone=a.find(".file-drop-zone"),o.$progress=a.find(".kv-upload-progress"),o.$btnUpload=a.find(".fileinput-upload"),o.$captionContainer=i.getElement(t,"elCaptionContainer",a.find(".file-caption")),o.$caption=i.getElement(t,"elCaptionText",a.find(".file-caption-name")),o.$previewContainer=i.getElement(t,"elPreviewContainer",a.find(".file-preview")),o.$preview=i.getElement(t,"elPreviewImage",a.find(".file-preview-thumbnails")),o.$previewStatus=i.getElement(t,"elPreviewStatus",a.find(".file-preview-status")),o.$errorContainer=i.getElement(t,"elErrorContainer",o.$previewContainer.find(".kv-fileinput-error")),i.isEmpty(o.msgErrorClass)||i.addCss(o.$errorContainer,o.msgErrorClass),o.$errorContainer.hide(),o.previewInitId="preview-"+i.uniqId(),o._initPreviewCache(),o._initPreview(!0),o._initPreviewActions(),o._setFileDropZoneTitle(),l.removeClass("file-loading"),l.attr("disabled")&&o.disable(),o._initZoom(),o.hideThumbnailContent&&i.addCss(o.$preview,"hide-content")},_initTemplateDefaults:function(){var t,a,n,r,o,l,s,d,c,u,p,f,m,v,h,g,w,_,b,C,y,T,E,x,F,S,I,k,P,z,A,$,D,U,B,j,L=this;t='{preview}\n
\n
\n {caption}\n
\n {remove}\n {cancel}\n {upload}\n {browse}\n
\n
',a='{preview}\n
\n{remove}\n{cancel}\n{upload}\n{browse}\n',n='
\n {close}
\n
\n
\n
\n
\n
\n
',o='
×
\n',r='',l='
\n
\n
\n',s='',d='{icon} {label}',c='
{icon} {label}
',u='',p='\n',f='
\n
\n {status}\n
\n
',m=" ({sizeText})",v='',h='{drag}\n
\n \n
\n
',g='\n',w='',_='',b='{dragIcon}',C='
{indicator}
',y='
\n',E=y+' title="{caption}">
\n',x="
{footer}\n
\n",F="{content}\n",S='
{data}
\n",I='{caption}\n",k='\n",P='\n",z='
\n",A='\n'+i.OBJECT_PARAMS+" "+i.DEFAULT_PREVIEW+"\n\n",$='\n\n'+i.OBJECT_PARAMS+" "+i.DEFAULT_PREVIEW+"\n\n",D='\n',U='
\n'+i.DEFAULT_PREVIEW+"\n
\n",B='',j={width:"100%",height:"100%","min-height":"480px"},L.defaults={layoutTemplates:{main1:t,main2:a,preview:n,close:o,fileIcon:r,caption:l,modalMain:u,modal:p,progress:f,size:m,footer:v,indicator:C,actions:h,actionDelete:g,actionUpload:w,actionZoom:_,actionDrag:b,btnDefault:s,btnLink:d,btnBrowse:c,zoomCache:B},previewMarkupTags:{tagBefore1:T,tagBefore2:E,tagAfter:x},previewContentTemplates:{generic:F,html:S,image:I,text:k,video:P,audio:z,flash:A,object:$,pdf:D,other:U},allowedPreviewTypes:["image","html","text","video","audio","flash","pdf","object"],previewTemplates:{},previewSettings:{image:{width:"auto",height:"160px"},html:{width:"213px",height:"160px"},text:{width:"213px",height:"160px"},video:{width:"auto",height:"100%","max-width":"100%"},audio:{width:"100%",height:"30px"},flash:{width:"auto",height:"100%","max-width":"100%"},object:{height:"100%"},pdf:{width:"160px",height:"160px"},other:{width:"160px",height:"160px"}},previewZoomSettings:{image:{width:"auto",height:"auto","max-width":"100%","max-height":"100%"},html:j,text:j,video:{width:"auto",height:"100%","max-width":"100%"},audio:{width:"100%",height:"30px"},flash:{width:"auto",height:"480px"},object:{width:"auto",height:"100%","max-width":"100%","min-height":"480px"},pdf:j,other:{width:"auto",height:"100%","min-height":"480px"}},fileTypeSettings:{image:function(e,t){return i.compare(e,"image.*")||i.compare(t,/\.(gif|png|jpe?g)$/i)},html:function(e,t){return i.compare(e,"text/html")||i.compare(t,/\.(htm|html)$/i)},text:function(e,t){return i.compare(e,"text.*")||i.compare(t,/\.(xml|javascript)$/i)||i.compare(t,/\.(txt|md|csv|nfo|ini|json|php|js|css)$/i)},video:function(e,t){return i.compare(e,"video.*")&&(i.compare(e,/(ogg|mp4|mp?g|mov|webm|3gp)$/i)||i.compare(t,/\.(og?|mp4|webm|mp?g|mov|3gp)$/i))},audio:function(e,t){return i.compare(e,"audio.*")&&(i.compare(t,/(ogg|mp3|mp?g|wav)$/i)||i.compare(t,/\.(og?|mp3|mp?g|wav)$/i))},flash:function(e,t){return i.compare(e,"application/x-shockwave-flash",!0)||i.compare(t,/\.(swf)$/i)},pdf:function(e,t){return i.compare(e,"application/pdf",!0)||i.compare(t,/\.(pdf)$/i)},object:function(){return!0},other:function(){return!0}},fileActionSettings:{showRemove:!0,showUpload:!0,showZoom:!0,showDrag:!0,removeIcon:'',removeClass:"btn btn-xs btn-default",removeTitle:"Remove file",uploadIcon:'',uploadClass:"btn btn-xs btn-default",uploadTitle:"Upload file",zoomIcon:'',zoomClass:"btn btn-xs btn-default",zoomTitle:"View Details",dragIcon:'',dragClass:"text-info",dragTitle:"Move / Rearrange",dragSettings:{},indicatorNew:'',indicatorSuccess:'',indicatorError:'',indicatorLoading:'',indicatorNewTitle:"Not uploaded yet",indicatorSuccessTitle:"Uploaded",indicatorErrorTitle:"Upload Error",indicatorLoadingTitle:"Uploading ..."}},e.each(L.defaults,function(i,t){return"allowedPreviewTypes"===i?void(void 0===L.allowedPreviewTypes&&(L.allowedPreviewTypes=t)):void(L[i]=e.extend(!0,{},t,L[i]))}),L._initPreviewTemplates()},_initPreviewTemplates:function(){var t,a=this,n=a.defaults,r=a.previewMarkupTags,o=r.tagAfter;e.each(n.previewContentTemplates,function(e,n){i.isEmpty(a.previewTemplates[e])&&(t=r.tagBefore2,"generic"!==e&&"image"!==e&&"html"!==e&&"text"!==e||(t=r.tagBefore1),a.previewTemplates[e]=t+n+o)})},_initPreviewCache:function(){var t=this;t.previewCache={data:{},init:function(){var e=t.initialPreview;e.length>0&&!i.isArray(e)&&(e=e.split(t.initialPreviewDelimiter)),t.previewCache.data={content:e,config:t.initialPreviewConfig,tags:t.initialPreviewThumbTags}},fetch:function(){return t.previewCache.data.content.filter(function(e){return null!==e})},count:function(e){return t.previewCache.data&&t.previewCache.data.content?e?t.previewCache.data.content.length:t.previewCache.fetch().length:0},get:function(a,n){var r,o,l,s,d,c,u,p="init_"+a,f=t.previewCache.data,m=f.config[a],v=f.content[a],h=t.previewInitId+"-"+p,g=i.ifSet("previewAsData",m,t.initialPreviewAsData),w=function(e,a,n,r,o,l,s,d,c){return d=" file-preview-initial "+i.SORT_CSS+(d?" "+d:""),t._generatePreviewTemplate(e,a,n,r,o,!1,null,d,l,s,c)};return v?(n=void 0===n?!0:n,l=i.ifSet("type",m,t.initialPreviewFileType||"generic"),d=i.ifSet("filename",m,i.ifSet("caption",m)),c=i.ifSet("filetype",m,l),s=t.previewCache.footer(a,n,m&&m.size||null),u=i.ifSet("frameClass",m),r=g?w(l,v,d,c,h,s,p,u):w("generic",v,d,c,h,s,p,u,l).setTokens({content:f.content[a]}),f.tags.length&&f.tags[a]&&(r=i.replaceTags(r,f.tags[a])),i.isEmpty(m)||i.isEmpty(m.frameAttr)||(o=e(document.createElement("div")).html(r),o.find(".file-preview-initial").attr(m.frameAttr),r=o.html(),o.remove()),r):""},add:function(e,a,n,r){var o,l=t.previewCache.data;return i.isArray(e)||(e=e.split(t.initialPreviewDelimiter)),r?(o=l.content.push(e)-1,l.config[o]=a,l.tags[o]=n):(o=e.length-1,l.content=e,l.config=a,l.tags=n),t.previewCache.data=l,o},set:function(e,a,n,r){var o,l,s=t.previewCache.data;if(e&&e.length&&(i.isArray(e)||(e=e.split(t.initialPreviewDelimiter)),l=e.filter(function(e){return null!==e}),l.length)){if(void 0===s.content&&(s.content=[]),void 0===s.config&&(s.config=[]),void 0===s.tags&&(s.tags=[]),r){for(o=0;oi;i++)a+=t.previewCache.get(i);return e=t._getMsgSelected(t.previewCache.count()),{content:a,caption:e}},footer:function(e,a,n){var r=t.previewCache.data;if(!r||!r.config||0===r.config.length||i.isEmpty(r.config[e]))return"";a=void 0===a?!0:a;var o,l=r.config[e],s=i.ifSet("caption",l),d=i.ifSet("width",l,"auto"),c=i.ifSet("url",l,!1),u=i.ifSet("key",l,null),p=t.fileActionSettings,f=t.initialPreviewShowDelete||!1,m=i.ifSet("showDelete",l,i.ifSet("showDelete",p,f)),v=i.ifSet("showZoom",l,i.ifSet("showZoom",p,!0)),h=i.ifSet("showDrag",l,i.ifSet("showDrag",p,!0)),g=c===!1&&a;return o=t._renderFileActions(!1,m,v,h,g,c,u,!0),t._getLayoutTemplate("footer").setTokens({progress:t._renderThumbProgress(),actions:o,caption:s,size:t._getSize(n),width:d,indicator:""})}},t.previewCache.init()},_handler:function(e,i,t){var a=this,n=a.namespace,r=i.split(" ").join(n+" ")+n;e&&e.length&&e.off(r).on(r,t)},_log:function(e){var i=this,t=i.$element.attr("id");t&&(e='"'+t+'": '+e),"undefined"!=typeof window.console.log?window.console.log(e):window.alert(e)},_validate:function(){var e=this,i="file"===e.$element.attr("type");return i||e._log('The input "type" must be set to "file" for initializing the "bootstrap-fileinput" plugin.'),i},_errorsExist:function(){var i,t=this;return t.$errorContainer.find("li").length?!0:(i=e(document.createElement("div")).html(t.$errorContainer.html()),i.find("span.kv-error-close").remove(),i.find("ul").remove(),!!e.trim(i.text()).length)},_errorHandler:function(e,i){var t=this,a=e.target.error,n=function(e){t._showError(e.replace("{name}",i))};n(a.code===a.NOT_FOUND_ERR?t.msgFileNotFound:a.code===a.SECURITY_ERR?t.msgFileSecured:a.code===a.NOT_READABLE_ERR?t.msgFileNotReadable:a.code===a.ABORT_ERR?t.msgFilePreviewAborted:t.msgFilePreviewError)},_addError:function(e){var i=this,t=i.$errorContainer;e&&t.length&&(t.html(i.errorCloseButton+e),i._handler(t.find(".kv-error-close"),"click",function(){t.fadeOut("slow")}))},_resetErrors:function(e){var i=this,t=i.$errorContainer;i.isError=!1,i.$container.removeClass("has-error"),t.html(""),e?t.fadeOut("slow"):t.hide()},_showFolderError:function(e){var t,a=this,n=a.$errorContainer;e&&(t=a.msgFoldersNotAllowed.replace("{n}",e),a._addError(t),i.addCss(a.$container,"has-error"),n.fadeIn(800),a._raise("filefoldererror",[e,t]))},_showUploadError:function(e,t,a){var n=this,r=n.$errorContainer,o=a||"fileuploaderror",l=t&&t.id?'
  • '+e+"
  • ":"
  • "+e+"
  • ";return 0===r.find("ul").length?n._addError("
      "+l+"
    "):r.find("ul").append(l),r.fadeIn(800),n._raise(o,[t,e]),n.$container.removeClass("file-input-new"),i.addCss(n.$container,"has-error"),!0},_showError:function(e,t,a){var n=this,r=n.$errorContainer,o=a||"fileerror";return t=t||{},t.reader=n.reader,n._addError(e),r.fadeIn(800),n._raise(o,[t,e]),n.isUploadable||n._clearFileInput(),n.$container.removeClass("file-input-new"),i.addCss(n.$container,"has-error"),n.$btnUpload.attr("disabled",!0),!0},_noFilesError:function(e){var t=this,a=t.minFileCount>1?t.filePlural:t.fileSingle,n=t.msgFilesTooLess.replace("{n}",t.minFileCount).replace("{files}",a),r=t.$errorContainer;t._addError(n),t.isError=!0,t._updateFileDetails(0),r.fadeIn(800),t._raise("fileerror",[e,n]),t._clearFileInput(),i.addCss(t.$container,"has-error")},_parseError:function(i,t,a,n){var r=this,o=e.trim(a+""),l="."===o.slice(-1)?"":".",s=void 0!==t.responseJSON&&void 0!==t.responseJSON.error?t.responseJSON.error:t.responseText;return r.cancelling&&r.msgUploadAborted&&(o=r.msgUploadAborted),r.showAjaxErrorDetails&&s?(s=e.trim(s.replace(/\n\s*\n/g,"\n")),s=s.length>0?"
    "+s+"
    ":"",o+=l+s):o+=l,o===l&&(o=r.msgAjaxError.replace("{operation}",i)),r.cancelling=!1,n?""+n+": "+o:o},_parseFileType:function(e){var t,a,n,r,o=this,l=o.allowedPreviewTypes||[];for(r=0;r-1&&(t=i.split(".").pop(),a.previewFileIconSettings&&(n=a.previewFileIconSettings[t]||a.previewFileIconSettings[t.toLowerCase()]||null),a.previewFileExtSettings&&e.each(a.previewFileExtSettings,function(e,i){return a.previewFileIconSettings[e]&&i(t)?void(n=a.previewFileIconSettings[e]):void 0})),n},_parseFilePreviewIcon:function(e,i){var t=this,a=t._getPreviewIcon(i)||t.previewFileIcon,n=e;return n.indexOf("{previewFileIcon}")>-1&&(n=n.setTokens({previewFileIconClass:t.previewFileIconClass,previewFileIcon:a})),n},_raise:function(i,t){var a=this,n=e.Event(i);if(void 0!==t?a.$element.trigger(n,t):a.$element.trigger(n),n.isDefaultPrevented()||n.result===!1)return!1;switch(i){case"filebatchuploadcomplete":case"filebatchuploadsuccess":case"fileuploaded":case"fileclear":case"filecleared":case"filereset":case"fileerror":case"filefoldererror":case"fileuploaderror":case"filebatchuploaderror":case"filedeleteerror":case"filecustomerror":case"filesuccessremove":break;default:a.ajaxAborted||(a.ajaxAborted=n.result)}return!0},_listenFullScreen:function(e){var i,t,a=this,n=a.$modal;n&&n.length&&(i=n&&n.find(".btn-fullscreen"),t=n&&n.find(".btn-borderless"),i.length&&t.length&&(i.removeClass("active").attr("aria-pressed","false"),t.removeClass("active").attr("aria-pressed","false"),e?i.addClass("active").attr("aria-pressed","true"):t.addClass("active").attr("aria-pressed","true"),n.hasClass("file-zoom-fullscreen")?a._maximizeZoomDialog():e?a._maximizeZoomDialog():t.removeClass("active").attr("aria-pressed","false")))},_listen:function(){var t,a=this,n=a.$element,r=a.$form,o=a.$container;a._handler(n,"change",e.proxy(a._change,a)),a.showBrowse&&a._handler(a.$btnFile,"click",e.proxy(a._browse,a)),a._handler(o.find(".fileinput-remove:not([disabled])"),"click",e.proxy(a.clear,a)),a._handler(o.find(".fileinput-cancel"),"click",e.proxy(a.cancel,a)),a._initDragDrop(),a._handler(r,"reset",e.proxy(a.reset,a)),a.isUploadable||a._handler(r,"submit",e.proxy(a._submitForm,a)),a._handler(a.$container.find(".fileinput-upload"),"click",e.proxy(a._uploadClick,a)),a._handler(e(window),"resize",function(){a._listenFullScreen(screen.width===window.innerWidth&&screen.height===window.innerHeight)}),t="webkitfullscreenchange mozfullscreenchange fullscreenchange MSFullscreenChange",a._handler(e(document),t,function(){a._listenFullScreen(i.checkFullScreen())}),a._initClickable()},_initClickable:function(){var t,a=this;a.isClickable&&(t=a.isUploadable?a.$dropZone:a.$preview.find(".file-default-preview"),i.addCss(t,"clickable"),t.attr("tabindex",-1),a._handler(t,"click",function(i){var n=e(i.target);n.parents(".file-preview-thumbnails").length&&!n.parents(".file-default-preview").length||(a.$element.trigger("click"),t.blur())}))},_initDragDrop:function(){var i=this,t=i.$dropZone;i.isUploadable&&i.dropZoneEnabled&&i.showPreview&&(i._handler(t,"dragenter dragover",e.proxy(i._zoneDragEnter,i)),i._handler(t,"dragleave",e.proxy(i._zoneDragLeave,i)),i._handler(t,"drop",e.proxy(i._zoneDrop,i)),i._handler(e(document),"dragenter dragover drop",i._zoneDragDropInit))},_zoneDragDropInit:function(e){e.stopPropagation(),e.preventDefault()},_zoneDragEnter:function(t){var a=this,n=e.inArray("Files",t.originalEvent.dataTransfer.types)>-1;return a._zoneDragDropInit(t),a.isDisabled||!n?(t.originalEvent.dataTransfer.effectAllowed="none",void(t.originalEvent.dataTransfer.dropEffect="none")):void i.addCss(a.$dropZone,"file-highlighted")},_zoneDragLeave:function(e){var i=this;i._zoneDragDropInit(e),i.isDisabled||i.$dropZone.removeClass("file-highlighted")},_zoneDrop:function(e){var t=this;e.preventDefault(),t.isDisabled||i.isEmpty(e.originalEvent.dataTransfer.files)||(t._change(e,"dragdrop"),t.$dropZone.removeClass("file-highlighted"))},_uploadClick:function(e){var t,a=this,n=a.$container.find(".fileinput-upload"),r=!n.hasClass("disabled")&&i.isEmpty(n.attr("disabled"));if(!e||!e.isDefaultPrevented()){if(!a.isUploadable)return void(r&&"submit"!==n.attr("type")&&(t=n.closest("form"),t.length&&t.trigger("submit"),e.preventDefault()));e.preventDefault(),r&&a.upload()}},_submitForm:function(){var e=this;return e._isFileSelectionValid()&&!e._abort({})},_clearPreview:function(){var t=this,a=t.$preview,n=t.showUploadedThumbs?t.getFrames(":not(.file-preview-success)"):t.getFrames();n.each(function(){var t=e(this);t.remove(),i.cleanZoomCache(a.find("#zoom-"+t.attr("id")))}),t.getFrames().length&&t.showPreview||t._resetUpload(),t._validateDefaultPreview()},_initSortable:function(){var t,a=this,n=a.$preview,r="."+i.SORT_CSS;window.KvSortable&&0!==n.find(r).length&&(t={handle:".drag-handle-init",dataIdAttr:"data-preview-id",scroll:!1,draggable:r,onSort:function(t){var n,r,o=t.oldIndex,l=t.newIndex;a.initialPreview=i.moveArray(a.initialPreview,o,l),a.initialPreviewConfig=i.moveArray(a.initialPreviewConfig,o,l),a.previewCache.init();for(var s=0;s