收藏查看接口,密码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 params
}); });
} }
// 分页查询个人收藏
export function getPolicyCollect(params) {
return request({
url: '/companyUser/getPolicyCollect',
params
});
}
// 禁用/启用企业 isOpen = true代表启用 // 禁用/启用企业 isOpen = true代表启用
export function handleCompanyUser(params) { export function handleCompanyUser(params) {
return request({ return request({

View File

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

View File

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

View File

@ -484,7 +484,8 @@ import {
getCategoryList, getCategoryList,
handleCompanyUser, handleCompanyUser,
deleteCompanyUser, deleteCompanyUser,
resetPw resetPw,
getPolicyCollect
} from '@/api/customer'; } from '@/api/customer';
import { parseTime } from '@/utils/ruoyi'; import { parseTime } from '@/utils/ruoyi';
import { getToken } from '@/utils/auth'; import { getToken } from '@/utils/auth';
@ -570,6 +571,7 @@ export default {
pageNum: 1, pageNum: 1,
pageSize: 10 pageSize: 10
}, },
rouId: null,
dialogTotal: 0, dialogTotal: 0,
dialogData: [], dialogData: [],
formA: {}, formA: {},
@ -658,33 +660,14 @@ export default {
}, },
handleCollecDialog(row) { handleCollecDialog(row) {
this.openDialog = true; this.openDialog = true;
console.log(row.id); this.rouId = row.userId
this.getCollecList(); this.getCollecList();
}, },
getCollecList() { getCollecList() {
this.dialogData = [ getPolicyCollect(Object.assign({},this.query,{userId:this.rouId})).then(({data})=>{
{ this.dialogData = data.list
id: '1447500160736436224', this.dialogTotal = data.total
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;
}, },
/** 下载模板操作 */ /** 下载模板操作 */
importTemplate() { importTemplate() {

View File

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

View File

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

View File

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

View File

@ -83,7 +83,8 @@
</el-table-column> </el-table-column>
<el-table-column label="操作" width="180" align="center"> <el-table-column label="操作" width="180" align="center">
<template slot-scope="scope"> <template slot-scope="scope">
<el-button <p>
<el-button
size="mini" size="mini"
type="text" type="text"
@click="handleSelectRole(scope.$index, scope.row)" @click="handleSelectRole(scope.$index, scope.row)"
@ -96,12 +97,21 @@
> >
编辑 编辑
</el-button> </el-button>
</p>
<p>
<el-button
@click="resetPwd(scope.row.id)"
size="mini"
type="text"
>重置密码</el-button
>
<el-button <el-button
size="mini" size="mini"
type="text" type="text"
@click="handleDelete(scope.$index, scope.row)" @click="handleDelete(scope.$index, scope.row)"
>删除 >删除
</el-button> </el-button>
</p>
</template> </template>
</el-table-column> </el-table-column>
</el-table> </el-table>
@ -134,7 +144,7 @@
<el-form-item label="邮箱:"> <el-form-item label="邮箱:">
<el-input v-model="admin.email" style="width: 250px"></el-input> <el-input v-model="admin.email" style="width: 250px"></el-input>
</el-form-item> </el-form-item>
<el-form-item label="密码:" prop="password"> <el-form-item label="密码:" prop="password" v-if="!isEdit">
<el-input <el-input
v-model="admin.password" v-model="admin.password"
type="password" type="password"
@ -295,6 +305,22 @@ export default {
this.getList(); 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) { handleDelete(index, row) {
this.$confirm('是否要删除该用户?', '提示', { this.$confirm('是否要删除该用户?', '提示', {
confirmButtonText: '确定', confirmButtonText: '确定',
@ -313,6 +339,7 @@ export default {
handleUpdate(index, row) { handleUpdate(index, row) {
this.dialogVisible = true; this.dialogVisible = true;
this.isEdit = true; this.isEdit = true;
delete row.password
this.admin = Object.assign({}, row); this.admin = Object.assign({}, row);
}, },
submitForm(formName){ submitForm(formName){
@ -338,7 +365,9 @@ export default {
this.getList(); this.getList();
}); });
} else { } else {
createAdmin(this.admin).then(response => { let admin = Object.assign({},this.admin)
admin.password = this.md5(admin.password)
createAdmin(admin).then(response => {
this.$message({ this.$message({
message: '添加成功!', message: '添加成功!',
type: 'success' type: 'success'

View File

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