Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
S
smart-web-router
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
SVI
svi-templates
smart-web-router
Commits
a311256e
Commit
a311256e
authored
Nov 26, 2019
by
曾沂轮
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'feature-AddFirstLogin' into 'master'
Feat: 新用户首次登陆需要修改密码 See merge request
!1
parents
d6742245
7cfe5110
Show whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
230 additions
and
37 deletions
+230
-37
README.md
template/README.md
+4
-0
config.js
template/form/api/config.js
+0
-3
index.js
template/form/api/index.js
+4
-4
index.scss
template/form/styles/index.scss
+8
-3
form.js
template/form/utils/form.js
+1
-1
form.vue
template/form/views/form.vue
+33
-19
config.js
template/src/api/config.js
+2
-4
index.js
template/src/api/index.js
+4
-0
Main.vue
template/src/views/Main.vue
+18
-2
PasswordDialog.vue
template/src/views/common/PasswordDialog.vue
+155
-0
vue.config.js
template/vue.config.js
+1
-1
No files found.
template/README.md
View file @
a311256e
...
...
@@ -15,3 +15,7 @@ npm run serve
npm run build
```
### 注意事项
1.
每次更新模板后、若想切换到最新版本,请将旧依赖全部删除后重新下载依赖(缓存配置文件没有实时更新)
2.
公司内部脚手架ssnpm暂时不要使用到模板项目中
template/form/api/config.js
View file @
a311256e
...
...
@@ -107,7 +107,6 @@ const config = {
resolve
(
res
.
data
);
})
.
catch
(
res
=>
{
console
.
log
(
'post error:'
,
res
);
reject
(
res
);
});
});
...
...
@@ -133,7 +132,6 @@ const config = {
resolve
(
res
.
data
);
})
.
catch
(
res
=>
{
console
.
log
(
'post error:'
,
res
);
reject
(
res
);
});
});
...
...
@@ -159,7 +157,6 @@ const config = {
resolve
(
res
.
data
);
})
.
catch
(
res
=>
{
console
.
log
(
'post error:'
,
res
);
reject
(
res
);
});
});
...
...
template/form/api/index.js
View file @
a311256e
...
...
@@ -19,15 +19,15 @@ const Api = {
/**
*
* @param {*} businessDefinitionId
* @param {*} taskId
* @param {*} linkId
* @param {*} linkKey
*/
getBusinessStartForm
(
businessDefinitionId
)
{
getBusinessStartForm
(
businessDefinitionId
,
taskId
)
{
return
config
.
doGetPromise
(
baseUrl
+
'/v1.1.0/workflow/workflowForm/getBusinessStartForm'
,
{
businessDefinitionId
businessDefinitionId
,
taskId
}
);
},
...
...
template/form/styles/index.scss
View file @
a311256e
...
...
@@ -65,15 +65,20 @@ body {
}
.form-render
{
padding-top
:
28
px
;
padding-top
:
44
px
;
width
:
1000px
;
margin
:
0
auto
;
}
.is-required
{
.submit-dialog
,
.return-work
,
.transform-work
{
.is-required
{
.el-textarea__inner
{
border-color
:
$--color-danger
;
}
}
}
.page-view
{
...
...
@@ -97,7 +102,7 @@ body {
@include
e
(
wrapper
)
{
width
:
100%
;
height
:
100%
;
max-height
:
20vh
;
background-color
:
inherit
;
overflow
:
auto
;
...
...
template/form/utils/form.js
View file @
a311256e
...
...
@@ -115,7 +115,7 @@ export function refreshTab(tabId) {
// 设置高级或某此控件需要【数组】、【对象】类型
// 比如upload_list, sign
const
checkObjectJson
=
data
=>
{
const
widgets
=
[
'upload_list'
,
'sign'
,
'select'
];
const
widgets
=
[
'upload_list'
,
'sign'
,
'select'
,
'approval'
];
if
(
widgets
.
includes
(
data
.
type
))
{
return
data
.
model
;
}
else
{
...
...
template/form/views/form.vue
View file @
a311256e
...
...
@@ -21,7 +21,7 @@
>
{{
item
.
operationName
}}
</el-button>
</div>
<div
class=
"form-render"
v-if=
"
isReRender
"
>
<div
class=
"form-render"
v-if=
"
!isLoading
"
>
<smart-form
:data=
"formData"
:value=
"values"
ref=
"generateForm"
></smart-form>
</div>
...
...
@@ -42,7 +42,7 @@
ref=
"submitTask"
:nextLinks=
"submitData.subTask"
:nextLinkUsers=
"submitData.userInfos"
@
closed=
"
submitTaskDialogVisible = fal
se"
@
closed=
"
handleSubmitTaskClo
se"
@
save=
"handleSubmitTaskSave"
></submit-task>
<!-- 转办 -->
...
...
@@ -112,7 +112,6 @@ export default {
return
{
apiFnName
:
''
,
// 加载API的方法名
isLoading
:
false
,
// 加载过渡
isReRender
:
true
,
// 重渲染
headBtnLists
:
[],
// 头部的按钮列表
headCustomBtns
:
[],
// 头部自定义按钮,一般包含表达式
formData
:
{},
...
...
@@ -126,7 +125,8 @@ export default {
submitTaskDialogVisible
:
false
,
// 提交dialog
submitData
:
{},
transformDialogVisible
:
false
,
// 转办dialog
returnTaskVisible
:
false
// 退回dialog
returnTaskVisible
:
false
,
// 退回dialog
createTaskId
:
''
// 新建工作后保存时的taskId
};
},
...
...
@@ -146,8 +146,8 @@ export default {
},
// 刷新
refresh
()
{
this
.
fetch
();
refresh
(
taskId
)
{
this
.
fetch
(
taskId
);
},
handleResultHtml
(
data
,
key
)
{
...
...
@@ -159,10 +159,12 @@ export default {
return
{};
}
},
fetch
()
{
/**
* 新建工作时,保存的时候后端返回tId
*/
fetch
(
tId
)
{
let
taskId
=
getTaskId
()
||
this
.
childrenData
.
taskId
;
const
linkId
=
getLinkId
()
||
this
.
childrenData
.
linkId
;
const
linkId
=
tId
?
tId
:
getLinkId
()
||
this
.
childrenData
.
linkId
;
const
linkKey
=
getLinkKey
()
||
this
.
childrenData
.
linkKey
;
// console.log(taskId, linkId, linkKey)
let
apiFn
=
'renderFormByTaskId'
;
...
...
@@ -178,9 +180,7 @@ export default {
taskId
=
getFinishForm
();
apiFn
=
'renderFinishForm'
;
}
this
.
isLoading
=
true
;
Api
[
apiFn
](
taskId
,
linkId
,
linkKey
)
.
then
(
res
=>
{
this
.
isLoading
=
false
;
...
...
@@ -238,6 +238,7 @@ export default {
'template'
);
this
.
formData
=
JSON
.
parse
(
_data
)
||
{};
this
.
$set
(
this
.
formData
.
config
,
'disabled'
,
ourselfOperationShow
[
'sign'
]
||
false
);
this
.
handleModels
(
this
.
handleResultHtml
(
detailMap
[
'result'
],
'values'
)
);
...
...
@@ -392,7 +393,7 @@ export default {
handleFormData
()
{
const
formData
=
this
.
$refs
[
'generateForm'
].
getData
();
const
fomrDataSub
=
new
FormData
();
Object
.
keys
(
formData
).
map
(
key
=>
{
Object
.
keys
(
formData
).
forEach
(
key
=>
{
let
value
=
formData
[
key
];
// 转JSON字符串提交
if
(
typeof
formData
[
key
]
===
'object'
&&
formData
[
key
]
!==
null
)
{
...
...
@@ -420,6 +421,9 @@ export default {
// console.log(res)
if
(
res
.
status
===
0
)
{
notification
(
'success'
,
'保存成功!'
);
if
(
!
res
.
data
.
taskId
)
return
false
;
this
.
createTaskId
=
res
.
data
.
taskId
;
this
.
refresh
(
res
.
data
.
taskId
);
}
else
{
notification
(
'warning'
,
res
.
message
||
'保存失败,请重试!'
);
}
...
...
@@ -479,6 +483,7 @@ export default {
if
(
this
.
$refs
[
'submitTask'
])
{
this
.
$refs
[
'submitTask'
].
$data
.
isSubmiting
=
false
;
}
if
(
res
.
status
===
0
)
{
this
.
submitTaskDialogVisible
=
false
;
// 关闭标签
...
...
@@ -518,24 +523,18 @@ export default {
];
this
.
isLoading
=
true
;
this
.
isReRender
=
false
;
Api
.
doPostPromiseJson
(
apiUrl
,
submitData
)
.
then
(
res
=>
{
this
.
isLoading
=
false
;
this
.
isReRender
=
true
;
// console.log('signTasks', res)
if
(
res
.
status
===
0
)
{
this
.
handleDataReturnErr
(
res
.
data
,
'接办成功'
);
// 刷新
this
.
refresh
();
}
else
{
notification
(
'warning'
,
res
.
message
||
'接办失败,请重试'
);
}
})
.
catch
(
err
=>
{
this
.
isLoading
=
false
;
this
.
isReRender
=
true
;
notification
(
'error'
,
err
.
message
||
'接办失败!'
);
});
},
...
...
@@ -595,7 +594,16 @@ export default {
this
.
isLoading
=
false
;
// console.log('receiveTasks', res)
if
(
res
.
status
===
0
)
{
this
.
handleDataReturnErr
(
res
.
data
,
'退件成功'
);
// 关闭和刷新标签页
setTimeout
(()
=>
{
refreshTab
();
closeTab
();
outerNotice
({
type
:
'success'
,
title
:
'退件成功!'
,
message
:
res
.
message
});
},
150
);
}
else
{
notification
(
'warning'
,
res
.
message
||
'退件失败,请重试'
);
}
...
...
@@ -772,6 +780,12 @@ export default {
/* eslint-disable no-eval */
eval
(
item
.
operation
);
}
},
// 关闭提交后的对话框事件
handleSubmitTaskClose
()
{
this
.
submitTaskDialogVisible
=
false
;
this
.
refresh
(
this
.
createTaskId
);
}
}
};
...
...
template/src/api/config.js
View file @
a311256e
...
...
@@ -83,6 +83,8 @@ const config = {
* @param {Object} options
*/
doGetPromise
(
url
,
params
,
options
=
{})
{
console
.
log
(
_config
.
baseUrl
);
console
.
log
(
axios
.
defaults
.
baseURL
);
const
{
timeout
=
30000
,
...
arg
}
=
options
;
return
new
Promise
((
resolve
,
reject
)
=>
{
...
...
@@ -100,7 +102,6 @@ const config = {
}).
then
(
response
=>
{
resolve
(
response
.
data
);
}).
catch
(
response
=>
{
// console.error('ajax error:', response)
reject
(
response
);
});
});
...
...
@@ -129,7 +130,6 @@ const config = {
}).
then
(
res
=>
{
resolve
(
res
.
data
);
}).
catch
(
res
=>
{
console
.
log
(
'post error:'
,
res
);
reject
(
res
);
});
});
...
...
@@ -154,7 +154,6 @@ const config = {
}).
then
(
res
=>
{
resolve
(
res
.
data
);
}).
catch
(
res
=>
{
// console.log('post error:', res)
reject
(
res
);
});
});
...
...
@@ -179,7 +178,6 @@ const config = {
}).
then
(
res
=>
{
resolve
(
res
.
data
);
}).
catch
(
res
=>
{
console
.
log
(
'post error:'
,
res
);
reject
(
res
);
});
});
...
...
template/src/api/index.js
View file @
a311256e
...
...
@@ -93,6 +93,10 @@ const Api = {
return
config
.
doGetPromise
(
'/authorityManage/queryUserSysAuthorizeInfoList'
,
{
moduleId
});
},
// 修改密码
updatePassword
(
userId
,
newPassword
)
{
return
config
.
doGetPromise
(
'/index/updatePassword'
,
{
id
:
userId
,
newPassword
:
newPassword
});
}
};
...
...
template/src/views/Main.vue
View file @
a311256e
...
...
@@ -12,12 +12,14 @@
</div>
<!--
<router-view
name=
"loginDialog"
></router-view>
-->
<password-dialog
:visiableDialog=
"visiableDialog"
@
visiable-dialog=
"handlePasswordDialogEvent"
></password-dialog>
</div>
</
template
>
<
script
>
import
AppHeader
from
'./common/Header'
;
import
AppNavigation
from
'./Navigation'
;
import
passwordDialog
from
'./common/PasswordDialog'
;
import
{
changeTheme
}
from
'@/utils/global'
;
export
default
{
...
...
@@ -25,7 +27,8 @@ export default {
components
:
{
AppHeader
,
AppNavigation
AppNavigation
,
passwordDialog
},
computed
:
{
...
...
@@ -39,7 +42,8 @@ export default {
data
()
{
return
{
oldNavigation
:
null
oldNavigation
:
null
,
visiableDialog
:
false
};
},
...
...
@@ -53,11 +57,23 @@ export default {
},
mounted
()
{
this
.
handleUserFirstLogin
();
},
methods
:
{
hasOwnProperty
(
obj
,
key
)
{
return
obj
.
hasOwnProperty
(
key
);
},
// 处理用户首次登陆时,需要修改密码
handleUserFirstLogin
()
{
const
userInfo
=
this
.
$store
.
state
.
userInfo
;
if
(
userInfo
&&
userInfo
.
Status
&&
userInfo
.
Status
===
1
)
{
this
.
visiableDialog
=
true
;
}
},
// 修改密码框显示事件
handlePasswordDialogEvent
(
visiable
)
{
this
.
visiableDialog
=
!!
visiable
;
}
}
};
...
...
template/src/views/common/PasswordDialog.vue
0 → 100644
View file @
a311256e
<
template
>
<el-dialog
title=
"首次登录,请修改密码"
:visible
.
sync=
"dialogVisiable"
width=
"400px"
:before-close=
"handleBeforeCloseDialog"
:close-on-click-modal=
"false"
:close-on-press-escape=
"false"
>
<el-form
:rules=
"passwordRule"
:model=
"passwordForm"
ref=
"pswForm"
>
<el-form-item
label=
"新密码"
:label-width=
"formLabelWidth"
prop=
"password"
>
<el-input
v-model=
"passwordForm.password"
type=
"password"
autocomplete=
"off"
></el-input>
</el-form-item>
<el-form-item
label=
"确认新密码"
:label-width=
"formLabelWidth"
prop=
"comfirmPassword"
>
<el-input
v-model=
"passwordForm.comfirmPassword"
type=
"password"
autocomplete=
"off"
@
keyup
.
native
.
enter=
"handleSubmitPassword"
></el-input>
</el-form-item>
</el-form>
<div
slot=
"footer"
class=
"dialog-footer"
>
<el-button
type=
"primary"
:loading=
"passSubmiting"
@
click=
"handleSubmitPassword"
>
确 定
</el-button>
</div>
</el-dialog>
</
template
>
<
script
>
import
sha1
from
'js-sha1'
;
import
Api
from
'@/api'
;
export
default
{
name
:
'PasswordDialog'
,
props
:
{
visiableDialog
:
{
type
:
Boolean
,
default
:
false
}
},
computed
:
{
dialogVisiable
()
{
return
this
.
visiableDialog
;
}
},
data
()
{
const
password
=
(
rule
,
value
,
callback
)
=>
{
if
(
value
===
''
)
{
callback
(
new
Error
(
'请输入密码'
));
}
else
{
if
(
this
.
passwordForm
.
comfirmPassword
!==
''
)
{
this
.
$refs
.
pswForm
.
validateField
(
'comfirmPassword'
);
}
callback
();
}
};
const
comfirmPassword
=
(
rule
,
value
,
callback
)
=>
{
if
(
value
===
''
)
{
callback
(
new
Error
(
'请再次输入密码'
));
}
else
if
(
value
!==
this
.
passwordForm
.
password
)
{
callback
(
new
Error
(
'两次输入密码不一致!'
));
}
else
{
callback
();
}
};
return
{
dialogVisible
:
false
,
passSubmiting
:
false
,
formLabelWidth
:
'100px'
,
passwordForm
:
{
password
:
''
,
comfirmPassword
:
''
},
passwordRule
:
{
password
:
[
{
required
:
true
,
message
:
'不能为空'
,
trigger
:
'change'
},
{
validator
:
password
,
trigger
:
'blur'
}
],
comfirmPassword
:
[
{
required
:
true
,
message
:
'不能为空'
,
trigger
:
'change'
},
{
validator
:
comfirmPassword
,
trigger
:
'blur'
}
]
}
};
},
methods
:
{
handleBeforeCloseDialog
()
{
this
.
$message
.
warning
(
'首次登陆,请修改密码哟!'
);
this
.
$emit
(
'visiable-dialog'
,
true
);
},
// 提交密码修改
handleSubmitPassword
()
{
this
.
$refs
[
'pswForm'
].
validate
(
valid
=>
{
if
(
valid
)
{
this
.
passSubmiting
=
true
;
const
userPassword
=
sha1
(
this
.
passwordForm
.
password
).
toUpperCase
();
const
userInfo
=
this
.
$store
.
state
.
userInfo
;
Api
.
updatePassword
(
userInfo
.
userId
,
userPassword
).
then
(
res
=>
{
if
(
res
.
status
===
0
)
{
this
.
modifyPassDialogVisible
=
false
;
this
.
loginOutAndReturnLogin
();
}
else
{
this
.
$message
({
message
:
'修改密码出错'
,
type
:
'warning'
,
duration
:
2000
});
}
}).
catch
(
err
=>
{
this
.
passSubmiting
=
false
;
this
.
$message
({
message
:
err
.
message
,
type
:
'error'
,
duration
:
2000
});
});
}
});
},
// 退出账号并返回到登陆
loginOutAndReturnLogin
()
{
Api
.
logout
().
then
(
res
=>
{
if
(
res
.
status
===
0
)
{
this
.
$message
({
message
:
'密码修改成功, 系统将在3s后为您跳转到登录页'
,
type
:
'success'
,
duration
:
3000
});
setTimeout
(()
=>
{
this
.
$router
.
replace
({
path
:
'/login'
});
this
.
passSubmiting
=
false
;
},
3000
);
}
else
{
this
.
$message
({
type
:
'warning'
,
message
:
'密码修改成功,由于'
+
res
.
message
});
}
}).
catch
(
err
=>
{
this
.
passSubmiting
=
false
;
this
.
$message
({
type
:
'error'
,
message
:
err
.
message
});
});
}
}
};
</
script
>
template/vue.config.js
View file @
a311256e
...
...
@@ -89,5 +89,5 @@ module.exports = {
},
// IE兼容
//
transpileDependencies: ['element-ui/src', 'element-ui/packages']
transpileDependencies
:
[
'element-ui/src'
,
'element-ui/packages'
]
};
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