Commit 830cfbf8 authored by yangshuxing's avatar yangshuxing

bug优化

parent 0e514012
......@@ -8,7 +8,7 @@
from gk_cmpt_score_rule where cmpt_id=#{cmptId} order by `index`
</select>
<insert id="save" useGeneratedKeys="true" keyProperty="id" keyColumn="id">
<insert id="save" useGeneratedKeys="true" keyProperty="cmptScoreRule.id" keyColumn="id">
insert into gk_cmpt_score_rule(cmpt_id,`index`,start_time,end_time)
VALUES(#{cmptScoreRule.cmptId},#{cmptScoreRule.index},#{cmptScoreRule.startTime},#{cmptScoreRule.endTime})
</insert>
......
......@@ -24,7 +24,7 @@ public class CmptScoreRuleService {
*/
public int saveOrUpdate(List<CmptScoreRule> cmptScoreRules){
for(CmptScoreRule cmptScoreRule:cmptScoreRules){
if(cmptScoreRule.getId()==0){
if(cmptScoreRule.getId()<=0){
cmptScoreRuleMapper.save(cmptScoreRule);
}else{
cmptScoreRuleMapper.update(cmptScoreRule);
......
......@@ -136,6 +136,7 @@ public class MicroApiController {
log.info("userId:" + userId + ",phone:" + phone + ",cmptId:" + cmptId);
EnrollInfo info = cmptService.bind(userId, phone, cmptId);
if (info == null) {
return Result.fail().setMsg("该用户未报名!");
}
return Result.success().setMsg("绑定成功!").setContent(info);
......@@ -242,7 +243,7 @@ public class MicroApiController {
public Result getCustomer(@PathVariable("cmptId") Integer cmptId) {
Customer customer = customerService.getCusomerServiceInfo(cmptId);
Map<String,String> result = new HashMap<>();
result.put("mobile",customer.getMobile());
result.put("mobile",customer == null ? "" : customer.getMobile());
return Result.success().setContent(result);
}
......
......@@ -21,7 +21,7 @@ input{
background: rgba(247,247,247,1);
border-radius: 4px;
border: 1px solid rgba(229,229,229,1);
padding-left: 10px;
padding-left: 7px;
}
.tip{
font-size: 16px;
......
......@@ -34,6 +34,10 @@ $(document).ready(function () {
url : "/gk/score/getScore/"+getCId()+"/"+param,
success:function (data) {
var result = data.content;
if(result.user){
layer.msg("未查到人员信息");
return;
}
$('#score-body').empty();
if(result.scores.length > 0){
$('#data').fadeIn();
......@@ -126,6 +130,10 @@ $(document).ready(function () {
})
$('.add-btn').click(function () {
if($('.rule-field tbody tr').length >= 5){
layer.alert('最多只能设置5个项目!');
return ;
}
$('.dialog').removeAttr('data-id');
$('.dialog input').val('');
$('.mask').fadeIn();
......@@ -162,6 +170,10 @@ $(document).ready(function () {
});
$('.count-input').keyup(function () {
if($('.save-btn').length == 0){
layer.alert('比赛已经开始,不能修改规则!');
return ;
}
var value = $(this).val();
if(value > 10){
layer.msg('最多只能设置9次!');
......@@ -182,7 +194,7 @@ $(document).ready(function () {
item = $('#rule-section .rule-item').last().clone().clone();
}
var number = item.find('label').text().replace(/[^0-9]/ig,"");
item.removeAttr('data-id')
item.attr('data-id',($('.rule-item').length+1)*-1)
item.find('label').text('第'+($('#rule-section .rule-item').length+1)+"次上传成绩的起止时间")
$('#rule-section').append(item);
$('#rule-section').append($('#rule-section .clear'));
......@@ -229,6 +241,21 @@ $(document).ready(function () {
success:function (data) {
if(data.status){
layer.msg("保存成功!");
$('#rule-section .rule-item').remove();
$.each(data.content,function (i,e) {
var item = null;
item = $('.template').clone().clone().show();
item.removeClass("template")
var number = item.find('label').text().replace(/[^0-9]/ig,"");
var start = new Date(e.startTime);
var end = new Date(e.endTime);
item.find('input[name="start"]').val(start.getFullYear()+"-"+(start.getMonth()+1)+"-"+start.getDate()+" "+start.getHours()+":"+start.getMinutes());
item.find('input[name="end"]').val(end.getFullYear()+"-"+(end.getMonth()+1)+"-"+end.getDate()+" "+end.getHours()+":"+end.getMinutes());
item.attr('data-id',e.id)
item.find('label').text('第'+($('#rule-section .rule-item').length+1)+"次上传成绩的起止时间")
$('#rule-section').append(item);
$('#rule-section').append($('#rule-section .clear'));
})
}
}
})
......@@ -352,6 +379,9 @@ function drawChart(roads,series) {
text: '打卡次数'
}
}],
credits: {
enabled: false
},
legend: {
shadow: false
},
......
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