Commit fa5006d1 authored by xioln's avatar xioln

更改密码

parent e6e5a18d
import { get, post } from '../utils/http' import { get, post } from '../utils/http'
import { setSearchParams } from '@/utils/util' import { setSearchParams } from '@/utils/util'
// import store from '../store'
export function getUserReceiveItem(params) {
return get('Windchill/extRest/workitem/getUserReceiveItem', params)
}
export function getUserCreateProcess(params) {
return get('Windchill/extRest/workitem/getUserCreateProcess', params)
}
export function isICDObject(params) {
return get('Windchill/extRest/icd/isICDObject', params)
}
// 获取工作流
export function getByWorkItemIdBatchId(id) {
return get(`Windchill/extRest/bpmworkflow/items/${id}`)
}
// #####
// 获取待办已办任务列表数量 // 获取待办已办任务列表数量
export function getStatistics(params) { export function getStatistics(params) {
return post('/workflow/task/statistics', params) return post('/workflow/task/statistics', params)
...@@ -66,3 +45,11 @@ export function getDictListByCode(code, parentKey, attr) { ...@@ -66,3 +45,11 @@ export function getDictListByCode(code, parentKey, attr) {
export function searchMsg(params) { export function searchMsg(params) {
return post('/Notify/searchNotify', params, true) return post('/Notify/searchNotify', params, true)
} }
// 获取消息
export function getMessage(params) {
return post('/Notify/search', params)
}
// 修改密码
export function revisePassword(params) {
return post('/DxUserAccount/password/revise', params)
}
...@@ -42,6 +42,7 @@ ...@@ -42,6 +42,7 @@
:is="formItem.component.name" :is="formItem.component.name"
:item-obj="formItem.component" :item-obj="formItem.component"
:form="form" :form="form"
:type="formItem.component.type"
:name="formItem.key || ''" :name="formItem.key || ''"
:label="formItem.title || ''" :label="formItem.title || ''"
v-on="$listeners" v-on="$listeners"
......
...@@ -24,7 +24,6 @@ const mutations = { ...@@ -24,7 +24,6 @@ const mutations = {
} }
const actions = { const actions = {
login({ commit }, userInfo) { login({ commit }, userInfo) {
console.log('🚀 ~ login ~ userInfo:', userInfo)
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
captchaLogin(userInfo).then(response => { captchaLogin(userInfo).then(response => {
if (!response.items.needUpdatePwd) { if (!response.items.needUpdatePwd) {
...@@ -32,6 +31,7 @@ const actions = { ...@@ -32,6 +31,7 @@ const actions = {
const userVO = response.items.userVO const userVO = response.items.userVO
commit('SET_TOKEN', token) commit('SET_TOKEN', token)
localStorage.setItem('user', userVO.name) localStorage.setItem('user', userVO.name)
localStorage.setItem('userAccount', userVO.userAccount)
localStorage.setItem('fullName', userVO.nickName) localStorage.setItem('fullName', userVO.nickName)
localStorage.setItem('userId', userVO.id) localStorage.setItem('userId', userVO.id)
localStorage.setItem('uploadUrl', response.items.prefsSite && response.items.prefsSite.endPoint ? response.items.prefsSite.endPoint : '') localStorage.setItem('uploadUrl', response.items.prefsSite && response.items.prefsSite.endPoint ? response.items.prefsSite.endPoint : '')
...@@ -40,6 +40,12 @@ const actions = { ...@@ -40,6 +40,12 @@ const actions = {
Notify({ type: 'success', message: '登录成功!' }) Notify({ type: 'success', message: '登录成功!' })
localStorage.setItem('org', response.items.userVO.dxOrganizationId) localStorage.setItem('org', response.items.userVO.dxOrganizationId)
setToken(token) setToken(token)
} else {
const token = response.items.token
localStorage.setItem('token', token)
setToken(token)
commit('SET_TOKEN', token)
resolve(response.items)
} }
resolve(response.items) resolve(response.items)
}).catch(error => { }).catch(error => {
......
...@@ -37,7 +37,7 @@ ...@@ -37,7 +37,7 @@
</div> </div>
</template> </template>
<script> <script>
import { searchMsg } from '@/api/home' import { getMessage } from '@/api/home'
export default { export default {
name: 'LoadTableCell', // name写在组件的最前方,自定义组件为必填 name: 'LoadTableCell', // name写在组件的最前方,自定义组件为必填
...@@ -90,7 +90,7 @@ export default { ...@@ -90,7 +90,7 @@ export default {
operator: 'AND' operator: 'AND'
} }
} }
searchMsg(params).then(res => { getMessage(params).then(res => {
this.list = res.items.content this.list = res.items.content
this.showLoading = false this.showLoading = false
}) })
......
...@@ -10,12 +10,28 @@ ...@@ -10,12 +10,28 @@
</div> </div>
<div class="login"> <div class="login">
<div class="login-form"> <div class="login-form">
<dee-form ref="form" :form="form" :form-data="formData" @getVerifyCode="handleIconClick"></dee-form> <dee-form
<van-button round block type="default" native-type="submit" class="submit" @click="login"> ref="form"
:form="form"
:form-data="formData"
@getVerifyCode="handleIconClick"
></dee-form>
<van-button
round
block
type="default"
native-type="submit"
class="submit"
@click="login"
>
登录 登录
</van-button> </van-button>
</div> </div>
</div> </div>
<ChangePassword
ref="changePsw"
:userAccount="userName"
></ChangePassword>
</div> </div>
</template> </template>
...@@ -23,12 +39,14 @@ ...@@ -23,12 +39,14 @@
import { Notify } from 'vant' import { Notify } from 'vant'
import RSA from '../../utils/rsa.js' import RSA from '../../utils/rsa.js'
import DeeForm from '../../components/form/form' import DeeForm from '../../components/form/form'
import ChangePassword from '@/views/tabbar/changePassword'
import { captchaLogin, extAccountCaptcha } from '../../api/user' import { captchaLogin, extAccountCaptcha } from '../../api/user'
export default { export default {
name: 'login', name: 'login',
props: {}, props: {},
components: { components: {
DeeForm DeeForm,
ChangePassword
}, },
data() { data() {
return { return {
...@@ -41,6 +59,7 @@ export default { ...@@ -41,6 +59,7 @@ export default {
loginType: 'NameAndPwd' loginType: 'NameAndPwd'
}, },
validateCodeImg: '', validateCodeImg: '',
userName: '',
formData: [ formData: [
{ {
data: [ data: [
...@@ -143,30 +162,6 @@ export default { ...@@ -143,30 +162,6 @@ export default {
this.$loading.show() this.$loading.show()
this.form.password = RSA.rsaPublicData(this.form.password) this.form.password = RSA.rsaPublicData(this.form.password)
this.userLogin() this.userLogin()
// isSupplierAccount({ account: this.form.account }).then((res) => {
// sessionStorage.setItem('isSupplierAccount', res.items)
// if (res.code === 0) {
// if (this.loginType === 'gace') {
// if (res.items) {
// Notify(
// `当前登录账户[${this.form.account}]为供应商账户,请访问供应商门户!`
// )
// this.$loading.hide()
// } else {
// this.userLogin()
// }
// } else if (this.loginType === 'supplier') {
// if (!res.items) {
// Notify(
// `当前登录账户[${this.form.account}]为通飞账户,请访问通飞门户!`
// )
// this.$loading.hide()
// } else {
// this.userLogin()
// }
// }
// }
// })
}) })
.catch(() => { .catch(() => {
this.$loading.hide() this.$loading.hide()
...@@ -176,8 +171,14 @@ export default { ...@@ -176,8 +171,14 @@ export default {
this.$store this.$store
.dispatch('user/login', this.form) .dispatch('user/login', this.form)
.then((res) => { .then((res) => {
if (res.needUpdatePwd) {
this.userName = res.userVO.userAccount
this.$refs.changePsw.show = true
this.$utils.showMessage(res.passwordChangeReason, 'warning')
} else {
this.$router.push({ path: '/home' })
}
this.$loading.hide() this.$loading.hide()
this.$router.push({ path: '/home' })
}) })
.catch(() => { .catch(() => {
this.$loading.hide() this.$loading.hide()
...@@ -291,7 +292,7 @@ export default { ...@@ -291,7 +292,7 @@ export default {
height: 100%; height: 100%;
font-size: 14px; font-size: 14px;
&>div { & > div {
height: 100%; height: 100%;
display: flex; display: flex;
flex-direction: column; flex-direction: column;
......
<template>
<div class="change-password">
<van-dialog
v-model="show"
title="修改密码"
show-cancel-button
:before-close="beforeClose"
>
<dee-form
class="form"
ref="deeform"
:form="form"
:form-data="formData"
:rules="rules"
/>
</van-dialog>
</div>
</template>
<script>
import DeeForm from '@/components/form/form.vue'
import RSA from '@/utils/rsa.js'
import { revisePassword } from '@/api/home'
export default {
components: { DeeForm },
props: {
userAccount: {
type: String,
default: ''
},
},
data() {
return {
show: false,
form: {},
formData: [{
data: [
{
title: '旧密码',
key: 'oldPassword',
component: {
name: 'el-input',
type: 'password',
placeholder: '请输入',
clearable: true,
border: true
}
},
{
title: '新密码',
key: 'newPassword',
component: {
name: 'el-input',
type: 'password',
placeholder: '请输入',
clearable: true,
border: true
}
},
{
title: '确认密码',
key: 'newPasswordCon',
component: {
name: 'el-input',
type: 'password',
placeholder: '请输入',
clearable: true,
border: true
}
},
]
}],
rules: { oldPsd: [{ required: true, message: '请填写' }] }
}
},
methods: {
showPopup() {
this.show = true
},
beforeClose(action, done) {
if (action === 'confirm') {
if (!(this.form.oldPassword && this.form.newPassword && this.form.newPasswordCon)) {
this.$utils.showMessage('请输入!', 'warning')
}
if (this.form.newPassword !== this.form.newPasswordCon) {
this.$utils.showMessage('新密码与确认密码不一致!', 'warning')
}
const params = {
accountName: this.userAccount || localStorage.getItem('userAccount'),
// 旧密码传明文
oldPassword: this.form.oldPassword,
// 新密码传密文
newPassword: RSA.rsaPublicData(this.form.newPassword)
}
revisePassword(params).then(res => {
this.$utils.showMessage('修改成功!', 'success')
done();
this.$store.dispatch('user/logout')
})
} else {
done();
}
}
}
}
</script>
<style lang="scss">
.change-password {
.form {
margin: 10px;
}
}
</style>
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment