Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
C
com.hdp.customerservice
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
刘文胜
com.hdp.customerservice
Commits
3b1a1387
Commit
3b1a1387
authored
Jun 18, 2015
by
刘文胜
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
11111
parent
4138ae13
Changes
15
Hide whitespace changes
Inline
Side-by-side
Showing
15 changed files
with
311 additions
and
21 deletions
+311
-21
LoginController.java
...ain/java/com/hdp/customerservice/api/LoginController.java
+50
-0
UserInfoController.java
.../java/com/hdp/customerservice/api/UserInfoController.java
+39
-0
WorksController.java
...va/com/hdp/customerservice/api/admin/WorksController.java
+2
-0
NOLoginFilter.java
...in/java/com/hdp/customerservice/filter/NOLoginFilter.java
+46
-0
WorksEntity.java
src/main/java/com/hdp/customerservice/model/WorksEntity.java
+2
-1
WorksRepository.java
...a/com/hdp/customerservice/repository/WorksRepository.java
+2
-0
WorksService.java
...in/java/com/hdp/customerservice/service/WorksService.java
+2
-0
WorksServiceImpl.java
...ava/com/hdp/customerservice/service/WorksServiceImpl.java
+8
-0
CustomerManager.java
...va/com/hdp/customerservice/websocket/CustomerManager.java
+0
-1
GetHttpSessionConfigurator.java
...customerservice/websocket/GetHttpSessionConfigurator.java
+26
-0
IMWebSocketEndpoint.java
...om/hdp/customerservice/websocket/IMWebSocketEndpoint.java
+26
-11
Waiter.java
.../java/com/hdp/customerservice/websocket/model/Waiter.java
+5
-1
im.html
src/main/resources/static/im.html
+3
-3
app.js
src/main/resources/static/js/app.js
+16
-4
login.html
src/main/resources/static/login.html
+84
-0
No files found.
src/main/java/com/hdp/customerservice/api/LoginController.java
0 → 100644
View file @
3b1a1387
/**
* @Title: LoginController.java
* @Package com.hdp.customerservice.api
* @Description: TODO
* @author new12304508_163_com
* @date 2015年6月18日 上午10:51:43
* @version V1.0
*/
package
com
.
hdp
.
customerservice
.
api
;
import
javax.servlet.http.HttpServletRequest
;
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
com.hdp.customerservice.dto.DTO
;
import
com.hdp.customerservice.model.WorksEntity
;
import
com.hdp.customerservice.service.WorksService
;
@Controller
@RequestMapping
(
"/customerservice/login"
)
public
class
LoginController
{
@Autowired
private
WorksService
worksService
;
Integer
entCode
=
10001
;
@RequestMapping
(
method
=
RequestMethod
.
POST
)
@ResponseBody
public
String
save
(
@RequestBody
WorksEntity
entity
,
HttpServletRequest
request
){
DTO
dto
=
DTO
.
newDTO
();
System
.
out
.
println
(
entity
.
getUserName
());
WorksEntity
worker
=
worksService
.
findByUserNameIgnoreCase
(
entity
.
getUserName
());
if
(
worker
==
null
){
dto
.
errCode
=
-
1
;
dto
.
errMsg
=
"用户名不存在!"
;
}
else
if
(!
worker
.
getPwd
().
equals
(
entity
.
getPwd
())){
dto
.
errCode
=
-
2
;
dto
.
errMsg
=
"密码错误!"
;
}
else
{
request
.
getSession
(
true
).
setAttribute
(
"user"
,
worker
);
}
dto
.
data
=
worker
;
return
dto
.
toJson
();
}
}
src/main/java/com/hdp/customerservice/api/
Test
Controller.java
→
src/main/java/com/hdp/customerservice/api/
UserInfo
Controller.java
View file @
3b1a1387
/**
/**
* @Title:
Test
Controller.java
* @Title:
Login
Controller.java
* @Package com.hdp.customerservice.api
* @Package com.hdp.customerservice.api
* @Description: TODO
* @Description: TODO
* @author new12304508_163_com
* @author new12304508_163_com
* @date 2015年6月
3日 下午4:01:5
3
* @date 2015年6月
18日 上午10:51:4
3
* @version V1.0
* @version V1.0
*/
*/
package
com
.
hdp
.
customerservice
.
api
;
package
com
.
hdp
.
customerservice
.
api
;
import
javax.servlet.http.HttpServletRequest
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Controller
;
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.RequestMapping
;
import
org.springframework.web.bind.annotation.RequestMethod
;
import
org.springframework.web.bind.annotation.ResponseBody
;
import
org.springframework.web.bind.annotation.ResponseBody
;
import
com.alibaba.fastjson.JSONArray
;
import
com.hdp.customerservice.dto.DTO
;
import
com.hdp.customerservice.repository.MemberRepository
;
import
com.hdp.customerservice.model.WorksEntity
;
import
com.hdp.customerservice.service.MemberService
;
import
com.hdp.customerservice.service.WorksService
;
import
com.hdp.customerservice.service.WorksService
;
@Controller
@Controller
public
class
TestController
{
@RequestMapping
(
"/customerservice/signed"
)
/**
public
class
UserInfoController
{
* @Title: TestController.java
* @Package com.hdp.customerservice.api
* @Description: TODO
* @author new12304508_163_com
* @date 2015年6月3日 下午4:01:53
* @version V1.0
*/
@Autowired
private
MemberService
memberService
;
@Autowired
@Autowired
private
WorksService
worksService
;
private
WorksService
worksService
;
Integer
entCode
=
10001
;
@RequestMapping
(
"/test"
)
@RequestMapping
(
method
=
RequestMethod
.
GET
)
public
@ResponseBody
String
test
(){
@ResponseBody
public
String
signed
(
HttpServletRequest
request
){
return
JSONArray
.
toJSONString
(
worksService
.
getAllList
());
DTO
dto
=
DTO
.
newDTO
();
//return JSONArray.toJSONString(memberService.getAllList());
dto
.
data
=
request
.
getSession
(
true
).
getAttribute
(
"user"
);
return
dto
.
toJson
();
}
}
}
}
src/main/java/com/hdp/customerservice/api/admin/WorksController.java
View file @
3b1a1387
...
@@ -27,11 +27,13 @@ public class WorksController {
...
@@ -27,11 +27,13 @@ public class WorksController {
@Autowired
@Autowired
private
WorksService
worksService
;
private
WorksService
worksService
;
Integer
entCode
=
10001
;
@RequestMapping
(
value
=
""
,
method
=
RequestMethod
.
POST
)
@RequestMapping
(
value
=
""
,
method
=
RequestMethod
.
POST
)
@ResponseBody
@ResponseBody
public
String
save
(
@RequestBody
WorksEntity
entity
){
public
String
save
(
@RequestBody
WorksEntity
entity
){
DTO
dto
=
DTO
.
newDTO
();
DTO
dto
=
DTO
.
newDTO
();
entity
.
setEntCode
(
entCode
);
dto
.
data
=
worksService
.
save
(
entity
);
dto
.
data
=
worksService
.
save
(
entity
);
return
dto
.
toJson
();
return
dto
.
toJson
();
}
}
...
...
src/main/java/com/hdp/customerservice/filter/NOLoginFilter.java
0 → 100644
View file @
3b1a1387
/**
* @Title: NOLoginFilter.java
* @Package com.hdp.customerservice.filter
* @Description: TODO
* @author new12304508_163_com
* @date 2015年6月18日 上午11:11:09
* @version V1.0
*/
package
com
.
hdp
.
customerservice
.
filter
;
import
java.io.IOException
;
import
javax.servlet.Filter
;
import
javax.servlet.FilterChain
;
import
javax.servlet.FilterConfig
;
import
javax.servlet.ServletException
;
import
javax.servlet.ServletRequest
;
import
javax.servlet.ServletResponse
;
import
javax.servlet.http.HttpServletRequest
;
import
javax.servlet.http.HttpServletResponse
;
import
javax.servlet.http.HttpSession
;
import
org.springframework.stereotype.Component
;
import
com.hdp.customerservice.model.WorksEntity
;
@Component
public
class
NOLoginFilter
implements
Filter
{
public
void
doFilter
(
ServletRequest
request
,
ServletResponse
response
,
FilterChain
chain
)
throws
IOException
,
ServletException
{
HttpServletRequest
req
=
(
HttpServletRequest
)
request
;
HttpServletResponse
res
=
(
HttpServletResponse
)
response
;
HttpSession
session
=
req
.
getSession
(
true
);
WorksEntity
user
=
(
WorksEntity
)
session
.
getAttribute
(
"user"
);
String
uri
=
req
.
getRequestURI
();
if
(
user
!=
null
&&
(
uri
.
endsWith
(
"login.html"
)
||
uri
.
endsWith
(
"login"
))){
res
.
sendRedirect
(
"/im.html"
);
}
else
if
(
user
!=
null
||
uri
.
startsWith
(
"/admin"
)
||
uri
.
endsWith
(
"login.html"
)
||
uri
.
endsWith
(
"login"
)){
chain
.
doFilter
(
request
,
response
);
}
else
{
res
.
sendRedirect
(
"/login.html"
);
}
}
public
void
init
(
FilterConfig
filterConfig
)
{}
public
void
destroy
()
{}
}
src/main/java/com/hdp/customerservice/model/WorksEntity.java
View file @
3b1a1387
...
@@ -6,6 +6,7 @@ import javax.persistence.GeneratedValue;
...
@@ -6,6 +6,7 @@ import javax.persistence.GeneratedValue;
import
javax.persistence.GenerationType
;
import
javax.persistence.GenerationType
;
import
javax.persistence.Id
;
import
javax.persistence.Id
;
import
javax.persistence.Table
;
import
javax.persistence.Table
;
import
javax.validation.constraints.Pattern
;
/**
/**
* (pi_customerservice_works)
* (pi_customerservice_works)
...
@@ -46,7 +47,7 @@ public class WorksEntity implements java.io.Serializable {
...
@@ -46,7 +47,7 @@ public class WorksEntity implements java.io.Serializable {
/** */
/** */
@Column
(
name
=
"status"
,
nullable
=
false
,
length
=
10
)
@Column
(
name
=
"status"
,
nullable
=
false
,
length
=
10
)
private
Integer
status
;
private
Integer
status
=
0
;
//0离线 1在线 2挂起 3离开
/**
/**
* 获取
* 获取
...
...
src/main/java/com/hdp/customerservice/repository/WorksRepository.java
View file @
3b1a1387
...
@@ -22,4 +22,6 @@ public interface WorksRepository extends BaseRepository<WorksEntity,Long>{
...
@@ -22,4 +22,6 @@ public interface WorksRepository extends BaseRepository<WorksEntity,Long>{
* @date 2015年6月17日 下午4:16:38
* @date 2015年6月17日 下午4:16:38
* @version V1.0
* @version V1.0
*/
*/
public
WorksEntity
findByUserNameIgnoreCase
(
String
userName
);
}
}
src/main/java/com/hdp/customerservice/service/WorksService.java
View file @
3b1a1387
...
@@ -19,4 +19,6 @@ public interface WorksService extends BaseService<WorksEntity, Long>{
...
@@ -19,4 +19,6 @@ public interface WorksService extends BaseService<WorksEntity, Long>{
* @date 2015年6月17日 下午4:07:41
* @date 2015年6月17日 下午4:07:41
* @version V1.0
* @version V1.0
*/
*/
public
WorksEntity
findByUserNameIgnoreCase
(
String
u
);
}
}
src/main/java/com/hdp/customerservice/service/WorksServiceImpl.java
View file @
3b1a1387
...
@@ -20,4 +20,12 @@ import com.hdp.customerservice.repository.WorksRepository;
...
@@ -20,4 +20,12 @@ import com.hdp.customerservice.repository.WorksRepository;
@Transactional
(
readOnly
=
true
)
@Transactional
(
readOnly
=
true
)
public
class
WorksServiceImpl
extends
AbstractBaseServiceImpl
<
WorksEntity
,
Long
>
implements
WorksService
{
public
class
WorksServiceImpl
extends
AbstractBaseServiceImpl
<
WorksEntity
,
Long
>
implements
WorksService
{
@Autowired
private
WorksRepository
workerRepository
;
@Override
public
WorksEntity
findByUserNameIgnoreCase
(
String
u
)
{
return
workerRepository
.
findByUserNameIgnoreCase
(
u
);
}
}
}
src/main/java/com/hdp/customerservice/websocket/CustomerManager.java
View file @
3b1a1387
...
@@ -8,7 +8,6 @@
...
@@ -8,7 +8,6 @@
*/
*/
package
com
.
hdp
.
customerservice
.
websocket
;
package
com
.
hdp
.
customerservice
.
websocket
;
import
java.util.List
;
import
java.util.concurrent.ConcurrentHashMap
;
import
java.util.concurrent.ConcurrentHashMap
;
import
org.springframework.util.StringUtils
;
import
org.springframework.util.StringUtils
;
...
...
src/main/java/com/hdp/customerservice/websocket/GetHttpSessionConfigurator.java
0 → 100644
View file @
3b1a1387
/**
* @Title: GetHttpSessionConfigurator.java
* @Package com.hdp.customerservice.websocket
* @Description: TODO
* @author new12304508_163_com
* @date 2015年6月18日 下午2:23:41
* @version V1.0
*/
package
com
.
hdp
.
customerservice
.
websocket
;
import
javax.servlet.http.HttpSession
;
import
javax.websocket.HandshakeResponse
;
import
javax.websocket.server.HandshakeRequest
;
import
javax.websocket.server.ServerEndpointConfig
;
public
class
GetHttpSessionConfigurator
extends
ServerEndpointConfig
.
Configurator
{
@Override
public
void
modifyHandshake
(
ServerEndpointConfig
config
,
HandshakeRequest
request
,
HandshakeResponse
response
)
{
HttpSession
httpSession
=
(
HttpSession
)
request
.
getHttpSession
();
config
.
getUserProperties
().
put
(
HttpSession
.
class
.
getName
(),
httpSession
);
}
}
src/main/java/com/hdp/customerservice/websocket/IMWebSocketEndpoint.java
View file @
3b1a1387
package
com
.
hdp
.
customerservice
.
websocket
;
package
com
.
hdp
.
customerservice
.
websocket
;
import
java.io.IOException
;
import
java.io.IOException
;
import
java.util.Iterator
;
import
java.util.concurrent.ConcurrentHashMap
;
import
javax.servlet.http.HttpSession
;
import
javax.websocket.EndpointConfig
;
import
javax.websocket.OnClose
;
import
javax.websocket.OnClose
;
import
javax.websocket.OnError
;
import
javax.websocket.OnMessage
;
import
javax.websocket.OnMessage
;
import
javax.websocket.OnOpen
;
import
javax.websocket.OnOpen
;
import
javax.websocket.Session
;
import
javax.websocket.Session
;
...
@@ -13,25 +14,39 @@ import javax.websocket.server.ServerEndpoint;
...
@@ -13,25 +14,39 @@ import javax.websocket.server.ServerEndpoint;
import
org.apache.commons.logging.Log
;
import
org.apache.commons.logging.Log
;
import
org.apache.commons.logging.LogFactory
;
import
org.apache.commons.logging.LogFactory
;
import
com.hdp.customerservice.
websocket.model.Customer
;
import
com.hdp.customerservice.
model.WorksEntity
;
import
com.hdp.customerservice.websocket.model.Waiter
;
import
com.hdp.customerservice.websocket.model.Waiter
;
@ServerEndpoint
(
"/im"
)
@ServerEndpoint
(
value
=
"/im"
,
configurator
=
GetHttpSessionConfigurator
.
class
)
public
class
IMWebSocketEndpoint
{
public
class
IMWebSocketEndpoint
{
private
static
Log
log
=
LogFactory
.
getLog
(
IMWebSocketEndpoint
.
class
);
private
static
Log
log
=
LogFactory
.
getLog
(
IMWebSocketEndpoint
.
class
);
private
HttpSession
httpSession
;
//当前登录用户的http session
private
Waiter
waiter
;
//当前客服
@OnOpen
@OnOpen
public
void
handleConnect
(
Session
session
)
throws
IOException
{
public
void
handleConnect
(
Session
session
,
EndpointConfig
config
)
throws
IOException
{
Waiter
waiter
=
new
Waiter
();
this
.
httpSession
=
(
HttpSession
)
config
.
getUserProperties
()
waiter
.
id
=
session
.
getId
();
.
get
(
HttpSession
.
class
.
getName
());
waiter
.
name
=
"刘文胜"
+
Math
.
random
();
WorksEntity
worksEntity
=
(
WorksEntity
)
this
.
httpSession
.
getAttribute
(
"user"
);
waiter
=
new
Waiter
();
waiter
.
entCode
=
worksEntity
.
getEntCode
();
waiter
.
id
=
worksEntity
.
getId
().
toString
();
waiter
.
nickName
=
worksEntity
.
getNickName
();
waiter
.
headImg
=
worksEntity
.
getHeadImg
();
waiter
.
userName
=
worksEntity
.
getUserName
();
waiter
.
session
=
session
;
waiter
.
session
=
session
;
WaiterManager
.
addWaiter
(
waiter
);
WaiterManager
.
addWaiter
(
waiter
);
//当前所有在线客服
}
}
@OnClose
@OnClose
public
void
handleClose
(
Session
session
){
public
void
handleClose
(
Session
session
){
log
.
info
(
"111111111111111111111111111111111111111"
);
log
.
info
(
waiter
.
nickName
+
"离线了"
);
}
@OnError
public
void
handleError
(
Throwable
t
){
log
.
info
(
t
);
}
}
@OnMessage
@OnMessage
...
...
src/main/java/com/hdp/customerservice/websocket/model/Waiter.java
View file @
3b1a1387
...
@@ -16,7 +16,11 @@ import javax.websocket.Session;
...
@@ -16,7 +16,11 @@ import javax.websocket.Session;
public
class
Waiter
{
public
class
Waiter
{
public
String
id
;
public
String
id
;
public
String
name
;
public
Integer
entCode
;
public
String
userName
;
public
String
nickName
;
public
String
headImg
;
public
String
headImg
;
...
...
src/main/resources/static/im.html
View file @
3b1a1387
...
@@ -2,10 +2,12 @@
...
@@ -2,10 +2,12 @@
<html
lang=
"en"
data-ng-app=
"websocketApp"
>
<html
lang=
"en"
data-ng-app=
"websocketApp"
>
<head>
<head>
<title>
test2
</title>
<title>
test2
</title>
<meta
http-equiv=
"pragma"
content=
"no-cache"
>
<meta
http-equiv=
"Cache-Control"
content=
"no-cache, must-revalidate"
>
<meta
http-equiv=
"Expires"
content=
"0"
/>
<link
rel=
"stylesheet"
href=
"css/skin.css"
/>
<link
rel=
"stylesheet"
href=
"css/skin.css"
/>
<link
rel=
"stylesheet"
href=
"css/frame.css"
/>
<link
rel=
"stylesheet"
href=
"css/frame.css"
/>
<link
rel=
"stylesheet"
href=
"css/home_A.css"
/>
<link
rel=
"stylesheet"
href=
"css/home_A.css"
/>
<script
src=
"js/angular/angular.min.js"
></script>
<script
src=
"js/angular/angular.min.js"
></script>
<script
src=
"js/angular/angular-cookies.min.js"
></script>
<script
src=
"js/angular/angular-cookies.min.js"
></script>
<script
src=
"js/angular/angular-file-upload.min.js"
></script>
<script
src=
"js/angular/angular-file-upload.min.js"
></script>
...
@@ -152,8 +154,6 @@
...
@@ -152,8 +154,6 @@
<div
class=
"bubble_user"
>
<div
class=
"bubble_user"
>
<a
href=
"http://weibo.com/u/3955027752"
target=
"_blank"
class=
"face default_face"
><img
width=
"30"
height=
"30"
src=
"{{m.headimgurl}}"
/></a>
<a
href=
"http://weibo.com/u/3955027752"
target=
"_blank"
class=
"face default_face"
><img
width=
"30"
height=
"30"
src=
"{{m.headimgurl}}"
/></a>
</div>
</div>
<p
class=
"bubble_name W_autocut"
style=
"height: 15px;display:none"
href=
"http://weibo.com/u/3955027752"
target=
"_blank"
>
海东青童鞋
</p>
<p
class=
"bubble_prompt"
style=
"display: none;"
><span
class=
"W_icon icon_rederrorS"
></span>
发送失败,请输入验证码
</p>
<div
class=
"bubble_box SW_fun "
>
<div
class=
"bubble_box SW_fun "
>
<div
class=
"bubble_cont "
>
<div
class=
"bubble_cont "
>
<div
class=
"bubble_arrow"
>
<div
class=
"bubble_arrow"
>
...
...
src/main/resources/static/js/app.js
View file @
3b1a1387
'use strict'
;
'use strict'
;
var
websocketApp
=
angular
.
module
(
'websocketApp'
,[
'ngCookies'
,
'ngResource'
,
'ui.router'
])
;
var
CUSTOMERSERVICE_API
=
"http://localhost:8080"
;
var
websocketApp
=
angular
.
module
(
'websocketApp'
,[
'ngCookies'
,
'ngResource'
,
'ui.router'
]);
websocketApp
.
config
([
'$stateProvider'
,
websocketApp
.
config
([
'$stateProvider'
,
function
(
$stateProvider
)
{
function
(
$stateProvider
)
{
var
states
=
[];
var
states
=
[];
...
@@ -12,14 +13,21 @@ websocketApp.config(['$stateProvider',
...
@@ -12,14 +13,21 @@ websocketApp.config(['$stateProvider',
]);
]);
websocketApp
.
service
(
'WebSocketService'
,
websocketApp
.
service
(
'WebSocketService'
,
[
'$q'
,
'$rootScope'
,
function
(
$q
,
$rootScop
e
)
{
[
'$q'
,
'$rootScope'
,
'$resource'
,
function
(
$q
,
$rootScope
,
$resourc
e
)
{
var
Service
=
{};
var
Service
=
{};
var
callbacks
=
{};
var
callbacks
=
{};
var
currentCallbackId
=
0
;
var
currentCallbackId
=
0
;
var
ws
=
new
WebSocket
(
"ws://localhost:8080/im"
);
var
ws
=
new
WebSocket
(
"ws://localhost:8080/im"
);
var
curUser
=
{};
ws
.
onopen
=
function
(){
ws
.
onopen
=
function
(){
console
.
log
(
"连接到了服务器!"
);
console
.
log
(
"连接到了服务器!"
);
$resource
(
CUSTOMERSERVICE_API
+
'/customerservice/signed'
)
.
get
({},
function
(
res
){
curUser
=
res
&&
res
.
data
;
},
function
(
res
){
console
.
log
(
'获取用户信息失败'
);
});
};
};
ws
.
onclose
=
function
()
{
ws
.
onclose
=
function
()
{
...
@@ -67,6 +75,9 @@ websocketApp.service('WebSocketService',
...
@@ -67,6 +75,9 @@ websocketApp.service('WebSocketService',
var
promise
=
sendRequest
(
request
);
var
promise
=
sendRequest
(
request
);
return
promise
;
return
promise
;
};
};
Service
.
getCurUser
=
function
(){
return
curUser
;
}
return
Service
;
return
Service
;
}]);
}]);
...
@@ -187,6 +198,7 @@ websocketApp.controller('MessagesCtrl',
...
@@ -187,6 +198,7 @@ websocketApp.controller('MessagesCtrl',
if
(
$scope
.
message
){
if
(
$scope
.
message
){
var
m
=
{
type
:
2
,
message
:
''
};
var
m
=
{
type
:
2
,
message
:
''
};
m
.
message
=
$sce
.
trustAsHtml
(
$scope
.
message
);
m
.
message
=
$sce
.
trustAsHtml
(
$scope
.
message
);
m
.
headimgurl
=
WebSocketService
.
getCurUser
().
headImg
;
messages
.
push
(
m
);
messages
.
push
(
m
);
/*WebSocketService.sendMessage($scope.message).then(function(res) {
/*WebSocketService.sendMessage($scope.message).then(function(res) {
messages.push({type:1,message:res.message});
messages.push({type:1,message:res.message});
...
...
src/main/resources/static/login.html
0 → 100644
View file @
3b1a1387
<!DOCTYPE html>
<html
lang=
"en"
>
<head>
<title>
客服系统-登录
</title>
<link
rel=
"stylesheet"
href=
"http://cdn.bootcss.com/bootstrap/3.3.4/css/bootstrap.min.css"
>
<!-- jQuery文件。务必在bootstrap.min.js 之前引入 -->
<script
src=
"http://cdn.bootcss.com/jquery/1.11.2/jquery.min.js"
></script>
<!-- 最新的 Bootstrap 核心 JavaScript 文件 -->
<script
src=
"http://cdn.bootcss.com/bootstrap/3.3.4/js/bootstrap.min.js"
></script>
<script>
var
login_ing
=
false
;
function
login
(){
if
(
login_ing
){
return
false
;
}
login_ing
=
true
;
$
.
ajax
({
type
:
"post"
,
url
:
'/customerservice/login'
,
dataType
:
"JSON"
,
contentType
:
'application/json'
,
data
:
JSON
.
stringify
({
userName
:
$
(
"#userName"
).
val
(),
pwd
:
$
(
"#pwd"
).
val
()
}),
error
:
function
(
request
)
{
login_ing
=
false
;
alert
(
'登录失败!'
);
},
success
:
function
(
data
)
{
login_ing
=
false
;
if
(
data
.
errcode
){
return
alert
(
data
.
errmsg
);
}
window
.
location
.
href
=
"/im.html"
;
}
});
return
false
;
}
</script>
</head>
<body>
<div
class=
"container-fluid"
>
<div
class=
"row"
style=
"height:150px;"
>
<div
class=
"col-md-12"
>
</div>
</div>
<div
class=
"row"
>
<div
class=
"col-md-2"
></div>
<div
class=
"col-md-8"
>
<form
id=
"loginForm"
class=
"form-horizontal"
action=
"/customerservice/login"
method=
"post"
autocomplete=
"on"
onsubmit=
"return login();"
>
<div
class=
"form-group"
>
<label
for=
"inputEmail3"
class=
"col-sm-2 control-label"
>
用户名
</label>
<div
class=
"col-sm-10"
>
<input
type=
"text"
class=
"form-control"
id=
"userName"
name=
"userName"
placeholder=
"用户名"
required
>
</div>
</div>
<div
class=
"form-group"
>
<label
for=
"inputPassword3"
class=
"col-sm-2 control-label"
>
密码
</label>
<div
class=
"col-sm-10"
>
<input
type=
"password"
class=
"form-control"
id=
"pwd"
name=
"pwd"
placeholder=
"密码"
required
>
</div>
</div>
<div
class=
"form-group"
>
<div
class=
"col-sm-offset-2 col-sm-10"
>
<div
class=
"checkbox"
>
<label>
<input
type=
"checkbox"
>
记住我
</label>
</div>
</div>
</div>
<div
class=
"form-group"
>
<div
class=
"col-sm-offset-2 col-sm-10"
>
<button
type=
"submit"
class=
"btn btn-default"
>
登 录
</button>
</div>
</div>
</form>
</div>
<div
class=
"col-md-2"
></div>
</div>
</div>
</body>
</html>
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment