10 files added
3 files modified
New file |
| | |
| | | package cc.mrbird.febs.mall.controller; |
| | | |
| | | import cc.mrbird.febs.common.annotation.ControllerEndpoint; |
| | | import cc.mrbird.febs.common.controller.BaseController; |
| | | import cc.mrbird.febs.common.entity.FebsResponse; |
| | | import cc.mrbird.febs.common.entity.QueryRequest; |
| | | import cc.mrbird.febs.mall.entity.PlatformBanner; |
| | | import cc.mrbird.febs.mall.service.IAdminBannerService; |
| | | import lombok.RequiredArgsConstructor; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.validation.annotation.Validated; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import javax.validation.Valid; |
| | | import javax.validation.constraints.NotNull; |
| | | import java.util.Map; |
| | | @Slf4j |
| | | @Validated |
| | | @RestController |
| | | @RequiredArgsConstructor |
| | | @RequestMapping(value = "/admin/banner") |
| | | public class AdminBannerController extends BaseController { |
| | | |
| | | @Autowired |
| | | private IAdminBannerService iAdminBannerService; |
| | | |
| | | /** |
| | | * 轮播图---列表 |
| | | */ |
| | | @GetMapping("platformBanner") |
| | | public FebsResponse platformBanner(PlatformBanner platformBannerEntity, QueryRequest request) { |
| | | Map<String, Object> data = getDataTable(iAdminBannerService.findPlatformBannerInPage(platformBannerEntity, request)); |
| | | return new FebsResponse().success().data(data); |
| | | } |
| | | |
| | | /** |
| | | * 轮播图---确认 |
| | | * @return |
| | | */ |
| | | @PostMapping("platformBannerConfirm") |
| | | @ControllerEndpoint(operation = "轮播图---确认", exceptionMessage = "设置失败") |
| | | public FebsResponse platformBannerConfirm(@Valid PlatformBanner platformBannerEntity) { |
| | | return iAdminBannerService.platformBannerConfirm(platformBannerEntity); |
| | | } |
| | | |
| | | /** |
| | | * 轮播图---删除 |
| | | * @return |
| | | */ |
| | | @GetMapping("platformBannerDelete/{id}") |
| | | @ControllerEndpoint(operation = "轮播图---删除", exceptionMessage = "删除失败") |
| | | public FebsResponse platformBannerDelete(@NotNull(message = "{required}") @PathVariable Long id) { |
| | | return iAdminBannerService.platformBannerDelete(id); |
| | | } |
| | | |
| | | /** |
| | | * 轮播图---新增 |
| | | */ |
| | | @PostMapping("platformBannerAdds") |
| | | @ControllerEndpoint(operation = "轮播图---新增", exceptionMessage = "新增失败") |
| | | public FebsResponse platformBannerAdds(@Valid PlatformBanner platformBannerEntity) { |
| | | iAdminBannerService.platformBannerAdd(platformBannerEntity); |
| | | return new FebsResponse().success(); |
| | | } |
| | | } |
| | |
| | | } |
| | | return new FebsResponse().success().data(news); |
| | | } |
| | | |
| | | @ApiOperation(value = "首页轮播图", notes = "首页轮播图") |
| | | @GetMapping(value = "/bannerList") |
| | | public FebsResponse findPlatformBannerList() { |
| | | return newsService.findAllBanner(); |
| | | } |
| | | } |
New file |
| | |
| | | package cc.mrbird.febs.mall.controller; |
| | | |
| | | import cc.mrbird.febs.common.controller.BaseController; |
| | | import cc.mrbird.febs.common.entity.FebsConstant; |
| | | import cc.mrbird.febs.common.utils.FebsUtil; |
| | | import cc.mrbird.febs.mall.entity.PlatformBanner; |
| | | import cc.mrbird.febs.mall.service.IAdminBannerService; |
| | | import lombok.RequiredArgsConstructor; |
| | | import org.apache.shiro.authz.annotation.RequiresPermissions; |
| | | import org.springframework.stereotype.Controller; |
| | | import org.springframework.ui.Model; |
| | | import org.springframework.web.bind.annotation.GetMapping; |
| | | import org.springframework.web.bind.annotation.PathVariable; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | |
| | | @Controller("bannerView") |
| | | @RequestMapping(FebsConstant.VIEW_PREFIX + "modules/banner") |
| | | @RequiredArgsConstructor |
| | | public class ViewBannerController extends BaseController { |
| | | |
| | | private final IAdminBannerService iAdminBannerService; |
| | | |
| | | /** |
| | | * 轮播图---列表 |
| | | */ |
| | | @GetMapping("platformBanner") |
| | | @RequiresPermissions("platformBanner:view") |
| | | public String platformBanner() { |
| | | return FebsUtil.view("modules/banner/platformBanner"); |
| | | } |
| | | |
| | | /** |
| | | * 轮播图---修改 |
| | | */ |
| | | @GetMapping("platformBannerUpdate/{id}") |
| | | @RequiresPermissions("platformBannerUpdate:update") |
| | | public String platformBannerUpdate(@PathVariable long id, Model model) { |
| | | PlatformBanner data = iAdminBannerService.selectPlatformBannerById(id); |
| | | model.addAttribute("member", data); |
| | | return FebsUtil.view("modules/banner/platformBannerDetail"); |
| | | } |
| | | |
| | | /** |
| | | * 轮播图---新增 |
| | | */ |
| | | @GetMapping("platformBannerAdd") |
| | | @RequiresPermissions("platformBannerAdd:add") |
| | | public String platformBannerAdd() { |
| | | return FebsUtil.view("modules/banner/platformBannerAdd"); |
| | | } |
| | | } |
New file |
| | |
| | | package cc.mrbird.febs.mall.entity; |
| | | |
| | | import cc.mrbird.febs.common.entity.BaseEntity; |
| | | import com.baomidou.mybatisplus.annotation.TableName; |
| | | import lombok.Data; |
| | | |
| | | @Data |
| | | @TableName("platform_banner") |
| | | public class PlatformBanner extends BaseEntity { |
| | | |
| | | /** |
| | | * |
| | | */ |
| | | private static final long serialVersionUID = 1L; |
| | | /** |
| | | * 标题 |
| | | */ |
| | | private String name; |
| | | /** |
| | | * 图片链接 |
| | | */ |
| | | private String imageUrl; |
| | | /** |
| | | * 是否可跳转 1-是2-否 |
| | | */ |
| | | private String isJump; |
| | | /** |
| | | * 跳转外部或内部 1-内2-外 |
| | | */ |
| | | private int isInside; |
| | | /** |
| | | * 跳转链接 |
| | | */ |
| | | private String jumpUrl; |
| | | /** |
| | | * 显示端口 1-pc2-手机 |
| | | */ |
| | | private int showPort; |
| | | /** |
| | | * 联系方式 |
| | | */ |
| | | private String sort; |
| | | /** |
| | | * 是否置顶 1-是2-否 |
| | | */ |
| | | private String isTop; |
| | | } |
| | | |
New file |
| | |
| | | package cc.mrbird.febs.mall.mapper; |
| | | |
| | | import cc.mrbird.febs.mall.entity.PlatformBanner; |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import org.apache.ibatis.annotations.Param; |
| | | |
| | | public interface PlatformBannerMapper extends BaseMapper<PlatformBanner> { |
| | | |
| | | IPage<PlatformBanner> findPlatformBannerInPage(Page<PlatformBanner> page, |
| | | @Param("record")PlatformBanner platformBannerEntity); |
| | | } |
New file |
| | |
| | | package cc.mrbird.febs.mall.service; |
| | | |
| | | import cc.mrbird.febs.common.entity.FebsResponse; |
| | | import cc.mrbird.febs.common.entity.QueryRequest; |
| | | import cc.mrbird.febs.mall.entity.PlatformBanner; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | |
| | | import javax.validation.Valid; |
| | | import javax.validation.constraints.NotNull; |
| | | |
| | | public interface IAdminBannerService extends IService<PlatformBanner> { |
| | | IPage<PlatformBanner> findPlatformBannerInPage(PlatformBanner platformBannerEntity, QueryRequest request); |
| | | |
| | | PlatformBanner selectPlatformBannerById(long id); |
| | | |
| | | FebsResponse platformBannerConfirm(@Valid PlatformBanner platformBannerEntity); |
| | | |
| | | FebsResponse platformBannerDelete(@NotNull(message = "{required}") Long id); |
| | | |
| | | void platformBannerAdd(@Valid PlatformBanner platformBannerEntity); |
| | | } |
| | |
| | | package cc.mrbird.febs.mall.service; |
| | | |
| | | import cc.mrbird.febs.common.entity.FebsResponse; |
| | | import cc.mrbird.febs.mall.dto.NewsListDto; |
| | | import cc.mrbird.febs.mall.entity.MallNewsCategory; |
| | | import cc.mrbird.febs.mall.entity.MallNewsInfo; |
| | |
| | | IPage<NewsListVo> findNewsInPage(NewsListDto newsListDto); |
| | | |
| | | List<NewsListVo> findTopNews(); |
| | | |
| | | FebsResponse findAllBanner(); |
| | | } |
New file |
| | |
| | | package cc.mrbird.febs.mall.service.impl; |
| | | |
| | | import cc.mrbird.febs.common.entity.FebsResponse; |
| | | import cc.mrbird.febs.common.entity.QueryRequest; |
| | | import cc.mrbird.febs.mall.entity.PlatformBanner; |
| | | import cc.mrbird.febs.mall.mapper.PlatformBannerMapper; |
| | | import cc.mrbird.febs.mall.service.IAdminBannerService; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import lombok.RequiredArgsConstructor; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | |
| | | import javax.validation.Valid; |
| | | import javax.validation.constraints.NotNull; |
| | | import java.util.Date; |
| | | |
| | | @Slf4j |
| | | @Service |
| | | @RequiredArgsConstructor |
| | | @Transactional |
| | | public class AdminBannerServiceImpl extends ServiceImpl<PlatformBannerMapper, PlatformBanner> implements IAdminBannerService { |
| | | |
| | | private final PlatformBannerMapper platformBannerMapper; |
| | | |
| | | @Override |
| | | public IPage<PlatformBanner> findPlatformBannerInPage(PlatformBanner platformBannerEntity, |
| | | QueryRequest request) { |
| | | Page<PlatformBanner> page = new Page<>(request.getPageNum(), request.getPageSize()); |
| | | IPage<PlatformBanner> platformBannerEntitys = platformBannerMapper.findPlatformBannerInPage(page, platformBannerEntity); |
| | | return platformBannerEntitys; |
| | | } |
| | | |
| | | @Override |
| | | public PlatformBanner selectPlatformBannerById(long id) { |
| | | PlatformBanner platformBannerEntity = platformBannerMapper.selectById(id); |
| | | return platformBannerEntity; |
| | | } |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public FebsResponse platformBannerConfirm(@Valid PlatformBanner platformBannerEntity) { |
| | | platformBannerMapper.updateById(platformBannerEntity); |
| | | return new FebsResponse().success(); |
| | | } |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public FebsResponse platformBannerDelete(@NotNull(message = "{required}") Long id) { |
| | | platformBannerMapper.deleteById(id); |
| | | return new FebsResponse().success(); |
| | | } |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public void platformBannerAdd(@Valid PlatformBanner platformBannerEntity) { |
| | | PlatformBanner platformBannerEntityAdd = new PlatformBanner(); |
| | | platformBannerEntityAdd.setImageUrl(platformBannerEntity.getImageUrl()); |
| | | platformBannerEntityAdd.setIsInside(platformBannerEntity.getIsInside()); |
| | | platformBannerEntityAdd.setIsJump(platformBannerEntity.getIsJump()); |
| | | platformBannerEntityAdd.setIsTop(platformBannerEntity.getIsTop()); |
| | | platformBannerEntityAdd.setJumpUrl(platformBannerEntity.getJumpUrl()); |
| | | platformBannerEntityAdd.setName(platformBannerEntity.getName()); |
| | | platformBannerEntityAdd.setShowPort(platformBannerEntity.getShowPort()); |
| | | platformBannerEntityAdd.setSort(platformBannerEntity.getSort()); |
| | | platformBannerMapper.insert(platformBannerEntityAdd); |
| | | |
| | | } |
| | | } |
| | |
| | | package cc.mrbird.febs.mall.service.impl; |
| | | |
| | | import cc.mrbird.febs.common.entity.FebsResponse; |
| | | import cc.mrbird.febs.mall.dto.NewsListDto; |
| | | import cc.mrbird.febs.mall.entity.MallNewsCategory; |
| | | import cc.mrbird.febs.mall.entity.MallNewsInfo; |
| | | import cc.mrbird.febs.mall.entity.PlatformBanner; |
| | | import cc.mrbird.febs.mall.mapper.MallNewsCategoryMapper; |
| | | import cc.mrbird.febs.mall.mapper.MallNewsInfoMapper; |
| | | import cc.mrbird.febs.mall.mapper.PlatformBannerMapper; |
| | | import cc.mrbird.febs.mall.service.IApiMallNewsService; |
| | | import cc.mrbird.febs.mall.vo.NewsListVo; |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | |
| | | public class ApiMallNewsServiceImpl extends ServiceImpl<MallNewsInfoMapper, MallNewsInfo> implements IApiMallNewsService { |
| | | |
| | | private final MallNewsCategoryMapper mallNewsCategoryMapper; |
| | | private final PlatformBannerMapper platformBannerMapper; |
| | | |
| | | @Override |
| | | public List<MallNewsCategory> findNewsCategoryList() { |
| | |
| | | IPage<NewsListVo> pageList = this.baseMapper.selectNewsVoInPage(page, mallNewsInfo); |
| | | return pageList.getRecords(); |
| | | } |
| | | |
| | | @Override |
| | | public FebsResponse findAllBanner() { |
| | | QueryWrapper<PlatformBanner> queryWrapper = new QueryWrapper<>(); |
| | | List<PlatformBanner> paymentMethodList = platformBannerMapper.selectList(queryWrapper); |
| | | return new FebsResponse().success().data(paymentMethodList); |
| | | } |
| | | } |
New file |
| | |
| | | <?xml version="1.0" encoding="UTF-8"?> |
| | | <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
| | | <mapper namespace="cc.mrbird.febs.mall.mapper.PlatformBannerMapper"> |
| | | |
| | | <select id="findPlatformBannerInPage" resultType="cc.mrbird.febs.mall.entity.PlatformBanner"> |
| | | SELECT |
| | | * |
| | | FROM |
| | | platform_banner |
| | | order by created_time desc |
| | | </select> |
| | | |
| | | </mapper> |
New file |
| | |
| | | <div class="layui-fluid layui-anim febs-anim" id="febs-banner" lay-title="轮播图"> |
| | | <div class="layui-row febs-container"> |
| | | <div class="layui-col-md12"> |
| | | <div class="layui-card"> |
| | | <div class="layui-card-body febs-table-full"> |
| | | <form class="layui-form layui-table-form" lay-filter="user-table-form"> |
| | | <div class="layui-row"> |
| | | <div class="layui-col-md2 layui-col-sm12 layui-col-xs12 table-action-area"> |
| | | <div class="layui-btn layui-btn-sm layui-btn-primary febs-button-green-plain table-action" id="add"> |
| | | 新增 |
| | | </div> |
| | | <div class="layui-btn layui-btn-sm layui-btn-primary febs-button-green-plain table-action" id="reset"> |
| | | <i class="layui-icon"></i> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | </form> |
| | | <table lay-filter="bannerTable" lay-data="{id: 'bannerTable'}"></table> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | |
| | | <script type="text/html" id="isJump"> |
| | | {{# |
| | | var isJump = { |
| | | 2: {title: '否', color: 'red' }, |
| | | 1: {title: '是' , color: 'green'} |
| | | }[d.isJump]; |
| | | }} |
| | | <span class="layui-badge febs-bg-{{isJump.color}}">{{ isJump.title }}</span> |
| | | </script> |
| | | <script type="text/html" id="isInside"> |
| | | {{# |
| | | var isInside = { |
| | | 2: {title: '外' , color: 'green'}, |
| | | 1: {title: '内', color: 'red'} |
| | | }[d.isInside]; |
| | | }} |
| | | <span class="layui-badge febs-bg-{{isInside.color}}">{{ isInside.title }}</span> |
| | | </script> |
| | | <script type="text/html" id="showPort"> |
| | | {{# |
| | | var showPort = { |
| | | 2: {title: '手机' , color: 'green'}, |
| | | 1: {title: 'pc', color: 'red'} |
| | | }[d.showPort]; |
| | | }} |
| | | <span class="layui-badge febs-bg-{{showPort.color}}">{{ showPort.title }}</span> |
| | | </script> |
| | | <script type="text/html" id="isTop"> |
| | | {{# |
| | | var isTop = { |
| | | 2: {title: '否', color: 'red' }, |
| | | 1: {title: '是' , color: 'green'} |
| | | }[d.isTop]; |
| | | }} |
| | | <span class="layui-badge febs-bg-{{isTop.color}}">{{ isTop.title }}</span> |
| | | </script> |
| | | <!-- 表格操作栏 start --> |
| | | <script type="text/html" id="user-option"> |
| | | <!-- <span shiro:lacksPermission="user:view,user:update,user:delete">--> |
| | | <!-- <span class="layui-badge-dot febs-bg-orange"></span> 无权限--> |
| | | <!-- </span>--> |
| | | <!-- <a lay-event="edit" shiro:hasPermission="user:update">编辑--> |
| | | <a lay-event="edit">编辑 |
| | | <i class="layui-icon febs-edit-area febs-blue"></i> |
| | | </a> |
| | | <!-- <a lay-event="delete" shiro:hasPermission="user:update">删除--> |
| | | <a lay-event="delete">删除 |
| | | <i class="layui-icon febs-edit-area febs-blue"></i> |
| | | </a> |
| | | </script> |
| | | <!-- 表格操作栏 end --> |
| | | <script data-th-inline="none" type="text/javascript"> |
| | | // 引入组件并初始化 |
| | | layui.use(['dropdown', 'jquery', 'laydate', 'form', 'table', 'febs'], function () { |
| | | var $ = layui.jquery, |
| | | laydate = layui.laydate, |
| | | febs = layui.febs, |
| | | form = layui.form, |
| | | table = layui.table, |
| | | dropdown = layui.dropdown, |
| | | $view = $('#febs-banner'), |
| | | $reset = $view.find('#reset'), |
| | | $add = $view.find('#add'), |
| | | $searchForm = $view.find('form'), |
| | | sortObject = {field: 'spread', type: null}, |
| | | tableIns |
| | | ; |
| | | |
| | | form.render(); |
| | | |
| | | // 表格初始化 |
| | | initTable(); |
| | | |
| | | // 初始化表格操作栏各个按钮功能 |
| | | table.on('tool(bannerTable)', function (obj) { |
| | | var data = obj.data, |
| | | layEvent = obj.event; |
| | | |
| | | if (layEvent === 'edit') { |
| | | febs.modal.open('轮播图设置', 'modules/banner/platformBannerUpdate/' + data.id, { |
| | | btn: ['提交', '取消'], |
| | | yes: function (index, layero) { |
| | | $('#banner-update').find('#submit').trigger('click'); |
| | | }, |
| | | btn2: function () { |
| | | layer.closeAll(); |
| | | } |
| | | }); |
| | | } |
| | | if (layEvent === 'delete') { |
| | | febs.modal.confirm('删除', '您是否确认删除?', function () { |
| | | deleteUsers(data.id); |
| | | }); |
| | | } |
| | | }); |
| | | |
| | | function deleteUsers(id) { |
| | | febs.get(ctx + 'admin/banner/platformBannerDelete/' + id, null, function () { |
| | | febs.alert.success('确认删除'); |
| | | $reset.click(); |
| | | }); |
| | | } |
| | | |
| | | // 刷新按钮 |
| | | $reset.on('click', function () { |
| | | $searchForm[0].reset(); |
| | | sortObject.type = 'null'; |
| | | tableIns.reload({where: getQueryParams(), page: {curr: 1}, initSort: sortObject}); |
| | | }); |
| | | |
| | | // 刷新按钮 |
| | | $add.on('click', function () { |
| | | febs.modal.open('轮播图新增', 'modules/banner/platformBannerAdd/', { |
| | | btn: ['提交', '取消'], |
| | | yes: function (index, layero) { |
| | | $('#banner-add').find('#submit').trigger('click'); |
| | | }, |
| | | btn2: function () { |
| | | layer.closeAll(); |
| | | } |
| | | }); |
| | | }); |
| | | |
| | | |
| | | // 获取查询参数 |
| | | function getQueryParams() { |
| | | return {}; |
| | | } |
| | | |
| | | function initTable() { |
| | | tableIns = febs.table.init({ |
| | | elem: $view.find('table'), |
| | | id: 'bannerTable', |
| | | url: ctx + 'admin/banner/platformBanner', |
| | | cols: [[ |
| | | {field: 'id', title: '', minWidth: 10,align:'left'}, |
| | | {field: 'name', title: '标题', minWidth: 120,align:'center'}, |
| | | {field: 'imageUrl', title: '图片链接', |
| | | templet: function (d) { |
| | | return '<img src="'+d.imageUrl+'" >' |
| | | }, minWidth: 200,align:'center'}, |
| | | {field: 'jumpUrl', title: '跳转链接', minWidth: 200,align:'center'}, |
| | | {field: 'sort', title: '联系方式', minWidth: 200,align:'center'}, |
| | | |
| | | {title: '是否可跳转', templet: '#isJump', minWidth: 60,align:'center'}, |
| | | {title: '跳转外部或内部', templet: '#isInside', minWidth: 60,align:'center'}, |
| | | {title: '显示端口', templet: '#showPort', minWidth: 60,align:'center'}, |
| | | {title: '是否置顶', templet: '#isTop', minWidth: 60,align:'center'}, |
| | | |
| | | {title: '操作', toolbar: '#user-option', minWidth: 140, fixed : 'right'} |
| | | ]] |
| | | }); |
| | | } |
| | | }) |
| | | </script> |
New file |
| | |
| | | <style> |
| | | #banner-add { |
| | | padding: 20px 25px 25px 0; |
| | | } |
| | | |
| | | #banner-add .layui-treeSelect .ztree li a, .ztree li span { |
| | | margin: 0 0 2px 3px !important; |
| | | } |
| | | #banner-add #data-permission-tree-block { |
| | | border: 1px solid #eee; |
| | | border-radius: 2px; |
| | | padding: 3px 0; |
| | | } |
| | | #banner-add .layui-treeSelect .ztree li span.button.switch { |
| | | top: 1px; |
| | | left: 3px; |
| | | } |
| | | |
| | | </style> |
| | | <div class="layui-fluid" id="banner-add"> |
| | | <form class="layui-form" action="" lay-filter="banner-add-form"> |
| | | <div class="layui-form-item febs-hide"> |
| | | <label class="layui-form-label febs-form-item-require">用户id:</label> |
| | | <div class="layui-input-block"> |
| | | <input type="text" name="id"> |
| | | </div> |
| | | </div> |
| | | <div class="layui-form-item"> |
| | | <label class="layui-form-label febs-form-item-require">标题:</label> |
| | | <div class="layui-input-block"> |
| | | <input type="text" name="name" minlength="4" maxlength="10" lay-verify="range|name" |
| | | autocomplete="off" class="layui-input" > |
| | | </div> |
| | | </div> |
| | | <div class="layui-form-item"> |
| | | <label class="layui-form-label febs-form-item-require">图片:</label> |
| | | <div class="layui-upload"> |
| | | <button type="button" class="layui-btn" id="test1">上传图片</button> |
| | | <div class="layui-input-block"> |
| | | <div class="layui-upload-list"> |
| | | <img class="layui-upload-img" id="imageUrls" width="100%" > |
| | | </div> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | <div class="layui-form-item"> |
| | | <label class="layui-form-label febs-form-item-require">图片链接:</label> |
| | | <div class="layui-input-block"> |
| | | <input type="text" id="imageUrl" name="imageUrl" minlength="4" maxlength="500" |
| | | lay-verify="range|imageUrl" autocomplete="off" class="layui-input" readonly> |
| | | </div> |
| | | </div> |
| | | <div class="layui-form-item"> |
| | | <label class="layui-form-label febs-form-item-require">跳转链接:</label> |
| | | <div class="layui-input-block"> |
| | | <input type="text" name="jumpUrl" minlength="4" maxlength="10" |
| | | lay-verify="range|jumpUrl" autocomplete="off" class="layui-input" > |
| | | </div> |
| | | </div> |
| | | <div class="layui-form-item"> |
| | | <label class="layui-form-label febs-form-item-require">联系方式:</label> |
| | | <div class="layui-input-block"> |
| | | <input type="text" name="sort" minlength="4" maxlength="10" |
| | | lay-verify="range|sort" autocomplete="off" class="layui-input" > |
| | | </div> |
| | | </div> |
| | | <div class="layui-form-item"> |
| | | <label class="layui-form-label febs-form-item-require">是否置顶:</label> |
| | | <div class="layui-input-block"> |
| | | <input type="radio" name="isTop" value="1" title="是" checked=""> |
| | | <input type="radio" name="isTop" value="2" title="否"> |
| | | </div> |
| | | </div> |
| | | <div class="layui-form-item"> |
| | | <label class="layui-form-label febs-form-item-require">显示端口:</label> |
| | | <div class="layui-input-block"> |
| | | <input type="radio" name="showPort" value="1" title="pc" checked=""> |
| | | <input type="radio" name="showPort" value="2" title="手机"> |
| | | </div> |
| | | </div> |
| | | <div class="layui-form-item"> |
| | | <label class="layui-form-label febs-form-item-require">是否可跳转:</label> |
| | | <div class="layui-input-block"> |
| | | <input type="radio" name="isJump" value="1" title="是" checked=""> |
| | | <input type="radio" name="isJump" value="2" title="否"> |
| | | </div> |
| | | </div> |
| | | <div class="layui-form-item"> |
| | | <label class="layui-form-label febs-form-item-require">跳转外部或内部:</label> |
| | | <div class="layui-input-block"> |
| | | <input type="radio" name="isInside" value="1" title="内" checked=""> |
| | | <input type="radio" name="isInside" value="2" title="外"> |
| | | </div> |
| | | </div> |
| | | <div class="layui-form-item febs-hide"> |
| | | <button class="layui-btn" lay-submit="" lay-filter="banner-add-form-submit" id="submit"></button> |
| | | </div> |
| | | </form> |
| | | </div> |
| | | |
| | | <script data-th-inline="javascript"> |
| | | layui.use(['febs', 'form', 'formSelects', 'validate', 'treeSelect', 'eleTree','upload'], function () { |
| | | var $ = layui.$, |
| | | febs = layui.febs, |
| | | layer = layui.layer, |
| | | formSelects = layui.formSelects, |
| | | treeSelect = layui.treeSelect, |
| | | form = layui.form, |
| | | eleTree = layui.eleTree, |
| | | member = [[${member}]], |
| | | $view = $('#banner-add'), |
| | | validate = layui.validate, |
| | | upload = layui.upload, |
| | | _deptTree; |
| | | |
| | | //普通图片上传 |
| | | var uploadInst = upload.render({ |
| | | elem: '#test1' |
| | | ,url: ctx + 'admin/goods/uploadFileBase64' //改成您自己的上传接口 |
| | | ,before: function(obj){ |
| | | //预读本地文件示例,不支持ie8 |
| | | obj.preview(function(index, file, result){ |
| | | $('#imageUrls').attr('src', result); //图片链接(base64) |
| | | }); |
| | | } |
| | | ,done: function(res){ |
| | | febs.alert.success(res.data.src); |
| | | $("#imageUrl").val(res.data.src); |
| | | } |
| | | }); |
| | | |
| | | form.render(); |
| | | |
| | | formSelects.render(); |
| | | |
| | | form.on('submit(banner-add-form-submit)', function (data) { |
| | | febs.post(ctx + 'admin/banner/platformBannerAdds', data.field, function () { |
| | | layer.closeAll(); |
| | | febs.alert.success('新增成功'); |
| | | $('#febs-banner').find('#reset').click(); |
| | | }); |
| | | return false; |
| | | }); |
| | | }); |
| | | </script> |
New file |
| | |
| | | <style> |
| | | #banner-update { |
| | | padding: 20px 25px 25px 0; |
| | | } |
| | | |
| | | #banner-update .layui-treeSelect .ztree li a, .ztree li span { |
| | | margin: 0 0 2px 3px !important; |
| | | } |
| | | #banner-update #data-permission-tree-block { |
| | | border: 1px solid #eee; |
| | | border-radius: 2px; |
| | | padding: 3px 0; |
| | | } |
| | | #user-add .layui-treeSelect .ztree li span.button.switch { |
| | | top: 1px; |
| | | left: 3px; |
| | | } |
| | | |
| | | </style> |
| | | <div class="layui-fluid" id="banner-update"> |
| | | <form class="layui-form" action="" lay-filter="banner-update-form"> |
| | | <div class="layui-form-item febs-hide"> |
| | | <label class="layui-form-label febs-form-item-require">用户id:</label> |
| | | <div class="layui-input-block"> |
| | | <input type="text" name="id" data-th-value="${member.id}"> |
| | | </div> |
| | | </div> |
| | | <div class="layui-form-item"> |
| | | <label class="layui-form-label febs-form-item-require">标题:</label> |
| | | <div class="layui-input-block"> |
| | | <input type="text" name="name" minlength="4" maxlength="10" data-th-id="${member.name}" |
| | | lay-verify="range|name" autocomplete="off" class="layui-input" > |
| | | </div> |
| | | </div> |
| | | <div class="layui-form-item"> |
| | | <label class="layui-form-label febs-form-item-require">图片:</label> |
| | | <div class="layui-upload"> |
| | | <button type="button" class="layui-btn" id="test1">上传图片</button> |
| | | <div class="layui-input-block"> |
| | | <div class="layui-upload-list"> |
| | | <img class="layui-upload-img" id="imageUrls" width="100%" > |
| | | </div> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | <div class="layui-form-item"> |
| | | <label class="layui-form-label febs-form-item-require">图片链接:</label> |
| | | <div class="layui-input-block"> |
| | | <input type="text" id="imageUrl" name="imageUrl" minlength="4" maxlength="500" |
| | | lay-verify="range|imageUrl" autocomplete="off" class="layui-input" readonly> |
| | | </div> |
| | | </div> |
| | | <div class="layui-form-item"> |
| | | <label class="layui-form-label febs-form-item-require">跳转链接:</label> |
| | | <div class="layui-input-block"> |
| | | <input type="text" name="jumpUrl" minlength="4" maxlength="10" data-th-id="${member.jumpUrl}" |
| | | lay-verify="range|jumpUrl" autocomplete="off" class="layui-input" > |
| | | </div> |
| | | </div> |
| | | <div class="layui-form-item"> |
| | | <label class="layui-form-label febs-form-item-require">联系方式:</label> |
| | | <div class="layui-input-block"> |
| | | <input type="text" name="sort" minlength="4" maxlength="10" data-th-id="${member.sort}" |
| | | lay-verify="range|sort" autocomplete="off" class="layui-input" > |
| | | </div> |
| | | </div> |
| | | <div class="layui-form-item"> |
| | | <label class="layui-form-label febs-form-item-require">是否置顶:</label> |
| | | <div class="layui-input-block"> |
| | | <input type="radio" name="isTop" value="1" title="是"> |
| | | <input type="radio" name="isTop" value="2" title="否"> |
| | | </div> |
| | | </div> |
| | | <div class="layui-form-item"> |
| | | <label class="layui-form-label febs-form-item-require">显示端口:</label> |
| | | <div class="layui-input-block"> |
| | | <input type="radio" name="showPort" value="1" title="pc"> |
| | | <input type="radio" name="showPort" value="2" title="手机"> |
| | | </div> |
| | | </div> |
| | | <div class="layui-form-item"> |
| | | <label class="layui-form-label febs-form-item-require">是否可跳转:</label> |
| | | <div class="layui-input-block"> |
| | | <input type="radio" name="isJump" value="1" title="是"> |
| | | <input type="radio" name="isJump" value="2" title="否"> |
| | | </div> |
| | | </div> |
| | | <div class="layui-form-item"> |
| | | <label class="layui-form-label febs-form-item-require">跳转外部或内部:</label> |
| | | <div class="layui-input-block"> |
| | | <input type="radio" name="isInside" value="1" title="内"> |
| | | <input type="radio" name="isInside" value="2" title="外"> |
| | | </div> |
| | | </div> |
| | | <div class="layui-form-item febs-hide"> |
| | | <button class="layui-btn" lay-submit="" lay-filter="banner-update-form-submit" id="submit"></button> |
| | | </div> |
| | | </form> |
| | | </div> |
| | | |
| | | <script data-th-inline="javascript"> |
| | | layui.use(['febs', 'form', 'formSelects', 'validate', 'treeSelect', 'eleTree','upload'], function () { |
| | | var $ = layui.$, |
| | | febs = layui.febs, |
| | | layer = layui.layer, |
| | | formSelects = layui.formSelects, |
| | | treeSelect = layui.treeSelect, |
| | | form = layui.form, |
| | | eleTree = layui.eleTree, |
| | | member = [[${member}]], |
| | | $view = $('#banner-update'), |
| | | validate = layui.validate, |
| | | upload = layui.upload, |
| | | _deptTree; |
| | | |
| | | //普通图片上传 |
| | | var uploadInst = upload.render({ |
| | | elem: '#test1' |
| | | ,url: ctx + 'admin/goods/uploadFileBase64' //改成您自己的上传接口 |
| | | ,before: function(obj){ |
| | | //预读本地文件示例,不支持ie8 |
| | | obj.preview(function(index, file, result){ |
| | | $('#imageUrls').attr('src', result); //图片链接(base64) |
| | | }); |
| | | } |
| | | ,done: function(res){ |
| | | febs.alert.success(res.data.src); |
| | | $("#imageUrl").val(res.data.src); |
| | | } |
| | | }); |
| | | |
| | | form.render(); |
| | | |
| | | initUserValue(); |
| | | |
| | | formSelects.render(); |
| | | |
| | | function initUserValue() { |
| | | $('#imageUrls').attr('src', member.imageUrl); |
| | | form.val("banner-update-form", { |
| | | "id": member.id, |
| | | "name": member.name, |
| | | "imageUrl": member.imageUrl, |
| | | "isInside": member.isInside, |
| | | "showPort": member.showPort, |
| | | "jumpUrl": member.jumpUrl, |
| | | "sort": member.sort, |
| | | "isTop": member.isTop, |
| | | "isJump": member.isJump |
| | | }); |
| | | } |
| | | |
| | | form.on('submit(banner-update-form-submit)', function (data) { |
| | | febs.post(ctx + 'admin/banner/platformBannerConfirm', data.field, function () { |
| | | layer.closeAll(); |
| | | febs.alert.success('设置成功'); |
| | | $('#febs-banner').find('#reset').click(); |
| | | }); |
| | | return false; |
| | | }); |
| | | }); |
| | | </script> |