Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
施宇
/
icsales
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
c7bc33b6
authored
Jun 27, 2019
by
梁建民
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
js
parent
a5001727
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
352 additions
and
187 deletions
Application/Home/View/Register/index.html
dist/js/global/api.js
dist/js/global/global.min.js
dist/js/person/register.js
Application/Home/View/Register/index.html
View file @
c7bc33b6
...
@@ -17,7 +17,7 @@
...
@@ -17,7 +17,7 @@
</p>
</p>
<div
class=
"input-wrap"
>
<div
class=
"input-wrap"
>
<i
class=
"iconfont iconjuxing23 va-m"
></i>
<i
class=
"iconfont iconjuxing23 va-m"
></i>
<input
type=
"text"
class=
"w w1 va-m"
placeholder=
"请输入手机号"
>
<input
type=
"text"
class=
"w w1 va-m"
placeholder=
"请输入手机号"
name=
"mobile"
>
<div
class=
"sel lineBlock va-m"
>
<div
class=
"sel lineBlock va-m"
>
<select
name=
"interest"
>
<select
name=
"interest"
>
<option
value=
"0"
>
中国 +86
</option>
<option
value=
"0"
>
中国 +86
</option>
...
@@ -27,21 +27,24 @@
...
@@ -27,21 +27,24 @@
</div>
</div>
<div
class=
"input-wrap"
>
<div
class=
"input-wrap"
>
<i
class=
"iconfont iconpassword va-m"
></i>
<i
class=
"iconfont iconpassword va-m"
></i>
<input
type=
"text"
class=
"w w1 va-m"
placeholder=
"请输入密码"
>
<input
type=
"text"
class=
"w w1 va-m"
placeholder=
"请输入密码"
name=
"password"
>
<i
class=
"iconfont iconjuxing27 va-m lineBlock"
></i>
<i
class=
"iconfont iconjuxing27 va-m lineBlock"
></i>
</div>
</div>
<!--验证码-->
<div
class=
"input-wrap"
id=
"verifiCode"
style=
"display: none"
>
<div
class=
"input-wrap"
id=
"verifiCode"
style=
"display: none"
>
<i
class=
"iconfont iconjuxing26 va-m"
></i>
<i
class=
"iconfont iconjuxing26 va-m"
></i>
<input
type=
"text"
class=
"w w1 va-m"
placeholder=
"请输入验证码"
>
<input
type=
"text"
class=
"w w1 va-m"
name=
"captcha"
placeholder=
"请输入图形验证码"
/>
<img
src=
""
alt=
""
width=
"100"
height=
"30"
class=
"lineBlock va-m codepic"
>
<input
type=
"hidden"
class=
"w w1 va-m"
name=
"captchaUuid"
value=
""
/>
<img
src=
""
alt=
""
width=
"100"
height=
"30"
class=
"lineBlock va-m codepic"
/>
</div>
</div>
<div
class=
"input-wrap"
>
<div
class=
"input-wrap"
>
<i
class=
"iconfont iconjuxing26 va-m"
></i>
<i
class=
"iconfont iconjuxing26 va-m"
></i>
<input
type=
"text"
class=
"w w1 va-m"
placeholder=
"请输入手机号
"
>
<input
type=
"text"
name=
"code"
class=
"w w1 va-m"
placeholder=
"请输入手机验证码
"
>
<input
type=
"button"
name=
"code
"
class=
"lineBlock text va-m"
value=
"发送验证码"
data-type=
"0
"
/>
<input
type=
"button"
name=
"code
text"
class=
"lineBlock text va-m"
value=
"发送验证码
"
/>
</div>
</div>
<input
type=
"hidden"
name=
"code_type"
value=
"1"
>
<div
class=
"btn-wrap"
>
<div
class=
"btn-wrap"
>
<a
href=
"javascript:;"
class=
"btn"
>
注册
</a>
<a
href=
"javascript:;"
class=
"btn"
lay-submit
lay-filter=
"register"
>
注册
</a>
</div>
</div>
<p
class=
"agree"
>
点击注册即默认同意
<a>
《IC业务助手协议》
</a></p>
<p
class=
"agree"
>
点击注册即默认同意
<a>
《IC业务助手协议》
</a></p>
</div>
</div>
...
...
dist/js/global/api.js
View file @
c7bc33b6
...
@@ -18,6 +18,14 @@
...
@@ -18,6 +18,14 @@
(
function
(
window
)
{
(
function
(
window
)
{
apis
=
{
apis
=
{
/**
/**
* 用户注册
*/
authRegister
:
auth_url
+
'/auth/register'
,
/**
* 账号密码登录
*/
authlogin
:
auth_url
+
'/auth/login'
,
/**
* 获取图形验证码接口
* 获取图形验证码接口
*/
*/
captchaInfo
:
auth_url
+
'/captchaInfo'
,
captchaInfo
:
auth_url
+
'/captchaInfo'
,
...
...
dist/js/global/global.min.js
View file @
c7bc33b6
;
!
function
()
{
!
function
()
{
window
.
IcController
=
{
window
.
IcController
=
{
init
:
function
()
{
init
:
function
()
{
this
.
mounted
(
this
).
handleBind
(
this
);
this
.
mounted
(
this
).
handleBind
(
this
);
},
getData
:
function
(
url
,
type
,
param
,
callback
,)
{
var
index
=
layer
.
load
(
1
,
{
offset
:
[
'50%'
,
"50%"
],
shade
:
false
})
var
platform
=
{
source
:
2
,
token
:
''
}
var
params
=
$
.
extend
({},
platform
,
param
);
//跨域模式切换 兼容
var
dataTypeXpx
=
"json"
;
if
((
navigator
.
userAgent
.
indexOf
(
'MSIE'
)
>=
0
)
&&
(
navigator
.
userAgent
.
indexOf
(
'Opera'
)
<
0
))
{
dataTypeXpx
=
"jsonp"
;
}
var
cookieHostname
=
window
.
location
.
hostname
.
split
(
"."
)[
1
]
+
"."
+
window
.
location
.
hostname
.
split
(
"."
)[
2
];
$
.
ajax
({
type
:
type
,
url
:
url
,
data
:
params
,
dataType
:
dataTypeXpx
,
xhrFields
:
{
withCredentials
:
true
},
},
getData
:
function
(
url
,
type
,
param
,
callback
)
{
success
:
function
(
data
)
{
var
index
=
layer
.
load
(
1
,
{
typeof
callback
==
'function'
&&
callback
(
data
);
offset
:
[
'50%'
,
"50%"
],
layer
.
close
(
index
);
shade
:
false
return
false
;
})
var
platform
=
{
source
:
2
,
token
:
'1298dc6f00a017d9e94fc1e57792625d'
}
var
params
=
$
.
extend
({},
platform
,
param
);
//跨域模式切换 兼容
var
dataTypeXpx
=
"json"
;
if
((
navigator
.
userAgent
.
indexOf
(
'MSIE'
)
>=
0
)
&&
(
navigator
.
userAgent
.
indexOf
(
'Opera'
)
<
0
))
{
dataTypeXpx
=
"jsonp"
;
}
var
cookieHostname
=
window
.
location
.
hostname
.
split
(
"."
)[
1
]
+
"."
+
window
.
location
.
hostname
.
split
(
"."
)[
2
];
$
.
ajax
({
type
:
type
,
url
:
url
,
data
:
params
,
dataType
:
dataTypeXpx
,
xhrFields
:
{
withCredentials
:
true
},
success
:
function
(
data
)
{
typeof
callback
==
'function'
&&
callback
(
data
);
layer
.
close
(
index
);
return
false
;
},
error
:
function
()
{
layer
.
close
(
index
);
layer
.
msg
(
'网络出现问题,请重试!'
);
return
false
;
}
});
},
mounted
:
function
(
opt
)
{
//导航栏
var
isShow
=
$
(
'.xbj_li'
).
find
(
'dl'
).
css
(
'display'
);
if
(
isShow
==
'none'
)
{
$
(
'.xbj_li'
).
find
(
'.li_right'
).
removeClass
(
'iconjuxing15'
).
addClass
(
'iconjuxing12'
)
}
else
{
$
(
'.xbj_li'
).
find
(
'.li_right'
).
removeClass
(
'iconjuxing12'
).
addClass
(
'iconjuxing15'
)
}
return
this
;
},
handleBind
:
function
(
opt
)
{
//导航栏
$
(
'.xbj_li'
).
on
(
'click'
,
function
()
{
var
isShow
=
$
(
this
).
find
(
'dl'
).
css
(
'display'
);
if
(
isShow
==
'none'
)
{
$
(
this
).
find
(
'dl'
).
slideDown
();
$
(
'.xbj_li'
).
find
(
'.li_right'
).
removeClass
(
'iconjuxing12'
).
addClass
(
'iconjuxing15'
)
}
else
{
$
(
this
).
find
(
'dl'
).
slideUp
();
$
(
'.xbj_li'
).
find
(
'.li_right'
).
removeClass
(
'iconjuxing15'
).
addClass
(
'iconjuxing12'
)
}
$
})
return
this
;
},
},
},
$
(
function
()
{
error
:
function
()
{
IcController
.
init
();
layer
.
close
(
index
);
})
layer
.
msg
(
'网络出现问题,请重试!'
);
return
false
;
}
});
},
mounted
:
function
(
opt
)
{
//导航栏
var
isShow
=
$
(
'.xbj_li'
).
find
(
'dl'
).
css
(
'display'
);
if
(
isShow
==
'none'
)
{
$
(
'.xbj_li'
).
find
(
'.li_right'
).
removeClass
(
'iconjuxing15'
).
addClass
(
'iconjuxing12'
)
}
else
{
$
(
'.xbj_li'
).
find
(
'.li_right'
).
removeClass
(
'iconjuxing12'
).
addClass
(
'iconjuxing15'
)
}
return
this
;
},
handleBind
:
function
(
opt
)
{
//导航栏
$
(
'.xbj_li'
).
on
(
'click'
,
function
()
{
var
isShow
=
$
(
this
).
find
(
'dl'
).
css
(
'display'
);
if
(
isShow
==
'none'
)
{
$
(
this
).
find
(
'dl'
).
slideDown
();
$
(
'.xbj_li'
).
find
(
'.li_right'
).
removeClass
(
'iconjuxing12'
).
addClass
(
'iconjuxing15'
)
}
else
{
$
(
this
).
find
(
'dl'
).
slideUp
();
$
(
'.xbj_li'
).
find
(
'.li_right'
).
removeClass
(
'iconjuxing15'
).
addClass
(
'iconjuxing12'
)
}
$
})
return
this
;
},
},
$
(
function
()
{
IcController
.
init
();
})
}();
}();
//工具类
//工具类
(
function
(
window
)
{
(
function
(
window
)
{
Util
=
{
Util
=
{
/**
/**
* 设置cookie
* 设置cookie
* @param name
* @param name
* @param value
* @param value
* @param time
* @param time
* @param domain
* @param domain
* @returns {boolean}
* @returns {boolean}
*/
*/
setCookie
:
function
(
name
,
value
,
time
)
{
setCookie
:
function
(
name
,
value
,
time
)
{
// domain = domain ? ";domain=" + domain : "";
// domain = domain ? ";domain=" + domain : "";
var
Days
=
time
;
var
Days
=
time
;
var
exp
=
new
Date
();
var
exp
=
new
Date
();
exp
.
setTime
(
exp
.
getTime
()
+
Days
*
24
*
60
*
60
*
1000
);
exp
.
setTime
(
exp
.
getTime
()
+
Days
*
24
*
60
*
60
*
1000
);
document
.
cookie
=
name
+
"="
+
value
+
";expires="
+
exp
.
toGMTString
();
document
.
cookie
=
name
+
"="
+
value
+
";expires="
+
exp
.
toGMTString
();
return
true
;
return
true
;
},
},
/**
/**
* 获取cookie
* 获取cookie
* @param name
* @param name
* @returns {*}
* @returns {*}
*/
*/
getCookie
:
function
(
name
)
{
getCookie
:
function
(
name
)
{
var
strCookie
=
document
.
cookie
;
var
strCookie
=
document
.
cookie
;
var
arrCookie
=
strCookie
.
split
(
"; "
);
var
arrCookie
=
strCookie
.
split
(
"; "
);
for
(
var
i
=
0
;
i
<
arrCookie
.
length
;
i
++
)
{
for
(
var
i
=
0
;
i
<
arrCookie
.
length
;
i
++
)
{
var
arr
=
arrCookie
[
i
].
split
(
"="
);
var
arr
=
arrCookie
[
i
].
split
(
"="
);
if
(
name
==
arr
[
0
])
{
if
(
name
==
arr
[
0
])
{
return
arr
[
1
];
return
arr
[
1
];
}
}
return
""
;
},
/**
* 删除cookie
* @param name
*/
delCookie
:
function
(
name
)
{
var
exp
=
new
Date
();
exp
.
setTime
(
exp
.
getTime
()
-
1
);
var
cval
=
this
.
getCookie
(
name
);
if
(
cval
!=
null
)
document
.
cookie
=
name
+
"="
+
cval
+
";expires="
+
exp
.
toGMTString
();
},
/**
* 获取参数
* @param value
* @returns {*}
*/
getRequest
:
function
(
value
)
{
if
(
window
.
location
.
pathname
==
"/s/"
)
{
var
url
=
unescape
(
location
.
search
);
}
else
{
var
url
=
decodeURI
(
location
.
search
);
}
var
object
=
{};
if
(
url
.
indexOf
(
"?"
)
!=
-
1
)
{
var
str
=
url
.
substr
(
1
);
var
strs
=
str
.
split
(
"&"
);
for
(
var
i
=
0
;
i
<
strs
.
length
;
i
++
)
{
object
[
strs
[
i
].
split
(
"="
)[
0
]]
=
strs
[
i
].
split
(
"="
)[
1
]
}
}
return
object
[
value
];
},
/**
* 根据参数获取时间
* @param val
* @returns {string}
*/
getDateStr
:
function
(
val
)
{
var
dd
=
new
Date
();
dd
.
setDate
(
dd
.
getDate
()
+
val
);
var
y
=
dd
.
getFullYear
();
var
m
=
(
dd
.
getMonth
()
+
1
)
<
10
?
"0"
+
(
dd
.
getMonth
()
+
1
)
:
(
dd
.
getMonth
()
+
1
);
var
d
=
dd
.
getDate
()
<
10
?
"0"
+
dd
.
getDate
()
:
dd
.
getDate
();
return
y
+
"-"
+
m
+
"-"
+
d
;
}
}
};
}
if
(
typeof
define
===
"function"
&&
define
.
amd
)
{
return
""
;
return
Util
;
},
}
else
{
/**
window
.
Util
=
Util
;
* 删除cookie
* @param name
*/
delCookie
:
function
(
name
)
{
var
exp
=
new
Date
();
exp
.
setTime
(
exp
.
getTime
()
-
1
);
var
cval
=
this
.
getCookie
(
name
);
if
(
cval
!=
null
)
document
.
cookie
=
name
+
"="
+
cval
+
";expires="
+
exp
.
toGMTString
();
},
/**
* 获取参数
* @param value
* @returns {*}
*/
getRequest
:
function
(
value
)
{
if
(
window
.
location
.
pathname
==
"/s/"
)
{
var
url
=
unescape
(
location
.
search
);
}
else
{
var
url
=
decodeURI
(
location
.
search
);
}
var
object
=
{};
if
(
url
.
indexOf
(
"?"
)
!=
-
1
)
{
var
str
=
url
.
substr
(
1
);
var
strs
=
str
.
split
(
"&"
);
for
(
var
i
=
0
;
i
<
strs
.
length
;
i
++
)
{
object
[
strs
[
i
].
split
(
"="
)[
0
]]
=
strs
[
i
].
split
(
"="
)[
1
]
}
}
return
object
[
value
];
},
/**
* 根据参数获取时间
* @param val
* @returns {string}
*/
getDateStr
:
function
(
val
)
{
var
dd
=
new
Date
();
dd
.
setDate
(
dd
.
getDate
()
+
val
);
var
y
=
dd
.
getFullYear
();
var
m
=
(
dd
.
getMonth
()
+
1
)
<
10
?
"0"
+
(
dd
.
getMonth
()
+
1
)
:
(
dd
.
getMonth
()
+
1
);
var
d
=
dd
.
getDate
()
<
10
?
"0"
+
dd
.
getDate
()
:
dd
.
getDate
();
return
y
+
"-"
+
m
+
"-"
+
d
;
}
}
};
if
(
typeof
define
===
"function"
&&
define
.
amd
)
{
return
Util
;
}
else
{
window
.
Util
=
Util
;
}
})(
window
);
})(
window
);
//form序列化json
//form序列化json
$
.
fn
.
serializeJson
=
function
()
{
$
.
fn
.
serializeJson
=
function
()
{
var
serializeObj
=
{};
var
serializeObj
=
{};
var
array
=
this
.
serializeArray
();
var
array
=
this
.
serializeArray
();
var
str
=
this
.
serialize
();
var
str
=
this
.
serialize
();
$
(
array
).
each
(
function
()
{
$
(
array
).
each
(
function
()
{
if
(
serializeObj
[
this
.
name
])
{
if
(
serializeObj
[
this
.
name
])
{
if
(
$
.
isArray
(
serializeObj
[
this
.
name
]))
{
if
(
$
.
isArray
(
serializeObj
[
this
.
name
]))
{
serializeObj
[
this
.
name
].
push
(
this
.
value
);
serializeObj
[
this
.
name
].
push
(
this
.
value
);
}
else
{
}
else
{
serializeObj
[
this
.
name
]
=
[
serializeObj
[
this
.
name
],
this
.
value
];
serializeObj
[
this
.
name
]
=
[
serializeObj
[
this
.
name
],
this
.
value
];
}
}
}
else
{
}
else
{
serializeObj
[
this
.
name
]
=
this
.
value
;
serializeObj
[
this
.
name
]
=
this
.
value
;
}
}
});
});
return
serializeObj
;
return
serializeObj
;
};
};
\ No newline at end of file
dist/js/person/register.js
View file @
c7bc33b6
!
function
()
{
!
function
()
{
window
.
RegisterController
=
{
window
.
RegisterController
=
{
isClick
:
false
,
init
:
function
()
{
init
:
function
()
{
this
.
created
(
this
).
mounted
(
this
).
handleBind
(
this
);
this
.
created
(
this
).
mounted
(
this
).
handleBind
(
this
);
},
},
...
@@ -12,25 +13,178 @@
...
@@ -12,25 +13,178 @@
return
this
;
return
this
;
},
},
getCode
:
function
(
opt
,
type
,
params
)
{
var
$verifiCode
=
$
(
"#verifiCode"
),
$code
=
$
(
'input[name="code"]'
),
$codetext
=
$
(
'input[name="codetext"]'
),
$codepic
=
$
(
'.codepic'
);
if
(
type
==
'captchaInfo'
)
{
//获取验证码
IcController
.
getData
(
apis
.
captchaInfo
,
'GET'
,
null
,
function
(
res
)
{
if
(
res
.
captchaUrl
)
{
$verifiCode
.
find
(
'img'
).
attr
(
'src'
,
res
.
captchaUrl
);
$verifiCode
.
find
(
'input[name="captchaUuid"]'
).
val
(
res
.
captchaUuid
);
$verifiCode
.
show
();
$verifiCode
.
find
(
'input[name="captcha"]'
).
focus
();
}
});
}
else
if
(
type
==
'mobile'
)
{
//获取短信验证码
IcController
.
getData
(
apis
.
getRegistCode
,
'POST'
,
params
,
function
(
res
)
{
if
(
res
.
err_code
==
0
)
{
$code
.
focus
();
//开始倒计时
var
second
=
60
,
timer
=
null
;
timer
=
setInterval
(
function
()
{
second
-=
1
;
if
(
second
>
0
)
{
$codetext
.
val
(
second
+
'秒'
);
$codetext
.
attr
(
'disabled'
,
"true"
);
}
else
{
clearInterval
(
timer
);
$codetext
.
removeAttr
(
'disabled'
);
$codetext
.
val
(
'重新获取'
);
$codepic
.
trigger
(
'click'
);
}
},
1000
);
}
else
{
layer
.
msg
(
res
.
err_msg
);
}
});
}
},
calcForm
:
function
(
opt
)
{
var
$mobile
=
$
(
'input[name="mobile"]'
),
$password
=
$
(
'input[name="password"]'
),
$code
=
$
(
'input[name="code"]'
);
if
(
!
$mobile
.
val
())
{
$mobile
.
parent
(
'.input-wrap'
).
addClass
(
'error'
);
return
false
;
}
if
(
!
$password
.
val
())
{
$password
.
parent
(
'.input-wrap'
).
addClass
(
'error'
);
return
false
;
}
if
(
!
$code
.
val
())
{
$code
.
parent
(
'.input-wrap'
).
addClass
(
'error'
);
return
false
;
}
$
(
'.error'
).
removeClass
(
'error'
);
return
true
;
},
handleBind
:
function
(
opt
)
{
handleBind
:
function
(
opt
)
{
//发送验证码
//发送验证码
$
(
document
).
on
(
'click'
,
'input[name="code"]'
,
function
()
{
$
(
document
).
on
(
'click'
,
'input[name="code
text
"]'
,
function
()
{
//判断是否输入验证码
var
$verifiCode
=
$
(
"#verifiCode"
),
var
captchaInfo
=
$
(
this
).
attr
(
'data-type'
);
captchaUuid
=
$verifiCode
.
find
(
'input[name="captchaUuid"]'
).
val
(),
captcha
=
$verifiCode
.
find
(
'input[name="captcha"]'
).
val
(),
mobile
=
$
(
'input[name="mobile"]'
).
val
();
captchaInfo
==
0
?
$
(
this
).
attr
(
'data-type'
,
1
)
:
''
;
//判断是否有图形验证码id
if
(
!
captchaUuid
)
{
IcController
.
getData
(
apis
.
captchaInfo
,
'GET'
,
null
,
function
(
res
)
{
opt
.
getCode
(
opt
,
'captchaInfo'
);
console
.
log
(
res
)
}
else
{
})
//获取短信验证码
var
params
=
{
captchaUuid
:
captchaUuid
,
captcha
:
captcha
,
mobile
:
mobile
,
code_type
:
1
}
opt
.
getCode
(
opt
,
'mobile'
,
params
);
}
});
//更新验证码
$
(
document
).
on
(
'click'
,
'.codepic'
,
function
()
{
opt
.
getCode
(
opt
,
'captchaInfo'
);
});
//注册提交
layui
.
form
.
on
(
'submit(register)'
,
function
(
data
)
{
if
(
opt
.
calcForm
())
{
$
(
data
.
elem
).
addClass
(
"layui-btn-disabled"
);
if
(
!
opt
.
isClick
)
{
opt
.
isClick
=
true
;
IcController
.
getData
(
apis
.
authRegister
,
'POST'
,
data
.
field
,
function
(
res
)
{
if
(
res
.
err_msg
==
0
)
{
console
.
log
(
res
)
}
else
{
layer
.
msg
(
res
.
err_msg
);
opt
.
isClick
=
false
;
$
(
data
.
elem
).
removeClass
(
"layui-btn-disabled"
);
}
});
}
}
else
{
}
});
});
return
this
;
return
this
;
...
...
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