Skip to content

Commit

Permalink
登录页面
Browse files Browse the repository at this point in the history
  • Loading branch information
qiurunze123 committed Jan 26, 2019
1 parent bdae627 commit 1a8973c
Show file tree
Hide file tree
Showing 10 changed files with 102 additions and 82 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ public void removeState(Long state) {
}

public boolean getIsBindPhone() {

return BitStatesUtils.hasState(bitState, BitStatesUtils.OP_BIND_PHONE);
}

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
package com.geekq.admin.service.impl;

import com.geekq.admin.entity.Account;
import com.geekq.admin.mapper.AccountMapper;
import com.geekq.admin.service.IAccountService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service("accountServiceImpl")
public class AccountServiceImpl implements IAccountService {

@Autowired
private AccountMapper accountMapper;

@Override
public void update(Account account) {
int ret = accountMapper.updateByPrimaryKey(account);
// if (ret <= 0) {
// throw new RuntimeException("Account对象:" + account.getId()
// + " 乐观锁失败!");
// }
}

@Override
public Account get(Long id) {
Account account = accountMapper.selectByPrimaryKey(id);
if (!account.checkAbstractInfo()) {
throw new RuntimeException("账户信息被篡改:" + id);
}
return account;
}

/**
* 重建account表的摘要信息
*/
@Override
public void recreateAbstractInfo() {
List<Account> accounts = this.accountMapper.selectAll();
for (Account account : accounts) {
this.accountMapper.updateByPrimaryKey(account);
}
}

@Override
public List<Account> listAll() {
return this.accountMapper.selectAll();
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,7 @@

import java.util.List;

/**
* @author 邱润泽
*/
@Service
@Service("iSystemDictionaryServiceImpl")
public class SystemDictionaryServiceImpl implements ISystemDictionaryService {
@Autowired
private SystemDictionaryMapper systemDictionaryMapper;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
package com.geekq.admin.service.impl;

import com.geekq.admin.entity.SystemDictionaryItem;
import com.geekq.admin.service.ISystemDictionaryService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import java.util.List;

/**
* 数据字典工具类
* @author Administrator
*
*/
@Component
public class SystemDictionaryUtil {

@Autowired
private ISystemDictionaryService systemDictionaryService;

public List<SystemDictionaryItem> list(String sn) {
return systemDictionaryService.queryBySn(sn);
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -27,4 +27,10 @@

<dubbo:service timeout="60000" retries="3"
interface="com.geekq.admin.service.RedisCacheStorageService" ref="redisCacheStorageServiceImpl" />

<dubbo:service timeout="60000" retries="3"
interface="com.geekq.admin.service.IAccountService" ref="accountServiceImpl" />

<dubbo:service timeout="60000" retries="3"
interface="com.geekq.admin.service.ISystemDictionaryService" ref="iSystemDictionaryServiceImpl" />
</beans>
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ public class PersonController extends BaseController {
@Autowired
private IAccountService accountService;



@Autowired
private RedisCacheStorageService redisService;

Expand All @@ -29,7 +31,9 @@ public String personal(Model model) {
//从中拿到 用户信息对象
Logininfo info = redisService.get("Loginqiurunze11");
model.addAttribute("userinfo", userinfoService.get(info.getId()));
// model.addAttribute("account", accountService.get(info.getId()));
model.addAttribute("account", accountService.get(info.getId()));
model.addAttribute("logininfo", info);

return "personal";
}
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package com.geekq.web.interceptor;

import com.geekq.admin.service.impl.SystemDictionaryUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.servlet.ModelAndView;
import org.springframework.web.servlet.handler.HandlerInterceptorAdapter;
Expand All @@ -9,17 +10,15 @@

public class AddGlobalUtilInterceptor extends HandlerInterceptorAdapter {

/* @Autowired
private SystemDictionaryUtil systemDicUtil;*/
@Autowired
private SystemDictionaryUtil systemDicUtil;

@Override
public void postHandle(HttpServletRequest request,
HttpServletResponse response, Object handler,
ModelAndView modelAndView) throws Exception {
if (modelAndView != null) {
/*
modelAndView.addObject("_DicUtil", systemDicUtil);
*/
}
super.postHandle(request, response, handler, modelAndView);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,4 +28,10 @@

<dubbo:reference id="redisCacheStorageService" interface="com.geekq.admin.service.RedisCacheStorageService"
retries="3" check="false" init="true"></dubbo:reference>

<dubbo:reference id="accountService" interface="com.geekq.admin.service.IAccountService"
retries="3" check="false" init="true"></dubbo:reference>

<dubbo:reference id="iSystemDictionaryServiceImpl" interface="com.geekq.admin.service.ISystemDictionaryService"
retries="3" check="false" init="true"></dubbo:reference>
</beans>
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
<#else>
<li>
<a class="el-current-user" href="/personal.do">
${logininfo.username}
${logininfo.nickname}
</a>
</li>
<li>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,76 +9,7 @@

<script type="text/javascript">
$(function(){
<#if !userinfo.isBindPhone>
$("#goto_bindphone").click(function(){
$("#bindPhoneModal").modal('show');
});
$("#sendVerifyCode").click(function(){
var pn=$("#phoneNumber");
var _me=$(this);
if(pn.val()){
_me.attr("disabled","disabled");
$.ajax({
dataType:"json",
type:"post",
url:"/sendVerifyCode.do",
data:{phoneNumber:pn.val()},
success:function(data){
if(data.success){
var time=5;
var timer=window.setInterval(function(){
time--;
if(time>=0){
_me.html(time+"秒后重新发送");
}else{
_me.html("重新发送验证码");
_me.attr("disabled",false);
window.clearInterval(timer);
}
},1000);
}else{
_me.attr("disabled",false);
$.messager.alert("提示",data.msg);
}
}
});
}
});
$("#bindPhone").click(function(){
$("#bindForm").ajaxSubmit(function(data){
if(data.success){
$.messager.confirm("提示","手机绑定成功!",function(){
window.location.reload();
});
}else{
$.messager.popup("绑定手机失败");
}
});
});
</#if>
<#if !userinfo.isBindEmail>
$("#goto_bindemail").click(function(){
$("#bindEmailModal").modal("show");
});
$("#bindEmail").click(function(){
if($("#email").val()){
$("#bindEmailForm").ajaxSubmit(function(data){
if(data.success){
$.messager.confirm("提示","已发送验证邮件,请尽快激活!",function(){
window.location.reload();
});
}else{
$.messager.popup("发送验证邮件失败");
}
});
}
});
</#if>
});
</script>
</head>
Expand All @@ -105,7 +36,7 @@
<img class="icon" src="images/person_icon.png" />
</div>
<div class="pull-left el-head">
<p>用户名:${logininfo.username}</p>
<p>用户名:${logininfo.nickname}</p>
<p>最后登录时间:2015-01-25 15:30:10</p>
</div>
<div class="pull-left" style="text-align: center;width: 400px;margin:30px auto 0px auto;">
Expand Down Expand Up @@ -167,7 +98,7 @@
<div class="col-sm-4">
<div class="el-accoun-auth">
<div class="el-accoun-auth-left">
<img src="images/shouji.jpg" />
_DicUtil <img src="images/shouji.jpg" />
</div>
<div class="el-accoun-auth-right">
<h5>手机认证</h5>
Expand Down

0 comments on commit 1a8973c

Please sign in to comment.