Authored by 王水玲

密码修改

... ... @@ -24,6 +24,7 @@
<Dropdown-item v-for="shop in userInfo.shops" :key="shop.shopsId" :name="shop.shopsId" :selected="userInfo.currentShop.shopsId === shop.shopsId">{{shop.shopName}}</Dropdown-item>
</Dropdown-menu>
</Dropdown>
<a href="/password.html" class="update-pwd">[修改密码]</a>
<a class="logout" href="javascript:;" @click="logout">[退出]</a>
</Col>
</Row>
... ... @@ -151,5 +152,11 @@ export default {
}
}
}
.update-pwd {
margin-left: 5px;
font-size: 12px;
color: #444;
}
}
</style>
... ...
... ... @@ -6,6 +6,13 @@ const router = [{
authPass: true
}
}, {
path: '/password.html',
name: 'password',
component: () => import(/* webpackChunkName: "common" */'./password'),
meta: {
authPass: true
}
}, {
path: '/401.html',
name: 'error.401',
component: () => import(/* webpackChunkName: "common" */'./error'),
... ...
<template>
<div class="login-layout">
<div class="login-content">
<p class="login-title">
密码修改
</p>
<Card class="login-card">
<Form ref="formInline" :model="formInline" :rules="ruleInline">
<Form-item prop="user">
<Input type="text" size="large" v-model="formInline.user" placeholder="用户名" @on-enter="handleSubmit('formInline')">
<Icon type="ios-person-outline" slot="prepend"></Icon>
</Input>
</Form-item>
<Form-item prop="password">
<Input type="password" size="large" v-model="formInline.password" placeholder="新密码" @on-enter="handleSubmit('formInline')">
<Icon type="ios-locked-outline" slot="prepend"></Icon>
</Input>
</Form-item>
<Form-item class="login-btn">
<Button type="primary" :loading="loading" @click="handleSubmit('formInline')">
确认修改
</Button>
</Form-item>
</Form>
</Card>
</div>
</div>
</template>
<script>
import UserService from 'services/user/user-service';
export default {
name: 'password',
data() {
return {
loading: false,
formInline: {
user: '',
password: ''
},
ruleInline: {
user: [
{ required: true, message: '请填写用户名', trigger: 'blur' }
],
password: [
{ required: true, message: '请填写密码', trigger: 'blur' }
]
}
};
},
created() {},
methods: {
handleSubmit(name) {
this.$refs[name].validate((valid) => {
if (valid) {
this.update(this.formInline.user, this.formInline.password);
} else {
this.$Message.error('表单验证失败!');
}
});
},
update(user, password) {
this.loading = true;
UserService.update({
account: user,
password: password
}).then(ret => {
if (ret.code === 200) {
this.loading = false;
this.$router.push('/');
} else {
this.loading = false;
this.$Message.error(ret.message);
}
});
}
}
};
</script>
<style lang="scss" scoped>
.login-layout {
background-color: rgb(70, 76, 91);
position: absolute;
top: 0;
left: 0;
right: 0;
bottom: 0;
.login-content {
width: 350px;
margin: 200px auto;
}
.login-title {
width: 100%;
text-align: center;
font-size: 30px;
color: #fff;
line-height: 50px;
padding-bottom: 20px;
}
.ivu-form {
width: 90%;
margin: 20px auto;
}
.login-btn {
text-align: right;
button {
width: 100%;
height: 36px;
font-size: 14px;
}
}
.login-card {
min-height: 250px;
}
}
</style>
... ...
... ... @@ -9,6 +9,9 @@ class UserService extends Service {
captcha
});
}
update(params) {
return this.post('/erp/update', params);
}
purviews() {
return this.post('/erp/getPurview', {
platform_id: 4
... ...
... ... @@ -4,6 +4,7 @@ const _ = require('lodash');
let domainApis = {
erp: {
login: '/erp-shop-web/account/profile/login',
update: '/erp-gateway-web/account/profile/update',
getPurview: '/erp-shop-web/account/menu/query_by_pid',
allotList: '/erp-shop-web/purchase/queryPurchaseList',
allotPurchaseList: '/erp-shop-web/purchase/list',
... ...