Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
黄成意
/
yunxin
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
5006560c
authored
Feb 27, 2019
by
PRY5YKGJ82EZEPX\Administrator
Browse files
Options
_('Browse Files')
Download
Plain Diff
Merge branch 'master' of
http://119.23.72.7/q578953158/yunxin
parents
44551066
385e3d0f
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
28 additions
and
71 deletions
public/pc/js/controller/login.js
public/pc/js/global.js
resources/views/pc/Login.blade.php
public/pc/js/controller/login.js
View file @
5006560c
;
!
function
()
{
window
.
loginController
=
{
'code'
:
"#code"
,
//验证码
'submit'
:
"#submit"
,
//提交按钮
init
:
function
()
{
this
.
handleBind
(
this
);
},
...
...
@@ -24,7 +26,7 @@
}
return
false
;
},
getData
:
function
(
params
,
callback
)
{
getData
:
function
(
params
,
callback
)
{
$
.
ajax
({
url
:
_URL_
+
'/api/ApiLogin'
,
type
:
'post'
,
...
...
@@ -33,13 +35,14 @@
dataType
:
'json'
,
timeout
:
10000
,
success
:
function
(
res
)
{
typeof
callback
==
'function'
&&
callback
(
res
);
/* if (resp.code > 0) {
alert(resp.msg)
if
(
resp
.
code
>
0
)
{
layer
.
msg
(
resp
.
msg
);
}
else
{
setCookie('yunxin_token', resp.data)
window.location.href = "/web/orderList"
}*/
typeof
callback
==
'function'
&&
callback
(
res
);
}
},
error
:
function
(
res
)
{
layer
.
msg
(
'网络出现问题,请重试!'
)
}
})
},
...
...
@@ -64,80 +67,35 @@
return
true
;
},
handleBind
:
function
(
opt
)
{
//验证码
$
(
opt
.
code
).
on
(
'click'
,
function
()
{
$
(
this
).
find
(
'img'
).
attr
(
'src'
,
'/helper/captcha?'
+
new
Date
().
getTime
())
});
//提交
$
(
"#submit"
).
on
(
'click'
,
function
()
{
$
(
opt
.
submit
).
on
(
'click'
,
function
()
{
if
(
opt
.
calcForm
(
opt
))
{
opt
.
getData
(
function
(
res
)
{
console
.
log
(
res
)
});
opt
.
getData
(
function
(
res
)
{
setCookie
(
'yunxin_token'
,
resp
.
data
)
window
.
location
.
href
=
"/web/orderList"
});
}
});
$
(
"input[name='username']"
).
on
(
'blur'
,
function
()
{
opt
.
calcForm
(
opt
);
});
$
(
"input[name='pwd']"
).
on
(
'blur'
,
function
()
{
opt
.
calcForm
(
opt
);
});
$
(
"input[name='code']"
).
on
(
'blur'
,
function
()
{
opt
.
calcForm
(
opt
);
});
return
this
;
},
},
$
(
function
()
{
loginController
.
init
();
})
}();
/**
* Created by hcy on 2019/2/19.
*/
function
login
()
{
$
.
ajax
({
url
:
_URL_
+
'/api/ApiLogin'
,
type
:
'post'
,
data
:{
'mobile'
:
$
(
"#mobile"
).
val
(),
'password'
:
$
.
md5
(
$
(
"#password"
).
val
()),
'code'
:
$
(
"#code"
).
val
()
},
async
:
false
,
dataType
:
'json'
,
timeout
:
10000
,
success
:
function
(
resp
)
{
if
(
resp
.
code
>
0
){
alert
(
resp
.
msg
)
}
else
{
delCookie
(
'yunxin_token'
)
//先删除cookie
setCookie
(
'yunxin_token'
,
resp
.
data
)
window
.
location
.
href
=
"/web/orderList"
}
}
})
}
function
setCookie
(
name
,
value
){
var
Days
=
30
;
var
exp
=
new
Date
();
exp
.
setTime
(
exp
.
getTime
()
+
Days
*
24
*
60
*
60
*
30
);
document
.
cookie
=
name
+
"="
+
escape
(
value
)
+
";path=/;expires="
+
exp
.
toGMTString
()
+
";domain=."
+
_DOMAIN_
;
}
function
getCookie
(
name
)
{
var
arr
,
reg
=
new
RegExp
(
"(^| )"
+
name
+
"=([^;]*)(;|$)"
);
if
(
arr
=
document
.
cookie
.
match
(
reg
))
return
unescape
(
arr
[
2
]);
else
return
null
;
}
function
delCookie
(
key
)
{
var
date
=
new
Date
();
date
.
setTime
(
date
.
getTime
()
-
1
);
var
delValue
=
getCookie
(
key
);
if
(
!!
delValue
)
{
document
.
cookie
=
key
+
'='
+
delValue
+
';expires='
+
date
.
toGMTString
();
}
}
\ No newline at end of file
}();
\ No newline at end of file
public/pc/js/global.js
View file @
5006560c
...
...
@@ -103,5 +103,3 @@
})(
window
);
var
_URL_
=
"http://yunxin.liexin.com"
;
resources/views/pc/Login.blade.php
View file @
5006560c
...
...
@@ -55,7 +55,7 @@
<div
class=
"code-inp fl"
>
<input
type=
"text"
placeholder=
"请输入验证码"
name=
"code"
>
</div>
<div
class=
"code-img fr"
>
<div
class=
"code-img fr"
id=
"code"
>
<img
src=
"/helper/captcha"
alt=
""
>
<a
href=
"javascript:;"
>
换一张
</a>
</div>
...
...
@@ -180,7 +180,8 @@
</div>
<!--footer end-->
<script
type=
"text/javascript"
src=
"/pc/js/jquery.min.js"
></script>
<script
type=
"text/javascript"
src=
"/pc/js/layui/layui.js"
></script>
<script
type=
"text/javascript"
src=
"/pc/js/global.js"
></script>
<script
type=
"text/javascript"
src=
"/pc/js/layui/layui.all.js"
></script>
<script
type=
"text/javascript"
src=
"/pc/js/md5/jquery.md5.js"
></script>
<script
type=
"text/javascript"
src=
"/pc/js/controller/Login.js"
></script>
</body>
...
...
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