commit
74abea7fbf
|
@ -148,10 +148,21 @@ button_data = [
|
||||||
"dept_belong_id": 1,
|
"dept_belong_id": 1,
|
||||||
"update_datetime": datetime.datetime.now(),
|
"update_datetime": datetime.datetime.now(),
|
||||||
"create_datetime": datetime.datetime.now(),
|
"create_datetime": datetime.datetime.now(),
|
||||||
"name": "重置密码",
|
"name": "重设密码",
|
||||||
"value": "ResetPassword",
|
"value": "ResetPassword",
|
||||||
"creator_id": 1,
|
"creator_id": 1,
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"id": 10,
|
||||||
|
"description": None,
|
||||||
|
"modifier": "1",
|
||||||
|
"dept_belong_id": 1,
|
||||||
|
"update_datetime": datetime.datetime.now(),
|
||||||
|
"create_datetime": datetime.datetime.now(),
|
||||||
|
"name": "重置密码",
|
||||||
|
"value": "DefaultPassword",
|
||||||
|
"creator_id": 1,
|
||||||
|
},
|
||||||
]
|
]
|
||||||
|
|
||||||
menu_data = [
|
menu_data = [
|
||||||
|
@ -1250,7 +1261,7 @@ menu_button_data = [
|
||||||
"dept_belong_id": 1,
|
"dept_belong_id": 1,
|
||||||
"update_datetime": datetime.datetime.now(),
|
"update_datetime": datetime.datetime.now(),
|
||||||
"create_datetime": datetime.datetime.now(),
|
"create_datetime": datetime.datetime.now(),
|
||||||
"name": "重置密码",
|
"name": "重设密码",
|
||||||
"value": "ResetPassword",
|
"value": "ResetPassword",
|
||||||
"api": "/api/system/user/reset_password/{id}/",
|
"api": "/api/system/user/reset_password/{id}/",
|
||||||
"method": 2,
|
"method": 2,
|
||||||
|
@ -1261,6 +1272,20 @@ menu_button_data = [
|
||||||
"id": 54,
|
"id": 54,
|
||||||
"description": None,
|
"description": None,
|
||||||
"modifier": "1",
|
"modifier": "1",
|
||||||
|
"dept_belong_id": 1,
|
||||||
|
"update_datetime": datetime.datetime.now(),
|
||||||
|
"create_datetime": datetime.datetime.now(),
|
||||||
|
"name": "重置密码",
|
||||||
|
"value": "DefaultPassword",
|
||||||
|
"api": "/api/system/user/reset_to_default_password/{id}/",
|
||||||
|
"method": 2,
|
||||||
|
"creator_id": 1,
|
||||||
|
"menu_id": 3,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": 55,
|
||||||
|
"description": None,
|
||||||
|
"modifier": "1",
|
||||||
"dept_belong_id": "1",
|
"dept_belong_id": "1",
|
||||||
"update_datetime": datetime.datetime.now(),
|
"update_datetime": datetime.datetime.now(),
|
||||||
"create_datetime": datetime.datetime.now(),
|
"create_datetime": datetime.datetime.now(),
|
||||||
|
@ -1272,7 +1297,7 @@ menu_button_data = [
|
||||||
"menu_id": 20,
|
"menu_id": 20,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"id": 55,
|
"id": 56,
|
||||||
"description": None,
|
"description": None,
|
||||||
"modifier": "1",
|
"modifier": "1",
|
||||||
"dept_belong_id": "1",
|
"dept_belong_id": "1",
|
||||||
|
@ -1286,7 +1311,7 @@ menu_button_data = [
|
||||||
"menu_id": 20,
|
"menu_id": 20,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"id": 56,
|
"id": 57,
|
||||||
"description": None,
|
"description": None,
|
||||||
"modifier": "1",
|
"modifier": "1",
|
||||||
"dept_belong_id": 1,
|
"dept_belong_id": 1,
|
||||||
|
@ -1388,7 +1413,7 @@ dictionary_data = [
|
||||||
"creator_id": 1,
|
"creator_id": 1,
|
||||||
"parent_id": None,
|
"parent_id": None,
|
||||||
"is_value": 0,
|
"is_value": 0,
|
||||||
"type": 0
|
"type": 0,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"id": 2,
|
"id": 2,
|
||||||
|
@ -1405,7 +1430,7 @@ dictionary_data = [
|
||||||
"creator_id": 1,
|
"creator_id": 1,
|
||||||
"parent_id": 1,
|
"parent_id": 1,
|
||||||
"is_value": 1,
|
"is_value": 1,
|
||||||
"type": 6
|
"type": 6,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"id": 5,
|
"id": 5,
|
||||||
|
@ -1422,7 +1447,7 @@ dictionary_data = [
|
||||||
"creator_id": 1,
|
"creator_id": 1,
|
||||||
"parent_id": None,
|
"parent_id": None,
|
||||||
"is_value": 0,
|
"is_value": 0,
|
||||||
"type": 0
|
"type": 0,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"id": 6,
|
"id": 6,
|
||||||
|
@ -1439,7 +1464,7 @@ dictionary_data = [
|
||||||
"creator_id": 1,
|
"creator_id": 1,
|
||||||
"parent_id": 1,
|
"parent_id": 1,
|
||||||
"is_value": 1,
|
"is_value": 1,
|
||||||
"type": 6
|
"type": 6,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"id": 7,
|
"id": 7,
|
||||||
|
@ -1456,7 +1481,7 @@ dictionary_data = [
|
||||||
"creator_id": 1,
|
"creator_id": 1,
|
||||||
"parent_id": None,
|
"parent_id": None,
|
||||||
"is_value": 0,
|
"is_value": 0,
|
||||||
"type": 0
|
"type": 0,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"id": 8,
|
"id": 8,
|
||||||
|
@ -1473,7 +1498,7 @@ dictionary_data = [
|
||||||
"creator_id": 1,
|
"creator_id": 1,
|
||||||
"parent_id": 7,
|
"parent_id": 7,
|
||||||
"is_value": 1,
|
"is_value": 1,
|
||||||
"type": 1
|
"type": 1,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"id": 9,
|
"id": 9,
|
||||||
|
@ -1490,7 +1515,7 @@ dictionary_data = [
|
||||||
"creator_id": 1,
|
"creator_id": 1,
|
||||||
"parent_id": 7,
|
"parent_id": 7,
|
||||||
"is_value": 1,
|
"is_value": 1,
|
||||||
"type": 1
|
"type": 1,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"id": 10,
|
"id": 10,
|
||||||
|
@ -1507,7 +1532,7 @@ dictionary_data = [
|
||||||
"creator_id": 1,
|
"creator_id": 1,
|
||||||
"parent_id": None,
|
"parent_id": None,
|
||||||
"is_value": 0,
|
"is_value": 0,
|
||||||
"type": 0
|
"type": 0,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"id": 11,
|
"id": 11,
|
||||||
|
@ -1524,7 +1549,7 @@ dictionary_data = [
|
||||||
"creator_id": 1,
|
"creator_id": 1,
|
||||||
"parent_id": 5,
|
"parent_id": 5,
|
||||||
"is_value": 1,
|
"is_value": 1,
|
||||||
"type": 6
|
"type": 6,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"id": 12,
|
"id": 12,
|
||||||
|
@ -1541,7 +1566,7 @@ dictionary_data = [
|
||||||
"creator_id": 1,
|
"creator_id": 1,
|
||||||
"parent_id": 5,
|
"parent_id": 5,
|
||||||
"is_value": 1,
|
"is_value": 1,
|
||||||
"type": 6
|
"type": 6,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"id": 13,
|
"id": 13,
|
||||||
|
@ -1558,7 +1583,7 @@ dictionary_data = [
|
||||||
"creator_id": 1,
|
"creator_id": 1,
|
||||||
"parent_id": 10,
|
"parent_id": 10,
|
||||||
"is_value": 1,
|
"is_value": 1,
|
||||||
"type": 1
|
"type": 1,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"id": 14,
|
"id": 14,
|
||||||
|
@ -1575,7 +1600,7 @@ dictionary_data = [
|
||||||
"creator_id": 1,
|
"creator_id": 1,
|
||||||
"parent_id": 10,
|
"parent_id": 10,
|
||||||
"is_value": 1,
|
"is_value": 1,
|
||||||
"type": 1
|
"type": 1,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"id": 15,
|
"id": 15,
|
||||||
|
@ -1592,7 +1617,7 @@ dictionary_data = [
|
||||||
"creator_id": 1,
|
"creator_id": 1,
|
||||||
"parent_id": None,
|
"parent_id": None,
|
||||||
"is_value": 0,
|
"is_value": 0,
|
||||||
"type": 0
|
"type": 0,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"id": 16,
|
"id": 16,
|
||||||
|
@ -1609,7 +1634,7 @@ dictionary_data = [
|
||||||
"creator_id": 1,
|
"creator_id": 1,
|
||||||
"parent_id": 15,
|
"parent_id": 15,
|
||||||
"is_value": 1,
|
"is_value": 1,
|
||||||
"type": 1
|
"type": 1,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"id": 17,
|
"id": 17,
|
||||||
|
@ -1626,7 +1651,7 @@ dictionary_data = [
|
||||||
"creator_id": 1,
|
"creator_id": 1,
|
||||||
"parent_id": 15,
|
"parent_id": 15,
|
||||||
"is_value": 1,
|
"is_value": 1,
|
||||||
"type": 1
|
"type": 1,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"id": 18,
|
"id": 18,
|
||||||
|
@ -1643,7 +1668,7 @@ dictionary_data = [
|
||||||
"creator_id": 1,
|
"creator_id": 1,
|
||||||
"parent_id": None,
|
"parent_id": None,
|
||||||
"is_value": 0,
|
"is_value": 0,
|
||||||
"type": 0
|
"type": 0,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"id": 19,
|
"id": 19,
|
||||||
|
@ -1660,7 +1685,7 @@ dictionary_data = [
|
||||||
"creator_id": 1,
|
"creator_id": 1,
|
||||||
"parent_id": 18,
|
"parent_id": 18,
|
||||||
"is_value": 1,
|
"is_value": 1,
|
||||||
"type": 1
|
"type": 1,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"id": 20,
|
"id": 20,
|
||||||
|
@ -1677,7 +1702,7 @@ dictionary_data = [
|
||||||
"creator_id": 1,
|
"creator_id": 1,
|
||||||
"parent_id": 18,
|
"parent_id": 18,
|
||||||
"is_value": 1,
|
"is_value": 1,
|
||||||
"type": 1
|
"type": 1,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"id": 21,
|
"id": 21,
|
||||||
|
@ -1694,6 +1719,6 @@ dictionary_data = [
|
||||||
"creator_id": 1,
|
"creator_id": 1,
|
||||||
"parent_id": 18,
|
"parent_id": 18,
|
||||||
"is_value": 1,
|
"is_value": 1,
|
||||||
"type": 1
|
"type": 1,
|
||||||
}
|
},
|
||||||
]
|
]
|
||||||
|
|
|
@ -15,6 +15,7 @@ from dvadmin.system.models import (
|
||||||
MenuButton,
|
MenuButton,
|
||||||
Role,
|
Role,
|
||||||
Users,
|
Users,
|
||||||
|
Dictionary,
|
||||||
)
|
)
|
||||||
|
|
||||||
from .init_data import (
|
from .init_data import (
|
||||||
|
@ -78,7 +79,7 @@ class Initialize(CoreInitialize):
|
||||||
初始化字典表
|
初始化字典表
|
||||||
"""
|
"""
|
||||||
data = dictionary_data
|
data = dictionary_data
|
||||||
self.save(Users, data, "字典表", no_reset=False)
|
self.save(Dictionary, data, "字典表", no_reset=False)
|
||||||
|
|
||||||
def run(self):
|
def run(self):
|
||||||
self.init_dept()
|
self.init_dept()
|
||||||
|
|
|
@ -1,11 +1,3 @@
|
||||||
# -*- coding: utf-8 -*-
|
|
||||||
|
|
||||||
"""
|
|
||||||
@author: 猿小天
|
|
||||||
@contact: QQ:1638245306
|
|
||||||
@Created on: 2021/6/1 001 23:05
|
|
||||||
@Remark: 系统管理的路由文件
|
|
||||||
"""
|
|
||||||
from django.urls import path
|
from django.urls import path
|
||||||
from rest_framework import routers
|
from rest_framework import routers
|
||||||
|
|
||||||
|
@ -42,6 +34,7 @@ urlpatterns = [
|
||||||
path('menu/web_router/', MenuViewSet.as_view({'get': 'web_router'})),
|
path('menu/web_router/', MenuViewSet.as_view({'get': 'web_router'})),
|
||||||
path('user/user_info/', UserViewSet.as_view({'get': 'user_info', 'put': 'update_user_info'})),
|
path('user/user_info/', UserViewSet.as_view({'get': 'user_info', 'put': 'update_user_info'})),
|
||||||
path('user/change_password/<int:pk>/', UserViewSet.as_view({'put': 'change_password'})),
|
path('user/change_password/<int:pk>/', UserViewSet.as_view({'put': 'change_password'})),
|
||||||
|
path('user/reset_to_default_password/<int:pk>/', UserViewSet.as_view({'put': 'reset_to_default_password'})),
|
||||||
path('user/reset_password/<int:pk>/', UserViewSet.as_view({'put': 'reset_password'})),
|
path('user/reset_password/<int:pk>/', UserViewSet.as_view({'put': 'reset_password'})),
|
||||||
path('user/export/', UserViewSet.as_view({'post': 'export_data', })),
|
path('user/export/', UserViewSet.as_view({'post': 'export_data', })),
|
||||||
path('user/import/', UserViewSet.as_view({'get': 'import_data', 'post': 'import_data'})),
|
path('user/import/', UserViewSet.as_view({'get': 'import_data', 'post': 'import_data'})),
|
||||||
|
|
|
@ -242,8 +242,8 @@ class UserViewSet(CustomModelViewSet):
|
||||||
return ErrorResponse(msg="未获取到用户")
|
return ErrorResponse(msg="未获取到用户")
|
||||||
|
|
||||||
@action(methods=["PUT"], detail=True, permission_classes=[IsAuthenticated])
|
@action(methods=["PUT"], detail=True, permission_classes=[IsAuthenticated])
|
||||||
def reset_password(self, request, *args, **kwargs):
|
def reset_to_default_password(self, request, *args, **kwargs):
|
||||||
"""重置密码"""
|
"""恢复默认密码"""
|
||||||
instance = Users.objects.filter(id=kwargs.get("pk")).first()
|
instance = Users.objects.filter(id=kwargs.get("pk")).first()
|
||||||
if instance:
|
if instance:
|
||||||
instance.set_password(settings.DEFAULT_PASSWORD)
|
instance.set_password(settings.DEFAULT_PASSWORD)
|
||||||
|
@ -252,21 +252,21 @@ class UserViewSet(CustomModelViewSet):
|
||||||
else:
|
else:
|
||||||
return ErrorResponse(msg="未获取到用户")
|
return ErrorResponse(msg="未获取到用户")
|
||||||
|
|
||||||
# @action(methods=['PUT'], detail=True)
|
@action(methods=["PUT"], detail=True)
|
||||||
# def reset_password(self, request, pk):
|
def reset_password(self, request, pk):
|
||||||
# """
|
"""
|
||||||
# 密码重置
|
密码重置
|
||||||
# """
|
"""
|
||||||
# instance = Users.objects.filter(id=pk).first()
|
instance = Users.objects.filter(id=pk).first()
|
||||||
# data = request.data
|
data = request.data
|
||||||
# new_pwd = data.get('newPassword')
|
new_pwd = data.get("newPassword")
|
||||||
# new_pwd2 = data.get('newPassword2')
|
new_pwd2 = data.get("newPassword2")
|
||||||
# if instance:
|
if instance:
|
||||||
# if new_pwd != new_pwd2:
|
if new_pwd != new_pwd2:
|
||||||
# return ErrorResponse(msg="两次密码不匹配")
|
return ErrorResponse(msg="两次密码不匹配")
|
||||||
# else:
|
else:
|
||||||
# instance.password = make_password(new_pwd)
|
instance.password = make_password(new_pwd)
|
||||||
# instance.save()
|
instance.save()
|
||||||
# return DetailResponse(data=None, msg="修改成功")
|
return DetailResponse(data=None, msg="修改成功")
|
||||||
# else:
|
else:
|
||||||
# return ErrorResponse(msg="未获取到用户")
|
return ErrorResponse(msg="未获取到用户")
|
||||||
|
|
|
@ -1,7 +1,5 @@
|
||||||
<template>
|
<template>
|
||||||
<div class="page-login">
|
<div class="page-login"></div>
|
||||||
|
|
||||||
</div>
|
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
|
@ -14,8 +12,10 @@ export default {
|
||||||
computed: {
|
computed: {
|
||||||
...mapState('d2admin', {
|
...mapState('d2admin', {
|
||||||
siteName: (state) => state.settings.siteName, // 网站名称
|
siteName: (state) => state.settings.siteName, // 网站名称
|
||||||
siteLogo: (state) => state.settings.siteLogo || require('./image/dvadmin.png'), // 网站logo地址
|
siteLogo: (state) =>
|
||||||
loginBackground: (state) => state.settings.loginBackground || require('./image/bg.jpg'), // 登录页背景图
|
state.settings.siteLogo || require('./image/dvadmin.png'), // 网站logo地址
|
||||||
|
loginBackground: (state) =>
|
||||||
|
state.settings.loginBackground || require('./image/bg.jpg'), // 登录页背景图
|
||||||
copyright: (state) => state.settings.copyright, // 版权
|
copyright: (state) => state.settings.copyright, // 版权
|
||||||
keepRecord: (state) => state.settings.keepRecord, // 备案
|
keepRecord: (state) => state.settings.keepRecord, // 备案
|
||||||
helpUrl: (state) => state.settings.helpUrl, // 帮助
|
helpUrl: (state) => state.settings.helpUrl, // 帮助
|
||||||
|
@ -33,8 +33,8 @@ export default {
|
||||||
backgroundImage: 'url(' + this.loginBackground + ')',
|
backgroundImage: 'url(' + this.loginBackground + ')',
|
||||||
// 表单
|
// 表单
|
||||||
formLogin: {
|
formLogin: {
|
||||||
username: '',
|
username: 'superadmin',
|
||||||
password: '',
|
password: 'admin123456',
|
||||||
captcha: ''
|
captcha: ''
|
||||||
},
|
},
|
||||||
// 表单校验
|
// 表单校验
|
||||||
|
@ -65,10 +65,8 @@ export default {
|
||||||
image_base: null
|
image_base: null
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
mounted () {
|
mounted () {},
|
||||||
},
|
beforeDestroy () {},
|
||||||
beforeDestroy () {
|
|
||||||
},
|
|
||||||
methods: {
|
methods: {
|
||||||
...mapActions('d2admin/account', ['login']),
|
...mapActions('d2admin/account', ['login']),
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -1,5 +1,13 @@
|
||||||
<template>
|
<template>
|
||||||
<div class="w3l-signinform" :style="{background: 'url('+ (loginBackground || require('./image/bg.jpg')) + ') no-repeat center'}">
|
<div
|
||||||
|
class="w3l-signinform"
|
||||||
|
:style="{
|
||||||
|
background:
|
||||||
|
'url(' +
|
||||||
|
(loginBackground || require('./image/bg.jpg')) +
|
||||||
|
') no-repeat center'
|
||||||
|
}"
|
||||||
|
>
|
||||||
<!-- container -->
|
<!-- container -->
|
||||||
<div class="wrapper">
|
<div class="wrapper">
|
||||||
<!-- main content -->
|
<!-- main content -->
|
||||||
|
@ -7,12 +15,14 @@
|
||||||
<!-- logo -->
|
<!-- logo -->
|
||||||
<img class="page-login--logo" :src="siteLogo" width="300" />
|
<img class="page-login--logo" :src="siteLogo" width="300" />
|
||||||
<div class="w3_info">
|
<div class="w3_info">
|
||||||
<h2 style="text-align: center;">{{siteName || processTitle}}</h2>
|
<h2 style="text-align: center">{{ siteName || processTitle }}</h2>
|
||||||
<el-card shadow="always" class="card">
|
<el-card shadow="always" class="card">
|
||||||
<el-tabs v-model="activeName">
|
<el-tabs v-model="activeName">
|
||||||
<el-tab-pane label="账号密码登录" name="first" stretch>
|
<el-tab-pane label="账号密码登录" name="first" stretch>
|
||||||
<span slot="label"><span style="margin: 30px;">账号密码登录</span></span>
|
<span slot="label"
|
||||||
<br>
|
><span style="margin: 30px">账号密码登录</span></span
|
||||||
|
>
|
||||||
|
<br />
|
||||||
<el-form
|
<el-form
|
||||||
ref="loginForm"
|
ref="loginForm"
|
||||||
label-position="top"
|
label-position="top"
|
||||||
|
@ -58,17 +68,22 @@
|
||||||
</template>
|
</template>
|
||||||
</el-input>
|
</el-input>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<button class="btn btn-primary btn-block" @click="submit">登录</button>
|
<button class="btn btn-primary btn-block" @click="submit">
|
||||||
|
登录
|
||||||
|
</button>
|
||||||
</el-form>
|
</el-form>
|
||||||
</el-tab-pane>
|
</el-tab-pane>
|
||||||
</el-tabs>
|
</el-tabs>
|
||||||
</el-card>
|
</el-card>
|
||||||
|
|
||||||
<!-- footer -->
|
<!-- footer -->
|
||||||
<div class="footer">
|
<div class="footer">
|
||||||
<p>Copyright © {{ copyright }}</p>
|
<p>Copyright © {{ copyright }}</p>
|
||||||
<p>
|
<p>
|
||||||
<a href="https://beian.miit.gov.cn" target="_blank">{{keepRecord}}</a> |
|
<a href="https://beian.miit.gov.cn" target="_blank">{{
|
||||||
<a :href="helpUrl || '#'" target="_blank">帮助</a> |
|
keepRecord
|
||||||
|
}}</a>
|
||||||
|
| <a :href="helpUrl || '#'" target="_blank">帮助</a> |
|
||||||
<a :href="privacyUrl || '#'" target="_blank">隐私</a> |
|
<a :href="privacyUrl || '#'" target="_blank">隐私</a> |
|
||||||
<a :href="clauseUrl || '#'" target="_blank">条款</a>
|
<a :href="clauseUrl || '#'" target="_blank">条款</a>
|
||||||
</p>
|
</p>
|
||||||
|
@ -92,12 +107,9 @@ export default {
|
||||||
activeName: 'first'
|
activeName: 'first'
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
created () {
|
created () {},
|
||||||
},
|
mounted () {},
|
||||||
mounted () {
|
|
||||||
},
|
|
||||||
methods: {}
|
methods: {}
|
||||||
|
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|
|
@ -55,3 +55,11 @@ export function ResetPwd (obj) {
|
||||||
data: obj
|
data: obj
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export function ResetPwd2Default (obj) {
|
||||||
|
return request({
|
||||||
|
url: urlPrefix + 'reset_to_default_password/' + obj.id + '/',
|
||||||
|
method: 'put',
|
||||||
|
data: obj
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
|
@ -12,7 +12,7 @@ export const crudOptions = (vm) => {
|
||||||
rowKey: true // 必须设置,true or false
|
rowKey: true // 必须设置,true or false
|
||||||
},
|
},
|
||||||
rowHandle: {
|
rowHandle: {
|
||||||
width: 230,
|
width: 270,
|
||||||
fixed: 'right',
|
fixed: 'right',
|
||||||
view: {
|
view: {
|
||||||
thin: true,
|
thin: true,
|
||||||
|
@ -37,16 +37,27 @@ export const crudOptions = (vm) => {
|
||||||
},
|
},
|
||||||
custom: [
|
custom: [
|
||||||
{
|
{
|
||||||
|
thin: true,
|
||||||
|
text: '',
|
||||||
|
size: 'small',
|
||||||
|
type: 'warning',
|
||||||
|
icon: 'el-icon-refresh-left',
|
||||||
show () {
|
show () {
|
||||||
return vm.hasPermissions('ResetPassword')
|
return vm.hasPermissions('ResetPassword')
|
||||||
},
|
},
|
||||||
|
emit: 'resetPassword'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
show () {
|
||||||
|
return vm.hasPermissions('DefaultPassword')
|
||||||
|
},
|
||||||
disabled () {
|
disabled () {
|
||||||
return !vm.hasPermissions('ResetPassword')
|
return !vm.hasPermissions('DefaultPassword')
|
||||||
},
|
},
|
||||||
text: '重置密码',
|
text: '重置密码',
|
||||||
type: 'warning',
|
type: 'warning',
|
||||||
size: 'small',
|
size: 'small',
|
||||||
emit: 'resetPassword'
|
emit: 'defaultPassword'
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
|
|
@ -5,6 +5,7 @@
|
||||||
v-bind="_crudProps"
|
v-bind="_crudProps"
|
||||||
v-on="_crudListeners"
|
v-on="_crudListeners"
|
||||||
@resetPassword="resetPassword"
|
@resetPassword="resetPassword"
|
||||||
|
@defaultPassword="defaultPassword"
|
||||||
>
|
>
|
||||||
<div slot="header">
|
<div slot="header">
|
||||||
<crud-search
|
<crud-search
|
||||||
|
@ -31,20 +32,36 @@
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
</d2-crud-x>
|
</d2-crud-x>
|
||||||
<!-- <el-dialog title="密码重置" :visible.sync="dialogFormVisible" :close-on-click-modal="false">
|
<el-dialog
|
||||||
|
title="密码重置"
|
||||||
|
:visible.sync="dialogFormVisible"
|
||||||
|
:close-on-click-modal="false"
|
||||||
|
>
|
||||||
<el-form :model="resetPwdForm" ref="resetPwdForm" :rules="passwordRules">
|
<el-form :model="resetPwdForm" ref="resetPwdForm" :rules="passwordRules">
|
||||||
<el-form-item label="密码" prop="pwd">
|
<el-form-item label="密码" prop="pwd">
|
||||||
<el-input v-model="resetPwdForm.pwd" type="password" show-password clearable autocomplete="off"></el-input>
|
<el-input
|
||||||
|
v-model="resetPwdForm.pwd"
|
||||||
|
type="password"
|
||||||
|
show-password
|
||||||
|
clearable
|
||||||
|
autocomplete="off"
|
||||||
|
></el-input>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="再次输入密码" prop="pwd2">
|
<el-form-item label="再次输入密码" prop="pwd2">
|
||||||
<el-input v-model="resetPwdForm.pwd2" type="password" show-password clearable autocomplete="off"></el-input>
|
<el-input
|
||||||
|
v-model="resetPwdForm.pwd2"
|
||||||
|
type="password"
|
||||||
|
show-password
|
||||||
|
clearable
|
||||||
|
autocomplete="off"
|
||||||
|
></el-input>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-form>
|
</el-form>
|
||||||
<div slot="footer" class="dialog-footer">
|
<div slot="footer" class="dialog-footer">
|
||||||
<el-button @click="dialogFormVisible = false">取 消</el-button>
|
<el-button @click="dialogFormVisible = false">取 消</el-button>
|
||||||
<el-button type="primary" @click="resetPwdSubmit">确 定</el-button>
|
<el-button type="primary" @click="resetPwdSubmit">确 定</el-button>
|
||||||
</div>
|
</div>
|
||||||
</el-dialog> -->
|
</el-dialog>
|
||||||
</d2-container>
|
</d2-container>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
|
@ -57,39 +74,45 @@ export default {
|
||||||
name: 'user',
|
name: 'user',
|
||||||
mixins: [d2CrudPlus.crud],
|
mixins: [d2CrudPlus.crud],
|
||||||
data () {
|
data () {
|
||||||
// var validatePass = (rule, value, callback) => {
|
var validatePass = (rule, value, callback) => {
|
||||||
// const pwdRegex = new RegExp('(?=.*[0-9])(?=.*[a-zA-Z]).{8,30}')
|
const pwdRegex = new RegExp('(?=.*[0-9])(?=.*[a-zA-Z]).{8,30}')
|
||||||
// if (value === '') {
|
if (value === '') {
|
||||||
// callback(new Error('请输入密码'))
|
callback(new Error('请输入密码'))
|
||||||
// } else if (!pwdRegex.test(value)) {
|
} else if (!pwdRegex.test(value)) {
|
||||||
// callback(new Error('您的密码复杂度太低(密码中必须包含字母、数字)'))
|
callback(new Error('您的密码复杂度太低(密码中必须包含字母、数字)'))
|
||||||
// } else {
|
} else {
|
||||||
// if (this.resetPwdForm.pwd2 !== '') {
|
if (this.resetPwdForm.pwd2 !== '') {
|
||||||
// this.$refs.resetPwdForm.validateField('pwd2')
|
this.$refs.resetPwdForm.validateField('pwd2')
|
||||||
// }
|
}
|
||||||
// callback()
|
callback()
|
||||||
// }
|
}
|
||||||
// }
|
}
|
||||||
// var validatePass2 = (rule, value, callback) => {
|
var validatePass2 = (rule, value, callback) => {
|
||||||
// if (value === '') {
|
if (value === '') {
|
||||||
// callback(new Error('请再次输入密码'))
|
callback(new Error('请再次输入密码'))
|
||||||
// } else if (value !== this.resetPwdForm.pwd) {
|
} else if (value !== this.resetPwdForm.pwd) {
|
||||||
// callback(new Error('两次输入密码不一致!'))
|
callback(new Error('两次输入密码不一致!'))
|
||||||
// } else {
|
} else {
|
||||||
// callback()
|
callback()
|
||||||
// }
|
}
|
||||||
// }
|
}
|
||||||
return {
|
return {
|
||||||
// dialogFormVisible: false,
|
dialogFormVisible: false,
|
||||||
// resetPwdForm: {
|
resetPwdForm: {
|
||||||
// id: null,
|
id: null,
|
||||||
// pwd: null,
|
pwd: null,
|
||||||
// pwd2: null
|
pwd2: null
|
||||||
// },
|
},
|
||||||
// passwordRules: {
|
passwordRules: {
|
||||||
// pwd: [{ required: true, message: '必填项' }, { validator: validatePass, trigger: 'blur' }],
|
pwd: [
|
||||||
// pwd2: [{ required: true, message: '必填项' }, { validator: validatePass2, trigger: 'blur' }]
|
{ required: true, message: '必填项' },
|
||||||
// }
|
{ validator: validatePass, trigger: 'blur' }
|
||||||
|
],
|
||||||
|
pwd2: [
|
||||||
|
{ required: true, message: '必填项' },
|
||||||
|
{ validator: validatePass2, trigger: 'blur' }
|
||||||
|
]
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
@ -109,40 +132,40 @@ export default {
|
||||||
delRequest (row) {
|
delRequest (row) {
|
||||||
return api.DelObj(row.id)
|
return api.DelObj(row.id)
|
||||||
},
|
},
|
||||||
resetPassword (scope) {
|
defaultPassword (scope) {
|
||||||
api.ResetPwd(scope.row).then((res) => {
|
api.ResetPwd2Default(scope.row).then((res) => {
|
||||||
this.$message.success('密码重置成功')
|
this.$message.success('密码重置成功')
|
||||||
})
|
})
|
||||||
|
},
|
||||||
|
// 重置密码弹框
|
||||||
|
resetPassword ({ row }) {
|
||||||
|
this.dialogFormVisible = true
|
||||||
|
this.resetPwdForm.id = row.id
|
||||||
|
},
|
||||||
|
// 重置密码确认
|
||||||
|
resetPwdSubmit () {
|
||||||
|
const that = this
|
||||||
|
that.$refs.resetPwdForm.validate((valid) => {
|
||||||
|
if (valid) {
|
||||||
|
const params = {
|
||||||
|
id: that.resetPwdForm.id,
|
||||||
|
newPassword: that.$md5(that.resetPwdForm.pwd),
|
||||||
|
newPassword2: that.$md5(that.resetPwdForm.pwd2)
|
||||||
|
}
|
||||||
|
api.ResetPwd(params).then((res) => {
|
||||||
|
that.dialogFormVisible = false
|
||||||
|
that.resetPwdForm = {
|
||||||
|
id: null,
|
||||||
|
pwd: null,
|
||||||
|
pwd2: null
|
||||||
|
}
|
||||||
|
that.$message.success('修改成功')
|
||||||
|
})
|
||||||
|
} else {
|
||||||
|
that.$message.error('表单校验失败,请检查')
|
||||||
|
}
|
||||||
|
})
|
||||||
}
|
}
|
||||||
// // 重置密码弹框
|
|
||||||
// resetPwd ({ row }) {
|
|
||||||
// this.dialogFormVisible = true
|
|
||||||
// this.resetPwdForm.id = row.id
|
|
||||||
// },
|
|
||||||
// // 重置密码确认
|
|
||||||
// resetPwdSubmit () {
|
|
||||||
// const that = this
|
|
||||||
// that.$refs.resetPwdForm.validate((valid) => {
|
|
||||||
// if (valid) {
|
|
||||||
// const params = {
|
|
||||||
// id: that.resetPwdForm.id,
|
|
||||||
// newPassword: that.$md5(that.resetPwdForm.pwd),
|
|
||||||
// newPassword2: that.$md5(that.resetPwdForm.pwd2)
|
|
||||||
// }
|
|
||||||
// api.ResetPwd(params).then(res => {
|
|
||||||
// that.dialogFormVisible = false
|
|
||||||
// that.resetPwdForm = {
|
|
||||||
// id: null,
|
|
||||||
// pwd: null,
|
|
||||||
// pwd2: null
|
|
||||||
// }
|
|
||||||
// that.$message.success('修改成功')
|
|
||||||
// })
|
|
||||||
// } else {
|
|
||||||
// that.$message.error('表单校验失败,请检查')
|
|
||||||
// }
|
|
||||||
// })
|
|
||||||
// }
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
Loading…
Reference in New Issue