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
cf5e77cc
authored
Feb 27, 2019
by
梁建民
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
js
parent
902f40de
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
28 additions
and
61 deletions
public/pc/js/controller/login.js
resources/views/pc/Login.blade.php
public/pc/js/controller/login.js
View file @
cf5e77cc
;
!
function
()
{
;
!
function
()
{
window
.
loginController
=
{
window
.
loginController
=
{
'code'
:
"#code"
,
//验证码
'submit'
:
"#submit"
,
//提交按钮
init
:
function
()
{
init
:
function
()
{
this
.
handleBind
(
this
);
this
.
handleBind
(
this
);
},
},
...
@@ -24,7 +26,7 @@
...
@@ -24,7 +26,7 @@
}
}
return
false
;
return
false
;
},
},
getData
:
function
(
params
,
callback
)
{
getData
:
function
(
params
,
callback
)
{
$
.
ajax
({
$
.
ajax
({
url
:
_URL_
+
'/api/ApiLogin'
,
url
:
_URL_
+
'/api/ApiLogin'
,
type
:
'post'
,
type
:
'post'
,
...
@@ -33,13 +35,14 @@
...
@@ -33,13 +35,14 @@
dataType
:
'json'
,
dataType
:
'json'
,
timeout
:
10000
,
timeout
:
10000
,
success
:
function
(
res
)
{
success
:
function
(
res
)
{
typeof
callback
==
'function'
&&
callback
(
res
);
if
(
resp
.
code
>
0
)
{
/* if (resp.code > 0) {
layer
.
msg
(
resp
.
msg
);
alert(resp.msg)
}
else
{
}
else
{
setCookie('yunxin_token', resp.data)
typeof
callback
==
'function'
&&
callback
(
res
);
window.location.href = "/web/orderList"
}
}*/
},
error
:
function
(
res
)
{
layer
.
msg
(
'网络出现问题,请重试!'
)
}
}
})
})
},
},
...
@@ -64,73 +67,35 @@
...
@@ -64,73 +67,35 @@
return
true
;
return
true
;
},
},
handleBind
:
function
(
opt
)
{
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
))
{
if
(
opt
.
calcForm
(
opt
))
{
opt
.
getData
(
function
(
res
)
{
opt
.
getData
(
function
(
res
)
{
console
.
log
(
res
)
setCookie
(
'yunxin_token'
,
resp
.
data
)
});
window
.
location
.
href
=
"/web/orderList"
});
}
}
});
});
$
(
"input[name='username']"
).
on
(
'blur'
,
function
()
{
$
(
"input[name='username']"
).
on
(
'blur'
,
function
()
{
opt
.
calcForm
(
opt
);
opt
.
calcForm
(
opt
);
});
});
$
(
"input[name='pwd']"
).
on
(
'blur'
,
function
()
{
$
(
"input[name='pwd']"
).
on
(
'blur'
,
function
()
{
opt
.
calcForm
(
opt
);
opt
.
calcForm
(
opt
);
});
});
$
(
"input[name='code']"
).
on
(
'blur'
,
function
()
{
$
(
"input[name='code']"
).
on
(
'blur'
,
function
()
{
opt
.
calcForm
(
opt
);
opt
.
calcForm
(
opt
);
});
});
return
this
;
return
this
;
},
},
},
$
(
function
()
{
},
$
(
function
()
{
loginController
.
init
();
loginController
.
init
();
})
})
}();
}();
\ No newline at end of file
/**
* Created by hcy on 2019/2/19.
*/
var
_URL_
=
"http://yunxin.liexin.com"
;
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
{
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
)
+
";expires="
+
exp
.
toGMTString
();
}
function
getCookie
(
name
)
{
var
arr
,
reg
=
new
RegExp
(
"(^| )"
+
name
+
"=([^;]*)(;|$)"
);
if
(
arr
=
document
.
cookie
.
match
(
reg
))
return
unescape
(
arr
[
2
]);
else
return
null
;
}
resources/views/pc/Login.blade.php
View file @
cf5e77cc
...
@@ -50,7 +50,7 @@
...
@@ -50,7 +50,7 @@
<div
class=
"code-inp fl"
>
<div
class=
"code-inp fl"
>
<input
type=
"text"
placeholder=
"请输入验证码"
name=
"code"
>
<input
type=
"text"
placeholder=
"请输入验证码"
name=
"code"
>
</div>
</div>
<div
class=
"code-img fr"
>
<div
class=
"code-img fr"
id=
"code"
>
<img
src=
"/helper/captcha"
alt=
""
>
<img
src=
"/helper/captcha"
alt=
""
>
<a
href=
"javascript:;"
>
换一张
</a>
<a
href=
"javascript:;"
>
换一张
</a>
</div>
</div>
...
@@ -175,7 +175,8 @@
...
@@ -175,7 +175,8 @@
</div>
</div>
<!--footer end-->
<!--footer end-->
<script
type=
"text/javascript"
src=
"/pc/js/jquery.min.js"
></script>
<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/md5/jquery.md5.js"
></script>
<script
type=
"text/javascript"
src=
"/pc/js/controller/Login.js"
></script>
<script
type=
"text/javascript"
src=
"/pc/js/controller/Login.js"
></script>
</body>
</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