Merge branch '2.0' of http://120.76.84.145:10101/gitblit/r/java/PlayPai into 2.0
| | |
| | | List<TAppUser> list = appUserService.list(new QueryWrapper<TAppUser>().eq("cityCode", cityCode).eq("state", 1)); |
| | | return list.stream().map(TAppUser::getId).collect(Collectors.toList()); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 根据省市名称所有用户 |
| | | * @param appUserIdsByCityName |
| | | * @return |
| | | */ |
| | | @PostMapping("/appUser/getAppUserIdsByCityName") |
| | | public List<Integer> getAppUserIdsByCityName(@RequestBody AppUserIdsByCityName appUserIdsByCityName){ |
| | | QueryWrapper<TAppUser> queryWrapper = new QueryWrapper<TAppUser>().eq("state", 1); |
| | | if(ToolUtil.isNotEmpty(appUserIdsByCityName.getProvince())){ |
| | | queryWrapper.like("province", appUserIdsByCityName.getProvince()); |
| | | } |
| | | if(ToolUtil.isNotEmpty(appUserIdsByCityName.getCity())){ |
| | | queryWrapper.like("city", appUserIdsByCityName.getCity()); |
| | | } |
| | | List<TAppUser> list = appUserService.list(queryWrapper); |
| | | return list.stream().map(TAppUser::getId).collect(Collectors.toList()); |
| | | } |
| | | } |
New file |
| | |
| | | package com.dsh.account.model; |
| | | |
| | | import lombok.Data; |
| | | |
| | | /** |
| | | * @author zhibing.pu |
| | | * @Date 2024/3/6 16:46 |
| | | */ |
| | | @Data |
| | | public class AppUserIdsByCityName { |
| | | /** |
| | | * 省名称 |
| | | */ |
| | | private String province; |
| | | /** |
| | | * 市名称 |
| | | */ |
| | | private String city; |
| | | } |
| | |
| | | import com.dsh.activity.feignclient.course.model.CoursePackagePaymentConfig; |
| | | import com.dsh.activity.feignclient.model.*; |
| | | import com.dsh.activity.feignclient.other.OperatorClient; |
| | | import com.dsh.activity.feignclient.other.SiteClient; |
| | | import com.dsh.activity.feignclient.other.StoreClient; |
| | | import com.dsh.activity.feignclient.other.model.Store; |
| | | import com.dsh.activity.feignclient.other.model.StoreDetailOfCourse; |
| | | import com.dsh.activity.feignclient.other.model.StoreInfoDto; |
| | | import com.dsh.activity.feignclient.other.model.TOperatorCity; |
| | | import com.dsh.activity.feignclient.other.model.*; |
| | | import com.dsh.activity.model.CoachChangeStateVO; |
| | | import com.dsh.activity.model.PointMerchandiseIncomeVo; |
| | | import com.dsh.activity.model.PointMerchandiseVo; |
| | |
| | | import com.dsh.activity.util.*; |
| | | import io.swagger.models.auth.In; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.util.StringUtils; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import javax.annotation.Resource; |
| | |
| | | |
| | | @Resource |
| | | private CouponCityService ccityService; |
| | | @Autowired |
| | | private SiteClient siteClient; |
| | | |
| | | |
| | | @Resource |
| | |
| | | case 3: |
| | | infoOneVo.setExchangeArea("指定门店"); |
| | | break; |
| | | case 4: |
| | | infoOneVo.setExchangeArea("指定场地"); |
| | | break; |
| | | default: |
| | | break; |
| | | } |
| | |
| | | .eq("pointsMerchandiseId", id)); |
| | | if (list.size() > 0) { |
| | | List<Integer> collect = list.stream().map(PointsMerchandiseStore::getStoreId).collect(Collectors.toList()); |
| | | List<Integer> collect1 = list.stream().map(PointsMerchandiseStore::getSiteId).collect(Collectors.toList()); |
| | | List<Store> stores = stoClient.queryStoreByIds(collect); |
| | | if (stores.size() > 0) { |
| | | int a = 0; |
| | | for (Store store : stores) { |
| | | StoreVos storeVos1 = new StoreVos(); |
| | | storeVos1.setNum1(store.getProvince() + "省" + store.getCity() + "市"); |
| | | if (store.getOperatorId() == 0) { |
| | | if (store.getOperatorId()==null){ |
| | | storeVos1.setNum2("平台"); |
| | | }else if (store.getOperatorId() == 0) { |
| | | storeVos1.setNum2("平台"); |
| | | } else { |
| | | |
| | |
| | | } |
| | | storeVos1.setNum3(store.getName()); |
| | | storeVos1.setNum4(store.getIds()); |
| | | if (collect1.get(a)!=null){ |
| | | Site site = siteClient.querySiteById(collect1.get(a)); |
| | | storeVos1.setNum5(site.getName()); |
| | | } |
| | | storeVos1.setNum4(store.getIds()); |
| | | storeVos.add(storeVos1); |
| | | } |
| | | } |
| | | } |
| | | return storeVos; |
| | | } |
| | | |
| | | |
| | | |
| | | @ResponseBody |
| | |
| | | public Boolean addOther(@RequestBody String pam) { |
| | | Boolean save = false; |
| | | String[] split = pam.split("_"); |
| | | if (split.length>2){ |
| | | if (StringUtils.hasLength(split[2])){ |
| | | for (String s : split[2].split(",")) { |
| | | PointsMerchandiseStore pointsMerchandiseStore = new PointsMerchandiseStore(); |
| | | pointsMerchandiseStore.setPointsMerchandiseId(Integer.valueOf(split[0])); |
| | | pointsMerchandiseStore.setSiteId(Integer.valueOf(s)); |
| | | Site site = siteClient.querySiteById(Integer.valueOf(s)); |
| | | pointsMerchandiseStore.setStoreId(site.getStoreId()); |
| | | save = pmdstoService.save(pointsMerchandiseStore); |
| | | } |
| | | // 这个门票是选择的场地 |
| | | return save; |
| | | } |
| | | } |
| | | for (String s : split[1].split(",")) { |
| | | PointsMerchandiseStore pointsMerchandiseStore = new PointsMerchandiseStore(); |
| | | pointsMerchandiseStore.setPointsMerchandiseId(Integer.valueOf(split[0])); |
| | |
| | | return save; |
| | | } |
| | | |
| | | |
| | | @PostMapping("/base/pointMerchars/addCitys") |
| | | public Boolean addCitys(@RequestBody ArrayList<Map<String, String>> objects) { |
| | | try { |
| | |
| | | */ |
| | | @TableField("pointsMerchandiseId") |
| | | private Integer pointsMerchandiseId; |
| | | @TableField("siteId") |
| | | private Integer siteId; |
| | | /** |
| | | * 门店id |
| | | */ |
| | |
| | | |
| | | String num3; |
| | | String num4; |
| | | // 场地名称 |
| | | String num5; |
| | | } |
| | |
| | | public Map<String, Object> getRegisteredPersonnel(@RequestBody RegisteredPersonnel registeredPersonnel){ |
| | | return worldCupPaymentParticipantService.getRegisteredPersonnel(registeredPersonnel); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 获取比赛排行榜列表数据 |
| | | * @param worldCupRecords |
| | | * @return |
| | | */ |
| | | @ResponseBody |
| | | @PostMapping("/worldCup/worldCupRecordsList") |
| | | public Map<String, Object> worldCupRecordsList(@RequestBody WorldCupRecords worldCupRecords){ |
| | | return worldCupCompetitorService.worldCupRecordsList(worldCupRecords); |
| | | } |
| | | } |
| | |
| | | package com.dsh.communityWorldCup.feignclient.account; |
| | | |
| | | import com.dsh.communityWorldCup.feignclient.account.model.AppUser; |
| | | import com.dsh.communityWorldCup.feignclient.account.model.AppUserIdsByCityName; |
| | | import org.springframework.cloud.openfeign.FeignClient; |
| | | import org.springframework.web.bind.annotation.PostMapping; |
| | | |
| | |
| | | @PostMapping("/appUser/getAppUserIds") |
| | | List<Integer> getAppUserIds(String cityCode); |
| | | |
| | | |
| | | /** |
| | | * 根据省市名称获取用户的id集合 |
| | | * @param appUserIdsByCityName |
| | | * @return |
| | | */ |
| | | @PostMapping("/appUser/getAppUserIdsByCityName") |
| | | List<Integer> getAppUserIdsByCityName(AppUserIdsByCityName appUserIdsByCityName); |
| | | |
| | | } |
New file |
| | |
| | | package com.dsh.communityWorldCup.feignclient.account.model; |
| | | |
| | | import lombok.Data; |
| | | |
| | | /** |
| | | * @author zhibing.pu |
| | | * @Date 2024/3/6 16:46 |
| | | */ |
| | | @Data |
| | | public class AppUserIdsByCityName { |
| | | /** |
| | | * 省名称 |
| | | */ |
| | | private String province; |
| | | /** |
| | | * 市名称 |
| | | */ |
| | | private String city; |
| | | } |
| | |
| | | |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.dsh.communityWorldCup.entity.WorldCupCompetitor; |
| | | import com.dsh.communityWorldCup.model.MatchRecord; |
| | | import com.dsh.communityWorldCup.model.MatchRecordList; |
| | | import com.dsh.communityWorldCup.model.WorldCupRank; |
| | | import com.dsh.communityWorldCup.model.WorldCupRankVo; |
| | | import com.dsh.communityWorldCup.model.*; |
| | | import org.apache.ibatis.annotations.Param; |
| | | |
| | | import java.util.List; |
| | |
| | | * @return |
| | | */ |
| | | List<Map<String, Object>> getWorldCupRank(@Param("item") WorldCupRank worldCupRank, @Param("appUserIds") List<Integer> appUserIds); |
| | | |
| | | |
| | | /** |
| | | * 获取比赛排行榜列表数据 |
| | | * @param worldCupRecords |
| | | * @return |
| | | */ |
| | | List<Map<String, Object>> worldCupRecordsList(@Param("item") WorldCupRecords worldCupRecords, @Param("appUserIds") List<Integer> appUserIds); |
| | | |
| | | |
| | | int worldCupRecordsListCount(@Param("appUserIds") List<Integer> appUserIds); |
| | | } |
New file |
| | |
| | | package com.dsh.communityWorldCup.model; |
| | | |
| | | import lombok.Data; |
| | | |
| | | /** |
| | | * @author zhibing.pu |
| | | * @Date 2024/3/6 16:17 |
| | | */ |
| | | @Data |
| | | public class WorldCupRecords { |
| | | /** |
| | | * 省名称 |
| | | */ |
| | | private String province; |
| | | /** |
| | | * 市名称 |
| | | */ |
| | | private String city; |
| | | /** |
| | | * 页码 |
| | | */ |
| | | private Integer offset; |
| | | /** |
| | | * 页条数 |
| | | */ |
| | | private Integer limit; |
| | | |
| | | } |
| | |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import com.dsh.communityWorldCup.entity.WorldCupCompetitor; |
| | | import com.dsh.communityWorldCup.model.*; |
| | | import org.springframework.web.bind.annotation.RequestBody; |
| | | |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * @author zhibing.pu |
| | |
| | | * @param blue |
| | | */ |
| | | void endWorldCupCallback(String custom, Integer red_score, Integer blue); |
| | | |
| | | |
| | | /** |
| | | * 获取比赛排行榜列表数据 |
| | | * @param worldCupRecords |
| | | * @return |
| | | */ |
| | | Map<String, Object> worldCupRecordsList(WorldCupRecords worldCupRecords); |
| | | } |
| | |
| | | import com.dsh.communityWorldCup.feignclient.account.AppUserClient; |
| | | import com.dsh.communityWorldCup.feignclient.account.StudentClient; |
| | | import com.dsh.communityWorldCup.feignclient.account.model.AppUser; |
| | | import com.dsh.communityWorldCup.feignclient.account.model.AppUserIdsByCityName; |
| | | import com.dsh.communityWorldCup.feignclient.account.model.TStudent; |
| | | import com.dsh.communityWorldCup.feignclient.competition.ParticipantClient; |
| | | import com.dsh.communityWorldCup.feignclient.competition.model.Participant; |
| | |
| | | import java.math.BigDecimal; |
| | | import java.math.MathContext; |
| | | import java.math.RoundingMode; |
| | | import java.util.ArrayList; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.*; |
| | | |
| | | /** |
| | | * @author zhibing.pu |
| | |
| | | |
| | | this.updateBatchById(worldCupCompetitors); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 获取比赛排行榜列表数据 |
| | | * @param worldCupRecords |
| | | * @return |
| | | */ |
| | | @Override |
| | | public Map<String, Object> worldCupRecordsList(WorldCupRecords worldCupRecords) { |
| | | Map<String, Object> map1 = new HashMap<>(); |
| | | AppUserIdsByCityName appUserIdsByCityName = new AppUserIdsByCityName(); |
| | | appUserIdsByCityName.setProvince(worldCupRecords.getProvince()); |
| | | appUserIdsByCityName.setCity(worldCupRecords.getCity()); |
| | | List<Integer> appUserIds = appUserClient.getAppUserIdsByCityName(appUserIdsByCityName); |
| | | List<Map<String, Object>> mapList = this.baseMapper.worldCupRecordsList(worldCupRecords, appUserIds); |
| | | for (int i = 0; i < mapList.size(); i++) { |
| | | Map<String, Object> map = mapList.get(i); |
| | | Integer participantType = Integer.valueOf(map.get("participantType").toString()); |
| | | Integer participantId = Integer.valueOf(map.get("participantId").toString()); |
| | | Integer appUserId = Integer.valueOf(map.get("appUserId").toString()); |
| | | Integer totalSession = Integer.valueOf(map.get("totalSession").toString()); |
| | | Integer win = Integer.valueOf(map.get("win").toString()); |
| | | Integer lose = totalSession - win; |
| | | map.put("lose", lose); |
| | | AppUser appUser = appUserClient.getAppUser(appUserId); |
| | | map.put("province", appUser.getProvince() + appUser.getCity()); |
| | | if(1 == participantType){ |
| | | TStudent tStudent = studentClient.queryById(participantId); |
| | | map.put("name", tStudent.getName()); |
| | | map.put("phone", tStudent.getPhone()); |
| | | }else{ |
| | | Participant participant = participantClient.getParticipant(participantId); |
| | | map.put("name", participant.getName()); |
| | | map.put("phone", participant.getPhone()); |
| | | } |
| | | } |
| | | map1.put("rows", mapList); |
| | | int count = this.baseMapper.worldCupRecordsListCount(appUserIds); |
| | | map1.put("total", count); |
| | | return map1; |
| | | } |
| | | } |
| | |
| | | </if> |
| | | </select> |
| | | |
| | | |
| | | <select id="worldCupRecordsList" resultType="map"> |
| | | select @row_num := @row_num + 1 AS row_num, bb.* from ( |
| | | select * from ( |
| | | select |
| | | a.participantType, |
| | | a.participantId, |
| | | a.appUserId, |
| | | a.num as totalSession, |
| | | ifnull(b.num, 0) as win, |
| | | (ifnull(b.num, 0) / a.num * 100) as winRate |
| | | from ( |
| | | select |
| | | participantType, |
| | | participantId, |
| | | appUserId, |
| | | count(*) as num |
| | | from t_world_cup_competitor |
| | | where 1 = 1 |
| | | <if test="null != appUserIds and appUserIds.size() > 0"> |
| | | and appUserId in |
| | | <foreach collection="appUserIds" item="iten" index="index" open="(" separator="," close=")"> |
| | | #{iten} |
| | | </foreach> |
| | | </if> |
| | | group by participantType, participantId, appUserId |
| | | ) as a |
| | | left join ( |
| | | select |
| | | participantType, |
| | | participantId, |
| | | appUserId, |
| | | count(*) as num |
| | | from t_world_cup_competitor |
| | | where matchResult = 1 |
| | | <if test="null != appUserIds and appUserIds.size() > 0"> |
| | | and appUserId in |
| | | <foreach collection="appUserIds" item="iten" index="index" open="(" separator="," close=")"> |
| | | #{iten} |
| | | </foreach> |
| | | </if> |
| | | group by participantType, participantId, appUserId |
| | | ) as b on (a.participantId = b.participantId and a.participantType = b.participantType) |
| | | ) as aa order by aa.totalSession desc |
| | | ) as bb, (SELECT @row_num := 0) AS r |
| | | </select> |
| | | |
| | | |
| | | <select id="worldCupRecordsListCount" resultType="int"> |
| | | select count(*) from { |
| | | select |
| | | participantType, |
| | | participantId, |
| | | appUserId, |
| | | from t_world_cup_competitor |
| | | where 1 = 1 |
| | | <if test="null != appUserIds and appUserIds.size() > 0"> |
| | | and appUserId in |
| | | <foreach collection="appUserIds" item="iten" index="index" open="(" separator="," close=")"> |
| | | #{iten} |
| | | </foreach> |
| | | </if> |
| | | group by participantType, participantId, appUserId |
| | | } as aa |
| | | </select> |
| | | </mapper> |
| | |
| | | */ |
| | | @ResponseBody |
| | | @PostMapping("/backspaceClassHour") |
| | | public void backspaceClassHour(DeductionClassHourList deductionClassHourList){ |
| | | public void backspaceClassHour(@RequestBody DeductionClassHourList deductionClassHourList){ |
| | | coursePackageOrderStudentService.backspaceClassHour(deductionClassHourList); |
| | | } |
| | | } |
| | |
| | | @Autowired |
| | | private TCoursePackageService coursePackageService; |
| | | |
| | | @Resource |
| | | private CoursePackageStudentMapper coursePackageStudentMapper; |
| | | |
| | | |
| | | |
| | | @Override |
| | |
| | | Integer codeTime = coursePackage.getCodeTime(); |
| | | //未上的排课数据 |
| | | List<CoursePackageScheduling> packageSchedulings = coursePackageSchedulingService.list(new QueryWrapper<CoursePackageScheduling>().eq("studentId", coursePackageOrderStudent.getStudentId()) |
| | | .eq("coursePackageId", coursePackageOrderStudent.getCoursePackageId()).eq("status", 1).orderByDesc("classDate")); |
| | | .eq("type", 1).eq("coursePackageId", coursePackageOrderStudent.getCoursePackageId()).eq("status", 1).orderByDesc("classDate")); |
| | | //排课使用的总课时 |
| | | int classHour = packageSchedulings.size() * codeTime; |
| | | //未排课的课时 |
| | |
| | | List<CoursePackageScheduling> coursePackageSchedulings = packageSchedulings.subList(0, n); |
| | | List<Long> collect = coursePackageSchedulings.stream().map(CoursePackageScheduling::getId).collect(Collectors.toList()); |
| | | coursePackageSchedulingService.removeByIds(collect); |
| | | coursePackageStudentMapper.delete(new QueryWrapper<CoursePackageStudent>().in("coursePackageSchedulingId", collect)); |
| | | |
| | | deductionClassHour.setScheduledCourses(n); |
| | | } |
| | |
| | | CoursePackageOrderStudent coursePackageOrderStudent = this.getById(deductionClassHour.getId()); |
| | | Integer laveClassHours = coursePackageOrderStudent.getLaveClassHours(); |
| | | coursePackageOrderStudent.setLaveClassHours(coursePackageOrderStudent.getLaveClassHours() + deductionClassHour.getClassHour()); |
| | | this.updateById(coursePackageOrderStudent); |
| | | |
| | | CourseCounsum courseCounsum = new CourseCounsum(); |
| | | courseCounsum.setPaymentId(coursePackageOrderStudent.getId()); |
| | | courseCounsum.setChangeType(0); |
| | | courseCounsum.setNum(deductionClassHour.getClassHour()); |
| | | courseCounsum.setInsertTime(new Date()); |
| | | courseCounsum.setReason("社区世界杯报名"); |
| | | courseCounsum.setAppUserId(coursePackageOrderStudent.getAppUserId()); |
| | | courseCounsumService.save(courseCounsum); |
| | | |
| | | |
| | | //需要排课的节数 |
| | | Integer scheduledCourses = deductionClassHour.getScheduledCourses(); |
| | | // coursePackageService |
| | | TCoursePackage coursePackage = coursePackageService.getById(coursePackageOrderStudent.getCoursePackageId()); |
| | | Integer codeTime = coursePackage.getCodeTime(); |
| | | CoursePackageScheduling one = coursePackageSchedulingService.getOne(new QueryWrapper<CoursePackageScheduling>().eq("studentId", coursePackageOrderStudent.getStudentId()) |
| | | .eq("type", 1).eq("coursePackageId", coursePackageOrderStudent.getCoursePackageId()).eq("status", 1) |
| | | .orderByDesc("classDate").last(" limit 0, 1")); |
| | | |
| | | //上课星期 |
| | | String classWeeks = coursePackage.getClassWeeks(); |
| | | List<Integer> week = week(classWeeks); |
| | | //新排课的开始日期 |
| | | Calendar start = Calendar.getInstance(); |
| | | String classStartTime = coursePackage.getClassStartTime(); |
| | | String classEndTime = coursePackage.getClassEndTime(); |
| | | String[] split = classStartTime.split(","); |
| | | String[] split1 = classEndTime.split(","); |
| | | SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); |
| | | SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); |
| | | //计算剩余课时最大排课节数 |
| | | int num = laveClassHours / codeTime; |
| | | //比较除哪个最小以哪个来确定排课节数 |
| | | num = num > scheduledCourses ? scheduledCourses : num; |
| | | |
| | | //先检查当前是都还有需要排课的 |
| | | if(null != one){ |
| | | Date classDate = one.getClassDate(); |
| | | |
| | | Calendar calendar = Calendar.getInstance(); |
| | | calendar.setTime(classDate); |
| | | String s = sdf.format(calendar.getTime()); |
| | | |
| | | for (int j = 0; j < split.length; j++) { |
| | | Date parse = null; |
| | | Date parse1 = null; |
| | | try { |
| | | parse = format.parse(s + " " + split[j]); |
| | | parse1 = format.parse(s + " " + split1[j]); |
| | | } catch (ParseException e) { |
| | | throw new RuntimeException(e); |
| | | } |
| | | if(classDate.getTime() <= parse.getTime()){ |
| | | continue; |
| | | } |
| | | |
| | | //开始组装排课数据 |
| | | CoursePackageScheduling packageScheduling = new CoursePackageScheduling(); |
| | | packageScheduling.setType(1); |
| | | packageScheduling.setAppUserId(coursePackageOrderStudent.getAppUserId()); |
| | | packageScheduling.setStudentId(coursePackageOrderStudent.getStudentId()); |
| | | packageScheduling.setCoursePackageId(coursePackage.getId()); |
| | | packageScheduling.setClassDate(parse); |
| | | packageScheduling.setEndDate(parse1); |
| | | packageScheduling.setStatus(1); |
| | | coursePackageSchedulingService.save(packageScheduling); |
| | | |
| | | CoursePackageStudent student1 = new CoursePackageStudent(); |
| | | student1.setAppUserId(coursePackageOrderStudent.getAppUserId()); |
| | | student1.setStudentId(coursePackageOrderStudent.getStudentId()); |
| | | student1.setCoursePackageId(coursePackage.getId()); |
| | | student1.setCoursePackagePaymentId(coursePackageOrderStudent.getId()); |
| | | student1.setCoursePackageSchedulingId(packageScheduling.getId()); |
| | | student1.setSignInOrNot(1); |
| | | student1.setReservationStatus(1); |
| | | student1.setInsertTime(new Date()); |
| | | student1.setType(1); |
| | | coursePackageStudentMapper.insert(student1); |
| | | |
| | | num--; |
| | | if(num == 0){ |
| | | return; |
| | | } |
| | | } |
| | | |
| | | calendar.set(Calendar.DAY_OF_YEAR, calendar.get(Calendar.DAY_OF_YEAR) + 1); |
| | | start = calendar; |
| | | } |
| | | |
| | | if(num == 0){ |
| | | return; |
| | | } |
| | | |
| | | //继续排后面的数据 |
| | | while (true) { |
| | | String s = sdf.format(start.getTime()); |
| | | |
| | | //判断当天是否在排课星期内 |
| | | int day = start.get(Calendar.DAY_OF_WEEK); |
| | | day = day - 1 == 0 ? 7 : day - 1; |
| | | if (!week.contains(day)) { |
| | | start.set(Calendar.DAY_OF_YEAR, start.get(Calendar.DAY_OF_YEAR) + 1); |
| | | continue; |
| | | } |
| | | |
| | | for (int j = 0; j < split.length; j++) { |
| | | //开始组装排课数据 |
| | | CoursePackageScheduling packageScheduling = new CoursePackageScheduling(); |
| | | packageScheduling.setType(1); |
| | | packageScheduling.setAppUserId(coursePackageOrderStudent.getAppUserId()); |
| | | packageScheduling.setStudentId(coursePackageOrderStudent.getStudentId()); |
| | | packageScheduling.setCoursePackageId(coursePackage.getId()); |
| | | try { |
| | | Date parse = format.parse(s + " " + split[j]); |
| | | Date parse1 = format.parse(s + " " + split1[j]); |
| | | packageScheduling.setClassDate(parse); |
| | | packageScheduling.setEndDate(parse1); |
| | | packageScheduling.setStatus(1); |
| | | coursePackageSchedulingService.save(packageScheduling); |
| | | |
| | | CoursePackageStudent student1 = new CoursePackageStudent(); |
| | | student1.setAppUserId(coursePackageOrderStudent.getAppUserId()); |
| | | student1.setStudentId(coursePackageOrderStudent.getStudentId()); |
| | | student1.setCoursePackageId(coursePackage.getId()); |
| | | student1.setCoursePackagePaymentId(coursePackageOrderStudent.getId()); |
| | | student1.setCoursePackageSchedulingId(packageScheduling.getId()); |
| | | student1.setSignInOrNot(1); |
| | | student1.setReservationStatus(1); |
| | | student1.setInsertTime(new Date()); |
| | | student1.setType(1); |
| | | coursePackageStudentMapper.insert(student1); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | } |
| | | num--; |
| | | if(num == 0){ |
| | | return; |
| | | } |
| | | } |
| | | start.set(Calendar.DAY_OF_YEAR, start.get(Calendar.DAY_OF_YEAR) + 1); |
| | | } |
| | | |
| | | } |
| | | |
| | | } |
| | | |
| | | |
| | | |
| | | private List<Integer> week(String week) { |
| | | String[] split = week.split(";"); |
| | | ArrayList<Integer> integers = new ArrayList<>(); |
| | | for (String s : split) { |
| | | switch (s) { |
| | | case "周一": |
| | | integers.add(1); |
| | | break; |
| | | case "周二": |
| | | integers.add(2); |
| | | break; |
| | | case "周三": |
| | | integers.add(3); |
| | | break; |
| | | case "周四": |
| | | integers.add(4); |
| | | break; |
| | | case "周五": |
| | | integers.add(5); |
| | | break; |
| | | case "周六": |
| | | integers.add(6); |
| | | break; |
| | | case "周日": |
| | | integers.add(7); |
| | | break; |
| | | } |
| | | } |
| | | return integers; |
| | | } |
| | | } |
| | |
| | | <name>管理后台</name> |
| | | <description>管理后台</description> |
| | | <dependencies> |
| | | <dependency> |
| | | <groupId>org.springframework</groupId> |
| | | <artifactId>spring-test</artifactId> |
| | | <version>5.3.9</version> |
| | | </dependency> |
| | | <dependency> |
| | | <groupId>com.google.zxing</groupId> |
| | | <artifactId>core</artifactId> |
| | | <version>3.4.1</version> |
| | | </dependency> |
| | | <dependency> |
| | | <groupId>com.google.zxing</groupId> |
| | | <artifactId>javase</artifactId> |
| | | <version>3.4.1</version> |
| | | </dependency> |
| | | <!--处理json--> |
| | | <dependency> |
| | | <groupId>org.json</groupId> |
| | |
| | | <version>4.5.0</version> |
| | | </dependency> |
| | | |
| | | |
| | | <!--二维码--> |
| | | <dependency> |
| | | <groupId>com.google.zxing</groupId> |
| | | <artifactId>core</artifactId> |
| | | <version>3.3.0</version> |
| | | </dependency> |
| | | <dependency> |
| | | <groupId>com.google.zxing</groupId> |
| | | <artifactId>javase</artifactId> |
| | | <version>3.3.0</version> |
| | | </dependency> |
| | | </dependencies> |
| | | |
| | | <build> |
| | |
| | | @PostMapping("/base/pointMerchars/addOther") |
| | | Boolean addOther(@RequestBody String pam); |
| | | |
| | | @PostMapping("/base/pointMerchars/addOther1") |
| | | Boolean addOther1(@RequestBody String pam1); |
| | | |
| | | @PostMapping("/base/pointMerchars/addCitys") |
| | | Boolean addCitys(@RequestBody List<Map<String, String>> objects); |
| | | |
New file |
| | |
| | | package com.dsh.course.feignClient.communityWorldCup.Model; |
| | | |
| | | import lombok.Data; |
| | | |
| | | /** |
| | | * @author zhibing.pu |
| | | * @Date 2024/3/6 11:02 |
| | | */ |
| | | @Data |
| | | public class RegisteredPersonnel { |
| | | /** |
| | | * 世界杯赛事id |
| | | */ |
| | | private Integer id; |
| | | /** |
| | | * 姓名 |
| | | */ |
| | | private String name; |
| | | /** |
| | | * 电话号码 |
| | | */ |
| | | private String phone; |
| | | /** |
| | | * 身份证号 |
| | | */ |
| | | private String idcode; |
| | | /** |
| | | * 状态(1=正常,2=取消) |
| | | */ |
| | | private Integer status; |
| | | /** |
| | | * 页码 |
| | | */ |
| | | private Integer offset; |
| | | /** |
| | | * 页条数 |
| | | */ |
| | | private Integer limit; |
| | | } |
New file |
| | |
| | | package com.dsh.course.feignClient.communityWorldCup.Model; |
| | | |
| | | import lombok.Data; |
| | | |
| | | /** |
| | | * @author zhibing.pu |
| | | * @Date 2024/3/6 16:17 |
| | | */ |
| | | @Data |
| | | public class WorldCupRecords { |
| | | /** |
| | | * 省名称 |
| | | */ |
| | | private String province; |
| | | /** |
| | | * 市名称 |
| | | */ |
| | | private String city; |
| | | /** |
| | | * 页码 |
| | | */ |
| | | private Integer offset; |
| | | /** |
| | | * 页条数 |
| | | */ |
| | | private Integer limit; |
| | | |
| | | } |
| | |
| | | package com.dsh.course.feignClient.communityWorldCup; |
| | | |
| | | import com.dsh.course.feignClient.communityWorldCup.Model.RegisteredPersonnel; |
| | | import com.dsh.course.feignClient.communityWorldCup.Model.WorldCup; |
| | | import com.dsh.course.feignClient.communityWorldCup.Model.WorldCupListAll; |
| | | import com.dsh.course.feignClient.communityWorldCup.Model.WorldCupRecords; |
| | | import org.springframework.cloud.openfeign.FeignClient; |
| | | import org.springframework.web.bind.annotation.PostMapping; |
| | | |
| | |
| | | */ |
| | | @PostMapping("/worldCup/cancelWorldCupRefund") |
| | | void cancelWorldCupRefund(Integer id); |
| | | |
| | | |
| | | /** |
| | | * 获取已报名人员列表 |
| | | * @param registeredPersonnel |
| | | * @return |
| | | */ |
| | | @PostMapping("/worldCup/getRegisteredPersonnel") |
| | | Map<String, Object> getRegisteredPersonnel(RegisteredPersonnel registeredPersonnel); |
| | | |
| | | |
| | | /** |
| | | * 获取比赛排行榜列表数据 |
| | | * @param worldCupRecords |
| | | * @return |
| | | */ |
| | | @PostMapping("/worldCup/worldCupRecordsList") |
| | | Map<String, Object> worldCupRecordsList(WorldCupRecords worldCupRecords); |
| | | } |
| | |
| | | private String imgs; |
| | | @TableField("ids") |
| | | private String ids; |
| | | |
| | | |
| | | // 是否可预约 0否1是 |
| | | @TableField("reservation") |
| | | private Integer reservation; |
| | | } |
New file |
| | |
| | | package com.dsh.course.mapper; |
| | | |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.dsh.course.dto.JsDto; |
| | | import com.dsh.guns.modular.system.model.*; |
| | | import com.dsh.guns.modular.system.model.dto.SelectDto; |
| | | import org.apache.ibatis.annotations.Param; |
| | | |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * @author zhibing.pu |
| | | * @date 2023/7/6 16:51 |
| | | */ |
| | | public interface GateMapper extends BaseMapper<Gate> { |
| | | |
| | | |
| | | List<Map<String, Object>> listAll(@Param("name")String name, |
| | | @Param("device")String device, |
| | | @Param("operatorName")String operatorId, |
| | | @Param("storeName")String storeId, |
| | | @Param("storeIds")List<Integer> storeIds, |
| | | @Param("page")Page<Map<String, Object>> page); |
| | | |
| | | } |
New file |
| | |
| | | package com.dsh.course.mapper; |
| | | |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.dsh.guns.modular.system.model.HomeModule; |
| | | |
| | | public interface HomeModuleMapper extends BaseMapper<HomeModule> { |
| | | } |
| | |
| | | |
| | | |
| | | List<Map<String, Object>> listStoreAllByIds(@Param("ids") List<Integer> ids); |
| | | List<Map<String, Object>> querySiteListOfpage(@Param("provinceCode") String provinceCode, |
| | | @Param("cityCode") String cityCode, |
| | | @Param("operatorId") Integer operatorId, |
| | | @Param("storeName") String storeName, |
| | | @Param("page") Page<Map<String, Object>> page); |
| | | |
| | | |
| | | } |
New file |
| | |
| | | package com.dsh.guns.modular.system.controller.code; |
| | | |
| | | |
| | | import com.dsh.course.feignClient.other.model.Banner; |
| | | import com.dsh.guns.config.UserExt; |
| | | import com.dsh.guns.modular.system.model.HomeModule; |
| | | import com.dsh.guns.modular.system.service.IHomeModuleService; |
| | | import com.dsh.guns.modular.system.service.IStoreService; |
| | | 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.*; |
| | | |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | @Controller |
| | | @RequestMapping("/tHomeModule") |
| | | public class HomeModuleController { |
| | | |
| | | @Autowired |
| | | private IHomeModuleService homeModuleService; |
| | | @Autowired |
| | | private IStoreService storeService; |
| | | |
| | | private String PREFIX = "/system/tHomeModule/"; |
| | | |
| | | |
| | | @RequestMapping("/tHomeModule_platformSet/{id}") |
| | | public String tHomeModulePlatformSet(@PathVariable Integer id, Model model) { |
| | | HomeModule data = homeModuleService.getById(id); |
| | | List<Map<String, Object>> pages = storeService.typeChange(data.getModel()); |
| | | List<Map<String, Object>> types = storeService.typeChangeOne(data.getJumpPage()); |
| | | // type=1 查看详情 type=2 编辑 |
| | | model.addAttribute("type",2); |
| | | Integer roleType = UserExt.getUser().getObjectType(); |
| | | model.addAttribute("roleType",roleType); |
| | | model.addAttribute("data",data); |
| | | model.addAttribute("pages",pages); |
| | | model.addAttribute("types",types); |
| | | return PREFIX + "tHomeModule.html"; |
| | | } |
| | | |
| | | @ResponseBody |
| | | @RequestMapping("/updateHomeModule") |
| | | public ResultUtil updateAdvertisement(@RequestBody HomeModule homeModule) { |
| | | if (homeModule.getType().equals("请选择")){ |
| | | homeModule.setType(null); |
| | | } |
| | | if (homeModule.getPage().equals("请选择")){ |
| | | homeModule.setPage(null); |
| | | } |
| | | return ResultUtil.success(homeModuleService.updateById(homeModule)); |
| | | } |
| | | |
| | | } |
| | |
| | | } |
| | | } |
| | | } |
| | | |
| | | |
| | | } |
| | | } |
| | | return storeList; |
| | | } |
| | | // 查询场地列表 |
| | | @RequestMapping("/siteDetailsOfSearch") |
| | | @ResponseBody |
| | | public Object siteDetailsOfSearch(String provinceId,String cityId,Integer operatorId,String storeName){ |
| | | if (UserExt.getUser().getObjectType()== 2){ |
| | | // 筛选这个运营商下的门店 |
| | | operatorId = UserExt.getUser().getObjectId(); |
| | | } |
| | | Page<Map<String, Object>> page = new PageFactory<Map<String, Object>>().defaultPage(); |
| | | List<Map<String,Object>> storeList = storeService.querySiteListOfpage(provinceId,cityId,operatorId,storeName,page); |
| | | if (storeList.size() > 0 ){ |
| | | for (Map<String, Object> stringObjectMap : storeList) { |
| | | String provinceName = (String) stringObjectMap.get("province"); |
| | | String cityName = (String) stringObjectMap.get("city"); |
| | | stringObjectMap.put("provinceCity",provinceName+cityName); |
| | | Integer managerId = (Integer) stringObjectMap.get("operatorId"); |
| | | if (managerId == null){ |
| | | stringObjectMap.put("accountName","平台"); |
| | | }else{ |
| | | if (managerId==0){ |
| | | stringObjectMap.put("accountName","平台"); |
| | | }else{ |
| | | TOperator operator = operatorService.getOne(new QueryWrapper<TOperator>().eq("id", managerId)); |
| | | if (ToolUtil.isNotEmpty(operator)){ |
| | | stringObjectMap.put("accountName",operator.getName()); |
| | | }else{ |
| | | stringObjectMap.put("accountName","平台"); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | | return storeList; |
New file |
| | |
| | | package com.dsh.guns.modular.system.controller.code; |
| | | |
| | | |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.dsh.course.feignClient.account.AppUserClient; |
| | | import com.dsh.course.feignClient.account.CityManagerClient; |
| | | import com.dsh.course.feignClient.account.StoreStaffClient; |
| | | import com.dsh.course.feignClient.account.model.CityManager; |
| | | import com.dsh.course.feignClient.account.model.QueryByNamePhone; |
| | | import com.dsh.course.feignClient.account.model.TAppUser; |
| | | import com.dsh.course.feignClient.account.model.TStoreStaff; |
| | | import com.dsh.course.feignClient.activity.CouponClient; |
| | | import com.dsh.course.feignClient.activity.PointMercharsClient; |
| | | import com.dsh.course.feignClient.activity.model.*; |
| | | import com.dsh.guns.config.UserExt; |
| | | import com.dsh.guns.core.base.tips.SuccessTip; |
| | | import com.dsh.guns.core.common.constant.factory.PageFactory; |
| | | import com.dsh.guns.core.util.ToolUtil; |
| | | import com.dsh.guns.modular.system.model.*; |
| | | import com.dsh.guns.modular.system.service.*; |
| | | import com.dsh.guns.modular.system.util.HttpRequestUtil; |
| | | import com.dsh.guns.modular.system.util.OBSUploadUtil; |
| | | import com.dsh.guns.modular.system.util.ResultUtil; |
| | | import com.google.gson.Gson; |
| | | import com.google.gson.JsonObject; |
| | | import com.sun.org.apache.bcel.internal.generic.NEW; |
| | | import io.swagger.models.auth.In; |
| | | import org.apache.poi.ss.formula.functions.T; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Controller; |
| | | import org.springframework.ui.Model; |
| | | import org.springframework.web.bind.annotation.*; |
| | | import org.springframework.web.multipart.MultipartFile; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.io.IOException; |
| | | import java.util.ArrayList; |
| | | import java.util.HashMap; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.stream.Collectors; |
| | | |
| | | |
| | | /** |
| | | * 闸机管理 控制器 |
| | | */ |
| | | |
| | | @Controller |
| | | @RequestMapping("/gate") |
| | | public class TGateController { |
| | | private String PREFIX = "/system/gate/"; |
| | | @Resource |
| | | private IRegionService regiService; |
| | | @Resource |
| | | private IStoreService storeService; |
| | | |
| | | @Resource |
| | | private CouponClient client; |
| | | |
| | | @Resource |
| | | private CityManagerClient cmgrClient; |
| | | |
| | | @Autowired |
| | | private AppUserClient appUserClient; |
| | | @Autowired |
| | | private ICityService cityService; |
| | | |
| | | @Resource |
| | | private PointMercharsClient pointMercharsClient; |
| | | @Autowired |
| | | private StoreStaffClient storeStaffClient; |
| | | @Autowired |
| | | private IGateService gateService; |
| | | @Autowired |
| | | private TOperatorService tOperatorService; |
| | | @Autowired |
| | | private ITSiteService siteService; |
| | | |
| | | /** |
| | | * 跳转到优惠券管理首页 |
| | | */ |
| | | @RequestMapping("") |
| | | public String index(Model model) { |
| | | return PREFIX + "gate.html"; |
| | | } |
| | | /** |
| | | * 跳转到添加 |
| | | */ |
| | | @RequestMapping("/add") |
| | | public String add(Model model) { |
| | | Integer objectType = UserExt.getUser().getObjectType(); |
| | | model.addAttribute("userType",objectType); |
| | | System.out.println(objectType); |
| | | List<TOperator> list1 = tOperatorService.list(); |
| | | model.addAttribute("yysList",list1); |
| | | if (UserExt.getUser().getObjectType()==1) { |
| | | List<TStore> list = storeService.list(new QueryWrapper<TStore>() |
| | | .eq("operatorId", 0) |
| | | .ne("state", 3)); |
| | | model.addAttribute("storeList",list); |
| | | } |
| | | if (UserExt.getUser().getObjectType()==2){ |
| | | List<TStore> list2 = storeService.list(new QueryWrapper<TStore>() |
| | | .eq("operatorId", UserExt.getUser().getObjectId()) |
| | | .ne("state", 3)); |
| | | model.addAttribute("storeList",list2); |
| | | model.addAttribute("operatorId",UserExt.getUser().getObjectId()); |
| | | } |
| | | if (UserExt.getUser().getObjectType()==3){ |
| | | List<TStore> list3 = new ArrayList<>(); |
| | | TStore byId = storeService.getById(UserExt.getUser().getObjectId()); |
| | | list3.add(byId); |
| | | Integer operatorId = byId.getOperatorId(); |
| | | if (operatorId==null){ |
| | | model.addAttribute("operatorId",0); |
| | | }else if (operatorId==0){ |
| | | model.addAttribute("operatorId",0); |
| | | }else{ |
| | | model.addAttribute("operatorId",byId.getOperatorId()); |
| | | } |
| | | model.addAttribute("storeList",list3); |
| | | model.addAttribute("storeId",UserExt.getUser().getObjectId()); |
| | | // 查询场地列表 |
| | | List<TSite> siteList = siteService.list(new QueryWrapper<TSite>() |
| | | .eq("storeId", UserExt.getUser().getObjectId()) |
| | | .ne("state",3)); |
| | | model.addAttribute("siteList",siteList); |
| | | } |
| | | |
| | | |
| | | return PREFIX + "gate_add.html"; |
| | | } |
| | | |
| | | /** |
| | | * 添加门禁接口 |
| | | */ |
| | | @RequestMapping("/addDevice") |
| | | @ResponseBody |
| | | public Object addDevice(String name,Integer operatorId,Integer storeId,Integer siteId,String device) { |
| | | Gate gate = new Gate(); |
| | | gate.setName(name); |
| | | gate.setDevice(device); |
| | | gate.setStoreId(storeId); |
| | | gate.setSiteId(siteId); |
| | | gate.setOperatorId(operatorId); |
| | | |
| | | HashMap<String, String> map = new HashMap<>(); |
| | | map.put("sign","0DB011836143EEE2C2E072967C9F4E4B"); |
| | | map.put("space_id",""+storeId); |
| | | map.put("device_id",device); |
| | | map.put("region_id",""+siteId); |
| | | // 添加门禁 |
| | | String s1 = HttpRequestUtil.postRequest("https://try.daowepark.com/v7/user_api/general/addDevice", map); |
| | | System.out.println(s1); |
| | | Gson gson = new Gson(); |
| | | // 解析请求结果,json: |
| | | JsonObject jsonObject = gson.fromJson(s1, JsonObject.class); |
| | | if (!jsonObject.get("code").toString().equals("200")){ |
| | | return ResultUtil.error(""+jsonObject.get("message").getAsString()); |
| | | } |
| | | JsonObject data = jsonObject.getAsJsonObject("data"); |
| | | int device_id = data.get("device_id").getAsInt(); |
| | | gate.setId(device_id); |
| | | gateService.save(gate); |
| | | return new SuccessTip<>(); |
| | | } |
| | | /** |
| | | * 编辑门禁接口 |
| | | */ |
| | | @RequestMapping("/updateDevice") |
| | | @ResponseBody |
| | | public Object updateDevice(Integer id,String name,Integer operatorId,Integer storeId,Integer siteId,String device) { |
| | | Gate gate = gateService.getById(id); |
| | | gate.setName(name); |
| | | gate.setDevice(device); |
| | | gate.setStoreId(storeId); |
| | | gate.setSiteId(siteId); |
| | | gate.setOperatorId(operatorId); |
| | | HashMap<String, String> map = new HashMap<>(); |
| | | map.put("sign","0DB011836143EEE2C2E072967C9F4E4B"); |
| | | map.put("space_id",""+storeId); |
| | | map.put("device_id",device); |
| | | map.put("region_id",""+siteId); |
| | | // 添加门禁 |
| | | String s1 = HttpRequestUtil.postRequest("https://try.daowepark.com/v7/user_api/general/editDevice/ids/"+id, map); |
| | | System.out.println(s1); |
| | | Gson gson = new Gson(); |
| | | // 解析请求结果,json: |
| | | JsonObject jsonObject = gson.fromJson(s1, JsonObject.class); |
| | | if (!jsonObject.get("code").toString().equals("200")){ |
| | | return ResultUtil.error(""+jsonObject.get("message").getAsString()); |
| | | } |
| | | gateService.updateById(gate); |
| | | return new SuccessTip<>(); |
| | | } |
| | | /** |
| | | * 删除门禁接口 |
| | | */ |
| | | @RequestMapping("/deleteDevice") |
| | | @ResponseBody |
| | | public Object add(Integer gateId) { |
| | | Gate byId = gateService.getById(gateId); |
| | | byId.setIsDelete(1); |
| | | HashMap<String, String> map = new HashMap<>(); |
| | | map.put("sign","0DB011836143EEE2C2E072967C9F4E4B"); |
| | | // 添加门禁 |
| | | String s1 = HttpRequestUtil.postRequest |
| | | ("https://try.daowepark.com/v7/user_api/general/deleteDevice/ids/"+gateId, map); |
| | | |
| | | System.out.println(s1); |
| | | Gson gson = new Gson(); |
| | | // 解析请求结果,json: |
| | | JsonObject jsonObject = gson.fromJson(s1, JsonObject.class); |
| | | if (!jsonObject.get("code").toString().equals("200")){ |
| | | return ResultUtil.error(""+jsonObject.get("message").getAsString()); |
| | | } |
| | | gateService.updateById(byId); |
| | | return new SuccessTip<>(); |
| | | } |
| | | /** |
| | | * |
| | | * @param id |
| | | * @param model |
| | | * @return |
| | | */ |
| | | @RequestMapping("/update/{id}") |
| | | public String update(@PathVariable("id") Integer id,Model model) { |
| | | model.addAttribute("id",id); |
| | | Gate byId = gateService.getById(id); |
| | | model.addAttribute("id",id); |
| | | model.addAttribute("data",byId); |
| | | Integer objectType = UserExt.getUser().getObjectType(); |
| | | model.addAttribute("userType",objectType); |
| | | System.out.println(objectType); |
| | | List<TOperator> list1 = tOperatorService.list(); |
| | | model.addAttribute("yysList",list1); |
| | | if (UserExt.getUser().getObjectType()==1) { |
| | | List<TStore> list = storeService.list(new QueryWrapper<TStore>() |
| | | .eq("operatorId", 0) |
| | | .ne("state", 3)); |
| | | model.addAttribute("storeList",list); |
| | | List<TSite> siteList = siteService.list(new QueryWrapper<TSite>() |
| | | .eq("storeId", byId.getStoreId()) |
| | | .ne("state",3)); |
| | | model.addAttribute("siteList",siteList); |
| | | } |
| | | if (UserExt.getUser().getObjectType()==2){ |
| | | List<TStore> list2 = storeService.list(new QueryWrapper<TStore>() |
| | | .eq("operatorId", UserExt.getUser().getObjectId()) |
| | | .ne("state", 3)); |
| | | model.addAttribute("storeList",list2); |
| | | model.addAttribute("operatorId",UserExt.getUser().getObjectId()); |
| | | List<TSite> siteList = siteService.list(new QueryWrapper<TSite>() |
| | | .eq("storeId", byId.getStoreId()) |
| | | .ne("state",3)); |
| | | model.addAttribute("siteList",siteList); |
| | | } |
| | | if (UserExt.getUser().getObjectType()==3){ |
| | | List<TStore> list3 = new ArrayList<>(); |
| | | TStore byId1 = storeService.getById(UserExt.getUser().getObjectId()); |
| | | list3.add(byId1); |
| | | Integer operatorId = byId1.getOperatorId(); |
| | | if (operatorId==null){ |
| | | model.addAttribute("operatorId",0); |
| | | }else if (operatorId==0){ |
| | | model.addAttribute("operatorId",0); |
| | | }else{ |
| | | model.addAttribute("operatorId",byId1.getOperatorId()); |
| | | } |
| | | model.addAttribute("storeList",list3); |
| | | model.addAttribute("storeId",UserExt.getUser().getObjectId()); |
| | | // 查询场地列表 |
| | | List<TSite> siteList = siteService.list(new QueryWrapper<TSite>() |
| | | .eq("storeId", UserExt.getUser().getObjectId()) |
| | | .ne("state",3)); |
| | | model.addAttribute("siteList",siteList); |
| | | } |
| | | return PREFIX + "gate_edit.html"; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 获取闸机列表 |
| | | */ |
| | | @RequestMapping(value = "/listAll") |
| | | @ResponseBody |
| | | public Object listAll(String name,String device,String operatorName, |
| | | String storeName) { |
| | | Page<Map<String,Object>> page = new PageFactory<Map<String,Object>>().defaultPage(); |
| | | List<Integer> storeIds = new ArrayList<>(); |
| | | if (UserExt.getUser().getObjectType()==2){ |
| | | // 查询这个运营商下的所有门店 |
| | | List<Integer> ids = storeService.list(new QueryWrapper<TStore>() |
| | | .eq("operatorId", UserExt.getUser().getObjectId())).stream().map(TStore::getId) |
| | | .collect(Collectors.toList()); |
| | | if (ids.size()==0){ |
| | | storeIds.add(-1); |
| | | }else{ |
| | | storeIds.addAll(ids); |
| | | } |
| | | } |
| | | if (UserExt.getUser().getObjectType()==3){ |
| | | storeIds.add(UserExt.getUser().getObjectId()); |
| | | } |
| | | List<Map<String,Object>> res = gateService.listAll(name,device,operatorName,storeName,storeIds,page); |
| | | return res; |
| | | } |
| | | |
| | | /** |
| | | * 根据运营商id获取门店列表 |
| | | |
| | | */ |
| | | @RequestMapping(value = "/getStore") |
| | | @ResponseBody |
| | | public List<TStore> getStore(Integer operatorId) { |
| | | List<TStore> list = storeService.list(new QueryWrapper<TStore>() |
| | | .eq("operatorId", operatorId) |
| | | .ne("state", 3)); |
| | | return list; |
| | | |
| | | } |
| | | /** |
| | | * 根据门店id获取场地列表 |
| | | |
| | | */ |
| | | @RequestMapping(value = "/getSite") |
| | | @ResponseBody |
| | | public List<TSite> getSite(Integer storeId) { |
| | | List<TSite> list = siteService.list(new QueryWrapper<TSite>() |
| | | .eq("storeId", storeId) |
| | | .ne("state", 3)); |
| | | return list; |
| | | } |
| | | /** |
| | | * 跳转到门店管理列表页 |
| | | */ |
| | | @RequestMapping("/storeList") |
| | | public String storePage(Model model) { |
| | | return PREFIX + "TStoreList.html"; |
| | | } |
| | | @RequestMapping("/updateType") |
| | | @ResponseBody |
| | | public Object updateType(Long id) { |
| | | client.updateType(id); |
| | | return new SuccessTip<>(); |
| | | } |
| | | |
| | | @RequestMapping("/storeDetailsOfSearch") |
| | | @ResponseBody |
| | | public Object listOfStore(Integer provinceId,Integer cityId,Integer cityManagerId,String storeName){ |
| | | System.out.println("provinceId"+provinceId); |
| | | System.out.println("cityId"+cityId); |
| | | System.out.println("cityManagerId"+cityManagerId); |
| | | System.out.println("storeName"+storeName); |
| | | String provinceCode = null; |
| | | String cityCode = null; |
| | | if (ToolUtil.isNotEmpty(provinceId)){ |
| | | Region provinceRegion = regiService.getById(provinceId); |
| | | provinceCode = provinceRegion.getCode(); |
| | | } |
| | | if (ToolUtil.isNotEmpty(cityId)){ |
| | | Region cityRegion = regiService.getById(cityId); |
| | | cityCode = cityRegion.getCode(); |
| | | } |
| | | Page<Map<String, Object>> page = new PageFactory<Map<String, Object>>().defaultPage(); |
| | | List<Map<String,Object>> storeList = storeService.queryListOfpage(provinceCode,cityCode,cityManagerId,storeName,page); |
| | | if (storeList.size() > 0 ){ |
| | | for (Map<String, Object> stringObjectMap : storeList) { |
| | | String provinceName = (String) stringObjectMap.get("province"); |
| | | String cityName = (String) stringObjectMap.get("city"); |
| | | stringObjectMap.put("provinceCity",provinceName+cityName); |
| | | Integer managerId = (Integer) stringObjectMap.get("cityManagerId"); |
| | | CityManager cityManager = cmgrClient.queryCityManagerById(managerId); |
| | | if (ToolUtil.isNotEmpty(cityManager)){ |
| | | stringObjectMap.put("accountName",cityManager.getName()+"+"+cityManager.getPhone()); |
| | | } |
| | | } |
| | | } |
| | | return storeList; |
| | | } |
| | | |
| | | @RequestMapping(value = "/listRecord") |
| | | @ResponseBody |
| | | public Object listRecord(Integer id,String name, Integer type, String phone) { |
| | | Page<Map<String, Object>> page = new PageFactory<Map<String, Object>>().defaultPage(); |
| | | List<TAppUser> tAppUsers = appUserClient.queryByNamePhone(new QueryByNamePhone(name, phone)); |
| | | if(tAppUsers.size()==0){ |
| | | return new ArrayList<>(); |
| | | } |
| | | CouponRecordQuery ofSearch = new CouponRecordQuery(); |
| | | ofSearch.setId(id); |
| | | ofSearch.setLimit(page.getSize()); |
| | | ofSearch.setOffset(page.getCurrent()); |
| | | ofSearch.setIds(tAppUsers.stream().map(TAppUser::getId).collect(Collectors.toList())); |
| | | ofSearch.setType(type); |
| | | List<Map<String, Object>> maps = client.listRecord(ofSearch); |
| | | for (Map<String, Object> map : maps) { |
| | | map.put("id",map.get("id").toString()); |
| | | for (TAppUser tAppUser : tAppUsers) { |
| | | if(map.get("userId").equals(tAppUser.getId())){ |
| | | map.put("name",tAppUser.getName()); |
| | | map.put("phone",tAppUser.getPhone()); |
| | | } |
| | | } |
| | | } |
| | | return maps; |
| | | } |
| | | |
| | | @RequestMapping(value = "/getProvince") |
| | | @ResponseBody |
| | | public Object getProvince(){ |
| | | return regiService.list(new LambdaQueryWrapper<Region>() |
| | | .eq(Region::getParentId,0)); |
| | | } |
| | | |
| | | @RequestMapping(value = "/onShelf") |
| | | @ResponseBody |
| | | public Object onShelf(Integer id,Integer type){ |
| | | Coupon coupon = client.queryCouponById(id); |
| | | coupon.setState(type); |
| | | client.updateCouponData(coupon); |
| | | return new SuccessTip<>(); |
| | | } |
| | | |
| | | |
| | | @RequestMapping(value = "/getCity") |
| | | @ResponseBody |
| | | public Object getCity(Integer province){ |
| | | return regiService.list(new LambdaQueryWrapper<Region>() |
| | | .eq(Region::getParentId,province)); |
| | | } |
| | | |
| | | @RequestMapping(value = "/uploadPic") |
| | | @ResponseBody |
| | | public Object add(@RequestParam("file") MultipartFile imgFile) throws IOException { |
| | | String originalFilename = imgFile.getOriginalFilename(); |
| | | String newName = originalFilename.substring(imgFile.getOriginalFilename().lastIndexOf(".")); |
| | | String url = OBSUploadUtil.inputStreamUpload(imgFile); |
| | | Map<String, String> map = new HashMap<String, String>(); |
| | | //是否上传成功 |
| | | map.put("state", "SUCCESS"); |
| | | //现在文件名称 |
| | | map.put("title", newName); |
| | | //文件原名称 |
| | | map.put("original", originalFilename); |
| | | //文件类型 .+后缀名 |
| | | map.put("type", originalFilename.substring(imgFile.getOriginalFilename().lastIndexOf("."))); |
| | | //文件路径 |
| | | map.put("url", url); |
| | | //文件大小(字节数) |
| | | map.put("size", imgFile.getSize() + ""); |
| | | System.out.println(map); |
| | | return url; |
| | | } |
| | | |
| | | /** |
| | | * 提交添加 |
| | | */ |
| | | @PostMapping(value = "/commitData") |
| | | @ResponseBody |
| | | public Object commitData( CouponDataVo dataVo){ |
| | | System.out.println(dataVo); |
| | | Integer objectType = UserExt.getUser().getObjectType(); |
| | | dataVo.setUserType(objectType); |
| | | client.insertIntoData(dataVo); |
| | | return new SuccessTip<>(); |
| | | } |
| | | @PostMapping(value = "/update") |
| | | @ResponseBody |
| | | public Object update( Integer id,Integer num,Integer num1,String text){ |
| | | Coupon coupon = client.queryCouponById(id); |
| | | coupon.setQuantityIssued(num); |
| | | coupon.setPickUpQuantity(num1); |
| | | coupon.setIllustrate(text); |
| | | client.updateCouponData(coupon); |
| | | return new SuccessTip<>(); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 获取 积分商品列表 |
| | | */ |
| | | @RequestMapping(value = "/list") |
| | | @ResponseBody |
| | | public Object listOfIntegralGoods(String name, Integer type, Integer redemptionMethod , Integer userPopulation, Integer activeStatus, Integer state) { |
| | | Page<Map<String, Object>> page = new PageFactory<Map<String, Object>>().defaultPage(); |
| | | |
| | | IntegralGoodsOfSearch ofSearch = new IntegralGoodsOfSearch(); |
| | | ofSearch.setPage(page); |
| | | ofSearch.setName(name); |
| | | ofSearch.setType(type); |
| | | ofSearch.setRedemptionMethod(redemptionMethod); |
| | | ofSearch.setUserPopulation(userPopulation); |
| | | ofSearch.setActiveStatus(activeStatus); |
| | | ofSearch.setState(state); |
| | | System.out.println(ofSearch); |
| | | return pointMercharsClient.getIntegralGoodsListOfSearch(ofSearch); |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * 跳转到修改车辆管理 |
| | | */ |
| | | @RequestMapping("/tGoods_update/{id}") |
| | | public String tCityUpdate(@PathVariable Integer id, Model model) { |
| | | System.out.println("id:"+id); |
| | | PointMercharsVo pointMercharsVo = pointMercharsClient.queryPointMerchaseDetailOfId(id); |
| | | System.out.println("pointMercharsVo:"+pointMercharsVo); |
| | | String[] split = pointMercharsVo.getPics().split(","); |
| | | model.addAttribute("item",pointMercharsVo); |
| | | model.addAttribute("pictures",split); |
| | | return PREFIX + "TGoods_edit.html"; |
| | | } |
| | | |
| | | /** |
| | | * 上下架处理操作 |
| | | * @param id 商品id |
| | | * @param type 1=上架操作 2=下架操作 |
| | | * @return |
| | | */ |
| | | @RequestMapping("/grounding") |
| | | @ResponseBody |
| | | public Object updateGrounding(Integer id,Integer type) { |
| | | System.out.println(id); |
| | | System.out.println(type); |
| | | Map<String,Integer> map = new HashMap<>(); |
| | | map.put("id",id); |
| | | map.put("type",type); |
| | | boolean b = pointMercharsClient.updateGoodsGroudingStatus(map); |
| | | System.out.println(b); |
| | | return new SuccessTip<>(); |
| | | } |
| | | /** |
| | | * 上下架处理操作 |
| | | * @return |
| | | */ |
| | | @RequestMapping("/writeOff") |
| | | @ResponseBody |
| | | public Object writeOff(String id) { |
| | | Long aLong = Long.valueOf(id); |
| | | WriteOffDTO dto = new WriteOffDTO(); |
| | | // 核销人员id |
| | | Integer objectId = UserExt.getUser().getId(); |
| | | if (UserExt.getUser().getObjectType() == 1){ |
| | | dto.setVerifiStoreId(null); |
| | | }else if (UserExt.getUser().getObjectType() == 2){ |
| | | storeService.getOne(new QueryWrapper<TStore>().eq("cityManagerId",objectId)); |
| | | }else{ |
| | | TStoreStaff storeByStoreStaffId = storeStaffClient.getStoreByStoreStaffId(objectId); |
| | | dto.setVerifiStoreId(storeByStoreStaffId.getStoreId()); |
| | | } |
| | | dto.setId(aLong); |
| | | dto.setVerificationUserId(objectId); |
| | | pointMercharsClient.writeOff(dto); |
| | | return new SuccessTip<>(); |
| | | } |
| | | |
| | | /** |
| | | * 购买详情 |
| | | * @param id 商品id |
| | | * @return |
| | | */ |
| | | @RequestMapping("/tPay_detail/{id}") |
| | | public String payOfDetails(@PathVariable(value = "id") Integer id,Model model) { |
| | | System.out.println(id); |
| | | model.addAttribute("id",id); |
| | | return PREFIX + "TGoods_pay.html"; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 获取 购买记录列表 |
| | | */ |
| | | @ResponseBody |
| | | @RequestMapping(value = "/payList/{id}") |
| | | public Object payList(@PathVariable(value = "id") Integer id, String name, String phone, Integer status) { |
| | | PointMercharsPayedVo payedVo = new PointMercharsPayedVo(); |
| | | payedVo.setId(id); |
| | | payedVo.setName(name); |
| | | payedVo.setPhone(phone); |
| | | payedVo.setStatus(status); |
| | | List<Map<String,Object>> points = pointMercharsClient.queryUserPayedGoodsList(payedVo); |
| | | System.out.println(points); |
| | | if (points.size() > 0 ){ |
| | | for (Map<String, Object> point : points) { |
| | | Integer userId = (Integer) point.get("userId"); |
| | | TAppUser tAppUser = appUserClient.queryById(userId); |
| | | if (ToolUtil.isNotEmpty(tAppUser)){ |
| | | point.put("name",tAppUser.getName()); |
| | | point.put("phone",tAppUser.getPhone()); |
| | | } |
| | | } |
| | | if (ToolUtil.isNotEmpty(name)){ |
| | | points = points.stream() |
| | | .filter(data -> { |
| | | String obtName = (String) data.get("name"); |
| | | return obtName != null && obtName.contains(name); |
| | | }) |
| | | .collect(Collectors.toList()); |
| | | } |
| | | if (ToolUtil.isNotEmpty(phone)){ |
| | | points = points.stream() |
| | | .filter(data -> { |
| | | String obtPhone = (String) data.get("phone"); |
| | | return obtPhone != null && obtPhone.contains(phone); |
| | | }) |
| | | .collect(Collectors.toList()); |
| | | } |
| | | } |
| | | return points; |
| | | } |
| | | |
| | | /** |
| | | * 核销操作 |
| | | * @param id 商品id |
| | | * @return |
| | | */ |
| | | @RequestMapping("/write_off") |
| | | @ResponseBody |
| | | public Object GoodsWriteOff(Integer id){ |
| | | System.out.println(id); |
| | | return new SuccessTip<>(); |
| | | } |
| | | |
| | | |
| | | } |
| | |
| | | import com.dsh.guns.modular.system.service.ICityService; |
| | | import com.dsh.guns.modular.system.service.IRegionService; |
| | | import com.dsh.guns.modular.system.service.IStoreService; |
| | | import com.dsh.guns.modular.system.service.ITSiteService; |
| | | import com.dsh.guns.modular.system.util.OBSUploadUtil; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Controller; |
| | | import org.springframework.ui.Model; |
| | | import org.springframework.util.StringUtils; |
| | | import org.springframework.web.bind.annotation.*; |
| | | import org.springframework.web.multipart.MultipartFile; |
| | | |
| | |
| | | |
| | | @Resource |
| | | private IRegionService regiService; |
| | | |
| | | @Autowired |
| | | private ITSiteService siteService; |
| | | @Resource |
| | | private IStoreService storeService; |
| | | |
| | |
| | | List<StoreVos> storeVos = pointMercharsClient.getStoreList(id); |
| | | model.addAttribute("store",storeVos); |
| | | } |
| | | // 门票选的指定场地 |
| | | if (infoOneVo.getUseScope() == 4){ |
| | | List<StoreVos> storeVos = pointMercharsClient.getStoreList(id); |
| | | model.addAttribute("sites",storeVos); |
| | | } |
| | | model.addAttribute("pictures",list); |
| | | model.addAttribute("exchangeMethod",infoOneVo.getExchangeMethod()); |
| | | return PREFIX + "TGoods_detail_one.html"; |
| | | } |
| | | |
| | | |
| | | } |
| | | |
| | | |
| | | @RequestMapping("/coupon_record/{id}") |
| | | public String memberCouponAdd(@PathVariable Integer id,Model model) { |
| | | Coupon coupon = client.queryCouponById(id); |
| | | |
| | | model.addAttribute("id",id); |
| | | model.addAttribute("type",coupon.getType()); |
| | | return PREFIX + "TCouponRecord.html"; |
| | | } |
| | | |
| | | |
| | | |
| | | @RequestMapping("/coupon_detail/{id}") |
| | | public String memberCouponDetail(@PathVariable Integer id,Model model) { |
| | |
| | | List<TCity> provinceList = cityService.list(new LambdaQueryWrapper<TCity>().eq(TCity::getParentId, 0)); |
| | | model.addAttribute("list",provinceList); |
| | | return PREFIX + "TStoreListOne.html"; |
| | | } |
| | | // 场地列表 |
| | | @RequestMapping("/siteList1") |
| | | public String storePage2(Model model) { |
| | | List<TCity> provinceList = cityService.list(new LambdaQueryWrapper<TCity>().eq(TCity::getParentId, 0)); |
| | | model.addAttribute("list",provinceList); |
| | | return PREFIX + "TSiteListOne.html"; |
| | | } |
| | | @RequestMapping("/updateType") |
| | | @ResponseBody |
| | |
| | | @ResponseBody |
| | | public Object add( Integer typeAll,String provinceCode,String cityCode,Integer storeId,Integer coursePackageTypeId,Integer coursePackageId,Integer coursePackageConfigId, |
| | | Double price,Integer type,Integer integral,Double cash,String cover,String imgOne,Integer userPopulation,Integer quantityIssued,Integer pickUpQuantity, |
| | | String startTime,String text,Integer sort,String name,Integer useScope,String cityIds,String storeIds,Integer cardType |
| | | String startTime,String text,Integer sort,String name,Integer useScope,String cityIds,String storeIds,String sites,Integer cardType |
| | | ) throws ParseException { |
| | | // 判断当前选择的课包 是不是假期课 然后判断选择的有效期是否在假期课有效期内 |
| | | if (coursePackageId!=null){ |
| | |
| | | objects.add(map); |
| | | } |
| | | pointMercharsClient.addCitys(objects); |
| | | }else if(useScope==3){ |
| | | }else if(useScope==3||useScope==4){ |
| | | if(UserExt.getUser().getObjectType()==3){ |
| | | storeIds=UserExt.getUser().getObjectId().toString(); |
| | | } |
| | | if (useScope==4){ |
| | | storeIds =""; |
| | | } |
| | | if (useScope==3){ |
| | | sites =""; |
| | | } |
| | | if (StringUtils.hasLength(storeIds)){ |
| | | Integer oid=null; |
| | | String[] split = storeIds.split(","); |
| | | for (int i = 0; i < split.length; i++) { |
| | |
| | | return "5003"; |
| | | } |
| | | } |
| | | } |
| | | |
| | | if (StringUtils.hasLength(sites)){ |
| | | Integer oid=null; |
| | | String[] split = storeIds.split(","); |
| | | for (int i = 0; i < split.length; i++) { |
| | | if(i==0){ |
| | | Integer operatorId = siteService.getById(split[0]).getOperatorId(); |
| | | oid=operatorId; |
| | | } |
| | | Integer operatorId = siteService.getById(split[i]).getOperatorId(); |
| | | if(oid!=operatorId){ |
| | | return "5004"; |
| | | } |
| | | } |
| | | } |
| | | |
| | | Integer id = pointMercharsClient.add(pointsMerchandise); |
| | | String pam = id+"_"+storeIds; |
| | | // 添加多个城市 门店 |
| | | |
| | | String pam = id+"_"+storeIds+"_"+sites; |
| | | // 添加多个城市 门店 场地 |
| | | try{ |
| | | pointMercharsClient.addOther(pam); |
| | | |
| | | |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | |
| | | Integer id = pointMercharsClient.add(pointsMerchandise); |
| | | } |
| | | }else { |
| | | // ? |
| | | pointsMerchandise.setShelves(storeId); |
| | | pointsMerchandise.setUseScope(3); |
| | | |
| | | Integer id = pointMercharsClient.add(pointsMerchandise); |
| | | } |
| | | return new SuccessTip<>(); |
| | |
| | | import org.springframework.stereotype.Controller; |
| | | import org.springframework.ui.Model; |
| | | import org.springframework.web.bind.annotation.PathVariable; |
| | | import org.springframework.web.bind.annotation.PostMapping; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.ResponseBody; |
| | | |
| | |
| | | model.addAttribute("id",id); |
| | | return PREFIX + "TShop_add_device.html"; |
| | | } |
| | | |
| | | @RequestMapping("/addDevice") |
| | | public Object addDevice(Integer id,String device) { |
| | | // 应该是不用他了 |
| | | HashMap<String, String> map = new HashMap<>(); |
| | | map.put("sign","0DB011836143EEE2C2E072967C9F4E4B"); |
| | | map.put("space_id",id.toString()); |
| | |
| | | map.put("city_code",""); |
| | | // 添加门禁 |
| | | String s1 = HttpRequestUtil.postRequest |
| | | ("https://try.daowepark.com/v7/user_api/general/addSpaceSutu", map); |
| | | ("https://try.daowepark.c" + |
| | | "om/v7/user_api/general/addSpaceSutu", map); |
| | | return SUCCESS_TIP; |
| | | } |
| | | |
| | | public static void main(String[] args) { |
| | | // HashMap<String, String> map = new HashMap<>(); |
| | | // map.put("page","1"); |
| | | // map.put("space_id","2010"); |
| | | // // 获取门禁列表 |
| | | // String s1 = HttpRequestUtil.getRequest |
| | | // ("https://try.daowepark.com/v7/user_api/general/getDevice", map); |
| | | // System.err.println(s1); |
| | | |
| | | HashMap<String, String> map = new HashMap<>(); |
| | | map.put("sign","0DB011836143EEE2C2E072967C9F4E4B"); |
| | | map.put("space_id","1"); |
| | | map.put("device_id","1"); |
| | | map.put("region_id","2010"); |
| | | // 获取门禁列表 |
| | | String s1 = HttpRequestUtil.getRequest |
| | | ("https://try.daowepark.com/v7/user_api/general/getDevice", map); |
| | | System.err.println(s1); |
| | | }; |
| | | /** |
| | | * 跳转到车辆管理首页 |
| | | */ |
| | |
| | | User byId1 = userMapper.selectById(byId.getStoreStaffId()); |
| | | model.addAttribute("city",byId1); |
| | | model.addAttribute("type",0); |
| | | |
| | | return PREFIX + "TShop_edit.html"; |
| | | } |
| | | @RequestMapping("/tShop_gift/{id}") |
| | |
| | | StoreConfig c8 = storeConfigService.getOne(new LambdaQueryWrapper<StoreConfig>().eq(StoreConfig::getStoreId, id).eq(StoreConfig::getType,8)); |
| | | model.addAttribute("c8",c8); |
| | | model.addAttribute("id",id); |
| | | StoreConfig c9 = storeConfigService.getOne(new LambdaQueryWrapper<StoreConfig>().eq(StoreConfig::getStoreId, id).eq(StoreConfig::getType,9)); |
| | | model.addAttribute("c9",c9); |
| | | return PREFIX + "TShop_imgAll.html"; |
| | | } |
| | | |
| | |
| | | storeConfigs.add(storeConfig); |
| | | } |
| | | storeConfigService.saveBatch(storeConfigs); |
| | | |
| | | // 废弃添加门店时 添加闸机 |
| | | // HashMap<String, String> mapSite = new HashMap<>(); |
| | | // mapSite.put("sign","0DB011836143EEE2C2E072967C9F4E4B"); |
| | | // mapSite.put("name",tStore.getName()); |
| | |
| | | } |
| | | @RequestMapping(value = "/saveImgAll") |
| | | @ResponseBody |
| | | public Object saveImgAll(Integer id,Integer px1,Integer px2,Integer px3,Integer px4,Integer px5,Integer px6,Integer px7,Integer px8, |
| | | String c1,String c2,String c3,String c4,String c5,String c6,String c7,String c8, |
| | | Integer r1,Integer r2,Integer r3,Integer r4,Integer r5,Integer r6,Integer r7,Integer r8) { |
| | | public Object saveImgAll(Integer id,Integer px1,Integer px2,Integer px3,Integer px4,Integer px5,Integer px6,Integer px7,Integer px8,Integer px9, |
| | | String c1,String c2,String c3,String c4,String c5,String c6,String c7,String c8,String c9, |
| | | Integer r1,Integer r2,Integer r3,Integer r4,Integer r5,Integer r6,Integer r7,Integer r8,Integer r9) { |
| | | try { |
| | | ArrayList<StoreConfig> storeConfigs = new ArrayList<>(); |
| | | StoreConfig collect1 = collect(id, px1, r1, c1, 1); |
| | |
| | | storeConfigs.add(collect6); |
| | | storeConfigs.add(collect7); |
| | | storeConfigs.add(collect8); |
| | | StoreConfig collect9 = collect(id, px9, r9, c9, 9); |
| | | storeConfigs.add(collect9); |
| | | storeConfigService.updateBatchById(storeConfigs); |
| | | return new SuccessTip<>(); |
| | | }catch (Exception e){ |
| | |
| | | map.put("space_id",store.getId().toString()); |
| | | String s = HttpRequestUtil.postRequest |
| | | ("https://try.daowepark.com/v7/user_api/general/addSpaceArea", map); |
| | | // 添加门禁 |
| | | JSONObject jsonObject = JSONObject.parseObject(s); |
| | | JSONObject data = jsonObject.getJSONObject("data"); |
| | | String area_id = data.getString("area_id"); |
| | |
| | | site.setId(integer); |
| | | Integer integer1 = siteClient.addSite1(site); |
| | | // Integer integer = Integer.valueOf(spaceId); |
| | | if(StringUtils.hasLength( site.getIds())) { |
| | | for (String s1 : site.getIds().split(",")) { |
| | | HashMap<String, String> map1 = new HashMap<>(); |
| | | map1.put("sign", "0DB011836143EEE2C2E072967C9F4E4B"); |
| | | map1.put("space_id", store.getId().toString() + ""); |
| | | map1.put("device_id", s1); |
| | | map1.put("region_id", integer1 + ""); |
| | | String s2 = HttpRequestUtil.postRequest("https://try.daowepark.com/v7/user_api/general/addDevice", map1); |
| | | System.out.println("添加闸机:" + s2); |
| | | } |
| | | } |
| | | |
| | | return ResultUtil.success("添加成功"); |
| | | } |
| | | /** |
| | |
| | | site.setState(1); |
| | | siteClient.addSite(site); |
| | | |
| | | String ids = byId.getIds(); |
| | | HashMap<String, String> map = new HashMap<>(); |
| | | map.put("sign","0DB011836143EEE2C2E072967C9F4E4B"); |
| | | if(StringUtils.hasLength(ids)) { |
| | | for (String s : ids.split(",")) { |
| | | String s1 = HttpRequestUtil.postRequest("https://try.daowepark.com/v7/user_api/general/deleteDevice/ids/" + s, map); |
| | | System.out.println(s1); |
| | | } |
| | | } |
| | | if(StringUtils.hasLength( site.getIds())) { |
| | | for (String s : site.getIds().split(",")) { |
| | | HashMap<String, String> map1 = new HashMap<>(); |
| | | map1.put("sign", "0DB011836143EEE2C2E072967C9F4E4B"); |
| | | map1.put("space_id", store.getId() + ""); |
| | | map1.put("device_id", s); |
| | | map1.put("region_id", site.getId() + ""); |
| | | // 添加门禁 |
| | | String s1 = HttpRequestUtil.postRequest("https://try.daowepark.com/v7/user_api/general/addDevice", map1); |
| | | System.out.println(s1); |
| | | } |
| | | } |
| | | /** |
| | | * 取消闸机输入 新增模块闸机管理 |
| | | */ |
| | | // String ids = byId.getIds(); |
| | | // HashMap<String, String> map = new HashMap<>(); |
| | | // map.put("sign","0DB011836143EEE2C2E072967C9F4E4B"); |
| | | // if(StringUtils.hasLength(ids)) { |
| | | // for (String s : ids.split(",")) { |
| | | // String s1 = HttpRequestUtil.postRequest("https://try.daowepark.com/v7/user_api/general/deleteDevice/ids/" + s, map); |
| | | // System.out.println(s1); |
| | | // } |
| | | // } |
| | | // if(StringUtils.hasLength( site.getIds())) { |
| | | // for (String s : site.getIds().split(",")) { |
| | | // HashMap<String, String> map1 = new HashMap<>(); |
| | | // map1.put("sign", "0DB011836143EEE2C2E072967C9F4E4B"); |
| | | // map1.put("space_id", store.getId() + ""); |
| | | // map1.put("device_id", s); |
| | | // map1.put("region_id", site.getId() + ""); |
| | | // // 添加门禁 |
| | | // String s1 = HttpRequestUtil.postRequest("https://try.daowepark.com/v7/user_api/general/addDevice", map1); |
| | | // System.out.println(s1); |
| | | // } |
| | | // } |
| | | |
| | | |
| | | |
| | |
| | | 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.course.feignClient.communityWorldCup.Model.RegisteredPersonnel; |
| | | import com.dsh.course.feignClient.competition.model.Competition; |
| | | import com.dsh.course.feignClient.competition.model.CompetitionUser; |
| | | import com.dsh.course.feignClient.competition.model.GetPeopleQuery; |
| | | import com.dsh.guns.core.util.ToolUtil; |
| | | import com.dsh.guns.modular.system.service.IStoreService; |
| | | import com.dsh.guns.modular.system.util.DateUtil; |
| | | import com.dsh.guns.modular.system.util.ExcelUtil; |
| | | import com.dsh.guns.modular.system.util.QRCodeUtils; |
| | | import com.dsh.guns.modular.system.util.ResultUtil; |
| | | import org.apache.poi.hssf.usermodel.HSSFWorkbook; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Controller; |
| | | import org.springframework.ui.Model; |
| | | import org.springframework.web.bind.annotation.GetMapping; |
| | | 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 javax.servlet.http.HttpServletResponse; |
| | | import java.awt.image.BufferedImage; |
| | | import java.io.File; |
| | | import java.io.FileInputStream; |
| | | import java.io.InputStream; |
| | | import java.io.OutputStream; |
| | | import java.net.URLEncoder; |
| | | import java.text.DateFormat; |
| | | import java.text.SimpleDateFormat; |
| | | import java.util.*; |
| | | import java.util.stream.Collectors; |
| | | import java.util.zip.ZipEntry; |
| | | import java.util.zip.ZipOutputStream; |
| | | |
| | | /** |
| | | * @author zhibing.pu |
| | |
| | | List<Map<String, Object>> mapList = storeService.listStoreAllByIds(collect); |
| | | model.addAttribute("stores", JSON.toJSONString(mapList)); |
| | | return PREFIX + "worldCup_info.html"; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 跳转到已报名人员列表 |
| | | * @param model |
| | | * @param id |
| | | * @return |
| | | */ |
| | | @RequestMapping("/openRegisteredPersonnel") |
| | | public String openRegisteredPersonnel(Model model, Integer id){ |
| | | model.addAttribute("id", id); |
| | | return PREFIX + "registeredPersonnel.html"; |
| | | } |
| | | |
| | | |
| | |
| | | worldCupClient.cancelWorldCupRefund(id); |
| | | return ResultUtil.success(); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 获取已报名人员列表 |
| | | * @param registeredPersonnel |
| | | * @return |
| | | */ |
| | | @ResponseBody |
| | | @PostMapping("/registeredPersonnel") |
| | | public Object registeredPersonnel(RegisteredPersonnel registeredPersonnel){ |
| | | return worldCupClient.getRegisteredPersonnel(registeredPersonnel); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 下载二维码压缩包 |
| | | * @param registeredPersonnel |
| | | * @param response |
| | | */ |
| | | @ResponseBody |
| | | @GetMapping("/downloadQRCodeZip") |
| | | public void downloadQRCodeZip(RegisteredPersonnel registeredPersonnel, HttpServletResponse response){ |
| | | try { |
| | | registeredPersonnel.setOffset(0); |
| | | registeredPersonnel.setLimit(10000); |
| | | Map<String, Object> maps = worldCupClient.getRegisteredPersonnel(registeredPersonnel); |
| | | List<Map<String, Object>> list = (List<Map<String, Object>>)maps.get("rows"); |
| | | response.setContentType("APPLICATION/OCTET-STREAM"); |
| | | response.setHeader("Content-Disposition","attachment; filename=" + URLEncoder.encode("二维码", "UTF-8") + ".zip"); |
| | | ZipOutputStream out = new ZipOutputStream(response.getOutputStream()); |
| | | for(Map<String, Object> map : list){ |
| | | String id = map.get("id").toString(); |
| | | String isStudent = map.get("isStudent").toString(); |
| | | String name = map.get("name").toString(); |
| | | QRCodeUtils.encode("{\"id\":" + id + ",\"isStudent\":" + isStudent + "}", name, "/usr/playpai/qrcode", false); |
| | | File file = new File("/usr/playpai/qrcode/" + name + ".jpg"); |
| | | FileInputStream fileInputStream = new FileInputStream(file); |
| | | |
| | | out.putNextEntry(new ZipEntry(name + ".jpg")); |
| | | int len = 0; |
| | | byte[] buf = new byte[1024]; |
| | | while ((len = fileInputStream.read(buf, 0, 1024)) != -1) { |
| | | out.write(buf, 0, len); |
| | | } |
| | | fileInputStream.close(); |
| | | } |
| | | out.finish(); |
| | | out.close(); |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 下载已报名人员 |
| | | * @param registeredPersonnel |
| | | * @param response |
| | | */ |
| | | @ResponseBody |
| | | @GetMapping("/exportPersonnel") |
| | | public void exportPersonnel(RegisteredPersonnel registeredPersonnel, HttpServletResponse response){ |
| | | try { |
| | | Date date = new Date(); |
| | | DateFormat format = new SimpleDateFormat("yyyyMMdd"); |
| | | String time1 = format.format(date); |
| | | String fileName ="已报名人员.xls"; |
| | | String[] title = new String[] {"姓名","性别","年龄","联系电话","身份证号","状态"}; |
| | | registeredPersonnel.setOffset(0); |
| | | registeredPersonnel.setLimit(10000); |
| | | Map<String, Object> maps = worldCupClient.getRegisteredPersonnel(registeredPersonnel); |
| | | List<Map<String, Object>> list = (List<Map<String, Object>>)maps.get("rows"); |
| | | String[][] values = new String[list.size()][]; |
| | | for (int i = 0; i < list.size(); i++) { |
| | | Map<String, Object> d = list.get(i); |
| | | values[i] = new String[title.length]; |
| | | values[i][0] = d.get("name").toString(); |
| | | values[i][1] = d.get("gender").toString(); |
| | | values[i][2] = d.get("age").toString(); |
| | | values[i][3] = d.get("phone").toString(); |
| | | values[i][4] = d.get("idcard").toString(); |
| | | Integer state1 = Integer.valueOf(d.get("state").toString()); |
| | | if(1 == state1){ |
| | | values[i][5] = "正常"; |
| | | }else { |
| | | values[i][5] = "取消"; |
| | | } |
| | | } |
| | | HSSFWorkbook wb = ExcelUtil.getHSSFWorkbook("Variance"+time1, title, values, null); |
| | | ExcelUtil.setResponseHeader(response, fileName); |
| | | OutputStream os = response.getOutputStream(); |
| | | wb.write(os); |
| | | os.flush(); |
| | | os.close(); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | } |
New file |
| | |
| | | package com.dsh.guns.modular.system.controller.code; |
| | | |
| | | import com.dsh.course.feignClient.communityWorldCup.Model.WorldCupRecords; |
| | | import com.dsh.course.feignClient.communityWorldCup.WorldCupClient; |
| | | 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 javax.annotation.Resource; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * @author zhibing.pu |
| | | * @Date 2024/3/6 15:49 |
| | | */ |
| | | @Controller |
| | | @RequestMapping("/worldCupRecords") |
| | | public class WorldCupRecordsController { |
| | | |
| | | private String PREFIX = "/system/worldCupRecords/"; |
| | | |
| | | @Resource |
| | | private WorldCupClient worldCupClient; |
| | | |
| | | |
| | | @RequestMapping("") |
| | | public String openWorldCupRecords(){ |
| | | return PREFIX + "worldCupRecords.html"; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 获取排行榜列表数据 |
| | | * @param worldCupRecords |
| | | * @return |
| | | */ |
| | | @ResponseBody |
| | | @PostMapping("/worldCupRecordsList") |
| | | public Map<String, Object> worldCupRecordsList(WorldCupRecords worldCupRecords){ |
| | | return worldCupClient.worldCupRecordsList(worldCupRecords); |
| | | } |
| | | } |
| | |
| | | import com.dsh.course.feignClient.other.SiteClient; |
| | | import com.dsh.course.feignClient.other.model.Site; |
| | | import com.dsh.course.service.TGameConfigService; |
| | | import com.dsh.course.util.UUIDUtil; |
| | | import com.dsh.guns.config.UserExt; |
| | | import com.dsh.guns.core.base.controller.BaseController; |
| | | import com.dsh.guns.core.util.ToolUtil; |
| | |
| | | import com.dsh.guns.modular.system.model.*; |
| | | import com.dsh.guns.modular.system.model.dto.*; |
| | | import com.dsh.guns.modular.system.service.*; |
| | | import com.dsh.guns.modular.system.util.DateComparisonExample; |
| | | import com.dsh.guns.modular.system.util.HttpRequestUtil; |
| | | import com.dsh.guns.modular.system.util.ResultUtil; |
| | | import com.dsh.guns.modular.system.util.*; |
| | | import com.dsh.course.entity.SiteLock; |
| | | import com.google.gson.Gson; |
| | | import com.google.zxing.BarcodeFormat; |
| | | import com.google.zxing.EncodeHintType; |
| | | import com.google.zxing.WriterException; |
| | | import com.google.zxing.client.j2se.MatrixToImageWriter; |
| | | import com.google.zxing.common.BitMatrix; |
| | | import com.google.zxing.qrcode.QRCodeWriter; |
| | | import com.google.zxing.qrcode.decoder.ErrorCorrectionLevel; |
| | | import org.apache.commons.fileupload.FileItem; |
| | | import org.apache.tomcat.util.http.fileupload.ByteArrayOutputStream; |
| | | import org.json.JSONObject; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.core.io.ByteArrayResource; |
| | | import org.springframework.mock.web.MockMultipartFile; |
| | | import org.springframework.stereotype.Controller; |
| | | import org.springframework.ui.Model; |
| | | import org.springframework.web.bind.annotation.*; |
| | | import org.springframework.web.multipart.MultipartFile; |
| | | import org.springframework.web.multipart.commons.CommonsMultipartFile; |
| | | |
| | | import javax.annotation.Resource; |
| | | import javax.imageio.ImageIO; |
| | | |
| | | import java.awt.image.BufferedImage; |
| | | import java.io.File; |
| | | import java.io.IOException; |
| | | import java.math.BigDecimal; |
| | | |
| | | import java.nio.file.FileSystems; |
| | | import java.nio.file.Path; |
| | | import java.text.ParseException; |
| | | import java.text.SimpleDateFormat; |
| | | import java.time.LocalDate; |
| | |
| | | return ResultUtil.success(); |
| | | } |
| | | |
| | | // public static void main(String[] args) { |
| | | // // 添加sutu编号 |
| | | // HashMap<String, String> map3 = new HashMap<>(); |
| | | // // 添加sutu编号 |
| | | // // 添加门禁 红蓝方 |
| | | // TSite si = siteService.getById(site); |
| | | // TStore st = storeService.getById(store); |
| | | // map3.put("sign", "0DB011836143EEE2C2E072967C9F4E4B"); |
| | | // map3.put("space_id", si.getId() + ""); |
| | | // map3.put("name", ToolUtil.isEmpty(sutuName) ? "" : sutuName); |
| | | // map3.put("city_code", ""); |
| | | // String s3 = HttpRequestUtil.postRequest("https://try.daowepark.com/v7/user_api/general/addDevice", map3); |
| | | // System.out.println("---------------------------"+s3); |
| | | // JSONObject jsonObject = new JSONObject(s3); |
| | | // // 获取 data 字段的值 |
| | | // JSONObject dataObject = jsonObject.getJSONObject("data"); |
| | | // // 获取 sutu_id 字段的值 |
| | | // String sutuIdValue = dataObject.getString("sutu_id"); |
| | | // Integer sutuId = Integer.valueOf(sutuIdValue); |
| | | // game.setSutuId(sutuId); |
| | | // } |
| | | |
| | | public static MultipartFile convert(BufferedImage bufferedImage, String fileName) throws IOException { |
| | | // 将 BufferedImage 转换为字节数组 |
| | | ByteArrayOutputStream baos = new ByteArrayOutputStream(); |
| | | ImageIO.write(bufferedImage, "png", baos); |
| | | byte[] bytes = baos.toByteArray(); |
| | | |
| | | // 创建 ByteArrayResource |
| | | ByteArrayResource resource = new ByteArrayResource(bytes); |
| | | |
| | | // 创建 MockMultipartFile |
| | | MockMultipartFile multipartFile = new MockMultipartFile( |
| | | "file", |
| | | fileName, |
| | | "image/png", |
| | | resource.getInputStream() |
| | | ); |
| | | |
| | | return multipartFile; |
| | | } |
| | | @RequestMapping("/save") |
| | | @ResponseBody |
| | | public ResultUtil save(Integer id, String operationId, String red, String blue, String province, String city, Integer site, Integer store |
| | |
| | | , String ly, BigDecimal lyCoin, BigDecimal lyCash, String lyImage, BigDecimal lyInt, Integer lyId,Integer lyIId |
| | | ,String sutuName |
| | | |
| | | ) { |
| | | ) throws Exception { |
| | | |
| | | Game game = new Game(); |
| | | game.setRed(red); |
| | | game.setRedName(red); |
| | | game.setState(0); |
| | | game.setBlue(blue); |
| | | game.setBlueName(blue); |
| | | |
| | | |
| | | Integer objectType = UserExt.getUser().getObjectType(); |
| | |
| | | |
| | | // 添加sutu编号 |
| | | HashMap<String, String> map3 = new HashMap<>(); |
| | | HashMap<String, String> map4 = new HashMap<>(); |
| | | // 添加sutu编号 |
| | | // 添加门禁 红蓝方 |
| | | // 调用两次 创建sutu |
| | | TSite si = siteService.getById(site); |
| | | TStore st = storeService.getById(store); |
| | | // map3.put("sign", "0DB011836143EEE2C2E072967C9F4E4B"); |
| | | // map3.put("space_id", si.getId() + ""); |
| | | // map3.put("name", ToolUtil.isEmpty(sutuName) ? "" : sutuName); |
| | | // map3.put("city_code", ""); |
| | | // String s3 = HttpRequestUtil.postRequest("https://try.daowepark.com/v7/user_api/general/addDevice", map3); |
| | | // System.out.println("---------------------------"+s3); |
| | | // JSONObject jsonObject = new JSONObject(s3); |
| | | // // 获取 data 字段的值 |
| | | // JSONObject dataObject = jsonObject.getJSONObject("data"); |
| | | // // 获取 sutu_id 字段的值 |
| | | // String sutuIdValue = dataObject.getString("sutu_id"); |
| | | // Integer sutuId = Integer.valueOf(sutuIdValue); |
| | | // game.setSutuId(sutuId); |
| | | map3.put("sign", "0DB011836143EEE2C2E072967C9F4E4B"); |
| | | map4.put("sign", "0DB011836143EEE2C2E072967C9F4E4B"); |
| | | map3.put("space_id", st.getId() + ""); |
| | | map4.put("space_id", st.getId() + ""); |
| | | map3.put("name", blue); |
| | | map4.put("name", red); |
| | | map3.put("city_code", city); |
| | | map4.put("city_code", city); |
| | | String s3 = HttpRequestUtil.postRequest("https://try.daowepark.com/v7/user_api/general/addSpaceSutu", map3); |
| | | String s4 = HttpRequestUtil.postRequest("https://try.daowepark.com/v7/user_api/general/addSpaceSutu", map4); |
| | | System.out.println("---------------------------"+s3); |
| | | JSONObject jsonObject = new JSONObject(s3); |
| | | JSONObject jsonObject1 = new JSONObject(s4); |
| | | // 获取 data 字段的值 |
| | | JSONObject dataObject = jsonObject.getJSONObject("data"); |
| | | JSONObject dataObject1 = jsonObject1.getJSONObject("data"); |
| | | // 获取 sutu_id 字段的值 |
| | | String sutuIdValue = dataObject.getString("sutu_id"); |
| | | String sutuIdValue1 = dataObject1.getString("sutu_id"); |
| | | Integer sutuId = Integer.valueOf(sutuIdValue); |
| | | Integer sutuId1 = Integer.valueOf(sutuIdValue1); |
| | | game.setBlue(""+sutuId); |
| | | game.setRed(""+sutuId1); |
| | | |
| | | // 生成设备二维码 |
| | | HashMap<String, String> blueCode = new HashMap<>(); |
| | | blueCode.put("scan_type", "1000"); |
| | | blueCode.put("sutu_id", ""+sutuId); |
| | | blueCode.put("space_id", st.getId() + ""); |
| | | |
| | | HashMap<String, String> redCode = new HashMap<>(); |
| | | redCode.put("scan_type", "1000"); |
| | | redCode.put("sutu_id", sutuId1+""); |
| | | redCode.put("space_id", st.getId() + ""); |
| | | String blueS= "{\"scan_type\": 1000, \"space_id\": "+st.getId()+", \"sutu_id\": "+sutuId+"}"; |
| | | String redS= "{\"scan_type\": 1000, \"space_id\": "+st.getId()+", \"sutu_id\": "+sutuId1+"}"; |
| | | MyQrCodeUtil.createCodeToFile(blueS); |
| | | MyQrCodeUtil.createCodeToFile(redS); |
| | | BufferedImage blueImage = QRCodeUtil.createImage(blueS); |
| | | BufferedImage redImage = QRCodeUtil.createImage(redS); |
| | | MultipartFile blueFile = convert(blueImage, new Date().getTime()+UUIDUtil.getRandomCode(3)+".PNG"); |
| | | MultipartFile redFile = convert(redImage, new Date().getTime()+UUIDUtil.getRandomCode(3)+".PNG"); |
| | | String s = OssUploadUtil.ossUpload("img/", blueFile); |
| | | String s1 = OssUploadUtil.ossUpload("img/", redFile); |
| | | // MultipartFile multipartFile = convert(blueImage); |
| | | // MultipartFile multipartFile1 = convert(redImage); |
| | | // |
| | | // String s = OssUploadUtil.ossUpload("img/", multipartFile); |
| | | // String s1 = OssUploadUtil.ossUpload("img/", multipartFile1); |
| | | game.setBlueCode(s); |
| | | game.setRedCode(s1); |
| | | Integer gameId = ballClient.save(game); |
| | | List<TGameConfig> gameConfigList = new ArrayList<>(); |
| | | |
| | |
| | | HashMap<String, String> map2 = new HashMap<>(); |
| | | |
| | | |
| | | map1.put("sign", "0DB011836143EEE2C2E072967C9F4E4B"); |
| | | map1.put("space_id", si.getId() + ""); |
| | | map1.put("device_id", red); |
| | | map1.put("region_id", st.getId() + ""); |
| | | // 添加门禁 |
| | | String s1 = HttpRequestUtil.postRequest("https://try.daowepark.com/v7/user_api/general/addDevice", map1); |
| | | map2.put("sign", "0DB011836143EEE2C2E072967C9F4E4B"); |
| | | map2.put("space_id", si.getId() + ""); |
| | | map2.put("device_id", blue); |
| | | map2.put("region_id", st.getId() + ""); |
| | | // 添加门禁 |
| | | String s2 = HttpRequestUtil.postRequest("https://try.daowepark.com/v7/user_api/general/addDevice", map2); |
| | | // map1.put("sign", "0DB011836143EEE2C2E072967C9F4E4B"); |
| | | // map1.put("space_id", si.getId() + ""); |
| | | // map1.put("device_id", red); |
| | | // map1.put("region_id", st.getId() + ""); |
| | | // // 添加门禁 |
| | | // String s1 = HttpRequestUtil.postRequest("https://try.daowepark.com/v7/user_api/general/addDevice", map1); |
| | | // map2.put("sign", "0DB011836143EEE2C2E072967C9F4E4B"); |
| | | // map2.put("space_id", si.getId() + ""); |
| | | // map2.put("device_id", blue); |
| | | // map2.put("region_id", st.getId() + ""); |
| | | // // 添加门禁 |
| | | // String s2 = HttpRequestUtil.postRequest("https://try.daowepark.com/v7/user_api/general/addDevice", map2); |
| | | |
| | | |
| | | |
| | |
| | | super.getSession().setAttribute("language",language); |
| | | return REDIRECT + "/"; |
| | | } |
| | | |
| | | /** |
| | | * 退出登录 |
| | | */ |
| | |
| | | deleteAllCookie(); |
| | | return REDIRECT + "/login"; |
| | | } |
| | | |
| | | } |
| | |
| | | |
| | | private Integer state; |
| | | // 获取和设置方法 |
| | | private Integer sutuId; |
| | | private String sutuName; |
| | | private String redName; |
| | | private String blueName; |
| | | private String blueCode; |
| | | private String redCode; |
| | | |
| | | } |
New file |
| | |
| | | package com.dsh.guns.modular.system.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 lombok.Data; |
| | | |
| | | import java.util.Date; |
| | | |
| | | @TableName("t_gate") |
| | | @Data |
| | | public class Gate { |
| | | @TableId(value = "id", type = IdType.INPUT) |
| | | private Integer id; |
| | | // 闸机名称 |
| | | @TableField("name") |
| | | private String name; |
| | | // 硬件编号 |
| | | @TableField("device") |
| | | private String device; |
| | | // 门店id |
| | | @TableField("storeId") |
| | | private Integer storeId; |
| | | // 场地id |
| | | @TableField("siteId") |
| | | private Integer siteId; |
| | | // 运营商id 0为平台 |
| | | @TableField("operatorId") |
| | | private Integer operatorId; |
| | | // 是否删除 0否1是 |
| | | @TableField("isDelete") |
| | | private Integer isDelete; |
| | | } |
New file |
| | |
| | | package com.dsh.guns.modular.system.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 io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | /** |
| | | * 平台首页模块配置 |
| | | */ |
| | | @Data |
| | | @TableName("t_home_module") |
| | | public class HomeModule { |
| | | /** |
| | | * 主键 |
| | | */ |
| | | @TableId(value = "id", type = IdType.AUTO) |
| | | private Integer id; |
| | | /** |
| | | * 是否开通(0=否,1=是) |
| | | */ |
| | | @TableField("isOpen") |
| | | private Integer isOpen; |
| | | /** |
| | | * 标题 |
| | | */ |
| | | @TableField("title") |
| | | @ApiModelProperty("标题") |
| | | private String title; |
| | | @TableField(exist = false) |
| | | private String name; |
| | | /** |
| | | * 置顶(0=否,1=是) |
| | | */ |
| | | @TableField("isTop") |
| | | private Integer isTop; |
| | | /** |
| | | * 排序 |
| | | */ |
| | | @TableField("sort") |
| | | private Integer sort; |
| | | /** |
| | | * 背景图 |
| | | */ |
| | | @TableField("backgroundImage") |
| | | private String backgroundImage; |
| | | /** |
| | | * 按钮图片 |
| | | */ |
| | | @TableField("buttonImage") |
| | | @ApiModelProperty("按钮图片") |
| | | private String buttonImage; |
| | | /** |
| | | * 富文本内容 |
| | | */ |
| | | @TableField("content") |
| | | @ApiModelProperty("富文本内容") |
| | | private String content; |
| | | /** |
| | | * 跳转页面id |
| | | */ |
| | | @TableField("jumpPage") |
| | | private Integer jumpPage; |
| | | /** |
| | | * 跳转模块 |
| | | */ |
| | | @TableField("model") |
| | | private String model; |
| | | /** |
| | | * 跳转类型 |
| | | */ |
| | | @TableField("type") |
| | | private String type; |
| | | /** |
| | | * 跳转类型 |
| | | */ |
| | | @TableField("turnId") |
| | | private String turnId; |
| | | /** |
| | | * 跳转页面 |
| | | */ |
| | | @TableField("page") |
| | | private String page; |
| | | /** |
| | | * 跳转类型id |
| | | */ |
| | | @TableField("typeId") |
| | | private Integer typeId; |
| | | } |
| | |
| | | |
| | | String num3; |
| | | String num4; |
| | | // 场地名称 |
| | | String num5; |
| | | } |
| | |
| | | private String ids; |
| | | @TableField("sign") |
| | | private Integer sign; |
| | | @TableField("reservation") |
| | | private Integer reservation; |
| | | } |
New file |
| | |
| | | package com.dsh.guns.modular.system.service; |
| | | |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import com.dsh.course.dto.JsDto; |
| | | import com.dsh.guns.modular.system.model.*; |
| | | import com.dsh.guns.modular.system.model.dto.SelectDto; |
| | | |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | |
| | | /** |
| | | * 字典服务 |
| | | * |
| | | * @author fengshuonan |
| | | * @date 2017-04-27 17:00 |
| | | */ |
| | | public interface IGateService extends IService<Gate> { |
| | | |
| | | |
| | | List<Map<String, Object>> listAll(String name, String device, String operatorId, String storeId, List<Integer> storeIds, Page<Map<String, Object>> page); |
| | | } |
New file |
| | |
| | | package com.dsh.guns.modular.system.service; |
| | | |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import com.dsh.guns.modular.system.model.HomeModule; |
| | | |
| | | public interface IHomeModuleService extends IService<HomeModule> { |
| | | } |
| | |
| | | |
| | | |
| | | List<Map<String, Object>> listStoreAllByIds(List<Integer> ids); |
| | | List<Map<String, Object>> querySiteListOfpage(String provinceCode, String cityCode, Integer operatorId, String storeName, Page<Map<String, Object>> page); |
| | | |
| | | } |
New file |
| | |
| | | package com.dsh.guns.modular.system.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.dsh.course.dto.JsDto; |
| | | import com.dsh.course.mapper.GateMapper; |
| | | import com.dsh.course.mapper.StoreMapper; |
| | | import com.dsh.guns.modular.system.model.*; |
| | | import com.dsh.guns.modular.system.model.dto.SelectDto; |
| | | import com.dsh.guns.modular.system.service.IGateService; |
| | | import com.dsh.guns.modular.system.service.IStoreService; |
| | | import org.omg.CORBA.PRIVATE_MEMBER; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | @Service |
| | | public class GateServiceImpl extends ServiceImpl<GateMapper, Gate> implements IGateService { |
| | | @Autowired |
| | | private GateMapper gateMapper; |
| | | @Override |
| | | public List<Map<String, Object>> listAll(String name, String device, String operatorId, |
| | | String storeId, List<Integer> storeIds, Page<Map<String, Object>> page) { |
| | | return gateMapper.listAll(name,device,operatorId,storeId,storeIds,page); |
| | | } |
| | | } |
New file |
| | |
| | | package com.dsh.guns.modular.system.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.dsh.course.mapper.HomeModuleMapper; |
| | | import com.dsh.guns.modular.system.model.HomeModule; |
| | | import com.dsh.guns.modular.system.service.IHomeModuleService; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | @Service |
| | | public class HomeModuleServiceImpl extends ServiceImpl<HomeModuleMapper, HomeModule> implements IHomeModuleService { |
| | | } |
| | |
| | | return this.baseMapper.listAllStore(page,provinceCode,cityCode,name,phone,shopName,id); |
| | | } |
| | | |
| | | @Override |
| | | public List<Map<String, Object>> querySiteListOfpage(String provinceCode, String cityCode, Integer operatorId, String storeName, Page<Map<String, Object>> page) { |
| | | return this.baseMapper.querySiteListOfpage(provinceCode,cityCode,operatorId,storeName,page); |
| | | } |
| | | |
| | | /** |
| | | * 获取所有省 |
| | | * @return |
New file |
| | |
| | | package com.dsh.guns.modular.system.util; |
| | | |
| | | import com.baomidou.mybatisplus.core.toolkit.StringUtils; |
| | | import com.google.zxing.BarcodeFormat; |
| | | import com.google.zxing.EncodeHintType; |
| | | import com.google.zxing.MultiFormatWriter; |
| | | import com.google.zxing.WriterException; |
| | | import com.google.zxing.common.BitMatrix; |
| | | import com.google.zxing.qrcode.decoder.ErrorCorrectionLevel; |
| | | |
| | | import javax.imageio.ImageIO; |
| | | import javax.swing.filechooser.FileSystemView; |
| | | import java.awt.image.BufferedImage; |
| | | import java.io.File; |
| | | import java.io.OutputStream; |
| | | import java.util.HashMap; |
| | | import java.util.Map; |
| | | |
| | | public class MyQrCodeUtil { |
| | | //CODE_WIDTH:二维码宽度,单位像素 |
| | | private static final int CODE_WIDTH = 400; |
| | | //CODE_HEIGHT:二维码高度,单位像素 |
| | | private static final int CODE_HEIGHT = 400; |
| | | //FRONT_COLOR:二维码前景色,0x000000 表示黑色 |
| | | private static final int FRONT_COLOR = 0x000000; |
| | | //BACKGROUND_COLOR:二维码背景色,0xFFFFFF 表示白色 |
| | | //演示用 16 进制表示,和前端页面 CSS 的取色是一样的,注意前后景颜色应该对比明显,如常见的黑白 |
| | | private static final int BACKGROUND_COLOR = 0xFFFFFF; |
| | | public static BufferedImage createCodeToFile(String content) { |
| | | try { |
| | | content = content.trim(); |
| | | //核心代码-生成二维码 |
| | | BufferedImage bufferedImage = getBufferedImage(content); |
| | | |
| | | return bufferedImage; |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | } |
| | | return null; |
| | | } |
| | | /** |
| | | * 生成二维码并输出到输出流, 通常用于输出到网页上进行显示,输出到网页与输出到磁盘上的文件中,区别在于最后一句 ImageIO.write |
| | | * write(RenderedImage im,String formatName,File output):写到文件中 |
| | | * write(RenderedImage im,String formatName,OutputStream output):输出到输出流中 |
| | | * @param content :二维码内容 |
| | | * @param outputStream :输出流,比如 HttpServletResponse 的 getOutputStream |
| | | */ |
| | | public static void createCodeToOutputStream(String content, OutputStream outputStream) { |
| | | try { |
| | | if (StringUtils.isBlank(content)) { |
| | | return; |
| | | } |
| | | content = content.trim(); |
| | | //核心代码-生成二维码 |
| | | BufferedImage bufferedImage = getBufferedImage(content); |
| | | //区别就是这一句,输出到输出流中,如果第三个参数是 File,则输出到文件中 |
| | | ImageIO.write(bufferedImage, "png", outputStream); |
| | | System.out.println("二维码图片生成到输出流成功..."); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | //核心代码-生成二维码 |
| | | private static BufferedImage getBufferedImage(String content) throws WriterException { |
| | | //com.google.zxing.EncodeHintType:编码提示类型,枚举类型 |
| | | Map<EncodeHintType, Object> hints = new HashMap(); |
| | | //EncodeHintType.CHARACTER_SET:设置字符编码类型 |
| | | hints.put(EncodeHintType.CHARACTER_SET, "UTF-8"); |
| | | //EncodeHintType.ERROR_CORRECTION:设置误差校正 |
| | | //ErrorCorrectionLevel:误差校正等级,L = ~7% correction、M = ~15% correction、Q = ~25% correction、H = ~30% correction |
| | | //不设置时,默认为 L 等级,等级不一样,生成的图案不同,但扫描的结果是一样的 |
| | | hints.put(EncodeHintType.ERROR_CORRECTION, ErrorCorrectionLevel.M); |
| | | //EncodeHintType.MARGIN:设置二维码边距,单位像素,值越小,二维码距离四周越近 |
| | | hints.put(EncodeHintType.MARGIN, 1); |
| | | MultiFormatWriter multiFormatWriter = new MultiFormatWriter(); |
| | | BitMatrix bitMatrix = multiFormatWriter.encode(content, BarcodeFormat.QR_CODE, CODE_WIDTH, CODE_HEIGHT, hints); |
| | | BufferedImage bufferedImage = new BufferedImage(CODE_WIDTH, CODE_HEIGHT, BufferedImage.TYPE_INT_BGR); |
| | | for (int x = 0; x < CODE_WIDTH; x++) { |
| | | for (int y = 0; y < CODE_HEIGHT; y++) { |
| | | bufferedImage.setRGB(x, y, bitMatrix.get(x, y) ? FRONT_COLOR : BACKGROUND_COLOR); |
| | | } |
| | | } |
| | | return bufferedImage; |
| | | } |
| | | |
| | | public static void main(String[] args) { |
| | | String param = "{\n" + |
| | | " \"scan_type\": 1,\n" + |
| | | " \"space_id\": 2,\n" + |
| | | " \"sutu_id\": 3\n" + |
| | | "}"; |
| | | createCodeToFile(param); |
| | | } |
| | | |
| | | } |
New file |
| | |
| | | package com.dsh.guns.modular.system.util; |
| | | |
| | | import com.google.zxing.BarcodeFormat; |
| | | import com.google.zxing.EncodeHintType; |
| | | import com.google.zxing.MultiFormatWriter; |
| | | import com.google.zxing.common.BitMatrix; |
| | | import com.google.zxing.qrcode.decoder.ErrorCorrectionLevel; |
| | | |
| | | import java.awt.image.BufferedImage; |
| | | import java.util.Hashtable; |
| | | |
| | | /** |
| | | * @author chengst |
| | | * @date 2019/11/4 |
| | | **/ |
| | | public class QRCodeUtil{ |
| | | |
| | | private final static String CHARSET = "utf-8"; |
| | | |
| | | private final static int QRSIZEE = 300; |
| | | |
| | | // 二维码颜色 |
| | | private static final int BLACK = 0xFF000000; |
| | | // 二维码颜色 |
| | | private static final int WHITE = 0xFFFFFFFF; |
| | | |
| | | public static BufferedImage createImage(String content){ |
| | | Hashtable<EncodeHintType, Object> hints = new Hashtable<EncodeHintType, Object>(); |
| | | hints.put(EncodeHintType.ERROR_CORRECTION, ErrorCorrectionLevel.H); |
| | | hints.put(EncodeHintType.CHARACTER_SET, CHARSET); |
| | | hints.put(EncodeHintType.MARGIN, 1); |
| | | BitMatrix bitMatrix = null; |
| | | try { |
| | | bitMatrix = new MultiFormatWriter().encode(content, BarcodeFormat.QR_CODE, QRSIZEE, QRSIZEE,hints); |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | } |
| | | int width = bitMatrix.getWidth(); |
| | | int height = bitMatrix.getHeight(); |
| | | BufferedImage image = new BufferedImage(width, height, BufferedImage.TYPE_INT_RGB); |
| | | |
| | | for (int x = 0; x < width; x++) { |
| | | for (int y = 0; y < height; y++) { |
| | | image.setRGB(x, y, bitMatrix.get(x, y) ? BLACK : WHITE); |
| | | } |
| | | } |
| | | return image; |
| | | } |
| | | } |
| | | |
New file |
| | |
| | | package com.dsh.guns.modular.system.util; |
| | | |
| | | import com.google.zxing.*; |
| | | import com.google.zxing.client.j2se.BufferedImageLuminanceSource; |
| | | import com.google.zxing.common.BitMatrix; |
| | | import com.google.zxing.common.HybridBinarizer; |
| | | import com.google.zxing.qrcode.decoder.ErrorCorrectionLevel; |
| | | import org.slf4j.Logger; |
| | | import org.slf4j.LoggerFactory; |
| | | |
| | | import javax.imageio.ImageIO; |
| | | import java.awt.*; |
| | | import java.awt.geom.RoundRectangle2D; |
| | | import java.awt.image.BufferedImage; |
| | | import java.io.File; |
| | | import java.io.OutputStream; |
| | | import java.util.Hashtable; |
| | | import java.util.Random; |
| | | |
| | | /** |
| | | * 二维码工具类 |
| | | */ |
| | | public class QRCodeUtils { |
| | | |
| | | private static Logger logger = LoggerFactory.getLogger(QRCodeUtils.class); |
| | | |
| | | private static final String CHARSET = "utf-8"; |
| | | private static final String FORMAT_NAME = "JPG"; |
| | | // 二维码尺寸 |
| | | private static final int QRCODE_SIZE = 300; |
| | | // LOGO宽度 |
| | | private static final int WIDTH = 60; |
| | | // LOGO高度 |
| | | private static final int HEIGHT = 60; |
| | | |
| | | private static BufferedImage createImage(String content, String imgPath, |
| | | boolean needCompress) throws Exception { |
| | | Hashtable<EncodeHintType, Object> hints = new Hashtable<EncodeHintType, Object>(); |
| | | hints.put(EncodeHintType.ERROR_CORRECTION, ErrorCorrectionLevel.H); |
| | | hints.put(EncodeHintType.CHARACTER_SET, CHARSET); |
| | | hints.put(EncodeHintType.MARGIN, 1); |
| | | BitMatrix bitMatrix = new MultiFormatWriter().encode(content, |
| | | BarcodeFormat.QR_CODE, QRCODE_SIZE, QRCODE_SIZE, hints); |
| | | int width = bitMatrix.getWidth(); |
| | | int height = bitMatrix.getHeight(); |
| | | BufferedImage image = new BufferedImage(width, height, |
| | | BufferedImage.TYPE_INT_RGB); |
| | | for (int x = 0; x < width; x++) { |
| | | for (int y = 0; y < height; y++) { |
| | | image.setRGB(x, y, bitMatrix.get(x, y) ? 0xFF000000 |
| | | : 0xFFFFFFFF); |
| | | } |
| | | } |
| | | if (imgPath == null || "".equals(imgPath)) { |
| | | return image; |
| | | } |
| | | // 插入图片 |
| | | QRCodeUtils.insertImage(image, imgPath, needCompress); |
| | | return image; |
| | | } |
| | | |
| | | /** |
| | | * 插入LOGO |
| | | * |
| | | * @param source |
| | | * 二维码图片 |
| | | * @param imgPath |
| | | * LOGO图片地址 |
| | | * @param needCompress |
| | | * 是否压缩 |
| | | * @throws Exception |
| | | */ |
| | | private static void insertImage(BufferedImage source, String imgPath, |
| | | boolean needCompress) throws Exception { |
| | | File file = new File(imgPath); |
| | | if (!file.exists()) { |
| | | logger.debug(""+imgPath+" 该文件不存在!"); |
| | | return; |
| | | } |
| | | Image src = ImageIO.read(new File(imgPath)); |
| | | int width = src.getWidth(null); |
| | | int height = src.getHeight(null); |
| | | if (needCompress) { // 压缩LOGO |
| | | if (width > WIDTH) { |
| | | width = WIDTH; |
| | | } |
| | | if (height > HEIGHT) { |
| | | height = HEIGHT; |
| | | } |
| | | Image image = src.getScaledInstance(width, height, |
| | | Image.SCALE_SMOOTH); |
| | | BufferedImage tag = new BufferedImage(width, height, |
| | | BufferedImage.TYPE_INT_RGB); |
| | | Graphics g = tag.getGraphics(); |
| | | g.drawImage(image, 0, 0, null); // 绘制缩小后的图 |
| | | g.dispose(); |
| | | src = image; |
| | | } |
| | | // 插入LOGO |
| | | Graphics2D graph = source.createGraphics(); |
| | | int x = (QRCODE_SIZE - width) / 2; |
| | | int y = (QRCODE_SIZE - height) / 2; |
| | | graph.drawImage(src, x, y, width, height, null); |
| | | Shape shape = new RoundRectangle2D.Float(x, y, width, width, 6, 6); |
| | | graph.setStroke(new BasicStroke(3f)); |
| | | graph.draw(shape); |
| | | graph.dispose(); |
| | | } |
| | | |
| | | /** |
| | | * 生成二维码(内嵌LOGO) |
| | | * |
| | | * @param content |
| | | * 内容 |
| | | * @param fileName |
| | | * 文件名 |
| | | * @param imgPath |
| | | * LOGO地址 |
| | | * @param destPath |
| | | * 存放目录 |
| | | * @param needCompress |
| | | * 是否压缩LOGO |
| | | * @throws Exception |
| | | */ |
| | | public static String encode(String content, String fileName, String imgPath, String destPath, |
| | | boolean needCompress) throws Exception { |
| | | BufferedImage image = QRCodeUtils.createImage(content, imgPath, |
| | | needCompress); |
| | | mkdirs(destPath); |
| | | String file = fileName + ".jpg"; |
| | | ImageIO.write(image, FORMAT_NAME, new File(destPath + "/" + file)); |
| | | return file; |
| | | } |
| | | |
| | | /** |
| | | * 当文件夹不存在时,mkdirs会自动创建多层目录,区别于mkdir.(mkdir如果父目录不存在则会抛出异常) |
| | | * @date 2013-12-11 上午10:16:36 |
| | | * @param destPath 存放目录 |
| | | */ |
| | | public static void mkdirs(String destPath) { |
| | | File file =new File(destPath); |
| | | //当文件夹不存在时,mkdirs会自动创建多层目录,区别于mkdir.(mkdir如果父目录不存在则会抛出异常) |
| | | if (!file.exists() && !file.isDirectory()) { |
| | | file.mkdirs(); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 生成二维码(内嵌LOGO) |
| | | * |
| | | * @param content |
| | | * 内容 |
| | | * @param fileName |
| | | * 文件名 |
| | | * @param imgPath |
| | | * LOGO地址 |
| | | * @param destPath |
| | | * 存储地址 |
| | | * @throws Exception |
| | | */ |
| | | public static void encode(String content, String fileName, String imgPath, String destPath) |
| | | throws Exception { |
| | | QRCodeUtils.encode(content, fileName, imgPath, destPath, false); |
| | | } |
| | | |
| | | /** |
| | | * 生成二维码 |
| | | * |
| | | * @param content |
| | | * 内容 |
| | | * @param destPath |
| | | * 存储地址 |
| | | * @param needCompress |
| | | * 是否压缩LOGO |
| | | * @throws Exception |
| | | */ |
| | | public static void encode(String content, String fileName, String destPath, |
| | | boolean needCompress) throws Exception { |
| | | QRCodeUtils.encode(content, fileName, null, destPath, needCompress); |
| | | } |
| | | |
| | | /** |
| | | * 生成二维码 |
| | | * |
| | | * @param content |
| | | * 内容 |
| | | * @param destPath |
| | | * 存储地址 |
| | | * @throws Exception |
| | | */ |
| | | public static void encode(String content, String destPath) throws Exception { |
| | | QRCodeUtils.encode(content, null, destPath, false); |
| | | } |
| | | |
| | | /** |
| | | * 生成二维码(内嵌LOGO) |
| | | * |
| | | * @param content |
| | | * 内容 |
| | | * @param imgPath |
| | | * LOGO地址 |
| | | * @param output |
| | | * 输出流 |
| | | * @param needCompress |
| | | * 是否压缩LOGO |
| | | * @throws Exception |
| | | */ |
| | | public static void encode(String content, String imgPath, |
| | | OutputStream output, boolean needCompress) throws Exception { |
| | | BufferedImage image = QRCodeUtils.createImage(content, imgPath, |
| | | needCompress); |
| | | ImageIO.write(image, FORMAT_NAME, output); |
| | | } |
| | | |
| | | /** |
| | | * 生成二维码 |
| | | * |
| | | * @param content |
| | | * 内容 |
| | | * @param output |
| | | * 输出流 |
| | | * @throws Exception |
| | | */ |
| | | public static void encode(String content, OutputStream output) |
| | | throws Exception { |
| | | QRCodeUtils.encode(content, null, output, false); |
| | | } |
| | | |
| | | /** |
| | | * 解析二维码 |
| | | * |
| | | * @param file |
| | | * 二维码图片 |
| | | * @return |
| | | * @throws Exception |
| | | */ |
| | | public static String decode(File file) throws Exception { |
| | | BufferedImage image; |
| | | image = ImageIO.read(file); |
| | | if (image == null) { |
| | | return null; |
| | | } |
| | | BufferedImageLuminanceSource source = new BufferedImageLuminanceSource( |
| | | image); |
| | | BinaryBitmap bitmap = new BinaryBitmap(new HybridBinarizer(source)); |
| | | Result result; |
| | | Hashtable<DecodeHintType, Object> hints = new Hashtable<DecodeHintType, Object>(); |
| | | hints.put(DecodeHintType.CHARACTER_SET, CHARSET); |
| | | result = new MultiFormatReader().decode(bitmap, hints); |
| | | String resultStr = result.getText(); |
| | | return resultStr; |
| | | } |
| | | |
| | | /** |
| | | * 解析二维码 |
| | | * |
| | | * @param path |
| | | * 二维码图片地址 |
| | | * @return |
| | | * @throws Exception |
| | | */ |
| | | public static String decode(String path) throws Exception { |
| | | return QRCodeUtils.decode(new File(path)); |
| | | } |
| | | |
| | | public static void main(String[] args) throws Exception { |
| | | String text = "http://www.baidu.com"; //这里设置自定义网站url |
| | | String logoPath = "C:\\Users\\admin\\Desktop\\test\\test.jpg"; |
| | | String destPath = "C:\\Users\\admin\\Desktop\\test\\"; |
| | | logger.debug(QRCodeUtils.encode(text, "test", logoPath, destPath, true)); |
| | | } |
| | | } |
New file |
| | |
| | | <?xml version="1.0" encoding="UTF-8"?> |
| | | <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
| | | <mapper namespace="com.dsh.course.mapper.GateMapper"> |
| | | |
| | | <select id="listAll" resultType="java.util.Map"> |
| | | select t1.id as id,t1.name as name,t1.device as device, |
| | | ifNull(CONCAT(t5.name,'-',t5.phone),'平台闸机') as operatorName, |
| | | t2.name as storeName,t3.name as siteName |
| | | from t_gate t1 |
| | | left join t_store t2 on t2.id = t1.storeId |
| | | left join t_site t3 on t3.id = t1.siteId |
| | | left join t_operator t4 on t4.id = t1.operatorId |
| | | left join sys_user t5 on t5.id = t4.userId |
| | | where 1=1 and t1.isDelete = 0 |
| | | <if test="name != null and name!=''"> |
| | | and t1.name like CONCAT('%',#{name},'%') |
| | | </if> |
| | | <if test="device != null and device!=''"> |
| | | and t1.device like CONCAT('%',#{device},'%') |
| | | </if> |
| | | <if test="operatorName != null and operatorName!=''"> |
| | | and t4.name like CONCAT('%',#{operatorName},'%') |
| | | </if> |
| | | <if test="storeName != null and storeName!=''"> |
| | | and t2.name like CONCAT('%',#{storeName},'%') |
| | | </if> |
| | | <if test="storeIds != null and storeIds.size()>0"> |
| | | AND t1.storeId IN |
| | | <foreach collection="storeIds" separator="," item="id" open="(" close=")"> |
| | | #{id} |
| | | </foreach> |
| | | </if> |
| | | </select> |
| | | </mapper> |
| | |
| | | and t1.name like concat("%",#{shopName},"%") |
| | | </if> |
| | | </select> |
| | | <select id="querySiteListOfpage" resultType="java.util.Map"> |
| | | SELECT t1.id, t1.operatorId, t1.province, t1.city, t2.name,t1.ids,t1.name as siteName |
| | | from t_site t1 |
| | | left join t_store t2 on t1.storeId =t2.id |
| | | where t1.state=1 and t2.state=1 |
| | | <if test="provinceCode != null and provinceCode!=''"> |
| | | and t1.provinceCode = #{provinceCode} |
| | | </if> |
| | | <if test="cityCode != null and cityCode!=''"> |
| | | and t1.cityCode = #{cityCode} |
| | | </if> |
| | | <if test="operatorId != null and operatorId!=''"> |
| | | and t1.operatorId = #{operatorId} |
| | | </if> |
| | | <if test="storeName != null and storeName != ''"> |
| | | and t1.name like CONCAT('%',#{storeName},'%') |
| | | </if> |
| | | |
| | | </select> |
| | | |
| | | |
| | | |
| | |
| | | <div class="ibox-title"> |
| | | <h5>管理</h5> |
| | | </div> |
| | | |
| | | <div class="ibox-content"> |
| | | <div class="row row-lg"> |
| | | <div class="col-sm-12"> |
| | |
| | | }, |
| | | { |
| | | "type": "tpl", |
| | | "tpl": "                       设备ID:", |
| | | "tpl": "                       SUTU名称:", |
| | | "inline": true, |
| | | "wrapperComponent": "", |
| | | "id": "u:587781d5d181", |
| | |
| | | }, |
| | | { |
| | | "type": "tpl", |
| | | "tpl": "                       设备ID:", |
| | | "tpl": "                       SUTU名称:", |
| | | "inline": true, |
| | | "wrapperComponent": "", |
| | | "id": "u:587781d5d181", |
| | |
| | | }, |
| | | { |
| | | "type": "tpl", |
| | | "tpl": "                       设备ID:", |
| | | "tpl": "                       SUTU名称:", |
| | | "inline": true, |
| | | "wrapperComponent": "", |
| | | "id": "u:587781d5d181", |
| | |
| | | }, |
| | | { |
| | | "type": "tpl", |
| | | "tpl": "                       设备ID:", |
| | | "tpl": "                       SUTU名称:", |
| | | "inline": true, |
| | | "wrapperComponent": "", |
| | | "id": "u:587781d5d181", |
| | |
| | | "value": "", |
| | | "required": true |
| | | , |
| | | "value":`${game.blue}` |
| | | "value":`${game.blueName}` |
| | | }, |
| | | { |
| | | "type": "input-text", |
| | |
| | | "hidden": false, |
| | | "required": true |
| | | , |
| | | "value":`${game.red}` |
| | | "value":`${game.redName}` |
| | | }, |
| | | |
| | | { |
| | |
| | | }, |
| | | { |
| | | "type": "tpl", |
| | | "tpl": "                       设备ID:", |
| | | "tpl": "                       SUTU名称:", |
| | | "inline": true, |
| | | "wrapperComponent": "", |
| | | "id": "u:587781d5d181", |
| | |
| | | "value": "", |
| | | "required": true |
| | | , |
| | | "value":`${game.blue}` |
| | | "value":`${game.blueName}` |
| | | }, |
| | | { |
| | | "type": "input-text", |
| | |
| | | "hidden": false, |
| | | "required": true |
| | | , |
| | | "value":`${game.red}` |
| | | "value":`${game.redName}` |
| | | }, |
| | | { |
| | | "type": "button", |
| | |
| | | }, |
| | | { |
| | | "type": "tpl", |
| | | "tpl": "                       设备ID:", |
| | | "tpl": "                       SUTU名称:", |
| | | "inline": true, |
| | | "wrapperComponent": "", |
| | | "id": "u:587781d5d181", |
| | |
| | | "value": "", |
| | | "required": true |
| | | , |
| | | "value":`${game.blue}` |
| | | "value":`${game.blueName}` |
| | | }, |
| | | { |
| | | "type": "input-text", |
| | |
| | | "hidden": false, |
| | | "required": true |
| | | , |
| | | "value":`${game.red}` |
| | | "value":`${game.redName}` |
| | | }, |
| | | { |
| | | "type": "button", |
| | |
| | | }, |
| | | { |
| | | "type": "tpl", |
| | | "tpl": "                       设备ID:", |
| | | "tpl": "                       SUTU名称:", |
| | | "inline": true, |
| | | "wrapperComponent": "", |
| | | "id": "u:587781d5d181", |
| | |
| | | "value": "", |
| | | "required": true |
| | | , |
| | | "value":`${game.blue}` |
| | | "value":`${game.blueName}` |
| | | }, |
| | | { |
| | | "type": "input-text", |
| | |
| | | "hidden": false, |
| | | "required": true |
| | | , |
| | | "value":`${game.red}` |
| | | "value":`${game.redName}` |
| | | }, |
| | | { |
| | | "type": "button", |
New file |
| | |
| | | @layout("/common/_container.html"){ |
| | | <style> |
| | | .avatar-uploader .el-upload { |
| | | border: 1px dashed #d9d9d9; |
| | | border-radius: 6px; |
| | | cursor: pointer; |
| | | position: relative; |
| | | height: 100px; |
| | | width: 100px; |
| | | overflow: hidden; |
| | | } |
| | | |
| | | .avatar-uploader .el-upload:hover { |
| | | border-color: #409EFF; |
| | | } |
| | | .avatar-uploader-icon { |
| | | font-size: 28px; |
| | | color: #8c939d; |
| | | width: 100px; |
| | | height: 100px; |
| | | line-height: 100px; |
| | | margin-top: 32px; |
| | | text-align: center; |
| | | } |
| | | .avatar { |
| | | width: 100px; |
| | | height: 100px; |
| | | display: block; |
| | | } |
| | | |
| | | .col-sm-12 { |
| | | margin-top: 20px; |
| | | } |
| | | |
| | | .col-sm-12 select { |
| | | height: 33px; |
| | | } |
| | | #app1{ |
| | | margin-left: 255px; |
| | | } |
| | | |
| | | |
| | | </style> |
| | | <script type="text/javascript" src="http://webapi.amap.com/maps?v=1.4.15&key=77b37f0753049c4e712ea79a24e0719c"></script> |
| | | <div class="ibox float-e-margins"> |
| | | <input hidden id="roleType" value="${roleType}"> |
| | | <div class="ibox-content"> |
| | | <div class="form-horizontal" id="carInfoForm"> |
| | | <#avatar id="cover3" name="*我的券包(推荐像素:780x560px):" avatarImg="${c3}"/><span></span> |
| | | <#avatar id="cover4" name="*线上商城(推荐像素:780x560px):" avatarImg="${c4}"/><span ></span> |
| | | <#avatar id="cover5" name="*本周福利(推荐像素:616x402px):" avatarImg="${c5}"/><span></span> |
| | | <#avatar id="cover6" name="*今日免费(推荐像素:616x402px):" avatarImg="${c6}"/><span></span> |
| | | <div class="row btn-group-m-t"> |
| | | <div class="col-sm-10 col-sm-offset-5" > |
| | | <#button btnCss="info" name="提交" id="ensure" icon="fa-check" clickFun="TSite.addBenefits()"/> |
| | | <#button btnCss="danger" name="关闭" id="cancel" icon="fa-eraser" clickFun="TSite.close()"/> |
| | | </div> |
| | | </div> |
| | | |
| | | </div> |
| | | </div> |
| | | |
| | | </div> |
| | | |
| | | </div> |
| | | |
| | | <script src="${ctxPath}/modular/system/advertisement/advertisement.js"></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> |
| | | $(function(){ |
| | | var carPhoto1 = new $WebUpload("cover3"); |
| | | carPhoto1.setUploadBarId("progressBar"); |
| | | carPhoto1.init(); |
| | | var carPhoto2 = new $WebUpload("cover4"); |
| | | carPhoto2.setUploadBarId("progressBar"); |
| | | carPhoto2.init(); |
| | | var carPhoto7 = new $WebUpload("cover5"); |
| | | carPhoto7.setUploadBarId("progressBar"); |
| | | carPhoto7.init(); |
| | | var carPhoto8 = new $WebUpload("cover6"); |
| | | carPhoto8.setUploadBarId("progressBar"); |
| | | carPhoto8.init(); |
| | | }); |
| | | </script> |
| | | @} |
New file |
| | |
| | | @layout("/common/_container.html"){ |
| | | <link href="${ctxPath}/static/css/plugins/switchery/switchery.css" rel="stylesheet"> |
| | | <style> |
| | | .table1{ |
| | | display: inline; |
| | | width: 33.333333333333333333333333333333333333%; |
| | | float:left; |
| | | text-align:center; |
| | | border-collapse:collapse; |
| | | font-size: 18px; |
| | | } |
| | | .table2{ |
| | | display: inline; |
| | | width: 50%; |
| | | float:left; |
| | | text-align:center; |
| | | border-collapse:collapse; |
| | | font-size: 18px; |
| | | } |
| | | .table3{ |
| | | display: inline; |
| | | width: 50%; |
| | | float:left; |
| | | text-align:center; |
| | | border-collapse:collapse; |
| | | font-size: 18px; |
| | | } |
| | | .table1:hover{ |
| | | background-color: rgba(255,0,0,.3); |
| | | } |
| | | .newWidth, .single-line{ |
| | | max-width:150px !important;display: initial !important; |
| | | } |
| | | .companyValueClass td:first-child { |
| | | display: flex; |
| | | align-items: center; |
| | | justify-content: center; |
| | | } |
| | | </style> |
| | | <div class="ibox float-e-margins"> |
| | | <div class="ibox-content"> |
| | | <div class="form-horizontal"> |
| | | <#avatar id="cover1" name="*无学员配置(推荐像素:宽度780px):" avatarImg="${c1}"/> |
| | | <#avatar id="cover2" name="*成为会员(推荐像素:宽度780px):" avatarImg="${c2}" /> |
| | | <#avatar id="cover7" name="*启动页配置(推荐像素:宽度780px):" avatarImg="${c7}"/> |
| | | </div> |
| | | <div class="row btn-group-m-t"> |
| | | <div class="col-sm-10 col-sm-offset-5" > |
| | | <#button btnCss="info" name="提交" id="ensure" icon="fa-check" clickFun="TSite.addConfig()"/> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | |
| | | |
| | | <script src="${ctxPath}/modular/system/dataStatistics/echarts.min.js"></script> |
| | | <script src="${ctxPath}/modular/system/advertisement/advertisement.js"></script> |
| | | <script src="${ctxPath}/static/js/plugins/switchery/switchery.js"></script> |
| | | <script> |
| | | $(function(){ |
| | | |
| | | |
| | | getContent(1); |
| | | }); |
| | | function getContent(type){ |
| | | |
| | | //设置点击字体颜色效果 |
| | | for(var i=1;i<4;i++){ |
| | | document.getElementById("div"+i).style.color="#888888";// |
| | | document.getElementById("div"+i).style.backgroundColor =""; |
| | | $("#content"+i).hide(); |
| | | } |
| | | //设置点击背景颜色效果 |
| | | document.getElementById("div"+type).style.color="white";// |
| | | document.getElementById("div"+type).style.backgroundColor ="rgb(26, 179, 148)"; |
| | | $("#type").val(type); |
| | | $("#content"+type).show(); |
| | | if(type!=3){ |
| | | $("#ensure").hide(); |
| | | $("#nextB").show(); |
| | | }else{ |
| | | $("#ensure").show(); |
| | | $("#nextB").hide(); |
| | | } |
| | | } |
| | | </script> |
| | | @} |
New file |
| | |
| | | @layout("/common/_container.html"){ |
| | | <style> |
| | | .avatar-uploader .el-upload { |
| | | border: 1px dashed #d9d9d9; |
| | | border-radius: 6px; |
| | | cursor: pointer; |
| | | position: relative; |
| | | height: 100px; |
| | | width: 100px; |
| | | overflow: hidden; |
| | | } |
| | | |
| | | .avatar-uploader .el-upload:hover { |
| | | border-color: #409EFF; |
| | | } |
| | | .avatar-uploader-icon { |
| | | font-size: 28px; |
| | | color: #8c939d; |
| | | width: 100px; |
| | | height: 100px; |
| | | line-height: 100px; |
| | | margin-top: 32px; |
| | | text-align: center; |
| | | } |
| | | .avatar { |
| | | width: 100px; |
| | | height: 100px; |
| | | display: block; |
| | | } |
| | | |
| | | .col-sm-12 { |
| | | margin-top: 20px; |
| | | } |
| | | |
| | | .col-sm-12 select { |
| | | height: 33px; |
| | | } |
| | | #app1{ |
| | | margin-left: 255px; |
| | | } |
| | | |
| | | |
| | | </style> |
| | | <script type="text/javascript" src="http://webapi.amap.com/maps?v=1.4.15&key=77b37f0753049c4e712ea79a24e0719c"></script> |
| | | <div class="ibox float-e-margins"> |
| | | <input hidden id="roleType" value="${roleType}"> |
| | | <input hidden id="type1" value="${type}"> |
| | | <input hidden id="turnId" value="${data.turnId}"> |
| | | <input hidden id="id" value="${data.id}"> |
| | | <input hidden id="img1" value="${data.img}"> |
| | | <div class="ibox-content"> |
| | | <div class="form-horizontal" id="carInfoForm"> |
| | | @if(roleType==1){ |
| | | <div class="form-group"> |
| | | <label class="col-sm-3 control-label">*广告类型:</label> |
| | | <div class="col-sm-9"> |
| | | <select style="width: 300px" class="form-control" id="position" onchange="updatePosition(this)" name = "position"> |
| | | <option value="">选择类型</option> |
| | | <option value="1" ${data.position == 1 ? 'selected=selected' : ''}>首页banner</option> |
| | | <option value="2" ${data.position == 2 ? 'selected=selected' : ''}>线上课得积分</option> |
| | | <option value="3" ${data.position == 3 ? 'selected=selected' : ''}>看视频得奖励</option> |
| | | <option value="4" ${data.position == 4 ? 'selected=selected' : ''}>常见问题</option> |
| | | </select> |
| | | </div> |
| | | </div> |
| | | @} |
| | | <div class="form-group" > |
| | | <label class="col-sm-3 control-label">*广告名称:</label> |
| | | <div class="col-sm-9" style="display: flex;"> |
| | | <input style="width: 300px" class="form-control" value="${data.name}" id="name" name="name" placeholder="请输入广告名称" type="text"> |
| | | </div> |
| | | </div> |
| | | |
| | | <div class="form-group"> |
| | | <label class="col-sm-3 control-label">*广告图片:</label> |
| | | <div class="col-sm-9" style="display: flex;"> |
| | | <#avatar id="img" name="" avatarImg="${data.img}"/><span id = "imgPX">推荐像素:</span> |
| | | </div> |
| | | </div> |
| | | @if(roleType == 1){ |
| | | <div class="form-group"> |
| | | <label class="col-sm-3 control-label">*跳转模块:</label> |
| | | <div class="col-sm-9"> |
| | | <select style="width: 300px" class="form-control" id="model" name = "model" onchange="updateType(this)"> |
| | | <option value="">请选择</option> |
| | | <option value="0"${data.model == '不跳转' ? 'selected=selected' : ''}>不跳转</option> |
| | | <option value="1"${data.model == '加入玩湃' ? 'selected=selected' : ''}>加入玩湃</option> |
| | | <option value="2"${data.model == '开始课程' ? 'selected=selected' : ''}>开始课程</option> |
| | | <option value="3"${data.model == '使用福利' ? 'selected=selected' : ''}>使用福利</option> |
| | | <option value="4"${data.model == '探索玩湃' ? 'selected=selected' : ''}>探索玩湃</option> |
| | | </select> |
| | | </div> |
| | | </div> |
| | | @} |
| | | <div class="form-group" id="t1"> |
| | | <label class="col-sm-3 control-label">*跳转页面:</label> |
| | | <div class="col-sm-9"> |
| | | <select style="width: 300px" class="form-control" id="page" name = "page" onchange="updateOne(this)"> |
| | | <option value="">请选择</option> |
| | | @for(obj in pages){ |
| | | <option value="${obj.id}" ${obj.id == data.jumpPage ? 'selected=selected' : ''}>${obj.name}</option> |
| | | @} |
| | | </select> |
| | | </div> |
| | | </div> |
| | | @if(roleType == 1){ |
| | | <div class="form-group" id="t2"> |
| | | <label class="col-sm-3 control-label">*跳转类型:</label> |
| | | <div class="col-sm-9"> |
| | | <select style="width: 300px" class="form-control" id="type" name = "page" onchange="updateT(this)"> |
| | | <option value="">请选择</option> |
| | | @for(obj in types){ |
| | | <option value="${obj.id}" ${obj.id == data.typeId ? 'selected=selected' : ''}>${obj.name}</option> |
| | | @} |
| | | </select> |
| | | </div> |
| | | </div> |
| | | |
| | | <div class="form-group" id="t3"> |
| | | <label class="col-sm-3 control-label">*跳转ID:</label> |
| | | <div class="col-sm-9" style="display: flex;"> |
| | | <input style="width: 300px" value="${data.turnId}" class="form-control" id="pageId" name="name" placeholder="请输入跳转id" type="number"> |
| | | </div> |
| | | </div> |
| | | |
| | | @} |
| | | <div class="form-group" > |
| | | <label class="col-sm-3 control-label">*排序:</label> |
| | | <div class="col-sm-9" style="display: flex;"> |
| | | <input style="width: 300px" class="form-control" value="${data.sort}" id="sort" name="sort" placeholder="请输入排序" type="number"> |
| | | <span style="margin-left: 5px;margin-top: 5px">数字越大 权重越大</span> |
| | | </div> |
| | | </div> |
| | | |
| | | <div class="row btn-group-m-t"> |
| | | <div class="col-sm-10 col-sm-offset-5" > |
| | | @if(type==2){ |
| | | <#button btnCss="info" name="提交" id="ensure" icon="fa-check" clickFun="TSite.updateSubmit()"/> |
| | | @} |
| | | <#button btnCss="danger" name="关闭" id="cancel" icon="fa-eraser" clickFun="TSite.close()"/> |
| | | </div> |
| | | </div> |
| | | |
| | | </div> |
| | | </div> |
| | | |
| | | </div> |
| | | |
| | | </div> |
| | | |
| | | <script src="${ctxPath}/modular/system/advertisement/advertisement.js"></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: '#time', |
| | | range:true |
| | | }); |
| | | |
| | | |
| | | |
| | | |
| | | function updateType(e) { |
| | | let name = $("#model").val(); |
| | | console.log(name); |
| | | if(name =='0'){ |
| | | $("#t1").hide() |
| | | $("#t2").hide() |
| | | $("#t3").hide() |
| | | $("#t1").val("") |
| | | $("#t2").val("") |
| | | $("#t3").val("") |
| | | $("#page").val("") |
| | | $("#type").val("") |
| | | $("#pageId").val("") |
| | | }else { |
| | | $("#t1").show() |
| | | $("#t2").show() |
| | | $("#t3").show() |
| | | |
| | | var oneId = $('#model option:selected').text(); |
| | | var ajax = new $ax(Feng.ctxPath + "/tShop/typeChange", function(data){ |
| | | if(data!=null){ |
| | | var content = '<option value="">请选择</option>'; |
| | | $.each(data, function(k,v) { |
| | | |
| | | content += "<option value='"+v.id+"'>"+v.name+"</option>"; |
| | | }); |
| | | $("#page").empty().append(content); |
| | | } |
| | | }); |
| | | ajax.set("name",oneId); |
| | | ajax.start(); |
| | | } |
| | | |
| | | |
| | | } |
| | | |
| | | |
| | | function updateOne(e) { |
| | | console.log($('#page option:selected').text()) |
| | | var page= $('#page option:selected').text(); |
| | | if (page=="门店列表" || page=="主页" || page=="充值中心"){ |
| | | $("#t3").hide(); |
| | | $("#t2").hide(); |
| | | $("#t2").val("") |
| | | $("#t3").val("") |
| | | $("#type").val("") |
| | | $("#pageId").val("") |
| | | } |
| | | var oneId=$(e).val(); |
| | | var ajax = new $ax(Feng.ctxPath + "/tShop/typeChangeOne", function(data){ |
| | | if(data!=null&&data.length>0){ |
| | | $("#t2").show() |
| | | var content1 = '<option value="">请选择</option>'; |
| | | $.each(data, function(k,v) { |
| | | content1 += "<option value='"+v.id+"'>"+v.name+"</option>"; |
| | | }); |
| | | $("#type").empty().append(content1); |
| | | }else{ |
| | | console.log("=-======0000") |
| | | $("#t2").val("") |
| | | $("#t2").hide() |
| | | $("#type").val("") |
| | | |
| | | } |
| | | }); |
| | | if (oneId==2 || oneId==25|| oneId==27){ |
| | | $("#t3").val("") |
| | | $("#t3").hide() |
| | | |
| | | $("#pageId").val("") |
| | | } |
| | | ajax.set("id",oneId); |
| | | ajax.start(); |
| | | updateT(document.getElementById("type")); |
| | | |
| | | } |
| | | |
| | | function updatePosition(e) { |
| | | var oneId=$(e).val(); |
| | | var res= document.getElementById("imgPX"); |
| | | console.log(res) |
| | | if (oneId == "1"){ |
| | | res.innerHTML ="推荐像素:780x472px"; |
| | | }else{ |
| | | res.innerHTML ="推荐像素:780x440px"; |
| | | } |
| | | console.log(oneId) |
| | | } |
| | | function updateT(e) { |
| | | var oneId = $('#type option:selected').text(); |
| | | console.log(oneId); |
| | | if (oneId!="详情"&&oneId!="指定商品"&&oneId!="指定折扣"){ |
| | | $("#t3").hide() |
| | | $("#t3").val("") |
| | | $("#pageId").val("") |
| | | |
| | | }else{ |
| | | $("#t3").show() |
| | | } |
| | | var page = $('#page option:selected').text(); |
| | | if (page=="线上课得积分" || page=="看视频得奖励"){ |
| | | if (oneId == "列表"){ |
| | | $("#t3").show() |
| | | } |
| | | } |
| | | } |
| | | window.onload = function() { |
| | | if ($('#model option:selected').text()=="不跳转"){ |
| | | $("#t1").hide(); |
| | | $("#t2").hide(); |
| | | $("#t3").hide(); |
| | | $("#page").val("") |
| | | $("#type").val("") |
| | | $("#pageId").val("") |
| | | } |
| | | |
| | | var temp = $("#turnId").val(); |
| | | var res= document.getElementById("imgPX"); |
| | | res.innerHTML ="推荐像素:780x472px"; |
| | | if (temp==""){ |
| | | $("#t3").hide(); |
| | | $("#t3").val("") |
| | | $("#pageId").val("") |
| | | } |
| | | // 查看跳转页面 有没有跳转类型 |
| | | var page = $('#page option:selected').text(); |
| | | if (page=="门店列表" || page=="主页" || page=="充值中心" ){ |
| | | $("#t2").hide(); |
| | | $("#t3").hide(); |
| | | $("#t2").val("") |
| | | $("#t3").val("") |
| | | $("#type").val("") |
| | | $("#pageId").val("") |
| | | } |
| | | } |
| | | </script> |
| | | @} |
New file |
| | |
| | | @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="device" name="硬件编号" /> |
| | | </div> |
| | | <div class="col-sm-3"> |
| | | <#NameCon id="operatorName" name="所属运营商" /> |
| | | </div> |
| | | <div class="col-sm-3"> |
| | | <#NameCon id="storeName" name="所属门店" /> |
| | | </div> |
| | | <div class="col-sm-3"> |
| | | <#button name="搜索" icon="fa-search" clickFun="TSite.search()"/> |
| | | <#button name="重置" icon="fa-trash" clickFun="TSite.resetSearch()" space="true"/> |
| | | </div> |
| | | </div> |
| | | <div class="hidden-xs" id="TCompetitionTableToolbar" role="group"> |
| | | @if(shiro.hasPermission("/gate/add")){ |
| | | <#button name="添加" icon="fa-plus" clickFun="TSite.openAddTSite()"/> |
| | | @} |
| | | @if(shiro.hasPermission("/gate/update")){ |
| | | <#button name="编辑" icon="fa-edit" clickFun="TSite.openEditTSite()" space="true"/> |
| | | @} |
| | | @if(shiro.hasPermission("/gate/delete")){ |
| | | <#button name="删除" icon="fa-check" clickFun="TSite.delete()" space="true"/> |
| | | @} |
| | | </div> |
| | | <#table id="TSiteTable"/> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | <script src="${ctxPath}/modular/system/gate/gate.js"></script> |
| | | <script> |
| | | |
| | | </script> |
| | | @} |
New file |
| | |
| | | @layout("/common/_container.html"){ |
| | | <style> |
| | | .avatar-uploader .el-upload { |
| | | border: 1px dashed #d9d9d9; |
| | | border-radius: 6px; |
| | | cursor: pointer; |
| | | position: relative; |
| | | height: 100px; |
| | | width: 100px; |
| | | overflow: hidden; |
| | | } |
| | | |
| | | .avatar-uploader .el-upload:hover { |
| | | border-color: #409EFF; |
| | | } |
| | | .avatar-uploader-icon { |
| | | font-size: 28px; |
| | | color: #8c939d; |
| | | width: 100px; |
| | | height: 100px; |
| | | line-height: 100px; |
| | | margin-top: 32px; |
| | | text-align: center; |
| | | } |
| | | .avatar { |
| | | width: 100px; |
| | | height: 100px; |
| | | display: block; |
| | | } |
| | | |
| | | .col-sm-12 { |
| | | margin-top: 20px; |
| | | } |
| | | |
| | | .col-sm-12 select { |
| | | height: 33px; |
| | | } |
| | | #app1{ |
| | | margin-left: 255px; |
| | | } |
| | | |
| | | |
| | | </style> |
| | | <script type="text/javascript" src="http://webapi.amap.com/maps?v=1.4.15&key=77b37f0753049c4e712ea79a24e0719c"></script> |
| | | <div class="ibox float-e-margins"> |
| | | <input hidden id="userType" value="${userType}"> |
| | | @if(userType!=1){ |
| | | <input hidden id="operatorId" value="${operatorId}"> |
| | | @} |
| | | @if(userType==3){ |
| | | <input hidden id="storeId" value="${storeId}"> |
| | | @} |
| | | <div class="ibox-content"> |
| | | <div class="form-horizontal" id="carInfoForm"> |
| | | @if(userType==1){ |
| | | <div class="form-group"> |
| | | <label class="col-sm-3 control-label">*闸机类型:</label> |
| | | <div class="col-sm-9"> |
| | | <input type="radio" name="type" value="0" checked onclick="updateType(0)"> 平台闸机 |
| | | <input type="radio" name="type" value="1" onclick="updateType(1)" id="radio1" > 运营商闸机 |
| | | </div> |
| | | </div> |
| | | @} |
| | | <div class="form-group" > |
| | | <label class="col-sm-3 control-label">*闸机名称:</label> |
| | | <div class="col-sm-9" style="display: flex;"> |
| | | <input style="width: 300px" class="form-control" id="name" name="name" placeholder="请输入闸机名称" > |
| | | </div> |
| | | </div> |
| | | @if(userType==1){ |
| | | <div id = "yys" class="form-group" > |
| | | <label class="col-sm-3 control-label">*所属运营商:</label> |
| | | <div class="col-sm-9"> |
| | | <select class="form-control" disabled id="account" name="account" onchange="TCarInfoDlg.getStore(this)" > |
| | | <option value="">选择运营商</option> |
| | | @for(i in yysList){ |
| | | <option value="${i.id}">${i.name}</option> |
| | | @} |
| | | </select> |
| | | </div> |
| | | </div> |
| | | @} |
| | | @if(userType!=3){ |
| | | <div class="form-group"> |
| | | <label class="col-sm-3 control-label">*所属门店:</label> |
| | | <div class="col-sm-9"> |
| | | <select class="form-control" id="store" name="account" onchange="TCarInfoDlg.getSite(this)" > |
| | | <option value="">选择门店</option> |
| | | @for(i in storeList){ |
| | | <option value="${i.id}">${i.name}</option> |
| | | @} |
| | | </select> |
| | | </div> |
| | | </div> |
| | | @} |
| | | @if(userType!=3){ |
| | | <div class="form-group"> |
| | | <label class="col-sm-3 control-label">*所属场地:</label> |
| | | <div class="col-sm-9"> |
| | | <select class="form-control" id="site" name="account" > |
| | | <option value="">选择场地</option> |
| | | </select> |
| | | </div> |
| | | </div> |
| | | @} |
| | | @if(userType==3){ |
| | | <div class="form-group"> |
| | | <label class="col-sm-3 control-label">*所属场地:</label> |
| | | <div class="col-sm-9"> |
| | | <select class="form-control" id="site" name="account" > |
| | | <option value="">选择场地</option> |
| | | @for(i in siteList){ |
| | | <option value="${i.id}">${i.name}</option> |
| | | @} |
| | | </select> |
| | | </div> |
| | | </div> |
| | | @} |
| | | <div class="form-group" > |
| | | <label class="col-sm-3 control-label">*硬件编号:</label> |
| | | <div class="col-sm-9" style="display: flex;"> |
| | | <input style="width: 300px" class="form-control" id="device" name="device" placeholder="请输入硬件编号" > |
| | | </div> |
| | | </div> |
| | | <div class="row btn-group-m-t"> |
| | | <div class="col-sm-10 col-sm-offset-5" > |
| | | <#button btnCss="info" name="提交" id="ensure" icon="fa-check" clickFun="TCarInfoDlg.addSubmit()"/> |
| | | <#button btnCss="danger" name="关闭" id="cancel" icon="fa-eraser" clickFun="TCarInfoDlg.close()"/> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | <script src="${ctxPath}/modular/system/gate/gate_info.js"></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: '#time', |
| | | range:true |
| | | }); |
| | | |
| | | function updateType(e) { |
| | | var selectElement = document.getElementById('account'); |
| | | var storeSelect = document.getElementById("store"); |
| | | var siteSelect = document.getElementById("site"); |
| | | |
| | | // $("#store").empty(); |
| | | // $("#site").empty(); |
| | | if(e =='0'){ |
| | | selectElement.innerHTML = '<option value="">请选择运营商</option>'; |
| | | storeSelect.innerHTML = '<option value="">请选择门店</option>'; |
| | | siteSelect.innerHTML = '<option value="">请选择场地</option>'; |
| | | selectElement.disabled = true; |
| | | var ajax = new $ax(Feng.ctxPath + "/gate/getStore", function(data){ |
| | | if(data!=null){ |
| | | var content="<option value=''>选择门店</option>"; |
| | | $.each(data, function(k,v) { |
| | | content += "<option value='"+v.id+"'>"+v.name+"</option>"; |
| | | }); |
| | | $("#store").empty().append(content); |
| | | } |
| | | }); |
| | | ajax.set("operatorId",e); |
| | | ajax.start(); |
| | | |
| | | }else { |
| | | selectElement.disabled = false; |
| | | var ajax = new $ax(Feng.ctxPath + "/tShop/typeChange", function(data){ |
| | | if(data!=null){ |
| | | var content = '<option value="">请选择</option>'; |
| | | $.each(data, function(k,v) { |
| | | |
| | | content += "<option value='"+v.id+"'>"+v.name+"</option>"; |
| | | }); |
| | | $("#page").empty().append(content); |
| | | } |
| | | }); |
| | | ajax.set("name",oneId); |
| | | ajax.start(); |
| | | } |
| | | var pageElement = document.getElementById('page'); |
| | | var event = new Event('change'); |
| | | pageElement.dispatchEvent(event); |
| | | } |
| | | |
| | | |
| | | |
| | | function updatePosition(e) { |
| | | var oneId=$(e).val(); |
| | | var res= document.getElementById("imgPX"); |
| | | console.log(res) |
| | | if (oneId == "1"){ |
| | | res.innerHTML ="推荐像素:780x472px"; |
| | | }else{ |
| | | res.innerHTML ="推荐像素:780x440px"; |
| | | } |
| | | console.log(oneId) |
| | | } |
| | | |
| | | </script> |
| | | @} |
New file |
| | |
| | | @layout("/common/_container.html"){ |
| | | <style> |
| | | .avatar-uploader .el-upload { |
| | | border: 1px dashed #d9d9d9; |
| | | border-radius: 6px; |
| | | cursor: pointer; |
| | | position: relative; |
| | | height: 100px; |
| | | width: 100px; |
| | | overflow: hidden; |
| | | } |
| | | |
| | | .avatar-uploader .el-upload:hover { |
| | | border-color: #409EFF; |
| | | } |
| | | .avatar-uploader-icon { |
| | | font-size: 28px; |
| | | color: #8c939d; |
| | | width: 100px; |
| | | height: 100px; |
| | | line-height: 100px; |
| | | margin-top: 32px; |
| | | text-align: center; |
| | | } |
| | | .avatar { |
| | | width: 100px; |
| | | height: 100px; |
| | | display: block; |
| | | } |
| | | |
| | | .col-sm-12 { |
| | | margin-top: 20px; |
| | | } |
| | | |
| | | .col-sm-12 select { |
| | | height: 33px; |
| | | } |
| | | #app1{ |
| | | margin-left: 255px; |
| | | } |
| | | |
| | | |
| | | </style> |
| | | <script type="text/javascript" src="http://webapi.amap.com/maps?v=1.4.15&key=77b37f0753049c4e712ea79a24e0719c"></script> |
| | | <div class="ibox float-e-margins"> |
| | | <input hidden id="userType" value="${userType}"> |
| | | <input hidden id="id" value="${id}"> |
| | | @if(userType!=1){ |
| | | <input hidden id="operatorId" value="${operatorId}"> |
| | | @} |
| | | @if(userType==3){ |
| | | <input hidden id="storeId" value="${storeId}"> |
| | | @} |
| | | <div class="ibox-content"> |
| | | <div class="form-horizontal" id="carInfoForm"> |
| | | @if(userType==1){ |
| | | <div class="form-group"> |
| | | <label class="col-sm-3 control-label">*闸机类型:</label> |
| | | <div class="col-sm-9"> |
| | | <input type="radio" name="type" value="0" checked onclick="updateType(0)"> 平台闸机 |
| | | <input type="radio" name="type" value="1" onclick="updateType(1)" id="radio1" > 运营商闸机 |
| | | </div> |
| | | </div> |
| | | @} |
| | | <div class="form-group" > |
| | | <label class="col-sm-3 control-label">*闸机名称:</label> |
| | | <div class="col-sm-9" style="display: flex;"> |
| | | <input style="width: 300px" class="form-control" id="name" value="${data.name}" name="name" placeholder="请输入闸机名称" > |
| | | </div> |
| | | </div> |
| | | @if(userType==1){ |
| | | <div id = "yys" class="form-group" > |
| | | <label class="col-sm-3 control-label">*所属运营商:</label> |
| | | <div class="col-sm-9"> |
| | | <select class="form-control" disabled id="account" name="account" onchange="TCarInfoDlg.getStore(this)" > |
| | | @for(obj in yysList){ |
| | | <option value="${obj.id}" ${obj.id == data.operatorId ? 'selected=selected' : ''}>${obj.name}</option> |
| | | @} |
| | | </select> |
| | | </div> |
| | | </div> |
| | | @} |
| | | @if(userType!=3){ |
| | | <div class="form-group"> |
| | | <label class="col-sm-3 control-label">*所属门店:</label> |
| | | <div class="col-sm-9"> |
| | | <select class="form-control" id="store" name="account" onchange="TCarInfoDlg.getSite(this)" > |
| | | @for(obj in storeList){ |
| | | <option value="${obj.id}" ${obj.id == data.storeId ? 'selected=selected' : ''}>${obj.name}</option> |
| | | @} |
| | | </select> |
| | | </div> |
| | | </div> |
| | | @} |
| | | <div class="form-group"> |
| | | <label class="col-sm-3 control-label">*所属场地:</label> |
| | | <div class="col-sm-9"> |
| | | <select class="form-control" id="site" name="account" > |
| | | @for(obj in siteList){ |
| | | <option value="${obj.id}" ${obj.id == data.siteId ? 'selected=selected' : ''}>${obj.name}</option> |
| | | @} |
| | | </select> |
| | | </div> |
| | | </div> |
| | | <div class="form-group" > |
| | | <label class="col-sm-3 control-label">*硬件编号:</label> |
| | | <div class="col-sm-9" style="display: flex;"> |
| | | <input style="width: 300px" class="form-control" value="${data.device}" id="device" name="device" placeholder="请输入硬件编号" > |
| | | </div> |
| | | </div> |
| | | <div class="row btn-group-m-t"> |
| | | <div class="col-sm-10 col-sm-offset-5" > |
| | | <#button btnCss="info" name="提交" id="ensure" icon="fa-check" clickFun="TCarInfoDlg.editSubmit()"/> |
| | | <#button btnCss="danger" name="关闭" id="cancel" icon="fa-eraser" clickFun="TCarInfoDlg.close()"/> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | <script src="${ctxPath}/modular/system/gate/gate_info.js"></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: '#time', |
| | | range:true |
| | | }); |
| | | |
| | | function updateType(e) { |
| | | var selectElement = document.getElementById('account'); |
| | | var storeSelect = document.getElementById("store"); |
| | | var siteSelect = document.getElementById("site"); |
| | | |
| | | // $("#store").empty(); |
| | | // $("#site").empty(); |
| | | if(e =='0'){ |
| | | selectElement.innerHTML = '<option value="">请选择运营商</option>'; |
| | | storeSelect.innerHTML = '<option value="">请选择门店</option>'; |
| | | siteSelect.innerHTML = '<option value="">请选择场地</option>'; |
| | | selectElement.disabled = true; |
| | | var ajax = new $ax(Feng.ctxPath + "/gate/getStore", function(data){ |
| | | if(data!=null){ |
| | | var content="<option value=''>选择门店</option>"; |
| | | $.each(data, function(k,v) { |
| | | content += "<option value='"+v.id+"'>"+v.name+"</option>"; |
| | | }); |
| | | $("#store").empty().append(content); |
| | | } |
| | | }); |
| | | ajax.set("operatorId",e); |
| | | ajax.start(); |
| | | }else { |
| | | selectElement.disabled = false; |
| | | var ajax = new $ax(Feng.ctxPath + "/tShop/typeChange", function(data){ |
| | | if(data!=null){ |
| | | var content = '<option value="">请选择</option>'; |
| | | $.each(data, function(k,v) { |
| | | |
| | | content += "<option value='"+v.id+"'>"+v.name+"</option>"; |
| | | }); |
| | | $("#page").empty().append(content); |
| | | } |
| | | }); |
| | | ajax.set("name",oneId); |
| | | ajax.start(); |
| | | } |
| | | var pageElement = document.getElementById('page'); |
| | | var event = new Event('change'); |
| | | pageElement.dispatchEvent(event); |
| | | } |
| | | |
| | | |
| | | |
| | | function updatePosition(e) { |
| | | var oneId=$(e).val(); |
| | | var res= document.getElementById("imgPX"); |
| | | console.log(res) |
| | | if (oneId == "1"){ |
| | | res.innerHTML ="推荐像素:780x472px"; |
| | | }else{ |
| | | res.innerHTML ="推荐像素:780x440px"; |
| | | } |
| | | console.log(oneId) |
| | | } |
| | | window.onload = function(){ |
| | | // 如果是0则是平台闸机 |
| | | var temp = $("#operatorId").val(); |
| | | console.log("看看运营商id") |
| | | console.log(temp) |
| | | // 如果不是平台闸机 |
| | | if (temp!=0){ |
| | | var selectElement = document.getElementById('account'); |
| | | selectElement.disabled = false; |
| | | } |
| | | var OBJradio1=document.getElementsByName("type") |
| | | if($("#operatorId").val()==OBJradio1[0].value){//判断是否与radio的值相同 |
| | | OBJradio1[0].checked=true//修改选中状态 |
| | | }else{ |
| | | OBJradio1[1].checked=true//修改选中状态 |
| | | } |
| | | |
| | | } |
| | | </script> |
| | | @} |
| | |
| | | <div id="b1"> |
| | | <#input id="name" name="*商品名称:" type="text" value="${item.name}" readonly="true" /> |
| | | |
| | | <#input id="cover" name="*原价:" avatarImg="${item.price}" readonly="true" /> |
| | | <#input id="cover" name="*原价:" value="${item.price}" readonly="true" /> |
| | | <div class="form-group"> |
| | | <label class="col-sm-3 control-label head-scu-label">*兑换方式:</label> |
| | | <label class="col-sm-3 control-label head-scu-label">*发放方式:</label> |
| | | <div class="col-sm-4"> |
| | | @if(exchangeMethod == 1){ |
| | | <input class="col-sm-1 control-label" name="userGroup" type="radio" |
| | |
| | | </div> |
| | | </div> |
| | | |
| | | <#input id="cover" name="*所需现金:" avatarImg="${item.cash}" readonly="true" /> |
| | | <#input id="cover" name="*所需积分:" avatarImg="${item.integral}" readonly="true" /> |
| | | <div class="form-group"> |
| | | <label class="col-sm-3 control-label">兑换方式:</label> |
| | | <div class="col-sm-9"> |
| | | <input type="radio" name="redemptionMethod" value="1" checked onclick="updateMethod(1)"> 积分 |
| | | <input type="radio" name="redemptionMethod" value="2" onclick="updateMethod(2)"> 现金+积分 |
| | | </div> |
| | | </div> |
| | | |
| | | <div class="form-group" id="y3" hidden> |
| | | <label class="col-sm-3 control-label">所需现金:</label> |
| | | <div class="col-sm-9"> |
| | | <input class="form-control" id="cash1" name="cash" type="text" value="${item.cash}"> |
| | | |
| | | </div> |
| | | </div> |
| | | <div class="form-group" id="y4"> |
| | | <label class="col-sm-3 control-label">所需积分:</label> |
| | | <div class="col-sm-9"> |
| | | <input class="form-control" id="integral1" name="integral" type="text" value="${item.integral}"> |
| | | |
| | | </div> |
| | | </div> |
| | | <div class="form-group"> |
| | | <label class="col-sm-3 control-label head-scu-label">*商品封面:</label> |
| | | <div class="col-sm-4"> |
| | |
| | | <td>${s.num1}</td> |
| | | <td>${s.num2}</td> |
| | | <td>${s.num3}</td> |
| | | <td>${s.num4}</td> |
| | | @} |
| | | </table> |
| | | @} |
| | | @if(item.useScope == 4){ |
| | | <table class="table table-bordered" style="width: 70%;margin-left: 228px;" > |
| | | <thead> |
| | | <tr> |
| | | <td>所在省市</td> |
| | | <td>所属账号</td> |
| | | <td>门店名称</td> |
| | | <td>场地名称</td> |
| | | <td>闸机id</td> |
| | | </tr> |
| | | </thead> |
| | | @for(s in sites){ |
| | | <td>${s.num1}</td> |
| | | <td>${s.num2}</td> |
| | | <td>${s.num3}</td> |
| | | <td>${s.num5}</td> |
| | | <td>${s.num4}</td> |
| | | @} |
| | | </table> |
| | |
| | | <link rel="stylesheet" href="${ctxPath}/js/elementui/index.css"> |
| | | <script src="${ctxPath}/modular/system/tGoods/tGoods_info.js"></script> |
| | | <script> |
| | | function updateMethod(e) { |
| | | console.log(e) |
| | | if(e==1){ |
| | | $("#y3").hide() |
| | | $("#y4").show() |
| | | }else if(e==2){ |
| | | $("#y4").show() |
| | | $("#y3").show() |
| | | }else if(e==3){ |
| | | $("#y1").hide() |
| | | $("#y2").show() |
| | | }else if(e==4){ |
| | | $("#y1").show() |
| | | $("#y2").show() |
| | | }else if(e==5) { |
| | | $("#y2").hide() |
| | | $("#y1").show() |
| | | } |
| | | |
| | | } |
| | | window.onload = function(){ |
| | | var OBJradio=document.getElementsByName("redemptionMethod") |
| | | if(OBJradio==1){ |
| | | $("#y4").show() |
| | | $("#y3").hide() |
| | | } |
| | | if(OBJradio==2){ |
| | | $("#y4").show() |
| | | $("#y3").show() |
| | | } |
| | | for(i=0;i<OBJradio.length;i++){//循环查找这个radio |
| | | if($("#s1").val()==OBJradio[i].value){//判断是否与radio的值相同 |
| | | OBJradio[i].checked=true//修改选中状态 |
| | | } |
| | | } |
| | | var OBJradio=document.getElementsByName("userPopulation") |
| | | for(i=0;i<OBJradio.length;i++){//循环查找这个radio |
| | | if($("#s2").val()==OBJradio[i].value){//判断是否与radio的值相同 |
| | | OBJradio[i].checked=true//修改选中状态 |
| | | } |
| | | } |
| | | } |
| | | var vue2 = new Vue({ |
| | | el: '#app', |
| | | data: { |
New file |
| | |
| | | @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="pCode" onchange="oneChange(this)"> |
| | | <option value="">全部</option> |
| | | @for(obj in list){ |
| | | <option value="${obj.code}">${obj.name}</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="cCode" onchange="getAccount()"> |
| | | </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="account"> |
| | | </select> |
| | | </div> |
| | | </div> |
| | | |
| | | <div class="col-sm-3"> |
| | | <#NameCon id="storeName" name="门店名称" placeholder="请输入门店名称"/> |
| | | </div> |
| | | <div class="col-sm-3"> |
| | | <#button name="搜索" icon="fa-search" clickFun="TStoreProvince.search()"/> |
| | | <#button name="重置" icon="fa-trash" clickFun="TStoreProvince.resetSearch()"/> |
| | | </div> |
| | | </div> |
| | | <div class="hidden-xs" id="TStoreProvinceTableToolbar" role="group"> |
| | | </div> |
| | | <#table id="TStoreProvinceTable"/> |
| | | <div style="margin-left: 30%"> |
| | | <button type="button" class="btn btn-info button-margin" onclick="TStoreProvince.storeOfClosePage()" |
| | | id="closePage" style="width: 30%;height: 40px;background: #0d8ddb;color: white;border: none;"> |
| | | <i class="fa fa-check"></i> 关闭 |
| | | </button> |
| | | |
| | | <button type="button" class="btn btn-info button-margin" onclick="TStoreProvince.saveSelectSites()" |
| | | id="submit" style="margin-left: 5%;width: 30%;height: 40px;background: #0d8ddb;color: white;border: none;"> |
| | | <i class="fa fa-check"></i> 保存 |
| | | </button> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | |
| | | </div> |
| | | </div> |
| | | </div> |
| | | <script src="${ctxPath}/modular/system/tGoods/TCouponInfo.js"></script> |
| | | <script src="${ctxPath}/modular/system/tGoods/TSiteInfo.js"></script> |
| | | <script> |
| | | function oneChange(e) { |
| | | var citySelect= document.getElementById("cCode"); |
| | | var accountSelect= document.getElementById("account"); |
| | | var oneId=$(e).val(); |
| | | var content = "<option value=''>请选择</option>"; |
| | | var ajax = new $ax(Feng.ctxPath + "/tCompetition/onChange", function(data){ |
| | | if(data!=null){ |
| | | |
| | | $.each(data, function(k,v) { |
| | | content += "<option value='"+v.name+"'>"+v.name+"</option>"; |
| | | }); |
| | | $("#cCode").empty().append(content); |
| | | } |
| | | }); |
| | | accountSelect.innerHTML = '<option style="width: 300px" value="">请先选择省/市</option>'; |
| | | if(oneId==""){ |
| | | citySelect.innerHTML = '<option style="width: 300px" value="">请先选择省/市</option>'; |
| | | accountSelect.innerHTML = '<option style="width: 300px" value="">请先选择省/市</option>'; |
| | | } |
| | | ajax.set("oneId",oneId); |
| | | ajax.start(); |
| | | } |
| | | function getAccount() { |
| | | var oneId= $("#cCode option:selected").text(); |
| | | var accountSelect= document.getElementById("account"); |
| | | var content = "<option value=''>请选择</option>"; |
| | | var ajax = new $ax(Feng.ctxPath + "/tCouponManage/getOperator", function(data){ |
| | | if(data!=null){ |
| | | $.each(data, function(k,v) { |
| | | content += "<option value='"+v.id+"'>"+v.name+"</option>"; |
| | | }); |
| | | $("#account").empty().append(content); |
| | | } |
| | | }); |
| | | if(oneId==""){ |
| | | accountSelect.innerHTML = '<option style="width: 300px" value="">请先选择省/市</option>'; |
| | | } |
| | | ajax.set("city",oneId); |
| | | ajax.start(); |
| | | } |
| | | </script> |
| | | @} |
New file |
| | |
| | | @layout("/common/_container.html"){ |
| | | <style> |
| | | .avatar-uploader .el-upload { |
| | | border: 1px dashed #d9d9d9; |
| | | border-radius: 6px; |
| | | cursor: pointer; |
| | | position: relative; |
| | | height: 100px; |
| | | width: 100px; |
| | | overflow: hidden; |
| | | } |
| | | |
| | | .avatar-uploader .el-upload:hover { |
| | | border-color: #409EFF; |
| | | } |
| | | .avatar-uploader-icon { |
| | | font-size: 28px; |
| | | color: #8c939d; |
| | | width: 100px; |
| | | height: 100px; |
| | | line-height: 100px; |
| | | margin-top: 32px; |
| | | text-align: center; |
| | | } |
| | | .avatar { |
| | | width: 100px; |
| | | height: 100px; |
| | | display: block; |
| | | } |
| | | |
| | | .col-sm-12 { |
| | | margin-top: 20px; |
| | | } |
| | | |
| | | .col-sm-12 select { |
| | | height: 33px; |
| | | } |
| | | #app1{ |
| | | margin-left: 255px; |
| | | } |
| | | |
| | | |
| | | </style> |
| | | <script type="text/javascript" src="http://webapi.amap.com/maps?v=1.4.15&key=77b37f0753049c4e712ea79a24e0719c"></script> |
| | | <div class="ibox float-e-margins"> |
| | | <input hidden id="roleType" value="${roleType}"> |
| | | <input hidden id="turnId" value="${data.turnId}"> |
| | | <input hidden id="type1" value="${type}"> |
| | | <input hidden id="id" value="${data.id}"> |
| | | <input hidden id="isOpen" value="${data.isOpen}"> |
| | | <input hidden id="isTop" value="${data.isTop}"> |
| | | <input hidden id="backgroundImage1" value="${data.backgroundImage}"> |
| | | <input hidden id="buttonImage1" value="${data.buttonImage}"> |
| | | <div class="ibox-content"> |
| | | <div class="form-horizontal" id="carInfoForm"> |
| | | |
| | | <div class="form-group" style="margin-left: 96px"> |
| | | <label class="col-sm-3 control-label" > |
| | | 开启状态:<input type="radio" name="isOpen" value="1">开启 <input type="radio" name="isOpen" value="0">关闭 |
| | | </label> |
| | | </div> |
| | | |
| | | <div class="form-group" > |
| | | <label class="col-sm-3 control-label">*标题:</label> |
| | | <div class="col-sm-9" style="display: flex;"> |
| | | <input style="width: 300px" class="form-control" value="${data.title}" id="title" name="title" placeholder="请输入标题" type="text"> |
| | | </div> |
| | | </div> |
| | | |
| | | <div class="form-group" style="margin-left: 96px"> |
| | | <label class="col-sm-3 control-label" > |
| | | 是否置顶:<input type="radio" name="isTop" value="1">是 <input type="radio" name="isTop" value="0">否 |
| | | </label> |
| | | </div> |
| | | |
| | | <div class="form-group" > |
| | | <label class="col-sm-3 control-label">排序:</label> |
| | | <div class="col-sm-9" style="display: flex;"> |
| | | <input style="width: 300px" class="form-control" value="${data.sort}" id="sort" name="sort" placeholder="请输入排序" type="number"> |
| | | <span style="margin-left: 5px;margin-top: 5px">数字越大 权重越大</span> |
| | | </div> |
| | | </div> |
| | | |
| | | <div class="form-group"> |
| | | <label class="col-sm-3 control-label">背景图:</label> |
| | | <div class="col-sm-9" style="display: flex;"> |
| | | <#avatar id="backgroundImage" name="" value ="${data.backgroundImage}" avatarImg="${data.backgroundImage}"/> |
| | | </div> |
| | | </div> |
| | | <div class="form-group"> |
| | | <label class="col-sm-3 control-label">按钮样式:</label> |
| | | <div class="col-sm-9" style="display: flex;"> |
| | | <#avatar id="buttonImage" name="" value ="${data.buttonImage}" avatarImg="${data.buttonImage}"/> |
| | | </div> |
| | | </div> |
| | | @if(roleType == 1){ |
| | | <div class="form-group"> |
| | | <label class="col-sm-3 control-label">*跳转模块:</label> |
| | | <div class="col-sm-9"> |
| | | <select style="width: 300px" class="form-control" id="model" name = "model" onchange="updateType(this)"> |
| | | <option value="">请选择</option> |
| | | <option value="0"${data.model == '不跳转' ? 'selected=selected' : ''}>不跳转</option> |
| | | <option value="1"${data.model == '加入玩湃' ? 'selected=selected' : ''}>加入玩湃</option> |
| | | <option value="2"${data.model == '开始课程' ? 'selected=selected' : ''}>开始课程</option> |
| | | <option value="3"${data.model == '使用福利' ? 'selected=selected' : ''}>使用福利</option> |
| | | <option value="4"${data.model == '探索玩湃' ? 'selected=selected' : ''}>探索玩湃</option> |
| | | </select> |
| | | </div> |
| | | </div> |
| | | @} |
| | | <div class="form-group" id="t1"> |
| | | <label class="col-sm-3 control-label">*跳转页面:</label> |
| | | <div class="col-sm-9"> |
| | | <select style="width: 300px" class="form-control" id="page" name = "page" onchange="updateOne(this)"> |
| | | <option value="">请选择</option> |
| | | @for(obj in pages){ |
| | | <option value="${obj.id}" ${obj.id == data.jumpPage ? 'selected=selected' : ''}>${obj.name}</option> |
| | | @} |
| | | </select> |
| | | </div> |
| | | </div> |
| | | @if(roleType == 1){ |
| | | <div class="form-group" id="t2"> |
| | | <label class="col-sm-3 control-label">*跳转类型:</label> |
| | | <div class="col-sm-9"> |
| | | <select style="width: 300px" class="form-control" id="type" name = "page" onchange="updateT(this)"> |
| | | <option value="">请选择</option> |
| | | @for(obj in types){ |
| | | <option value="${obj.id}" ${obj.id == data.typeId ? 'selected=selected' : ''}>${obj.name}</option> |
| | | @} |
| | | </select> |
| | | </div> |
| | | </div> |
| | | |
| | | <div class="form-group" id="t3"> |
| | | <label class="col-sm-3 control-label">*跳转ID:</label> |
| | | <div class="col-sm-9" style="display: flex;"> |
| | | <input style="width: 300px" value="${data.turnId}" class="form-control" id="pageId" name="name" placeholder="请输入跳转id" type="number"> |
| | | </div> |
| | | </div> |
| | | @} |
| | | <div class="form-group" style="margin-left: 13%;display: inline-flex;margin-top: 16px;" > |
| | | <label class="col-sm-2 control-label">*内容设置:</label> |
| | | <div class="col-sm-5" style="margin-left: -35px;"> |
| | | <textarea type="text/plain" id="editor" style="height: 300px;width: 800px;">${data.content}</textarea> |
| | | </div> |
| | | </div> |
| | | <div class="row btn-group-m-t"> |
| | | <div class="col-sm-10 col-sm-offset-5" > |
| | | <#button btnCss="info" name="保存" id="ensure" icon="fa-check" clickFun="THomeModule.updateSubmit()"/> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | |
| | | <script src="${ctxPath}/modular/system/tHomeModule/tHomeModule_info.js"></script> |
| | | <script src="${ctxPath}/modular/system/tHomeModule/tHomeModule.js"></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: '#time', |
| | | range:true |
| | | }); |
| | | |
| | | function updateType(e) { |
| | | let name = $("#model").val(); |
| | | console.log(name); |
| | | if(name =='0'){ |
| | | $("#t1").hide() |
| | | $("#t2").hide() |
| | | $("#t3").hide() |
| | | $("#t1").val("") |
| | | $("#t2").val("") |
| | | $("#t3").val("") |
| | | $("#page").val("") |
| | | $("#type").val("") |
| | | $("#pageId").val("") |
| | | }else { |
| | | $("#t1").show() |
| | | $("#t2").show() |
| | | $("#t3").show() |
| | | |
| | | var oneId = $('#model option:selected').text(); |
| | | var ajax = new $ax(Feng.ctxPath + "/tShop/typeChange", function(data){ |
| | | if(data!=null){ |
| | | var content = '<option value="">请选择</option>'; |
| | | $.each(data, function(k,v) { |
| | | |
| | | content += "<option value='"+v.id+"'>"+v.name+"</option>"; |
| | | }); |
| | | $("#page").empty().append(content); |
| | | } |
| | | }); |
| | | ajax.set("name",oneId); |
| | | ajax.start(); |
| | | } |
| | | |
| | | |
| | | } |
| | | |
| | | |
| | | function updateOne(e) { |
| | | console.log($('#page option:selected').text()) |
| | | var page= $('#page option:selected').text(); |
| | | if (page=="门店列表" || page=="主页" || page=="充值中心"){ |
| | | $("#t3").hide(); |
| | | $("#t2").hide(); |
| | | $("#t2").val("") |
| | | $("#t3").val("") |
| | | $("#type").val("") |
| | | $("#pageId").val("") |
| | | } |
| | | var oneId=$(e).val(); |
| | | var ajax = new $ax(Feng.ctxPath + "/tShop/typeChangeOne", function(data){ |
| | | if(data!=null&&data.length>0){ |
| | | $("#t2").show() |
| | | var content1 = '<option value="">请选择</option>'; |
| | | $.each(data, function(k,v) { |
| | | content1 += "<option value='"+v.id+"'>"+v.name+"</option>"; |
| | | }); |
| | | $("#type").empty().append(content1); |
| | | }else{ |
| | | console.log("=-======0000") |
| | | $("#t2").val("") |
| | | $("#t2").hide() |
| | | $("#type").val("") |
| | | |
| | | } |
| | | }); |
| | | if (oneId==2 || oneId==25|| oneId==27){ |
| | | $("#t3").val("") |
| | | $("#t3").hide() |
| | | |
| | | $("#pageId").val("") |
| | | } |
| | | ajax.set("id",oneId); |
| | | ajax.start(); |
| | | updateT(document.getElementById("type")); |
| | | |
| | | } |
| | | |
| | | function updateT(e) { |
| | | var oneId = $('#type option:selected').text(); |
| | | console.log(oneId); |
| | | if (oneId!="详情"&&oneId!="指定商品"&&oneId!="指定折扣"){ |
| | | $("#t3").hide() |
| | | $("#t3").val("") |
| | | $("#pageId").val("") |
| | | |
| | | }else{ |
| | | $("#t3").show() |
| | | } |
| | | var page = $('#page option:selected').text(); |
| | | if (page=="线上课得积分" || page=="看视频得奖励"){ |
| | | if (oneId == "列表"){ |
| | | $("#t3").show() |
| | | } |
| | | } |
| | | } |
| | | window.onload = function() { |
| | | |
| | | |
| | | } |
| | | |
| | | |
| | | $(function(){ |
| | | |
| | | if ($('#model option:selected').text()=="不跳转"){ |
| | | $("#t1").hide(); |
| | | $("#t2").hide(); |
| | | $("#t3").hide(); |
| | | $("#page").val("") |
| | | $("#type").val("") |
| | | $("#pageId").val("") |
| | | } |
| | | |
| | | var temp = $("#turnId").val(); |
| | | if (temp==""){ |
| | | $("#t3").hide(); |
| | | $("#t3").val("") |
| | | $("#pageId").val("") |
| | | } |
| | | // 查看跳转页面 有没有跳转类型 |
| | | var page = $('#page option:selected').text(); |
| | | if (page=="门店列表" || page=="主页" || page=="充值中心" ){ |
| | | $("#t2").hide(); |
| | | $("#t3").hide(); |
| | | $("#t2").val("") |
| | | $("#t3").val("") |
| | | $("#type").val("") |
| | | $("#pageId").val("") |
| | | } |
| | | |
| | | var OBJradio=document.getElementsByName("isOpen") |
| | | for(i=0;i<OBJradio.length;i++){//循环查找这个radio |
| | | if($("#isOpen").val()==OBJradio[i].value){//判断是否与radio的值相同 |
| | | OBJradio[i].checked=true//修改选中状态 |
| | | } |
| | | } |
| | | var OBJradio=document.getElementsByName("isTop") |
| | | for(i=0;i<OBJradio.length;i++){//循环查找这个radio |
| | | if($("#isTop").val()==OBJradio[i].value){//判断是否与radio的值相同 |
| | | OBJradio[i].checked=true//修改选中状态 |
| | | } |
| | | } |
| | | }) |
| | | </script> |
| | | @} |
| | |
| | | <#button name="免费福利" icon="fa-remove" clickFun="TCompetition.gift()" space="true"/> |
| | | <#button name="首页设置" icon="fa-remove" clickFun="TCompetition.indexSet()" space="true"/> |
| | | <#button name="SUTU设置" icon="fa-plus" clickFun="TCompetition.addDevice()" space="true"/> |
| | | |
| | | @if(role == '1'){ |
| | | <#button name="平台首页设置" icon="fa-edit" clickFun="TCompetition.platformSet()" space="true"/> |
| | | @} |
| | | </div> |
| | | <#table id="TCompetitionTable"/> |
| | | </div> |
| | |
| | | |
| | | </div> |
| | | </div> |
| | | <#input id="ids" name="添加入园闸机" placeholder= "请输入入园闸机id,多个用逗号分隔" type="text"/> |
| | | <!--<#input id="ids" name="添加入园闸机" placeholder= "请输入入园闸机id,多个用逗号分隔" type="text"/>--> |
| | | |
| | | </div> |
| | | </div> |
| | |
| | | |
| | | </div> |
| | | </div> |
| | | <#input id="ids" name="添加入园闸机" type="text" value="${item.ids}"/> |
| | | <!--<#input id="ids" name="添加入园闸机" type="text" value="${item.ids}"/>--> |
| | | |
| | | </div> |
| | | <div class="row btn-group-m-t"> |
| | |
| | | <input hidden id="s6" value="${c6.isOpen}"> |
| | | <input hidden id="s7" value="${c7.isOpen}"> |
| | | <input hidden id="s8" value="${c8.isOpen}"> |
| | | <input hidden id="s9" value="${c9.isOpen}"> |
| | | <div class="row"> |
| | | <div class="col-lg-6" style=""> |
| | | <div class="form-group" style="margin-left: 96px"> |
| | |
| | | </div> |
| | | </div> |
| | | |
| | | <div style="font-size: x-large;">社区世界杯板块</div> |
| | | <div class="row"> |
| | | <div class="col-lg-6" style=""> |
| | | <div class="form-group" style="margin-left: 96px"> |
| | | <label class="col-sm-4 control-label" > |
| | | 社区世界杯:<input type="radio" name="r9" value="1">开启 <input type="radio" name="r9" value="0">关闭 |
| | | </label> |
| | | </div> |
| | | <div class="form-group"> |
| | | <label class="col-sm-3 control-label">排序:</label> |
| | | <div class="col-sm-9"> |
| | | <input class="form-control" style="width: 200px;" type="text" id="px9" value="${c9.sort}"> |
| | | </div> |
| | | </div> |
| | | @if(c9==null){ |
| | | <#avatar id="c9" name="背景图" /> |
| | | @} |
| | | @if(c9!=null){ |
| | | <#avatar id="c9" name="背景图" avatarImg="${c9.backgroundImage}"/> |
| | | @} |
| | | </div> |
| | | </div> |
| | | |
| | | <div style="font-size: x-large;">首页其他板块设置</div> |
| | | <#button name="添加" icon="fa-plus" clickFun="TCompetition.openAddTCompetition(id)"/> |
| | |
| | | } |
| | | } |
| | | |
| | | var OBJradio=document.getElementsByName("r9") |
| | | for(i=0;i<OBJradio.length;i++){//循环查找这个radio |
| | | if($("#s9").val()==OBJradio[i].value){//判断是否与radio的值相同 |
| | | OBJradio[i].checked=true//修改选中状态 |
| | | } |
| | | } |
| | | |
| | | |
| | | } |
| | | </script> |
| | |
| | | </div> |
| | | |
| | | <#input style="width: 300px" id="name" name="*场地名称" type="text"/> |
| | | <div class="form-group"> |
| | | <label class="col-sm-3 control-label">是否可预约:</label> |
| | | <div class="col-sm-9"> |
| | | <input type="radio" name="reservation" value="1" checked onclick="updateHtml(1)"> 是 |
| | | <input type="radio" name="reservation" value="0" onclick="updateHtml(0)"> 否 |
| | | </div> |
| | | </div> |
| | | <div id = reservation> |
| | | <div class="form-group" > |
| | | <label class="col-sm-3 control-label">*可预约时间段:</label> |
| | | <!-- <input style="width: 300px" class="form-control" type="time">--> |
| | |
| | | </div> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | <div class="form-group"> |
| | | <label class="col-sm-3 control-label">*场地责任险有效期:</label> |
| | | <div class="col-sm-9"> |
| | |
| | | </div> |
| | | </div> |
| | | </div> |
| | | <#input style="width: 300px" id="ids" name="*添加闸机:" placeholder="请输入闸机ID" type="text"/> |
| | | |
| | | @if(objectType==1){ |
| | | <div class="form-group" style=" margin-left: 17%;" > |
| | | <label class="col-sm-1 control-label">场地说明:</label> |
| | |
| | | }else { |
| | | $("#halfCode").show() |
| | | } |
| | | |
| | | } |
| | | |
| | | |
| | | var vue2 = new Vue({ |
| | | el: '#app1', |
| | |
| | | endTime.disabled = true; |
| | | } |
| | | }); |
| | | function updateHtml(e) { |
| | | console.log("进入看看") |
| | | console.log(e) |
| | | if(e==0){ |
| | | $("#reservation").hide() |
| | | }else { |
| | | $("#reservation").show() |
| | | } |
| | | } |
| | | function updateTime1() { |
| | | var selectedValue = document.getElementById("siteTypeOne").value; |
| | | var priceLabel = document.getElementById("priceLabel"); |
| | |
| | | <div class="form-horizontal" id="carInfoForm"> |
| | | |
| | | <input id="type_" value="${list.ishalf}" hidden> |
| | | <input id="reservation" value="${list.reservation}" hidden> |
| | | <input id="objectType" value="${objectType}" hidden> |
| | | |
| | | @if(objectType == 1){ |
| | |
| | | <input style="width: 300px" class="form-control" id="name" name="name" type="text" value="${list.name}"> |
| | | </div> |
| | | </div> |
| | | <div class="form-group"> |
| | | <label class="col-sm-3 control-label">是否可预约:</label> |
| | | <div class="col-sm-9"> |
| | | <input type="radio" name="reservation" value="1" onclick="updateHtml(1)"> 是 |
| | | <input type="radio" name="reservation" value="0" onclick="updateHtml(0)"> 否 |
| | | </div> |
| | | </div> |
| | | <div id = reservation1> |
| | | <div class="form-group" > |
| | | <label class="col-sm-3 control-label">*可预约时间段:</label> |
| | | <div class="col-sm-9" style="display: flex"> |
| | |
| | | </div> |
| | | @} |
| | | </div> |
| | | |
| | | </div> |
| | | |
| | | <div class="form-group"> |
| | | <label class="col-sm-3 control-label">*场地责任险有效期:</label> |
| | |
| | | </div> |
| | | </div> |
| | | </div> |
| | | <div class="form-group" style="margin-left: 205px;"> |
| | | <label class="col-sm-1 control-label">*添加闸机:</label> |
| | | <div class="col-sm-9"> |
| | | <input class="form-control" id="ids" name="ids" value="${list.ids}" type="text" style="width: 300px" placeholder="请输入闸机ID"> |
| | | </div> |
| | | </div> |
| | | <!-- <div class="form-group" style="margin-left: 205px;">--> |
| | | <!-- <label class="col-sm-1 control-label">*添加闸机:</label>--> |
| | | <!-- <div class="col-sm-9">--> |
| | | <!-- <input class="form-control" id="ids" name="ids" value="${list.ids}" type="text" style="width: 300px" placeholder="请输入闸机ID">--> |
| | | <!-- </div>--> |
| | | <!-- </div>--> |
| | | @if(objectType==1){ |
| | | <div class="form-group" style="margin-left: 13%;display: inline-flex;margin-top: 16px;" > |
| | | <label class="col-sm-2 control-label">场地说明:</label> |
| | |
| | | } |
| | | }); |
| | | |
| | | |
| | | function updateHtml(e) { |
| | | console.log("进入看看") |
| | | console.log(e) |
| | | if(e==0){ |
| | | $("#reservation1").hide() |
| | | }else { |
| | | $("#reservation1").show() |
| | | } |
| | | } |
| | | window.onload = function(){ |
| | | var siteTypeOne = document.getElementById('siteTypeOne'); |
| | | siteTypeOne.onchange(); // Trigger the onchange event |
| | |
| | | } |
| | | } |
| | | |
| | | |
| | | var OBJradio1=document.getElementsByName("reservation") |
| | | if($("#reservation").val()==1){ |
| | | $("#reservation1").show() |
| | | }else{ |
| | | $("#reservation1").hide() |
| | | } |
| | | for(j=0;j<OBJradio1.length;j++){//循环查找这个radio |
| | | if($("#reservation").val()==OBJradio1[j].value){//判断是否与radio的值相同 |
| | | OBJradio1[j].checked=true//修改选中状态 |
| | | } |
| | | } |
| | | } |
| | | // 选择了不可预约 可预约时间段、价格、多场地配置、半场配置,都不展示。 |
| | | |
| | | function addBox1() { |
| | | var a=" <div class=\"col-sm-8 control-label\" id=\"far\" style=\"margin-left: 210px;\">\n" + |
| | |
| | | value="3" style="margin-left: 4%;margin-top: 10px;width: 13px;height: 13px"/> |
| | | <label class="col-sm-1" style="width: 38%;margin-top: 6px;">指定门店</label> |
| | | </div> |
| | | <div class="col-sm-2" id="belongsSite" > |
| | | <input class="col-sm-1" name="company" onclick="scopeOfApplication4()" type="radio" |
| | | value="4" style="margin-left: 4%;margin-top: 10px;width: 13px;height: 13px"/> |
| | | <label class="col-sm-1" style="width: 38%;margin-top: 6px;">指定场地</label> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | |
| | | </div> |
| | | </div> |
| | | @} |
| | | |
| | | <div class="row" id="citySelect" hidden="hidden"> |
| | | <div class="form-group"> |
| | | <div class="form-group"> |
| | |
| | | </tr> |
| | | </thead> |
| | | <tbody id="coun"></tbody> |
| | | </table> |
| | | </div> |
| | | </div> |
| | | |
| | | </div> |
| | | </div> |
| | | @} |
| | | @if(userType!=3){ |
| | | <div class="row" id="siteSelect" hidden > |
| | | <div class="form-group"> |
| | | <div class="form-group"> |
| | | <div class="col-sm-12"> |
| | | <label class="col-sm-3 control-label">*指定场地: </label> |
| | | <button onclick="siteList1()" |
| | | style="height: 22px;width: 82px;background-color: #4a8ff1;color: white;z-index: 15;position:relative;border: none;margin-top: 1%"> |
| | | 选择场地 |
| | | </button> |
| | | </div> |
| | | <div class="col-sm-12" style="margin-left: -57px;margin-top: 20px"> |
| | | <table class="table table-bordered" style="width: 70%;margin-left: 228px;" id="siteTable"> |
| | | <thead> |
| | | <tr> |
| | | <td>所在省市</td> |
| | | <td>所属账号</td> |
| | | <td>门店名称</td> |
| | | <td>场地名称</td> |
| | | <td>闸机id</td> |
| | | <td>操作</td> |
| | | </tr> |
| | | </thead> |
| | | <tbody id="coun1"></tbody> |
| | | </table> |
| | | </div> |
| | | </div> |
| | |
| | | function scopeOfApplication3() { |
| | | $("#storeSelect").show(); |
| | | $("#citySelect").hide(); |
| | | $("#siteSelect").hide(); |
| | | } |
| | | function scopeOfApplication4() { |
| | | $("#siteSelect").show(); |
| | | $("#storeSelect").hide(); |
| | | } |
| | | |
| | | function updateMethod(e) { |
New file |
| | |
| | | @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"> |
| | | <input type="hidden" id="id" value="${id}"> |
| | | <div class="row"> |
| | | <div class="col-sm-3"> |
| | | <#NameCon id="name" name="姓名:" /> |
| | | </div> |
| | | <div class="col-sm-3"> |
| | | <#NameCon id="phone" name="联系电话:" /> |
| | | </div> |
| | | <div class="col-sm-3"> |
| | | <#NameCon id="idcode" 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> |
| | | </select> |
| | | </div> |
| | | </div> |
| | | <div class="col-sm-3"> |
| | | <#button name="搜索" icon="fa-search" clickFun="RegisteredPersonnel.search()"/> |
| | | <#button name="重置" icon="fa-trash" clickFun="RegisteredPersonnel.resetSearch()" space="true"/> |
| | | </div> |
| | | </div> |
| | | <div class="hidden-xs" id="RegisteredPersonnelTableToolbar" role="group"> |
| | | <#button name="导出二维码" icon="fa-plus" clickFun="RegisteredPersonnel.exportQRCode()"/> |
| | | <#button name="导出" icon="fa-edit" clickFun="RegisteredPersonnel.exportPersonnel()" space="true"/> |
| | | </div> |
| | | <#table id="RegisteredPersonnelTable"/> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | <script src="${ctxPath}/modular/system/worldCup/registeredPersonnel.js"></script> |
| | | <script src="${ctxPath}/js/jquery.qrcode.min.js"></script> |
| | | @} |
New file |
| | |
| | | @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="tabs-container"> |
| | | <ul class="nav nav-tabs"> |
| | | <li class="active"><a data-toggle="tab" href="#tab-1" aria-expanded="true">排行榜</a></li> |
| | | <li class=""><a data-toggle="tab" href="#tab-2" aria-expanded="false">比赛统计</a></li> |
| | | <li class=""><a data-toggle="tab" href="#tab-3" aria-expanded="false">用户统计</a></li> |
| | | </ul> |
| | | <div class="tab-content"> |
| | | <div id="tab-1" class="tab-pane active"> |
| | | <div class="panel-body"> |
| | | <div class="row"> |
| | | <div class="col-sm-3"> |
| | | <#NameCon id="province" name="所在省份:" /> |
| | | </div> |
| | | <div class="col-sm-3"> |
| | | <#NameCon id="city" name="所在城市:" /> |
| | | </div> |
| | | <div class="col-sm-3"> |
| | | <#button name="搜索" icon="fa-search" clickFun="WorldCupRecords.search1()"/> |
| | | <#button name="重置" icon="fa-trash" clickFun="WorldCupRecords.resetSearch1()" space="true"/> |
| | | </div> |
| | | </div> |
| | | <#table id="WorldCupRecordsTable1"/> |
| | | </div> |
| | | </div> |
| | | <div id="tab-2" class="tab-pane"> |
| | | <div class="panel-body"> |
| | | <div class="row"> |
| | | <div class="col-sm-3"> |
| | | <#NameCon id="province" name="所在省份:" /> |
| | | </div> |
| | | <div class="col-sm-3"> |
| | | <#NameCon id="city" name="所在城市:" /> |
| | | </div> |
| | | <div class="col-sm-3"> |
| | | <#button name="搜索" icon="fa-search" clickFun="WorldCupRecords.search2()"/> |
| | | <#button name="重置" icon="fa-trash" clickFun="WorldCupRecords.resetSearch2()" space="true"/> |
| | | </div> |
| | | </div> |
| | | <div class="hidden-xs" id="WorldCupRecordsTable2Toolbar" role="group"> |
| | | @if(shiro.hasPermission("/WorldCupRecords/openAddWorldCupRecords")){ |
| | | <#button name="添加" icon="fa-plus" clickFun="WorldCupRecords.openAddWorldCupRecords()"/> |
| | | @} |
| | | @if(shiro.hasPermission("/WorldCupRecords/openEditWorldCupRecords")){ |
| | | <#button name="编辑" icon="fa-edit" clickFun="WorldCupRecords.openEditWorldCupRecords()" space="true"/> |
| | | @} |
| | | @if(shiro.hasPermission("/WorldCupRecords/cancelWorldCupRecords")){ |
| | | <#button name="取消" icon="fa-edit" clickFun="WorldCupRecords.cancelWorldCupRecords()" space="true"/> |
| | | @} |
| | | @if(shiro.hasPermission("/WorldCupRecords/openWorldCupRecordsInfo")){ |
| | | <#button name="查看详情" icon="fa-edit" clickFun="WorldCupRecords.openWorldCupRecordsInfo()" space="true"/> |
| | | @} |
| | | @if(shiro.hasPermission("/WorldCupRecords/registeredPersonnel")){ |
| | | <#button name="已报名人员" icon="fa-edit" clickFun="WorldCupRecords.registeredPersonnel()" space="true"/> |
| | | @} |
| | | </div> |
| | | <#table id="WorldCupRecordsTable2"/> |
| | | </div> |
| | | </div> |
| | | <div id="tab-3" class="tab-pane"> |
| | | <div class="panel-body"> |
| | | <div class="row"> |
| | | <div class="col-sm-3"> |
| | | <#NameCon id="province" name="所在省份:" /> |
| | | </div> |
| | | <div class="col-sm-3"> |
| | | <#NameCon id="city" name="所在城市:" /> |
| | | </div> |
| | | <div class="col-sm-3"> |
| | | <#button name="搜索" icon="fa-search" clickFun="WorldCupRecords.search3()"/> |
| | | <#button name="重置" icon="fa-trash" clickFun="WorldCupRecords.resetSearch3()" space="true"/> |
| | | </div> |
| | | </div> |
| | | <div class="hidden-xs" id="WorldCupRecordsTable3Toolbar" role="group"> |
| | | @if(shiro.hasPermission("/WorldCupRecords/openAddWorldCupRecords")){ |
| | | <#button name="添加" icon="fa-plus" clickFun="WorldCupRecords.openAddWorldCupRecords()"/> |
| | | @} |
| | | @if(shiro.hasPermission("/WorldCupRecords/openEditWorldCupRecords")){ |
| | | <#button name="编辑" icon="fa-edit" clickFun="WorldCupRecords.openEditWorldCupRecords()" space="true"/> |
| | | @} |
| | | @if(shiro.hasPermission("/WorldCupRecords/cancelWorldCupRecords")){ |
| | | <#button name="取消" icon="fa-edit" clickFun="WorldCupRecords.cancelWorldCupRecords()" space="true"/> |
| | | @} |
| | | @if(shiro.hasPermission("/WorldCupRecords/openWorldCupRecordsInfo")){ |
| | | <#button name="查看详情" icon="fa-edit" clickFun="WorldCupRecords.openWorldCupRecordsInfo()" space="true"/> |
| | | @} |
| | | @if(shiro.hasPermission("/WorldCupRecords/registeredPersonnel")){ |
| | | <#button name="已报名人员" icon="fa-edit" clickFun="WorldCupRecords.registeredPersonnel()" space="true"/> |
| | | @} |
| | | </div> |
| | | <#table id="WorldCupRecordsTable3"/> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | <script src="${ctxPath}/modular/system/WorldCupRecordsRecords/WorldCupRecordsRecords.js"></script> |
| | | <script> |
| | | laydate.render({ |
| | | elem: '#startTime' |
| | | }); |
| | | laydate.render({ |
| | | elem: '#endTime' |
| | | }); |
| | | </script> |
| | | @} |
New file |
| | |
| | | (function( $ ){ |
| | | $.fn.qrcode = function(options) { |
| | | // if options is string, |
| | | if( typeof options === 'string' ){ |
| | | options = { text: options }; |
| | | } |
| | | |
| | | // set default values |
| | | // typeNumber < 1 for automatic calculation |
| | | options = $.extend( {}, { |
| | | render : "canvas", |
| | | width : 256, |
| | | height : 256, |
| | | typeNumber : -1, |
| | | correctLevel : QRErrorCorrectLevel.H, |
| | | background : "#ffffff", |
| | | foreground : "#000000" |
| | | }, options); |
| | | |
| | | var createCanvas = function(){ |
| | | // create the qrcode itself |
| | | var qrcode = new QRCode(options.typeNumber, options.correctLevel); |
| | | qrcode.addData(options.text); |
| | | qrcode.make(); |
| | | |
| | | // create canvas element |
| | | var canvas = document.createElement('canvas'); |
| | | canvas.width = options.width; |
| | | canvas.height = options.height; |
| | | var ctx = canvas.getContext('2d'); |
| | | |
| | | // compute tileW/tileH based on options.width/options.height |
| | | var tileW = options.width / qrcode.getModuleCount(); |
| | | var tileH = options.height / qrcode.getModuleCount(); |
| | | |
| | | // draw in the canvas |
| | | for( var row = 0; row < qrcode.getModuleCount(); row++ ){ |
| | | for( var col = 0; col < qrcode.getModuleCount(); col++ ){ |
| | | ctx.fillStyle = qrcode.isDark(row, col) ? options.foreground : options.background; |
| | | var w = (Math.ceil((col+1)*tileW) - Math.floor(col*tileW)); |
| | | var h = (Math.ceil((row+1)*tileH) - Math.floor(row*tileH)); |
| | | ctx.fillRect(Math.round(col*tileW),Math.round(row*tileH), w, h); |
| | | } |
| | | } |
| | | // return just built canvas |
| | | return canvas; |
| | | } |
| | | |
| | | // from Jon-Carlos Rivera (https://github.com/imbcmdth) |
| | | var createTable = function(){ |
| | | // create the qrcode itself |
| | | var qrcode = new QRCode(options.typeNumber, options.correctLevel); |
| | | qrcode.addData(options.text); |
| | | qrcode.make(); |
| | | |
| | | // create table element |
| | | var $table = $('<table></table>') |
| | | .css("width", options.width+"px") |
| | | .css("height", options.height+"px") |
| | | .css("border", "0px") |
| | | .css("border-collapse", "collapse") |
| | | .css('background-color', options.background); |
| | | |
| | | // compute tileS percentage |
| | | var tileW = options.width / qrcode.getModuleCount(); |
| | | var tileH = options.height / qrcode.getModuleCount(); |
| | | |
| | | // draw in the table |
| | | for(var row = 0; row < qrcode.getModuleCount(); row++ ){ |
| | | var $row = $('<tr></tr>').css('height', tileH+"px").appendTo($table); |
| | | |
| | | for(var col = 0; col < qrcode.getModuleCount(); col++ ){ |
| | | $('<td></td>') |
| | | .css('width', tileW+"px") |
| | | .css('background-color', qrcode.isDark(row, col) ? options.foreground : options.background) |
| | | .appendTo($row); |
| | | } |
| | | } |
| | | // return just built canvas |
| | | return $table; |
| | | } |
| | | |
| | | |
| | | return this.each(function(){ |
| | | var element = options.render == "canvas" ? createCanvas() : createTable(); |
| | | $(element).appendTo(this); |
| | | }); |
| | | }; |
| | | })( jQuery ); |
New file |
| | |
| | | (function(r){r.fn.qrcode=function(h){var s;function u(a){this.mode=s;this.data=a}function o(a,c){this.typeNumber=a;this.errorCorrectLevel=c;this.modules=null;this.moduleCount=0;this.dataCache=null;this.dataList=[]}function q(a,c){if(void 0==a.length)throw Error(a.length+"/"+c);for(var d=0;d<a.length&&0==a[d];)d++;this.num=Array(a.length-d+c);for(var b=0;b<a.length-d;b++)this.num[b]=a[b+d]}function p(a,c){this.totalCount=a;this.dataCount=c}function t(){this.buffer=[];this.length=0}u.prototype={getLength:function(){return this.data.length}, |
| | | write:function(a){for(var c=0;c<this.data.length;c++)a.put(this.data.charCodeAt(c),8)}};o.prototype={addData:function(a){this.dataList.push(new u(a));this.dataCache=null},isDark:function(a,c){if(0>a||this.moduleCount<=a||0>c||this.moduleCount<=c)throw Error(a+","+c);return this.modules[a][c]},getModuleCount:function(){return this.moduleCount},make:function(){if(1>this.typeNumber){for(var a=1,a=1;40>a;a++){for(var c=p.getRSBlocks(a,this.errorCorrectLevel),d=new t,b=0,e=0;e<c.length;e++)b+=c[e].dataCount; |
| | | for(e=0;e<this.dataList.length;e++)c=this.dataList[e],d.put(c.mode,4),d.put(c.getLength(),j.getLengthInBits(c.mode,a)),c.write(d);if(d.getLengthInBits()<=8*b)break}this.typeNumber=a}this.makeImpl(!1,this.getBestMaskPattern())},makeImpl:function(a,c){this.moduleCount=4*this.typeNumber+17;this.modules=Array(this.moduleCount);for(var d=0;d<this.moduleCount;d++){this.modules[d]=Array(this.moduleCount);for(var b=0;b<this.moduleCount;b++)this.modules[d][b]=null}this.setupPositionProbePattern(0,0);this.setupPositionProbePattern(this.moduleCount- |
| | | 7,0);this.setupPositionProbePattern(0,this.moduleCount-7);this.setupPositionAdjustPattern();this.setupTimingPattern();this.setupTypeInfo(a,c);7<=this.typeNumber&&this.setupTypeNumber(a);null==this.dataCache&&(this.dataCache=o.createData(this.typeNumber,this.errorCorrectLevel,this.dataList));this.mapData(this.dataCache,c)},setupPositionProbePattern:function(a,c){for(var d=-1;7>=d;d++)if(!(-1>=a+d||this.moduleCount<=a+d))for(var b=-1;7>=b;b++)-1>=c+b||this.moduleCount<=c+b||(this.modules[a+d][c+b]= |
| | | 0<=d&&6>=d&&(0==b||6==b)||0<=b&&6>=b&&(0==d||6==d)||2<=d&&4>=d&&2<=b&&4>=b?!0:!1)},getBestMaskPattern:function(){for(var a=0,c=0,d=0;8>d;d++){this.makeImpl(!0,d);var b=j.getLostPoint(this);if(0==d||a>b)a=b,c=d}return c},createMovieClip:function(a,c,d){a=a.createEmptyMovieClip(c,d);this.make();for(c=0;c<this.modules.length;c++)for(var d=1*c,b=0;b<this.modules[c].length;b++){var e=1*b;this.modules[c][b]&&(a.beginFill(0,100),a.moveTo(e,d),a.lineTo(e+1,d),a.lineTo(e+1,d+1),a.lineTo(e,d+1),a.endFill())}return a}, |
| | | setupTimingPattern:function(){for(var a=8;a<this.moduleCount-8;a++)null==this.modules[a][6]&&(this.modules[a][6]=0==a%2);for(a=8;a<this.moduleCount-8;a++)null==this.modules[6][a]&&(this.modules[6][a]=0==a%2)},setupPositionAdjustPattern:function(){for(var a=j.getPatternPosition(this.typeNumber),c=0;c<a.length;c++)for(var d=0;d<a.length;d++){var b=a[c],e=a[d];if(null==this.modules[b][e])for(var f=-2;2>=f;f++)for(var i=-2;2>=i;i++)this.modules[b+f][e+i]=-2==f||2==f||-2==i||2==i||0==f&&0==i?!0:!1}},setupTypeNumber:function(a){for(var c= |
| | | j.getBCHTypeNumber(this.typeNumber),d=0;18>d;d++){var b=!a&&1==(c>>d&1);this.modules[Math.floor(d/3)][d%3+this.moduleCount-8-3]=b}for(d=0;18>d;d++)b=!a&&1==(c>>d&1),this.modules[d%3+this.moduleCount-8-3][Math.floor(d/3)]=b},setupTypeInfo:function(a,c){for(var d=j.getBCHTypeInfo(this.errorCorrectLevel<<3|c),b=0;15>b;b++){var e=!a&&1==(d>>b&1);6>b?this.modules[b][8]=e:8>b?this.modules[b+1][8]=e:this.modules[this.moduleCount-15+b][8]=e}for(b=0;15>b;b++)e=!a&&1==(d>>b&1),8>b?this.modules[8][this.moduleCount- |
| | | b-1]=e:9>b?this.modules[8][15-b-1+1]=e:this.modules[8][15-b-1]=e;this.modules[this.moduleCount-8][8]=!a},mapData:function(a,c){for(var d=-1,b=this.moduleCount-1,e=7,f=0,i=this.moduleCount-1;0<i;i-=2)for(6==i&&i--;;){for(var g=0;2>g;g++)if(null==this.modules[b][i-g]){var n=!1;f<a.length&&(n=1==(a[f]>>>e&1));j.getMask(c,b,i-g)&&(n=!n);this.modules[b][i-g]=n;e--; -1==e&&(f++,e=7)}b+=d;if(0>b||this.moduleCount<=b){b-=d;d=-d;break}}}};o.PAD0=236;o.PAD1=17;o.createData=function(a,c,d){for(var c=p.getRSBlocks(a, |
| | | c),b=new t,e=0;e<d.length;e++){var f=d[e];b.put(f.mode,4);b.put(f.getLength(),j.getLengthInBits(f.mode,a));f.write(b)}for(e=a=0;e<c.length;e++)a+=c[e].dataCount;if(b.getLengthInBits()>8*a)throw Error("code length overflow. ("+b.getLengthInBits()+">"+8*a+")");for(b.getLengthInBits()+4<=8*a&&b.put(0,4);0!=b.getLengthInBits()%8;)b.putBit(!1);for(;!(b.getLengthInBits()>=8*a);){b.put(o.PAD0,8);if(b.getLengthInBits()>=8*a)break;b.put(o.PAD1,8)}return o.createBytes(b,c)};o.createBytes=function(a,c){for(var d= |
| | | 0,b=0,e=0,f=Array(c.length),i=Array(c.length),g=0;g<c.length;g++){var n=c[g].dataCount,h=c[g].totalCount-n,b=Math.max(b,n),e=Math.max(e,h);f[g]=Array(n);for(var k=0;k<f[g].length;k++)f[g][k]=255&a.buffer[k+d];d+=n;k=j.getErrorCorrectPolynomial(h);n=(new q(f[g],k.getLength()-1)).mod(k);i[g]=Array(k.getLength()-1);for(k=0;k<i[g].length;k++)h=k+n.getLength()-i[g].length,i[g][k]=0<=h?n.get(h):0}for(k=g=0;k<c.length;k++)g+=c[k].totalCount;d=Array(g);for(k=n=0;k<b;k++)for(g=0;g<c.length;g++)k<f[g].length&& |
| | | (d[n++]=f[g][k]);for(k=0;k<e;k++)for(g=0;g<c.length;g++)k<i[g].length&&(d[n++]=i[g][k]);return d};s=4;for(var j={PATTERN_POSITION_TABLE:[[],[6,18],[6,22],[6,26],[6,30],[6,34],[6,22,38],[6,24,42],[6,26,46],[6,28,50],[6,30,54],[6,32,58],[6,34,62],[6,26,46,66],[6,26,48,70],[6,26,50,74],[6,30,54,78],[6,30,56,82],[6,30,58,86],[6,34,62,90],[6,28,50,72,94],[6,26,50,74,98],[6,30,54,78,102],[6,28,54,80,106],[6,32,58,84,110],[6,30,58,86,114],[6,34,62,90,118],[6,26,50,74,98,122],[6,30,54,78,102,126],[6,26,52, |
| | | 78,104,130],[6,30,56,82,108,134],[6,34,60,86,112,138],[6,30,58,86,114,142],[6,34,62,90,118,146],[6,30,54,78,102,126,150],[6,24,50,76,102,128,154],[6,28,54,80,106,132,158],[6,32,58,84,110,136,162],[6,26,54,82,110,138,166],[6,30,58,86,114,142,170]],G15:1335,G18:7973,G15_MASK:21522,getBCHTypeInfo:function(a){for(var c=a<<10;0<=j.getBCHDigit(c)-j.getBCHDigit(j.G15);)c^=j.G15<<j.getBCHDigit(c)-j.getBCHDigit(j.G15);return(a<<10|c)^j.G15_MASK},getBCHTypeNumber:function(a){for(var c=a<<12;0<=j.getBCHDigit(c)- |
| | | j.getBCHDigit(j.G18);)c^=j.G18<<j.getBCHDigit(c)-j.getBCHDigit(j.G18);return a<<12|c},getBCHDigit:function(a){for(var c=0;0!=a;)c++,a>>>=1;return c},getPatternPosition:function(a){return j.PATTERN_POSITION_TABLE[a-1]},getMask:function(a,c,d){switch(a){case 0:return 0==(c+d)%2;case 1:return 0==c%2;case 2:return 0==d%3;case 3:return 0==(c+d)%3;case 4:return 0==(Math.floor(c/2)+Math.floor(d/3))%2;case 5:return 0==c*d%2+c*d%3;case 6:return 0==(c*d%2+c*d%3)%2;case 7:return 0==(c*d%3+(c+d)%2)%2;default:throw Error("bad maskPattern:"+ |
| | | a);}},getErrorCorrectPolynomial:function(a){for(var c=new q([1],0),d=0;d<a;d++)c=c.multiply(new q([1,l.gexp(d)],0));return c},getLengthInBits:function(a,c){if(1<=c&&10>c)switch(a){case 1:return 10;case 2:return 9;case s:return 8;case 8:return 8;default:throw Error("mode:"+a);}else if(27>c)switch(a){case 1:return 12;case 2:return 11;case s:return 16;case 8:return 10;default:throw Error("mode:"+a);}else if(41>c)switch(a){case 1:return 14;case 2:return 13;case s:return 16;case 8:return 12;default:throw Error("mode:"+ |
| | | a);}else throw Error("type:"+c);},getLostPoint:function(a){for(var c=a.getModuleCount(),d=0,b=0;b<c;b++)for(var e=0;e<c;e++){for(var f=0,i=a.isDark(b,e),g=-1;1>=g;g++)if(!(0>b+g||c<=b+g))for(var h=-1;1>=h;h++)0>e+h||c<=e+h||0==g&&0==h||i==a.isDark(b+g,e+h)&&f++;5<f&&(d+=3+f-5)}for(b=0;b<c-1;b++)for(e=0;e<c-1;e++)if(f=0,a.isDark(b,e)&&f++,a.isDark(b+1,e)&&f++,a.isDark(b,e+1)&&f++,a.isDark(b+1,e+1)&&f++,0==f||4==f)d+=3;for(b=0;b<c;b++)for(e=0;e<c-6;e++)a.isDark(b,e)&&!a.isDark(b,e+1)&&a.isDark(b,e+ |
| | | 2)&&a.isDark(b,e+3)&&a.isDark(b,e+4)&&!a.isDark(b,e+5)&&a.isDark(b,e+6)&&(d+=40);for(e=0;e<c;e++)for(b=0;b<c-6;b++)a.isDark(b,e)&&!a.isDark(b+1,e)&&a.isDark(b+2,e)&&a.isDark(b+3,e)&&a.isDark(b+4,e)&&!a.isDark(b+5,e)&&a.isDark(b+6,e)&&(d+=40);for(e=f=0;e<c;e++)for(b=0;b<c;b++)a.isDark(b,e)&&f++;a=Math.abs(100*f/c/c-50)/5;return d+10*a}},l={glog:function(a){if(1>a)throw Error("glog("+a+")");return l.LOG_TABLE[a]},gexp:function(a){for(;0>a;)a+=255;for(;256<=a;)a-=255;return l.EXP_TABLE[a]},EXP_TABLE:Array(256), |
| | | LOG_TABLE:Array(256)},m=0;8>m;m++)l.EXP_TABLE[m]=1<<m;for(m=8;256>m;m++)l.EXP_TABLE[m]=l.EXP_TABLE[m-4]^l.EXP_TABLE[m-5]^l.EXP_TABLE[m-6]^l.EXP_TABLE[m-8];for(m=0;255>m;m++)l.LOG_TABLE[l.EXP_TABLE[m]]=m;q.prototype={get:function(a){return this.num[a]},getLength:function(){return this.num.length},multiply:function(a){for(var c=Array(this.getLength()+a.getLength()-1),d=0;d<this.getLength();d++)for(var b=0;b<a.getLength();b++)c[d+b]^=l.gexp(l.glog(this.get(d))+l.glog(a.get(b)));return new q(c,0)},mod:function(a){if(0> |
| | | this.getLength()-a.getLength())return this;for(var c=l.glog(this.get(0))-l.glog(a.get(0)),d=Array(this.getLength()),b=0;b<this.getLength();b++)d[b]=this.get(b);for(b=0;b<a.getLength();b++)d[b]^=l.gexp(l.glog(a.get(b))+c);return(new q(d,0)).mod(a)}};p.RS_BLOCK_TABLE=[[1,26,19],[1,26,16],[1,26,13],[1,26,9],[1,44,34],[1,44,28],[1,44,22],[1,44,16],[1,70,55],[1,70,44],[2,35,17],[2,35,13],[1,100,80],[2,50,32],[2,50,24],[4,25,9],[1,134,108],[2,67,43],[2,33,15,2,34,16],[2,33,11,2,34,12],[2,86,68],[4,43,27], |
| | | [4,43,19],[4,43,15],[2,98,78],[4,49,31],[2,32,14,4,33,15],[4,39,13,1,40,14],[2,121,97],[2,60,38,2,61,39],[4,40,18,2,41,19],[4,40,14,2,41,15],[2,146,116],[3,58,36,2,59,37],[4,36,16,4,37,17],[4,36,12,4,37,13],[2,86,68,2,87,69],[4,69,43,1,70,44],[6,43,19,2,44,20],[6,43,15,2,44,16],[4,101,81],[1,80,50,4,81,51],[4,50,22,4,51,23],[3,36,12,8,37,13],[2,116,92,2,117,93],[6,58,36,2,59,37],[4,46,20,6,47,21],[7,42,14,4,43,15],[4,133,107],[8,59,37,1,60,38],[8,44,20,4,45,21],[12,33,11,4,34,12],[3,145,115,1,146, |
| | | 116],[4,64,40,5,65,41],[11,36,16,5,37,17],[11,36,12,5,37,13],[5,109,87,1,110,88],[5,65,41,5,66,42],[5,54,24,7,55,25],[11,36,12],[5,122,98,1,123,99],[7,73,45,3,74,46],[15,43,19,2,44,20],[3,45,15,13,46,16],[1,135,107,5,136,108],[10,74,46,1,75,47],[1,50,22,15,51,23],[2,42,14,17,43,15],[5,150,120,1,151,121],[9,69,43,4,70,44],[17,50,22,1,51,23],[2,42,14,19,43,15],[3,141,113,4,142,114],[3,70,44,11,71,45],[17,47,21,4,48,22],[9,39,13,16,40,14],[3,135,107,5,136,108],[3,67,41,13,68,42],[15,54,24,5,55,25],[15, |
| | | 43,15,10,44,16],[4,144,116,4,145,117],[17,68,42],[17,50,22,6,51,23],[19,46,16,6,47,17],[2,139,111,7,140,112],[17,74,46],[7,54,24,16,55,25],[34,37,13],[4,151,121,5,152,122],[4,75,47,14,76,48],[11,54,24,14,55,25],[16,45,15,14,46,16],[6,147,117,4,148,118],[6,73,45,14,74,46],[11,54,24,16,55,25],[30,46,16,2,47,17],[8,132,106,4,133,107],[8,75,47,13,76,48],[7,54,24,22,55,25],[22,45,15,13,46,16],[10,142,114,2,143,115],[19,74,46,4,75,47],[28,50,22,6,51,23],[33,46,16,4,47,17],[8,152,122,4,153,123],[22,73,45, |
| | | 3,74,46],[8,53,23,26,54,24],[12,45,15,28,46,16],[3,147,117,10,148,118],[3,73,45,23,74,46],[4,54,24,31,55,25],[11,45,15,31,46,16],[7,146,116,7,147,117],[21,73,45,7,74,46],[1,53,23,37,54,24],[19,45,15,26,46,16],[5,145,115,10,146,116],[19,75,47,10,76,48],[15,54,24,25,55,25],[23,45,15,25,46,16],[13,145,115,3,146,116],[2,74,46,29,75,47],[42,54,24,1,55,25],[23,45,15,28,46,16],[17,145,115],[10,74,46,23,75,47],[10,54,24,35,55,25],[19,45,15,35,46,16],[17,145,115,1,146,116],[14,74,46,21,75,47],[29,54,24,19, |
| | | 55,25],[11,45,15,46,46,16],[13,145,115,6,146,116],[14,74,46,23,75,47],[44,54,24,7,55,25],[59,46,16,1,47,17],[12,151,121,7,152,122],[12,75,47,26,76,48],[39,54,24,14,55,25],[22,45,15,41,46,16],[6,151,121,14,152,122],[6,75,47,34,76,48],[46,54,24,10,55,25],[2,45,15,64,46,16],[17,152,122,4,153,123],[29,74,46,14,75,47],[49,54,24,10,55,25],[24,45,15,46,46,16],[4,152,122,18,153,123],[13,74,46,32,75,47],[48,54,24,14,55,25],[42,45,15,32,46,16],[20,147,117,4,148,118],[40,75,47,7,76,48],[43,54,24,22,55,25],[10, |
| | | 45,15,67,46,16],[19,148,118,6,149,119],[18,75,47,31,76,48],[34,54,24,34,55,25],[20,45,15,61,46,16]];p.getRSBlocks=function(a,c){var d=p.getRsBlockTable(a,c);if(void 0==d)throw Error("bad rs block @ typeNumber:"+a+"/errorCorrectLevel:"+c);for(var b=d.length/3,e=[],f=0;f<b;f++)for(var h=d[3*f+0],g=d[3*f+1],j=d[3*f+2],l=0;l<h;l++)e.push(new p(g,j));return e};p.getRsBlockTable=function(a,c){switch(c){case 1:return p.RS_BLOCK_TABLE[4*(a-1)+0];case 0:return p.RS_BLOCK_TABLE[4*(a-1)+1];case 3:return p.RS_BLOCK_TABLE[4* |
| | | (a-1)+2];case 2:return p.RS_BLOCK_TABLE[4*(a-1)+3]}};t.prototype={get:function(a){return 1==(this.buffer[Math.floor(a/8)]>>>7-a%8&1)},put:function(a,c){for(var d=0;d<c;d++)this.putBit(1==(a>>>c-d-1&1))},getLengthInBits:function(){return this.length},putBit:function(a){var c=Math.floor(this.length/8);this.buffer.length<=c&&this.buffer.push(0);a&&(this.buffer[c]|=128>>>this.length%8);this.length++}};"string"===typeof h&&(h={text:h});h=r.extend({},{render:"canvas",width:256,height:256,typeNumber:-1, |
| | | correctLevel:2,background:"#ffffff",foreground:"#000000"},h);return this.each(function(){var a;if("canvas"==h.render){a=new o(h.typeNumber,h.correctLevel);a.addData(h.text);a.make();var c=document.createElement("canvas");c.width=h.width;c.height=h.height;for(var d=c.getContext("2d"),b=h.width/a.getModuleCount(),e=h.height/a.getModuleCount(),f=0;f<a.getModuleCount();f++)for(var i=0;i<a.getModuleCount();i++){d.fillStyle=a.isDark(f,i)?h.foreground:h.background;var g=Math.ceil((i+1)*b)-Math.floor(i*b), |
| | | j=Math.ceil((f+1)*b)-Math.floor(f*b);d.fillRect(Math.round(i*b),Math.round(f*e),g,j)}}else{a=new o(h.typeNumber,h.correctLevel);a.addData(h.text);a.make();c=r("<table></table>").css("width",h.width+"px").css("height",h.height+"px").css("border","0px").css("border-collapse","collapse").css("background-color",h.background);d=h.width/a.getModuleCount();b=h.height/a.getModuleCount();for(e=0;e<a.getModuleCount();e++){f=r("<tr></tr>").css("height",b+"px").appendTo(c);for(i=0;i<a.getModuleCount();i++)r("<td></td>").css("width", |
| | | d+"px").css("background-color",a.isDark(e,i)?h.foreground:h.background).appendTo(f)}}a=c;jQuery(a).appendTo(this)})}})(jQuery); |
New file |
| | |
| | | //--------------------------------------------------------------------- |
| | | // QRCode for JavaScript |
| | | // |
| | | // Copyright (c) 2009 Kazuhiko Arase |
| | | // |
| | | // URL: http://www.d-project.com/ |
| | | // |
| | | // Licensed under the MIT license: |
| | | // http://www.opensource.org/licenses/mit-license.php |
| | | // |
| | | // The word "QR Code" is registered trademark of |
| | | // DENSO WAVE INCORPORATED |
| | | // http://www.denso-wave.com/qrcode/faqpatent-e.html |
| | | // |
| | | //--------------------------------------------------------------------- |
| | | |
| | | //--------------------------------------------------------------------- |
| | | // QR8bitByte |
| | | //--------------------------------------------------------------------- |
| | | |
| | | function QR8bitByte(data) { |
| | | this.mode = QRMode.MODE_8BIT_BYTE; |
| | | this.data = data; |
| | | } |
| | | |
| | | QR8bitByte.prototype = { |
| | | |
| | | getLength : function(buffer) { |
| | | return this.data.length; |
| | | }, |
| | | |
| | | write : function(buffer) { |
| | | for (var i = 0; i < this.data.length; i++) { |
| | | // not JIS ... |
| | | buffer.put(this.data.charCodeAt(i), 8); |
| | | } |
| | | } |
| | | }; |
| | | |
| | | //--------------------------------------------------------------------- |
| | | // QRCode |
| | | //--------------------------------------------------------------------- |
| | | |
| | | function QRCode(typeNumber, errorCorrectLevel) { |
| | | this.typeNumber = typeNumber; |
| | | this.errorCorrectLevel = errorCorrectLevel; |
| | | this.modules = null; |
| | | this.moduleCount = 0; |
| | | this.dataCache = null; |
| | | this.dataList = new Array(); |
| | | } |
| | | |
| | | QRCode.prototype = { |
| | | |
| | | addData : function(data) { |
| | | var newData = new QR8bitByte(data); |
| | | this.dataList.push(newData); |
| | | this.dataCache = null; |
| | | }, |
| | | |
| | | isDark : function(row, col) { |
| | | if (row < 0 || this.moduleCount <= row || col < 0 || this.moduleCount <= col) { |
| | | throw new Error(row + "," + col); |
| | | } |
| | | return this.modules[row][col]; |
| | | }, |
| | | |
| | | getModuleCount : function() { |
| | | return this.moduleCount; |
| | | }, |
| | | |
| | | make : function() { |
| | | // Calculate automatically typeNumber if provided is < 1 |
| | | if (this.typeNumber < 1 ){ |
| | | var typeNumber = 1; |
| | | for (typeNumber = 1; typeNumber < 40; typeNumber++) { |
| | | var rsBlocks = QRRSBlock.getRSBlocks(typeNumber, this.errorCorrectLevel); |
| | | |
| | | var buffer = new QRBitBuffer(); |
| | | var totalDataCount = 0; |
| | | for (var i = 0; i < rsBlocks.length; i++) { |
| | | totalDataCount += rsBlocks[i].dataCount; |
| | | } |
| | | |
| | | for (var i = 0; i < this.dataList.length; i++) { |
| | | var data = this.dataList[i]; |
| | | buffer.put(data.mode, 4); |
| | | buffer.put(data.getLength(), QRUtil.getLengthInBits(data.mode, typeNumber) ); |
| | | data.write(buffer); |
| | | } |
| | | if (buffer.getLengthInBits() <= totalDataCount * 8) |
| | | break; |
| | | } |
| | | this.typeNumber = typeNumber; |
| | | } |
| | | this.makeImpl(false, this.getBestMaskPattern() ); |
| | | }, |
| | | |
| | | makeImpl : function(test, maskPattern) { |
| | | |
| | | this.moduleCount = this.typeNumber * 4 + 17; |
| | | this.modules = new Array(this.moduleCount); |
| | | |
| | | for (var row = 0; row < this.moduleCount; row++) { |
| | | |
| | | this.modules[row] = new Array(this.moduleCount); |
| | | |
| | | for (var col = 0; col < this.moduleCount; col++) { |
| | | this.modules[row][col] = null;//(col + row) % 3; |
| | | } |
| | | } |
| | | |
| | | this.setupPositionProbePattern(0, 0); |
| | | this.setupPositionProbePattern(this.moduleCount - 7, 0); |
| | | this.setupPositionProbePattern(0, this.moduleCount - 7); |
| | | this.setupPositionAdjustPattern(); |
| | | this.setupTimingPattern(); |
| | | this.setupTypeInfo(test, maskPattern); |
| | | |
| | | if (this.typeNumber >= 7) { |
| | | this.setupTypeNumber(test); |
| | | } |
| | | |
| | | if (this.dataCache == null) { |
| | | this.dataCache = QRCode.createData(this.typeNumber, this.errorCorrectLevel, this.dataList); |
| | | } |
| | | |
| | | this.mapData(this.dataCache, maskPattern); |
| | | }, |
| | | |
| | | setupPositionProbePattern : function(row, col) { |
| | | |
| | | for (var r = -1; r <= 7; r++) { |
| | | |
| | | if (row + r <= -1 || this.moduleCount <= row + r) continue; |
| | | |
| | | for (var c = -1; c <= 7; c++) { |
| | | |
| | | if (col + c <= -1 || this.moduleCount <= col + c) continue; |
| | | |
| | | if ( (0 <= r && r <= 6 && (c == 0 || c == 6) ) |
| | | || (0 <= c && c <= 6 && (r == 0 || r == 6) ) |
| | | || (2 <= r && r <= 4 && 2 <= c && c <= 4) ) { |
| | | this.modules[row + r][col + c] = true; |
| | | } else { |
| | | this.modules[row + r][col + c] = false; |
| | | } |
| | | } |
| | | } |
| | | }, |
| | | |
| | | getBestMaskPattern : function() { |
| | | |
| | | var minLostPoint = 0; |
| | | var pattern = 0; |
| | | |
| | | for (var i = 0; i < 8; i++) { |
| | | |
| | | this.makeImpl(true, i); |
| | | |
| | | var lostPoint = QRUtil.getLostPoint(this); |
| | | |
| | | if (i == 0 || minLostPoint > lostPoint) { |
| | | minLostPoint = lostPoint; |
| | | pattern = i; |
| | | } |
| | | } |
| | | |
| | | return pattern; |
| | | }, |
| | | |
| | | createMovieClip : function(target_mc, instance_name, depth) { |
| | | |
| | | var qr_mc = target_mc.createEmptyMovieClip(instance_name, depth); |
| | | var cs = 1; |
| | | |
| | | this.make(); |
| | | |
| | | for (var row = 0; row < this.modules.length; row++) { |
| | | |
| | | var y = row * cs; |
| | | |
| | | for (var col = 0; col < this.modules[row].length; col++) { |
| | | |
| | | var x = col * cs; |
| | | var dark = this.modules[row][col]; |
| | | |
| | | if (dark) { |
| | | qr_mc.beginFill(0, 100); |
| | | qr_mc.moveTo(x, y); |
| | | qr_mc.lineTo(x + cs, y); |
| | | qr_mc.lineTo(x + cs, y + cs); |
| | | qr_mc.lineTo(x, y + cs); |
| | | qr_mc.endFill(); |
| | | } |
| | | } |
| | | } |
| | | |
| | | return qr_mc; |
| | | }, |
| | | |
| | | setupTimingPattern : function() { |
| | | |
| | | for (var r = 8; r < this.moduleCount - 8; r++) { |
| | | if (this.modules[r][6] != null) { |
| | | continue; |
| | | } |
| | | this.modules[r][6] = (r % 2 == 0); |
| | | } |
| | | |
| | | for (var c = 8; c < this.moduleCount - 8; c++) { |
| | | if (this.modules[6][c] != null) { |
| | | continue; |
| | | } |
| | | this.modules[6][c] = (c % 2 == 0); |
| | | } |
| | | }, |
| | | |
| | | setupPositionAdjustPattern : function() { |
| | | |
| | | var pos = QRUtil.getPatternPosition(this.typeNumber); |
| | | |
| | | for (var i = 0; i < pos.length; i++) { |
| | | |
| | | for (var j = 0; j < pos.length; j++) { |
| | | |
| | | var row = pos[i]; |
| | | var col = pos[j]; |
| | | |
| | | if (this.modules[row][col] != null) { |
| | | continue; |
| | | } |
| | | |
| | | for (var r = -2; r <= 2; r++) { |
| | | |
| | | for (var c = -2; c <= 2; c++) { |
| | | |
| | | if (r == -2 || r == 2 || c == -2 || c == 2 |
| | | || (r == 0 && c == 0) ) { |
| | | this.modules[row + r][col + c] = true; |
| | | } else { |
| | | this.modules[row + r][col + c] = false; |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | | }, |
| | | |
| | | setupTypeNumber : function(test) { |
| | | |
| | | var bits = QRUtil.getBCHTypeNumber(this.typeNumber); |
| | | |
| | | for (var i = 0; i < 18; i++) { |
| | | var mod = (!test && ( (bits >> i) & 1) == 1); |
| | | this.modules[Math.floor(i / 3)][i % 3 + this.moduleCount - 8 - 3] = mod; |
| | | } |
| | | |
| | | for (var i = 0; i < 18; i++) { |
| | | var mod = (!test && ( (bits >> i) & 1) == 1); |
| | | this.modules[i % 3 + this.moduleCount - 8 - 3][Math.floor(i / 3)] = mod; |
| | | } |
| | | }, |
| | | |
| | | setupTypeInfo : function(test, maskPattern) { |
| | | |
| | | var data = (this.errorCorrectLevel << 3) | maskPattern; |
| | | var bits = QRUtil.getBCHTypeInfo(data); |
| | | |
| | | // vertical |
| | | for (var i = 0; i < 15; i++) { |
| | | |
| | | var mod = (!test && ( (bits >> i) & 1) == 1); |
| | | |
| | | if (i < 6) { |
| | | this.modules[i][8] = mod; |
| | | } else if (i < 8) { |
| | | this.modules[i + 1][8] = mod; |
| | | } else { |
| | | this.modules[this.moduleCount - 15 + i][8] = mod; |
| | | } |
| | | } |
| | | |
| | | // horizontal |
| | | for (var i = 0; i < 15; i++) { |
| | | |
| | | var mod = (!test && ( (bits >> i) & 1) == 1); |
| | | |
| | | if (i < 8) { |
| | | this.modules[8][this.moduleCount - i - 1] = mod; |
| | | } else if (i < 9) { |
| | | this.modules[8][15 - i - 1 + 1] = mod; |
| | | } else { |
| | | this.modules[8][15 - i - 1] = mod; |
| | | } |
| | | } |
| | | |
| | | // fixed module |
| | | this.modules[this.moduleCount - 8][8] = (!test); |
| | | |
| | | }, |
| | | |
| | | mapData : function(data, maskPattern) { |
| | | |
| | | var inc = -1; |
| | | var row = this.moduleCount - 1; |
| | | var bitIndex = 7; |
| | | var byteIndex = 0; |
| | | |
| | | for (var col = this.moduleCount - 1; col > 0; col -= 2) { |
| | | |
| | | if (col == 6) col--; |
| | | |
| | | while (true) { |
| | | |
| | | for (var c = 0; c < 2; c++) { |
| | | |
| | | if (this.modules[row][col - c] == null) { |
| | | |
| | | var dark = false; |
| | | |
| | | if (byteIndex < data.length) { |
| | | dark = ( ( (data[byteIndex] >>> bitIndex) & 1) == 1); |
| | | } |
| | | |
| | | var mask = QRUtil.getMask(maskPattern, row, col - c); |
| | | |
| | | if (mask) { |
| | | dark = !dark; |
| | | } |
| | | |
| | | this.modules[row][col - c] = dark; |
| | | bitIndex--; |
| | | |
| | | if (bitIndex == -1) { |
| | | byteIndex++; |
| | | bitIndex = 7; |
| | | } |
| | | } |
| | | } |
| | | |
| | | row += inc; |
| | | |
| | | if (row < 0 || this.moduleCount <= row) { |
| | | row -= inc; |
| | | inc = -inc; |
| | | break; |
| | | } |
| | | } |
| | | } |
| | | |
| | | } |
| | | |
| | | }; |
| | | |
| | | QRCode.PAD0 = 0xEC; |
| | | QRCode.PAD1 = 0x11; |
| | | |
| | | QRCode.createData = function(typeNumber, errorCorrectLevel, dataList) { |
| | | |
| | | var rsBlocks = QRRSBlock.getRSBlocks(typeNumber, errorCorrectLevel); |
| | | |
| | | var buffer = new QRBitBuffer(); |
| | | |
| | | for (var i = 0; i < dataList.length; i++) { |
| | | var data = dataList[i]; |
| | | buffer.put(data.mode, 4); |
| | | buffer.put(data.getLength(), QRUtil.getLengthInBits(data.mode, typeNumber) ); |
| | | data.write(buffer); |
| | | } |
| | | |
| | | // calc num max data. |
| | | var totalDataCount = 0; |
| | | for (var i = 0; i < rsBlocks.length; i++) { |
| | | totalDataCount += rsBlocks[i].dataCount; |
| | | } |
| | | |
| | | if (buffer.getLengthInBits() > totalDataCount * 8) { |
| | | throw new Error("code length overflow. (" |
| | | + buffer.getLengthInBits() |
| | | + ">" |
| | | + totalDataCount * 8 |
| | | + ")"); |
| | | } |
| | | |
| | | // end code |
| | | if (buffer.getLengthInBits() + 4 <= totalDataCount * 8) { |
| | | buffer.put(0, 4); |
| | | } |
| | | |
| | | // padding |
| | | while (buffer.getLengthInBits() % 8 != 0) { |
| | | buffer.putBit(false); |
| | | } |
| | | |
| | | // padding |
| | | while (true) { |
| | | |
| | | if (buffer.getLengthInBits() >= totalDataCount * 8) { |
| | | break; |
| | | } |
| | | buffer.put(QRCode.PAD0, 8); |
| | | |
| | | if (buffer.getLengthInBits() >= totalDataCount * 8) { |
| | | break; |
| | | } |
| | | buffer.put(QRCode.PAD1, 8); |
| | | } |
| | | |
| | | return QRCode.createBytes(buffer, rsBlocks); |
| | | } |
| | | |
| | | QRCode.createBytes = function(buffer, rsBlocks) { |
| | | |
| | | var offset = 0; |
| | | |
| | | var maxDcCount = 0; |
| | | var maxEcCount = 0; |
| | | |
| | | var dcdata = new Array(rsBlocks.length); |
| | | var ecdata = new Array(rsBlocks.length); |
| | | |
| | | for (var r = 0; r < rsBlocks.length; r++) { |
| | | |
| | | var dcCount = rsBlocks[r].dataCount; |
| | | var ecCount = rsBlocks[r].totalCount - dcCount; |
| | | |
| | | maxDcCount = Math.max(maxDcCount, dcCount); |
| | | maxEcCount = Math.max(maxEcCount, ecCount); |
| | | |
| | | dcdata[r] = new Array(dcCount); |
| | | |
| | | for (var i = 0; i < dcdata[r].length; i++) { |
| | | dcdata[r][i] = 0xff & buffer.buffer[i + offset]; |
| | | } |
| | | offset += dcCount; |
| | | |
| | | var rsPoly = QRUtil.getErrorCorrectPolynomial(ecCount); |
| | | var rawPoly = new QRPolynomial(dcdata[r], rsPoly.getLength() - 1); |
| | | |
| | | var modPoly = rawPoly.mod(rsPoly); |
| | | ecdata[r] = new Array(rsPoly.getLength() - 1); |
| | | for (var i = 0; i < ecdata[r].length; i++) { |
| | | var modIndex = i + modPoly.getLength() - ecdata[r].length; |
| | | ecdata[r][i] = (modIndex >= 0)? modPoly.get(modIndex) : 0; |
| | | } |
| | | |
| | | } |
| | | |
| | | var totalCodeCount = 0; |
| | | for (var i = 0; i < rsBlocks.length; i++) { |
| | | totalCodeCount += rsBlocks[i].totalCount; |
| | | } |
| | | |
| | | var data = new Array(totalCodeCount); |
| | | var index = 0; |
| | | |
| | | for (var i = 0; i < maxDcCount; i++) { |
| | | for (var r = 0; r < rsBlocks.length; r++) { |
| | | if (i < dcdata[r].length) { |
| | | data[index++] = dcdata[r][i]; |
| | | } |
| | | } |
| | | } |
| | | |
| | | for (var i = 0; i < maxEcCount; i++) { |
| | | for (var r = 0; r < rsBlocks.length; r++) { |
| | | if (i < ecdata[r].length) { |
| | | data[index++] = ecdata[r][i]; |
| | | } |
| | | } |
| | | } |
| | | |
| | | return data; |
| | | |
| | | } |
| | | |
| | | //--------------------------------------------------------------------- |
| | | // QRMode |
| | | //--------------------------------------------------------------------- |
| | | |
| | | var QRMode = { |
| | | MODE_NUMBER : 1 << 0, |
| | | MODE_ALPHA_NUM : 1 << 1, |
| | | MODE_8BIT_BYTE : 1 << 2, |
| | | MODE_KANJI : 1 << 3 |
| | | }; |
| | | |
| | | //--------------------------------------------------------------------- |
| | | // QRErrorCorrectLevel |
| | | //--------------------------------------------------------------------- |
| | | |
| | | var QRErrorCorrectLevel = { |
| | | L : 1, |
| | | M : 0, |
| | | Q : 3, |
| | | H : 2 |
| | | }; |
| | | |
| | | //--------------------------------------------------------------------- |
| | | // QRMaskPattern |
| | | //--------------------------------------------------------------------- |
| | | |
| | | var QRMaskPattern = { |
| | | PATTERN000 : 0, |
| | | PATTERN001 : 1, |
| | | PATTERN010 : 2, |
| | | PATTERN011 : 3, |
| | | PATTERN100 : 4, |
| | | PATTERN101 : 5, |
| | | PATTERN110 : 6, |
| | | PATTERN111 : 7 |
| | | }; |
| | | |
| | | //--------------------------------------------------------------------- |
| | | // QRUtil |
| | | //--------------------------------------------------------------------- |
| | | |
| | | var QRUtil = { |
| | | |
| | | PATTERN_POSITION_TABLE : [ |
| | | [], |
| | | [6, 18], |
| | | [6, 22], |
| | | [6, 26], |
| | | [6, 30], |
| | | [6, 34], |
| | | [6, 22, 38], |
| | | [6, 24, 42], |
| | | [6, 26, 46], |
| | | [6, 28, 50], |
| | | [6, 30, 54], |
| | | [6, 32, 58], |
| | | [6, 34, 62], |
| | | [6, 26, 46, 66], |
| | | [6, 26, 48, 70], |
| | | [6, 26, 50, 74], |
| | | [6, 30, 54, 78], |
| | | [6, 30, 56, 82], |
| | | [6, 30, 58, 86], |
| | | [6, 34, 62, 90], |
| | | [6, 28, 50, 72, 94], |
| | | [6, 26, 50, 74, 98], |
| | | [6, 30, 54, 78, 102], |
| | | [6, 28, 54, 80, 106], |
| | | [6, 32, 58, 84, 110], |
| | | [6, 30, 58, 86, 114], |
| | | [6, 34, 62, 90, 118], |
| | | [6, 26, 50, 74, 98, 122], |
| | | [6, 30, 54, 78, 102, 126], |
| | | [6, 26, 52, 78, 104, 130], |
| | | [6, 30, 56, 82, 108, 134], |
| | | [6, 34, 60, 86, 112, 138], |
| | | [6, 30, 58, 86, 114, 142], |
| | | [6, 34, 62, 90, 118, 146], |
| | | [6, 30, 54, 78, 102, 126, 150], |
| | | [6, 24, 50, 76, 102, 128, 154], |
| | | [6, 28, 54, 80, 106, 132, 158], |
| | | [6, 32, 58, 84, 110, 136, 162], |
| | | [6, 26, 54, 82, 110, 138, 166], |
| | | [6, 30, 58, 86, 114, 142, 170] |
| | | ], |
| | | |
| | | G15 : (1 << 10) | (1 << 8) | (1 << 5) | (1 << 4) | (1 << 2) | (1 << 1) | (1 << 0), |
| | | G18 : (1 << 12) | (1 << 11) | (1 << 10) | (1 << 9) | (1 << 8) | (1 << 5) | (1 << 2) | (1 << 0), |
| | | G15_MASK : (1 << 14) | (1 << 12) | (1 << 10) | (1 << 4) | (1 << 1), |
| | | |
| | | getBCHTypeInfo : function(data) { |
| | | var d = data << 10; |
| | | while (QRUtil.getBCHDigit(d) - QRUtil.getBCHDigit(QRUtil.G15) >= 0) { |
| | | d ^= (QRUtil.G15 << (QRUtil.getBCHDigit(d) - QRUtil.getBCHDigit(QRUtil.G15) ) ); |
| | | } |
| | | return ( (data << 10) | d) ^ QRUtil.G15_MASK; |
| | | }, |
| | | |
| | | getBCHTypeNumber : function(data) { |
| | | var d = data << 12; |
| | | while (QRUtil.getBCHDigit(d) - QRUtil.getBCHDigit(QRUtil.G18) >= 0) { |
| | | d ^= (QRUtil.G18 << (QRUtil.getBCHDigit(d) - QRUtil.getBCHDigit(QRUtil.G18) ) ); |
| | | } |
| | | return (data << 12) | d; |
| | | }, |
| | | |
| | | getBCHDigit : function(data) { |
| | | |
| | | var digit = 0; |
| | | |
| | | while (data != 0) { |
| | | digit++; |
| | | data >>>= 1; |
| | | } |
| | | |
| | | return digit; |
| | | }, |
| | | |
| | | getPatternPosition : function(typeNumber) { |
| | | return QRUtil.PATTERN_POSITION_TABLE[typeNumber - 1]; |
| | | }, |
| | | |
| | | getMask : function(maskPattern, i, j) { |
| | | |
| | | switch (maskPattern) { |
| | | |
| | | case QRMaskPattern.PATTERN000 : return (i + j) % 2 == 0; |
| | | case QRMaskPattern.PATTERN001 : return i % 2 == 0; |
| | | case QRMaskPattern.PATTERN010 : return j % 3 == 0; |
| | | case QRMaskPattern.PATTERN011 : return (i + j) % 3 == 0; |
| | | case QRMaskPattern.PATTERN100 : return (Math.floor(i / 2) + Math.floor(j / 3) ) % 2 == 0; |
| | | case QRMaskPattern.PATTERN101 : return (i * j) % 2 + (i * j) % 3 == 0; |
| | | case QRMaskPattern.PATTERN110 : return ( (i * j) % 2 + (i * j) % 3) % 2 == 0; |
| | | case QRMaskPattern.PATTERN111 : return ( (i * j) % 3 + (i + j) % 2) % 2 == 0; |
| | | |
| | | default : |
| | | throw new Error("bad maskPattern:" + maskPattern); |
| | | } |
| | | }, |
| | | |
| | | getErrorCorrectPolynomial : function(errorCorrectLength) { |
| | | |
| | | var a = new QRPolynomial([1], 0); |
| | | |
| | | for (var i = 0; i < errorCorrectLength; i++) { |
| | | a = a.multiply(new QRPolynomial([1, QRMath.gexp(i)], 0) ); |
| | | } |
| | | |
| | | return a; |
| | | }, |
| | | |
| | | getLengthInBits : function(mode, type) { |
| | | |
| | | if (1 <= type && type < 10) { |
| | | |
| | | // 1 - 9 |
| | | |
| | | switch(mode) { |
| | | case QRMode.MODE_NUMBER : return 10; |
| | | case QRMode.MODE_ALPHA_NUM : return 9; |
| | | case QRMode.MODE_8BIT_BYTE : return 8; |
| | | case QRMode.MODE_KANJI : return 8; |
| | | default : |
| | | throw new Error("mode:" + mode); |
| | | } |
| | | |
| | | } else if (type < 27) { |
| | | |
| | | // 10 - 26 |
| | | |
| | | switch(mode) { |
| | | case QRMode.MODE_NUMBER : return 12; |
| | | case QRMode.MODE_ALPHA_NUM : return 11; |
| | | case QRMode.MODE_8BIT_BYTE : return 16; |
| | | case QRMode.MODE_KANJI : return 10; |
| | | default : |
| | | throw new Error("mode:" + mode); |
| | | } |
| | | |
| | | } else if (type < 41) { |
| | | |
| | | // 27 - 40 |
| | | |
| | | switch(mode) { |
| | | case QRMode.MODE_NUMBER : return 14; |
| | | case QRMode.MODE_ALPHA_NUM : return 13; |
| | | case QRMode.MODE_8BIT_BYTE : return 16; |
| | | case QRMode.MODE_KANJI : return 12; |
| | | default : |
| | | throw new Error("mode:" + mode); |
| | | } |
| | | |
| | | } else { |
| | | throw new Error("type:" + type); |
| | | } |
| | | }, |
| | | |
| | | getLostPoint : function(qrCode) { |
| | | |
| | | var moduleCount = qrCode.getModuleCount(); |
| | | |
| | | var lostPoint = 0; |
| | | |
| | | // LEVEL1 |
| | | |
| | | for (var row = 0; row < moduleCount; row++) { |
| | | |
| | | for (var col = 0; col < moduleCount; col++) { |
| | | |
| | | var sameCount = 0; |
| | | var dark = qrCode.isDark(row, col); |
| | | |
| | | for (var r = -1; r <= 1; r++) { |
| | | |
| | | if (row + r < 0 || moduleCount <= row + r) { |
| | | continue; |
| | | } |
| | | |
| | | for (var c = -1; c <= 1; c++) { |
| | | |
| | | if (col + c < 0 || moduleCount <= col + c) { |
| | | continue; |
| | | } |
| | | |
| | | if (r == 0 && c == 0) { |
| | | continue; |
| | | } |
| | | |
| | | if (dark == qrCode.isDark(row + r, col + c) ) { |
| | | sameCount++; |
| | | } |
| | | } |
| | | } |
| | | |
| | | if (sameCount > 5) { |
| | | lostPoint += (3 + sameCount - 5); |
| | | } |
| | | } |
| | | } |
| | | |
| | | // LEVEL2 |
| | | |
| | | for (var row = 0; row < moduleCount - 1; row++) { |
| | | for (var col = 0; col < moduleCount - 1; col++) { |
| | | var count = 0; |
| | | if (qrCode.isDark(row, col ) ) count++; |
| | | if (qrCode.isDark(row + 1, col ) ) count++; |
| | | if (qrCode.isDark(row, col + 1) ) count++; |
| | | if (qrCode.isDark(row + 1, col + 1) ) count++; |
| | | if (count == 0 || count == 4) { |
| | | lostPoint += 3; |
| | | } |
| | | } |
| | | } |
| | | |
| | | // LEVEL3 |
| | | |
| | | for (var row = 0; row < moduleCount; row++) { |
| | | for (var col = 0; col < moduleCount - 6; col++) { |
| | | if (qrCode.isDark(row, col) |
| | | && !qrCode.isDark(row, col + 1) |
| | | && qrCode.isDark(row, col + 2) |
| | | && qrCode.isDark(row, col + 3) |
| | | && qrCode.isDark(row, col + 4) |
| | | && !qrCode.isDark(row, col + 5) |
| | | && qrCode.isDark(row, col + 6) ) { |
| | | lostPoint += 40; |
| | | } |
| | | } |
| | | } |
| | | |
| | | for (var col = 0; col < moduleCount; col++) { |
| | | for (var row = 0; row < moduleCount - 6; row++) { |
| | | if (qrCode.isDark(row, col) |
| | | && !qrCode.isDark(row + 1, col) |
| | | && qrCode.isDark(row + 2, col) |
| | | && qrCode.isDark(row + 3, col) |
| | | && qrCode.isDark(row + 4, col) |
| | | && !qrCode.isDark(row + 5, col) |
| | | && qrCode.isDark(row + 6, col) ) { |
| | | lostPoint += 40; |
| | | } |
| | | } |
| | | } |
| | | |
| | | // LEVEL4 |
| | | |
| | | var darkCount = 0; |
| | | |
| | | for (var col = 0; col < moduleCount; col++) { |
| | | for (var row = 0; row < moduleCount; row++) { |
| | | if (qrCode.isDark(row, col) ) { |
| | | darkCount++; |
| | | } |
| | | } |
| | | } |
| | | |
| | | var ratio = Math.abs(100 * darkCount / moduleCount / moduleCount - 50) / 5; |
| | | lostPoint += ratio * 10; |
| | | |
| | | return lostPoint; |
| | | } |
| | | |
| | | }; |
| | | |
| | | |
| | | //--------------------------------------------------------------------- |
| | | // QRMath |
| | | //--------------------------------------------------------------------- |
| | | |
| | | var QRMath = { |
| | | |
| | | glog : function(n) { |
| | | |
| | | if (n < 1) { |
| | | throw new Error("glog(" + n + ")"); |
| | | } |
| | | |
| | | return QRMath.LOG_TABLE[n]; |
| | | }, |
| | | |
| | | gexp : function(n) { |
| | | |
| | | while (n < 0) { |
| | | n += 255; |
| | | } |
| | | |
| | | while (n >= 256) { |
| | | n -= 255; |
| | | } |
| | | |
| | | return QRMath.EXP_TABLE[n]; |
| | | }, |
| | | |
| | | EXP_TABLE : new Array(256), |
| | | |
| | | LOG_TABLE : new Array(256) |
| | | |
| | | }; |
| | | |
| | | for (var i = 0; i < 8; i++) { |
| | | QRMath.EXP_TABLE[i] = 1 << i; |
| | | } |
| | | for (var i = 8; i < 256; i++) { |
| | | QRMath.EXP_TABLE[i] = QRMath.EXP_TABLE[i - 4] |
| | | ^ QRMath.EXP_TABLE[i - 5] |
| | | ^ QRMath.EXP_TABLE[i - 6] |
| | | ^ QRMath.EXP_TABLE[i - 8]; |
| | | } |
| | | for (var i = 0; i < 255; i++) { |
| | | QRMath.LOG_TABLE[QRMath.EXP_TABLE[i] ] = i; |
| | | } |
| | | |
| | | //--------------------------------------------------------------------- |
| | | // QRPolynomial |
| | | //--------------------------------------------------------------------- |
| | | |
| | | function QRPolynomial(num, shift) { |
| | | |
| | | if (num.length == undefined) { |
| | | throw new Error(num.length + "/" + shift); |
| | | } |
| | | |
| | | var offset = 0; |
| | | |
| | | while (offset < num.length && num[offset] == 0) { |
| | | offset++; |
| | | } |
| | | |
| | | this.num = new Array(num.length - offset + shift); |
| | | for (var i = 0; i < num.length - offset; i++) { |
| | | this.num[i] = num[i + offset]; |
| | | } |
| | | } |
| | | |
| | | QRPolynomial.prototype = { |
| | | |
| | | get : function(index) { |
| | | return this.num[index]; |
| | | }, |
| | | |
| | | getLength : function() { |
| | | return this.num.length; |
| | | }, |
| | | |
| | | multiply : function(e) { |
| | | |
| | | var num = new Array(this.getLength() + e.getLength() - 1); |
| | | |
| | | for (var i = 0; i < this.getLength(); i++) { |
| | | for (var j = 0; j < e.getLength(); j++) { |
| | | num[i + j] ^= QRMath.gexp(QRMath.glog(this.get(i) ) + QRMath.glog(e.get(j) ) ); |
| | | } |
| | | } |
| | | |
| | | return new QRPolynomial(num, 0); |
| | | }, |
| | | |
| | | mod : function(e) { |
| | | |
| | | if (this.getLength() - e.getLength() < 0) { |
| | | return this; |
| | | } |
| | | |
| | | var ratio = QRMath.glog(this.get(0) ) - QRMath.glog(e.get(0) ); |
| | | |
| | | var num = new Array(this.getLength() ); |
| | | |
| | | for (var i = 0; i < this.getLength(); i++) { |
| | | num[i] = this.get(i); |
| | | } |
| | | |
| | | for (var i = 0; i < e.getLength(); i++) { |
| | | num[i] ^= QRMath.gexp(QRMath.glog(e.get(i) ) + ratio); |
| | | } |
| | | |
| | | // recursive call |
| | | return new QRPolynomial(num, 0).mod(e); |
| | | } |
| | | }; |
| | | |
| | | //--------------------------------------------------------------------- |
| | | // QRRSBlock |
| | | //--------------------------------------------------------------------- |
| | | |
| | | function QRRSBlock(totalCount, dataCount) { |
| | | this.totalCount = totalCount; |
| | | this.dataCount = dataCount; |
| | | } |
| | | |
| | | QRRSBlock.RS_BLOCK_TABLE = [ |
| | | |
| | | // L |
| | | // M |
| | | // Q |
| | | // H |
| | | |
| | | // 1 |
| | | [1, 26, 19], |
| | | [1, 26, 16], |
| | | [1, 26, 13], |
| | | [1, 26, 9], |
| | | |
| | | // 2 |
| | | [1, 44, 34], |
| | | [1, 44, 28], |
| | | [1, 44, 22], |
| | | [1, 44, 16], |
| | | |
| | | // 3 |
| | | [1, 70, 55], |
| | | [1, 70, 44], |
| | | [2, 35, 17], |
| | | [2, 35, 13], |
| | | |
| | | // 4 |
| | | [1, 100, 80], |
| | | [2, 50, 32], |
| | | [2, 50, 24], |
| | | [4, 25, 9], |
| | | |
| | | // 5 |
| | | [1, 134, 108], |
| | | [2, 67, 43], |
| | | [2, 33, 15, 2, 34, 16], |
| | | [2, 33, 11, 2, 34, 12], |
| | | |
| | | // 6 |
| | | [2, 86, 68], |
| | | [4, 43, 27], |
| | | [4, 43, 19], |
| | | [4, 43, 15], |
| | | |
| | | // 7 |
| | | [2, 98, 78], |
| | | [4, 49, 31], |
| | | [2, 32, 14, 4, 33, 15], |
| | | [4, 39, 13, 1, 40, 14], |
| | | |
| | | // 8 |
| | | [2, 121, 97], |
| | | [2, 60, 38, 2, 61, 39], |
| | | [4, 40, 18, 2, 41, 19], |
| | | [4, 40, 14, 2, 41, 15], |
| | | |
| | | // 9 |
| | | [2, 146, 116], |
| | | [3, 58, 36, 2, 59, 37], |
| | | [4, 36, 16, 4, 37, 17], |
| | | [4, 36, 12, 4, 37, 13], |
| | | |
| | | // 10 |
| | | [2, 86, 68, 2, 87, 69], |
| | | [4, 69, 43, 1, 70, 44], |
| | | [6, 43, 19, 2, 44, 20], |
| | | [6, 43, 15, 2, 44, 16], |
| | | |
| | | // 11 |
| | | [4, 101, 81], |
| | | [1, 80, 50, 4, 81, 51], |
| | | [4, 50, 22, 4, 51, 23], |
| | | [3, 36, 12, 8, 37, 13], |
| | | |
| | | // 12 |
| | | [2, 116, 92, 2, 117, 93], |
| | | [6, 58, 36, 2, 59, 37], |
| | | [4, 46, 20, 6, 47, 21], |
| | | [7, 42, 14, 4, 43, 15], |
| | | |
| | | // 13 |
| | | [4, 133, 107], |
| | | [8, 59, 37, 1, 60, 38], |
| | | [8, 44, 20, 4, 45, 21], |
| | | [12, 33, 11, 4, 34, 12], |
| | | |
| | | // 14 |
| | | [3, 145, 115, 1, 146, 116], |
| | | [4, 64, 40, 5, 65, 41], |
| | | [11, 36, 16, 5, 37, 17], |
| | | [11, 36, 12, 5, 37, 13], |
| | | |
| | | // 15 |
| | | [5, 109, 87, 1, 110, 88], |
| | | [5, 65, 41, 5, 66, 42], |
| | | [5, 54, 24, 7, 55, 25], |
| | | [11, 36, 12], |
| | | |
| | | // 16 |
| | | [5, 122, 98, 1, 123, 99], |
| | | [7, 73, 45, 3, 74, 46], |
| | | [15, 43, 19, 2, 44, 20], |
| | | [3, 45, 15, 13, 46, 16], |
| | | |
| | | // 17 |
| | | [1, 135, 107, 5, 136, 108], |
| | | [10, 74, 46, 1, 75, 47], |
| | | [1, 50, 22, 15, 51, 23], |
| | | [2, 42, 14, 17, 43, 15], |
| | | |
| | | // 18 |
| | | [5, 150, 120, 1, 151, 121], |
| | | [9, 69, 43, 4, 70, 44], |
| | | [17, 50, 22, 1, 51, 23], |
| | | [2, 42, 14, 19, 43, 15], |
| | | |
| | | // 19 |
| | | [3, 141, 113, 4, 142, 114], |
| | | [3, 70, 44, 11, 71, 45], |
| | | [17, 47, 21, 4, 48, 22], |
| | | [9, 39, 13, 16, 40, 14], |
| | | |
| | | // 20 |
| | | [3, 135, 107, 5, 136, 108], |
| | | [3, 67, 41, 13, 68, 42], |
| | | [15, 54, 24, 5, 55, 25], |
| | | [15, 43, 15, 10, 44, 16], |
| | | |
| | | // 21 |
| | | [4, 144, 116, 4, 145, 117], |
| | | [17, 68, 42], |
| | | [17, 50, 22, 6, 51, 23], |
| | | [19, 46, 16, 6, 47, 17], |
| | | |
| | | // 22 |
| | | [2, 139, 111, 7, 140, 112], |
| | | [17, 74, 46], |
| | | [7, 54, 24, 16, 55, 25], |
| | | [34, 37, 13], |
| | | |
| | | // 23 |
| | | [4, 151, 121, 5, 152, 122], |
| | | [4, 75, 47, 14, 76, 48], |
| | | [11, 54, 24, 14, 55, 25], |
| | | [16, 45, 15, 14, 46, 16], |
| | | |
| | | // 24 |
| | | [6, 147, 117, 4, 148, 118], |
| | | [6, 73, 45, 14, 74, 46], |
| | | [11, 54, 24, 16, 55, 25], |
| | | [30, 46, 16, 2, 47, 17], |
| | | |
| | | // 25 |
| | | [8, 132, 106, 4, 133, 107], |
| | | [8, 75, 47, 13, 76, 48], |
| | | [7, 54, 24, 22, 55, 25], |
| | | [22, 45, 15, 13, 46, 16], |
| | | |
| | | // 26 |
| | | [10, 142, 114, 2, 143, 115], |
| | | [19, 74, 46, 4, 75, 47], |
| | | [28, 50, 22, 6, 51, 23], |
| | | [33, 46, 16, 4, 47, 17], |
| | | |
| | | // 27 |
| | | [8, 152, 122, 4, 153, 123], |
| | | [22, 73, 45, 3, 74, 46], |
| | | [8, 53, 23, 26, 54, 24], |
| | | [12, 45, 15, 28, 46, 16], |
| | | |
| | | // 28 |
| | | [3, 147, 117, 10, 148, 118], |
| | | [3, 73, 45, 23, 74, 46], |
| | | [4, 54, 24, 31, 55, 25], |
| | | [11, 45, 15, 31, 46, 16], |
| | | |
| | | // 29 |
| | | [7, 146, 116, 7, 147, 117], |
| | | [21, 73, 45, 7, 74, 46], |
| | | [1, 53, 23, 37, 54, 24], |
| | | [19, 45, 15, 26, 46, 16], |
| | | |
| | | // 30 |
| | | [5, 145, 115, 10, 146, 116], |
| | | [19, 75, 47, 10, 76, 48], |
| | | [15, 54, 24, 25, 55, 25], |
| | | [23, 45, 15, 25, 46, 16], |
| | | |
| | | // 31 |
| | | [13, 145, 115, 3, 146, 116], |
| | | [2, 74, 46, 29, 75, 47], |
| | | [42, 54, 24, 1, 55, 25], |
| | | [23, 45, 15, 28, 46, 16], |
| | | |
| | | // 32 |
| | | [17, 145, 115], |
| | | [10, 74, 46, 23, 75, 47], |
| | | [10, 54, 24, 35, 55, 25], |
| | | [19, 45, 15, 35, 46, 16], |
| | | |
| | | // 33 |
| | | [17, 145, 115, 1, 146, 116], |
| | | [14, 74, 46, 21, 75, 47], |
| | | [29, 54, 24, 19, 55, 25], |
| | | [11, 45, 15, 46, 46, 16], |
| | | |
| | | // 34 |
| | | [13, 145, 115, 6, 146, 116], |
| | | [14, 74, 46, 23, 75, 47], |
| | | [44, 54, 24, 7, 55, 25], |
| | | [59, 46, 16, 1, 47, 17], |
| | | |
| | | // 35 |
| | | [12, 151, 121, 7, 152, 122], |
| | | [12, 75, 47, 26, 76, 48], |
| | | [39, 54, 24, 14, 55, 25], |
| | | [22, 45, 15, 41, 46, 16], |
| | | |
| | | // 36 |
| | | [6, 151, 121, 14, 152, 122], |
| | | [6, 75, 47, 34, 76, 48], |
| | | [46, 54, 24, 10, 55, 25], |
| | | [2, 45, 15, 64, 46, 16], |
| | | |
| | | // 37 |
| | | [17, 152, 122, 4, 153, 123], |
| | | [29, 74, 46, 14, 75, 47], |
| | | [49, 54, 24, 10, 55, 25], |
| | | [24, 45, 15, 46, 46, 16], |
| | | |
| | | // 38 |
| | | [4, 152, 122, 18, 153, 123], |
| | | [13, 74, 46, 32, 75, 47], |
| | | [48, 54, 24, 14, 55, 25], |
| | | [42, 45, 15, 32, 46, 16], |
| | | |
| | | // 39 |
| | | [20, 147, 117, 4, 148, 118], |
| | | [40, 75, 47, 7, 76, 48], |
| | | [43, 54, 24, 22, 55, 25], |
| | | [10, 45, 15, 67, 46, 16], |
| | | |
| | | // 40 |
| | | [19, 148, 118, 6, 149, 119], |
| | | [18, 75, 47, 31, 76, 48], |
| | | [34, 54, 24, 34, 55, 25], |
| | | [20, 45, 15, 61, 46, 16] |
| | | ]; |
| | | |
| | | QRRSBlock.getRSBlocks = function(typeNumber, errorCorrectLevel) { |
| | | |
| | | var rsBlock = QRRSBlock.getRsBlockTable(typeNumber, errorCorrectLevel); |
| | | |
| | | if (rsBlock == undefined) { |
| | | throw new Error("bad rs block @ typeNumber:" + typeNumber + "/errorCorrectLevel:" + errorCorrectLevel); |
| | | } |
| | | |
| | | var length = rsBlock.length / 3; |
| | | |
| | | var list = new Array(); |
| | | |
| | | for (var i = 0; i < length; i++) { |
| | | |
| | | var count = rsBlock[i * 3 + 0]; |
| | | var totalCount = rsBlock[i * 3 + 1]; |
| | | var dataCount = rsBlock[i * 3 + 2]; |
| | | |
| | | for (var j = 0; j < count; j++) { |
| | | list.push(new QRRSBlock(totalCount, dataCount) ); |
| | | } |
| | | } |
| | | |
| | | return list; |
| | | } |
| | | |
| | | QRRSBlock.getRsBlockTable = function(typeNumber, errorCorrectLevel) { |
| | | |
| | | switch(errorCorrectLevel) { |
| | | case QRErrorCorrectLevel.L : |
| | | return QRRSBlock.RS_BLOCK_TABLE[(typeNumber - 1) * 4 + 0]; |
| | | case QRErrorCorrectLevel.M : |
| | | return QRRSBlock.RS_BLOCK_TABLE[(typeNumber - 1) * 4 + 1]; |
| | | case QRErrorCorrectLevel.Q : |
| | | return QRRSBlock.RS_BLOCK_TABLE[(typeNumber - 1) * 4 + 2]; |
| | | case QRErrorCorrectLevel.H : |
| | | return QRRSBlock.RS_BLOCK_TABLE[(typeNumber - 1) * 4 + 3]; |
| | | default : |
| | | return undefined; |
| | | } |
| | | } |
| | | |
| | | //--------------------------------------------------------------------- |
| | | // QRBitBuffer |
| | | //--------------------------------------------------------------------- |
| | | |
| | | function QRBitBuffer() { |
| | | this.buffer = new Array(); |
| | | this.length = 0; |
| | | } |
| | | |
| | | QRBitBuffer.prototype = { |
| | | |
| | | get : function(index) { |
| | | var bufIndex = Math.floor(index / 8); |
| | | return ( (this.buffer[bufIndex] >>> (7 - index % 8) ) & 1) == 1; |
| | | }, |
| | | |
| | | put : function(num, length) { |
| | | for (var i = 0; i < length; i++) { |
| | | this.putBit( ( (num >>> (length - i - 1) ) & 1) == 1); |
| | | } |
| | | }, |
| | | |
| | | getLengthInBits : function() { |
| | | return this.length; |
| | | }, |
| | | |
| | | putBit : function(bit) { |
| | | |
| | | var bufIndex = Math.floor(this.length / 8); |
| | | if (this.buffer.length <= bufIndex) { |
| | | this.buffer.push(0); |
| | | } |
| | | |
| | | if (bit) { |
| | | this.buffer[bufIndex] |= (0x80 >>> (this.length % 8) ); |
| | | } |
| | | |
| | | this.length++; |
| | | } |
| | | }; |
New file |
| | |
| | | var QRCode;!function(){function a(a){this.mode=c.MODE_8BIT_BYTE,this.data=a,this.parsedData=[];for(var b=[],d=0,e=this.data.length;e>d;d++){var f=this.data.charCodeAt(d);f>65536?(b[0]=240|(1835008&f)>>>18,b[1]=128|(258048&f)>>>12,b[2]=128|(4032&f)>>>6,b[3]=128|63&f):f>2048?(b[0]=224|(61440&f)>>>12,b[1]=128|(4032&f)>>>6,b[2]=128|63&f):f>128?(b[0]=192|(1984&f)>>>6,b[1]=128|63&f):b[0]=f,this.parsedData=this.parsedData.concat(b)}this.parsedData.length!=this.data.length&&(this.parsedData.unshift(191),this.parsedData.unshift(187),this.parsedData.unshift(239))}function b(a,b){this.typeNumber=a,this.errorCorrectLevel=b,this.modules=null,this.moduleCount=0,this.dataCache=null,this.dataList=[]}function i(a,b){if(void 0==a.length)throw new Error(a.length+"/"+b);for(var c=0;c<a.length&&0==a[c];)c++;this.num=new Array(a.length-c+b);for(var d=0;d<a.length-c;d++)this.num[d]=a[d+c]}function j(a,b){this.totalCount=a,this.dataCount=b}function k(){this.buffer=[],this.length=0}function m(){return"undefined"!=typeof CanvasRenderingContext2D}function n(){var a=!1,b=navigator.userAgent;return/android/i.test(b)&&(a=!0,aMat=b.toString().match(/android ([0-9]\.[0-9])/i),aMat&&aMat[1]&&(a=parseFloat(aMat[1]))),a}function r(a,b){for(var c=1,e=s(a),f=0,g=l.length;g>=f;f++){var h=0;switch(b){case d.L:h=l[f][0];break;case d.M:h=l[f][1];break;case d.Q:h=l[f][2];break;case d.H:h=l[f][3]}if(h>=e)break;c++}if(c>l.length)throw new Error("Too long data");return c}function s(a){var b=encodeURI(a).toString().replace(/\%[0-9a-fA-F]{2}/g,"a");return b.length+(b.length!=a?3:0)}a.prototype={getLength:function(){return this.parsedData.length},write:function(a){for(var b=0,c=this.parsedData.length;c>b;b++)a.put(this.parsedData[b],8)}},b.prototype={addData:function(b){var c=new a(b);this.dataList.push(c),this.dataCache=null},isDark:function(a,b){if(0>a||this.moduleCount<=a||0>b||this.moduleCount<=b)throw new Error(a+","+b);return this.modules[a][b]},getModuleCount:function(){return this.moduleCount},make:function(){this.makeImpl(!1,this.getBestMaskPattern())},makeImpl:function(a,c){this.moduleCount=4*this.typeNumber+17,this.modules=new Array(this.moduleCount);for(var d=0;d<this.moduleCount;d++){this.modules[d]=new Array(this.moduleCount);for(var e=0;e<this.moduleCount;e++)this.modules[d][e]=null}this.setupPositionProbePattern(0,0),this.setupPositionProbePattern(this.moduleCount-7,0),this.setupPositionProbePattern(0,this.moduleCount-7),this.setupPositionAdjustPattern(),this.setupTimingPattern(),this.setupTypeInfo(a,c),this.typeNumber>=7&&this.setupTypeNumber(a),null==this.dataCache&&(this.dataCache=b.createData(this.typeNumber,this.errorCorrectLevel,this.dataList)),this.mapData(this.dataCache,c)},setupPositionProbePattern:function(a,b){for(var c=-1;7>=c;c++)if(!(-1>=a+c||this.moduleCount<=a+c))for(var d=-1;7>=d;d++)-1>=b+d||this.moduleCount<=b+d||(this.modules[a+c][b+d]=c>=0&&6>=c&&(0==d||6==d)||d>=0&&6>=d&&(0==c||6==c)||c>=2&&4>=c&&d>=2&&4>=d?!0:!1)},getBestMaskPattern:function(){for(var a=0,b=0,c=0;8>c;c++){this.makeImpl(!0,c);var d=f.getLostPoint(this);(0==c||a>d)&&(a=d,b=c)}return b},createMovieClip:function(a,b,c){var d=a.createEmptyMovieClip(b,c),e=1;this.make();for(var f=0;f<this.modules.length;f++)for(var g=f*e,h=0;h<this.modules[f].length;h++){var i=h*e,j=this.modules[f][h];j&&(d.beginFill(0,100),d.moveTo(i,g),d.lineTo(i+e,g),d.lineTo(i+e,g+e),d.lineTo(i,g+e),d.endFill())}return d},setupTimingPattern:function(){for(var a=8;a<this.moduleCount-8;a++)null==this.modules[a][6]&&(this.modules[a][6]=0==a%2);for(var b=8;b<this.moduleCount-8;b++)null==this.modules[6][b]&&(this.modules[6][b]=0==b%2)},setupPositionAdjustPattern:function(){for(var a=f.getPatternPosition(this.typeNumber),b=0;b<a.length;b++)for(var c=0;c<a.length;c++){var d=a[b],e=a[c];if(null==this.modules[d][e])for(var g=-2;2>=g;g++)for(var h=-2;2>=h;h++)this.modules[d+g][e+h]=-2==g||2==g||-2==h||2==h||0==g&&0==h?!0:!1}},setupTypeNumber:function(a){for(var b=f.getBCHTypeNumber(this.typeNumber),c=0;18>c;c++){var d=!a&&1==(1&b>>c);this.modules[Math.floor(c/3)][c%3+this.moduleCount-8-3]=d}for(var c=0;18>c;c++){var d=!a&&1==(1&b>>c);this.modules[c%3+this.moduleCount-8-3][Math.floor(c/3)]=d}},setupTypeInfo:function(a,b){for(var c=this.errorCorrectLevel<<3|b,d=f.getBCHTypeInfo(c),e=0;15>e;e++){var g=!a&&1==(1&d>>e);6>e?this.modules[e][8]=g:8>e?this.modules[e+1][8]=g:this.modules[this.moduleCount-15+e][8]=g}for(var e=0;15>e;e++){var g=!a&&1==(1&d>>e);8>e?this.modules[8][this.moduleCount-e-1]=g:9>e?this.modules[8][15-e-1+1]=g:this.modules[8][15-e-1]=g}this.modules[this.moduleCount-8][8]=!a},mapData:function(a,b){for(var c=-1,d=this.moduleCount-1,e=7,g=0,h=this.moduleCount-1;h>0;h-=2)for(6==h&&h--;;){for(var i=0;2>i;i++)if(null==this.modules[d][h-i]){var j=!1;g<a.length&&(j=1==(1&a[g]>>>e));var k=f.getMask(b,d,h-i);k&&(j=!j),this.modules[d][h-i]=j,e--,-1==e&&(g++,e=7)}if(d+=c,0>d||this.moduleCount<=d){d-=c,c=-c;break}}}},b.PAD0=236,b.PAD1=17,b.createData=function(a,c,d){for(var e=j.getRSBlocks(a,c),g=new k,h=0;h<d.length;h++){var i=d[h];g.put(i.mode,4),g.put(i.getLength(),f.getLengthInBits(i.mode,a)),i.write(g)}for(var l=0,h=0;h<e.length;h++)l+=e[h].dataCount;if(g.getLengthInBits()>8*l)throw new Error("code length overflow. ("+g.getLengthInBits()+">"+8*l+")");for(g.getLengthInBits()+4<=8*l&&g.put(0,4);0!=g.getLengthInBits()%8;)g.putBit(!1);for(;;){if(g.getLengthInBits()>=8*l)break;if(g.put(b.PAD0,8),g.getLengthInBits()>=8*l)break;g.put(b.PAD1,8)}return b.createBytes(g,e)},b.createBytes=function(a,b){for(var c=0,d=0,e=0,g=new Array(b.length),h=new Array(b.length),j=0;j<b.length;j++){var k=b[j].dataCount,l=b[j].totalCount-k;d=Math.max(d,k),e=Math.max(e,l),g[j]=new Array(k);for(var m=0;m<g[j].length;m++)g[j][m]=255&a.buffer[m+c];c+=k;var n=f.getErrorCorrectPolynomial(l),o=new i(g[j],n.getLength()-1),p=o.mod(n);h[j]=new Array(n.getLength()-1);for(var m=0;m<h[j].length;m++){var q=m+p.getLength()-h[j].length;h[j][m]=q>=0?p.get(q):0}}for(var r=0,m=0;m<b.length;m++)r+=b[m].totalCount;for(var s=new Array(r),t=0,m=0;d>m;m++)for(var j=0;j<b.length;j++)m<g[j].length&&(s[t++]=g[j][m]);for(var m=0;e>m;m++)for(var j=0;j<b.length;j++)m<h[j].length&&(s[t++]=h[j][m]);return s};for(var c={MODE_NUMBER:1,MODE_ALPHA_NUM:2,MODE_8BIT_BYTE:4,MODE_KANJI:8},d={L:1,M:0,Q:3,H:2},e={PATTERN000:0,PATTERN001:1,PATTERN010:2,PATTERN011:3,PATTERN100:4,PATTERN101:5,PATTERN110:6,PATTERN111:7},f={PATTERN_POSITION_TABLE:[[],[6,18],[6,22],[6,26],[6,30],[6,34],[6,22,38],[6,24,42],[6,26,46],[6,28,50],[6,30,54],[6,32,58],[6,34,62],[6,26,46,66],[6,26,48,70],[6,26,50,74],[6,30,54,78],[6,30,56,82],[6,30,58,86],[6,34,62,90],[6,28,50,72,94],[6,26,50,74,98],[6,30,54,78,102],[6,28,54,80,106],[6,32,58,84,110],[6,30,58,86,114],[6,34,62,90,118],[6,26,50,74,98,122],[6,30,54,78,102,126],[6,26,52,78,104,130],[6,30,56,82,108,134],[6,34,60,86,112,138],[6,30,58,86,114,142],[6,34,62,90,118,146],[6,30,54,78,102,126,150],[6,24,50,76,102,128,154],[6,28,54,80,106,132,158],[6,32,58,84,110,136,162],[6,26,54,82,110,138,166],[6,30,58,86,114,142,170]],G15:1335,G18:7973,G15_MASK:21522,getBCHTypeInfo:function(a){for(var b=a<<10;f.getBCHDigit(b)-f.getBCHDigit(f.G15)>=0;)b^=f.G15<<f.getBCHDigit(b)-f.getBCHDigit(f.G15);return(a<<10|b)^f.G15_MASK},getBCHTypeNumber:function(a){for(var b=a<<12;f.getBCHDigit(b)-f.getBCHDigit(f.G18)>=0;)b^=f.G18<<f.getBCHDigit(b)-f.getBCHDigit(f.G18);return a<<12|b},getBCHDigit:function(a){for(var b=0;0!=a;)b++,a>>>=1;return b},getPatternPosition:function(a){return f.PATTERN_POSITION_TABLE[a-1]},getMask:function(a,b,c){switch(a){case e.PATTERN000:return 0==(b+c)%2;case e.PATTERN001:return 0==b%2;case e.PATTERN010:return 0==c%3;case e.PATTERN011:return 0==(b+c)%3;case e.PATTERN100:return 0==(Math.floor(b/2)+Math.floor(c/3))%2;case e.PATTERN101:return 0==b*c%2+b*c%3;case e.PATTERN110:return 0==(b*c%2+b*c%3)%2;case e.PATTERN111:return 0==(b*c%3+(b+c)%2)%2;default:throw new Error("bad maskPattern:"+a)}},getErrorCorrectPolynomial:function(a){for(var b=new i([1],0),c=0;a>c;c++)b=b.multiply(new i([1,g.gexp(c)],0));return b},getLengthInBits:function(a,b){if(b>=1&&10>b)switch(a){case c.MODE_NUMBER:return 10;case c.MODE_ALPHA_NUM:return 9;case c.MODE_8BIT_BYTE:return 8;case c.MODE_KANJI:return 8;default:throw new Error("mode:"+a)}else if(27>b)switch(a){case c.MODE_NUMBER:return 12;case c.MODE_ALPHA_NUM:return 11;case c.MODE_8BIT_BYTE:return 16;case c.MODE_KANJI:return 10;default:throw new Error("mode:"+a)}else{if(!(41>b))throw new Error("type:"+b);switch(a){case c.MODE_NUMBER:return 14;case c.MODE_ALPHA_NUM:return 13;case c.MODE_8BIT_BYTE:return 16;case c.MODE_KANJI:return 12;default:throw new Error("mode:"+a)}}},getLostPoint:function(a){for(var b=a.getModuleCount(),c=0,d=0;b>d;d++)for(var e=0;b>e;e++){for(var f=0,g=a.isDark(d,e),h=-1;1>=h;h++)if(!(0>d+h||d+h>=b))for(var i=-1;1>=i;i++)0>e+i||e+i>=b||(0!=h||0!=i)&&g==a.isDark(d+h,e+i)&&f++;f>5&&(c+=3+f-5)}for(var d=0;b-1>d;d++)for(var e=0;b-1>e;e++){var j=0;a.isDark(d,e)&&j++,a.isDark(d+1,e)&&j++,a.isDark(d,e+1)&&j++,a.isDark(d+1,e+1)&&j++,(0==j||4==j)&&(c+=3)}for(var d=0;b>d;d++)for(var e=0;b-6>e;e++)a.isDark(d,e)&&!a.isDark(d,e+1)&&a.isDark(d,e+2)&&a.isDark(d,e+3)&&a.isDark(d,e+4)&&!a.isDark(d,e+5)&&a.isDark(d,e+6)&&(c+=40);for(var e=0;b>e;e++)for(var d=0;b-6>d;d++)a.isDark(d,e)&&!a.isDark(d+1,e)&&a.isDark(d+2,e)&&a.isDark(d+3,e)&&a.isDark(d+4,e)&&!a.isDark(d+5,e)&&a.isDark(d+6,e)&&(c+=40);for(var k=0,e=0;b>e;e++)for(var d=0;b>d;d++)a.isDark(d,e)&&k++;var l=Math.abs(100*k/b/b-50)/5;return c+=10*l}},g={glog:function(a){if(1>a)throw new Error("glog("+a+")");return g.LOG_TABLE[a]},gexp:function(a){for(;0>a;)a+=255;for(;a>=256;)a-=255;return g.EXP_TABLE[a]},EXP_TABLE:new Array(256),LOG_TABLE:new Array(256)},h=0;8>h;h++)g.EXP_TABLE[h]=1<<h;for(var h=8;256>h;h++)g.EXP_TABLE[h]=g.EXP_TABLE[h-4]^g.EXP_TABLE[h-5]^g.EXP_TABLE[h-6]^g.EXP_TABLE[h-8];for(var h=0;255>h;h++)g.LOG_TABLE[g.EXP_TABLE[h]]=h;i.prototype={get:function(a){return this.num[a]},getLength:function(){return this.num.length},multiply:function(a){for(var b=new Array(this.getLength()+a.getLength()-1),c=0;c<this.getLength();c++)for(var d=0;d<a.getLength();d++)b[c+d]^=g.gexp(g.glog(this.get(c))+g.glog(a.get(d)));return new i(b,0)},mod:function(a){if(this.getLength()-a.getLength()<0)return this;for(var b=g.glog(this.get(0))-g.glog(a.get(0)),c=new Array(this.getLength()),d=0;d<this.getLength();d++)c[d]=this.get(d);for(var d=0;d<a.getLength();d++)c[d]^=g.gexp(g.glog(a.get(d))+b);return new i(c,0).mod(a)}},j.RS_BLOCK_TABLE=[[1,26,19],[1,26,16],[1,26,13],[1,26,9],[1,44,34],[1,44,28],[1,44,22],[1,44,16],[1,70,55],[1,70,44],[2,35,17],[2,35,13],[1,100,80],[2,50,32],[2,50,24],[4,25,9],[1,134,108],[2,67,43],[2,33,15,2,34,16],[2,33,11,2,34,12],[2,86,68],[4,43,27],[4,43,19],[4,43,15],[2,98,78],[4,49,31],[2,32,14,4,33,15],[4,39,13,1,40,14],[2,121,97],[2,60,38,2,61,39],[4,40,18,2,41,19],[4,40,14,2,41,15],[2,146,116],[3,58,36,2,59,37],[4,36,16,4,37,17],[4,36,12,4,37,13],[2,86,68,2,87,69],[4,69,43,1,70,44],[6,43,19,2,44,20],[6,43,15,2,44,16],[4,101,81],[1,80,50,4,81,51],[4,50,22,4,51,23],[3,36,12,8,37,13],[2,116,92,2,117,93],[6,58,36,2,59,37],[4,46,20,6,47,21],[7,42,14,4,43,15],[4,133,107],[8,59,37,1,60,38],[8,44,20,4,45,21],[12,33,11,4,34,12],[3,145,115,1,146,116],[4,64,40,5,65,41],[11,36,16,5,37,17],[11,36,12,5,37,13],[5,109,87,1,110,88],[5,65,41,5,66,42],[5,54,24,7,55,25],[11,36,12],[5,122,98,1,123,99],[7,73,45,3,74,46],[15,43,19,2,44,20],[3,45,15,13,46,16],[1,135,107,5,136,108],[10,74,46,1,75,47],[1,50,22,15,51,23],[2,42,14,17,43,15],[5,150,120,1,151,121],[9,69,43,4,70,44],[17,50,22,1,51,23],[2,42,14,19,43,15],[3,141,113,4,142,114],[3,70,44,11,71,45],[17,47,21,4,48,22],[9,39,13,16,40,14],[3,135,107,5,136,108],[3,67,41,13,68,42],[15,54,24,5,55,25],[15,43,15,10,44,16],[4,144,116,4,145,117],[17,68,42],[17,50,22,6,51,23],[19,46,16,6,47,17],[2,139,111,7,140,112],[17,74,46],[7,54,24,16,55,25],[34,37,13],[4,151,121,5,152,122],[4,75,47,14,76,48],[11,54,24,14,55,25],[16,45,15,14,46,16],[6,147,117,4,148,118],[6,73,45,14,74,46],[11,54,24,16,55,25],[30,46,16,2,47,17],[8,132,106,4,133,107],[8,75,47,13,76,48],[7,54,24,22,55,25],[22,45,15,13,46,16],[10,142,114,2,143,115],[19,74,46,4,75,47],[28,50,22,6,51,23],[33,46,16,4,47,17],[8,152,122,4,153,123],[22,73,45,3,74,46],[8,53,23,26,54,24],[12,45,15,28,46,16],[3,147,117,10,148,118],[3,73,45,23,74,46],[4,54,24,31,55,25],[11,45,15,31,46,16],[7,146,116,7,147,117],[21,73,45,7,74,46],[1,53,23,37,54,24],[19,45,15,26,46,16],[5,145,115,10,146,116],[19,75,47,10,76,48],[15,54,24,25,55,25],[23,45,15,25,46,16],[13,145,115,3,146,116],[2,74,46,29,75,47],[42,54,24,1,55,25],[23,45,15,28,46,16],[17,145,115],[10,74,46,23,75,47],[10,54,24,35,55,25],[19,45,15,35,46,16],[17,145,115,1,146,116],[14,74,46,21,75,47],[29,54,24,19,55,25],[11,45,15,46,46,16],[13,145,115,6,146,116],[14,74,46,23,75,47],[44,54,24,7,55,25],[59,46,16,1,47,17],[12,151,121,7,152,122],[12,75,47,26,76,48],[39,54,24,14,55,25],[22,45,15,41,46,16],[6,151,121,14,152,122],[6,75,47,34,76,48],[46,54,24,10,55,25],[2,45,15,64,46,16],[17,152,122,4,153,123],[29,74,46,14,75,47],[49,54,24,10,55,25],[24,45,15,46,46,16],[4,152,122,18,153,123],[13,74,46,32,75,47],[48,54,24,14,55,25],[42,45,15,32,46,16],[20,147,117,4,148,118],[40,75,47,7,76,48],[43,54,24,22,55,25],[10,45,15,67,46,16],[19,148,118,6,149,119],[18,75,47,31,76,48],[34,54,24,34,55,25],[20,45,15,61,46,16]],j.getRSBlocks=function(a,b){var c=j.getRsBlockTable(a,b);if(void 0==c)throw new Error("bad rs block @ typeNumber:"+a+"/errorCorrectLevel:"+b);for(var d=c.length/3,e=[],f=0;d>f;f++)for(var g=c[3*f+0],h=c[3*f+1],i=c[3*f+2],k=0;g>k;k++)e.push(new j(h,i));return e},j.getRsBlockTable=function(a,b){switch(b){case d.L:return j.RS_BLOCK_TABLE[4*(a-1)+0];case d.M:return j.RS_BLOCK_TABLE[4*(a-1)+1];case d.Q:return j.RS_BLOCK_TABLE[4*(a-1)+2];case d.H:return j.RS_BLOCK_TABLE[4*(a-1)+3];default:return void 0}},k.prototype={get:function(a){var b=Math.floor(a/8);return 1==(1&this.buffer[b]>>>7-a%8)},put:function(a,b){for(var c=0;b>c;c++)this.putBit(1==(1&a>>>b-c-1))},getLengthInBits:function(){return this.length},putBit:function(a){var b=Math.floor(this.length/8);this.buffer.length<=b&&this.buffer.push(0),a&&(this.buffer[b]|=128>>>this.length%8),this.length++}};var l=[[17,14,11,7],[32,26,20,14],[53,42,32,24],[78,62,46,34],[106,84,60,44],[134,106,74,58],[154,122,86,64],[192,152,108,84],[230,180,130,98],[271,213,151,119],[321,251,177,137],[367,287,203,155],[425,331,241,177],[458,362,258,194],[520,412,292,220],[586,450,322,250],[644,504,364,280],[718,560,394,310],[792,624,442,338],[858,666,482,382],[929,711,509,403],[1003,779,565,439],[1091,857,611,461],[1171,911,661,511],[1273,997,715,535],[1367,1059,751,593],[1465,1125,805,625],[1528,1190,868,658],[1628,1264,908,698],[1732,1370,982,742],[1840,1452,1030,790],[1952,1538,1112,842],[2068,1628,1168,898],[2188,1722,1228,958],[2303,1809,1283,983],[2431,1911,1351,1051],[2563,1989,1423,1093],[2699,2099,1499,1139],[2809,2213,1579,1219],[2953,2331,1663,1273]],o=function(){var a=function(a,b){this._el=a,this._htOption=b};return a.prototype.draw=function(a){function g(a,b){var c=document.createElementNS("http://www.w3.org/2000/svg",a);for(var d in b)b.hasOwnProperty(d)&&c.setAttribute(d,b[d]);return c}var b=this._htOption,c=this._el,d=a.getModuleCount();Math.floor(b.width/d),Math.floor(b.height/d),this.clear();var h=g("svg",{viewBox:"0 0 "+String(d)+" "+String(d),width:"100%",height:"100%",fill:b.colorLight});h.setAttributeNS("http://www.w3.org/2000/xmlns/","xmlns:xlink","http://www.w3.org/1999/xlink"),c.appendChild(h),h.appendChild(g("rect",{fill:b.colorDark,width:"1",height:"1",id:"template"}));for(var i=0;d>i;i++)for(var j=0;d>j;j++)if(a.isDark(i,j)){var k=g("use",{x:String(i),y:String(j)});k.setAttributeNS("http://www.w3.org/1999/xlink","href","#template"),h.appendChild(k)}},a.prototype.clear=function(){for(;this._el.hasChildNodes();)this._el.removeChild(this._el.lastChild)},a}(),p="svg"===document.documentElement.tagName.toLowerCase(),q=p?o:m()?function(){function a(){this._elImage.src=this._elCanvas.toDataURL("image/png"),this._elImage.style.display="block",this._elCanvas.style.display="none"}function d(a,b){var c=this;if(c._fFail=b,c._fSuccess=a,null===c._bSupportDataURI){var d=document.createElement("img"),e=function(){c._bSupportDataURI=!1,c._fFail&&_fFail.call(c)},f=function(){c._bSupportDataURI=!0,c._fSuccess&&c._fSuccess.call(c)};return d.onabort=e,d.onerror=e,d.onload=f,d.src="data:image/gif;base64,iVBORw0KGgoAAAANSUhEUgAAAAUAAAAFCAYAAACNbyblAAAAHElEQVQI12P4//8/w38GIAXDIBKE0DHxgljNBAAO9TXL0Y4OHwAAAABJRU5ErkJggg==",void 0}c._bSupportDataURI===!0&&c._fSuccess?c._fSuccess.call(c):c._bSupportDataURI===!1&&c._fFail&&c._fFail.call(c)}if(this._android&&this._android<=2.1){var b=1/window.devicePixelRatio,c=CanvasRenderingContext2D.prototype.drawImage;CanvasRenderingContext2D.prototype.drawImage=function(a,d,e,f,g,h,i,j){if("nodeName"in a&&/img/i.test(a.nodeName))for(var l=arguments.length-1;l>=1;l--)arguments[l]=arguments[l]*b;else"undefined"==typeof j&&(arguments[1]*=b,arguments[2]*=b,arguments[3]*=b,arguments[4]*=b);c.apply(this,arguments)}}var e=function(a,b){this._bIsPainted=!1,this._android=n(),this._htOption=b,this._elCanvas=document.createElement("canvas"),this._elCanvas.width=b.width,this._elCanvas.height=b.height,a.appendChild(this._elCanvas),this._el=a,this._oContext=this._elCanvas.getContext("2d"),this._bIsPainted=!1,this._elImage=document.createElement("img"),this._elImage.style.display="none",this._el.appendChild(this._elImage),this._bSupportDataURI=null};return e.prototype.draw=function(a){var b=this._elImage,c=this._oContext,d=this._htOption,e=a.getModuleCount(),f=d.width/e,g=d.height/e,h=Math.round(f),i=Math.round(g);b.style.display="none",this.clear();for(var j=0;e>j;j++)for(var k=0;e>k;k++){var l=a.isDark(j,k),m=k*f,n=j*g;c.strokeStyle=l?d.colorDark:d.colorLight,c.lineWidth=1,c.fillStyle=l?d.colorDark:d.colorLight,c.fillRect(m,n,f,g),c.strokeRect(Math.floor(m)+.5,Math.floor(n)+.5,h,i),c.strokeRect(Math.ceil(m)-.5,Math.ceil(n)-.5,h,i)}this._bIsPainted=!0},e.prototype.makeImage=function(){this._bIsPainted&&d.call(this,a)},e.prototype.isPainted=function(){return this._bIsPainted},e.prototype.clear=function(){this._oContext.clearRect(0,0,this._elCanvas.width,this._elCanvas.height),this._bIsPainted=!1},e.prototype.round=function(a){return a?Math.floor(1e3*a)/1e3:a},e}():function(){var a=function(a,b){this._el=a,this._htOption=b};return a.prototype.draw=function(a){for(var b=this._htOption,c=this._el,d=a.getModuleCount(),e=Math.floor(b.width/d),f=Math.floor(b.height/d),g=['<table style="border:0;border-collapse:collapse;">'],h=0;d>h;h++){g.push("<tr>");for(var i=0;d>i;i++)g.push('<td style="border:0;border-collapse:collapse;padding:0;margin:0;width:'+e+"px;height:"+f+"px;background-color:"+(a.isDark(h,i)?b.colorDark:b.colorLight)+';"></td>');g.push("</tr>")}g.push("</table>"),c.innerHTML=g.join("");var j=c.childNodes[0],k=(b.width-j.offsetWidth)/2,l=(b.height-j.offsetHeight)/2;k>0&&l>0&&(j.style.margin=l+"px "+k+"px")},a.prototype.clear=function(){this._el.innerHTML=""},a}();QRCode=function(a,b){if(this._htOption={width:256,height:256,typeNumber:4,colorDark:"#000000",colorLight:"#ffffff",correctLevel:d.H},"string"==typeof b&&(b={text:b}),b)for(var c in b)this._htOption[c]=b[c];"string"==typeof a&&(a=document.getElementById(a)),this._android=n(),this._el=a,this._oQRCode=null,this._oDrawing=new q(this._el,this._htOption),this._htOption.text&&this.makeCode(this._htOption.text)},QRCode.prototype.makeCode=function(a){this._oQRCode=new b(r(a,this._htOption.correctLevel),this._htOption.correctLevel),this._oQRCode.addData(a),this._oQRCode.make(),this._el.title=a,this._oDrawing.draw(this._oQRCode),this.makeImage()},QRCode.prototype.makeImage=function(){"function"==typeof this._oDrawing.makeImage&&(!this._android||this._android>=3)&&this._oDrawing.makeImage()},QRCode.prototype.clear=function(){this._oDrawing.clear()},QRCode.CorrectLevel=d}(); |
| | |
| | | {title: '市', field: 'city', visible: true, align: 'center', valign: 'middle'}, |
| | | { title: '门店名称', field: 'store', visible: true, align: 'center', valign: 'middle'}, |
| | | { title: '所属场地', field: 'site', visible: true, align: 'center', valign: 'middle'}, |
| | | { title: '蓝方设备ID', field: 'blue', visible: true, align: 'center', valign: 'middle'}, |
| | | { title: '红方设备ID', field: 'red', visible: true, align: 'center', valign: 'middle'}, |
| | | { title: '红方设备二维码', field: 'redCode', visible: false, align: 'center', valign: 'middle'}, |
| | | { title: '蓝方设备二维码', field: 'blueCode', visible: false, align: 'center', valign: 'middle'}, |
| | | { title: '蓝方设备ID', field: 'blue', visible: true, align: 'center', valign: 'middle', |
| | | formatter: function (data,row) { |
| | | // row.redCode存储的设备二维码连接 |
| | | var temp = row.blueCode; |
| | | var str = '<button class="btn btn-outline btn-primary" onclick="TStudent.openDetail(\'' + temp + '\')" >'+row.blue+'</button>' |
| | | btn = ['<p class="toolTip" style="overflow:hidden;white-space:nowrap;text-overflow:ellipsis;" title="" onfocus="TUser.tooltip()">' + str + '</p>'] |
| | | return btn; |
| | | } |
| | | }, |
| | | { title: '红方设备ID', field: 'red', visible: true, align: 'center', valign: 'middle', |
| | | formatter: function (data,row) { |
| | | // row.redCode存储的设备二维码连接 |
| | | var temp = row.redCode; |
| | | var str = '<button class="btn btn-outline btn-primary" onclick="TStudent.openDetail(\'' + temp + '\')" >'+row.red+'</button>' |
| | | btn = ['<p class="toolTip" style="overflow:hidden;white-space:nowrap;text-overflow:ellipsis;" title="" onfocus="TUser.tooltip()">' + str + '</p>'] |
| | | return btn; |
| | | } |
| | | }, |
| | | { |
| | | title: '设备类型', |
| | | field: 'deviceType', |
| | |
| | | } |
| | | }; |
| | | |
| | | TStudent.openDetail = function (e) { |
| | | console.log("看看") |
| | | console.log(e) |
| | | var index = layer.load(1,{ |
| | | type: 1 |
| | | , title: '设备二维码' |
| | | , area: ['100%', '100%'] |
| | | , offset: 'auto' //具体配置参考:http://www.layui.com/doc/modules/layer.html#offset |
| | | , id: 'layerDemo' //防止重复弹出cge |
| | | , content: '<div class="form-horizontal">' + |
| | | ' <img src='+ e +'>' + |
| | | '</img>'+ |
| | | '</div>' |
| | | , btn: ['关闭', '下载'] |
| | | , btnAlign: 'c' //按钮居中 |
| | | , shade: 0.5 //不显示遮罩 |
| | | ,load:1 |
| | | , yes: function () { |
| | | |
| | | layer.closeAll(); |
| | | }, |
| | | btn2:function () { |
| | | var a = document.createElement('a'); |
| | | a.href = e; |
| | | a.download = '设备二维码.jpg'; // 设置下载文件的名称 |
| | | a.style.display = 'none'; |
| | | document.body.appendChild(a); |
| | | a.click(); |
| | | document.body.removeChild(a); |
| | | } |
| | | }); |
| | | this.layerIndex = index; |
| | | }; |
| | | |
| | | TStudent.editCoursePackageState = function (state) { |
| | | if (this.check()) { |
New file |
| | |
| | | /** |
| | | * 跨城站点管理管理初始化 |
| | | */ |
| | | var TSite = { |
| | | id: "TSiteTable", //表格id |
| | | seItem: null, //选中的条目 |
| | | table: null, |
| | | layerIndex: -1, |
| | | picture:"", |
| | | fileUrl:"", |
| | | img:"", |
| | | plan:"", |
| | | goodsPicArray:[], |
| | | validateFields: { |
| | | } |
| | | }; |
| | | var objectType =$("#objectType").val() |
| | | /** |
| | | * 初始化表格的列 |
| | | */ |
| | | TSite.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: 'device', visible: true, align: 'center', valign: 'middle'}, |
| | | {title: '所属运营商', field: 'operatorName', visible: true, align: 'center', valign: 'middle'}, |
| | | {title: '所属门店', field: 'storeName', visible: true, align: 'center', valign: 'middle',}, |
| | | {title: '所属场地', field: 'siteName', visible: true, align: 'center', valign: 'middle',}, |
| | | ]; |
| | | }; |
| | | |
| | | /** |
| | | * 检查是否选中 |
| | | */ |
| | | TSite.check = function () { |
| | | var selected = $('#' + this.id).bootstrapTable('getSelections'); |
| | | if(selected.length == 0){ |
| | | Feng.info("请先选中表格中的某一记录!"); |
| | | return false; |
| | | }else{ |
| | | TSite.seItem = selected[0]; |
| | | return true; |
| | | } |
| | | }; |
| | | /** |
| | | * 上架 |
| | | */ |
| | | TSite.onShelf = function () { |
| | | if (this.check()){ |
| | | var selected = $('#' + this.id).bootstrapTable('getSelections'); |
| | | const data1 = { |
| | | ids:[], |
| | | state:null |
| | | }; |
| | | selected.forEach(function(obj) { |
| | | var id = obj.id; |
| | | data1.ids.push(id); |
| | | }); |
| | | data1.state = 1; |
| | | $.ajax({ |
| | | url: Feng.ctxPath + "/advertisement/changeState", |
| | | type: "POST", |
| | | contentType: "application/json", // 设置请求头的 Content-Type |
| | | data: JSON.stringify(data1), // 将数据转换为 JSON 字符串 |
| | | success: function(response) { |
| | | Feng.success("上架成功!"); |
| | | TSite.search(); |
| | | }, |
| | | error: function(xhr, status, error) { |
| | | var errorMessage = xhr.responseText ? xhr.responseText : "上架失败!"; |
| | | Feng.error("您的网络异常!"); |
| | | } |
| | | }); |
| | | } |
| | | }; |
| | | |
| | | /** |
| | | * 下架 |
| | | */ |
| | | TSite.offShelf = function () { |
| | | if (this.check()){ |
| | | var selected = $('#' + this.id).bootstrapTable('getSelections'); |
| | | const data1 = { |
| | | ids:[], |
| | | state:null |
| | | }; |
| | | selected.forEach(function(obj) { |
| | | var id = obj.id; |
| | | data1.ids.push(id); |
| | | }); |
| | | data1.state = 2; |
| | | $.ajax({ |
| | | url: Feng.ctxPath + "/advertisement/changeState", |
| | | type: "POST", |
| | | contentType: "application/json", // 设置请求头的 Content-Type |
| | | data: JSON.stringify(data1), // 将数据转换为 JSON 字符串 |
| | | success: function(response) { |
| | | Feng.success("下架成功!"); |
| | | TSite.search(); |
| | | }, |
| | | error: function(xhr, status, error) { |
| | | var errorMessage = xhr.responseText ? xhr.responseText : "下架失败!"; |
| | | } |
| | | }); |
| | | } |
| | | }; |
| | | |
| | | /** |
| | | * 跳转添加广告页面 |
| | | */ |
| | | TSite.openAddTSite = function () { |
| | | var index = layer.open({ |
| | | type: 2, |
| | | title: "添加广告", |
| | | area: ['100%', '100%'], //宽高 |
| | | fix: false, //不固定 |
| | | maxmin: true, |
| | | content: Feng.ctxPath + '/gate/add' |
| | | }); |
| | | this.layerIndex = index; |
| | | }; |
| | | /** |
| | | * 跳转基础页面配置 |
| | | */ |
| | | TSite.basic = function () { |
| | | var index = layer.open({ |
| | | type: 2, |
| | | title: "基础页面配置", |
| | | area: ['100%', '100%'], //宽高 |
| | | fix: false, //不固定 |
| | | maxmin: true, |
| | | content: Feng.ctxPath + '/gate/config' |
| | | }); |
| | | this.layerIndex = index; |
| | | }; |
| | | /** |
| | | * 跳转福利页面配置 |
| | | */ |
| | | TSite.benefits = function () { |
| | | var index = layer.open({ |
| | | type: 2, |
| | | title: "福利页面配置", |
| | | area: ['100%', '100%'], //宽高 |
| | | fix: false, //不固定 |
| | | maxmin: true, |
| | | content: Feng.ctxPath + '/advertisement/benefits' |
| | | }); |
| | | this.layerIndex = index; |
| | | }; |
| | | |
| | | /** |
| | | * 打开查看详情页面 |
| | | */ |
| | | TSite.openInfo = function () { |
| | | var selected = $('#' + this.id).bootstrapTable('getSelections'); |
| | | if(selected.length >1 ){ |
| | | Feng.info("只能选择一个广告进行查看!"); |
| | | }else { |
| | | if (this.check()) { |
| | | var index = layer.open({ |
| | | type: 2, |
| | | title: "查看详情", |
| | | area: ['100%', '100%'], //宽高 |
| | | fix: false, //不固定 |
| | | maxmin: true, |
| | | content: Feng.ctxPath + '/advertisement/update/' + TSite.seItem.id+'/1' |
| | | }); |
| | | this.layerIndex = index; |
| | | } |
| | | } |
| | | }; |
| | | /** |
| | | * 跳转编辑页面 |
| | | */ |
| | | TSite.openEditTSite = function () { |
| | | var selected = $('#' + this.id).bootstrapTable('getSelections'); |
| | | if(selected.length >1 ){ |
| | | Feng.info("只能选择一个闸机进行编辑!"); |
| | | }else { |
| | | if (this.check()) { |
| | | var index = layer.open({ |
| | | type: 2, |
| | | title: "编辑广告", |
| | | area: ['100%', '100%'], //宽高 |
| | | fix: false, //不固定 |
| | | maxmin: true, |
| | | content: Feng.ctxPath + '/gate/update/' + TSite.seItem.id |
| | | }); |
| | | this.layerIndex = index; |
| | | } |
| | | } |
| | | }; |
| | | |
| | | /** |
| | | * 关闭此对话框 |
| | | */ |
| | | TSite.close = function() { |
| | | parent.layer.close(window.parent.TSite.layerIndex); |
| | | }; |
| | | TSite.oneChange = function () { |
| | | var modelId = $('#model option:selected').val(); |
| | | var pageSelect = document.getElementById("page"); |
| | | var typeSelect = document.getElementById("type"); |
| | | var ajax = new $ax(Feng.ctxPath + "/tSite/getCity", function(data){ |
| | | if(data!=null){ |
| | | var content='<option value="">选择跳转页面</option>'; |
| | | $.each(data, function(k,v) { |
| | | content += "<option value='"+v.id+"'>"+v.name+"</option>"; |
| | | }); |
| | | $("#cCode").empty().append(content); |
| | | } |
| | | }); |
| | | if (modelId === ""){ |
| | | pageSelect.innerHTML = '<option value="">请先选择跳转模块</option>'; |
| | | typeSelect.innerHTML = '<option value="">请先选择跳转模块</option>'; |
| | | } |
| | | ajax.set("province",province); |
| | | ajax.start(); |
| | | }; |
| | | TSite.addConfig = function(){ |
| | | $("#cover1").val(); |
| | | $("#cover2").val(); |
| | | $("#cover7").val(); |
| | | var ajax = new $ax(Feng.ctxPath + "/advertisement/updateConfig", function (data) { |
| | | Feng.success("基础页面设置成功") |
| | | }); |
| | | ajax.set("p1",$("#cover1").val()) |
| | | ajax.set("p2",$("#cover2").val()) |
| | | ajax.set("p7",$("#cover7").val()) |
| | | ajax.start(); |
| | | } |
| | | TSite.addBenefits = function(){ |
| | | $("#cover3").val(); |
| | | $("#cover4").val(); |
| | | $("#cover5").val(); |
| | | $("#cover6").val(); |
| | | var ajax = new $ax(Feng.ctxPath + "/advertisement/updateBenefits", function (data) { |
| | | Feng.success("基础页面设置成功") |
| | | }); |
| | | ajax.set("p3",$("#cover3").val()) |
| | | ajax.set("p4",$("#cover4").val()) |
| | | ajax.set("p5",$("#cover5").val()) |
| | | ajax.set("p6",$("#cover6").val()) |
| | | ajax.start(); |
| | | } |
| | | TSite.delete = function () { |
| | | if (this.check()) { |
| | | let id = this.seItem.id |
| | | var operation = function(){ |
| | | var ajax = new $ax(Feng.ctxPath + "/gate/deleteDevice", function (data) { |
| | | if (data.code!=200){ |
| | | Feng.error(data.msg) |
| | | return |
| | | }else{ |
| | | TSite.resetSearch(); |
| | | Feng.success("删除成功") |
| | | } |
| | | |
| | | }, function (data) { |
| | | Feng.error("删除失败!" + data.responseJSON.message + "!"); |
| | | }); |
| | | ajax.set("gateId",id); |
| | | ajax.start(); |
| | | } |
| | | Feng.confirm("确认删除该闸机?", operation); |
| | | } |
| | | }; |
| | | |
| | | TSite.addSubmit = function(){ |
| | | var data1 = { |
| | | id:null, |
| | | position:null, |
| | | img:"", |
| | | jumpPage:null, |
| | | sort:null, |
| | | state:1, |
| | | name:"", |
| | | type:"", |
| | | page:"", |
| | | model:null, |
| | | typeId:null, |
| | | turnId:null, |
| | | }; |
| | | let name = $("#model").val(); |
| | | data1.name = $("#name").val(); |
| | | data1.position = $("#position").val(); |
| | | data1.img = $("#img").val(); |
| | | data1.model = $('#model option:selected').text(); |
| | | data1.page = $('#page option:selected').text(); |
| | | data1.jumpPage = $("#page").val(); |
| | | data1.typeId = $("#type").val(); |
| | | data1.type = $('#type option:selected').text(); |
| | | data1.turnId = $("#pageId").val(); |
| | | data1.sort = $("#sort").val(); |
| | | |
| | | if ( $("#roleType").val()==1){ |
| | | if($("#position").val()==''){ |
| | | data1.position = $("#position").val(); |
| | | Feng.info("请选择广告类型") |
| | | return; |
| | | } |
| | | } |
| | | if($("#name").val()==''){ |
| | | |
| | | Feng.info("请输入广告名称") |
| | | return; |
| | | } |
| | | if($("#img").val()=='' ){ |
| | | Feng.info("请上传广告图片") |
| | | return; |
| | | } |
| | | if ( $("#roleType").val()==1) { |
| | | if ($("#model").val() == '') { |
| | | Feng.info("请选择跳转模块") |
| | | return; |
| | | } |
| | | } |
| | | if(name !='0'){ |
| | | if($("#page").val()=='' ){ |
| | | Feng.info("请选择跳转页面") |
| | | return; |
| | | } |
| | | } |
| | | console.log("====pagepagepage==============="+$("#page").val()) |
| | | if(name !='0'){ |
| | | if ($("#type").val() == ''&&$("#page").val()!=2&&$("#page").val()!=25&&$("#page").val()!=27&&$("#page").val()!=37&&$("#page").val()!=28) { |
| | | Feng.info("请选择跳转类型") |
| | | return; |
| | | } |
| | | |
| | | } |
| | | if(name !='0') { |
| | | if ($("#roleType").val() == 1) { |
| | | if ($('#type option:selected').text() == "详情"&&$('#type option:selected').text() == "指定商品"&&$('#type option:selected').text() == "指定折扣") { |
| | | if ($("#pageId").val() == '') { |
| | | Feng.info("请输入跳转ID") |
| | | return; |
| | | } |
| | | } |
| | | } |
| | | } |
| | | if($("#sort").val()=='' ){ |
| | | Feng.info("请输入排序") |
| | | return; |
| | | } |
| | | $.ajax({ |
| | | url: Feng.ctxPath + "/advertisement/addAdvertisement", |
| | | type: "POST", |
| | | contentType: "application/json", // 设置请求头的 Content-Type |
| | | data: JSON.stringify(data1), // 将数据转换为 JSON 字符串 |
| | | success: function(response) { |
| | | window.parent.TSite.table.refresh(); |
| | | TSite.close(); |
| | | Feng.success("添加成功!"); |
| | | }, |
| | | error: function(xhr, status, error) { |
| | | var errorMessage = xhr.responseText ? xhr.responseText : "下架失败!"; |
| | | Feng.error("您的网络异常!"); |
| | | } |
| | | }); |
| | | }; |
| | | |
| | | |
| | | TSite.updateSubmit = function(){ |
| | | |
| | | console.log("kankan") |
| | | console.log($("#img").val()) |
| | | var data1 = { |
| | | id:null, |
| | | position:null, |
| | | img:"", |
| | | jumpPage:null, |
| | | sort:null, |
| | | state:1, |
| | | name:"", |
| | | type:"", |
| | | page:"", |
| | | model:null, |
| | | typeId:null, |
| | | turnId:null, |
| | | }; |
| | | let name = $("#model").val(); |
| | | data1.name = $("#name").val(); |
| | | data1.id = $("#id").val(); |
| | | data1.position = $("#position").val(); |
| | | data1.img = $("#img").val(); |
| | | data1.model = $('#model option:selected').text(); |
| | | data1.page = $('#page option:selected').text(); |
| | | data1.jumpPage = $("#page").val(); |
| | | data1.typeId = $("#type").val(); |
| | | data1.type = $('#type option:selected').text(); |
| | | data1.turnId = $("#pageId").val(); |
| | | data1.sort = $("#sort").val(); |
| | | |
| | | if ( $("#roleType").val()==1){ |
| | | if($("#position").val()==''){ |
| | | data1.position = $("#position").val(); |
| | | Feng.info("请选择广告类型") |
| | | return; |
| | | } |
| | | } |
| | | if($("#name").val()==''){ |
| | | Feng.info("请输入广告名称") |
| | | return; |
| | | } |
| | | |
| | | if ( $("#roleType").val()==1) { |
| | | if ($("#model").val() == '') { |
| | | Feng.info("请选择跳转模块") |
| | | return; |
| | | } |
| | | } |
| | | if(name !='0'){ |
| | | if($("#page").val()=='' ){ |
| | | Feng.info("请选择跳转页面") |
| | | return; |
| | | } |
| | | } |
| | | if(name !='0') { |
| | | if ($("#roleType").val() == 1) { |
| | | if ($("#type").val() == ''&&$("#page").val()!=2&&$("#page").val()!=25&&$("#page").val()!=27&&$("#page").val()!=37&&$("#page").val()!=28) { |
| | | Feng.info("请选择跳转类型") |
| | | return; |
| | | } |
| | | } |
| | | } |
| | | if(name !='0') { |
| | | if ($("#roleType").val() == 1) { |
| | | if ($('#type option:selected').text() == "详情"&&$('#type option:selected').text() == "指定商品"&&$('#type option:selected').text() == "指定折扣") { |
| | | if ($("#pageId").val() == '') { |
| | | Feng.info("请输入跳转ID") |
| | | return; |
| | | } |
| | | } |
| | | } |
| | | } |
| | | if($("#sort").val()=='' ){ |
| | | Feng.info("请输入排序") |
| | | return; |
| | | } |
| | | $.ajax({ |
| | | url: Feng.ctxPath + "/advertisement/updateAdvertisement", |
| | | type: "POST", |
| | | contentType: "application/json", // 设置请求头的 Content-Type |
| | | data: JSON.stringify(data1), // 将数据转换为 JSON 字符串 |
| | | success: function(response) { |
| | | window.parent.TSite.table.refresh(); |
| | | TSite.close(); |
| | | Feng.success("添加成功!"); |
| | | |
| | | }, |
| | | error: function(xhr, status, error) { |
| | | var errorMessage = xhr.responseText ? xhr.responseText : "下架失败!"; |
| | | Feng.error("您的网络异常!"); |
| | | } |
| | | }); |
| | | }; |
| | | |
| | | TSite.search = function () { |
| | | var queryData = {}; |
| | | // 广告名称 |
| | | queryData['name'] = $("#name").val(); |
| | | // 跳转页面 |
| | | queryData['device'] = $("#device").val(); |
| | | // 状态 |
| | | queryData['operatorName'] = $("#operatorName").val(); |
| | | queryData['storeName'] = $("#storeName").val(); |
| | | TSite.table.refresh({query: queryData}); |
| | | }; |
| | | |
| | | TSite.resetSearch = function () { |
| | | $("#name").val(""); |
| | | $("#device").val(""); |
| | | $("#operatorName").val(""); |
| | | $("#storeName").val(""); |
| | | TSite.search(); |
| | | }; |
| | | |
| | | function UploadFileFn(){ |
| | | $('#upFile').click(); |
| | | } |
| | | |
| | | $(function () { |
| | | var defaultColunms = TSite.initColumn(); |
| | | var table = new BSTable(TSite.id, "/gate/listAll", defaultColunms); |
| | | table.setPaginationType("client"); |
| | | TSite.table = table.init(); |
| | | }); |
New file |
| | |
| | | /** |
| | | * 初始化车辆管理详情对话框 |
| | | */ |
| | | var language=1; |
| | | var TCarInfoDlg = { |
| | | goodsPicArray: [], |
| | | tCarInfoData : {}, |
| | | validateFields: { |
| | | } |
| | | }; |
| | | |
| | | /** |
| | | * 验证数据是否为空 |
| | | */ |
| | | TCarInfoDlg.validate = function () { |
| | | $('#carInfoForm').data("bootstrapValidator").resetForm(); |
| | | $('#carInfoForm').bootstrapValidator('validate'); |
| | | return $("#carInfoForm").data('bootstrapValidator').isValid(); |
| | | }; |
| | | |
| | | /** |
| | | * 清除数据 |
| | | */ |
| | | TCarInfoDlg.clearData = function() { |
| | | this.tCarInfoData = {}; |
| | | } |
| | | |
| | | /** |
| | | * 设置对话框中的数据 |
| | | * |
| | | * @param key 数据的名称 |
| | | * @param val 数据的具体值 |
| | | */ |
| | | TCarInfoDlg.set = function(key, val) { |
| | | this.tCarInfoData[key] = (typeof val == "undefined") ? $("#" + key).val() : val; |
| | | return this; |
| | | } |
| | | |
| | | /** |
| | | * 设置对话框中的数据 |
| | | * |
| | | * @param key 数据的名称 |
| | | * @param val 数据的具体值 |
| | | */ |
| | | TCarInfoDlg.get = function(key) { |
| | | return $("#" + key).val(); |
| | | } |
| | | |
| | | /** |
| | | * 关闭此对话框 |
| | | */ |
| | | TCarInfoDlg.close = function() { |
| | | parent.layer.close(window.parent.TSite.layerIndex); |
| | | } |
| | | |
| | | /** |
| | | * 收集数据 |
| | | */ |
| | | TCarInfoDlg.collectData = function() { |
| | | this |
| | | .set('id') |
| | | .set('isPlatCar') |
| | | .set('companyId') |
| | | .set('franchiseeId') |
| | | .set('carColor') |
| | | .set('carModelId') |
| | | .set('carBrandId') |
| | | .set('carLicensePlate') |
| | | .set('carPhoto') |
| | | .set('drivingLicenseNumber') |
| | | .set('drivingLicensePhoto') |
| | | .set('annualInspectionTime') |
| | | .set('commercialInsuranceTime') |
| | | .set('createTime') |
| | | .set('state') |
| | | .set('addType') |
| | | .set('addObjectId') |
| | | .set('plateColor') |
| | | .set('vehicleType') |
| | | .set('ownerName') |
| | | .set('engineId') |
| | | .set('VIN') |
| | | .set('certifyDateA') |
| | | .set('fuelType') |
| | | .set('engineDisplace') |
| | | .set('certificate') |
| | | .set('transAgency') |
| | | .set('transArea') |
| | | .set('transDateStart') |
| | | .set('transDateStop') |
| | | .set('certifyDateB') |
| | | .set('fixState') |
| | | .set('nextFixDate') |
| | | .set('checkState') |
| | | .set('feePrintId') |
| | | .set('GPSBrand') |
| | | .set('GPSModel') |
| | | .set('GPSIMEI') |
| | | .set('GPSInstallDate') |
| | | .set('registerDate') |
| | | .set('commercialType'); |
| | | } |
| | | TCarInfoDlg.addSubmit = function() { |
| | | if ($("#userType").val()==1){ |
| | | var type= $("input[name='type']:checked").val(); |
| | | console.log("看看选择类型") |
| | | console.log(type) |
| | | } |
| | | |
| | | |
| | | var ajax = new $ax(Feng.ctxPath + "/gate/addDevice", function(data){ |
| | | console.log("状态码") |
| | | console.log(data.code) |
| | | if (data.code!=200){ |
| | | Feng.error(data.msg) |
| | | return |
| | | } |
| | | console.log("调用方法") |
| | | Feng.success("添加成功") |
| | | window.parent.TSite.table.refresh(); |
| | | TCarInfoDlg.close(); |
| | | }); |
| | | if ($("#userType").val()==1) { |
| | | if (type == 0) { |
| | | ajax.set("operatorId", type); |
| | | } else { |
| | | if ($("#account").val() == null || $("#account").val() == '') { |
| | | Feng.error("请选择运营商") |
| | | return; |
| | | } |
| | | ajax.set("operatorId", $("#account").val()); |
| | | } |
| | | ajax.set("storeId",$("#store").val()); |
| | | }else if ($("#userType").val()==2){ |
| | | ajax.set("operatorId", $("#operatorId").val()); |
| | | ajax.set("storeId",$("#store").val()); |
| | | }else{ |
| | | ajax.set("storeId",$("#storeId").val()); |
| | | ajax.set("operatorId", $("#operatorId").val()); |
| | | } |
| | | if ($("#name").val()==null || $("#name").val()==''){ |
| | | console.log("名称") |
| | | Feng.error("请输入闸机名称") |
| | | return; |
| | | } |
| | | if ($("#userType").val()!=3){ |
| | | if ($("#store").val()==null || $("#store").val()==''){ |
| | | console.log("门店") |
| | | Feng.error("请选择门店") |
| | | return; |
| | | } |
| | | } |
| | | if ($("#site").val()==null || $("#site").val()==''){ |
| | | Feng.error("请选择场地") |
| | | return; |
| | | } |
| | | if ($("#device").val()==null || $("#device").val()==''){ |
| | | Feng.error("请输入硬件编号") |
| | | return; |
| | | } |
| | | ajax.set("name",$("#name").val()); |
| | | |
| | | ajax.set("siteId",$("#site").val()); |
| | | ajax.set("device",$("#device").val()); |
| | | ajax.start(); |
| | | } |
| | | TCarInfoDlg.editSubmit = function() { |
| | | if ($("#userType").val()==1){ |
| | | var type= $("input[name='type']:checked").val(); |
| | | console.log("看看选择类型") |
| | | console.log(type) |
| | | } |
| | | var ajax = new $ax(Feng.ctxPath + "/gate/updateDevice", function(data){ |
| | | console.log("状态码") |
| | | console.log(data.code) |
| | | if (data.code!=200){ |
| | | Feng.error(data.msg) |
| | | return |
| | | } |
| | | console.log("调用方法") |
| | | Feng.success("修改成功") |
| | | window.parent.TSite.table.refresh(); |
| | | TCarInfoDlg.close(); |
| | | }); |
| | | if ($("#userType").val()==1) { |
| | | if (type == 0) { |
| | | ajax.set("operatorId", type); |
| | | } else { |
| | | if ($("#account").val() == null || $("#account").val() == '') { |
| | | Feng.error("请选择运营商") |
| | | return; |
| | | } |
| | | ajax.set("operatorId", $("#account").val()); |
| | | } |
| | | ajax.set("storeId",$("#store").val()); |
| | | }else if ($("#userType").val()==2){ |
| | | ajax.set("operatorId", $("#operatorId").val()); |
| | | ajax.set("storeId",$("#store").val()); |
| | | }else{ |
| | | ajax.set("storeId",$("#storeId").val()); |
| | | ajax.set("operatorId", $("#operatorId").val()); |
| | | } |
| | | if ($("#name").val()==null || $("#name").val()==''){ |
| | | console.log("名称") |
| | | Feng.error("请输入闸机名称") |
| | | return; |
| | | } |
| | | if ($("#userType").val()!=3){ |
| | | if ($("#store").val()==null || $("#store").val()==''){ |
| | | console.log("门店") |
| | | Feng.error("请选择门店") |
| | | return; |
| | | } |
| | | } |
| | | |
| | | if ($("#site").val()==null || $("#site").val()==''){ |
| | | Feng.error("请选择场地") |
| | | return; |
| | | } |
| | | if ($("#device").val()==null || $("#device").val()==''){ |
| | | Feng.error("请输入硬件编号") |
| | | return; |
| | | } |
| | | ajax.set("name",$("#name").val()); |
| | | ajax.set("id",$("#id").val()); |
| | | ajax.set("siteId",$("#site").val()); |
| | | ajax.set("device",$("#device").val()); |
| | | ajax.start(); |
| | | } |
| | | TCarInfoDlg.oneChange = function (e) { |
| | | console.log(111) |
| | | var oneId=$(e).val(); |
| | | var ajax = new $ax(Feng.ctxPath + "/tCompetition/onChange", function(data){ |
| | | if(data!=null){ |
| | | if(language==1){ |
| | | var content='<option value="">选择市</option>'; |
| | | }else if(language==2){ |
| | | var content='<option value="">Choose your franchisee</option>'; |
| | | }else { |
| | | var content='<option value="">Pilih franchisee Anda</option>'; |
| | | } |
| | | $.each(data, function(k,v) { |
| | | content += "<option value='"+v.code+"'>"+v.name+"</option>"; |
| | | }); |
| | | $("#cCode").empty().append(content); |
| | | } |
| | | }); |
| | | ajax.set("oneId",oneId); |
| | | ajax.start(); |
| | | } |
| | | TCarInfoDlg.oneChange9 = function (e) { |
| | | console.log(111) |
| | | var oneId=$(e).val(); |
| | | var operatorId = $("#account").val(); |
| | | var ajax = new $ax(Feng.ctxPath + "/tShop/getCityYys", function(data){ |
| | | if(data!=null){ |
| | | if(language==1){ |
| | | var content='<option value="">选择市</option>'; |
| | | }else if(language==2){ |
| | | var content='<option value="">Choose your franchisee</option>'; |
| | | }else { |
| | | var content='<option value="">Pilih franchisee Anda</option>'; |
| | | } |
| | | $.each(data, function(k,v) { |
| | | content += "<option value='"+v.code+"'>"+v.name+"</option>"; |
| | | }); |
| | | $("#cCode1").empty().append(content); |
| | | $("#cCode").empty().append(content); |
| | | } |
| | | }); |
| | | ajax.set("province",oneId); |
| | | ajax.set("operatorId",operatorId); |
| | | ajax.start(); |
| | | } |
| | | TCarInfoDlg.oneChangeNext = function (e) { |
| | | var oneId=$(e).val(); |
| | | var ajax = new $ax(Feng.ctxPath + "/tShop/oneChangeNext", function(data){ |
| | | if(data!=null){ |
| | | if(language==1){ |
| | | var content='<option value="">选择账号</option>'; |
| | | }else if(language==2){ |
| | | var content='<option value="">Choose your franchisee</option>'; |
| | | }else { |
| | | var content='<option value="">Pilih franchisee Anda</option>'; |
| | | } |
| | | $.each(data, function(k,v) { |
| | | content += "<option value='"+v.id+"'>"+v.name+"</option>"; |
| | | }); |
| | | $("#account").empty().append(content); |
| | | } |
| | | }); |
| | | ajax.set("oneId",oneId); |
| | | ajax.start(); |
| | | } |
| | | TCarInfoDlg.saveImg = function () { |
| | | var id=$("#id").val(); |
| | | var img=$("#welfarePicture").val(); |
| | | var ajax = new $ax(Feng.ctxPath + "/tShop/saveImg", function(data){ |
| | | if(data.code == 200){ |
| | | Feng.success("保存成功") |
| | | TCarInfoDlg.close(); |
| | | |
| | | } |
| | | }); |
| | | ajax.set("id",id); |
| | | ajax.set("img",img); |
| | | ajax.start(); |
| | | } |
| | | |
| | | /** |
| | | * 提交添加 |
| | | */ |
| | | |
| | | var map = new AMap.Map('container', { |
| | | resizeEnable: true, // 允许缩放 |
| | | zoom: 15 // 设置地图的缩放级别,0 - 20 |
| | | }); |
| | | var marker; |
| | | //搜索地图 |
| | | TCarInfoDlg.searchByStationName = function(e,type){ |
| | | console.log("调用") |
| | | 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{ |
| | | addMarker(lng,lat); |
| | | } |
| | | } 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 { |
| | | //获取地址失败 |
| | | } |
| | | }); |
| | | }) |
| | | } |
| | | |
| | | |
| | | |
| | | $(function() { |
| | | Feng.initValidator("carInfoForm", TCarInfoDlg.validateFields); |
| | | // 初始化图片上传 |
| | | var carPhoto = new $WebUpload("c1"); |
| | | carPhoto.setUploadBarId("progressBar"); |
| | | carPhoto.init(); |
| | | var carPhoto = new $WebUpload("c2"); |
| | | carPhoto.setUploadBarId("progressBar"); |
| | | carPhoto.init(); |
| | | var carPhoto = new $WebUpload("c3"); |
| | | carPhoto.setUploadBarId("progressBar"); |
| | | carPhoto.init(); |
| | | var carPhoto = new $WebUpload("c4"); |
| | | carPhoto.setUploadBarId("progressBar"); |
| | | carPhoto.init(); |
| | | var carPhoto = new $WebUpload("c5"); |
| | | carPhoto.setUploadBarId("progressBar"); |
| | | carPhoto.init(); |
| | | var carPhoto = new $WebUpload("c6"); |
| | | carPhoto.setUploadBarId("progressBar"); |
| | | carPhoto.init(); |
| | | var carPhoto = new $WebUpload("c7"); |
| | | carPhoto.setUploadBarId("progressBar"); |
| | | carPhoto.init(); |
| | | var carPhoto = new $WebUpload("c8"); |
| | | carPhoto.setUploadBarId("progressBar"); |
| | | carPhoto.init(); |
| | | var carPhoto = new $WebUpload("img"); |
| | | carPhoto.setUploadBarId("progressBar"); |
| | | carPhoto.init(); |
| | | var carPhoto = new $WebUpload("welfarePicture"); |
| | | carPhoto.setUploadBarId("progressBar"); |
| | | carPhoto.init(); |
| | | var drivingLicensePhoto = new $WebUpload("drivingLicensePhoto"); |
| | | drivingLicensePhoto.setUploadBarId("progressBar"); |
| | | drivingLicensePhoto.init(); |
| | | |
| | | //地图搜索 |
| | | TCarInfoDlg.searchByStationName(); |
| | | }); |
| | | |
| | | /** |
| | | * 选择分公司后执行 |
| | | */ |
| | | TCarInfoDlg.oneChange = function (e) { |
| | | if ($("#objectType").val()==2){ |
| | | |
| | | }else{ |
| | | var oneId=$(e).val(); |
| | | var ajax = new $ax(Feng.ctxPath + "/tCity/onChange", function(data){ |
| | | if(data!=null){ |
| | | if(language==1){ |
| | | var content='<option value="">选择市</option>'; |
| | | }else if(language==2){ |
| | | var content='<option value="">Choose your franchisee</option>'; |
| | | }else { |
| | | var content='<option value="">Pilih franchisee Anda</option>'; |
| | | } |
| | | $.each(data, function(k,v) { |
| | | content += "<option value='"+v.code+"'>"+v.name+"</option>"; |
| | | }); |
| | | $("#cCode1").empty().append(content); |
| | | } |
| | | }); |
| | | ajax.set("oneId",oneId); |
| | | ajax.start(); |
| | | } |
| | | |
| | | } |
| | | |
| | | /** |
| | | * 类型改变执行 |
| | | * @param e |
| | | */ |
| | | TCarInfoDlg.companyTypeClick = function (e) { |
| | | if (1 == e){ |
| | | $(".companyDiv").hide(); |
| | | } else if (2 == e){ |
| | | $(".companyDiv").show(); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 车辆品牌改变时执行 |
| | | */ |
| | | TCarInfoDlg.saveAllImg = function (e) { |
| | | var id = $("#id").val() |
| | | var px1 = $("#px1").val() |
| | | var px2 = $("#px2").val() |
| | | var px3 = $("#px3").val() |
| | | var px4 = $("#px4").val() |
| | | var px5 = $("#px5").val() |
| | | var px6 = $("#px6").val() |
| | | var px7 = $("#px7").val() |
| | | var px8 = $("#px8").val() |
| | | var c1 = $("#c1").val() |
| | | var c2 = $("#c2").val() |
| | | var c3 = $("#c3").val() |
| | | var c4 = $("#c4").val() |
| | | var c5 = $("#c5").val() |
| | | var c6 = $("#c6").val() |
| | | var c7 = $("#7").val() |
| | | var c8 = $("#c8").val() |
| | | var r1 = document.querySelector('input[name="r1"]').checked; |
| | | var r2 = document.querySelector('input[name="r2"]').checked; |
| | | var r3 = document.querySelector('input[name="r3"]').checked; |
| | | var r4 = document.querySelector('input[name="r4"]').checked; |
| | | var r5 = document.querySelector('input[name="r5"]').checked; |
| | | var r6 = document.querySelector('input[name="r6"]').checked; |
| | | var r7 = document.querySelector('input[name="r7"]').checked; |
| | | var r8 = document.querySelector('input[name="r8"]').checked; |
| | | if(r1){ |
| | | r1 =1 |
| | | }else{ |
| | | r1=0 |
| | | } |
| | | if(r2){ |
| | | r2 =1 |
| | | }else{ |
| | | r2=0 |
| | | } |
| | | if(r3){ |
| | | r3 =1 |
| | | }else{ |
| | | r3=0 |
| | | } |
| | | if(r4){ |
| | | r4 =1 |
| | | }else{ |
| | | r4=0 |
| | | } |
| | | if(r5){ |
| | | r5 =1 |
| | | }else{ |
| | | r5=0 |
| | | } |
| | | if(r6){ |
| | | r6 =1 |
| | | }else{ |
| | | r6=0 |
| | | } |
| | | if(r7){ |
| | | r7 =1 |
| | | }else{ |
| | | r7=0 |
| | | } |
| | | if(r8){ |
| | | r8 =1 |
| | | }else{ |
| | | r8=0 |
| | | } |
| | | |
| | | var ajax = new $ax(Feng.ctxPath + "/tShop/saveImgAll", function(data){ |
| | | if(data.code == 200){ |
| | | Feng.success("保存成功!"); |
| | | }else{ |
| | | Feng.error(data.msg); |
| | | } |
| | | },function(data){ |
| | | Feng.error("保存失败!" + data.responseJSON.message + "!"); |
| | | |
| | | }); |
| | | ajax.set("id",id); |
| | | ajax.set("px1",px1); |
| | | ajax.set("px2",px2); |
| | | ajax.set("px3",px3); |
| | | ajax.set("px4",px4); |
| | | ajax.set("px5",px5); |
| | | ajax.set("px6",px6); |
| | | ajax.set("px7",px7); |
| | | ajax.set("px8",px8); |
| | | ajax.set("c1",c1); |
| | | ajax.set("c2",c2); |
| | | ajax.set("c3",c3); |
| | | ajax.set("c4",c4); |
| | | ajax.set("c5",c5); |
| | | ajax.set("c6",c6); |
| | | ajax.set("c7",c7); |
| | | ajax.set("c8",c8); |
| | | ajax.set("r1",r1); |
| | | ajax.set("r2",r2); |
| | | ajax.set("r3",r3); |
| | | ajax.set("r4",r4); |
| | | ajax.set("r5",r5); |
| | | ajax.set("r6",r6); |
| | | ajax.set("r7",r7); |
| | | ajax.set("r8",r8); |
| | | ajax.start(); |
| | | } |
| | | |
| | | /** |
| | | * 专车服务被点击 |
| | | */ |
| | | TCarInfoDlg.zcServerClick = function () { |
| | | var serverBox1 = $('#serverBox1').prop('checked'); |
| | | if (serverBox1){ |
| | | $("#zcModelDiv").show(); |
| | | } else { |
| | | $("#zcModelDiv").hide(); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 跨城服务被点击 |
| | | */ |
| | | TCarInfoDlg.kcServerClick = function () { |
| | | var serverBox3 = $('#serverBox3').prop('checked'); |
| | | if (serverBox3){ |
| | | $("#kcModelDiv").show(); |
| | | } else { |
| | | $("#kcModelDiv").hide(); |
| | | } |
| | | } |
| | | |
| | | |
| | | TCarInfoDlg.oneChange1 = function (e) { |
| | | console.log(111) |
| | | var oneId=$(e).val(); |
| | | var ajax = new $ax(Feng.ctxPath + "/tShop/onChange1", function(data){ |
| | | if(data!=null){ |
| | | if(language==1){ |
| | | var content='<option value="">选择省</option>'; |
| | | }else if(language==2){ |
| | | var content='<option value="">Choose your franchisee</option>'; |
| | | }else { |
| | | var content='<option value="">Pilih franchisee Anda</option>'; |
| | | } |
| | | $.each(data, function(k,v) { |
| | | content += "<option value='"+v.code+"'>"+v.name+"</option>"; |
| | | }); |
| | | $("#pCode").empty().append(content); |
| | | } |
| | | }); |
| | | ajax.set("oneId",oneId); |
| | | ajax.start(); |
| | | } |
| | | TCarInfoDlg.oneChange1Next = function (e) { |
| | | console.log(111) |
| | | var oneId=$(e).val(); |
| | | var ajax = new $ax(Feng.ctxPath + "/tShop/onChange1", function(data){ |
| | | if(data!=null){ |
| | | if(language==1){ |
| | | var content='<option value="">选择省</option>'; |
| | | }else if(language==2){ |
| | | var content='<option value="">Choose your franchisee</option>'; |
| | | }else { |
| | | var content='<option value="">Pilih franchisee Anda</option>'; |
| | | } |
| | | $.each(data, function(k,v) { |
| | | content += "<option value='"+v.id+"'>"+v.name+"</option>"; |
| | | }); |
| | | $("#pCode").empty().append(content); |
| | | } |
| | | }); |
| | | ajax.set("oneId",e); |
| | | ajax.start(); |
| | | } |
| | | TCarInfoDlg.oneChange2 = function (e) { |
| | | console.log(111) |
| | | var oneId=$(e).val(); |
| | | var elementById = document.getElementById("radio1"); |
| | | // 如果选中了运营商门店 那就查询这个运营商下的市 |
| | | if (elementById.checked){ |
| | | var operatorId = $("#account").val(); |
| | | console.log("我看看运营商id") |
| | | var ajax = new $ax(Feng.ctxPath + "/tShop/getCityYys", function(data){ |
| | | if(data!=null){ |
| | | if(language==1){ |
| | | var content='<option value="">选择市</option>'; |
| | | }else if(language==2){ |
| | | var content='<option value="">Choose your franchisee</option>'; |
| | | }else { |
| | | var content='<option value="">Pilih franchisee Anda</option>'; |
| | | } |
| | | $.each(data, function(k,v) { |
| | | content += "<option value='"+v.code+"'>"+v.name+"</option>"; |
| | | }); |
| | | $("#cCode1").empty().append(content); |
| | | $("#cCode").empty().append(content); |
| | | } |
| | | }); |
| | | ajax.set("province",oneId); |
| | | ajax.set("operatorId",operatorId); |
| | | ajax.start(); |
| | | }else{ |
| | | var ajax = new $ax(Feng.ctxPath + "/tShop/onChange2", function(data){ |
| | | if(data!=null){ |
| | | if(language==1){ |
| | | var content='<option value="">选择市</option>'; |
| | | }else if(language==2){ |
| | | var content='<option value="">Choose your franchisee</option>'; |
| | | }else { |
| | | var content='<option value="">Pilih franchisee Anda</option>'; |
| | | } |
| | | $.each(data, function(k,v) { |
| | | content += "<option value='"+v.code+"'>"+v.name+"</option>"; |
| | | }); |
| | | $("#cCode").empty().append(content); |
| | | } |
| | | }); |
| | | ajax.set("oneId",oneId); |
| | | ajax.start(); |
| | | } |
| | | |
| | | } |
| | | TCarInfoDlg.getStore = function (e) { |
| | | var operatorId=$(e).val(); |
| | | var ajax = new $ax(Feng.ctxPath + "/gate/getStore", function(data){ |
| | | if(data!=null){ |
| | | var content="<option value=''>选择门店</option>"; |
| | | $.each(data, function(k,v) { |
| | | content += "<option value='"+v.id+"'>"+v.name+"</option>"; |
| | | }); |
| | | $("#store").empty().append(content); |
| | | } |
| | | }); |
| | | ajax.set("operatorId",operatorId); |
| | | ajax.start(); |
| | | }; |
| | | TCarInfoDlg.getSite = function (e) { |
| | | var storeId=$(e).val(); |
| | | var ajax = new $ax(Feng.ctxPath + "/gate/getSite", function(data){ |
| | | if(data!=null){ |
| | | var content="<option value=''>选择场地</option>";; |
| | | $.each(data, function(k,v) { |
| | | content += "<option value='"+v.id+"'>"+v.name+"</option>"; |
| | | }); |
| | | $("#site").empty().append(content); |
| | | } |
| | | }); |
| | | ajax.set("storeId",storeId); |
| | | ajax.start(); |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | TCarInfoDlg.oneChangeNext1 = function (e) { |
| | | var oneId=$(e).val(); |
| | | var ajax = new $ax(Feng.ctxPath + "/tCompetition/oneChangeNext", function(data){ |
| | | if(data!=null){ |
| | | if(language==1){ |
| | | var content='<option value="">选择门店</option>'; |
| | | }else if(language==2){ |
| | | var content='<option value="">Choose your franchisee</option>'; |
| | | }else { |
| | | var content='<option value="">Pilih franchisee Anda</option>'; |
| | | } |
| | | $.each(data, function(k,v) { |
| | | content += "<option value='"+v.id+"'>"+v.name+"</option>"; |
| | | }); |
| | | $("#shopId").empty().append(content); |
| | | } |
| | | }); |
| | | ajax.set("oneId",oneId); |
| | | ajax.start(); |
| | | } |
| | | |
| | | |
| | | TCarInfoDlg.oneChangeNext3 = function (e) { |
| | | var oneId=$(e).val(); |
| | | var ajax = new $ax(Feng.ctxPath + "/tCompetition/oneChangeNext", function(data){ |
| | | if(data!=null){ |
| | | if(language==1){ |
| | | var content='<option value="">选择门店</option>'; |
| | | }else if(language==2){ |
| | | var content='<option value="">Choose your franchisee</option>'; |
| | | }else { |
| | | var content='<option value="">Pilih franchisee Anda</option>'; |
| | | } |
| | | $.each(data, function(k,v) { |
| | | content += "<option value='"+v.code+"'>"+v.name+"</option>"; |
| | | }); |
| | | $("#shopId").empty().append(content); |
| | | } |
| | | }); |
| | | ajax.set("oneId",oneId); |
| | | ajax.start(); |
| | | } |
New file |
| | |
| | | /** |
| | | * 管理初始化 |
| | | */ |
| | | var TStoreProvince = { |
| | | id: "TStoreProvinceTable", //表格id |
| | | seItem: null, //选中的条目 |
| | | table: null, |
| | | layerIndex: -1, |
| | | storeList: [] |
| | | }; |
| | | |
| | | /** |
| | | * 初始化表格的列 |
| | | */ |
| | | TStoreProvince.initColumn = function () { |
| | | return [ |
| | | {field: 'selectItem', checkbox: true}, |
| | | {title: '序号', field: 'id', visible: true, align: 'center', valign: 'middle'}, |
| | | {title: '所在省市', field: 'provinceCity', visible: true, align: 'center', valign: 'middle'}, |
| | | {title: '门店名称', field: 'name', visible: true, align: 'center', valign: 'middle'}, |
| | | {title: '场地名称', field: 'siteName', visible: true, align: 'center', valign: 'middle'}, |
| | | ]; |
| | | }; |
| | | |
| | | /** |
| | | * 检查是否选中 |
| | | */ |
| | | TStoreProvince.check = function () { |
| | | var selected = $('#' + this.id).bootstrapTable('getSelections'); |
| | | if(selected.length == 0){ |
| | | Feng.info("请先选中表格中的某一记录!"); |
| | | return false; |
| | | }else{ |
| | | TStoreProvince.seItem = selected[0]; |
| | | return true; |
| | | } |
| | | }; |
| | | |
| | | |
| | | TStoreProvince.storeOfClosePage = function (){ |
| | | parent.layer.close(parent.layer.getFrameIndex(window.frameElement.id)); |
| | | } |
| | | |
| | | |
| | | TStoreProvince.saveSelectSites = function (){ |
| | | var selected = $('#' + this.id).bootstrapTable('getSelections'); |
| | | if (selected.length == 0) { |
| | | Feng.info("请先选中表格中的某一记录!"); |
| | | return false; |
| | | } |
| | | var arr = []; |
| | | var name =''; |
| | | for(var i in selected){ |
| | | if(typeof selected[i].id != "undefined"){ |
| | | console.log( selected[i].ids,55555) |
| | | name = selected[0].accountName |
| | | if(name!=selected[i].accountName){ |
| | | Feng.info("请选择相同运营商场地") |
| | | return ; |
| | | } |
| | | arr.push({ |
| | | id: selected[i].id, |
| | | provinceCity: typeof selected[i].provinceCity != "undefined" ? selected[i].provinceCity : "", |
| | | accountName: typeof selected[i].accountName != "undefined" ? selected[i].accountName : "", |
| | | name: typeof selected[i].name != "undefined" ? selected[i].name : "", |
| | | siteName: typeof selected[i].siteName != "undefined" ? selected[i].siteName : "", |
| | | ids:typeof selected[i].ids != "undefined" ? selected[i].ids : "", |
| | | }) |
| | | } |
| | | } |
| | | window.parent.TGoodsInfoDlg.selecUserOpt1(arr); |
| | | TStoreProvince.storeOfClosePage(); |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * 查询列表 |
| | | */ |
| | | TStoreProvince.search = function () { |
| | | var queryData = {}; |
| | | queryData['provinceId'] = $("#pCode").val(); |
| | | queryData['cityId'] = $("#cCode").val(); |
| | | queryData['operatorId'] = $("#account").val(); |
| | | queryData['storeName'] = $("#storeName").val(); |
| | | TStoreProvince.table.refresh({query: queryData}); |
| | | }; |
| | | |
| | | |
| | | /** |
| | | * 重置搜索 |
| | | */ |
| | | TStoreProvince.resetSearch = function () { |
| | | $("#pCode").val('') |
| | | $("#cCode").val('') |
| | | $("#storeName").val('') |
| | | $("#account").val('') |
| | | TStoreProvince.search(); |
| | | }; |
| | | |
| | | function queryProvince(){ |
| | | // 发送AJAX请求到后台获取省份数据 |
| | | // 假设后台返回的数据格式为一个包含省份ID和名称的数组 |
| | | var provinceSelect = document.getElementById("province"); |
| | | |
| | | var ajax = new $ax(Feng.ctxPath + "/tCouponManage/getProvince", function(data){ |
| | | data.forEach(province => { |
| | | var option = document.createElement("option"); |
| | | option.value = province.code; // 根据你的数据结构确定省份的id字段 |
| | | option.text = province.name; // 根据你的数据结构确定省份的name字段 |
| | | provinceSelect.appendChild(option); |
| | | }); |
| | | },function(data){ |
| | | Feng.error("下拉失败!" + data.responseJSON.message + "!"); |
| | | }); |
| | | ajax.start(); |
| | | provinceSelect.addEventListener("change", queryCity); |
| | | } |
| | | |
| | | |
| | | // 获取城市数据 |
| | | function queryCity() { |
| | | var selectedProvinceId = this.value; // 获取选择的省份ID |
| | | // 发送AJAX请求到后台获取对应省份的城市数据 |
| | | // 假设后台返回的数据格式为一个包含城市ID和名称的数组 |
| | | |
| | | var citySelect = document.getElementById("city"); |
| | | citySelect.innerHTML = ""; |
| | | var ajax = new $ax(Feng.ctxPath + "/tCouponManage/getCity1", function(data){ |
| | | |
| | | data.forEach(province => { |
| | | var content='<option value="">选择市</option>'; |
| | | $.each(data, function(k,v) { |
| | | content += "<option value='"+v.code+"'>"+v.name+"</option>"; |
| | | }); |
| | | $("#city").empty().append(content); |
| | | |
| | | }); |
| | | },function(data){ |
| | | console.log('data:',data) |
| | | Feng.error("获取失败!" + data.responseJSON.message + "!"); |
| | | }); |
| | | ajax.set('province',selectedProvinceId); |
| | | ajax.start(); |
| | | } |
| | | |
| | | $(function () { |
| | | var defaultColunms = TStoreProvince.initColumn(); |
| | | var table = new BSTable(TStoreProvince.id, "/tCouponManage/siteDetailsOfSearch", defaultColunms); |
| | | table.setPaginationType("client"); |
| | | TStoreProvince.table = table.init(); |
| | | queryProvince(); |
| | | }); |
| | |
| | | {title: '序号', field: 'id', visible: true, align: 'center', valign: 'middle'}, |
| | | {title: '所在省市', field: 'provinceCity', visible: true, align: 'center', valign: 'middle'}, |
| | | {title: '门店名称', field: 'name', visible: true, align: 'center', valign: 'middle'}, |
| | | |
| | | ]; |
| | | }; |
| | | |
| | |
| | | var table = new BSTable(TStoreProvince.id, "/tCouponManage/storeDetailsOfSearch", defaultColunms); |
| | | table.setPaginationType("client"); |
| | | TStoreProvince.table = table.init(); |
| | | |
| | | queryProvince(); |
| | | }); |
| | |
| | | goodsPicArray:[], |
| | | goodsPicArray1:[], |
| | | storeIds: [], |
| | | siteIds: [], |
| | | |
| | | }; |
| | | |
| | |
| | | }); |
| | | this.layerIndex = index; |
| | | } |
| | | function siteList1(){ |
| | | var index = layer.open({ |
| | | type: 2, |
| | | title: '门店列表', |
| | | area: ['80%', '80%'], //宽高 |
| | | fix: false, //不固定 |
| | | maxmin: true, |
| | | content: Feng.ctxPath + '/tGoods/siteList1' |
| | | }); |
| | | this.layerIndex = index; |
| | | } |
| | | |
| | | function storeList(){ |
| | | var index = layer.open({ |
| | | type: 2, |
| | |
| | | this.layerIndex = index; |
| | | } |
| | | TGoodsInfoDlg.selecUserOpt = function (arrays){ |
| | | |
| | | //获取所有的值 |
| | | var subArr= this.storeIds; |
| | | console.log(subArr) |
| | |
| | | } |
| | | } |
| | | $("#coun").append(str); |
| | | } |
| | | TGoodsInfoDlg.selecUserOpt1 = function (arrays){ |
| | | console.log("进入") |
| | | //获取所有的值 |
| | | var subArr= this.siteIds; |
| | | console.log(subArr) |
| | | $(".timeClass").each(function () { |
| | | subArr.push($(this).find("input[name*='id']").val()); |
| | | }); |
| | | var str = ''; |
| | | for(var i in arrays){ |
| | | var b = true; |
| | | for(var j in subArr){ |
| | | if(arrays[i].id === Number(subArr[j])){ |
| | | b = false; |
| | | break |
| | | } |
| | | } |
| | | if(b){ |
| | | this.siteIds.push(arrays[i].id) |
| | | str += '<tr class="timeClass">' + |
| | | '<td><input type="hidden" id="id" name="id" value="'+arrays[i].id+'"><input type="hidden" id="provinceCity" name="provinceCity" value="'+arrays[i].provinceCity+'">' + arrays[i].provinceCity + '</td>' + |
| | | '<td><input type="hidden" id="accountName" name="accountName" value="'+arrays[i].accountName+'">' + arrays[i].accountName + '</td>' + |
| | | '<td><input type="hidden" id="name" name="name" value="'+arrays[i].name+'">' + arrays[i].name + |
| | | '<td><input type="hidden" id="siteName" name="siteName" value="'+arrays[i].siteName+'">' + arrays[i].siteName + |
| | | '<td><input type="hidden" id="ids" name="ids" value="'+arrays[i].ids+'">' + arrays[i].ids + |
| | | '</td><td><button onclick="deleteSub(this)">移除</button></td></tr>'; |
| | | } |
| | | } |
| | | $("#coun1").append(str); |
| | | } |
| | | function deleteSub(e) { |
| | | console.log(e); |
| | |
| | | |
| | | } |
| | | TGoodsInfoDlg.addSubmit1 = function() { |
| | | let company = 3; |
| | | var company = 3; |
| | | var radioButtons = document.getElementsByName("company"); |
| | | for (var i = 0; i < radioButtons.length; i++) { |
| | | if (radioButtons[i].checked) { |
| | | company = radioButtons[i].value; |
| | | break; |
| | | } |
| | | } |
| | | console.log("看看作用域") |
| | | console.log(company) |
| | | this.clearData(); |
| | | this.collectData(); |
| | | var cityIds = []; |
| | | var cts = ""; |
| | | if (company === '2'){ |
| | | var myselect=document.getElementById('cityData'); |
| | | var seCity = myselect.options[myselect.selectedIndex].value; |
| | | if (seCity === null || seCity === undefined || seCity === ''){ |
| | | return Feng.error('请选中一个省市'); |
| | | } |
| | | cityIds.push(seCity); |
| | | console.log("看看num") |
| | | console.log(num) |
| | | if (num > 0){ |
| | | for (let i = 1; i <= num; i++) { |
| | | var insSelect=document.getElementById('cityData'+i); |
| | | var inData = insSelect.options[insSelect.selectedIndex].value; |
| | | if (inData !== undefined || inData !== null || inData !== ''){ |
| | | cityIds.push(inData); |
| | | } |
| | | } |
| | | |
| | | |
| | | }else { |
| | | // 如果只有一个城市,则将cts设置为字符串 |
| | | if (cityIds.length === 1) { |
| | | cts = cityIds[0]; |
| | | } else { |
| | | cts = cityIds.join(','); |
| | | } |
| | | } |
| | | } |
| | | // if (company === '2'){ |
| | | // var myselect=document.getElementById('cityData'); |
| | | // var seCity = myselect.options[myselect.selectedIndex].value; |
| | | // if (seCity === null || seCity === undefined || seCity === ''){ |
| | | // return Feng.error('请选中一个省市'); |
| | | // } |
| | | // cityIds.push(seCity); |
| | | // console.log("看看num") |
| | | // console.log(num) |
| | | // if (num > 0){ |
| | | // for (let i = 1; i <= num; i++) { |
| | | // var insSelect=document.getElementById('cityData'+i); |
| | | // var inData = insSelect.options[insSelect.selectedIndex].value; |
| | | // if (inData !== undefined || inData !== null || inData !== ''){ |
| | | // cityIds.push(inData); |
| | | // } |
| | | // } |
| | | // }else { |
| | | // // 如果只有一个城市,则将cts设置为字符串 |
| | | // if (cityIds.length === 1) { |
| | | // cts = cityIds[0]; |
| | | // } else { |
| | | // cts = cityIds.join(','); |
| | | // } |
| | | // } |
| | | // } |
| | | |
| | | let type = document.querySelector('input[name="redemptionMethod"]:checked').value; |
| | | let name = $("#name").val() |
| | |
| | | |
| | | const commaSeparatedString = this.goodsPicArray.join(','); |
| | | |
| | | |
| | | var stores = ""; |
| | | if (company === 3 && $("#userType").val()!="3"){ |
| | | var sites = ""; |
| | | |
| | | if (company == "3" && $("#userType").val()!="3"){ |
| | | console.log('3---this.storeIds',this.storeIds); |
| | | if (TGoodsInfoDlg.storeIds.length === 0 ){ |
| | | return Feng.error('请至少选择一个门店'); |
| | | } |
| | | stores = this.storeIds.join(','); |
| | | console.log('stores--===--',stores) |
| | | } |
| | | if (company == "4" && $("#userType").val()!="3"){ |
| | | console.log('3---this.siteIds',this.siteIds); |
| | | if (TGoodsInfoDlg.siteIds.length === 0 ){ |
| | | return Feng.error('请至少选择一个场地'); |
| | | } |
| | | sites = this.siteIds.join(','); |
| | | console.log('sites--===--',sites) |
| | | } |
| | | let text = TGoodsInfoDlg.editor.getContent(); |
| | | console.log(text) |
| | |
| | | }else if(data=="5003"){ |
| | | Feng.info("请选择相同运营商门店"); |
| | | |
| | | }else |
| | | if(data.code == 200){ |
| | | }else if(data=="5004"){ |
| | | Feng.info("请选择相同运营商场地"); |
| | | } |
| | | else if(data.code == 200){ |
| | | if(language==1){ |
| | | Feng.success("添加成功!"); |
| | | }else if(language==2){ |
| | |
| | | },function(data){ |
| | | Feng.error("添加失败!" + data.responseJSON.message + "!"); |
| | | }); |
| | | console.log("看看城市ids") |
| | | console.log(cts); |
| | | console.log("看看场地ids") |
| | | console.log(sites); |
| | | ajax.set("typeAll",3); |
| | | ajax.set("name",name); |
| | | ajax.set("price",price); |
| | | ajax.set("sites",sites); |
| | | ajax.set("type",type); |
| | | ajax.set("integral",integral); |
| | | ajax.set("cash",cash); |
| | |
| | | $("#coun").append(str); |
| | | console.log('storeIds',this.storeIds) |
| | | } |
| | | TGoodsInfoDlg.selecUserOpt1 = function (arrays){ |
| | | console.log(arrays) |
| | | //获取所有的值 |
| | | var subArr= this.storeIds; |
| | | $(".timeClass").each(function () { |
| | | subArr.push($(this).find("input[name*='id']").val()); |
| | | }); |
| | | var str = ''; |
| | | for(var i in arrays){ |
| | | var b = true; |
| | | for(var j in subArr){ |
| | | if(arrays[i].id === Number(subArr[j])){ |
| | | b = false; |
| | | break |
| | | } |
| | | } |
| | | if(b){ |
| | | this.storeIds.push(arrays[i].id) |
| | | str += '<tr class="timeClass">' + |
| | | '<td><input type="hidden" id="id" name="id" value="'+arrays[i].id+'"><input type="hidden" id="provinceCity" name="provinceCity" value="'+arrays[i].provinceCity+'">' + arrays[i].provinceCity + '</td>' + |
| | | '<td><input type="hidden" id="accountName" name="accountName" value="'+arrays[i].accountName+'">' + arrays[i].accountName + '</td>' + |
| | | '<td><input type="hidden" id="name" name="name" value="'+arrays[i].name+'">' + arrays[i].name + '</td>' + |
| | | '<td><input type="hidden" id="siteName" name="siteName" value="'+arrays[i].siteName+'">' + arrays[i].siteName + '</td>' + |
| | | '<td><button onclick="deleteSub(this)">移除</button></td></tr>'; |
| | | } |
| | | } |
| | | $("#coun1").append(str); |
| | | } |
| | | function deleteSub(e) { |
| | | console.log(e); |
| | | var row = $(e).closest('tr'); |
New file |
| | |
| | | /** |
| | | * 跨城站点管理管理初始化 |
| | | */ |
| | | var THomeModule = { |
| | | id: "THomeModule", //表格id |
| | | seItem: null, //选中的条目 |
| | | table: null, |
| | | layerIndex: -1, |
| | | picture:"", |
| | | fileUrl:"", |
| | | backgroundImage:"", |
| | | buttonImage:"", |
| | | plan:"", |
| | | goodsPicArray:[], |
| | | validateFields: { |
| | | } |
| | | }; |
| | | var objectType =$("#objectType").val() |
| | | // /** |
| | | // * 初始化表格的列 |
| | | // */ |
| | | // THomeModule.initColumn = function () { |
| | | // return [ |
| | | // {field: 'selectItem', checkbox: true}, |
| | | // {title: '序号', field: 'id', visible: true, align: 'center', valign: 'middle'}, |
| | | // {title: '广告类型', field: 'position', visible: true, align: 'center', valign: 'middle',width:'20%', |
| | | // formatter:function (data) { |
| | | // return {1:"首页banner",2:"线上课得积分",3:"看视频得奖励",4:"常见问题"}[data] |
| | | // } |
| | | // }, |
| | | // {title: '广告名称', field: 'name', visible: true, align: 'center', valign: 'middle'}, |
| | | // {title: '广告图片', field: 'img', visible: true, align: 'center', valign: 'middle', |
| | | // formatter: function (value, row, index) { |
| | | // value = typeof value == "undefined" || value == '' ? '/static/img/NoPIC.png' : value; |
| | | // return '<img src="' + value + '" style="height: 100px;"/>' |
| | | // } |
| | | // }, |
| | | // {title: '跳转模块', field: 'model', visible: true, align: 'center', valign: 'middle', |
| | | // }, |
| | | // {title: '跳转页面', field: 'page', visible: true, align: 'center', valign: 'middle', |
| | | // }, |
| | | // {title: '排序', field: 'sort', visible: true, align: 'center', valign: 'middle', |
| | | // }, |
| | | // {title: '状态', field: 'state', visible: true, align: 'center', valign: 'middle', |
| | | // formatter:function (data) { |
| | | // return {1:"上架中",2:"下架中"}[data] |
| | | // } |
| | | // } |
| | | // ]; |
| | | // }; |
| | | |
| | | /** |
| | | * 检查是否选中 |
| | | */ |
| | | THomeModule.check = function () { |
| | | var selected = $('#' + this.id).bootstrapTable('getSelections'); |
| | | if(selected.length == 0){ |
| | | Feng.info("请先选中表格中的某一记录!"); |
| | | return false; |
| | | }else{ |
| | | THomeModule.seItem = selected[0]; |
| | | return true; |
| | | } |
| | | }; |
| | | |
| | | /** |
| | | * 打开查看详情页面 |
| | | */ |
| | | THomeModule.openInfo = function () { |
| | | var selected = $('#' + this.id).bootstrapTable('getSelections'); |
| | | if(selected.length >1 ){ |
| | | Feng.info("只能选择一个广告进行查看!"); |
| | | }else { |
| | | if (this.check()) { |
| | | var index = layer.open({ |
| | | type: 2, |
| | | title: "查看详情", |
| | | area: ['100%', '100%'], //宽高 |
| | | fix: false, //不固定 |
| | | maxmin: true, |
| | | content: Feng.ctxPath + '/advertisement/update/' + THomeModule.seItem.id+'/1' |
| | | }); |
| | | this.layerIndex = index; |
| | | } |
| | | } |
| | | }; |
| | | /** |
| | | * 跳转编辑页面 |
| | | */ |
| | | THomeModule.openEditTHomeModule = function () { |
| | | var selected = $('#' + this.id).bootstrapTable('getSelections'); |
| | | if(selected.length >1 ){ |
| | | Feng.info("只能选择一个广告进行编辑!"); |
| | | }else { |
| | | if (this.check()) { |
| | | var index = layer.open({ |
| | | type: 2, |
| | | title: "编辑广告", |
| | | area: ['100%', '100%'], //宽高 |
| | | fix: false, //不固定 |
| | | maxmin: true, |
| | | content: Feng.ctxPath + '/advertisement/update/' + THomeModule.seItem.id+'/2' |
| | | }); |
| | | this.layerIndex = index; |
| | | } |
| | | } |
| | | }; |
| | | /** |
| | | * 关闭此对话框 |
| | | */ |
| | | THomeModule.close = function() { |
| | | parent.layer.close(parent.layer.getFrameIndex(window.name)); |
| | | }; |
| | | THomeModule.oneChange = function () { |
| | | var modelId = $('#model option:selected').val(); |
| | | var pageSelect = document.getElementById("page"); |
| | | var typeSelect = document.getElementById("type"); |
| | | var ajax = new $ax(Feng.ctxPath + "/THomeModule/getCity", function(data){ |
| | | if(data!=null){ |
| | | var content='<option value="">选择跳转页面</option>'; |
| | | $.each(data, function(k,v) { |
| | | content += "<option value='"+v.id+"'>"+v.name+"</option>"; |
| | | }); |
| | | $("#cCode").empty().append(content); |
| | | } |
| | | }); |
| | | if (modelId === ""){ |
| | | pageSelect.innerHTML = '<option value="">请先选择跳转模块</option>'; |
| | | typeSelect.innerHTML = '<option value="">请先选择跳转模块</option>'; |
| | | } |
| | | ajax.set("province",province); |
| | | ajax.start(); |
| | | }; |
| | | THomeModule.addConfig = function(){ |
| | | $("#cover1").val(); |
| | | $("#cover2").val(); |
| | | $("#cover7").val(); |
| | | var ajax = new $ax(Feng.ctxPath + "/advertisement/updateConfig", function (data) { |
| | | Feng.success("基础页面设置成功") |
| | | }); |
| | | ajax.set("p1",$("#cover1").val()) |
| | | ajax.set("p2",$("#cover2").val()) |
| | | ajax.set("p7",$("#cover7").val()) |
| | | ajax.start(); |
| | | } |
| | | THomeModule.addBenefits = function(){ |
| | | $("#cover3").val(); |
| | | $("#cover4").val(); |
| | | $("#cover5").val(); |
| | | $("#cover6").val(); |
| | | var ajax = new $ax(Feng.ctxPath + "/advertisement/updateBenefits", function (data) { |
| | | Feng.success("基础页面设置成功") |
| | | }); |
| | | ajax.set("p3",$("#cover3").val()) |
| | | ajax.set("p4",$("#cover4").val()) |
| | | ajax.set("p5",$("#cover5").val()) |
| | | ajax.set("p6",$("#cover6").val()) |
| | | ajax.start(); |
| | | } |
| | | |
| | | THomeModule.updateSubmit = function(){ |
| | | |
| | | console.log("kankan") |
| | | console.log($("#backgroundImage").val()) |
| | | var data1 = { |
| | | id:null, |
| | | isOpen:null, |
| | | title:"", |
| | | isTop:null, |
| | | sort:null, |
| | | backgroundImage:"", |
| | | buttonImage:"", |
| | | model:null, |
| | | page:"", |
| | | jumpPage:null, |
| | | type:"", |
| | | typeId:null, |
| | | turnId:null, |
| | | content:"", |
| | | }; |
| | | let name = $("#model").val(); |
| | | data1.id = $("#id").val(); |
| | | if(document.querySelector('input[name="isOpen"]').checked){ |
| | | data1.isOpen = 1; |
| | | }else { |
| | | data1.isOpen = 0; |
| | | } |
| | | if(document.querySelector('input[name="isTop"]').checked){ |
| | | data1.isTop = 1; |
| | | }else { |
| | | data1.isTop = 0; |
| | | } |
| | | data1.title = $("#title").val(); |
| | | data1.sort = $("#sort").val(); |
| | | if($("#backgroundImage").val() == null || $("#backgroundImage").val() == ""){ |
| | | data1.backgroundImage = $("#backgroundImage1").val(); |
| | | }else { |
| | | data1.backgroundImage = $("#backgroundImage").val(); |
| | | } |
| | | if($("#buttonImage").val() == null || $("#buttonImage").val() == ""){ |
| | | data1.buttonImage = $("#buttonImage1").val(); |
| | | }else { |
| | | data1.buttonImage = $("#buttonImage").val(); |
| | | } |
| | | data1.model = $('#model option:selected').text(); |
| | | data1.page = $('#page option:selected').text(); |
| | | data1.jumpPage = $("#page").val(); |
| | | data1.type = $('#type option:selected').text(); |
| | | data1.typeId = $("#type").val(); |
| | | data1.turnId = $("#pageId").val(); |
| | | data1.content = jQuery.trim(THomeModuleDlg.editor.getContent()); |
| | | |
| | | if ( $("#roleType").val()==1){ |
| | | if($("#title").val()==''){ |
| | | data1.title = $("#title").val(); |
| | | Feng.info("请填写标题") |
| | | return; |
| | | } |
| | | } |
| | | |
| | | if ( $("#roleType").val()==1) { |
| | | if ($("#model").val() == '') { |
| | | Feng.info("请选择跳转模块") |
| | | return; |
| | | } |
| | | } |
| | | if(name !='0'){ |
| | | if($("#page").val()=='' ){ |
| | | Feng.info("请选择跳转页面") |
| | | return; |
| | | } |
| | | } |
| | | if(name !='0') { |
| | | if ($("#roleType").val() == 1) { |
| | | if ($("#type").val() == ''&&$("#page").val()!=2&&$("#page").val()!=25&&$("#page").val()!=27&&$("#page").val()!=37&&$("#page").val()!=28) { |
| | | Feng.info("请选择跳转类型") |
| | | return; |
| | | } |
| | | } |
| | | } |
| | | if(name !='0') { |
| | | if ($("#roleType").val() == 1) { |
| | | if ($('#type option:selected').text() == "详情"&&$('#type option:selected').text() == "指定商品"&&$('#type option:selected').text() == "指定折扣") { |
| | | if ($("#pageId").val() == '') { |
| | | Feng.info("请输入跳转ID") |
| | | return; |
| | | } |
| | | } |
| | | } |
| | | } |
| | | if ( $("#roleType").val()==1){ |
| | | if($("#content").val()==''){ |
| | | data1.content = $("#content").val(); |
| | | Feng.info("请填写内容设置") |
| | | return; |
| | | } |
| | | } |
| | | $.ajax({ |
| | | url: Feng.ctxPath + "/tHomeModule/updateHomeModule", |
| | | type: "POST", |
| | | contentType: "application/json", // 设置请求头的 Content-Type |
| | | data: JSON.stringify(data1), // 将数据转换为 JSON 字符串 |
| | | success: function(response) { |
| | | // window.parent.THomeModule.table.refresh(); |
| | | THomeModule.close(); |
| | | Feng.success("编辑成功!"); |
| | | }, |
| | | error: function(xhr, status, error) { |
| | | var errorMessage = xhr.responseText ? xhr.responseText : "下架失败!"; |
| | | Feng.error("您的网络异常!"); |
| | | } |
| | | }); |
| | | }; |
| | | |
| | | THomeModule.resetSearch = function () { |
| | | $("#advertisementName").val(""); |
| | | $("#cCode").val(""); |
| | | $("#page").val(""); |
| | | $("#state").val(""); |
| | | THomeModule.search(); |
| | | }; |
| | | |
| | | function UploadFileFn(){ |
| | | $('#upFile').click(); |
| | | } |
| | | |
| | | $(function () { |
| | | |
| | | }); |
New file |
| | |
| | | /** |
| | | * 初始化详情对话框 |
| | | */ |
| | | var THomeModuleDlg = { |
| | | tHomeModuleData : {} |
| | | }; |
| | | var language=$("#language").val(); |
| | | /** |
| | | * 清除数据 |
| | | */ |
| | | THomeModuleDlg.clearData = function() { |
| | | this.tHomeModuleData = {}; |
| | | } |
| | | |
| | | /** |
| | | * 设置对话框中的数据 |
| | | * |
| | | * @param key 数据的名称 |
| | | * @param val 数据的具体值 |
| | | */ |
| | | THomeModuleDlg.set = function(key, val) { |
| | | this.tHomeModuleData[key] = (typeof val == "undefined") ? $("#" + key).val() : val; |
| | | return this; |
| | | } |
| | | |
| | | /** |
| | | * 设置对话框中的数据 |
| | | * |
| | | * @param key 数据的名称 |
| | | * @param val 数据的具体值 |
| | | */ |
| | | THomeModuleDlg.get = function(key) { |
| | | return $("#" + key).val(); |
| | | } |
| | | |
| | | /** |
| | | * 关闭此对话框 |
| | | */ |
| | | THomeModuleDlg.close = function() { |
| | | parent.layer.close(window.parent.THomeModule.layerIndex); |
| | | } |
| | | |
| | | THomeModuleDlg.provinceChange = function () { |
| | | var provinceId = $("#cityId").val(); |
| | | var ajax = new $ax(Feng.ctxPath + "/THomeModule/change", function(data){ |
| | | if(data!=null){ |
| | | if(language==1){ |
| | | var content='<option value="">选择市</option>'; |
| | | }else if(language==2){ |
| | | var content='<option value="">Please select a city</option>'; |
| | | }else { |
| | | var content='<option value="">Pilih Kota</option>'; |
| | | } |
| | | $.each(data, function(k,v) { |
| | | content += "<option value='"+v.id+"'>"+v.chineseName+"</option>"; |
| | | }); |
| | | $("#cityId1").empty().append(content); |
| | | } |
| | | }); |
| | | ajax.set("id",provinceId); |
| | | ajax.start(); |
| | | } |
| | | /** |
| | | * 收集数据 |
| | | */ |
| | | THomeModuleDlg.collectData = function() { |
| | | this |
| | | .set('id') |
| | | .set('isOpen') |
| | | .set('title') |
| | | .set('isTop') |
| | | .set('sort') |
| | | .set('backgroundImage') |
| | | .set('buttonImage') |
| | | .set('model') |
| | | .set('page') |
| | | .set('jumpPage') |
| | | .set('type') |
| | | .set('typeId') |
| | | .set('turnId') |
| | | .set('content'); |
| | | } |
| | | |
| | | THomeModuleDlg.updateSubmit = function(){ |
| | | |
| | | console.log("kankan") |
| | | console.log($("#backgroundImage").val()) |
| | | var data1 = { |
| | | id:null, |
| | | isOpen:null, |
| | | title:"", |
| | | isTop:null, |
| | | sort:null, |
| | | backgroundImage:"", |
| | | buttonImage:"", |
| | | model:null, |
| | | page:"", |
| | | jumpPage:null, |
| | | type:"", |
| | | typeId:null, |
| | | turnId:null, |
| | | content:"", |
| | | }; |
| | | let name = $("#model").val(); |
| | | data1.id = $("#id").val(); |
| | | if(document.querySelector('input[name="isOpen"]').checked){ |
| | | data1.isOpen = 1; |
| | | }else { |
| | | data1.isOpen = 0; |
| | | } |
| | | if(document.querySelector('input[name="isTop"]').checked){ |
| | | data1.isTop = 1; |
| | | }else { |
| | | data1.isTop = 0; |
| | | } |
| | | data1.title = $("#title").val(); |
| | | data1.sort = $("#sort").val(); |
| | | data1.backgroundImage = $("#backgroundImage").val(); |
| | | data1.buttonImage = $("#buttonImage").val(); |
| | | data1.model = $('#model option:selected').text(); |
| | | data1.page = $('#page option:selected').text(); |
| | | data1.jumpPage = $("#page").val(); |
| | | data1.type = $('#type option:selected').text(); |
| | | data1.typeId = $("#type").val(); |
| | | data1.turnId = $("#pageId").val(); |
| | | data1.content = jQuery.trim(THomeModuleDlg.editor.getContent()); |
| | | |
| | | if ( $("#roleType").val()==1){ |
| | | if($("#title").val()==''){ |
| | | data1.title = $("#title").val(); |
| | | Feng.info("请填写标题") |
| | | return; |
| | | } |
| | | } |
| | | |
| | | if ( $("#roleType").val()==1) { |
| | | if ($("#model").val() == '') { |
| | | Feng.info("请选择跳转模块") |
| | | return; |
| | | } |
| | | } |
| | | if(name !='0'){ |
| | | if($("#page").val()=='' ){ |
| | | Feng.info("请选择跳转页面") |
| | | return; |
| | | } |
| | | } |
| | | if(name !='0') { |
| | | if ($("#roleType").val() == 1) { |
| | | if ($("#type").val() == ''&&$("#page").val()!=2&&$("#page").val()!=25&&$("#page").val()!=27&&$("#page").val()!=37&&$("#page").val()!=28) { |
| | | Feng.info("请选择跳转类型") |
| | | return; |
| | | } |
| | | } |
| | | } |
| | | if(name !='0') { |
| | | if ($("#roleType").val() == 1) { |
| | | if ($('#type option:selected').text() == "详情"&&$('#type option:selected').text() == "指定商品"&&$('#type option:selected').text() == "指定折扣") { |
| | | if ($("#pageId").val() == '') { |
| | | Feng.info("请输入跳转ID") |
| | | return; |
| | | } |
| | | } |
| | | } |
| | | } |
| | | if ( $("#roleType").val()==1){ |
| | | if($("#content").val()==''){ |
| | | data1.content = $("#content").val(); |
| | | Feng.info("请填写内容设置") |
| | | return; |
| | | } |
| | | } |
| | | $.ajax({ |
| | | url: Feng.ctxPath + "/tHomeModule/updateHomeModule", |
| | | type: "POST", |
| | | contentType: "application/json", // 设置请求头的 Content-Type |
| | | data: JSON.stringify(data1), // 将数据转换为 JSON 字符串 |
| | | success: function(response) { |
| | | // window.parent.THomeModule.table.refresh(); |
| | | THomeModuleDlg.close(); |
| | | Feng.success("编辑成功!"); |
| | | }, |
| | | error: function(xhr, status, error) { |
| | | var errorMessage = xhr.responseText ? xhr.responseText : "下架失败!"; |
| | | Feng.error("您的网络异常!"); |
| | | } |
| | | }); |
| | | }; |
| | | |
| | | $(function() { |
| | | THomeModuleDlg.editor = UE.getEditor('editor'); |
| | | var backgroundImage = new $WebUpload("backgroundImage"); |
| | | backgroundImage.setUploadBarId("progressBar"); |
| | | backgroundImage.init(); |
| | | var buttonImage = new $WebUpload("buttonImage"); |
| | | buttonImage.setUploadBarId("progressBar"); |
| | | buttonImage.init(); |
| | | }); |
| | |
| | | } |
| | | }; |
| | | |
| | | TCompetition.platformSet = function () { |
| | | var index = layer.open({ |
| | | type: 2, |
| | | title:'平台首页设置', |
| | | area: ['100%', '100%'], //宽高 |
| | | fix: false, //不固定 |
| | | maxmin: true, |
| | | content: Feng.ctxPath + '/tHomeModule/tHomeModule_platformSet/' + 1 |
| | | }); |
| | | this.layerIndex = index; |
| | | }; |
| | | |
| | | /** |
| | | * 删除车辆管理 |
| | | */ |
| | |
| | | var px6 = $("#px6").val() |
| | | var px7 = $("#px7").val() |
| | | var px8 = $("#px8").val() |
| | | var px9 = $("#px9").val() |
| | | var c1 = $("#c1").val() |
| | | var c2 = $("#c2").val() |
| | | var c3 = $("#c3").val() |
| | |
| | | var c6 = $("#c6").val() |
| | | var c7 = $("#7").val() |
| | | var c8 = $("#c8").val() |
| | | var c9 = $("#c9").val() |
| | | var r1 = document.querySelector('input[name="r1"]').checked; |
| | | var r2 = document.querySelector('input[name="r2"]').checked; |
| | | var r3 = document.querySelector('input[name="r3"]').checked; |
| | |
| | | var r6 = document.querySelector('input[name="r6"]').checked; |
| | | var r7 = document.querySelector('input[name="r7"]').checked; |
| | | var r8 = document.querySelector('input[name="r8"]').checked; |
| | | var r9 = document.querySelector('input[name="r9"]').checked; |
| | | if(r1){ |
| | | r1 =1 |
| | | }else{ |
| | |
| | | }else{ |
| | | r8=0 |
| | | } |
| | | if(r9){ |
| | | r9 =1 |
| | | }else{ |
| | | r9=0 |
| | | } |
| | | |
| | | var ajax = new $ax(Feng.ctxPath + "/tShop/saveImgAll", function(data){ |
| | | if(data.code == 200){ |
| | |
| | | ajax.set("px6",px6); |
| | | ajax.set("px7",px7); |
| | | ajax.set("px8",px8); |
| | | ajax.set("px9",px9); |
| | | ajax.set("c1",c1); |
| | | ajax.set("c2",c2); |
| | | ajax.set("c3",c3); |
| | |
| | | ajax.set("c6",c6); |
| | | ajax.set("c7",c7); |
| | | ajax.set("c8",c8); |
| | | ajax.set("c9",c9); |
| | | ajax.set("r1",r1); |
| | | ajax.set("r2",r2); |
| | | ajax.set("r3",r3); |
| | |
| | | ajax.set("r6",r6); |
| | | ajax.set("r7",r7); |
| | | ajax.set("r8",r8); |
| | | ajax.set("r9",r9); |
| | | ajax.start(); |
| | | } |
| | | |
| | |
| | | }; |
| | | TSite.oneChangeYys = function(e){ |
| | | |
| | | var oneId; |
| | | var oneId = $(e).val(); |
| | | |
| | | var checkbox = document.querySelector('input[name="pt"]'); |
| | | if (checkbox.checked) { |
| | | oneId=0; |
| | | console.log("选中是平台"); |
| | | } else { |
| | | oneId = $("#yys").val(); |
| | | console.log("运营商"); |
| | | console.log(oneId) |
| | | |
| | | } |
| | | var ajax = new $ax(Feng.ctxPath + "/tSite/getChangeOne", function(data){ |
| | | if(data!=null){ |
| | | // var content1 = '<option value="0">平台</option>'; |
| | | console.log("看看oneId") |
| | | console.log(oneId) |
| | | if (oneId == 0) { |
| | | console.log("锁住") |
| | | $("#yys").prop('disabled', true); |
| | |
| | | halfName:"", |
| | | introduce:"", |
| | | imgs:"", |
| | | introduce:"", |
| | | ids:"" |
| | | reservation:"", |
| | | |
| | | }; |
| | | data.province = $("#pCode").val() |
| | | data.city = $("#cCode").val() |
| | |
| | | |
| | | |
| | | console.log(data.typeName) |
| | | |
| | | var reservation= $("input[name='reservation']:checked").val(); |
| | | data.reservation= reservation; |
| | | console.log("看看是否可预约值") |
| | | console.log(reservation); |
| | | if (reservation==1){ |
| | | |
| | | |
| | | if (data.typeName === "智慧场地"){ |
| | |
| | | return; |
| | | |
| | | } |
| | | |
| | | |
| | | |
| | | } |
| | | |
| | | } |
| | | var SelectValue=""; |
| | | var getSelectValueMenbers = $("input[name='pt']:checked").each(function(j) { |
| | | if (j >= 0) { |
| | |
| | | } |
| | | } |
| | | data.nextName= nextName; |
| | | |
| | | |
| | | var ishalf= $("input[name='ishalf']:checked").val(); |
| | | data.ishalf= ishalf; |
| | | |
| | | var halfName=""; |
| | | if(ishalf==1){ |
| | | let cashPriceOne = $("#cashPriceOne").val() |
| | | if(cashPriceOne=='' ){ |
| | | Feng.info("请填写现金价格") |
| | | return; |
| | | } |
| | | data.cashPriceOne= cashPriceOne; |
| | | |
| | | let playPaiCoinOne = $("#playPaiCoinOne").val() |
| | | if(playPaiCoinOne=='' ){ |
| | | Feng.info("请填写玩湃币价格") |
| | | return; |
| | | } |
| | | |
| | | data.playPaiCoinOne= playPaiCoinOne; |
| | | let num2 = $('input[name="name2"]'); |
| | | for (let i = 0; i < num2.length; i++) { |
| | | if($(num2[i]).val()==''){ |
| | | Feng.info("请填写半场名称") |
| | | if (reservation==1) { |
| | | if (ishalf == 1) { |
| | | let cashPriceOne = $("#cashPriceOne").val() |
| | | if (cashPriceOne == '') { |
| | | Feng.info("请填写现金价格") |
| | | return; |
| | | } |
| | | if(i==num2.length-1){ |
| | | halfName += $(num2[i]).val() |
| | | }else { |
| | | halfName += $(num2[i]).val()+"," |
| | | data.cashPriceOne = cashPriceOne; |
| | | |
| | | let playPaiCoinOne = $("#playPaiCoinOne").val() |
| | | if (playPaiCoinOne == '') { |
| | | Feng.info("请填写玩湃币价格") |
| | | return; |
| | | } |
| | | |
| | | data.playPaiCoinOne = playPaiCoinOne; |
| | | let num2 = $('input[name="name2"]'); |
| | | for (let i = 0; i < num2.length; i++) { |
| | | if ($(num2[i]).val() == '') { |
| | | Feng.info("请填写半场名称") |
| | | return; |
| | | } |
| | | if (i == num2.length - 1) { |
| | | halfName += $(num2[i]).val() |
| | | } else { |
| | | halfName += $(num2[i]).val() + "," |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | |
| | | data.halfName= halfName; |
| | | data.ids= $("#ids").val(); |
| | | |
| | | let introduce ; |
| | | if (objectType==1){ |
| | | introduce = TSite.editor.getContent(); |
| | |
| | | Feng.info("请输入场地名称") |
| | | return; |
| | | } |
| | | |
| | | if (reservation==1){ |
| | | if($("#start-time").val()=='' ){ |
| | | Feng.info("请输入可预约时间段 开始时间") |
| | | return; |
| | |
| | | if($("#playPaiCoin").val()==''){ |
| | | Feng.info("请输入玩湃币价格") |
| | | return; |
| | | } |
| | | } |
| | | if($("#insuranceEndTime").val()==''){ |
| | | Feng.info("请输入场地责任险有效期") |
| | |
| | | type: "GET", |
| | | contentType: "application/json", // 设置请求头的 Content-Type |
| | | success: function (response) { |
| | | rStime = response.startTime; |
| | | sh = rStime.split(':')[0];// 门店经营开始时间:小时 |
| | | sm = rStime.split(':')[1];// 门店经营开始时间:分钟 |
| | | if (reservation==1) { |
| | | rStime = response.startTime; |
| | | sh = rStime.split(':')[0];// 门店经营开始时间:小时 |
| | | sm = rStime.split(':')[1];// 门店经营开始时间:分钟 |
| | | |
| | | rEtime = response.endTime; |
| | | eh = rEtime.split(':')[0];// 门店经营结束时间:小时 |
| | | em = rEtime.split(':')[1];// 门店经营结束时间:分钟 |
| | | rEtime = response.endTime; |
| | | eh = rEtime.split(':')[0];// 门店经营结束时间:小时 |
| | | em = rEtime.split(':')[1];// 门店经营结束时间:分钟 |
| | | |
| | | var start = sTime.value; |
| | | var startHour = start.split(':')[0]; // 输入的可预约开始时间:小时 |
| | | var startMinute = start.split(':')[1];// 输入的可预约开始时间:分钟 |
| | | if (Number(sh)>Number(startHour)){ |
| | | Feng.error("预约的开始时间不应小于营业开始时间!") |
| | | return false; |
| | | }else if(Number(sh) === Number(startHour) ){ |
| | | if (Number(sm)>Number(startMinute)){ |
| | | Feng.error("预约的开始时间不应大于营业开始时间!") |
| | | var start = sTime.value; |
| | | var startHour = start.split(':')[0]; // 输入的可预约开始时间:小时 |
| | | var startMinute = start.split(':')[1];// 输入的可预约开始时间:分钟 |
| | | if (Number(sh) > Number(startHour)) { |
| | | Feng.error("预约的开始时间不应小于营业开始时间!") |
| | | return false; |
| | | } else if (Number(sh) === Number(startHour)) { |
| | | if (Number(sm) > Number(startMinute)) { |
| | | Feng.error("预约的开始时间不应大于营业开始时间!") |
| | | return false; |
| | | } |
| | | } else if (Number(eh) < Number(startHour)) { |
| | | Feng.error("预约的开始时间不应大于营业结束时间!") |
| | | return false; |
| | | } else if (Number(eh) === Number(startHour)) { |
| | | Feng.error("预约的开始时间不应大于等于营业结束时间!") |
| | | return false; |
| | | } |
| | | }else if (Number(eh)<Number(startHour)){ |
| | | Feng.error("预约的开始时间不应大于营业结束时间!") |
| | | return false; |
| | | }else if(Number(eh)===Number(startHour)){ |
| | | Feng.error("预约的开始时间不应大于等于营业结束时间!") |
| | | return false; |
| | | } |
| | | var end = eTime.value; |
| | | var endHour = end.split(':')[0]; // 输入的可预约结束时间:小时 |
| | | var endMinute = end.split(':')[1];// 输入的可预约结束时间:分钟 |
| | | if (Number(eh)<Number(endHour)){ |
| | | Feng.error("预约的结束时间不应大于营业结束时间!") |
| | | return ; |
| | | }else if(Number(eh) === Number(endHour) ){ |
| | | if (Number(em)<Number(endMinute)){ |
| | | Feng.error("预约的开始时间不应大于开始营业时间!") |
| | | return ; |
| | | } |
| | | }else if(Number(sh)>Number(endHour)){ |
| | | Feng.error("预约的结束时间不应小于营业开始时间!") |
| | | return ; |
| | | } |
| | | if (Number(endHour)===Number(sh)){ |
| | | if(Number(endMinute) < Number(sm)){ |
| | | Feng.error("预约结束时间不应小于营业开始时间"); |
| | | var end = eTime.value; |
| | | var endHour = end.split(':')[0]; // 输入的可预约结束时间:小时 |
| | | var endMinute = end.split(':')[1];// 输入的可预约结束时间:分钟 |
| | | if (Number(eh) < Number(endHour)) { |
| | | Feng.error("预约的结束时间不应大于营业结束时间!") |
| | | return; |
| | | } else if (Number(eh) === Number(endHour)) { |
| | | if (Number(em) < Number(endMinute)) { |
| | | Feng.error("预约的开始时间不应大于开始营业时间!") |
| | | return; |
| | | } |
| | | } else if (Number(sh) > Number(endHour)) { |
| | | Feng.error("预约的结束时间不应小于营业开始时间!") |
| | | return; |
| | | } |
| | | } |
| | | if (Number(startHour)===Number(endHour) && Number(startMinute)===Number(endMinute)){ |
| | | Feng.error("至少预约半个小时"); |
| | | return; |
| | | if (Number(endHour) === Number(sh)) { |
| | | if (Number(endMinute) < Number(sm)) { |
| | | Feng.error("预约结束时间不应小于营业开始时间"); |
| | | return; |
| | | } |
| | | } |
| | | if (Number(startHour) === Number(endHour) && Number(startMinute) === Number(endMinute)) { |
| | | Feng.error("至少预约半个小时"); |
| | | return; |
| | | } |
| | | } |
| | | $.ajax({ |
| | | url: Feng.ctxPath + "/tSite/addSite" , |
| | |
| | | halfName:"", |
| | | introduce:"", |
| | | imgs:"", |
| | | ids:"" |
| | | reservation:"", |
| | | }; |
| | | data.province = $("#pCode").val() |
| | | data.id = $("#id").val() |
| | |
| | | |
| | | var ishalf= $("input[name='ishalf']:checked").val(); |
| | | data.ishalf= ishalf; |
| | | var reservation= $("input[name='reservation']:checked").val(); |
| | | data.reservation= reservation; |
| | | var halfName=""; |
| | | if (reservation==1){ |
| | | |
| | | |
| | | if(ishalf==1){ |
| | | let cashPriceOne = $("#cashPriceOne").val() |
| | | if(cashPriceOne=='' ){ |
| | |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | var objectType =$("#objectType").val() |
| | | data.halfName= halfName; |
| | | data.ids= $("#ids").val(); |
| | | if (objectType==1){ |
| | | introduce = TSiteInfo.editor.getContent(); |
| | | } |
| | |
| | | Feng.info("请输入场地名称") |
| | | return; |
| | | } |
| | | if($("#start-time").val()=='' ){ |
| | | Feng.info("请输入可预约时间段 开始时间") |
| | | return; |
| | | } |
| | | if($("#end-time").val()==''){ |
| | | Feng.info("请输入可预约时间段 结束时间") |
| | | return; |
| | | } |
| | | if($("#cashPrice").val()==''){ |
| | | Feng.info("请输入现金价格") |
| | | return; |
| | | } |
| | | if($("#playPaiCoin").val()==''){ |
| | | Feng.info("请输入玩湃币价格") |
| | | return; |
| | | if (reservation==1) { |
| | | if ($("#start-time").val() == '') { |
| | | Feng.info("请输入可预约时间段 开始时间") |
| | | return; |
| | | } |
| | | if ($("#end-time").val() == '') { |
| | | Feng.info("请输入可预约时间段 结束时间") |
| | | return; |
| | | } |
| | | if ($("#cashPrice").val() == '') { |
| | | Feng.info("请输入现金价格") |
| | | return; |
| | | } |
| | | if ($("#playPaiCoin").val() == '') { |
| | | Feng.info("请输入玩湃币价格") |
| | | return; |
| | | } |
| | | } |
| | | if($("#insuranceEndTime").val()==''){ |
| | | Feng.info("请输入场地责任险有效期") |
| | |
| | | Feng.info("请上传消防及应急管理方案") |
| | | return; |
| | | } |
| | | |
| | | var sTime = document.getElementById("start-time"); //获取输入的开始时间 |
| | | var eTime = document.getElementById("end-time"); // 获取输入的结束时间 |
| | | var rStime = ""; //门店的经营开始时间 |
| | |
| | | type: "GET", |
| | | contentType: "application/json", // 设置请求头的 Content-Type |
| | | success: function (response) { |
| | | rStime = response.startTime; |
| | | sh = rStime.split(':')[0];// 门店经营开始时间:小时 |
| | | sm = rStime.split(':')[1];// 门店经营开始时间:分钟 |
| | | if (reservation==1) { |
| | | rStime = response.startTime; |
| | | sh = rStime.split(':')[0];// 门店经营开始时间:小时 |
| | | sm = rStime.split(':')[1];// 门店经营开始时间:分钟 |
| | | |
| | | rEtime = response.endTime; |
| | | eh = rEtime.split(':')[0];// 门店经营结束时间:小时 |
| | | em = rEtime.split(':')[1];// 门店经营结束时间:分钟 |
| | | rEtime = response.endTime; |
| | | eh = rEtime.split(':')[0];// 门店经营结束时间:小时 |
| | | em = rEtime.split(':')[1];// 门店经营结束时间:分钟 |
| | | |
| | | var start = sTime.value; |
| | | var startHour = start.split(':')[0]; // 输入的可预约开始时间:小时 |
| | | var startMinute = start.split(':')[1];// 输入的可预约开始时间:分钟 |
| | | if (Number(sh)>Number(startHour)){ |
| | | Feng.error("预约的开始时间不应小于营业开始时间!") |
| | | return false; |
| | | }else if(Number(sh) === Number(startHour) ){ |
| | | if (Number(sm)>Number(startMinute)){ |
| | | Feng.error("预约的开始时间不应大于营业开始时间!") |
| | | var start = sTime.value; |
| | | var startHour = start.split(':')[0]; // 输入的可预约开始时间:小时 |
| | | var startMinute = start.split(':')[1];// 输入的可预约开始时间:分钟 |
| | | if (Number(sh) > Number(startHour)) { |
| | | Feng.error("预约的开始时间不应小于营业开始时间!") |
| | | return false; |
| | | } else if (Number(sh) === Number(startHour)) { |
| | | if (Number(sm) > Number(startMinute)) { |
| | | Feng.error("预约的开始时间不应大于营业开始时间!") |
| | | return false; |
| | | } |
| | | } else if (Number(eh) < Number(startHour)) { |
| | | Feng.error("预约的开始时间不应大于营业结束时间!") |
| | | return false; |
| | | } else if (Number(eh) === Number(startHour)) { |
| | | Feng.error("预约的开始时间不应大于等于营业结束时间!") |
| | | return false; |
| | | } |
| | | }else if (Number(eh)<Number(startHour)){ |
| | | Feng.error("预约的开始时间不应大于营业结束时间!") |
| | | return false; |
| | | }else if(Number(eh)===Number(startHour)){ |
| | | Feng.error("预约的开始时间不应大于等于营业结束时间!") |
| | | return false; |
| | | } |
| | | var end = eTime.value; |
| | | var endHour = end.split(':')[0]; // 输入的可预约结束时间:小时 |
| | | var endMinute = end.split(':')[1];// 输入的可预约结束时间:分钟 |
| | | if (Number(eh)<Number(endHour)){ |
| | | Feng.error("预约的结束时间不应大于营业结束时间!") |
| | | return ; |
| | | }else if(Number(eh) === Number(endHour) ){ |
| | | if (Number(em)<Number(endMinute)){ |
| | | Feng.error("预约的开始时间不应大于开始营业时间!") |
| | | return ; |
| | | } |
| | | }else if(Number(sh)>Number(endHour)){ |
| | | Feng.error("预约的结束时间不应小于营业开始时间!") |
| | | return ; |
| | | } |
| | | if (Number(endHour)===Number(sh)){ |
| | | if(Number(endMinute) < Number(sm)){ |
| | | Feng.error("预约结束时间不应小于营业开始时间"); |
| | | var end = eTime.value; |
| | | var endHour = end.split(':')[0]; // 输入的可预约结束时间:小时 |
| | | var endMinute = end.split(':')[1];// 输入的可预约结束时间:分钟 |
| | | if (Number(eh) < Number(endHour)) { |
| | | Feng.error("预约的结束时间不应大于营业结束时间!") |
| | | return; |
| | | } else if (Number(eh) === Number(endHour)) { |
| | | if (Number(em) < Number(endMinute)) { |
| | | Feng.error("预约的开始时间不应大于开始营业时间!") |
| | | return; |
| | | } |
| | | } else if (Number(sh) > Number(endHour)) { |
| | | Feng.error("预约的结束时间不应小于营业开始时间!") |
| | | return; |
| | | } |
| | | } |
| | | if (Number(startHour)===Number(endHour) && Number(startMinute)===Number(endMinute)){ |
| | | Feng.error("至少预约半个小时"); |
| | | return; |
| | | if (Number(endHour) === Number(sh)) { |
| | | if (Number(endMinute) < Number(sm)) { |
| | | Feng.error("预约结束时间不应小于营业开始时间"); |
| | | return; |
| | | } |
| | | } |
| | | if (Number(startHour) === Number(endHour) && Number(startMinute) === Number(endMinute)) { |
| | | Feng.error("至少预约半个小时"); |
| | | return; |
| | | } |
| | | } |
| | | $.ajax({ |
| | | url: Feng.ctxPath + "/tSite/updateSite" , |
| | |
| | | }, |
| | | {title: '兑换地点', field: 'useScope', visible: true, align: 'center', valign: 'middle', |
| | | formatter: function (value, row, index) { |
| | | return {1: "全国", 2: "指定城市", 3: "指定门店"}[value] |
| | | return {1: "全国", 2: "指定城市", 3: "指定门店",4:"指定场地"}[value] |
| | | } |
| | | }, |
| | | {title: '用户人群', field: 'userPopulation', visible: true, align: 'center', valign: 'middle', |
New file |
| | |
| | | /** |
| | | * 跨城站点管理管理初始化 |
| | | */ |
| | | var RegisteredPersonnel = { |
| | | id: "RegisteredPersonnelTable", //表格id |
| | | seItem: null, //选中的条目 |
| | | table: null, |
| | | layerIndex: -1, |
| | | }; |
| | | /** |
| | | * 初始化表格的列 |
| | | */ |
| | | RegisteredPersonnel.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: 'gender', visible: true, align: 'center', valign: 'middle',}, |
| | | {title: '年龄', field: 'age', visible: true, align: 'center', valign: 'middle'}, |
| | | {title: '联系电话', field: 'phone', visible: true, align: 'center', valign: 'middle'}, |
| | | {title: '身份证号', field: 'idcard', visible: true, align: 'center', valign: 'middle'}, |
| | | {title: '二维码', field: '', visible: true, align: 'center', valign: 'middle', |
| | | formatter:function (data, item) { |
| | | return '<a href="#" onclick="RegisteredPersonnel.openQRCode(' + item.id + ', ' + item.isStudent + ',\'' + item.name + '\')">二维码</a>' |
| | | } |
| | | }, |
| | | {title: '状态', field: 'state', visible: true, align: 'center', valign: 'middle', |
| | | formatter:function (data) { |
| | | return {1:"正常",2:"已取消"}[data] |
| | | } |
| | | }, |
| | | ]; |
| | | }; |
| | | |
| | | /** |
| | | * 检查是否选中 |
| | | */ |
| | | RegisteredPersonnel.check = function () { |
| | | var selected = $('#' + this.id).bootstrapTable('getSelections'); |
| | | if(selected.length == 0){ |
| | | Feng.info("请先选中表格中的某一记录!"); |
| | | return false; |
| | | }else{ |
| | | RegisteredPersonnel.seItem = selected[0]; |
| | | return true; |
| | | } |
| | | }; |
| | | /** |
| | | * 商户号认证 |
| | | */ |
| | | RegisteredPersonnel.exportQRCode = function () { |
| | | let id = $("#id").val(); |
| | | let name = $("#name").val(); |
| | | let phone =$("#phone").val(); |
| | | let idcode =$("#idcode").val(); |
| | | let status =$("#status").val(); |
| | | window.location.href = Feng.ctxPath + "/worldCup/downloadQRCodeZip?id=" + id + "&name=" + name + "&phone=" + phone + "&idcode=" + idcode + "&status=" + status; |
| | | }; |
| | | /** |
| | | * 编辑 |
| | | */ |
| | | RegisteredPersonnel.exportPersonnel = function () { |
| | | let id = $("#id").val(); |
| | | let name = $("#name").val(); |
| | | let phone =$("#phone").val(); |
| | | let idcode =$("#idcode").val(); |
| | | let status =$("#status").val(); |
| | | window.location.href = Feng.ctxPath + "/worldCup/exportPersonnel?id=" + id + "&name=" + name + "&phone=" + phone + "&idcode=" + idcode + "&status=" + status; |
| | | }; |
| | | |
| | | RegisteredPersonnel.openQRCode = function (id, isStudent, name){ |
| | | let code = "{\"id\":" + id + ",\"isStudent\":" + isStudent + "}"; |
| | | const str = '<div class="row">\n' + |
| | | ' <div class="form-group" style="height: 50px;">\n' + |
| | | ' <div class="col-sm-8">\n' + |
| | | ' <div id="qrcode"></div>\n' + |
| | | ' </div>\n' + |
| | | ' </div>\n' + |
| | | ' </div>' |
| | | layer.open({ |
| | | type: 1 |
| | | ,title: name |
| | | ,area: ['303px', '343px'] |
| | | ,offset: 'auto' //具体配置参考:http://www.layui.com/doc/modules/layer.html#offset |
| | | ,id: 'layerDemo' //防止重复弹出 |
| | | ,content: '<div style="padding: 20px">' + str + '</div>' |
| | | ,btnAlign: 'c' //按钮居中 |
| | | ,shade: 0.5 //不显示遮罩 |
| | | }); |
| | | jQuery('#qrcode').qrcode({ |
| | | text: code |
| | | }); |
| | | } |
| | | |
| | | |
| | | |
| | | RegisteredPersonnel.search = function () { |
| | | var queryData = {}; |
| | | queryData['id'] = $("#id").val(); |
| | | queryData['name'] = $("#name").val(); |
| | | queryData['phone'] =$("#phone").val(); |
| | | queryData['idcode'] =$("#idcode").val(); |
| | | queryData['status'] =$("#status").val(); |
| | | RegisteredPersonnel.table.refresh({query: queryData}); |
| | | }; |
| | | |
| | | RegisteredPersonnel.resetSearch = function () { |
| | | $("#name").val(""); |
| | | $("#phone").val(""); |
| | | $("#idcode").val(""); |
| | | $("#status").val(""); |
| | | RegisteredPersonnel.search(); |
| | | }; |
| | | |
| | | $(function () { |
| | | var defaultColunms = RegisteredPersonnel.initColumn(); |
| | | var table = new BSTable(RegisteredPersonnel.id, "/worldCup/registeredPersonnel", defaultColunms); |
| | | table.setPaginationType("server"); |
| | | let id = $('#id').val(); |
| | | table.setQueryParams({ |
| | | 'id': id |
| | | }) |
| | | RegisteredPersonnel.table = table.init(); |
| | | |
| | | }); |
| | |
| | | }; |
| | | |
| | | |
| | | /** |
| | | * 删除 |
| | | */ |
| | | 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); |
| | | var index = layer.open({ |
| | | type: 2, |
| | | title: '已报名人员', |
| | | area: ['100%', '100%'], //宽高 |
| | | fix: false, //不固定 |
| | | maxmin: true, |
| | | content: Feng.ctxPath + '/worldCup/openRegisteredPersonnel?id=' + WorldCup.seItem.id |
| | | }); |
| | | this.layerIndex = index; |
| | | } |
| | | }; |
| | | |
New file |
| | |
| | | /** |
| | | * 跨城站点管理管理初始化 |
| | | */ |
| | | var WorldCupRecords = { |
| | | id: "WorldCupRecordsTable", //表格id |
| | | seItem: null, //选中的条目 |
| | | table1: null, |
| | | table2: null, |
| | | table3: null, |
| | | layerIndex: -1, |
| | | }; |
| | | |
| | | |
| | | |
| | | /** |
| | | * 检查是否选中 |
| | | */ |
| | | WorldCupRecords.check = function () { |
| | | var selected = $('#' + this.id).bootstrapTable('getSelections'); |
| | | if(selected.length == 0){ |
| | | Feng.info("请先选中表格中的某一记录!"); |
| | | return false; |
| | | }else{ |
| | | WorldCupRecords.seItem = selected[0]; |
| | | return true; |
| | | } |
| | | }; |
| | | /** |
| | | * 商户号认证 |
| | | */ |
| | | WorldCupRecords.openAddWorldCupRecords = function () { |
| | | var index = layer.open({ |
| | | type: 2, |
| | | title: '添加比赛', |
| | | area: ['100%', '100%'], //宽高 |
| | | fix: false, //不固定 |
| | | maxmin: true, |
| | | content: Feng.ctxPath + '/WorldCupRecords/openAddWorldCupRecords' |
| | | }); |
| | | this.layerIndex = index; |
| | | }; |
| | | /** |
| | | * 编辑 |
| | | */ |
| | | WorldCupRecords.openEditWorldCupRecords = function () { |
| | | if(this.check()){ |
| | | var index = layer.open({ |
| | | type: 2, |
| | | title: '编辑比赛', |
| | | area: ['100%', '100%'], //宽高 |
| | | fix: false, //不固定 |
| | | maxmin: true, |
| | | content: Feng.ctxPath + '/WorldCupRecords/openEditWorldCupRecords?id=' + WorldCupRecords.seItem.id |
| | | }); |
| | | this.layerIndex = index; |
| | | } |
| | | }; |
| | | |
| | | |
| | | WorldCupRecords.openWorldCupRecordsInfo = function () { |
| | | if(this.check()){ |
| | | var index = layer.open({ |
| | | type: 2, |
| | | title: '比赛详情', |
| | | area: ['100%', '100%'], //宽高 |
| | | fix: false, //不固定 |
| | | maxmin: true, |
| | | content: Feng.ctxPath + '/WorldCupRecords/openInfoWorldCupRecords?id=' + WorldCupRecords.seItem.id |
| | | }); |
| | | this.layerIndex = index; |
| | | } |
| | | }; |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | /** |
| | | * 下架 |
| | | */ |
| | | WorldCupRecords.registeredPersonnel = function () { |
| | | if(this.check()){ |
| | | var index = layer.open({ |
| | | type: 2, |
| | | title: '已报名人员', |
| | | area: ['100%', '100%'], //宽高 |
| | | fix: false, //不固定 |
| | | maxmin: true, |
| | | content: Feng.ctxPath + '/WorldCupRecords/openRegisteredPersonnel?id=' + WorldCupRecords.seItem.id |
| | | }); |
| | | this.layerIndex = index; |
| | | } |
| | | }; |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | /** |
| | | * 关闭此对话框 |
| | | */ |
| | | WorldCupRecords.close = function() { |
| | | parent.layer.close(window.parent.WorldCupRecords.layerIndex); |
| | | }; |
| | | |
| | | |
| | | WorldCupRecords.search1 = function () { |
| | | var queryData = {}; |
| | | queryData['province'] = $("#province").val(); |
| | | queryData['city'] =$("#city").val(); |
| | | WorldCupRecords.table1.refresh({query: queryData}); |
| | | }; |
| | | |
| | | WorldCupRecords.resetSearch1 = function () { |
| | | $("#province").val(""); |
| | | $("#city").val(""); |
| | | WorldCupRecords.search1(); |
| | | }; |
| | | |
| | | WorldCupRecords.search2 = function () { |
| | | var queryData = {}; |
| | | queryData['province'] = $("#province").val(); |
| | | queryData['city'] =$("#city").val(); |
| | | WorldCupRecords.table2.refresh({query: queryData}); |
| | | }; |
| | | |
| | | WorldCupRecords.resetSearch2 = function () { |
| | | $("#province").val(""); |
| | | $("#city").val(""); |
| | | WorldCupRecords.search2(); |
| | | }; |
| | | |
| | | WorldCupRecords.search3 = function () { |
| | | var queryData = {}; |
| | | queryData['province'] = $("#province").val(); |
| | | queryData['city'] =$("#city").val(); |
| | | WorldCupRecords.table3.refresh({query: queryData}); |
| | | }; |
| | | |
| | | WorldCupRecords.resetSearch3 = function () { |
| | | $("#province").val(""); |
| | | $("#city").val(""); |
| | | WorldCupRecords.search3(); |
| | | }; |
| | | |
| | | $(function () { |
| | | var defaultColunms1 = [ |
| | | {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'}, |
| | | {title: '已比赛场次', field: 'maxPeople', visible: true, align: 'center', valign: 'middle'}, |
| | | {title: '胜-负场次', field: 'maxPeople', visible: true, align: 'center', valign: 'middle'}, |
| | | {title: '胜率', field: 'status', visible: true, align: 'center', valign: 'middle', |
| | | formatter:function (data) { |
| | | return data + '%'; |
| | | } |
| | | }, |
| | | ]; |
| | | var table1 = new BSTable("WorldCupRecordsTable1", "/worldCupRecords/worldCupRecordsList", defaultColunms1); |
| | | table1.setPaginationType("server"); |
| | | WorldCupRecords.table1 = table1.init(); |
| | | |
| | | var defaultColunms2 = [ |
| | | {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'}, |
| | | {title: '已比赛场次', field: 'maxPeople', visible: true, align: 'center', valign: 'middle'}, |
| | | ]; |
| | | var table2 = new BSTable("WorldCupRecordsTable2", "/worldCupRecords/listAll", defaultColunms2); |
| | | table2.setPaginationType("server"); |
| | | WorldCupRecords.table2 = table2.init(); |
| | | |
| | | var defaultColunms3 = [ |
| | | {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: 'maxPeople', visible: true, align: 'center', valign: 'middle'}, |
| | | {title: '胜-负场次', field: 'maxPeople', visible: true, align: 'center', valign: 'middle'}, |
| | | {title: '胜率', field: 'status', visible: true, align: 'center', valign: 'middle', |
| | | formatter:function (data) { |
| | | return data + '%'; |
| | | } |
| | | }, |
| | | ]; |
| | | var table3 = new BSTable("WorldCupRecordsTable3", "/worldCupRecords/listAll", defaultColunms3); |
| | | table3.setPaginationType("server"); |
| | | WorldCupRecords.table3 = table3.init(); |
| | | }); |
| | |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") |
| | | private Date insertTime; |
| | | private Integer state; |
| | | @TableField("sutuId") |
| | | private Integer sutuId; |
| | | @TableField("sutuName") |
| | | private String sutuName; |
| | | @TableField("blueName") |
| | | private String blueName; |
| | | @TableField("redName") |
| | | private String redName; |
| | | @TableField("blueCode") |
| | | private String blueCode; |
| | | @TableField("redCode") |
| | | private String redCode; |
| | | // 获取和设置方法 |
| | | } |
| | |
| | | private String ids; |
| | | @TableField("sign") |
| | | private Integer sign; |
| | | @TableField("reservation") |
| | | private Integer reservation; |
| | | } |
| | |
| | | * 红方id |
| | | */ |
| | | private String red; |
| | | private String blueName; |
| | | private String redName; |
| | | |
| | | private Integer state; |
| | | |
| | |
| | | from t_site a |
| | | left join t_store b on (a.storeId = b.id) |
| | | left join t_site_type c on (a.siteTypeId = c.id) |
| | | where a.state = 1 and a.isCanBeBooked = 1 |
| | | where a.state = 1 and a.reservation = 1 and a.isCanBeBooked = 1 |
| | | <if test="null != item.startTime and '' != item.startTime and null != item.endTime and '' != item.endTime"> |
| | | and CONCAT(DATE_FORMAT(now(), '%Y-%m-%d'), ' ', a.appointmentStartTime) <= CONCAT(DATE_FORMAT(now(), |
| | | '%Y-%m-%d'), ' ', #{item.startTime}) and CONCAT(DATE_FORMAT(now(), '%Y-%m-%d'), ' ', a.appointmentEndTime) |