Commit c0656b16 authored by liuchao's avatar liuchao

no message

parent 7783edd3
package com.qiankun.controller;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.HashMap;
import java.util.Map;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.commons.lang.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.servlet.ModelAndView;
import com.qiankun.annotation.Auth;
import com.qiankun.controller.base.BaseController;
import com.qiankun.entity.Activity;
import com.qiankun.service.ActivityService;
......@@ -41,4 +53,62 @@ public class ActivityController extends BaseController<Object>{
return view;
}
@Auth(verifyLogin = false,verifyURL = false)
@RequestMapping(value = "/wx/api/activity/save",method = RequestMethod.POST)
public @ResponseBody Map<String,Object> saveUserFormWX(@RequestBody ActivityVo activityVo, HttpServletResponse response, HttpServletRequest request) throws Exception{
return this.save(activityVo, response, request);
}
@RequestMapping("/api/activity/save")
public Map<String, Object> save(ActivityVo activityVo, HttpServletResponse response, HttpServletRequest request) throws Exception {
Map<String, Object> map = new HashMap<>();
Activity activity = new Activity();
if (StringUtils.isEmpty(activityVo.getId())) {
Date date = new Date();
activity.setCreateTime(date);
map.put("status", 1);
} else {
activity = activityService.findById(activityVo.getId());
map.put("status", 2);
}
activity.setAddr(activityVo.getAddr());
activity.setAvailable(activityVo.getAvailable());
activity.setContacts(activityVo.getContacts());
activity.setContent(activityVo.getContent());
activity.setCrowd(activityVo.getCrowd());
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm");
activity.setDay(sdf.parse(activityVo.getDay()));
activity.setMax(activityVo.getMax());
activity.setName(activityVo.getName());
activity.setTel(activityVo.getTel());
activity.setType(activityVo.getType());
Activity a = activityService.save(activity);
map.put("activity", a);
return map;
}
}
\ No newline at end of file
......@@ -47,6 +47,7 @@ public class UserController extends BaseController<Object>{
}
@RequestMapping("/user/add")
public ModelAndView userAdd(String id) throws Exception {
ModelAndView view = new ModelAndView();
......
......@@ -14,6 +14,7 @@ import javax.persistence.InheritanceType;
import javax.persistence.Lob;
import javax.persistence.ManyToMany;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import org.hibernate.annotations.Cache;
import org.hibernate.annotations.CacheConcurrencyStrategy;
......@@ -33,7 +34,7 @@ public class Activity {
private String name; //活动名称
private String type; //活动类型
private String type; //活动类型 1.采血 2.公益 3.彩虹
@Lob
private String addr; //地点
......@@ -53,9 +54,9 @@ public class Activity {
private String tel; //联系电话
@ManyToMany(fetch = FetchType.LAZY, cascade = { CascadeType.MERGE })
@OneToMany(fetch = FetchType.LAZY, cascade = { CascadeType.ALL}, orphanRemoval = true, mappedBy = "activity")
@JsonIgnore
private Set<User> user = new HashSet<User>();
private Set<ActivityReg> activityReg = new HashSet<ActivityReg>();
private Date createTime = new Date();
......@@ -147,12 +148,12 @@ public class Activity {
this.tel = tel;
}
public Set<User> getUser() {
return user;
public Set<ActivityReg> getActivityReg() {
return activityReg;
}
public void setUser(Set<User> user) {
this.user = user;
public void setActivityReg(Set<ActivityReg> activityReg) {
this.activityReg = activityReg;
}
public Date getCreateTime() {
......
package com.qiankun.entity;
import java.util.Date;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.Inheritance;
import javax.persistence.InheritanceType;
import javax.persistence.ManyToOne;
import org.hibernate.annotations.Cache;
import org.hibernate.annotations.CacheConcurrencyStrategy;
import org.hibernate.annotations.GenericGenerator;
@Entity
@Cache(usage = CacheConcurrencyStrategy.READ_WRITE)
@Inheritance(strategy = InheritanceType.TABLE_PER_CLASS)
public class ActivityReg {
@Id
@GenericGenerator(name = "systemUUID", strategy = "uuid2")
@GeneratedValue(generator = "systemUUID")
private String id;
private boolean signin; //是否签到
private Date signinTime; //签到时间
@ManyToOne
private User user = new User();
private Date createTime = new Date();
@ManyToOne
private Activity activity = new Activity();
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public boolean isSignin() {
return signin;
}
public void setSignin(boolean signin) {
this.signin = signin;
}
public Date getSigninTime() {
return signinTime;
}
public void setSigninTime(Date signinTime) {
this.signinTime = signinTime;
}
public User getUser() {
return user;
}
public void setUser(User user) {
this.user = user;
}
public Date getCreateTime() {
return createTime;
}
public void setCreateTime(Date createTime) {
this.createTime = createTime;
}
}
......@@ -22,8 +22,8 @@ public class ActivityService {
@Transactional
public void save(Activity activity) {
activityDao.save(activity);
public Activity save(Activity activity) {
return activityDao.save(activity);
}
@Transactional
......
package com.qiankun.vo;
import java.util.Date;
import javax.persistence.Lob;
import javax.persistence.ManyToOne;
import com.qiankun.entity.User;
public class ActivityVo {
private String id;
......@@ -19,18 +12,107 @@ private String id;
private String content; //详细信息
private Date day; //活动时间
private String day; //活动时间
private long max; //最大人数;
private String crowd; //适用人群 1,2,3
private boolean available; //活动是否可用
private Boolean available; //活动是否可用
private String contacts; //联系人
private String tel; //联系电话
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getType() {
return type;
}
public void setType(String type) {
this.type = type;
}
public String getAddr() {
return addr;
}
public void setAddr(String addr) {
this.addr = addr;
}
public String getContent() {
return content;
}
public void setContent(String content) {
this.content = content;
}
public long getMax() {
return max;
}
public void setMax(long max) {
this.max = max;
}
public String getCrowd() {
return crowd;
}
public void setCrowd(String crowd) {
this.crowd = crowd;
}
public String getDay() {
return day;
}
public void setDay(String day) {
this.day = day;
}
public Boolean getAvailable() {
return available;
}
public void setAvailable(Boolean available) {
this.available = available;
}
public String getContacts() {
return contacts;
}
public void setContacts(String contacts) {
this.contacts = contacts;
}
public String getTel() {
return tel;
}
public void setTel(String tel) {
this.tel = tel;
}
......
......@@ -13,7 +13,7 @@ log4j.appender.stdout.layout.ConversionPattern = %d %p [%c] - <%m>%n
### create log on lever debug ###
log4j.appender.D = org.apache.log4j.RollingFileAppender
log4j.appender.D.File = /home/cbsys/sofeware/apache-tomcat-7.0.64/logs/debug.log
log4j.appender.D.File = E:/logs/debug.log
log4j.appender.D.MaxFileSize = 10240KB
log4j.appender.D.Encoding = UTF-8
log4j.appender.D.Threshold = DEBUG
......@@ -24,7 +24,7 @@ log4j.appender.D.MaxBackupIndex = 10
### create log on lever error ###
log4j.appender.E = org.apache.log4j.RollingFileAppender
log4j.appender.E.File = /home/cbsys/sofeware/apache-tomcat-7.0.64/logs/error.log
log4j.appender.E.File = E:/logs/error.log
log4j.appender.E.MaxFileSize = 10240KB
log4j.appender.E.Encoding = UTF-8
log4j.appender.E.Threshold = ERROR
......
......@@ -33,6 +33,7 @@
<link rel="stylesheet" href="<webpath:path/>/resources/assets/css/ace-skins.min.css" />
<link rel="stylesheet" href="<webpath:path/>/resources/assets/css/datepicker/datepicker.css" />
<link rel="stylesheet" href="<webpath:path/>/resources/assets/css/select2/select2.css" />
<link rel="stylesheet" href="<webpath:path/>/resources/assets/css/hsCheckData/hsCheckData.css" />
......@@ -68,7 +69,7 @@
<script src="<webpath:path/>/resources/assets/js/jquery.dataTables.min.js"></script>
<script src="<webpath:path/>/resources/assets/js/jquery.dataTables.bootstrap.js"></script>
<script src="<webpath:path/>/resources/assets/js/datepicker/laydate.js"></script>
<script src="<webpath:path/>/resources/assets/js/datepicker/bootstrap-datepicker.js"></script>
<script src="<webpath:path/>/resources/assets/js/select2/select2.js"></script>
<script src="<webpath:path/>/resources/assets/js/hsCheckData/hsCheckData.js"></script>
......
......@@ -32,7 +32,7 @@
<div class="col-xs-12">
<div class="widget-toolbox">
<div class="btn-group">
<button class="btn btn-sm btn-success" onclick="window.location.href='<webpath:path/>/user/add'">
<button class="btn btn-sm btn-success" onclick="window.location.href='<webpath:path/>/activity/add'">
<i class="icon-plus-sign-alt bigger-110"></i>
新增
</button>
......
<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>
<%@ taglib prefix="webpath" uri="/WEB-INF/tlds/path.tld"%>
<%@ taglib prefix="webpage" uri="/WEB-INF/tlds/pageview.tld"%>
<head>
</head>
<div class="main-content">
<div class="breadcrumbs" id="breadcrumbs">
<ul class="breadcrumb">
<li>
<i class="icon-home home-icon"></i>
<a href="#">首页</a>
</li>
<li class="active">活动管理</li>
<li class="active">保存</li>
</ul><!-- .breadcrumb -->
</div>
<div class="page-content">
<div class="row">
<div class="col-xs-12">
<form action="#" id="activityForm" name="activityForm" method="post" onsubmit="return false" class="form-horizontal" role="form">
<input type="hidden" id="id" name="id" value="${activity.id}"/>
<div class="row">
<div class="col-xs-12">
<h3 class="header smaller lighter blue">活动信息</h3></div>
</div>
<div class="row">
<div class="col-xs-5">
<div class="form-group">
<label class="col-sm-3 control-label no-padding-right" for="form-field-1"> 活动类型 </label>
<div class="col-sm-9">
<select class="col-xs-10 col-sm-10" id="type" name="type">
<option value="1" <c:if test="${activity.type == 1}">selected</c:if>>采血</option>
<option value="2" <c:if test="${activity.type == 2}">selected</c:if>>公益</option>
<option value="3" <c:if test="${activity.type == 3}">selected</c:if>>彩虹</option>
</select>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label no-padding-right" for="form-field-1"> <font color="red">*</font> 活动名称 </label>
<div class="col-sm-9">
<input type="text" id="name" name="name" value="" class="col-xs-10 col-sm-10" />
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label no-padding-right" for="form-field-2"> 活动地址 </label>
<div class="col-sm-9">
<input type="text" id="addr" name="addr" value="" class="col-xs-10 col-sm-10" />
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label no-padding-right" for="form-input-readonly"> <font color="red">*</font> 活动时间 </label>
<div class="col-sm-9">
<input class="col-xs-10 col-sm-10" id="day" name="day" type="text" autocomplete="off" data-date-format="yyyy-mm-dd hh:ss" value="${activity.day}"/>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label no-padding-right" for="form-input-readonly"> <font color="red">*</font> 最大人数</label>
<div class="col-sm-9">
<input class="col-xs-10 col-sm-10" id="max" name="max" type="text" value="${activity.max}"/>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label no-padding-right" for="form-input-readonly"> <font color="red">*</font> 适用人群 </label>
<div class="col-sm-9">
<select class="col-xs-10 col-sm-10" id="crowd" name="crowd">
<option value="0" <c:if test="${activity.crowd == 0}">selected</c:if>>所有人</option>
<option value="1" <c:if test="${activity.crowd == 1}">selected</c:if>>捐献志愿者</option>
<option value="2" <c:if test="${activity.crowd == 2}">selected</c:if>>未采血用户</option>
</select>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label no-padding-right" for="form-input-readonly"> 活动是否可用 </label>
<div class="col-sm-9">
<select name="available" id="available" class="col-xs-10 col-sm-10">
<option value="true" <c:if test="${activity.available}">selected</c:if>>可用</option>
<option value="false" <c:if test="${activity.available}">selected</c:if>>关闭</option>
</select>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label no-padding-right" for="form-input-readonly"> 联系人</label>
<div class="col-sm-9">
<input type="text" id="contacts" name="contacts" value="${activity.contacts}" class="col-xs-10 col-sm-10" />
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label no-padding-right" for="form-field-1"> <font color="red">*</font> 电话</label>
<div class="col-sm-9">
<input type="text" id="tel" name="tel" value="${activity.tel}" class="col-xs-10 col-sm-10" />
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label no-padding-right" for="form-field-1"> 详细信息 </label>
<div class="col-sm-9">
<textarea rows="4" class="col-xs-10 col-sm-10" id="content" name="content">${activity.content}</textarea>
</div>
</div>
</div>
</div>
<div class="col-md-offset-3 col-md-9">
<button class="btn btn-sm btn-success" type="submit">
<i class="icon-save bigger-110"></i>
保存
</button>
&nbsp; &nbsp; &nbsp;
<button class="btn btn-sm btn-success">
<i class="icon-reply bigger-110"></i>
返回
</button>
</div>
</form>
</div>
</div>
</div>
</div>
<script src="<webpath:path/>/resources/js/activity/activity.js" type="text/javascript"></script>
\ No newline at end of file
......@@ -22,7 +22,7 @@
<a href="#">首页</a>
</li>
<li class="active">用户管理</li>
<li class="active">新增</li>
<li class="active">保存</li>
</ul><!-- .breadcrumb -->
......@@ -88,7 +88,7 @@
<label class="col-sm-3 control-label no-padding-right" for="form-input-readonly"> <font color="red">*</font> 出生日期 </label>
<div class="col-sm-9">
<input class="col-xs-10 col-sm-10" id="birthday" name="birthday" type="text" data-date-format="yyyy-mm-dd" value="${user.birthday}"/>
<input class="col-xs-10 col-sm-10" id="birthday" name="birthday" type="text" autocomplete="off" data-date-format="yyyy-mm-dd" value="${user.birthday}"/>
</div>
</div>
......
This diff is collapsed.
<?xml version="1.0" standalone="no"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd" >
<!--
2013-9-30: Created.
-->
<svg>
<metadata>
Created by iconfont
</metadata>
<defs>
<font id="laydate-icon" horiz-adv-x="1024" >
<font-face
font-family="laydate-icon"
font-weight="500"
font-stretch="normal"
units-per-em="1024"
ascent="896"
descent="-128"
/>
<missing-glyph />
<glyph glyph-name="x" unicode="x" horiz-adv-x="1001"
d="M281 543q-27 -1 -53 -1h-83q-18 0 -36.5 -6t-32.5 -18.5t-23 -32t-9 -45.5v-76h912v41q0 16 -0.5 30t-0.5 18q0 13 -5 29t-17 29.5t-31.5 22.5t-49.5 9h-133v-97h-438v97zM955 310v-52q0 -23 0.5 -52t0.5 -58t-10.5 -47.5t-26 -30t-33 -16t-31.5 -4.5q-14 -1 -29.5 -0.5
t-29.5 0.5h-32l-45 128h-439l-44 -128h-29h-34q-20 0 -45 1q-25 0 -41 9.5t-25.5 23t-13.5 29.5t-4 30v167h911zM163 247q-12 0 -21 -8.5t-9 -21.5t9 -21.5t21 -8.5q13 0 22 8.5t9 21.5t-9 21.5t-22 8.5zM316 123q-8 -26 -14 -48q-5 -19 -10.5 -37t-7.5 -25t-3 -15t1 -14.5
t9.5 -10.5t21.5 -4h37h67h81h80h64h36q23 0 34 12t2 38q-5 13 -9.5 30.5t-9.5 34.5q-5 19 -11 39h-368zM336 498v228q0 11 2.5 23t10 21.5t20.5 15.5t34 6h188q31 0 51.5 -14.5t20.5 -52.5v-227h-327z" />
<glyph glyph-name="youyou" unicode="&#58882;" d="M283.648 721.918976 340.873216 780.926976 740.352 383.997952 340.876288-12.925952 283.648 46.077952 619.52 383.997952Z" horiz-adv-x="1024" />
<glyph glyph-name="zuozuo" unicode="&#58883;" d="M740.352 721.918976 683.126784 780.926976 283.648 383.997952 683.123712-12.925952 740.352 46.077952 404.48 383.997952Z" horiz-adv-x="1024" />
<glyph glyph-name="xiayiye" unicode="&#58970;" d="M62.573 384.103l423.401 423.662c18.985 18.985 49.757 18.985 68.727 0 18.982-18.972 18.985-49.746 0-68.729l-355.058-355.067 356.796-356.796c18.977-18.971 18.976-49.746 0-68.727-18.982-18.976-49.751-18.976-68.727 0l-39.753 39.753 0.269 0.246-385.655 385.661zM451.365 384.103l423.407 423.662c18.985 18.985 49.757 18.985 68.727 0 18.982-18.972 18.985-49.746 0-68.729l-355.058-355.067 356.796-356.796c18.977-18.971 18.976-49.746 0-68.727-18.982-18.976-49.757-18.977-68.727 0l-39.762 39.754 0.273 0.249-385.662 385.661zM451.365 384.103z" horiz-adv-x="1024" />
<glyph glyph-name="xiayiye1" unicode="&#58971;" d="M948.066926 382.958838l-411.990051-412.24426c-18.47333-18.47333-48.417689-18.47333-66.875207 0-18.47333 18.461167-18.47333 48.405526 0 66.875207L814.691135 383.088983 467.512212 730.269123c-18.466032 18.458735-18.466032 48.405526 0 66.873991 18.468465 18.464816 48.410391 18.464816 66.872774 0l38.682336-38.682336-0.261507-0.239614 375.259894-375.265975v0.003649m-378.312834 0L157.756743-29.285422c-18.47333-18.47333-48.415256-18.47333-66.872775 0-18.47333 18.461167-18.47333 48.405526 0 66.875207L436.369787 383.088983 89.19208 730.269123c-18.4636 18.458735-18.4636 48.405526 0 66.873991 18.470898 18.464816 48.415256 18.464816 66.872774 0l38.692067-38.682336-0.266372-0.239614 375.267191-375.265975-0.004865 0.003649m0 0z" horiz-adv-x="1024" />
</font>
</defs></svg>
/*! laydate-v5.0.9 日期与时间组件 MIT License http://www.layui.com/laydate/ By 贤心 */
.laydate-set-ym,.layui-laydate,.layui-laydate *,.layui-laydate-list{box-sizing:border-box}html #layuicss-laydate{display:none;position:absolute;width:1989px}.layui-laydate *{margin:0;padding:0}.layui-laydate{position:absolute;z-index:66666666;margin:5px 0;border-radius:2px;font-size:14px;-webkit-animation-duration:.3s;animation-duration:.3s;-webkit-animation-fill-mode:both;animation-fill-mode:both;-webkit-animation-name:laydate-upbit;animation-name:laydate-upbit}.layui-laydate-main{width:272px}.layui-laydate-content td,.layui-laydate-header *,.layui-laydate-list li{transition-duration:.3s;-webkit-transition-duration:.3s}@-webkit-keyframes laydate-upbit{from{-webkit-transform:translate3d(0,20px,0);opacity:.3}to{-webkit-transform:translate3d(0,0,0);opacity:1}}@keyframes laydate-upbit{from{transform:translate3d(0,20px,0);opacity:.3}to{transform:translate3d(0,0,0);opacity:1}}.layui-laydate-static{position:relative;z-index:0;display:inline-block;margin:0;-webkit-animation:none;animation:none}.laydate-ym-show .laydate-next-m,.laydate-ym-show .laydate-prev-m{display:none!important}.laydate-ym-show .laydate-next-y,.laydate-ym-show .laydate-prev-y{display:inline-block!important}.laydate-time-show .laydate-set-ym span[lay-type=month],.laydate-time-show .laydate-set-ym span[lay-type=year],.laydate-time-show .layui-laydate-header .layui-icon,.laydate-ym-show .laydate-set-ym span[lay-type=month]{display:none!important}.layui-laydate-header{position:relative;line-height:30px;padding:10px 70px 5px}.laydate-set-ym span,.layui-laydate-header i{padding:0 5px;cursor:pointer}.layui-laydate-header *{display:inline-block;vertical-align:bottom}.layui-laydate-header i{position:absolute;top:10px;color:#999;font-size:18px}.layui-laydate-header i.laydate-prev-y{left:15px}.layui-laydate-header i.laydate-prev-m{left:45px}.layui-laydate-header i.laydate-next-y{right:15px}.layui-laydate-header i.laydate-next-m{right:45px}.laydate-set-ym{width:100%;text-align:center;text-overflow:ellipsis;overflow:hidden;white-space:nowrap}.laydate-time-text{cursor:default!important}.layui-laydate-content{position:relative;padding:10px;-moz-user-select:none;-webkit-user-select:none;-ms-user-select:none}.layui-laydate-content table{border-collapse:collapse;border-spacing:0}.layui-laydate-content td,.layui-laydate-content th{width:36px;height:30px;padding:5px;text-align:center}.layui-laydate-content td{position:relative;cursor:pointer}.laydate-day-mark{position:absolute;left:0;top:0;width:100%;height:100%;line-height:30px;font-size:12px;overflow:hidden}.laydate-day-mark::after{position:absolute;content:'';right:2px;top:2px;width:5px;height:5px;border-radius:50%}.layui-laydate-footer{position:relative;height:46px;line-height:26px;padding:10px 20px}.layui-laydate-footer span{margin-right:15px;display:inline-block;cursor:pointer;font-size:12px}.layui-laydate-footer span:hover{color:#5FB878}.laydate-footer-btns{position:absolute;right:10px;top:10px}.laydate-footer-btns span{height:26px;line-height:26px;margin:0 0 0 -1px;padding:0 10px;border:1px solid #C9C9C9;background-color:#fff;white-space:nowrap;vertical-align:top;border-radius:2px}.layui-laydate-list>li,.layui-laydate-range .layui-laydate-main{display:inline-block;vertical-align:middle}.layui-laydate-list{position:absolute;left:0;top:0;width:100%;height:100%;padding:10px;background-color:#fff}.layui-laydate-list>li{position:relative;width:33.3%;height:36px;line-height:36px;margin:3px 0;text-align:center;cursor:pointer}.laydate-month-list>li{width:25%;margin:17px 0}.laydate-time-list>li{height:100%;margin:0;line-height:normal;cursor:default}.laydate-time-list p{position:relative;top:-4px;line-height:29px}.laydate-time-list ol{height:181px;overflow:hidden}.laydate-time-list>li:hover ol{overflow-y:auto}.laydate-time-list ol li{width:130%;padding-left:33px;line-height:30px;text-align:left;cursor:pointer}.layui-laydate-hint{position:absolute;top:115px;left:50%;width:250px;margin-left:-125px;line-height:20px;padding:15px;text-align:center;font-size:12px}.layui-laydate-range{width:546px}.layui-laydate-range .laydate-main-list-0 .laydate-next-m,.layui-laydate-range .laydate-main-list-0 .laydate-next-y,.layui-laydate-range .laydate-main-list-1 .laydate-prev-m,.layui-laydate-range .laydate-main-list-1 .laydate-prev-y{display:none}.layui-laydate-range .laydate-main-list-1 .layui-laydate-content{border-left:1px solid #e2e2e2}.layui-laydate,.layui-laydate-hint{border:1px solid #d2d2d2;box-shadow:0 2px 4px rgba(0,0,0,.12);background-color:#fff;color:#666}.layui-laydate-header{border-bottom:1px solid #e2e2e2}.layui-laydate-header i:hover,.layui-laydate-header span:hover{color:#5FB878}.layui-laydate-content{border-top:none 0;border-bottom:none 0}.layui-laydate-content th{font-weight:400;color:#333}.layui-laydate-content td{color:#666}.layui-laydate-content td.laydate-selected{background-color:#00F7DE}.laydate-selected:hover{background-color:#00F7DE!important}.layui-laydate-content td:hover,.layui-laydate-list li:hover{background-color:#eaeaea;color:#333}.laydate-time-list li ol{margin:0;padding:0;border:1px solid #e2e2e2;border-left-width:0}.laydate-time-list li:first-child ol{border-left-width:1px}.laydate-time-list>li:hover{background:0 0}.layui-laydate-content .laydate-day-next,.layui-laydate-content .laydate-day-prev{color:#d2d2d2}.laydate-selected.laydate-day-next,.laydate-selected.laydate-day-prev{background-color:#f8f8f8!important}.layui-laydate-footer{border-top:1px solid #e2e2e2}.layui-laydate-hint{color:#FF5722}.laydate-day-mark::after{background-color:#5FB878}.layui-laydate-content td.layui-this .laydate-day-mark::after{display:none}.layui-laydate-footer span[lay-type=date]{color:#5FB878}.layui-laydate .layui-this{background-color:#009688!important;color:#fff!important}.layui-laydate .laydate-disabled,.layui-laydate .laydate-disabled:hover{background:0 0!important;color:#d2d2d2!important;cursor:not-allowed!important;-moz-user-select:none;-webkit-user-select:none;-ms-user-select:none}.laydate-theme-molv{border:none}.laydate-theme-molv.layui-laydate-range{width:548px}.laydate-theme-molv .layui-laydate-main{width:274px}.laydate-theme-molv .layui-laydate-header{border:none;background-color:#009688}.laydate-theme-molv .layui-laydate-header i,.laydate-theme-molv .layui-laydate-header span{color:#f6f6f6}.laydate-theme-molv .layui-laydate-header i:hover,.laydate-theme-molv .layui-laydate-header span:hover{color:#fff}.laydate-theme-molv .layui-laydate-content{border:1px solid #e2e2e2;border-top:none;border-bottom:none}.laydate-theme-molv .laydate-main-list-1 .layui-laydate-content{border-left:none}.laydate-theme-grid .laydate-month-list>li,.laydate-theme-grid .laydate-year-list>li,.laydate-theme-grid .layui-laydate-content td,.laydate-theme-grid .layui-laydate-content thead,.laydate-theme-molv .layui-laydate-footer{border:1px solid #e2e2e2}.laydate-theme-grid .laydate-selected,.laydate-theme-grid .laydate-selected:hover{background-color:#f2f2f2!important;color:#009688!important}.laydate-theme-grid .laydate-selected.laydate-day-next,.laydate-theme-grid .laydate-selected.laydate-day-prev{color:#d2d2d2!important}.laydate-theme-grid .laydate-month-list,.laydate-theme-grid .laydate-year-list{margin:1px 0 0 1px}.laydate-theme-grid .laydate-month-list>li,.laydate-theme-grid .laydate-year-list>li{margin:0 -1px -1px 0}.laydate-theme-grid .laydate-year-list>li{height:43px;line-height:43px}.laydate-theme-grid .laydate-month-list>li{height:71px;line-height:71px}@font-face{font-family:laydate-icon;src:url(font/iconfont.eot);src:url(font/iconfont.eot#iefix) format('embedded-opentype'),url(font/iconfont.svg#iconfont) format('svg'),url(font/iconfont.woff) format('woff'),url(font/iconfont.ttf) format('truetype')}.laydate-icon{font-family:laydate-icon!important;font-size:16px;font-style:normal;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}
\ No newline at end of file
......@@ -1062,7 +1062,7 @@ a.a15:active {
}
input.error{
input.error, textarea.error{
border:1px solid red;
......
var isSubmit = true;
$(document).ready(function(){
if ($('#activityForm').length>0){
$('#activityForm').validate({
rules : {
"name" : {
required : true
},
"addr" : {
required : true
},
"day" : {
required : true
},
"max" : {
required : true,
isInteger: true
},
"crowd" : {
required : true
},
"contacts" : {
required : true
},
"tel": {
required : true
},
"content" : {
required : true
}
},
messages:{
"name" : {
required : "不能为空"
},
"addr" : {
required : "不能为空"
},
"day" : {
required : "不能为空"
},
"max" : {
required : "不能为空"
},
"crowd" : {
required : "不能为空"
},
"contacts" : {
required : "不能为空"
},
"tel": {
required : "不能为空"
},
"content" : {
required : "不能为空"
}
},
submitHandler: function(form){
activity.save(form);
}
});
}
laydate.render({
elem: '#day'
,type: 'datetime'
});
})
var activity = {
save : function(form){
if (isSubmit){
isSubmit = false;
$.ajax({
type: 'POST',
url: '/api/activity/save',
dataType:'json',
data: {
id:$('#id').val(),
name:$('#name').val(),
type:$('#type').val(),
addr:$('#addr').val(),
content:$('#content').html(),
day:$('#day').val(),
max:$('#max').val(),
crowd:$('#crowd').val(),
available:$('#available').val(),
contacts:$('#contacts').val(),
tel:$('#tel').val()
},
success: function(data){
var status=data.status;
if(status==1){//注册成功
bootbox.dialog({
message:"新增活动成功",
buttons:{
"cancel":{
"label":"返回",
"className":"btn-sm btn-primary",
"callback": function () {
window.location.href = webPath + '/activity/list';
}
},
"success":{
"label":"继续添加",
"className":"btn-sm btn-primary",
"callback": function () {
window.location.href = webPath + '/activity/add';
}
}
}
});
} else if (status == 2){
isSubmit = true;
bootbox.dialog({
message:"修改活动成功",
buttons:{
"success":{
"label":"确定",
"className":"btn-sm btn-primary",
"callback": function () {
}
}
}
});
}
}
});
}
}
}
......@@ -1337,7 +1337,7 @@ jQuery.validator.addMethod("isFloat", function(value, element) {
// 匹配integer
jQuery.validator.addMethod("isInteger", function(value, element) {
return this.optional(element) || (/^[-\+]?\d+$/.test(value) && parseInt(value)>=0);
}, "Please enter an integer");
}, "只能输入整数");
// 判断数值类型,包括整数和浮点数
jQuery.validator.addMethod("isNumber", function(value, element) {
......
......@@ -105,7 +105,9 @@ $(document).ready(function(){
}
laydate.render({
elem: '#birthday'
});
$('#birthday').datepicker()
$("#nation").select2({
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment