From a89221efd99beffa3f295b1a5c427e1ea0537bad Mon Sep 17 00:00:00 2001 From: puzhibing <393733352@qq.com> Date: 星期二, 05 三月 2024 09:31:38 +0800 Subject: [PATCH] 合并代码 --- cloud-server-management/src/main/webapp/WEB-INF/view/system/referee/referee.html | 2 cloud-server-management/src/main/webapp/WEB-INF/view/system/worldCup/worldCup_edit.html | 299 ++++++ cloud-server-management/src/main/java/com/dsh/guns/modular/system/service/IStoreService.java | 4 cloud-server-management/src/main/java/com/dsh/guns/modular/system/controller/code/RefereeController.java | 36 cloud-server-management/src/main/java/com/dsh/guns/modular/system/service/impl/StoreServiceImpl.java | 11 cloud-server-management/src/main/webapp/static/modular/system/worldCup/store.js | 120 ++ cloud-server-communityWorldCup/src/main/java/com/dsh/communityWorldCup/entity/WorldCup.java | 20 cloud-server-management/src/main/webapp/static/modular/system/worldCup/worldCup_info.js | 571 +++++++++++ cloud-server-management/src/main/java/com/dsh/course/feignClient/account/RefereeClient.java | 8 cloud-server-communityWorldCup/src/main/java/com/dsh/communityWorldCup/controller/WorldCupController.java | 49 cloud-server-management/src/main/java/com/dsh/guns/modular/system/controller/code/OperatorController.java | 11 cloud-server-management/src/main/java/com/dsh/course/feignClient/communityWorldCup/Model/WorldCupStore.java | 37 cloud-server-management/src/main/webapp/static/modular/system/referee/referee.js | 126 +- cloud-server-management/src/main/java/com/dsh/course/feignClient/communityWorldCup/Model/WorldCupListAll.java | 35 cloud-server-management/src/main/resources/mapper/TStoreMapper.xml | 45 cloud-server-management/src/main/webapp/WEB-INF/view/system/worldCup/worldCup_add.html | 278 +++++ cloud-server-management/src/main/webapp/WEB-INF/view/system/worldCup/worldCup_info.html | 282 +++++ cloud-server-management/src/main/java/com/dsh/course/feignClient/communityWorldCup/Model/WorldCup.java | 152 +++ cloud-server-communityWorldCup/src/main/java/com/dsh/communityWorldCup/util/GDMapGeocodingUtil.java | 149 +++ cloud-server-communityWorldCup/src/main/java/com/dsh/communityWorldCup/service/impl/WorldCupServiceImpl.java | 15 cloud-server-management/src/main/java/com/dsh/course/feignClient/communityWorldCup/WorldCupStoreClient.java | 42 cloud-server-management/src/main/java/com/dsh/course/feignClient/communityWorldCup/WorldCupClient.java | 60 + cloud-server-management/src/main/java/com/dsh/guns/modular/system/controller/code/WorldCupController.java | 200 ++++ cloud-server-management/src/main/webapp/WEB-INF/view/system/worldCup/store.html | 68 + cloud-server-management/src/main/java/com/dsh/guns/modular/system/controller/code/TStoreController.java | 25 cloud-server-communityWorldCup/src/main/resources/mapper/WorldCupCompetitorMapper.xml | 2 cloud-server-communityWorldCup/src/main/java/com/dsh/communityWorldCup/service/IWorldCupService.java | 7 cloud-server-management/src/main/webapp/static/modular/system/worldCup/worldCup.js | 186 +++ cloud-server-management/src/main/java/com/dsh/course/mapper/StoreMapper.java | 9 cloud-server-management/src/main/webapp/WEB-INF/view/system/worldCup/worldCup.html | 75 + cloud-server-communityWorldCup/src/main/java/com/dsh/communityWorldCup/entity/WorldCupPaymentParticipant.java | 5 31 files changed, 2,855 insertions(+), 74 deletions(-) diff --git a/cloud-server-communityWorldCup/src/main/java/com/dsh/communityWorldCup/controller/WorldCupController.java b/cloud-server-communityWorldCup/src/main/java/com/dsh/communityWorldCup/controller/WorldCupController.java index c3e57b5..a768280 100644 --- a/cloud-server-communityWorldCup/src/main/java/com/dsh/communityWorldCup/controller/WorldCupController.java +++ b/cloud-server-communityWorldCup/src/main/java/com/dsh/communityWorldCup/controller/WorldCupController.java @@ -22,6 +22,7 @@ import com.dsh.communityWorldCup.service.IWorldCupPaymentParticipantService; import com.dsh.communityWorldCup.service.IWorldCupService; import com.dsh.communityWorldCup.service.IWorldCupStoreService; +import com.dsh.communityWorldCup.util.GDMapGeocodingUtil; import com.dsh.communityWorldCup.util.PayMoneyUtil; import com.dsh.communityWorldCup.util.ResultUtil; import com.dsh.communityWorldCup.util.TokenUtil; @@ -88,6 +89,9 @@ @Autowired private IWorldCupCompetitorService worldCupCompetitorService; + + @Autowired + private GDMapGeocodingUtil gdMapGeocodingUtil; @@ -518,6 +522,22 @@ @ResponseBody @PostMapping("/worldCup/addWorldCup") public Integer addWorldCup(@RequestBody WorldCup worldCup){ + String lon = worldCup.getLon(); + String lat = worldCup.getLat(); + Map<String, String> geocode = null; + try { + geocode = gdMapGeocodingUtil.geocode(lon, lat); + } catch (Exception e) { + throw new RuntimeException(e); + } + String province = geocode.get("province"); + String provinceCode = geocode.get("provinceCode"); + String city = geocode.get("city"); + String cityCode = geocode.get("cityCode"); + worldCup.setProvince(province.replace("省", "")); + worldCup.setProvinceCode(provinceCode); + worldCup.setCity(city.replace("市", "")); + worldCup.setCityCode(cityCode); worldCupService.save(worldCup); return worldCup.getId(); } @@ -543,7 +563,23 @@ @ResponseBody @PostMapping("/worldCup/editWorldCup") public Integer editWorldCup(@RequestBody WorldCup worldCup){ - worldCupService.save(worldCup); + String lon = worldCup.getLon(); + String lat = worldCup.getLat(); + Map<String, String> geocode = null; + try { + geocode = gdMapGeocodingUtil.geocode(lon, lat); + } catch (Exception e) { + throw new RuntimeException(e); + } + String province = geocode.get("province"); + String provinceCode = geocode.get("provinceCode"); + String city = geocode.get("city"); + String cityCode = geocode.get("cityCode"); + worldCup.setProvince(province.replace("省", "")); + worldCup.setProvinceCode(provinceCode); + worldCup.setCity(city.replace("市", "")); + worldCup.setCityCode(cityCode); + worldCupService.updateById(worldCup); return worldCup.getId(); } @@ -581,4 +617,15 @@ public List<WorldCupStore> getWorldCupStoreAllList(@RequestBody Integer worldCupId){ return worldCupStoreService.list(new QueryWrapper<WorldCupStore>().eq("worldCupId", worldCupId)); } + + + /** + * 取消赛事退款操作 + * @param id + */ + @ResponseBody + @PostMapping("/worldCup/cancelWorldCupRefund") + public void cancelWorldCupRefund(@RequestBody Integer id){ + worldCupService.cancelWorldCupRefund(id); + } } diff --git a/cloud-server-communityWorldCup/src/main/java/com/dsh/communityWorldCup/entity/WorldCup.java b/cloud-server-communityWorldCup/src/main/java/com/dsh/communityWorldCup/entity/WorldCup.java index 631d54f..f1d5398 100644 --- a/cloud-server-communityWorldCup/src/main/java/com/dsh/communityWorldCup/entity/WorldCup.java +++ b/cloud-server-communityWorldCup/src/main/java/com/dsh/communityWorldCup/entity/WorldCup.java @@ -102,6 +102,26 @@ @TableField("winIntegral") private Integer winIntegral; /** + * 省 + */ + @TableField("province") + private String province; + /** + * 省 + */ + @TableField("provinceCode") + private String provinceCode; + /** + * 市 + */ + @TableField("city") + private String city; + /** + * 市 + */ + @TableField("cityCode") + private String cityCode; + /** * 参赛地址 */ @TableField("address") diff --git a/cloud-server-communityWorldCup/src/main/java/com/dsh/communityWorldCup/entity/WorldCupPaymentParticipant.java b/cloud-server-communityWorldCup/src/main/java/com/dsh/communityWorldCup/entity/WorldCupPaymentParticipant.java index 30eaa97..0f82011 100644 --- a/cloud-server-communityWorldCup/src/main/java/com/dsh/communityWorldCup/entity/WorldCupPaymentParticipant.java +++ b/cloud-server-communityWorldCup/src/main/java/com/dsh/communityWorldCup/entity/WorldCupPaymentParticipant.java @@ -43,4 +43,9 @@ */ @TableField("participantId") private Integer participantId; + /** + * 是否已参赛(0=否,1=是) + */ + @TableField("alreadyEntered") + private Integer alreadyEntered; } diff --git a/cloud-server-communityWorldCup/src/main/java/com/dsh/communityWorldCup/service/IWorldCupService.java b/cloud-server-communityWorldCup/src/main/java/com/dsh/communityWorldCup/service/IWorldCupService.java index e462205..0392f9a 100644 --- a/cloud-server-communityWorldCup/src/main/java/com/dsh/communityWorldCup/service/IWorldCupService.java +++ b/cloud-server-communityWorldCup/src/main/java/com/dsh/communityWorldCup/service/IWorldCupService.java @@ -77,4 +77,11 @@ * @return */ ResultUtil paymentWorldCupCallback(String code, String outTradeNo); + + + /** + * 取消赛事后退还费用 + * @param id + */ + void cancelWorldCupRefund(Integer id); } diff --git a/cloud-server-communityWorldCup/src/main/java/com/dsh/communityWorldCup/service/impl/WorldCupServiceImpl.java b/cloud-server-communityWorldCup/src/main/java/com/dsh/communityWorldCup/service/impl/WorldCupServiceImpl.java index fa50904..3319ef9 100644 --- a/cloud-server-communityWorldCup/src/main/java/com/dsh/communityWorldCup/service/impl/WorldCupServiceImpl.java +++ b/cloud-server-communityWorldCup/src/main/java/com/dsh/communityWorldCup/service/impl/WorldCupServiceImpl.java @@ -383,6 +383,7 @@ //微信 if(payType == 1){ worldCupPayment.setAmount(new BigDecimal(num).multiply(worldCup.getCash())); + worldCupPayment.setUnitPrice(worldCupPayment.getAmount().divide(new BigDecimal(num))); worldCupPaymentService.save(worldCupPayment); return payMoneyUtil.weixinpay("社区世界杯报名", "", worldCupPayment.getCode(), worldCup.getCash().toString(), "/base/worldCup/wxPayWorldCupCallback", "APP", ""); @@ -390,6 +391,7 @@ //支付宝 if(payType == 2){ worldCupPayment.setAmount(new BigDecimal(num).multiply(worldCup.getCash())); + worldCupPayment.setUnitPrice(worldCupPayment.getAmount().divide(new BigDecimal(num))); worldCupPaymentService.save(worldCupPayment); return payMoneyUtil.alipay("2088330203191220", "社区世界杯报名", "世界杯报名", "", worldCupPayment.getCode(), worldCup.getCash().toString(), "/base/worldCup/aliPayWorldCupCallback"); @@ -404,6 +406,7 @@ worldCupPayment.setAmount(multiply); worldCupPayment.setPayStatus(2); worldCupPayment.setPayTime(new Date()); + worldCupPayment.setUnitPrice(worldCupPayment.getAmount().divide(new BigDecimal(num))); worldCupPaymentService.save(worldCupPayment); appUser.setPlayPaiCoins(appUser.getPlayPaiCoins() - multiply.intValue()); @@ -482,6 +485,7 @@ worldCupPayment.setAmount(multiply); worldCupPayment.setPayStatus(2); worldCupPayment.setPayTime(new Date()); + worldCupPayment.setUnitPrice(worldCupPayment.getAmount().divide(new BigDecimal(num))); worldCupPaymentService.save(worldCupPayment); return ResultUtil.success(); } @@ -490,6 +494,7 @@ worldCupPayment.setAmount(BigDecimal.ZERO); worldCupPayment.setPayStatus(2); worldCupPayment.setPayTime(new Date()); + worldCupPayment.setUnitPrice(BigDecimal.ZERO); worldCupPaymentService.save(worldCupPayment); //添加报名明细 @@ -547,4 +552,14 @@ } return ResultUtil.success(); } + + + /** + * 取消赛事后退还费用 + * @param id + */ + @Override + public void cancelWorldCupRefund(Integer id) { + + } } diff --git a/cloud-server-communityWorldCup/src/main/java/com/dsh/communityWorldCup/util/GDMapGeocodingUtil.java b/cloud-server-communityWorldCup/src/main/java/com/dsh/communityWorldCup/util/GDMapGeocodingUtil.java new file mode 100644 index 0000000..422dcdd --- /dev/null +++ b/cloud-server-communityWorldCup/src/main/java/com/dsh/communityWorldCup/util/GDMapGeocodingUtil.java @@ -0,0 +1,149 @@ +package com.dsh.communityWorldCup.util; + +import com.alibaba.fastjson.JSON; +import com.alibaba.fastjson.JSONArray; +import com.alibaba.fastjson.JSONObject; +import com.dsh.communityWorldCup.util.httpClinet.HttpClientUtil; +import com.dsh.communityWorldCup.util.httpClinet.HttpResult; +import org.springframework.stereotype.Component; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +/** + * 高德地图的地理编码工具类 + */ +@Component +public class GDMapGeocodingUtil { + + private String key = "fb131ad2dbfb3f39d7d37d244b92aa2d"; + + + /** + * 将行政区域名称转化为坐标 + * + * @param province + * @param city + * @param county + * @param address + * @return + */ + public Map<String, Object> geocoding(String province, String city, String county, String address) throws Exception { + Map<String, Object> map = new HashMap<>(); + if (ToolUtil.isEmpty(province)) { + map.put("status", -1); + map.put("data", "省不能为空"); + return map; + } + if ((ToolUtil.isEmpty(city) && ToolUtil.isNotEmpty(county)) || (ToolUtil.isEmpty(city) && ToolUtil.isNotEmpty(address))) { + map.put("status", -1); + map.put("data", "市不能为空"); + return map; + } + if ((ToolUtil.isEmpty(county) && ToolUtil.isNotEmpty(address))) { + map.put("status", -1); + map.put("data", "县/区不能为空"); + return map; + } + + String url = "https://restapi.amap.com/v3/geocode/geo?key=" + key + "&output=JSON"; + url += "&address=" + province + (ToolUtil.isNotEmpty(city) ? city : "") + (ToolUtil.isNotEmpty(county) ? county : "") + (ToolUtil.isNotEmpty(address) ? address : ""); + HttpResult httpResult = HttpClientUtil.pushHttpRequset("GET", url, null, null, "json"); + JSONObject jsonObject = JSON.parseObject(httpResult.getData()); + String status = jsonObject.getString("status"); + List<String> list = new ArrayList<>(); + + if (status.equals("1")) { + JSONArray geocodes = jsonObject.getJSONArray("geocodes"); + for (int i = 0; i < geocodes.size(); i++) { + String location = geocodes.getJSONObject(i).getString("location"); + list.add(location); + } + } + map.put("status", 0); + map.put("data", list); + return map; + } + + + public Map<String, Object> geocoding(String address) throws Exception { + Map<String, Object> map = new HashMap<>(); + String url = "https://restapi.amap.com/v3/geocode/geo?key=" + key + "&output=JSON&address=" + address; + HttpResult httpResult = HttpClientUtil.pushHttpRequset("GET", url, null, null, "json"); + JSONObject jsonObject = JSON.parseObject(httpResult.getData()); + String status = jsonObject.getString("status"); + List<String> list = new ArrayList<>(); + + if (status.equals("1")) { + JSONArray geocodes = jsonObject.getJSONArray("geocodes"); + for (int i = 0; i < geocodes.size(); i++) { + String location = geocodes.getJSONObject(i).getString("location"); + list.add(location); + } + } + map.put("status", 0); + map.put("data", list); + return map; + } + + + /** + * 根据经纬度获取行政区域信息 + * + * @param lon + * @param lan + * @return + * @throws Exception + */ + public Map<String, String> geocode(String lon, String lan) throws Exception { + String url = "https://restapi.amap.com/v3/geocode/regeo?key=" + key + "&location=" + lon + "," + lan; + HttpResult httpResult = HttpClientUtil.pushHttpRequset("GET", url, null, null, "json"); + JSONObject jsonObject = JSON.parseObject(httpResult.getData()); + Map<String, String> map = new HashMap<>(); + + if (jsonObject.getString("status").equals("1")) { + JSONObject regeocode = jsonObject.getJSONObject("regeocode"); + JSONObject addressComponent = regeocode.getJSONObject("addressComponent"); + String address = regeocode.getString("formatted_address"); + map.put("address", address); + String code = addressComponent.getString("adcode"); + String province = addressComponent.getString("province"); + String city = addressComponent.getString("city"); + String district = addressComponent.getString("district"); + map.put("province", province); + map.put("provinceCode", code.substring(0, 2) + "0000"); + map.put("city", city); + map.put("cityCode", code.substring(0, 4) + "00"); + map.put("district", district); + map.put("districtCode", code); + } + return map; + } + + + /** + * 坐标转换 + * + * @param locations 经度和纬度用","分割,经度在前,纬度在后,经纬度小数点后不得超过6位。多个坐标对之间用”|”进行分隔最多支持40对坐标。 + * @param coordsys 可选值:gps;mapbar;baidu;autonavi(不进行转换) + * @return + * @throws Exception + */ + public Map<String, String> convert(String locations, String coordsys) throws Exception { + String url = "https://restapi.amap.com/v3/assistant/coordinate/convert?locations=" + locations + "&coordsys=" + coordsys + "&output=json&key=" + key; + HttpResult httpResult = HttpClientUtil.pushHttpRequset("GET", url, null, null, "json"); + JSONObject jsonObject = JSON.parseObject(httpResult.getData()); + Map<String, String> map = new HashMap<>(); + if ("1".equals(jsonObject.getString("status"))) { + map.put("code", jsonObject.getString("infocode"));//"10000" + map.put("info", jsonObject.getString("info"));//status为0时,info返回错误原;否则返回“OK”。 + map.put("locations", jsonObject.getString("locations").split(";")[0]);//转换之后的坐标。若有多个坐标,则用 “;”进行区分和间隔 + } else { + map.put("code", jsonObject.getString("infocode")); + map.put("info", jsonObject.getString("info"));//status为0时,info返回错误原;否则返回“OK”。 + } + return map; + } +} diff --git a/cloud-server-communityWorldCup/src/main/resources/mapper/WorldCupCompetitorMapper.xml b/cloud-server-communityWorldCup/src/main/resources/mapper/WorldCupCompetitorMapper.xml index abad966..1f15572 100644 --- a/cloud-server-communityWorldCup/src/main/resources/mapper/WorldCupCompetitorMapper.xml +++ b/cloud-server-communityWorldCup/src/main/resources/mapper/WorldCupCompetitorMapper.xml @@ -9,7 +9,7 @@ participantId, count(*) as num from t_world_cup_competitor - where 1 = 1 + where DATE_FORMAT(NOW(), '%Y-%m-%d') = DATE_FORMAT(startTime, '%Y-%m-%d') <if test="null != appUserIds and appUserIds.size() > 0"> and appUserId in <foreach collection="appUserIds" item="item" index="index" open="(" separator="," close=")"> diff --git a/cloud-server-management/src/main/java/com/dsh/course/feignClient/account/RefereeClient.java b/cloud-server-management/src/main/java/com/dsh/course/feignClient/account/RefereeClient.java index c531b18..ee55510 100644 --- a/cloud-server-management/src/main/java/com/dsh/course/feignClient/account/RefereeClient.java +++ b/cloud-server-management/src/main/java/com/dsh/course/feignClient/account/RefereeClient.java @@ -39,4 +39,12 @@ */ @PostMapping("/referee/getRefereeById") Referee getRefereeById(Integer id); + + + /** + * 修改裁判 + * @param referee + */ + @PostMapping("/referee/editReferee") + void editReferee(Referee referee); } diff --git a/cloud-server-management/src/main/java/com/dsh/course/feignClient/communityWorldCup/Model/WorldCup.java b/cloud-server-management/src/main/java/com/dsh/course/feignClient/communityWorldCup/Model/WorldCup.java new file mode 100644 index 0000000..d92f1da --- /dev/null +++ b/cloud-server-management/src/main/java/com/dsh/course/feignClient/communityWorldCup/Model/WorldCup.java @@ -0,0 +1,152 @@ +package com.dsh.course.feignClient.communityWorldCup.Model; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import com.fasterxml.jackson.annotation.JsonFormat; +import lombok.Data; + +import java.math.BigDecimal; +import java.util.Date; + +/** + * 社区世界杯 + * @author zhibing.pu + * @Date 2024/2/18 16:58 + */ +@Data +public class WorldCup { + /** + * 主键 + */ + private Integer id; + /** + * 名称 + */ + private String name; + /** + * 开始时间 + */ + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") + private Date startTime; + /** + * 结束时间 + */ + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") + private Date endTime; + /** + * 报名结束时间 + */ + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") + private Date registrationClosingTime; + /** + * 开始年龄 + */ + private Integer startAge; + /** + * 结束年龄 + */ + private Integer endAge; + /** + * 报名性别(0=全部,1=男,2=女) + */ + private Integer gender; + /** + * 支付方式(1=免费,2=现金支付,3=玩湃币支付,4=课时支付) + */ + private String payType; + /** + * 现金 + */ + private BigDecimal cash; + /** + * 玩湃币 + */ + private Integer paiCoin; + /** + * 课时 + */ + private Integer classHour; + /** + * 最多报名人数 + */ + private Integer maxPeople; + /** + * 基础报名人数 + */ + private Integer basePeople; + /** + * 参赛获得积分 + */ + private Integer participationIntegral; + /** + * 胜利获得积分 + */ + private Integer winIntegral; + /** + * 省 + */ + @TableField("province") + private String province; + /** + * 省 + */ + @TableField("provinceCode") + private String provinceCode; + /** + * 市 + */ + @TableField("city") + private String city; + /** + * 市 + */ + @TableField("cityCode") + private String cityCode; + /** + * 参赛地址 + */ + private String address; + /** + * 经度 + */ + private String lon; + /** + * 纬度 + */ + private String lat; + /** + * 封面图 + */ + private String coverImg; + /** + * 首页默认背景图 + */ + private String homeBackdropImg; + /** + * 比赛图片 + */ + private String infoImg; + /** + * 比赛简介 + */ + private String intro; + /** + * 比赛详情 + */ + private String content; + /** + * 比赛状态(1=未开始,2=已开始,3=已结束,4=已取消) + */ + private Integer status; + /** + * 添加时间 + */ + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") + private Date createTime; + /** + * 已比赛次数 + */ + private Integer matchNumber; +} diff --git a/cloud-server-management/src/main/java/com/dsh/course/feignClient/communityWorldCup/Model/WorldCupListAll.java b/cloud-server-management/src/main/java/com/dsh/course/feignClient/communityWorldCup/Model/WorldCupListAll.java new file mode 100644 index 0000000..358edfb --- /dev/null +++ b/cloud-server-management/src/main/java/com/dsh/course/feignClient/communityWorldCup/Model/WorldCupListAll.java @@ -0,0 +1,35 @@ +package com.dsh.course.feignClient.communityWorldCup.Model; + +import lombok.Data; + +/** + * @author zhibing.pu + * @Date 2024/3/2 10:56 + */ +@Data +public class WorldCupListAll { + /** + * 比赛名称 + */ + private String name; + /** + * 开始时间 + */ + private String startTime; + /** + * 结束时间 + */ + private String endTime; + /** + * 比赛状态(1=未开始,2=已开始,3=已结束,4=已取消) + */ + private Integer status; + /** + * 页码 + */ + private Integer offset; + /** + * 页条数 + */ + private Integer limit; +} diff --git a/cloud-server-management/src/main/java/com/dsh/course/feignClient/communityWorldCup/Model/WorldCupStore.java b/cloud-server-management/src/main/java/com/dsh/course/feignClient/communityWorldCup/Model/WorldCupStore.java new file mode 100644 index 0000000..80eaf66 --- /dev/null +++ b/cloud-server-management/src/main/java/com/dsh/course/feignClient/communityWorldCup/Model/WorldCupStore.java @@ -0,0 +1,37 @@ +package com.dsh.course.feignClient.communityWorldCup.Model; + +import lombok.Data; + +/** + * 社区世界杯门店 + * @author zhibing.pu + * @Date 2024/2/18 18:06 + */ +@Data +public class WorldCupStore { + /** + * 主键 + */ + private Integer id; + /** + * 世界杯id + */ + private Integer worldCupId; + /** + * 门店id + */ + private Integer storeId; + /** + * 是否开启世界杯按钮(0=否,1=是) + */ + private Integer isOpen; + /** + * 世界杯入口背景图 + */ + private String backgroundImage; + /** + * 排序 + */ + private Integer sort; + +} diff --git a/cloud-server-management/src/main/java/com/dsh/course/feignClient/communityWorldCup/WorldCupClient.java b/cloud-server-management/src/main/java/com/dsh/course/feignClient/communityWorldCup/WorldCupClient.java new file mode 100644 index 0000000..d1a88d4 --- /dev/null +++ b/cloud-server-management/src/main/java/com/dsh/course/feignClient/communityWorldCup/WorldCupClient.java @@ -0,0 +1,60 @@ +package com.dsh.course.feignClient.communityWorldCup; + +import com.dsh.course.feignClient.communityWorldCup.Model.WorldCup; +import com.dsh.course.feignClient.communityWorldCup.Model.WorldCupListAll; +import org.springframework.cloud.openfeign.FeignClient; +import org.springframework.web.bind.annotation.PostMapping; + +import java.util.Map; + +/** + * @author zhibing.pu + * @Date 2024/3/2 10:58 + */ +@FeignClient("mb-cloud-communityWorldCup") +public interface WorldCupClient { + + /** + * 获取比赛管理列表页数据 + * @param worldCupListAll + * @return + */ + @PostMapping("/worldCup/getWorldCupListAll") + Map<String, Object> getWorldCupListAll(WorldCupListAll worldCupListAll); + + + /** + * 添加社区世界杯 + * @param worldCup + * @return 数据id + */ + @PostMapping("/worldCup/addWorldCup") + Integer addWorldCup(WorldCup worldCup); + + + + /** + * 添加社区世界杯 + * @param worldCup + * @return 数据id + */ + @PostMapping("/worldCup/editWorldCup") + void editWorldCup(WorldCup worldCup); + + + /** + * 根据id获取数据 + * @param id + * @return + */ + @PostMapping("/worldCup/getWorldCupById") + WorldCup getWorldCupById(Integer id); + + + /** + * 取消赛事退款操作 + * @param id + */ + @PostMapping("/worldCup/cancelWorldCupRefund") + void cancelWorldCupRefund(Integer id); +} diff --git a/cloud-server-management/src/main/java/com/dsh/course/feignClient/communityWorldCup/WorldCupStoreClient.java b/cloud-server-management/src/main/java/com/dsh/course/feignClient/communityWorldCup/WorldCupStoreClient.java new file mode 100644 index 0000000..1f234a5 --- /dev/null +++ b/cloud-server-management/src/main/java/com/dsh/course/feignClient/communityWorldCup/WorldCupStoreClient.java @@ -0,0 +1,42 @@ +package com.dsh.course.feignClient.communityWorldCup; + +import com.dsh.course.feignClient.communityWorldCup.Model.WorldCupStore; +import org.springframework.cloud.openfeign.FeignClient; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestBody; + +import java.util.List; + +/** + * @author zhibing.pu + * @Date 2024/3/4 9:58 + */ +@FeignClient("mb-cloud-communityWorldCup") +public interface WorldCupStoreClient { + + + /** + * 添加社区世界杯和门店关系数据 + * @param worldCupStore + */ + @PostMapping("/worldCup/addWorldCupStore") + void addWorldCupStore(WorldCupStore worldCupStore); + + + /** + * 删除世界杯门店关系数据 + * @param worldCupId + */ + @PostMapping("/worldCup/addWorldCupStore") + void delWorldCupStore(@RequestBody Integer worldCupId); + + + /** + * 根据世界杯id获取门店关系数据 + * @param worldCupId + * @return + */ + @PostMapping("/worldCup/getWorldCupStoreAllList") + List<WorldCupStore> getWorldCupStoreAllList(Integer worldCupId); + +} diff --git a/cloud-server-management/src/main/java/com/dsh/course/mapper/StoreMapper.java b/cloud-server-management/src/main/java/com/dsh/course/mapper/StoreMapper.java index 4d490a1..3d5f97e 100644 --- a/cloud-server-management/src/main/java/com/dsh/course/mapper/StoreMapper.java +++ b/cloud-server-management/src/main/java/com/dsh/course/mapper/StoreMapper.java @@ -76,4 +76,13 @@ List<TStoreListVo> listAllStore(@Param("page") Page<TStoreListVo> page, @Param("provinceCode") String provinceCode, @Param("cityCode") String cityCode, @Param("name") String name, @Param("phone") String phone, @Param("shopName") String shopName, @Param("id") Integer id); + + + List<Map<String, Object>> listStoreAll(Page page, @Param("name") String name, + @Param("operator") Integer operator, @Param("provinceCode") String provinceCode, + @Param("cityCode") String cityCode); + + + + List<Map<String, Object>> listStoreAllByIds(@Param("ids") List<Integer> ids); } diff --git a/cloud-server-management/src/main/java/com/dsh/guns/modular/system/controller/code/OperatorController.java b/cloud-server-management/src/main/java/com/dsh/guns/modular/system/controller/code/OperatorController.java index cd434d7..c1d7f8f 100644 --- a/cloud-server-management/src/main/java/com/dsh/guns/modular/system/controller/code/OperatorController.java +++ b/cloud-server-management/src/main/java/com/dsh/guns/modular/system/controller/code/OperatorController.java @@ -856,4 +856,15 @@ } return ResultUtil.success("添加成功"); } + + + /** + * 获取所有运营商 + * @return + */ + @ResponseBody + @PostMapping("/getOperatorListAll") + public Object getOperatorListAll(){ + return operatorService.list(new QueryWrapper<TOperator>().eq("state", 1)); + } } diff --git a/cloud-server-management/src/main/java/com/dsh/guns/modular/system/controller/code/RefereeController.java b/cloud-server-management/src/main/java/com/dsh/guns/modular/system/controller/code/RefereeController.java index 735b8f4..feaf9b9 100644 --- a/cloud-server-management/src/main/java/com/dsh/guns/modular/system/controller/code/RefereeController.java +++ b/cloud-server-management/src/main/java/com/dsh/guns/modular/system/controller/code/RefereeController.java @@ -91,4 +91,40 @@ map.put("city", citys); return map; } + + + /** + * 修改裁判数据 + * @param referee + * @return + */ + @ResponseBody + @PostMapping("/editReferee") + public ResultUtil editReferee(Referee referee){ + Region region = regionService.getOne(new QueryWrapper<Region>().eq("code", referee.getProvinceCode())); + referee.setProvince(region.getName()); + region = regionService.getOne(new QueryWrapper<Region>().eq("code", referee.getCityCode())); + referee.setCity(region.getName()); + refereeClient.editReferee(referee); + return ResultUtil.success(); + } + + + /** + * 修改状态 + * @param id + * @param state + * @return + */ + @ResponseBody + @PostMapping("/updateState") + public ResultUtil updateState(Integer id, Integer state){ + Referee referee = new Referee(); + referee.setState(state); + referee.setId(id); + refereeClient.editReferee(referee); + return ResultUtil.success(); + } + + } diff --git a/cloud-server-management/src/main/java/com/dsh/guns/modular/system/controller/code/TStoreController.java b/cloud-server-management/src/main/java/com/dsh/guns/modular/system/controller/code/TStoreController.java index d0c4b0d..e2d85ee 100644 --- a/cloud-server-management/src/main/java/com/dsh/guns/modular/system/controller/code/TStoreController.java +++ b/cloud-server-management/src/main/java/com/dsh/guns/modular/system/controller/code/TStoreController.java @@ -1,7 +1,17 @@ package com.dsh.guns.modular.system.controller.code; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.dsh.guns.core.base.controller.BaseController; +import com.dsh.guns.core.common.constant.factory.PageFactory; +import com.dsh.guns.modular.system.service.IStoreService; +import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; +import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.ResponseBody; + +import java.util.List; +import java.util.Map; /** * @author zhibing.pu @@ -9,5 +19,18 @@ */ @Controller @RequestMapping("/store") -public class TStoreController { +public class TStoreController extends BaseController { + + @Autowired + private IStoreService storeService; + + + @ResponseBody + @PostMapping("/listAll") + public Object listAll(String name, Integer operator, String provinceCode, String cityCode){ + Page page = new PageFactory<List<Map<String, Object>>>().defaultPage(); + List<Map<String, Object>> mapList = storeService.listStoreAll(page, name, operator, provinceCode, cityCode); + page.setRecords(mapList); + return super.packForBT(page); + } } diff --git a/cloud-server-management/src/main/java/com/dsh/guns/modular/system/controller/code/WorldCupController.java b/cloud-server-management/src/main/java/com/dsh/guns/modular/system/controller/code/WorldCupController.java new file mode 100644 index 0000000..620b6f1 --- /dev/null +++ b/cloud-server-management/src/main/java/com/dsh/guns/modular/system/controller/code/WorldCupController.java @@ -0,0 +1,200 @@ +package com.dsh.guns.modular.system.controller.code; + +import com.alibaba.fastjson.JSON; +import com.alibaba.fastjson.JSONArray; +import com.alibaba.fastjson.JSONObject; +import com.dsh.course.feignClient.communityWorldCup.Model.WorldCupStore; +import com.dsh.course.feignClient.communityWorldCup.WorldCupClient; +import com.dsh.course.feignClient.communityWorldCup.Model.WorldCup; +import com.dsh.course.feignClient.communityWorldCup.Model.WorldCupListAll; +import com.dsh.course.feignClient.communityWorldCup.WorldCupStoreClient; +import com.dsh.guns.modular.system.service.IStoreService; +import com.dsh.guns.modular.system.util.DateUtil; +import com.dsh.guns.modular.system.util.ResultUtil; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Controller; +import org.springframework.ui.Model; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.ResponseBody; + +import javax.annotation.Resource; +import java.sql.ResultSet; +import java.text.SimpleDateFormat; +import java.util.*; +import java.util.stream.Collectors; + +/** + * @author zhibing.pu + * @Date 2024/3/2 10:40 + */ +@Controller +@RequestMapping("/worldCup") +public class WorldCupController { + + private String PREFIX = "/system/worldCup/"; + + @Resource + private WorldCupClient worldCupClient; + + @Resource + private WorldCupStoreClient worldCupStoreClient; + + @Autowired + private IStoreService storeService; + + + /** + * 跳转列表页 + * @return + */ + @RequestMapping("") + public String showWorldCupList(){ + return PREFIX + "worldCup.html"; + } + + /** + * 跳转到添加页 + * @return + */ + @RequestMapping("/openAddWorldCup") + public String openAddWorldCup(){ + return PREFIX + "worldCup_add.html"; + } + + + @RequestMapping("/openEditWorldCup") + public String openEditWorldCup(Model model, Integer id){ + SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); + WorldCup worldCup = worldCupClient.getWorldCupById(id); + model.addAttribute("item", worldCup); + model.addAttribute("startTime", sdf.format(worldCup.getStartTime())); + model.addAttribute("endTime", sdf.format(worldCup.getEndTime())); + model.addAttribute("registrationClosingTime", null != worldCup.getRegistrationClosingTime() ? sdf.format(worldCup.getRegistrationClosingTime()) : ""); + List<WorldCupStore> worldCupStoreAllList = worldCupStoreClient.getWorldCupStoreAllList(id); + List<Integer> collect = worldCupStoreAllList.stream().map(WorldCupStore::getStoreId).collect(Collectors.toList()); + List<Map<String, Object>> mapList = storeService.listStoreAllByIds(collect); + model.addAttribute("stores", JSON.toJSONString(mapList)); + return PREFIX + "worldCup_edit.html"; + } + + + @RequestMapping("/openInfoWorldCup") + public String openInfoWorldCup(Model model, Integer id){ + SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); + WorldCup worldCup = worldCupClient.getWorldCupById(id); + model.addAttribute("item", worldCup); + model.addAttribute("startTime", sdf.format(worldCup.getStartTime())); + model.addAttribute("endTime", sdf.format(worldCup.getEndTime())); + model.addAttribute("registrationClosingTime", null != worldCup.getRegistrationClosingTime() ? sdf.format(worldCup.getRegistrationClosingTime()) : ""); + List<WorldCupStore> worldCupStoreAllList = worldCupStoreClient.getWorldCupStoreAllList(id); + List<Integer> collect = worldCupStoreAllList.stream().map(WorldCupStore::getStoreId).collect(Collectors.toList()); + List<Map<String, Object>> mapList = storeService.listStoreAllByIds(collect); + model.addAttribute("stores", JSON.toJSONString(mapList)); + return PREFIX + "worldCup_info.html"; + } + + + + /** + * 跳转到门店选择页面 + * @return + */ + @RequestMapping("/openStore") + public String openStore(){ + return PREFIX + "store.html"; + } + + + + + + /** + * 获取列表数据 + * @param worldCupList + * @return + */ + @ResponseBody + @PostMapping("/listAll") + public Object listAll(WorldCupListAll worldCupList){ + return worldCupClient.getWorldCupListAll(worldCupList); + } + + + /** + * 添加社区世界杯 + * @param worldCup + * @param stores + * @return + */ + @ResponseBody + @PostMapping("/addWorldCup") + public ResultUtil addWorldCup(WorldCup worldCup, String stores){ + worldCup.setStatus(1); + worldCup.setCreateTime(new Date()); + worldCup.setMatchNumber(0); + Integer integer = worldCupClient.addWorldCup(worldCup); + if(null != integer){ + JSONArray jsonArray = JSON.parseArray(stores); + for (int i = 0; i < jsonArray.size(); i++) { + JSONObject jsonObject = jsonArray.getJSONObject(i); + Integer id = jsonObject.getInteger("id"); + WorldCupStore worldCupStore = new WorldCupStore(); + worldCupStore.setStoreId(id); + worldCupStore.setWorldCupId(integer); + worldCupStore.setIsOpen(0); + worldCupStoreClient.addWorldCupStore(worldCupStore); + } + } + return ResultUtil.success(); + } + + + + /** + * 编辑社区世界杯 + * @param worldCup + * @param stores + * @return + */ + @ResponseBody + @PostMapping("/editWorldCup") + public ResultUtil editWorldCup(WorldCup worldCup, String stores){ + WorldCup worldCup1 = worldCupClient.getWorldCupById(worldCup.getId()); + if(worldCup1.getStartTime().before(DateUtil.getDate())){ + return ResultUtil.error("赛事已开始,不能编辑"); + } + worldCupClient.editWorldCup(worldCup); + worldCupStoreClient.delWorldCupStore(worldCup.getId()); + JSONArray jsonArray = JSON.parseArray(stores); + for (int i = 0; i < jsonArray.size(); i++) { + JSONObject jsonObject = jsonArray.getJSONObject(i); + Integer id = jsonObject.getInteger("id"); + WorldCupStore worldCupStore = new WorldCupStore(); + worldCupStore.setStoreId(id); + worldCupStore.setWorldCupId(worldCup.getId()); + worldCupStore.setIsOpen(0); + worldCupStoreClient.addWorldCupStore(worldCupStore); + } + return ResultUtil.success(); + } + + + /** + * 修改赛事状态 + * @param id + * @param state + * @return + */ + @ResponseBody + @PostMapping("/updateState") + public ResultUtil updateState(Integer id, Integer state){ + WorldCup worldCup = new WorldCup(); + worldCup.setId(id); + worldCup.setStatus(state); + worldCupClient.editWorldCup(worldCup); + //开始处理已支付的退费 + worldCupClient.cancelWorldCupRefund(id); + return ResultUtil.success(); + } +} diff --git a/cloud-server-management/src/main/java/com/dsh/guns/modular/system/service/IStoreService.java b/cloud-server-management/src/main/java/com/dsh/guns/modular/system/service/IStoreService.java index 03b6630..1d093a5 100644 --- a/cloud-server-management/src/main/java/com/dsh/guns/modular/system/service/IStoreService.java +++ b/cloud-server-management/src/main/java/com/dsh/guns/modular/system/service/IStoreService.java @@ -79,4 +79,8 @@ List<TStoreListVo> listAllStore(Page<TStoreListVo> page, String provinceCode, String cityCode, String name, String phone, String shopName, Integer objectId); + List<Map<String, Object>> listStoreAll(Page page, String name, Integer operator, String provinceCode, String cityCode); + + + List<Map<String, Object>> listStoreAllByIds(List<Integer> ids); } diff --git a/cloud-server-management/src/main/java/com/dsh/guns/modular/system/service/impl/StoreServiceImpl.java b/cloud-server-management/src/main/java/com/dsh/guns/modular/system/service/impl/StoreServiceImpl.java index a0d65a3..b52ad11 100644 --- a/cloud-server-management/src/main/java/com/dsh/guns/modular/system/service/impl/StoreServiceImpl.java +++ b/cloud-server-management/src/main/java/com/dsh/guns/modular/system/service/impl/StoreServiceImpl.java @@ -132,4 +132,15 @@ public void updateBenefits(Integer id, String p1) { this.baseMapper.updateBasicBenefits(id,p1); } + + + @Override + public List<Map<String, Object>> listStoreAll(Page page, String name, Integer operator, String provinceCode, String cityCode) { + return this.baseMapper.listStoreAll(page, name, operator, provinceCode, cityCode); + } + + @Override + public List<Map<String, Object>> listStoreAllByIds(List<Integer> ids) { + return this.baseMapper.listStoreAllByIds(ids); + } } diff --git a/cloud-server-management/src/main/resources/mapper/TStoreMapper.xml b/cloud-server-management/src/main/resources/mapper/TStoreMapper.xml index cacc3a4..24ef43b 100644 --- a/cloud-server-management/src/main/resources/mapper/TStoreMapper.xml +++ b/cloud-server-management/src/main/resources/mapper/TStoreMapper.xml @@ -171,4 +171,49 @@ and t1.name like concat("%",#{shopName},"%") </if> </select> + + + + <select id="listStoreAll" resultType="map"> + select + a.id, + CONCAT(a.province, a.city) as province, + b.name as operator, + a.name, + c.gate + from t_store a + left join t_operator b on (a.operatorId = b.id) + left join (select GROUP_CONCAT(id) as gate, storeId from t_gate group by storeId) c on (a.id = c.storeId) + where a.state = 1 + <if test="null != name and '' != name"> + and a.name like CONCAT('%', #{name}, '%') + </if> + <if test="null != operator"> + and a.operatorId = #{operator} + </if> + <if test="null != provinceCode and '' != provinceCode"> + and a.provinceCode = #{provinceCode} + </if> + <if test="null != cityCode and '' != cityCode"> + and a.cityCode = #{cityCode} + </if> + </select> + + + + <select id="listStoreAllByIds" resultType="map"> + select + a.id, + CONCAT(a.province, a.city) as province, + b.name as operator, + a.name, + c.gate + from t_store a + left join t_operator b on (a.operatorId = b.id) + left join (select GROUP_CONCAT(id) as gate, storeId from t_gate group by storeId) c on (a.id = c.storeId) + where a.id in + <foreach collection="ids" item="item" index="index" open="(" separator="," close=")"> + #{item} + </foreach> + </select> </mapper> \ No newline at end of file diff --git a/cloud-server-management/src/main/webapp/WEB-INF/view/system/referee/referee.html b/cloud-server-management/src/main/webapp/WEB-INF/view/system/referee/referee.html index 8f7adf7..772466f 100644 --- a/cloud-server-management/src/main/webapp/WEB-INF/view/system/referee/referee.html +++ b/cloud-server-management/src/main/webapp/WEB-INF/view/system/referee/referee.html @@ -22,7 +22,7 @@ 所在省 </button> </div> - <select class="form-control" id="provinceCode" > + <select class="form-control" id="provinceCode" onchange="Referee.region('cityCode', this)"> <option value="">请选择</option> </select> </div> diff --git a/cloud-server-management/src/main/webapp/WEB-INF/view/system/worldCup/store.html b/cloud-server-management/src/main/webapp/WEB-INF/view/system/worldCup/store.html new file mode 100644 index 0000000..8a80e31 --- /dev/null +++ b/cloud-server-management/src/main/webapp/WEB-INF/view/system/worldCup/store.html @@ -0,0 +1,68 @@ +@layout("/common/_container.html"){ +<div class="row"> + <div class="col-sm-12"> + <div class="ibox float-e-margins"> + <div class="ibox-title"> + <h5>参与赛点</h5> + </div> + <div class="ibox-content"> + <div class="row row-lg"> + <div class="col-sm-12"> + <div class="row"> + <div class="col-sm-3"> + <div class="input-group"> + <div class="input-group-btn open"> + <button data-toggle="dropdown" class="btn btn-white dropdown-toggle" type="button" aria-expanded="true"> + 所在省 + </button> + </div> + <select class="form-control" id="provinceCode" onchange="Store.region('cityCode', this)"> + <option value="">请选择</option> + </select> + </div> + </div> + <div class="col-sm-3"> + <div class="input-group"> + <div class="input-group-btn open"> + <button data-toggle="dropdown" class="btn btn-white dropdown-toggle" type="button" aria-expanded="true"> + 所在市 + </button> + </div> + <select class="form-control" id="cityCode" > + <option value="">请选择</option> + </select> + </div> + </div> + <div class="col-sm-3"> + <div class="input-group"> + <div class="input-group-btn open"> + <button data-toggle="dropdown" class="btn btn-white dropdown-toggle" type="button" aria-expanded="true"> + 所属运营商 + </button> + </div> + <select class="form-control" id="operator" > + <option value="">请选择</option> + </select> + </div> + </div> + <div class="col-sm-3"> + <#NameCon id="name" name="门店名称:" /> + </div> + <div class="col-sm-3"> + <#button name="搜索" icon="fa-search" clickFun="Store.search()"/> + <#button name="重置" icon="fa-trash" clickFun="Store.resetSearch()" space="true"/> + </div> + </div> + <#table id="StoreTable"/> + <div style="text-align: center;"> + <#button btnCss="danger" name="关闭" id="cancel" icon="fa-eraser" clickFun="Store.close()"/> + <#button btnCss="info" name="保存" id="ensure" icon="fa-check" clickFun="Store.addSubmit()"/> + </div> + </div> + </div> + </div> + </div> + </div> +</div> +<script src="${ctxPath}/modular/system/worldCup/store.js"></script> +@} diff --git a/cloud-server-management/src/main/webapp/WEB-INF/view/system/worldCup/worldCup.html b/cloud-server-management/src/main/webapp/WEB-INF/view/system/worldCup/worldCup.html new file mode 100644 index 0000000..023a2d8 --- /dev/null +++ b/cloud-server-management/src/main/webapp/WEB-INF/view/system/worldCup/worldCup.html @@ -0,0 +1,75 @@ +@layout("/common/_container.html"){ +<div class="row"> + <div class="col-sm-12"> + <div class="ibox float-e-margins"> + <div class="ibox-title"> + <h5>社区世界杯比赛管理</h5> + </div> + <div class="ibox-content"> + <div class="row row-lg"> + <div class="col-sm-12"> + <div class="row"> + <div class="col-sm-3"> + <#NameCon id="name" name="比赛名称:" /> + </div> + <div class="col-sm-3"> + <#NameCon id="startTime" name="开始时间:" /> + </div> + <div class="col-sm-3"> + <#NameCon id="endTime" name="结束时间:" /> + </div> + <div class="col-sm-3"> + <div class="input-group"> + <div class="input-group-btn open"> + <button data-toggle="dropdown" class="btn btn-white dropdown-toggle" type="button" aria-expanded="true"> + 状态 + </button> + </div> + <select class="form-control" id="status"> + <option value="">全部</option> + <option value="1">未开始</option> + <option value="2">已开始</option> + <option value="3">已结束</option> + <option value="4">已取消</option> + </select> + </div> + </div> + <div class="col-sm-3"> + <#button name="搜索" icon="fa-search" clickFun="WorldCup.search()"/> + <#button name="重置" icon="fa-trash" clickFun="WorldCup.resetSearch()" space="true"/> + </div> + </div> + <div class="hidden-xs" id="WorldCupTableToolbar" role="group"> + @if(shiro.hasPermission("/worldCup/openAddWorldCup")){ + <#button name="添加" icon="fa-plus" clickFun="WorldCup.openAddWorldCup()"/> + @} + @if(shiro.hasPermission("/worldCup/openEditWorldCup")){ + <#button name="编辑" icon="fa-edit" clickFun="WorldCup.openEditWorldCup()" space="true"/> + @} + @if(shiro.hasPermission("/worldCup/cancelWorldCup")){ + <#button name="取消" icon="fa-edit" clickFun="WorldCup.cancelWorldCup()" space="true"/> + @} + @if(shiro.hasPermission("/worldCup/openWorldCupInfo")){ + <#button name="查看详情" icon="fa-edit" clickFun="WorldCup.openWorldCupInfo()" space="true"/> + @} + @if(shiro.hasPermission("/worldCup/registeredPersonnel")){ + <#button name="已报名人员" icon="fa-edit" clickFun="WorldCup.registeredPersonnel()" space="true"/> + @} + </div> + <#table id="WorldCupTable"/> + </div> + </div> + </div> + </div> + </div> +</div> +<script src="${ctxPath}/modular/system/worldCup/worldCup.js"></script> +<script> + laydate.render({ + elem: '#startTime' + }); + laydate.render({ + elem: '#endTime' + }); +</script> +@} diff --git a/cloud-server-management/src/main/webapp/WEB-INF/view/system/worldCup/worldCup_add.html b/cloud-server-management/src/main/webapp/WEB-INF/view/system/worldCup/worldCup_add.html new file mode 100644 index 0000000..4036fde --- /dev/null +++ b/cloud-server-management/src/main/webapp/WEB-INF/view/system/worldCup/worldCup_add.html @@ -0,0 +1,278 @@ +@layout("/common/_container.html"){ +<style type="text/css"> + #stores{ + width: 100%; + } + #stores td, #stores th{ + border: 1px solid #eee; + text-align: center; + height: 40px; + line-height: 40px; + } + #stores td select, #stores td div, #stores td div input, #stores td input{ + height: 100%; + width: 95%; + border: none; + text-indent: 10px; + } +</style> +<div class="ibox float-e-margins"> + <div class="ibox-content"> + <div class="form-horizontal" id="userInfoForm"> + <input type="hidden" id="id" value=""> + <div class="row"> + <div class="form-group"> + <label class="col-sm-3 control-label">*比赛名称:</label> + <div class="col-sm-3"> + <input class="form-control" id="name"> + </div> + </div> + <div class="form-group"> + <label class="col-sm-3 control-label">*开始时间:</label> + <div class="col-sm-3"> + <input class="form-control" id="startTime"> + </div> + </div> + <div class="form-group"> + <label class="col-sm-3 control-label">*结束时间:</label> + <div class="col-sm-3"> + <input class="form-control" id="endTime"> + </div> + </div> + <div class="form-group"> + <label class="col-sm-3 control-label">报名截止时间:</label> + <div class="col-sm-3"> + <input class="form-control" id="registrationClosingTime"> + </div> + </div> + <div class="form-group"> + <label class="col-sm-3 control-label">*报名年龄:</label> + <div class="col-sm-1"> + <input class="form-control" id="startAge" type="number" min="0"> + </div> + <label style="float: left;line-height: 35px;">岁至:</label> + <div class="col-sm-1"> + <input class="form-control" id="endAge" type="number" min="0"> + </div> + <label style="float: left;line-height: 35px;">岁</label> + </div> + <div class="form-group"> + <label class="col-sm-3 control-label">*报名性别</label> + <div class="col-sm-3"> + <select class="form-control" id="gender"> + <option value="0">全部</option> + <option value="1">男</option> + <option value="2">女</option> + </select> + </div> + </div> + <div class="form-group"> + <label class="col-sm-3 control-label">*支付方式:</label> + <div class="col-sm-9" id="payType"> + <input type="checkbox" item="free" value="0" checked>免费 + <input type="checkbox" item="cash" value="1">现金支付 + <input type="checkbox" item="paiCoin" value="2">玩湃币支付 + <input type="checkbox" item="classHour" value="3">课时支付 + </div> + </div> + <div class="form-group cash" hidden> + <label class="col-sm-3 control-label">*现金支付:</label> + <div class="col-sm-3"> + <input class="form-control" id="cash" type="number" min="0"> + </div> + </div> + <div class="form-group paiCoin" hidden> + <label class="col-sm-3 control-label">*玩湃币支付:</label> + <div class="col-sm-3"> + <input class="form-control" id="paiCoin" type="number" min="0"> + </div> + </div> + <div class="form-group classHour" hidden> + <label class="col-sm-3 control-label">*课时支付:</label> + <div class="col-sm-3"> + <input class="form-control" id="classHour" type="number" min="0"> + </div> + </div> + <div class="form-group"> + <label class="col-sm-3 control-label">*报名人数:</label> + <div class="col-sm-3"> + <input class="form-control" id="maxPeople" type="number" min="0"> + </div> + </div> + <div class="form-group"> + <label class="col-sm-3 control-label">*基础报名人数:</label> + <div class="col-sm-3"> + <input class="form-control" id="basePeople" type="number" min="0"> + </div> + </div> + <div class="form-group"> + <label class="col-sm-3 control-label">*参赛可获积分:</label> + <div class="col-sm-3"> + <input class="form-control" id="participationIntegral" type="number" min="0"> + </div> + <label style="float: left;line-height: 35px;">胜场可获积分</label> + <div class="col-sm-3"> + <input class="form-control" id="winIntegral" type="number" min="0"> + </div> + </div> + <div class="form-group"> + <label class="col-sm-3 control-label">*比赛地点:</label> + <div class="col-sm-7"> + <input class="form-control" id="address" onchange="WorldCupInfo.searchByStationName(this,1)"> + </div> + </div> + <div class="form-group"> + <label class="col-sm-3 control-label">*坐标选择:</label> + <div class="col-sm-7"> + <div id="container" style="height: 500px;" ></div> + </div> + <input type="hidden" id="longitude"/> + <input type="hidden" id="latitude"/> + </div> + <div class="form-group"> + <label class="col-sm-3 control-label">参与赛点:</label> + <div class="col-sm-7"> + <button onclick="WorldCupInfo.openStore()">选择门店</button> + </div> + </div> + <div class="form-group"> + <label class="col-sm-3 control-label"></label> + <div class="col-sm-7"> + <table id="stores"> + <thead> + <tr> + <th>所在省市</th><th>所属运营商</th><th>门店名称</th><th>操作</th> + </tr> + </thead> + <tbody> + + </tbody> + </table> + </div> + </div> + <div class="form-group"> + <label class="col-sm-3 control-label">赛事简介</label> + <div class="col-sm-7"> + <textarea class="form-control" id="intro" style="height:200px"></textarea> + </div> + </div> + <div class="form-group"> + <label class="col-sm-3 control-label head-scu-label">比赛封面图</label> + <div class="col-sm-2"> + <div id="coverImgPreId"> + <div><img width="100px" height="100px" src="${ctxPath}/img/NoPIC.png"></div> + </div> + </div> + <div class="col-sm-1"> + <div class="head-scu-btn upload-btn" id="coverImgBtnId"> + <i class="fa fa-upload"></i> 文件上传 + </div> + </div> + <input type="hidden" id="coverImg" /> + <label class="col-sm-1 control-label">首页默认背景图</label> + <div class="col-sm-2"> + <div id="homeBackdropImgPreId"> + <div><img width="100px" height="100px" src="${ctxPath}/img/NoPIC.png"></div> + </div> + </div> + <div class="col-sm-1"> + <div class="head-scu-btn upload-btn" id="homeBackdropImgBtnId"> + <i class="fa fa-upload"></i> 文件上传 + </div> + </div> + <input type="hidden" id="homeBackdropImg" /> + </div> + <div class="row" id="app1"> + <div class="form-group"> + <label class="col-sm-3 control-label head-scu-label">*比赛图片(请上传不超过五张图片): </label> + <div class="col-sm-7"> + <el-upload + :limit="5" + class="avatar-uploader" + action="/tCouponManage/uploadPic" + list-type="picture-card" + accept="." + :on-success="handleAvatarSuccess" + :on-remove="handleRemove"> + <i class="el-icon-plus"></i> + </el-upload> + <el-dialog :visible.sync="dialogVisible"> + <img width="100%" :src="imageUrl1" alt=""> + </el-dialog> + </div> + </div> + </div> + <div class="form-group"> + <label class="col-sm-3 control-label">比赛详情</label> + <div class="col-sm-7" style="padding: 0px;"> + <textarea id="content" style="height: 800px;width: 100%;"></textarea> + </div> + </div> + </div> + </div> + <div class="row btn-group-m-t"> + <div class="col-sm-10"> + <#button btnCss="info" name="提交" id="ensure" icon="fa-check" clickFun="WorldCupInfo.addSubmit()"/> + <#button btnCss="danger" name="取消" id="cancel" icon="fa-eraser" clickFun="WorldCupInfo.close()"/> + </div> + </div> + </div> +</div> +<script src="${ctxPath}/modular/system/worldCup/worldCup_info.js"></script> +<script type="text/javascript" src="http://webapi.amap.com/maps?v=1.4.15&key=77b37f0753049c4e712ea79a24e0719c"></script> +<script src="${ctxPath}/js/vue/vue.js"></script> +<script src="${ctxPath}/js/elementui/index.js"></script> +<link rel="stylesheet" href="${ctxPath}/js/elementui/index.css"> +<script> + laydate.render({ + elem: '#startTime' + }); + laydate.render({ + elem: '#endTime' + }); + laydate.render({ + elem: '#registrationClosingTime' + }); + + + + var vue2 = new Vue({ + el: '#app1', + props: { + // 数量限制 + limit: { + type: Number, + default: 2 + }, + }, + data: { + autoUpload: true,//自动上传 + imageUrl1: '',//模型数据,用于上传图片完成后图片预览 + dialogVisible: false + }, + methods: { + handleAvatarSuccess(res, file) { + WorldCupInfo.goodsPicArray1.push({ + 'name': file.name, + 'uuid': file.uuid, + 'url': file.response + }); + }, + beforeAvatarUpload(file) { + const isLt2M = file.size / 1024 / 1024 < 10; + if (!isLt2M) { + this.$message.error('上传图片大小不能超过 10MB!'); + } + return isLt2M; + }, + handleRemove(file, fileList) { + WorldCupInfo.goodsPicArray1 = WorldCupInfo.goodsPicArray1.filter(item => { + return item.uid != file.uid; + }); + }, + }, + created() { + }, + }); +</script> +@} diff --git a/cloud-server-management/src/main/webapp/WEB-INF/view/system/worldCup/worldCup_edit.html b/cloud-server-management/src/main/webapp/WEB-INF/view/system/worldCup/worldCup_edit.html new file mode 100644 index 0000000..ff95132 --- /dev/null +++ b/cloud-server-management/src/main/webapp/WEB-INF/view/system/worldCup/worldCup_edit.html @@ -0,0 +1,299 @@ +@layout("/common/_container.html"){ +<style type="text/css"> + #stores{ + width: 100%; + } + #stores td, #stores th{ + border: 1px solid #eee; + text-align: center; + height: 40px; + line-height: 40px; + } + #stores td select, #stores td div, #stores td div input, #stores td input{ + height: 100%; + width: 95%; + border: none; + text-indent: 10px; + } +</style> +<div class="ibox float-e-margins"> + <div class="ibox-content"> + <div class="form-horizontal" id="userInfoForm"> + <input type="hidden" id="id" value="${item.id}"> + <input type="hidden" id="storeInfo", value='${stores}'> + <div class="row"> + <div class="form-group"> + <label class="col-sm-3 control-label">*比赛名称:</label> + <div class="col-sm-3"> + <input class="form-control" id="name" value="${item.name}"> + </div> + </div> + <div class="form-group"> + <label class="col-sm-3 control-label">*开始时间:</label> + <div class="col-sm-3"> + <input class="form-control" id="startTime" value="${startTime}"> + </div> + </div> + <div class="form-group"> + <label class="col-sm-3 control-label">*结束时间:</label> + <div class="col-sm-3"> + <input class="form-control" id="endTime" value="${endTime}"> + </div> + </div> + <div class="form-group"> + <label class="col-sm-3 control-label">报名截止时间:</label> + <div class="col-sm-3"> + <input class="form-control" id="registrationClosingTime" value="${registrationClosingTime}"> + </div> + </div> + <div class="form-group"> + <label class="col-sm-3 control-label">*报名年龄:</label> + <div class="col-sm-1"> + <input class="form-control" id="startAge" type="number" min="0" value="${item.startAge}"> + </div> + <label style="float: left;line-height: 35px;">岁至:</label> + <div class="col-sm-1"> + <input class="form-control" id="endAge" type="number" min="0" value="${item.endAge}"> + </div> + <label style="float: left;line-height: 35px;">岁</label> + </div> + <div class="form-group"> + <label class="col-sm-3 control-label">*报名性别</label> + <div class="col-sm-3"> + <select class="form-control" id="gender"> + <option value="0" ${0 == item.gender ? 'selected' : ''}>全部</option> + <option value="1" ${1 == item.gender ? 'selected' : ''}>男</option> + <option value="2" ${2 == item.gender ? 'selected' : ''}>女</option> + </select> + </div> + </div> + <div class="form-group"> + <label class="col-sm-3 control-label">*支付方式:</label> + <div class="col-sm-9" id="payType"> + <input type="checkbox" item="free" value="0" ${null != item.cash || null != item.paiCoin || null != item.classHour ? '' : 'checked'}>免费 + <input type="checkbox" item="cash" value="1" ${null == item.cash ? '' : 'checked'}>现金支付 + <input type="checkbox" item="paiCoin" value="2" ${null == item.paiCoin ? '' : 'checked'}>玩湃币支付 + <input type="checkbox" item="classHour" value="3" ${null == item.classHour ? '' : 'checked'}>课时支付 + </div> + </div> + <div class="form-group cash" ${null == item.cash ? 'hidden' : ''}> + <label class="col-sm-3 control-label">*现金支付:</label> + <div class="col-sm-3"> + <input class="form-control" id="cash" type="number" min="0" value="${item.cash}"> + </div> + </div> + <div class="form-group paiCoin" ${null == item.paiCoin ? 'hidden' : ''}> + <label class="col-sm-3 control-label">*玩湃币支付:</label> + <div class="col-sm-3"> + <input class="form-control" id="paiCoin" type="number" min="0" value="${item.paiCoin}"> + </div> + </div> + <div class="form-group classHour" ${null == item.classHour ? 'hidden' : ''}> + <label class="col-sm-3 control-label">*课时支付:</label> + <div class="col-sm-3"> + <input class="form-control" id="classHour" type="number" min="0" value="${item.classHour}"> + </div> + </div> + <div class="form-group"> + <label class="col-sm-3 control-label">*报名人数:</label> + <div class="col-sm-3"> + <input class="form-control" id="maxPeople" type="number" min="0" value="${item.maxPeople}"> + </div> + </div> + <div class="form-group"> + <label class="col-sm-3 control-label">*基础报名人数:</label> + <div class="col-sm-3"> + <input class="form-control" id="basePeople" type="number" min="0" value="${item.basePeople}"> + </div> + </div> + <div class="form-group"> + <label class="col-sm-3 control-label">*参赛可获积分:</label> + <div class="col-sm-3"> + <input class="form-control" id="participationIntegral" type="number" min="0" value="${item.participationIntegral}"> + </div> + <label style="float: left;line-height: 35px;">胜场可获积分</label> + <div class="col-sm-3"> + <input class="form-control" id="winIntegral" type="number" min="0" value="${item.winIntegral}"> + </div> + </div> + <div class="form-group"> + <label class="col-sm-3 control-label">*比赛地点:</label> + <div class="col-sm-7"> + <input class="form-control" id="address" onchange="WorldCupInfo.searchByStationName(this,1)" value="${item.address}"> + </div> + </div> + <div class="form-group"> + <label class="col-sm-3 control-label">*坐标选择:</label> + <div class="col-sm-7"> + <div id="container" style="height: 500px;" ></div> + </div> + <input type="hidden" id="longitude" value="${item.lon}"/> + <input type="hidden" id="latitude" value="${item.lat}"/> + </div> + <div class="form-group"> + <label class="col-sm-3 control-label">参与赛点:</label> + <div class="col-sm-7"> + <button onclick="WorldCupInfo.openStore()">选择门店</button> + </div> + </div> + <div class="form-group"> + <label class="col-sm-3 control-label"></label> + <div class="col-sm-7"> + <table id="stores"> + <thead> + <tr> + <th>所在省市</th><th>所属运营商</th><th>门店名称</th><th>操作</th> + </tr> + </thead> + <tbody> + + </tbody> + </table> + </div> + </div> + <div class="form-group"> + <label class="col-sm-3 control-label">赛事简介</label> + <div class="col-sm-7"> + <textarea class="form-control" id="intro" style="height:200px">${item.intro}</textarea> + </div> + </div> + <div class="form-group"> + <label class="col-sm-3 control-label head-scu-label">比赛封面图</label> + <div class="col-sm-2"> + <div id="coverImgPreId"> + <div><img width="100px" height="100px" src="${item.coverImg}"></div> + </div> + </div> + <div class="col-sm-1"> + <div class="head-scu-btn upload-btn" id="coverImgBtnId"> + <i class="fa fa-upload"></i> 文件上传 + </div> + </div> + <input type="hidden" id="coverImg" value="${item.coverImg}"/> + <label class="col-sm-1 control-label">首页默认背景图</label> + <div class="col-sm-2"> + <div id="homeBackdropImgPreId"> + <div><img width="100px" height="100px" src="${item.homeBackdropImg}"></div> + </div> + </div> + <div class="col-sm-1"> + <div class="head-scu-btn upload-btn" id="homeBackdropImgBtnId"> + <i class="fa fa-upload"></i> 文件上传 + </div> + </div> + <input type="hidden" id="homeBackdropImg" value="${item.homeBackdropImg}"/> + </div> + <div class="row" id="app1"> + <div class="form-group"> + <label class="col-sm-3 control-label head-scu-label">*比赛图片(请上传不超过五张图片): </label> + <div class="col-sm-7"> + <el-upload + :limit="5" + class="avatar-uploader" + action="/tCouponManage/uploadPic" + list-type="picture-card" + accept="." + :file-list="imageUrl2" + :on-success="handleAvatarSuccess" + :on-remove="handleRemove"> + <i class="el-icon-plus"></i> + </el-upload> + <el-dialog :visible.sync="dialogVisible"> + <img width="100%" :src="imageUrl1" alt=""> + </el-dialog> + </div> + </div> + </div> + <div class="form-group"> + <label class="col-sm-3 control-label">比赛详情</label> + <div class="col-sm-7" style="padding: 0px;"> + <textarea id="content" style="height: 800px;width: 100%;">${item.content}</textarea> + </div> + </div> + </div> + </div> + <div class="row btn-group-m-t"> + <div class="col-sm-10"> + <#button btnCss="info" name="提交" id="ensure" icon="fa-check" clickFun="WorldCupInfo.editSubmit()"/> + <#button btnCss="danger" name="取消" id="cancel" icon="fa-eraser" clickFun="WorldCupInfo.close()"/> + </div> + </div> + </div> +</div> +<script src="${ctxPath}/modular/system/worldCup/worldCup_info.js"></script> +<script type="text/javascript" src="http://webapi.amap.com/maps?v=1.4.15&key=77b37f0753049c4e712ea79a24e0719c"></script> +<script src="${ctxPath}/js/vue/vue.js"></script> +<script src="${ctxPath}/js/elementui/index.js"></script> +<link rel="stylesheet" href="${ctxPath}/js/elementui/index.css"> +<script> + laydate.render({ + elem: '#startTime' + }); + laydate.render({ + elem: '#endTime' + }); + laydate.render({ + elem: '#registrationClosingTime' + }); + + + + let id = '${item.infoImg}' + let obj = [] + + var vue2 = new Vue({ + el: '#app1', + props: { + // 数量限制 + limit: { + type: Number, + default: 2 + }, + }, + data: { + autoUpload: true,//自动上传 + imageUrl1: '',//模型数据,用于上传图片完成后图片预览 + imageUrl2: JSON.parse(id), + dialogVisible: false + }, + methods: { + handleAvatarSuccess(res, file) { + WorldCupInfo.goodsPicArray1.push({ + 'name': file.name, + 'uuid': file.uuid, + 'url': file.response + }); + }, + changeImg(){ + var i = id.split(",") + for (let j = 0; j <i.length; j++) { + let obj={ + name:i[j], + uuid:i[j], + url:i[j], + } + this.imageUrl2.push(obj) + + } + }, + beforeAvatarUpload(file) { + const isLt2M = file.size / 1024 / 1024 < 10; + if (!isLt2M) { + this.$message.error('上传图片大小不能超过 10MB!'); + } + return isLt2M; + }, + handleRemove(file, fileList) { + WorldCupInfo.goodsPicArray1 = WorldCupInfo.goodsPicArray1.filter(item => { + return item.uid != file.uid; + }); + }, + }, + created() { + // this.changeImg() + WorldCupInfo.goodsPicArray1 = this.imageUrl2 + }, + }); + +</script> +@} diff --git a/cloud-server-management/src/main/webapp/WEB-INF/view/system/worldCup/worldCup_info.html b/cloud-server-management/src/main/webapp/WEB-INF/view/system/worldCup/worldCup_info.html new file mode 100644 index 0000000..5943704 --- /dev/null +++ b/cloud-server-management/src/main/webapp/WEB-INF/view/system/worldCup/worldCup_info.html @@ -0,0 +1,282 @@ +@layout("/common/_container.html"){ +<style type="text/css"> + #stores{ + width: 100%; + } + #stores td, #stores th{ + border: 1px solid #eee; + text-align: center; + height: 40px; + line-height: 40px; + } + #stores td select, #stores td div, #stores td div input, #stores td input{ + height: 100%; + width: 95%; + border: none; + text-indent: 10px; + } +</style> +<div class="ibox float-e-margins"> + <div class="ibox-content"> + <div class="form-horizontal" id="userInfoForm"> + <input type="hidden" id="id" value="${item.id}"> + <input type="hidden" id="storeInfo", value='${stores}'> + <div class="row"> + <div class="form-group"> + <label class="col-sm-3 control-label">*比赛名称:</label> + <div class="col-sm-3"> + <input class="form-control" id="name" value="${item.name}" disabled> + </div> + </div> + <div class="form-group"> + <label class="col-sm-3 control-label">*开始时间:</label> + <div class="col-sm-3"> + <input class="form-control" id="startTime" value="${startTime}" disabled> + </div> + </div> + <div class="form-group"> + <label class="col-sm-3 control-label">*结束时间:</label> + <div class="col-sm-3"> + <input class="form-control" id="endTime" value="${endTime}" disabled> + </div> + </div> + <div class="form-group"> + <label class="col-sm-3 control-label">报名截止时间:</label> + <div class="col-sm-3"> + <input class="form-control" id="registrationClosingTime" value="${registrationClosingTime}" disabled> + </div> + </div> + <div class="form-group"> + <label class="col-sm-3 control-label">*报名年龄:</label> + <div class="col-sm-1"> + <input class="form-control" id="startAge" type="number" min="0" value="${item.startAge}" disabled> + </div> + <label style="float: left;line-height: 35px;">岁至:</label> + <div class="col-sm-1"> + <input class="form-control" id="endAge" type="number" min="0" value="${item.endAge}" disabled> + </div> + <label style="float: left;line-height: 35px;">岁</label> + </div> + <div class="form-group"> + <label class="col-sm-3 control-label">*报名性别</label> + <div class="col-sm-3"> + <select class="form-control" id="gender" disabled> + <option value="0" ${0 == item.gender ? 'selected' : ''}>全部</option> + <option value="1" ${1 == item.gender ? 'selected' : ''}>男</option> + <option value="2" ${2 == item.gender ? 'selected' : ''}>女</option> + </select> + </div> + </div> + <div class="form-group"> + <label class="col-sm-3 control-label">*支付方式:</label> + <div class="col-sm-9" id="payType"> + <input type="checkbox" item="free" value="0" ${null != item.cash || null != item.paiCoin || null != item.classHour ? '' : 'checked'} disabled>免费 + <input type="checkbox" item="cash" value="1" ${null == item.cash ? '' : 'checked'} disabled>现金支付 + <input type="checkbox" item="paiCoin" value="2" ${null == item.paiCoin ? '' : 'checked'} disabled>玩湃币支付 + <input type="checkbox" item="classHour" value="3" ${null == item.classHour ? '' : 'checked'} disabled>课时支付 + </div> + </div> + <div class="form-group cash" ${null == item.cash ? 'hidden' : ''}> + <label class="col-sm-3 control-label">*现金支付:</label> + <div class="col-sm-3"> + <input class="form-control" id="cash" type="number" min="0" value="${item.cash}" disabled> + </div> + </div> + <div class="form-group paiCoin" ${null == item.paiCoin ? 'hidden' : ''}> + <label class="col-sm-3 control-label">*玩湃币支付:</label> + <div class="col-sm-3"> + <input class="form-control" id="paiCoin" type="number" min="0" value="${item.paiCoin}" disabled> + </div> + </div> + <div class="form-group classHour" ${null == item.classHour ? 'hidden' : ''}> + <label class="col-sm-3 control-label">*课时支付:</label> + <div class="col-sm-3"> + <input class="form-control" id="classHour" type="number" min="0" value="${item.classHour}" disabled> + </div> + </div> + <div class="form-group"> + <label class="col-sm-3 control-label">*报名人数:</label> + <div class="col-sm-3"> + <input class="form-control" id="maxPeople" type="number" min="0" value="${item.maxPeople}" disabled> + </div> + </div> + <div class="form-group"> + <label class="col-sm-3 control-label">*基础报名人数:</label> + <div class="col-sm-3"> + <input class="form-control" id="basePeople" type="number" min="0" value="${item.basePeople}" disabled> + </div> + </div> + <div class="form-group"> + <label class="col-sm-3 control-label">*参赛可获积分:</label> + <div class="col-sm-3"> + <input class="form-control" id="participationIntegral" type="number" min="0" value="${item.participationIntegral}" disabled> + </div> + <label style="float: left;line-height: 35px;">胜场可获积分</label> + <div class="col-sm-3"> + <input class="form-control" id="winIntegral" type="number" min="0" value="${item.winIntegral}" disabled> + </div> + </div> + <div class="form-group"> + <label class="col-sm-3 control-label">*比赛地点:</label> + <div class="col-sm-7"> + <input class="form-control" id="address" onchange="WorldCupInfo.searchByStationName(this,1)" value="${item.address}" disabled> + </div> + </div> + <div class="form-group"> + <label class="col-sm-3 control-label">*坐标选择:</label> + <div class="col-sm-7"> + <div id="container" style="height: 500px;" ></div> + </div> + <input type="hidden" id="longitude" value="${item.lon}"/> + <input type="hidden" id="latitude" value="${item.lat}"/> + </div> + <div class="form-group"> + <label class="col-sm-3 control-label">参与赛点:</label> + <div class="col-sm-7"> + <button onclick="WorldCupInfo.openStore()" disabled>选择门店</button> + </div> + </div> + <div class="form-group"> + <label class="col-sm-3 control-label"></label> + <div class="col-sm-7"> + <table id="stores"> + <thead> + <tr> + <th>所在省市</th><th>所属运营商</th><th>门店名称</th><th>操作</th> + </tr> + </thead> + <tbody> + + </tbody> + </table> + </div> + </div> + <div class="form-group"> + <label class="col-sm-3 control-label">赛事简介</label> + <div class="col-sm-7"> + <textarea class="form-control" id="intro" style="height:200px">${item.intro}</textarea> + </div> + </div> + <div class="form-group"> + <label class="col-sm-3 control-label head-scu-label">比赛封面图</label> + <div class="col-sm-2"> + <div id="coverImgPreId"> + <div><img width="100px" height="100px" src="${item.coverImg}"></div> + </div> + </div> + <input type="hidden" id="coverImg" value="${item.coverImg}"/> + <label class="col-sm-1 control-label">首页默认背景图</label> + <div class="col-sm-2"> + <div id="homeBackdropImgPreId"> + <div><img width="100px" height="100px" src="${item.homeBackdropImg}"></div> + </div> + </div> + <input type="hidden" id="homeBackdropImg" value="${item.homeBackdropImg}"/> + </div> + <div class="row" id="app1"> + <div class="form-group"> + <label class="col-sm-3 control-label head-scu-label">*比赛图片(请上传不超过五张图片): </label> + <div class="col-sm-7"> + <el-upload + :limit="5" + class="avatar-uploader" + action="" + list-type="picture-card" + accept="." + :file-list="imageUrl2" + :on-remove="handleRemove"> + <i class="el-icon-plus"></i> + </el-upload> + <el-dialog :visible.sync="dialogVisible"> + <img width="100%" :src="imageUrl1" alt=""> + </el-dialog> + </div> + </div> + </div> + <div class="form-group"> + <label class="col-sm-3 control-label">比赛详情</label> + <div class="col-sm-7" style="padding: 0px;"> + <textarea id="content" style="height: 800px;width: 100%;">${item.content}</textarea> + </div> + </div> + </div> + </div> + </div> +</div> +<script src="${ctxPath}/modular/system/worldCup/worldCup_info.js"></script> +<script type="text/javascript" src="http://webapi.amap.com/maps?v=1.4.15&key=77b37f0753049c4e712ea79a24e0719c"></script> +<script src="${ctxPath}/js/vue/vue.js"></script> +<script src="${ctxPath}/js/elementui/index.js"></script> +<link rel="stylesheet" href="${ctxPath}/js/elementui/index.css"> +<script> + laydate.render({ + elem: '#startTime' + }); + laydate.render({ + elem: '#endTime' + }); + laydate.render({ + elem: '#registrationClosingTime' + }); + + + + let id = '${item.infoImg}' + let obj = [] + + var vue2 = new Vue({ + el: '#app1', + props: { + // 数量限制 + limit: { + type: Number, + default: 2 + }, + }, + data: { + autoUpload: true,//自动上传 + imageUrl1: '',//模型数据,用于上传图片完成后图片预览 + imageUrl2: JSON.parse(id), + dialogVisible: false + }, + methods: { + handleAvatarSuccess(res, file) { + WorldCupInfo.goodsPicArray1.push({ + 'name': file.name, + 'uuid': file.uuid, + 'url': file.response + }); + }, + changeImg(){ + var i = id.split(",") + for (let j = 0; j <i.length; j++) { + let obj={ + name:i[j], + uuid:i[j], + url:i[j], + } + this.imageUrl2.push(obj) + + } + }, + beforeAvatarUpload(file) { + const isLt2M = file.size / 1024 / 1024 < 10; + if (!isLt2M) { + this.$message.error('上传图片大小不能超过 10MB!'); + } + return isLt2M; + }, + handleRemove(file, fileList) { + WorldCupInfo.goodsPicArray1 = WorldCupInfo.goodsPicArray1.filter(item => { + return item.uid != file.uid; + }); + }, + }, + created() { + // this.changeImg() + WorldCupInfo.goodsPicArray1 = this.imageUrl2 + }, + }); + +</script> +@} diff --git a/cloud-server-management/src/main/webapp/static/modular/system/referee/referee.js b/cloud-server-management/src/main/webapp/static/modular/system/referee/referee.js index 26de31b..4694b30 100644 --- a/cloud-server-management/src/main/webapp/static/modular/system/referee/referee.js +++ b/cloud-server-management/src/main/webapp/static/modular/system/referee/referee.js @@ -109,10 +109,10 @@ if(res.code == 200){ Feng.success("添加成功"); layer.closeAll(); + Referee.table.refresh(); }else{ Feng.error(res.msg); } - MgrUser.table.refresh(); }, function (data) { Feng.error("添加失败!" + data.responseJSON.message + "!"); }); @@ -202,12 +202,12 @@ } var ajax = new $ax(Feng.ctxPath + "/referee/editReferee", function (res) { if (res.code == 200) { - Feng.success("添加成功"); + Feng.success("编辑成功"); layer.closeAll(); + Referee.table.refresh(); } else { Feng.error(res.msg); } - MgrUser.table.refresh(); }, function (data) { Feng.error("添加失败!" + data.responseJSON.message + "!"); }); @@ -265,29 +265,24 @@ Referee.delReferee = function (){ if(this.check()){ var operation = function(){ - var userId = MgrUser.seItem.id; - var ajax = new $ax(Feng.ctxPath + "/mgr/delete", function () { - if(language==1){ - Feng.success("删除成功!"); - }else if(language==2){ - Feng.success("Delete succeeded!"); - }else { - Feng.success("Hapus berhasil!"); + var ajax = new $ax(Feng.ctxPath + "/referee/updateState", function (res) { + if (res.code == 200) { + Feng.success("删除成功"); + layer.closeAll(); + Referee.table.refresh(); + } else { + Feng.error(res.msg); } - MgrUser.table.refresh(); }, function (data) { - if(language==1){ - Feng.error("删除失败!" + data.responseJSON.message + "!"); - }else if(language==2){ - Feng.error("Delete failed!" + data.responseJSON.message + "!"); - }else { - Feng.error("Hapus gagal!" + data.responseJSON.message + "!"); - } + Feng.error("添加失败!" + data.responseJSON.message + "!"); }); - ajax.set("userId", userId); + ajax.setData({ + 'id': Referee.seItem.id, + 'state': 3 + }); ajax.start(); }; - Feng.confirm("是否删除员工: " + MgrUser.seItem.name + "?",operation); + Feng.confirm("是否删除裁判:" + Referee.seItem.name + "?",operation); } } @@ -297,33 +292,26 @@ * 上架 */ Referee.onShelf = function () { - if (this.check()){ - var selected = $('#' + this.id).bootstrapTable('getSelections'); - const data1 = { - ids:[], - state:null + if(this.check()){ + var operation = function(){ + var ajax = new $ax(Feng.ctxPath + "/referee/updateState", function (res) { + if (res.code == 200) { + Feng.success("删除成功"); + layer.closeAll(); + Referee.table.refresh(); + } else { + Feng.error(res.msg); + } + }, function (data) { + Feng.error("添加失败!" + data.responseJSON.message + "!"); + }); + ajax.setData({ + 'id': Referee.seItem.id, + 'state': 1 + }); + ajax.start(); }; - selected.forEach(function(obj) { - console.log("查看选中") - console.log(obj) - var id = obj.id; - data1.ids.push(id); - }); - data1.state = 1; - - $.ajax({ - url: Feng.ctxPath + "/referee/changeState", - type: "POST", - contentType: "application/json", // 设置请求头的 Content-Type - data: JSON.stringify(data1), // 将数据转换为 JSON 字符串 - success: function(response) { - Feng.success("解冻成功!"); - Referee.search(); - }, - error: function(xhr, status, error) { - var errorMessage = xhr.responseText ? xhr.responseText : "解冻失败!"; - } - }); + Feng.confirm("是否解冻裁判:" + Referee.seItem.name + "?",operation); } }; @@ -331,30 +319,26 @@ * 下架 */ Referee.offShelf = function () { - if (this.check()){ - var selected = $('#' + this.id).bootstrapTable('getSelections'); - const data1 = { - ids:[], - state:null + if(this.check()){ + var operation = function(){ + var ajax = new $ax(Feng.ctxPath + "/referee/updateState", function (res) { + if (res.code == 200) { + Feng.success("删除成功"); + layer.closeAll(); + Referee.table.refresh(); + } else { + Feng.error(res.msg); + } + }, function (data) { + Feng.error("添加失败!" + data.responseJSON.message + "!"); + }); + ajax.setData({ + 'id': Referee.seItem.id, + 'state': 2 + }); + ajax.start(); }; - selected.forEach(function(obj) { - var id = obj.id; - data1.ids.push(id); - }); - data1.state = 2; - $.ajax({ - url: Feng.ctxPath + "/referee/changeState", - type: "POST", - contentType: "application/json", // 设置请求头的 Content-Type - data: JSON.stringify(data1), // 将数据转换为 JSON 字符串 - success: function(response) { - Feng.success("冻结成功!"); - Referee.search(); - }, - error: function(xhr, status, error) { - var errorMessage = xhr.responseText ? xhr.responseText : "冻结失败!"; - } - }); + Feng.confirm("是否冻结裁判:" + Referee.seItem.name + "?",operation); } }; @@ -412,4 +396,6 @@ var table = new BSTable(Referee.id, "/referee/listAll", defaultColunms); table.setPaginationType("server"); Referee.table = table.init(); + + Referee.region('provinceCode', null); }); diff --git a/cloud-server-management/src/main/webapp/static/modular/system/worldCup/store.js b/cloud-server-management/src/main/webapp/static/modular/system/worldCup/store.js new file mode 100644 index 0000000..372ed72 --- /dev/null +++ b/cloud-server-management/src/main/webapp/static/modular/system/worldCup/store.js @@ -0,0 +1,120 @@ +/** + * 跨城站点管理管理初始化 + */ +var Store = { + id: "StoreTable", //表格id + seItem: null, //选中的条目 + table: null, + layerIndex: -1 +}; +/** + * 初始化表格的列 + */ +Store.initColumn = function () { + return [ + {field: 'selectItem', checkbox: true}, + {title: 'id', field: 'id', visible: false, align: 'center', valign: 'middle'}, + {title: '所在省市', field: 'province', visible: true, align: 'center', valign: 'middle',width:'20%',}, + {title: '所属运营商', field: 'operator', visible: true, align: 'center', valign: 'middle',}, + {title: '门店名称', field: 'name', visible: true, align: 'center', valign: 'middle'}, + {title: '闸机ID', field: 'gate', visible: true, align: 'center', valign: 'middle'}, + ]; +}; + +/** + * 检查是否选中 + */ +Store.check = function () { + var selected = $('#' + this.id).bootstrapTable('getSelections'); + if(selected.length == 0){ + Feng.info("请先选中表格中的某一记录!"); + return false; + }else{ + Store.seItem = selected[0]; + return true; + } +}; + + + + +Store.region = function (node, e){ + let pcode = null; + if(null != e){ + pcode = $(e).val(); + } + var ajax = new $ax(Feng.ctxPath + "/region/getRegion", function (res) { + let html = '<option value="">请选择</option>'; + for (let i = 0; i < res.length; i++) { + html += '<option value="' + res[i].code + '">' + res[i].name + '</option>'; + } + $('#' + node).html(html) + }, function (data) { + Feng.error("添加失败!" + data.responseJSON.message + "!"); + }); + ajax.setData({ + 'pcode': pcode + }); + ajax.start(); +} + + + + +/** + * 关闭此对话框 + */ +Store.close = function() { + parent.layer.close(window.parent.WorldCupInfo.layerIndex); +}; + +Store.addSubmit = function (){ + var selected = $('#' + this.id).bootstrapTable('getSelections'); + if(selected.length == 0){ + Feng.info("请先选中表格中的某一记录!"); + return false; + }else{ + window.parent.WorldCupInfo.stores = selected; + window.parent.WorldCupInfo.initStore(); + Store.close(); + } +} + + + +Store.search = function () { + var queryData = {}; + queryData['userName'] = $("#name").val(); + queryData['operator'] =$("#operator").val(); + queryData['provinceCode'] =$("#provinceCode").val(); + queryData['cityCode'] =$("#cityCode").val(); + Store.table.refresh({query: queryData}); +}; + +Store.resetSearch = function () { + $("#name").val(""); + $("#operator").val(""); + $("#provinceCode").val(""); + $("#cityCode").val(""); + Store.search(); +}; + +$(function () { + var defaultColunms = Store.initColumn(); + var table = new BSTable(Store.id, "/store/listAll", defaultColunms); + table.setPaginationType("server"); + Store.table = table.init(); + + Store.region('provinceCode', null); + + var ajax = new $ax(Feng.ctxPath + "/operator/getOperatorListAll", function (res) { + let html = '<option value="">请选择</option>'; + for (let i = 0; i < res.length; i++) { + html += '<option value="' + res[i].id + '">' + res[i].name + '</option>'; + } + $('#operator').html(html) + }, function (data) { + Feng.error("添加失败!" + data.responseJSON.message + "!"); + }); + ajax.start(); +}); diff --git a/cloud-server-management/src/main/webapp/static/modular/system/worldCup/worldCup.js b/cloud-server-management/src/main/webapp/static/modular/system/worldCup/worldCup.js new file mode 100644 index 0000000..7c71ebd --- /dev/null +++ b/cloud-server-management/src/main/webapp/static/modular/system/worldCup/worldCup.js @@ -0,0 +1,186 @@ +/** + * 跨城站点管理管理初始化 + */ +var WorldCup = { + id: "WorldCupTable", //表格id + seItem: null, //选中的条目 + table: null, + layerIndex: -1, +}; +/** + * 初始化表格的列 + */ +WorldCup.initColumn = function () { + return [ + {field: 'selectItem', checkbox: true}, + {title: 'id', field: 'id', visible: false, align: 'center', valign: 'middle'}, + {title: '比赛名字', field: 'name', visible: true, align: 'center', valign: 'middle',width:'20%',}, + {title: '开始时间', field: 'startTime', visible: true, align: 'center', valign: 'middle',}, + {title: '结束时间', field: 'endTime', visible: true, align: 'center', valign: 'middle'}, + {title: '报名条件', field: 'age', visible: true, align: 'center', valign: 'middle', + formatter:function (data, item) { + return item.age + "," + {0:"全部",1:"男",2:"女"}[item.gender] + } + }, + {title: '最大报名人数-已报名人数', field: 'maxPeople', visible: true, align: 'center', valign: 'middle'}, + {title: '状态', field: 'status', visible: true, align: 'center', valign: 'middle', + formatter:function (data) { + return {1:"未开始",2:"已开始",3:"已结束", 4:"已取消"}[data] + } + }, + ]; +}; + +/** + * 检查是否选中 + */ +WorldCup.check = function () { + var selected = $('#' + this.id).bootstrapTable('getSelections'); + if(selected.length == 0){ + Feng.info("请先选中表格中的某一记录!"); + return false; + }else{ + WorldCup.seItem = selected[0]; + return true; + } +}; +/** + * 商户号认证 + */ +WorldCup.openAddWorldCup = function () { + var index = layer.open({ + type: 2, + title: '添加比赛', + area: ['100%', '100%'], //宽高 + fix: false, //不固定 + maxmin: true, + content: Feng.ctxPath + '/worldCup/openAddWorldCup' + }); + this.layerIndex = index; +}; +/** + * 编辑 + */ +WorldCup.openEditWorldCup = function () { + if(this.check()){ + var index = layer.open({ + type: 2, + title: '编辑比赛', + area: ['100%', '100%'], //宽高 + fix: false, //不固定 + maxmin: true, + content: Feng.ctxPath + '/worldCup/openEditWorldCup?id=' + WorldCup.seItem.id + }); + this.layerIndex = index; + } +}; + + +WorldCup.openWorldCupInfo = function () { + if(this.check()){ + var index = layer.open({ + type: 2, + title: '比赛详情', + area: ['100%', '100%'], //宽高 + fix: false, //不固定 + maxmin: true, + content: Feng.ctxPath + '/worldCup/openInfoWorldCup?id=' + WorldCup.seItem.id + }); + this.layerIndex = index; + } +}; + + +/** + * 删除 + */ +WorldCup.cancelWorldCup = function (){ + if(this.check()){ + var operation = function(){ + var ajax = new $ax(Feng.ctxPath + "/worldCup/updateState", function (res) { + if (res.code == 200) { + Feng.success("删除成功"); + layer.closeAll(); + WorldCup.table.refresh(); + } else { + Feng.error(res.msg); + } + }, function (data) { + Feng.error("添加失败!" + data.responseJSON.message + "!"); + }); + ajax.setData({ + 'id': WorldCup.seItem.id, + 'state': 4 + }); + ajax.start(); + }; + Feng.confirm("确认取消所选比赛吗?",operation); + } +} + + + + +/** + * 下架 + */ +WorldCup.registeredPersonnel = function () { + if(this.check()){ + var operation = function(){ + var ajax = new $ax(Feng.ctxPath + "/worldCup/updateState", function (res) { + if (res.code == 200) { + Feng.success("删除成功"); + layer.closeAll(); + WorldCup.table.refresh(); + } else { + Feng.error(res.msg); + } + }, function (data) { + Feng.error("添加失败!" + data.responseJSON.message + "!"); + }); + ajax.setData({ + 'id': WorldCup.seItem.id, + 'state': 2 + }); + ajax.start(); + }; + Feng.confirm("是否冻结裁判:" + WorldCup.seItem.name + "?",operation); + } +}; + + + + + + +/** + * 关闭此对话框 + */ +WorldCup.close = function() { + parent.layer.close(window.parent.WorldCup.layerIndex); +}; + +WorldCup.search = function () { + var queryData = {}; + queryData['name'] = $("#name").val(); + queryData['startTime'] =$("#startTime").val(); + queryData['endTime'] =$("#endTime").val(); + queryData['status'] =$("#status").val(); + WorldCup.table.refresh({query: queryData}); +}; + +WorldCup.resetSearch = function () { + $("#name").val(""); + $("#startTime").val(""); + $("#endTime").val(""); + $("#status").val(""); + WorldCup.search(); +}; + +$(function () { + var defaultColunms = WorldCup.initColumn(); + var table = new BSTable(WorldCup.id, "/worldCup/listAll", defaultColunms); + table.setPaginationType("server"); + WorldCup.table = table.init(); + +}); diff --git a/cloud-server-management/src/main/webapp/static/modular/system/worldCup/worldCup_info.js b/cloud-server-management/src/main/webapp/static/modular/system/worldCup/worldCup_info.js new file mode 100644 index 0000000..ae905e3 --- /dev/null +++ b/cloud-server-management/src/main/webapp/static/modular/system/worldCup/worldCup_info.js @@ -0,0 +1,571 @@ +/** + * 用户详情对话框(可用于添加和修改对话框) + */ +var WorldCupInfo = { + userInfoData: {}, + stores:[], + goodsPicArray1: [] +}; + + + +/** + * 关闭此对话框 + */ +WorldCupInfo.close = function () { + parent.layer.close(window.parent.WorldCup.layerIndex); +}; + + + + +/** + * 提交添加用户 + */ +WorldCupInfo.addSubmit = function () { + let name = $('#name').val(); + let startTime = $('#startTime').val(); + let endTime = $('#endTime').val(); + let registrationClosingTime = $('#registrationClosingTime').val(); + let startAge = $('#startAge').val(); + let endAge = $('#endAge').val(); + let gender = $('#gender').val(); + let payType = []; + let cash = $('#cash').val(); + let paiCoin = $('#paiCoin').val(); + let classHour = $('#classHour').val(); + + let maxPeople = $('#maxPeople').val(); + let basePeople = $('#basePeople').val(); + let participationIntegral = $('#participationIntegral').val(); + let winIntegral = $('#winIntegral').val(); + let address = $('#address').val(); + let longitude = $('#longitude').val(); + let latitude = $('#latitude').val(); + let intro = $('#intro').val(); + let coverImg = $('#coverImg').val(); + let homeBackdropImg = $('#homeBackdropImg').val(); + let content = editor.getContent(); + if(null == name || '' == name){ + Feng.error("请填写有效的比赛名称"); + return + } + if(null == startTime || '' == startTime){ + Feng.error("请选择有效的开始时间"); + return + } + if(null == endTime || '' == endTime){ + Feng.error("请选择有效的结束时间"); + return + } + if(null == startAge || '' == startAge){ + Feng.error("请填写有效的报名开始年龄"); + return + } + if(null == endAge || '' == endAge){ + Feng.error("请填写有效的报名结束年龄"); + return + } + if(parseInt(startAge) > parseInt(endAge)){ + Feng.error("报名开始年龄不能大于结束年龄"); + return + } + $('#payType input[type="checkbox"]').each(function (i, e){ + if($(e).is(":checked")){ + payType.push($(e).val()); + if($(e).val() == 1 && null == cash){ + Feng.error("请输入有效的现金支付金额"); + return + } + if($(e).val() == 2 && null == paiCoin){ + Feng.error("请输入有效的玩湃币支付数量"); + return + } + if($(e).val() == 3 && null == classHour){ + Feng.error("请输入有效的课时支付数量"); + return + } + } + }) + if(null == maxPeople || '' == maxPeople){ + Feng.error("请填写有效的报名人数"); + return + } + if(null == basePeople || '' == basePeople){ + Feng.error("请填写有效的基础报名人数"); + return + } + if(null == participationIntegral || '' == participationIntegral){ + Feng.error("请填写有效的参赛可获积分"); + return + } + if(null == winIntegral || '' == winIntegral){ + Feng.error("请填写有效的胜场可获积分"); + return + } + if(null == address || '' == address){ + Feng.error("请填写有效的比赛地点"); + return + } + if(null == longitude || '' == longitude){ + Feng.error("无效的坐标,请重新输入地址"); + return + } + if(null == latitude || '' == latitude){ + Feng.error("无效的坐标,请重新输入地址"); + return + } + if(WorldCupInfo.stores.length == 0){ + Feng.error("请选择参赛门店"); + return + } + if(null == intro || '' == intro){ + Feng.error("请填写有效的赛事简介"); + return + } + if(null == coverImg || '' == coverImg){ + Feng.error("请上传有效的比赛封面图"); + return + } + if(null == homeBackdropImg || '' == homeBackdropImg){ + Feng.error("请上传有效的首页默认背景图"); + return + } + if(WorldCupInfo.goodsPicArray1 == 0){ + Feng.error("请上传有效的比赛图片"); + return + } + if(null == content || '' == content){ + Feng.error("请填写有效的比赛详情"); + return + } + let data = { + 'name': name, + 'startTime': new Date(startTime + " 00:00:00"), + 'endTime': new Date(endTime + " 23:59:59"), + 'registrationClosingTime': (null != registrationClosingTime && '' != registrationClosingTime ? new Date(registrationClosingTime + " 23:59:59") : registrationClosingTime), + 'startAge': startAge, + 'endAge': endAge, + 'gender': gender, + 'payType': payType.toString(), + 'cash': cash, + 'paiCoin': paiCoin, + 'classHour': classHour, + 'maxPeople': maxPeople, + 'basePeople': basePeople, + 'participationIntegral' : participationIntegral, + 'winIntegral' : winIntegral, + 'address': address, + 'lon': longitude, + 'lat': latitude, + 'coverImg': coverImg, + 'homeBackdropImg': homeBackdropImg, + 'infoImg': JSON.stringify(WorldCupInfo.goodsPicArray1), + 'intro': intro, + 'content': content, + 'stores': JSON.stringify(WorldCupInfo.stores) + } + + //提交信息 + var ajax = new $ax(Feng.ctxPath + "/worldCup/addWorldCup", function (res) { + if (res.code==200){ + Feng.success("添加成功!"); + WorldCupInfo.close(); + window.parent.WorldCup.refresh(); + }else{ + Feng.error(res.msg); + } + }, function (data) { + Feng.error("添加失败!" + data.responseJSON.message + "!"); + }); + ajax.set(data); + ajax.start(); +}; + +/** + * 提交修改 + */ +WorldCupInfo.editSubmit = function () { + let name = $('#name').val(); + let startTime = $('#startTime').val(); + let endTime = $('#endTime').val(); + let registrationClosingTime = $('#registrationClosingTime').val(); + let startAge = $('#startAge').val(); + let endAge = $('#endAge').val(); + let gender = $('#gender').val(); + let payType = []; + let cash = $('#cash').val(); + let paiCoin = $('#paiCoin').val(); + let classHour = $('#classHour').val(); + + let maxPeople = $('#maxPeople').val(); + let basePeople = $('#basePeople').val(); + let participationIntegral = $('#participationIntegral').val(); + let winIntegral = $('#winIntegral').val(); + let address = $('#address').val(); + let longitude = $('#longitude').val(); + let latitude = $('#latitude').val(); + let intro = $('#intro').val(); + let coverImg = $('#coverImg').val(); + let homeBackdropImg = $('#homeBackdropImg').val(); + let content = editor.getContent(); + if(null == name || '' == name){ + Feng.error("请填写有效的比赛名称"); + return + } + if(null == startTime || '' == startTime){ + Feng.error("请选择有效的开始时间"); + return + } + if(null == endTime || '' == endTime){ + Feng.error("请选择有效的结束时间"); + return + } + if(null == startAge || '' == startAge){ + Feng.error("请填写有效的报名开始年龄"); + return + } + if(null == endAge || '' == endAge){ + Feng.error("请填写有效的报名结束年龄"); + return + } + if(parseInt(startAge) > parseInt(endAge)){ + Feng.error("报名开始年龄不能大于结束年龄"); + return + } + $('#payType input[type="checkbox"]').each(function (i, e){ + if($(e).is(":checked")){ + payType.push($(e).val()); + if($(e).val() == 1 && null == cash){ + Feng.error("请输入有效的现金支付金额"); + return + } + if($(e).val() == 2 && null == paiCoin){ + Feng.error("请输入有效的玩湃币支付数量"); + return + } + if($(e).val() == 3 && null == classHour){ + Feng.error("请输入有效的课时支付数量"); + return + } + } + }) + if(null == maxPeople || '' == maxPeople){ + Feng.error("请填写有效的报名人数"); + return + } + if(null == basePeople || '' == basePeople){ + Feng.error("请填写有效的基础报名人数"); + return + } + if(null == participationIntegral || '' == participationIntegral){ + Feng.error("请填写有效的参赛可获积分"); + return + } + if(null == winIntegral || '' == winIntegral){ + Feng.error("请填写有效的胜场可获积分"); + return + } + if(null == address || '' == address){ + Feng.error("请填写有效的比赛地点"); + return + } + if(null == longitude || '' == longitude){ + Feng.error("无效的坐标,请重新输入地址"); + return + } + if(null == latitude || '' == latitude){ + Feng.error("无效的坐标,请重新输入地址"); + return + } + if(WorldCupInfo.stores.length == 0){ + Feng.error("请选择参赛门店"); + return + } + if(null == intro || '' == intro){ + Feng.error("请填写有效的赛事简介"); + return + } + if(null == coverImg || '' == coverImg){ + Feng.error("请上传有效的比赛封面图"); + return + } + if(null == homeBackdropImg || '' == homeBackdropImg){ + Feng.error("请上传有效的首页默认背景图"); + return + } + if(WorldCupInfo.goodsPicArray1 == 0){ + Feng.error("请上传有效的比赛图片"); + return + } + if(null == content || '' == content){ + Feng.error("请填写有效的比赛详情"); + return + } + let data = { + 'id': $('#id').val(), + 'name': name, + 'startTime': new Date(startTime + " 00:00:00"), + 'endTime': new Date(endTime + " 23:59:59"), + 'registrationClosingTime': (null != registrationClosingTime && '' != registrationClosingTime ? new Date(registrationClosingTime + " 23:59:59") : registrationClosingTime), + 'startAge': startAge, + 'endAge': endAge, + 'gender': gender, + 'payType': payType.toString(), + 'cash': cash, + 'paiCoin': paiCoin, + 'classHour': classHour, + 'maxPeople': maxPeople, + 'basePeople': basePeople, + 'participationIntegral' : participationIntegral, + 'winIntegral' : winIntegral, + 'address': address, + 'lon': longitude, + 'lat': latitude, + 'coverImg': coverImg, + 'homeBackdropImg': homeBackdropImg, + 'infoImg': JSON.stringify(WorldCupInfo.goodsPicArray1), + 'intro': intro, + 'content': content, + 'stores': JSON.stringify(WorldCupInfo.stores) + } + + //提交信息 + var ajax = new $ax(Feng.ctxPath + "/worldCup/editWorldCup", function (res) { + if (res.code==200){ + Feng.success("编辑成功!"); + WorldCupInfo.close(); + window.parent.WorldCup.refresh(); + }else{ + Feng.error(res.msg); + } + }, function (data) { + Feng.error("编辑失败!" + data.responseJSON.message + "!"); + }); + ajax.set(data); + ajax.start(); +}; + + + +$(function () { + Feng.initValidator("userInfoForm", WorldCupInfo.validateFields); + + // 初始化头像上传 + var coverImg = new $WebUpload("coverImg"); + coverImg.setUploadBarId("progressBar1"); + coverImg.init(); + + var homeBackdropImg = new $WebUpload("homeBackdropImg"); + homeBackdropImg.setUploadBarId("progressBar2"); + homeBackdropImg.init(); + + $('#payType input[type="checkbox"]').click(function (){ + let v = $(this).val(); + if($(this).is(":checked")){ + if(v == 0){ + $('.cash').hide(); + $('.classHour').hide(); + $('.paiCoin').hide(); + $('#payType input[item="cash"]').attr('checked', false); + $('#payType input[item="classHour"]').attr('checked', false); + $('#payType input[item="paiCoin"]').attr('checked', false); + $('#cash').val(''); + $('#classHour').val(''); + $('#paiCoin').val(''); + } + if(v == 1){ + $('#payType input[item="free"]').attr('checked', false); + $('.cash').show(); + } + if(v == 2){ + $('#payType input[item="free"]').attr('checked', false); + $('.paiCoin').show(); + } + if(v == 3){ + $('#payType input[item="free"]').attr('checked', false); + $('.classHour').show(); + } + }else{ + if(v == 0){ + $('.cash').hide(); + $('.classHour').hide(); + $('.paiCoin').hide(); + $('#payType input[item="cash"]').attr('checked', false); + $('#payType input[item="classHour"]').attr('checked', false); + $('#payType input[item="paiCoin"]').attr('checked', false); + $('#cash').val(''); + $('#classHour').val(''); + $('#paiCoin').val(''); + } + if(v == 1){ + $('.cash').hide(); + } + if(v == 2){ + $('.classHour').hide(); + } + if(v == 3){ + $('.paiCoin').hide(); + } + } + + }); + + if(null != $('#id').val()){ + WorldCupInfo.stores = JSON.parse($('#storeInfo').val()); + WorldCupInfo.initStore(); + let lng = $('#longitude').val(); + let lat = $('#latitude').val(); + // 地图实例 + map = new AMap.Map('container', { + resizeEnable: true, // 允许缩放 + center: [lng, lat], // 设置地图的中心点 + zoom: 15 // 设置地图的缩放级别,0 - 20 + }); + //地图画点 + addMarker(lng,lat); + } +}); + + +var map = new AMap.Map('container', { + resizeEnable: true, // 允许缩放 + zoom: 15 // 设置地图的缩放级别,0 - 20 +}); +var marker; +//搜索地图 +WorldCupInfo.searchByStationName = function(e,type){ + var keyword=""; + if(type==2){ + keyword = $(e).parent().prev().find("input").val(); + }else { + if($("#address").val()!=null && $("#address").val()!=''){ + keyword = $("#address").val(); + } + } + type=1; + AMap.plugin('AMap.Geocoder', function() { + var geocoder = new AMap.Geocoder(); + console.log(geocoder) + console.log(keyword) + geocoder.getLocation(keyword, function(status, result) { + console.log(status,result) + if (status === 'complete' && result.info === 'OK') { + // 经纬度 + var lng = result.geocodes[0].location.lng; + var lat = result.geocodes[0].location.lat; + $("#longitude").val(lng) + $("#latitude").val(lat) + // 地图实例 + map = new AMap.Map('container', { + resizeEnable: true, // 允许缩放 + center: [lng, lat], // 设置地图的中心点 + zoom: 15 // 设置地图的缩放级别,0 - 20 + }); + //地图画点 + //addMarker(lng,lat); + if(type==1 || type==2){ + showInfoClick(); + if(lng == null){ + }else{ + addMarker(lng,lat); + } + }else{ + + } + } else { + console.log('定位失败!'); + } + }); + }); + +} +//地图点击事件 +function showInfoClick(){ + map.on('click', function (e) { + addMarker(e.lnglat.getLng(),e.lnglat.getLat()); + }); +} +//删除点 +function removeMarkers(){ + if(marker!=null){ + map.remove(marker); + } + +} +// 实例化点标记 +function addMarker(lon,lat) { + removeMarkers(); + marker = new AMap.Marker({ + map: map, + position: new AMap.LngLat(lon, lat), // 经纬度 + }); + //加经纬度 + $("#lon").val(lon); + $("#lat").val(lat); + var lnglatXY = [lon, lat];//地图上所标点的坐标 + AMap.service('AMap.Geocoder',function() {//回调函数 + geocoder = new AMap.Geocoder({ + }); + geocoder.getAddress(lnglatXY, function (status, result) { + if (status === 'complete' && result.info === 'OK') { + //获得了有效的地址信息: + //即,result.regeocode.formattedAddress + // alert(result.regeocode.formattedAddress) + //document.getElementById("address").value=result.regeocode.formattedAddress;//将获取到的地址信息赋值给文本框,保存进数据库 + + var address = result.regeocode.formattedAddress; + var city = result.regeocode.addressComponent.city; + var province = result.regeocode.addressComponent.province; + var district = result.regeocode.addressComponent.district; + $("#address").val(address); + } else { + //获取地址失败 + } + }); + }) +} + + +WorldCupInfo.openStore = function () { + var index = layer.open({ + type: 2, + title: '参与赛点', + area: ['80%', '80%'], //宽高 + fix: false, //不固定 + maxmin: true, + content: Feng.ctxPath + '/worldCup/openStore' + }); + this.layerIndex = index; +}; + +WorldCupInfo.initStore = function (){ + let html = ''; + for (let i = 0; i < WorldCupInfo.stores.length; i++) { + let item = WorldCupInfo.stores[i]; + html += '<tr><td>' + item.province + '</td><td>' + (typeof item.operator == "undefined" ? "" : item.operator) + '</td><td>' + item.name + '</td><td><button style="height: 30px;\n' + + ' line-height: 30px;\n' + + ' font-size: 14px;\n' + + ' width: 50px" onclick="WorldCupInfo.delStore(' + item.id + ')">删除</button></td></tr>' + } + $('#stores tbody').html(html); +} + +WorldCupInfo.delStore = function (id){ + let arr = []; + for (let i = 0; i < WorldCupInfo.stores.length; i++) { + let item = WorldCupInfo.stores[i]; + if(id != item.id){ + arr.push(item); + } + } + WorldCupInfo.stores = arr; + WorldCupInfo.initStore(); +} + + +var editor = null; +$(function () { + //初始化编辑器 + editor = UE.getEditor('content'); +}); \ No newline at end of file -- Gitblit v1.7.1