Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
肖康
/
cloudSystem
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
682e9879
authored
May 11, 2021
by
liangjianmin
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
js
parent
3997be88
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
73 additions
and
55 deletions
src/ajax/index.js
src/main.js
src/views/User/login.vue
src/ajax/index.js
View file @
682e9879
...
...
@@ -32,15 +32,11 @@ export const http = (method, url, param) => {
method
:
method
,
transformRequest
:
[
function
(
param
)
{
return
qs
.
stringify
(
param
);
}],
headers
:
{
'X-Requested-With'
:
'XMLHttpRequest'
}
}]
};
// post请求时需要设定Content-Type
if
(
method
===
'post'
)
{
config
.
headers
[
'Content-Type'
]
=
'application/x-www-form-urlencoded; charset=UTF-8'
;
config
.
data
=
param
;
}
else
if
(
method
===
'get'
)
{
config
.
params
=
param
;
...
...
src/main.js
View file @
682e9879
...
...
@@ -22,45 +22,46 @@ Vue.use(directive);
//处理顶部导航TAB
router
.
afterEach
((
to
,
from
,
next
)
=>
{
if
(
to
.
path
==
"/"
){
return
}
let
tabOldArr
=
sessionStorage
.
getItem
(
'tabs'
);
let
tabOldJson
;
let
tabNewJson
=
[];
if
(
tabOldArr
){
tabOldJson
=
JSON
.
parse
(
tabOldArr
);
for
(
var
i
=
0
;
i
<
tabOldJson
.
length
;
i
++
){
tabNewJson
.
push
(
JSON
.
stringify
(
tabOldJson
[
i
]))
}
if
(
tabNewJson
.
indexOf
(
JSON
.
stringify
({
path
:
to
.
path
,
title
:
to
.
meta
.
title
}))
==-
1
){
tabOldJson
.
push
({
path
:
to
.
path
,
title
:
to
.
meta
.
title
})
}
}
else
{
tabOldJson
=
[
{
path
:
to
.
path
,
title
:
to
.
meta
.
title
}
]
if
(
to
.
path
==
"/"
)
{
return
}
let
tabOldArr
=
sessionStorage
.
getItem
(
'tabs'
);
let
tabOldJson
;
let
tabNewJson
=
[];
if
(
tabOldArr
)
{
tabOldJson
=
JSON
.
parse
(
tabOldArr
);
for
(
var
i
=
0
;
i
<
tabOldJson
.
length
;
i
++
)
{
tabNewJson
.
push
(
JSON
.
stringify
(
tabOldJson
[
i
]))
}
if
(
tabOldJson
){
sessionStorage
.
setItem
(
'tabs'
,
JSON
.
stringify
(
tabOldJson
));
if
(
tabNewJson
.
indexOf
(
JSON
.
stringify
({
path
:
to
.
path
,
title
:
to
.
meta
.
title
}))
==
-
1
)
{
tabOldJson
.
push
({
path
:
to
.
path
,
title
:
to
.
meta
.
title
})
}
}
else
{
tabOldJson
=
[
{
path
:
to
.
path
,
title
:
to
.
meta
.
title
}
]
}
if
(
tabOldJson
)
{
sessionStorage
.
setItem
(
'tabs'
,
JSON
.
stringify
(
tabOldJson
));
}
});
axios
.
interceptors
.
response
.
use
(
res
=>
{
return
res
;
},
error
=>
{
console
.
log
(
'error
'
);
Message
(
'网络出现问题,请检查网络
'
);
return
Promise
.
reject
(
new
Error
(
error
))
})
...
...
src/views/User/login.vue
View file @
682e9879
...
...
@@ -20,7 +20,7 @@
<div
class=
"bar"
>
<div
class=
"input-box lbBox"
>
<i
class=
"iconfont iconuser va-m"
></i>
<input
type=
"text"
placeholder=
"请输入手机号"
class=
"inp va-m"
v-model=
"form.
usernam
e"
/>
<input
type=
"text"
placeholder=
"请输入手机号"
class=
"inp va-m"
v-model=
"form.
mobil
e"
/>
<b
class=
"lineBlock emptys"
></b>
</div>
<div
class=
"input-box lbBox"
>
...
...
@@ -31,10 +31,10 @@
</div>
<div
class=
"code-box clr"
>
<div
class=
"fl l"
>
<input
type=
"text"
placeholder=
"请输入验证码"
v-model=
"form.c
ode
"
/>
<input
type=
"text"
placeholder=
"请输入验证码"
v-model=
"form.c
aptcha
"
/>
</div>
<a
class=
"fr r"
href=
"javascript:;"
>
<img
src=
"https://www.ichunt.com/v3/public/verify
"
alt=
""
>
<a
class=
"fr r"
href=
"javascript:;"
title=
"换一张"
@
click=
"updateCp()"
>
<img
:src=
"imgSrc
"
alt=
""
>
</a>
</div>
<p
class=
"text"
>
...
...
@@ -50,7 +50,7 @@
</
template
>
<
script
>
import
Vue
from
'vue'
;
import
{
Loading
}
from
'element-ui'
;
import
{
Loading
,
Message
}
from
'element-ui'
;
export
default
{
name
:
"index"
,
...
...
@@ -62,10 +62,12 @@
status1
:
false
,
status2
:
false
,
loading
:
true
,
imgSrc
:
''
,
form
:
{
usernam
e
:
''
,
mobil
e
:
''
,
password
:
''
,
code
:
''
captcha
:
''
,
captcha_key
:
''
}
};
},
...
...
@@ -74,11 +76,11 @@
deep
:
true
,
handler
:
function
(
newV
,
oldV
)
{
let
obj
=
newV
;
if
(
obj
.
c
ode
||
obj
.
password
||
obj
.
usernam
e
)
{
if
(
obj
.
c
aptcha
||
obj
.
password
||
obj
.
mobil
e
)
{
this
.
errror_text
=
''
;
}
if
(
obj
.
c
ode
&&
obj
.
password
&&
obj
.
usernam
e
)
{
if
(
obj
.
c
aptcha
&&
obj
.
password
&&
obj
.
mobil
e
)
{
this
.
active
=
true
;
}
else
{
this
.
active
=
false
;
...
...
@@ -87,24 +89,29 @@
}
},
created
()
{
this
.
$http
(
'get'
,
"/auth/cp"
,
{}).
then
(
res
=>
{
console
.
log
(
res
)
}).
catch
(
err
=>
{
console
.
log
(
err
.
message
);
})
this
.
updateCp
();
Message
(
'2121'
);
},
computed
:
{},
methods
:
{
updateCp
()
{
this
.
$http
(
'get'
,
"/auth/cp"
).
then
(
res
=>
{
this
.
imgSrc
=
res
.
data
.
data
.
url
.
img
;
this
.
form
.
captcha_key
=
res
.
data
.
data
.
url
.
key
;
}).
catch
(
err
=>
{
console
.
log
(
err
.
message
);
})
},
changePwd
:
function
()
{
this
.
pwdFlag
=
!
this
.
pwdFlag
;
},
submit
()
{
var
myreg
=
/^
[
1
][
3,4,5,7,8
][
0-9
]{9}
$/
;
if
(
!
this
.
form
.
usernam
e
)
{
if
(
!
this
.
form
.
mobil
e
)
{
this
.
errror_text
=
'请输入手机号'
;
return
false
;
}
if
(
!
myreg
.
test
(
this
.
form
.
usernam
e
))
{
if
(
!
myreg
.
test
(
this
.
form
.
mobil
e
))
{
this
.
errror_text
=
'请输入正确的手机号'
;
return
false
;
}
...
...
@@ -113,7 +120,7 @@
this
.
errror_text
=
'请输入登录密码'
;
return
false
;
}
if
(
!
this
.
form
.
c
ode
)
{
if
(
!
this
.
form
.
c
aptcha
)
{
this
.
errror_text
=
'请输入验证码'
;
return
false
;
}
...
...
@@ -122,9 +129,23 @@
background
:
'rgba(0, 0, 0, 0)'
});
setTimeout
(()
=>
{
this
.
$http
(
'post'
,
"/auth/login"
,
{
mobile
:
this
.
form
.
mobile
,
password
:
this
.
form
.
password
,
captcha
:
this
.
form
.
captcha
,
captcha_key
:
this
.
form
.
captcha_key
}).
then
(
data
=>
{
loadingInstance
.
close
();
},
2000
);
let
res
=
data
.
data
;
if
(
res
.
err_code
===
0
)
{
}
else
{
Message
(
res
.
err_msg
);
}
}).
catch
(
err
=>
{
loadingInstance
.
close
();
});
}
}
...
...
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