parent
20e18b566a
commit
5f1b97bc4e
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -0,0 +1,52 @@
|
||||
# Generated by Django 5.0.6 on 2024-05-31 02:45
|
||||
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('manage', '0001_initial'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.RenameModel(
|
||||
old_name='employe',
|
||||
new_name='employee',
|
||||
),
|
||||
migrations.RenameField(
|
||||
model_name='employee',
|
||||
old_name='employe_information',
|
||||
new_name='employee_information',
|
||||
),
|
||||
migrations.RemoveField(
|
||||
model_name='department',
|
||||
name='employe_number',
|
||||
),
|
||||
migrations.AddField(
|
||||
model_name='department',
|
||||
name='employee_number',
|
||||
field=models.CharField(default=1, max_length=4, verbose_name='员工数量'),
|
||||
preserve_default=False,
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name='administrator',
|
||||
name='administrator_name',
|
||||
field=models.CharField(max_length=10, verbose_name='管理员名称'),
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name='customer',
|
||||
name='customer_age',
|
||||
field=models.CharField(max_length=3, verbose_name='客户年龄'),
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name='customer',
|
||||
name='customer_name',
|
||||
field=models.CharField(max_length=10, verbose_name='客户名称'),
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name='project',
|
||||
name='project_leader',
|
||||
field=models.CharField(max_length=10, verbose_name='项目名称'),
|
||||
),
|
||||
]
|
Binary file not shown.
@ -1,47 +1,92 @@
|
||||
from django.shortcuts import render,redirect,HttpResponse
|
||||
from django.contrib.auth.hashers import make_password,check_password
|
||||
from django.shortcuts import render
|
||||
from django.views import View
|
||||
from django.contrib import auth
|
||||
from .models import administrator
|
||||
from django.contrib.auth.decorators import login_required
|
||||
import datetime
|
||||
import uuid
|
||||
from django.http import HttpResponseRedirect
|
||||
from .models import *
|
||||
|
||||
# class Login(View):
|
||||
# def get(self,request):
|
||||
# error_info = request.session.pop('error_info',"")
|
||||
# return render(request,'login.html',context={'error_info':error_info})
|
||||
#
|
||||
# def post(self,request):
|
||||
#
|
||||
# res_get = request.GET.get('next',"")
|
||||
# print("res_get:",res_get)
|
||||
#
|
||||
# user = request.POST.get('user',"")
|
||||
# pwd = request.POST.get('passwd',"")
|
||||
#
|
||||
# user_obj = auth.authenticate(username=user,password=pwd)
|
||||
# if user_obj:
|
||||
# auth.login(request,user_obj)
|
||||
# return redirect('index')
|
||||
# else:
|
||||
# request.session['error_info'] ="用户名或密码错误,请检查"
|
||||
# return redirect('login')
|
||||
#
|
||||
# @login_required
|
||||
# def index(request):
|
||||
# res = request.user
|
||||
# return HttpResponse("Ok %s" % res.username)
|
||||
#
|
||||
# def logout(request):
|
||||
# auth.logout(request)
|
||||
# return redirect('login')
|
||||
|
||||
class LoginChooseView(View):
|
||||
|
||||
# 登录选择
|
||||
class ChooseLoginView(View):
|
||||
def get(self,request):
|
||||
return render(request,'login_choose.html')
|
||||
return render(request, 'ChooseLogin.html')
|
||||
|
||||
|
||||
# 客户登录
|
||||
class CustomerLoginView(View):
|
||||
def get(self, request):
|
||||
return render(request, 'Customerlogin.html')
|
||||
|
||||
def post(self, request):
|
||||
id = request.POST.get('id', "")
|
||||
customer_name = request.POST.get('customer_name', "")
|
||||
customer_list = customer.objects.filter(id=id, customer_name=customer_name)
|
||||
if customer_list:
|
||||
print(type(customer_list[0]))
|
||||
request.session.clear()
|
||||
request.session['customer'] = customer_list[0].name
|
||||
return HttpResponseRedirect('/customercenter/')
|
||||
else:
|
||||
return HttpResponseRedirect('/customerlogin/')
|
||||
|
||||
|
||||
#员工登录
|
||||
class EmployeeLoginView(View):
|
||||
def get(self,request):
|
||||
return render(request,'Customerlogin.html')
|
||||
return render(request, 'Employeelogin.html')
|
||||
|
||||
def post(self,request):
|
||||
id = request.POST.get('id',"")
|
||||
customer_name = request.POST.get('customer_name',"")
|
||||
password = request.POST.get('password',"")
|
||||
employee_list =employee.objects.filter(id=id,password=password)
|
||||
if employee_list:
|
||||
request.session['employee'] = employee_list[0].name
|
||||
request.session['employee_image'] = str(employee_list[0].img)
|
||||
return HttpResponseRedirect('/employeecenter/')
|
||||
else:
|
||||
return HttpResponseRedirect('/employeelogin/')
|
||||
|
||||
|
||||
#客户注册
|
||||
class CustomerRegisterView(View):
|
||||
def get(self,request):
|
||||
return render(request, 'Customerregister.html')
|
||||
def post(self, request, customer):#customer引用失败
|
||||
# 只能注册客户账号,不能注册员工账号,员工账号只能由管理员创建
|
||||
id = request.POST.get('id',"")
|
||||
customer_list = customer.objects.filter(id=id)
|
||||
if customer_list:
|
||||
return render(request, 'Customerregister.html'),{"err":1, "tips": "该客户账号已存在"}
|
||||
else:
|
||||
customer_name = request.POST.get('customer_name',"")
|
||||
customer_age = request.POST.get('customer_age',"")
|
||||
customer_priority = request.POST.get('customer_priority',"")
|
||||
customer = customer.objects.create(id=id,customer_name=customer_name,customer_age=customer_age,customer_priority=customer_priority)
|
||||
if customer:
|
||||
return HttpResponseRedirect('/customerlogin/')
|
||||
return HttpResponseRedirect('/customerregister/')
|
||||
|
||||
#客户界面
|
||||
class CustomerCenterView(View):
|
||||
def get(self,request):
|
||||
customer = request.session.get('customer')
|
||||
print(customer)
|
||||
return render(request, 'Customercenter.html', {"customer_id":customer})
|
||||
|
||||
#员工界面
|
||||
class EmployeeCenterView(View):
|
||||
def get(self,request):
|
||||
employee = request.session.get('employee','')
|
||||
employee_image = request.session.get('employee_image','')
|
||||
return render(request, 'Employeecenter.html', {"employee_id":employee, 'employee_image':employee_image})
|
||||
|
||||
|
||||
|
||||
|
||||
#管理员登录
|
||||
# class AdministratorLoginView(View):
|
||||
# def get(self,request):
|
||||
# return render(request,'Administratorlogin.html')
|
||||
# def post(self,request):
|
||||
# id = request.POST.get('id',"")
|
||||
# administrator_name = request.POST.get('administrator_name',"")
|
||||
|
Binary file not shown.
Binary file not shown.
@ -0,0 +1,10 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<title>管理员登录</title>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
</body>
|
||||
</html>
|
@ -0,0 +1,48 @@
|
||||
<!DOCTYPE html>
|
||||
{% load static %}
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<title>Django企业项目管理系统</title>
|
||||
{# <link rel="stylesheet" type="text/css" href="/static/css/login_choose.css/">#}
|
||||
</head>
|
||||
<body>
|
||||
<div class="PageFont">
|
||||
<h1 style="">Django企业项目管理系统</h1>
|
||||
</div>
|
||||
|
||||
<div class="bottom">
|
||||
|
||||
<!-- 客户登录 -->
|
||||
<div class="PageCustomer">
|
||||
<a href="/Customer_login/">
|
||||
{# <img src="/static/images/customer.png" alt=""/>#}
|
||||
<p>客户登录</p>
|
||||
</a>
|
||||
</div>
|
||||
|
||||
<!-- 员工登录 -->
|
||||
<div class="PageEmployee">
|
||||
<a href="/Employee_login/">
|
||||
{# <img src="/static/images/employee.png" alt=""/>#}
|
||||
<p>员工登录</p>
|
||||
</a>
|
||||
</div>
|
||||
|
||||
<!-- 管理员登录 -->
|
||||
<div class="Administrator">
|
||||
{# <a href="admin">#}
|
||||
{# <img src="/static/images/admin.png" alt=""/>#}
|
||||
{# <p class="Administrator">管理员登录</p>#}
|
||||
{# </a>#}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="copyright" style="">
|
||||
<p>
|
||||
<span>Copyright(C). Create By BHML 2024, All Rights Reserved.</span>
|
||||
</p>
|
||||
</div>
|
||||
|
||||
</body>
|
||||
</html>
|
@ -0,0 +1,10 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<title>客户界面</title>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
</body>
|
||||
</html>
|
@ -0,0 +1,10 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<title>客户登录</title>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
</body>
|
||||
</html>
|
@ -0,0 +1,10 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<title>客户注册</title>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
</body>
|
||||
</html>
|
@ -0,0 +1,10 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<title>员工界面</title>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
</body>
|
||||
</html>
|
@ -0,0 +1,20 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<title>员工登录</title>
|
||||
<link rel="stylesheet" type="text/css" href="/static/css/emplyeelogin.css/">
|
||||
</head>
|
||||
<body>
|
||||
{% load static %}
|
||||
<div class="logo_box">
|
||||
<img src="/static/images/employee.png" alt=""/>
|
||||
</div>
|
||||
<div>
|
||||
<form action="login_box" method="POST" action="/employeelogin/">
|
||||
|
||||
|
||||
</form>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
Loading…
Reference in new issue