Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
L
learn-online-pc
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
EzijingWeb
learn-online-pc
Commits
f4f5d744
提交
f4f5d744
authored
4月 09, 2020
作者:
lihuihui
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
添加修改密码
上级
6dd65782
隐藏空白字符变更
内嵌
并排
正在显示
4 个修改的文件
包含
121 行增加
和
2 行删除
+121
-2
index.js
client/src/action/index.js
+24
-0
sidebar.vue
client/src/components/learnSysLayout/sidebar.vue
+1
-1
setPwd.vue
client/src/pages/other/setPwd.vue
+94
-0
routes.js
client/src/router/routes.js
+2
-1
没有找到文件。
client/src/action/index.js
浏览文件 @
f4f5d744
...
...
@@ -24,4 +24,28 @@ const cAction = {
Feedback
}
/**
* 统一处理接口返回请求
* 由于使用 axios ,返回 then + finally 可能存在 部分浏览器不支持情况
* 需要 添加兼容
* @param {[object]} obj 整个对象
* @param {[object]} obj.component 当前调用组件对象 传过来,必传
* @param {[string]} obj.actionName action名字,必传
* @param {[string]} obj.functionName action类中的方法名,必传
* @param {[object]} obj.data 传输数据,必传
* @param {[function]} obj.thenCallback 异步成功返回回调值,必传
* @param {[function]} obj.catchCallback 异常抛出时,返回错误抓取回调值,必传
* @param {[function]} obj.finallyCallback 最终finally回调,必传
*/
export
const
request
=
(
obj
)
=>
{
cAction
[
obj
.
actionName
][
obj
.
functionName
](
obj
.
data
).
then
(
res
=>
{
obj
.
thenCallback
(
res
)
}).
catch
(
e
=>
{
obj
.
component
.
$message
.
error
(
e
.
message
)
obj
.
catchCallback
(
e
)
}).
finally
(
e
=>
{
obj
.
finallyCallback
(
e
)
})
}
export
default
cAction
client/src/components/learnSysLayout/sidebar.vue
浏览文件 @
f4f5d744
...
...
@@ -119,7 +119,7 @@ export default {
},
/* 修改密码 - 跳转方法 */
goSetPwd
()
{
this
.
$router
.
push
({
path
:
'/app/
account
/set-pwd'
})
this
.
$router
.
push
({
path
:
'/app/
other
/set-pwd'
})
},
/* 退出登录 - 跳转方法 */
goOutLogin
()
{
...
...
client/src/pages/other/setPwd.vue
0 → 100644
浏览文件 @
f4f5d744
<
template
>
<div>
<div
class=
"con-title"
>
修改密码
</div>
<div
class=
"con-box"
>
<el-row>
<!--
<el-col
class=
"hidden-sm-and-down"
:md=
"6"
:lg=
"7"
:xl=
"8"
style=
"height: 1px;"
></el-col>
-->
<el-col
:xs=
"24"
:sm=
"16"
:md=
"12"
:lg=
"10"
:xl=
"8"
>
<el-form
ref=
"setpwdform"
label-width=
"100px"
:model=
"accountSetPwd"
:rules=
"rules"
>
<el-form-item
label=
"旧密码"
prop=
"oldPwd"
>
<el-input
v-model=
"accountSetPwd.oldPwd"
type=
"password"
placeholder=
"请输入密码"
@
keyup
.
enter
.
native=
"onSubmitSetPwd"
></el-input>
</el-form-item>
<el-form-item
label=
"新密码"
prop=
"newPwd"
>
<el-input
v-model=
"accountSetPwd.newPwd"
type=
"password"
placeholder=
"请输入新密码"
@
keyup
.
enter
.
native=
"onSubmitSetPwd"
></el-input>
</el-form-item>
<el-form-item
label=
"重复新密码"
prop=
"newPwdAgain"
>
<el-input
v-model=
"accountSetPwd.newPwdAgain"
type=
"password"
placeholder=
"请重复输入新密码"
@
keyup
.
enter
.
native=
"onSubmitSetPwd"
></el-input>
</el-form-item>
<el-form-item>
<el-button
type=
"primary"
@
click=
"onSubmitSetPwd"
>
保存
</el-button>
</el-form-item>
</el-form>
</el-col>
</el-row>
</div>
</div>
</
template
>
<
script
>
import
{
request
}
from
'@action'
export
default
{
components
:
{
},
data
()
{
/* 校验两次输入密码是否一致 */
const
checkNewPwd
=
(
rule
,
value
,
callback
)
=>
{
if
(
value
!==
this
.
accountSetPwd
.
newPwd
)
{
callback
(
new
Error
(
'两次输入密码不一致!'
))
}
else
{
callback
()
}
}
return
{
activeName
:
'1'
,
accountSetPwd
:
{},
rules
:
{
oldPwd
:
[
{
required
:
true
,
message
:
'请输入密码'
,
trigger
:
'blur'
},
{
pattern
:
/^
[
a-zA-Z0-9_+-
]{6,12}
$/
,
message
:
'请输入6-20个字母、数字及标点符号'
,
trigger
:
'change'
}
],
newPwd
:
[
{
required
:
true
,
message
:
'请输入新密码'
,
trigger
:
'blur'
},
{
pattern
:
/^
[
a-zA-Z0-9_+-
]{6,12}
$/
,
message
:
'请输入6-20个字母、数字及标点符号'
,
trigger
:
'change'
}
],
newPwdAgain
:
[
{
required
:
true
,
message
:
'请重复输入新密码'
,
trigger
:
'blur'
},
{
validator
:
checkNewPwd
,
trigger
:
'change'
}
]
}
}
},
methods
:
{
handleClick
(
tab
,
event
)
{
/* console.log(tab, event) */
},
onSubmitSetPwd
()
{
this
.
$refs
.
setpwdform
.
validate
((
valid
)
=>
{
if
(
valid
)
{
request
({
component
:
this
,
actionName
:
'loginAction'
,
functionName
:
'updatePwd'
,
data
:
{
old_password
:
this
.
$md5
(
'uokoaduw'
+
this
.
accountSetPwd
.
oldPwd
.
split
(
''
).
reverse
().
join
(
''
)
+
'auhgniq'
),
new_password
:
this
.
accountSetPwd
.
newPwdAgain
},
thenCallback
:
data
=>
{
if
(
data
.
status
===
200
)
{
/* 重置密码 */
this
.
$refs
.
setpwdform
.
resetFields
()
this
.
$message
.
success
(
'密码修改成功'
)
}
else
{
this
.
$message
.
error
(
data
.
message
)
}
},
catchCallback
:
()
=>
{},
finallyCallback
:
()
=>
{}
})
}
else
{
this
.
$message
.
error
(
'请检查输入项,确认无误后,重新提交'
)
return
false
}
})
}
}
}
</
script
>
client/src/router/routes.js
浏览文件 @
f4f5d744
...
...
@@ -33,7 +33,8 @@ export default [
redirect
:
'error/404'
,
component
:
()
=>
import
(
'@/components/learnSysLayout/container.vue'
),
children
:
[
{
path
:
'message'
,
component
:
()
=>
import
(
'../pages/other/message.vue'
)
}
{
path
:
'message'
,
component
:
()
=>
import
(
'../pages/other/message.vue'
)
},
{
path
:
'set-pwd'
,
component
:
()
=>
import
(
'../pages/other/setPwd.vue'
)
}
]
},
{
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论