收藏查看接口,密码md5加密,重置密码的正则校验

This commit is contained in:
熊丽君
2021-10-13 14:36:36 +08:00
parent 71b8585444
commit 68fca07951
9 changed files with 81 additions and 37 deletions

View File

@ -6,6 +6,13 @@ export function getCategoryList(params) {
params
});
}
// 分页查询个人收藏
export function getPolicyCollect(params) {
return request({
url: '/companyUser/getPolicyCollect',
params
});
}
// 禁用/启用企业 isOpen = true代表启用
export function handleCompanyUser(params) {
return request({

View File

@ -65,11 +65,19 @@
>启用</el-button
>
<el-button
v-if="scope.row.status!=2"
@click="handleStatus(scope.row.id, 2)"
type="text"
size="small"
>升级</el-button
>
<el-button
v-else
type="text"
size="small"
disabled
>已升级</el-button
>
<el-button
@click="resetPwd(scope.row.id)"
type="text"
@ -151,11 +159,11 @@ export default {
this.$prompt('请输入新密码', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
inputPattern: /^\d{6,}$/,
inputErrorMessage: '不能为空且六位及以上'
inputPattern: /^[0-9A-Za-z]{6,16}$/,
inputErrorMessage: '不能为空且6-16位'
})
.then(({ value }) => {
resetPw({ userId, password: value }).then(({ data }) => {
resetPw({ userId, password: this.md5(value) }).then(({ data }) => {
this.msgSuccess(data);
});
})

View File

@ -13,7 +13,7 @@
<el-input
placeholder="请输入"
v-model="ruleForm.companyName"
maxlength="48"
maxlength="25"
show-word-limit
:disabled="check"
></el-input>
@ -22,6 +22,8 @@
<el-input
placeholder="请输入"
v-model="ruleForm.companyType"
maxlength="25"
show-word-limit
:disabled="check"
></el-input>
</el-form-item>
@ -29,6 +31,8 @@
<el-input
placeholder="请输入"
v-model="ruleForm.nickName"
maxlength="25"
show-word-limit
:disabled="check"
></el-input>
</el-form-item>
@ -36,6 +40,8 @@
<el-input
placeholder="请输入"
v-model="ruleForm.note"
maxlength="25"
show-word-limit
:disabled="check"
></el-input>
</el-form-item>
@ -80,6 +86,8 @@
<el-input
placeholder="请输入"
v-model="ruleForm.address"
maxlength="25"
show-word-limit
:disabled="check"
></el-input>
</el-form-item>
@ -87,6 +95,8 @@
<el-input
placeholder="请输入"
v-model="ruleForm.username"
maxlength="11"
show-word-limit
:disabled="check"
></el-input>
</el-form-item>
@ -117,8 +127,8 @@
</el-form-item>
</el-form>
<el-dialog title="企业画像设置" :visible.sync="dialogVisible" width="20%">
<el-form ref="form" :model="form" label-width="80px">
<el-dialog title="企业画像设置" :visible.sync="dialogVisible" width="30%">
<el-form ref="form" :model="form" label-width="180px">
<el-form-item
:label="item.name"
v-for="(item, index) in labelList"
@ -305,6 +315,7 @@ export default {
checkPhoneExist({ phone: this.ruleForm.username }).then(
({ data }) => {
if (data === 500) return this.msgError('该手机号已被注册');
formData.password = this.md5(formData.password)
addCompanyUser(formData).then(({ message }) => {
this.msgSuccess(message);
this.$router.go(-1);

View File

@ -484,7 +484,8 @@ import {
getCategoryList,
handleCompanyUser,
deleteCompanyUser,
resetPw
resetPw,
getPolicyCollect
} from '@/api/customer';
import { parseTime } from '@/utils/ruoyi';
import { getToken } from '@/utils/auth';
@ -570,6 +571,7 @@ export default {
pageNum: 1,
pageSize: 10
},
rouId: null,
dialogTotal: 0,
dialogData: [],
formA: {},
@ -658,33 +660,14 @@ export default {
},
handleCollecDialog(row) {
this.openDialog = true;
console.log(row.id);
this.rouId = row.userId
this.getCollecList();
},
getCollecList() {
this.dialogData = [
{
id: '1447500160736436224',
method: 1,
title:
'关于公开征求《合肥市外国专家“合肥友谊奖”考核暂行办法》(修订版)意见的通知',
level: 3,
attribute: 'KJJ',
listDate: '2021-10-11',
source: '外国专家与科技人才管理服务处'
},
{
id: '1447500160736436225',
method: 1,
title:
'关于公开征求《合肥市外国专家“合肥友谊奖”考核暂行办法》(修订版)意见的通知',
level: 3,
attribute: 'KJJ',
listDate: '2021-10-11',
source: '外国专家与科技人才管理服务处'
}
];
this.dialogTotal = this.dialogData.length;
getPolicyCollect(Object.assign({},this.query,{userId:this.rouId})).then(({data})=>{
this.dialogData = data.list
this.dialogTotal = data.total
})
},
/** 下载模板操作 */
importTemplate() {

View File

@ -146,9 +146,10 @@ export default {
Cookies.remove('password');
Cookies.remove('rememberMe');
}
console.log(this.md5(this.loginForm.password));
let loginForm = Object.assign({},this.loginForm)
loginForm.password = this.md5(loginForm.password)
this.$store
.dispatch('Login', this.loginForm)
.dispatch('Login', loginForm)
.then(() => {
this.$router.push({ path: this.redirect || '/' });
})

View File

@ -176,7 +176,7 @@ export default {
editSatus: false,
ruleForm: {
title: '',
ids: '',
ids: [],
attribute: '',
listDate: '',
source: '',
@ -297,6 +297,9 @@ export default {
if (id) {
this.editPage = true;
getPolicyInfo({ policyId: id }).then(({ data }) => {
// if(!data.ids.length){
// data.ids=['1']
// }
this.ruleForm = data;
if(data.method==1){
this.editPage = true;

View File

@ -76,6 +76,7 @@
:ref="'editableInput' + index"
size="small"
placeholder="请输入标签信息"
maxlength="10"
@keyup.enter.native="handleEditableInputConfirm(tag, index)"
@change="handleEditableInputConfirm(tag, index)"
@blur="handleEditableInputBlur(tag, index)"

View File

@ -83,7 +83,8 @@
</el-table-column>
<el-table-column label="操作" width="180" align="center">
<template slot-scope="scope">
<el-button
<p>
<el-button
size="mini"
type="text"
@click="handleSelectRole(scope.$index, scope.row)"
@ -96,12 +97,21 @@
>
编辑
</el-button>
</p>
<p>
<el-button
@click="resetPwd(scope.row.id)"
size="mini"
type="text"
>重置密码</el-button
>
<el-button
size="mini"
type="text"
@click="handleDelete(scope.$index, scope.row)"
>删除
</el-button>
</p>
</template>
</el-table-column>
</el-table>
@ -134,7 +144,7 @@
<el-form-item label="邮箱:">
<el-input v-model="admin.email" style="width: 250px"></el-input>
</el-form-item>
<el-form-item label="密码:" prop="password">
<el-form-item label="密码:" prop="password" v-if="!isEdit">
<el-input
v-model="admin.password"
type="password"
@ -295,6 +305,22 @@ export default {
this.getList();
});
},
// 重置密码
resetPwd(userId) {
// resetPw
this.$prompt('请输入新密码', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
inputPattern: /^[0-9A-Za-z]{6,16}$/,
inputErrorMessage: '不能为空且6-16位'
})
.then(({ value }) => {
updateAdmin(userId, {password:this.md5(value)}).then(({message}) => {
this.msgSuccess(message);
});
})
.catch(() => {});
},
handleDelete(index, row) {
this.$confirm('是否要删除该用户?', '提示', {
confirmButtonText: '确定',
@ -313,6 +339,7 @@ export default {
handleUpdate(index, row) {
this.dialogVisible = true;
this.isEdit = true;
delete row.password
this.admin = Object.assign({}, row);
},
submitForm(formName){
@ -338,7 +365,9 @@ export default {
this.getList();
});
} else {
createAdmin(this.admin).then(response => {
let admin = Object.assign({},this.admin)
admin.password = this.md5(admin.password)
createAdmin(admin).then(response => {
this.$message({
message: '添加成功!',
type: 'success'

View File

@ -30,6 +30,7 @@
<el-form-item label="输入搜索:">
<el-input
v-model="listQuery.keyword"
@input="e => listQuery.keyword = stripscript(e)"
class="input-width"
placeholder="角色名称"
clearable