Skip to content
项目
群组
代码片段
帮助
正在加载...
帮助
提交反馈
为 GitLab 提交贡献
登录
切换导航
P
pica.cloud.web-education-admin
项目
项目
详情
动态
版本
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
统计图
成员
成员
收起侧边栏
Close sidebar
动态
分支图
统计图
提交
打开侧边栏
com.pica.cloud.education.frontend
pica.cloud.web-education-admin
提交
034361e3
提交
034361e3
编写于
10月 09, 2019
作者:
chengxiang.li
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
update 获取 验证码、重设密码、登录
上级
3b61d45b
变更
3
隐藏空白字符变更
内嵌
并排
正在显示
3 个修改的文件
包含
170 行增加
和
73 行删除
+170
-73
accountApi.js
src/utils/account/accountApi.js
+20
-0
mixins.js
src/utils/mixins.js
+1
-1
login.vue
src/views/login.vue
+149
-72
未找到文件。
src/utils/account/accountApi.js
浏览文件 @
034361e3
...
...
@@ -30,6 +30,26 @@ export const handleLogin = data => {
})
}
// 忘记密码时 获取验证码
export
const
handleGetAuthCode
=
data
=>
{
return
fetch
({
headers
,
url
:
getBaseUrl
(
`account/authCode`
),
method
:
'post'
,
data
:
data
,
description
:
'获取验证码'
,
})
}
// 重设密码
export
const
handleResetPWD
=
data
=>
{
return
fetch
({
headers
,
url
:
getBaseUrl
(
`account/password/reset`
),
method
:
'post'
,
data
:
data
,
description
:
'忘记密码之重设密码'
,
})
}
src/utils/mixins.js
浏览文件 @
034361e3
...
...
@@ -71,7 +71,7 @@ module.exports = {
key
:
''
,
content
:
''
};
// 开发阶段后端接口还没处理加密,先传 原始json数据
// 开发阶段后端接口还没处理加密,先传 原始json数据
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 后端加密OK后 再用下面的注释代码
params
.
content
=
content
;
// params.content = this.AesEncrypt(content, aesKey);
params
.
key
=
this
.
RsaEncrypt
(
aesKey
,
pubKey
);
...
...
src/views/login.vue
浏览文件 @
034361e3
...
...
@@ -93,7 +93,7 @@
import
{
ssoLogin2
,
getDeviceInfo
}
from
'@/utils/utils'
;
import
{
mapActions
}
from
'vuex'
;
import
md5
from
'js-md5'
;
import
{
handleLogin
}
from
'@/utils/account/accountApi'
;
import
{
handleLogin
,
handleGetAuthCode
,
handleResetPWD
}
from
'@/utils/account/accountApi'
;
export
default
{
...
...
@@ -206,47 +206,79 @@
}
// ------------------------ Old Start-------------------------------
let
params
=
{
receiver
:
this
.
resetPassword
.
mobile
,
token
:
localStorage
.
getItem
(
"token"
),
flag
:
2
,
//1表示注册 2表示忘记密码
gaoFlag
:
1
,
//1表示saas 2表示高血压项目
deviceInfo
:
getDeviceInfo
()
};
this
.
saasPOST
(
'/mobiles/sendCaptchaNew'
,
params
,
'application/x-www-form-urlencoded;charset=UTF-8'
).
then
(
data
=>
{
if
(
data
.
mobileFlag
==
2
)
{
this
.
resetMobileErr
=
true
;
this
.
resetMobileErrText
=
'该手机号尚未注册!'
;
return
;
}
else
{
const
TIME_COUNT
=
60
;
if
(
!
this
.
timer
)
{
this
.
countDown
=
TIME_COUNT
;
this
.
timer
=
setInterval
(()
=>
{
if
(
this
.
countDown
>
0
&&
this
.
countDown
<=
TIME_COUNT
)
{
this
.
countDown
--
;
}
else
{
this
.
countDown
=
0
;
clearInterval
(
this
.
timer
);
this
.
timer
=
null
;
}
},
1000
)
}
}
//
let params = {
//
receiver: this.resetPassword.mobile,
//
token: localStorage.getItem("token"),
//
flag: 2, //1表示注册 2表示忘记密码
//
gaoFlag: 1 ,//1表示saas 2表示高血压项目
//
deviceInfo: getDeviceInfo()
//
};
//
this.saasPOST('/mobiles/sendCaptchaNew',params, 'application/x-www-form-urlencoded;charset=UTF-8').then(data => {
//
if (data.mobileFlag == 2) {
//
this.resetMobileErr = true;
//
this.resetMobileErrText = '该手机号尚未注册!';
//
return;
//
} else {
//
const TIME_COUNT = 60;
//
if (!this.timer) {
//
this.countDown = TIME_COUNT;
//
this.timer = setInterval(() => {
//
if (this.countDown > 0 && this.countDown
<=
TIME_COUNT
)
{
//
this.countDown--;
//
} else {
//
this.countDown = 0;
//
clearInterval(this.timer);
//
this.timer = null;
//
}
//
}, 1000)
//
}
//
}
}).
catch
(
err
=>
{
this
.
$message
({
message
:
'系统错误!'
,
type
:
'error'
});
})
//
}).catch( err => {
//
this.$message({
//
message: '系统错误!',
//
type: 'error'
//
});
//
})
// ------------------------ Old End-------------------------------
// ------------------------ New Start-------------------------------
// let params = {
// mobilePhone: this.resetPassword.mobile,
// flag: 4, // 4 重置密码
// };
let
paramsObj
=
{
mobile
:
this
.
resetPassword
.
mobile
,
flag
:
4
,
// 4 重置密码
};
let
getAuthCodeCB
=
params
=>
{
handleGetAuthCode
(
params
).
then
(
res
=>
{
console
.
log
(
'>>>>>>login res '
,
res
)
if
(
res
.
code
!=
'000000'
)
{
this
.
resetMobileErr
=
true
;
this
.
resetMobileErrText
=
res
.
message
;
return
;
}
else
{
const
TIME_COUNT
=
60
;
if
(
!
this
.
timer
)
{
this
.
countDown
=
TIME_COUNT
;
this
.
timer
=
setInterval
(()
=>
{
if
(
this
.
countDown
>
0
&&
this
.
countDown
<=
TIME_COUNT
)
{
this
.
countDown
--
;
}
else
{
this
.
countDown
=
0
;
clearInterval
(
this
.
timer
);
this
.
timer
=
null
;
}
},
1000
)
}
}
}).
catch
(
err
=>
{
this
.
$message
({
message
:
'系统错误!'
,
type
:
'error'
});
})
};
this
.
sendEncryptRequest
(
paramsObj
,
getAuthCodeCB
)
...
...
@@ -332,22 +364,22 @@
password
:
md5
(
this
.
loginData
.
password
).
toUpperCase
(),
};
let
loginCB
=
params
=>
{
handleLogin
(
params
).
then
(
data
=>
{
console
.
log
(
'>>>>>>login res '
,
data
)
if
(
data
.
code
==
'216509'
||
data
.
code
==
'216502'
||
data
.
code
==
'100001'
)
{
handleLogin
(
params
).
then
(
res
=>
{
console
.
log
(
'>>>>>>login res '
,
res
)
if
(
res
.
code
==
'216509'
||
res
.
code
==
'216502'
||
res
.
code
==
'100001'
)
{
this
.
loginPWDErr
=
true
;
this
.
loginPWDErrText
=
'手机号或密码不正确!'
;
return
;
}
if
(
data
.
code
==
'216508'
)
{
if
(
res
.
code
==
'216508'
)
{
this
.
loginMobileErr
=
true
;
this
.
loginMobileErrText
=
'该手机号尚未注册!'
;
return
;
}
localStorage
.
setItem
(
"token"
,
data
.
token
);
vm
.
changeToken
(
data
.
token
)
localStorage
.
setItem
(
"storageToken"
,
data
.
token
);
debugger
;
localStorage
.
setItem
(
"token"
,
res
.
data
.
token
);
vm
.
changeToken
(
res
.
data
.
token
)
localStorage
.
setItem
(
"storageToken"
,
res
.
data
.
token
);
this
.
$router
.
push
(
'/'
);
}).
catch
(
err
=>
{
...
...
@@ -404,39 +436,84 @@
||!
this
.
checkPwdVal
(
this
.
resetPassword
.
password
))
{
return
;
}
let
para
=
{
// ------------------------ Old Start-------------------------------
// ------------------------ Old End-------------------------------
// ------------------------ New Start-------------------------------
// ------------------------ New End-------------------------------
// ------------------------ Old Start-------------------------------
// let para = {
// mobile: this.resetPassword.mobile,
// authCode: this.resetPassword.authCode
// }
// this.saasGET('/mobiles/checkCaptcha',para).then(data => {
// let req = {
// mobile: this.resetPassword.mobile,
// password: md5(this.resetPassword.password).toUpperCase()
// }
// this.saasPUT('/login/password',req).then(data => {
// this.$message({
// message: '重设密码成功,请重新登录!',
// type: 'success'
// });
// setTimeout(function () {
// window.location.reload();
// }, 2000)
// }).catch( err => {
// this.$message({
// message: '系统错误!',
// type: 'error'
// });
// })
// }).catch( err => {
// /*this.$message({
// message: '验证码已过期或不存在!',
// type: 'error'
// });*/
// this.resetCodeErr = true;
// this.resetCodeErrText = '验证码已过期或不存在';
// return;
// })
// ------------------------ Old End-------------------------------
// ------------------------ New Start-------------------------------
let
paramsObj
=
{
mobile
:
this
.
resetPassword
.
mobile
,
authCode
:
this
.
resetPassword
.
authCode
}
this
.
saasGET
(
'/mobiles/checkCaptcha'
,
para
).
then
(
data
=>
{
let
req
=
{
mobile
:
this
.
resetPassword
.
mobile
,
password
:
md5
(
this
.
resetPassword
.
password
).
toUpperCase
()
}
this
.
saasPUT
(
'/login/password'
,
req
).
then
(
data
=>
{
this
.
$message
({
message
:
'重设密码成功,请重新登录!'
,
type
:
'success'
});
setTimeout
(
function
()
{
window
.
location
.
reload
();
},
2000
)
}).
catch
(
err
=>
{
authCode
:
this
.
resetPassword
.
authCode
,
password
:
md5
(
this
.
resetPassword
.
password
).
toUpperCase
()
};
let
resetPWDCB
=
params
=>
{
handleResetPWD
(
params
).
then
(
res
=>
{
console
.
log
(
'>>>>>>login res '
,
res
)
if
(
res
&&
res
.
code
==
'000000'
){
this
.
$message
({
message
:
'重设密码成功,请重新登录!'
,
type
:
'success'
});
setTimeout
(
function
()
{
window
.
location
.
reload
();
},
2000
)
}
else
{
this
.
$message
({
message
:
(
res
&&
res
.
message
)
||
'系统错误!'
,
type
:
'error'
});
}
}).
catch
(
err
=>
{
this
.
$message
({
message
:
'系统错误!'
,
type
:
'error'
});
})
};
this
.
sendEncryptRequest
(
paramsObj
,
resetPWDCB
)
}).
catch
(
err
=>
{
/*this.$message({
message: '验证码已过期或不存在!',
type: 'error'
});*/
this
.
resetCodeErr
=
true
;
this
.
resetCodeErrText
=
'验证码已过期或不存在'
;
return
;
})
// ------------------------ New End-------------------------------
}
}
}
...
...
写
预览
Markdown
格式
0%
请重试
or
附加一个文件
附加文件
取消
您添加了
0
人
到此讨论。请谨慎行事。
先完成此消息的编辑!
取消
想要评论请
注册
或
登录