kehu
This commit is contained in:
parent
87c158888a
commit
d918bb68db
|
|
@ -2,8 +2,8 @@
|
|||
ENV = 'development'
|
||||
|
||||
# base api
|
||||
#VUE_APP_BASE_API = 'http://localhost:8000/api'
|
||||
VUE_APP_BASE_API = 'http://47.95.0.242:2222/api'
|
||||
VUE_APP_BASE_API = 'http://127.0.0.1:8000/api'
|
||||
#VUE_APP_BASE_API = 'http://47.95.0.242:2222/api'
|
||||
|
||||
|
||||
# vue-cli uses the VUE_CLI_BABEL_TRANSPILE_MODULES environment variable,
|
||||
|
|
|
|||
|
|
@ -0,0 +1,59 @@
|
|||
import request from '@/utils/request'
|
||||
//客户
|
||||
export function getCustomerList(query) {
|
||||
return request({
|
||||
url: '/sam/customer/',
|
||||
method: 'get',
|
||||
params: query
|
||||
})
|
||||
}
|
||||
export function createCustomer(data) {
|
||||
return request({
|
||||
url: '/sam/customer/',
|
||||
method: 'post',
|
||||
data
|
||||
})
|
||||
}
|
||||
export function updateCustomer(id, data) {
|
||||
return request({
|
||||
url: `/sam/customer/${id}/`,
|
||||
method: 'put',
|
||||
data
|
||||
})
|
||||
}
|
||||
export function deleteCustomer(id, data) {
|
||||
return request({
|
||||
url: `/sam/customer/${id}/`,
|
||||
method: 'delete',
|
||||
data
|
||||
})
|
||||
}
|
||||
//合同
|
||||
export function getContractList(query) {
|
||||
return request({
|
||||
url: '/sam/contract/',
|
||||
method: 'get',
|
||||
params: query
|
||||
})
|
||||
}
|
||||
export function createContract(data) {
|
||||
return request({
|
||||
url: '/sam/contract/',
|
||||
method: 'post',
|
||||
data
|
||||
})
|
||||
}
|
||||
export function updateContract(id, data) {
|
||||
return request({
|
||||
url: `/sam/contract/${id}/`,
|
||||
method: 'put',
|
||||
data
|
||||
})
|
||||
}
|
||||
export function deleteContract(id, data) {
|
||||
return request({
|
||||
url: `/sam/contract/${id}/`,
|
||||
method: 'delete',
|
||||
data
|
||||
})
|
||||
}
|
||||
|
|
@ -101,6 +101,27 @@ export const asyncRoutes = [
|
|||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
path: '/sam',
|
||||
component: Layout,
|
||||
redirect: '/sam/index',
|
||||
name: 'sam',
|
||||
meta: { title: '合同管理', icon: 'example', perms: ['equipment_set'] },
|
||||
children: [
|
||||
{
|
||||
path: 'customer',
|
||||
name: 'customer',
|
||||
component: () => import('@/views/sam/customer'),
|
||||
meta: { title: '客户信息', icon: 'example', perms: ['index_manage'] }
|
||||
},
|
||||
{
|
||||
path: 'contract',
|
||||
name: 'contract',
|
||||
component: () => import('@/views/sam/contract'),
|
||||
meta: { title: '合同信息', icon: 'example', perms: ['index_manage'] }
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
path: '/inm',
|
||||
component: Layout,
|
||||
|
|
|
|||
|
|
@ -0,0 +1,261 @@
|
|||
<template>
|
||||
<div class="app-container">
|
||||
<el-card>
|
||||
<div>
|
||||
<el-input
|
||||
v-model="listQuery.search"
|
||||
placeholder="仓库名称/仓库编号"
|
||||
style="width: 300px"
|
||||
class="filter-item"
|
||||
@keyup.enter.native="handleFilter"
|
||||
/>
|
||||
<el-button
|
||||
class="filter-item"
|
||||
type="primary"
|
||||
icon="el-icon-search"
|
||||
@click="handleFilter"
|
||||
>搜索</el-button
|
||||
>
|
||||
<el-button
|
||||
class="filter-item"
|
||||
type="primary"
|
||||
icon="el-icon-refresh-left"
|
||||
@click="resetFilter"
|
||||
>重置</el-button
|
||||
>
|
||||
</div>
|
||||
<div style="margin-top: 10px">
|
||||
<el-button type="primary" icon="el-icon-plus" @click="handleCreate"
|
||||
>新增仓库</el-button
|
||||
>
|
||||
</div>
|
||||
</el-card>
|
||||
<el-card style="margin-top: 10px">
|
||||
<el-table
|
||||
v-loading="listLoading"
|
||||
:data="warehouseList.results"
|
||||
border
|
||||
fit
|
||||
stripe
|
||||
highlight-current-row
|
||||
max-height="600"
|
||||
>
|
||||
<el-table-column type="index" width="50" />
|
||||
<el-table-column label="客户名称">
|
||||
<template slot-scope="scope">{{ scope.row.name }}</template>
|
||||
</el-table-column>
|
||||
|
||||
<el-table-column label="详细地址">
|
||||
<template slot-scope="scope">{{ scope.row.address }}</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="联系人">
|
||||
<template slot-scope="scope">{{ scope.row.contact }}</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="联系电话">
|
||||
<template slot-scope="scope">{{ scope.row.contact_phone }}</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="描述">
|
||||
<template slot-scope="scope">{{ scope.row.description }}</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="创建时间">
|
||||
<template slot-scope="scope">{{ scope.row.create_time }}</template>
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
align="center"
|
||||
label="操作"
|
||||
width="220px"
|
||||
>
|
||||
<template slot-scope="scope">
|
||||
|
||||
<el-link
|
||||
v-if="checkPermission(['warehouse_update'])"
|
||||
@click="handleEdit(scope)"
|
||||
>编辑</el-link
|
||||
>
|
||||
<el-link
|
||||
v-if="checkPermission(['warehouse_delete'])"
|
||||
type="danger"
|
||||
@click="handleDelete(scope)"
|
||||
>删除</el-link
|
||||
>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
<pagination
|
||||
v-show="warehouseList.count > 0"
|
||||
:total="warehouseList.count"
|
||||
:page.sync="listQuery.page"
|
||||
:limit.sync="listQuery.page_size"
|
||||
@pagination="getList"
|
||||
/>
|
||||
</el-card>
|
||||
<el-dialog
|
||||
:visible.sync="dialogVisible"
|
||||
:title="dialogType === 'edit' ? '编辑仓库' : '新增仓库'"
|
||||
>
|
||||
<el-form
|
||||
ref="Form"
|
||||
:model="warehouse"
|
||||
label-width="80px"
|
||||
label-position="right"
|
||||
:rules="rule1"
|
||||
>
|
||||
<el-form-item label="客户名称" prop="name">
|
||||
<el-input v-model="warehouse.name" placeholder="仓库名称" />
|
||||
</el-form-item>
|
||||
<el-form-item label="客户地址" prop="address">
|
||||
<el-input v-model="warehouse.address" placeholder="仓库编号" />
|
||||
</el-form-item>
|
||||
<el-form-item label="联系人" prop="contact">
|
||||
<el-input v-model="warehouse.contact" placeholder="具体地点" />
|
||||
</el-form-item>
|
||||
<el-form-item label="联系电话" prop="contact_phone">
|
||||
<el-input v-model="warehouse.contact_phone" placeholder="仓库编号" />
|
||||
</el-form-item>
|
||||
<el-form-item label="描述" prop="description">
|
||||
<el-input v-model="warehouse.description" placeholder="具体地点" />
|
||||
</el-form-item>
|
||||
|
||||
</el-form>
|
||||
<div style="text-align: right">
|
||||
<el-button type="danger" @click="dialogVisible = false">取消</el-button>
|
||||
<el-button type="primary" @click="confirm('Form')">确认</el-button>
|
||||
</div>
|
||||
</el-dialog>
|
||||
</div>
|
||||
</template>
|
||||
<script>
|
||||
import { getWarehouseList, createWarehouse,updateWarehouse,deleteWarehouse } from "@/api/inm";
|
||||
import checkPermission from "@/utils/permission";
|
||||
|
||||
|
||||
import { genTree } from "@/utils";
|
||||
import Pagination from "@/components/Pagination"; // secondary package based on el-pagination
|
||||
const defaultewarehouse = {
|
||||
};
|
||||
export default {
|
||||
components: { Pagination },
|
||||
data() {
|
||||
return {
|
||||
warehouse: defaultewarehouse,
|
||||
warehouseList: {
|
||||
count: 0,
|
||||
},
|
||||
options: [{
|
||||
value: 0,
|
||||
label: '运转正常'
|
||||
}, {
|
||||
value: 1,
|
||||
label: '停用'
|
||||
}, {
|
||||
value: 2,
|
||||
label: '报废'
|
||||
}],
|
||||
listQuery: {
|
||||
page: 1,
|
||||
page_size: 20,
|
||||
},
|
||||
keeperOptions:[],
|
||||
depOptions:[],
|
||||
listLoading: true,
|
||||
dialogVisible: false,
|
||||
dialogType: "new",
|
||||
rule1: {
|
||||
name: [{ required: true, message: "请输入", trigger: "blur" }],
|
||||
number: [{ required: true, message: "请输入", trigger: "blur" }],
|
||||
place: [{ required: true, message: "请输入", trigger: "blur" }],
|
||||
},
|
||||
};
|
||||
},
|
||||
computed: {},
|
||||
watch: {},
|
||||
created() {
|
||||
this.getList();
|
||||
},
|
||||
methods: {
|
||||
checkPermission,
|
||||
//设备列表
|
||||
getList() {
|
||||
this.listLoading = true;
|
||||
getWarehouseList(this.listQuery).then((response) => {
|
||||
if (response.data) {
|
||||
this.warehouseList = response.data;
|
||||
}
|
||||
this.listLoading = false;
|
||||
});
|
||||
},
|
||||
|
||||
|
||||
handleFilter() {
|
||||
this.listQuery.page = 1;
|
||||
this.getList();
|
||||
},
|
||||
resetFilter() {
|
||||
this.listQuery = {
|
||||
page: 1,
|
||||
page_size: 20,
|
||||
}
|
||||
this.getList();
|
||||
},
|
||||
handleCreate() {
|
||||
this.warehouse = Object.assign({}, defaultewarehouse);
|
||||
this.dialogType = "new";
|
||||
this.dialogVisible = true;
|
||||
this.$nextTick(() => {
|
||||
this.$refs["Form"].clearValidate();
|
||||
});
|
||||
},
|
||||
|
||||
handleEdit(scope) {
|
||||
this.warehouse = Object.assign({}, scope.row); // copy obj
|
||||
this.dialogType = "edit";
|
||||
this.dialogVisible = true;
|
||||
this.$nextTick(() => {
|
||||
this.$refs["Form"].clearValidate();
|
||||
});
|
||||
},
|
||||
handleDelete(scope) {
|
||||
this.$confirm("确认删除?", "警告", {
|
||||
confirmButtonText: "确认",
|
||||
cancelButtonText: "取消",
|
||||
type: "error",
|
||||
})
|
||||
.then(async () => {
|
||||
await deleteWarehouse(scope.row.id);
|
||||
this.getList();
|
||||
this.$message.success("成功");
|
||||
})
|
||||
.catch((err) => {
|
||||
console.error(err);
|
||||
});
|
||||
},
|
||||
|
||||
async confirm(form) {
|
||||
this.$refs[form].validate((valid) => {
|
||||
if (valid) {
|
||||
const isEdit = this.dialogType === "edit";
|
||||
if (isEdit) {
|
||||
updateWarehouse(this.warehouse.id, this.warehouse).then((res) => {
|
||||
if (res.code >= 200) {
|
||||
this.getList();
|
||||
this.dialogVisible = false;
|
||||
this.$message.success("成功");
|
||||
}
|
||||
});
|
||||
} else {
|
||||
createWarehouse(this.warehouse).then((res) => {
|
||||
if (res.code >= 200) {
|
||||
this.getList();
|
||||
this.dialogVisible = false;
|
||||
this.$message.success("成功");
|
||||
}
|
||||
});
|
||||
}
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
});
|
||||
},
|
||||
},
|
||||
};
|
||||
</script>
|
||||
|
|
@ -0,0 +1,261 @@
|
|||
<template>
|
||||
<div class="app-container">
|
||||
<el-card>
|
||||
<div>
|
||||
<el-input
|
||||
v-model="listQuery.search"
|
||||
placeholder="客户名称"
|
||||
style="width: 300px"
|
||||
class="filter-item"
|
||||
@keyup.enter.native="handleFilter"
|
||||
/>
|
||||
<el-button
|
||||
class="filter-item"
|
||||
type="primary"
|
||||
icon="el-icon-search"
|
||||
@click="handleFilter"
|
||||
>搜索</el-button
|
||||
>
|
||||
<el-button
|
||||
class="filter-item"
|
||||
type="primary"
|
||||
icon="el-icon-refresh-left"
|
||||
@click="resetFilter"
|
||||
>重置</el-button
|
||||
>
|
||||
</div>
|
||||
<div style="margin-top: 10px">
|
||||
<el-button type="primary" icon="el-icon-plus" @click="handleCreate"
|
||||
>新增客户</el-button
|
||||
>
|
||||
</div>
|
||||
</el-card>
|
||||
<el-card style="margin-top: 10px">
|
||||
<el-table
|
||||
v-loading="listLoading"
|
||||
:data="warehouseList.results"
|
||||
border
|
||||
fit
|
||||
stripe
|
||||
highlight-current-row
|
||||
max-height="600"
|
||||
>
|
||||
<el-table-column type="index" width="50" />
|
||||
<el-table-column label="客户名称">
|
||||
<template slot-scope="scope">{{ scope.row.name }}</template>
|
||||
</el-table-column>
|
||||
|
||||
<el-table-column label="详细地址">
|
||||
<template slot-scope="scope">{{ scope.row.address }}</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="联系人">
|
||||
<template slot-scope="scope">{{ scope.row.contact }}</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="联系电话">
|
||||
<template slot-scope="scope">{{ scope.row.contact_phone }}</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="描述">
|
||||
<template slot-scope="scope">{{ scope.row.description }}</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="创建时间">
|
||||
<template slot-scope="scope">{{ scope.row.create_time }}</template>
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
align="center"
|
||||
label="操作"
|
||||
width="220px"
|
||||
>
|
||||
<template slot-scope="scope">
|
||||
|
||||
<el-link
|
||||
v-if="checkPermission(['warehouse_update'])"
|
||||
@click="handleEdit(scope)"
|
||||
>编辑</el-link
|
||||
>
|
||||
<el-link
|
||||
v-if="checkPermission(['warehouse_delete'])"
|
||||
type="danger"
|
||||
@click="handleDelete(scope)"
|
||||
>删除</el-link
|
||||
>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
<pagination
|
||||
v-show="warehouseList.count > 0"
|
||||
:total="warehouseList.count"
|
||||
:page.sync="listQuery.page"
|
||||
:limit.sync="listQuery.page_size"
|
||||
@pagination="getList"
|
||||
/>
|
||||
</el-card>
|
||||
<el-dialog
|
||||
:visible.sync="dialogVisible"
|
||||
:title="dialogType === 'edit' ? '编辑客户' : '新增客户'"
|
||||
>
|
||||
<el-form
|
||||
ref="Form"
|
||||
:model="customer"
|
||||
label-width="80px"
|
||||
label-position="right"
|
||||
:rules="rule1"
|
||||
>
|
||||
<el-form-item label="客户名称" prop="name">
|
||||
<el-input v-model="customer.name" placeholder="仓库名称" />
|
||||
</el-form-item>
|
||||
<el-form-item label="客户地址" prop="address">
|
||||
<el-input v-model="customer.address" placeholder="仓库编号" />
|
||||
</el-form-item>
|
||||
<el-form-item label="联系人" prop="contact">
|
||||
<el-input v-model="customer.contact" placeholder="具体地点" />
|
||||
</el-form-item>
|
||||
<el-form-item label="联系电话" prop="contact_phone">
|
||||
<el-input v-model="customer.contact_phone" placeholder="仓库编号" />
|
||||
</el-form-item>
|
||||
<el-form-item label="描述" prop="description">
|
||||
<el-input v-model="customer.description" placeholder="具体地点" />
|
||||
</el-form-item>
|
||||
|
||||
</el-form>
|
||||
<div style="text-align: right">
|
||||
<el-button type="danger" @click="dialogVisible = false">取消</el-button>
|
||||
<el-button type="primary" @click="confirm('Form')">确认</el-button>
|
||||
</div>
|
||||
</el-dialog>
|
||||
</div>
|
||||
</template>
|
||||
<script>
|
||||
import { getCustomerList, createCustomer,updateCustomer,deleteCustomer } from "@/api/sam";
|
||||
import checkPermission from "@/utils/permission";
|
||||
|
||||
|
||||
import { genTree } from "@/utils";
|
||||
import Pagination from "@/components/Pagination"; // secondary package based on el-pagination
|
||||
const defaultecustomer = {
|
||||
};
|
||||
export default {
|
||||
components: { Pagination },
|
||||
data() {
|
||||
return {
|
||||
customer: defaultecustomer,
|
||||
customerList: {
|
||||
count: 0,
|
||||
},
|
||||
options: [{
|
||||
value: 0,
|
||||
label: '运转正常'
|
||||
}, {
|
||||
value: 1,
|
||||
label: '停用'
|
||||
}, {
|
||||
value: 2,
|
||||
label: '报废'
|
||||
}],
|
||||
listQuery: {
|
||||
page: 1,
|
||||
page_size: 20,
|
||||
},
|
||||
keeperOptions:[],
|
||||
depOptions:[],
|
||||
listLoading: true,
|
||||
dialogVisible: false,
|
||||
dialogType: "new",
|
||||
rule1: {
|
||||
name: [{ required: true, message: "请输入", trigger: "blur" }],
|
||||
number: [{ required: true, message: "请输入", trigger: "blur" }],
|
||||
place: [{ required: true, message: "请输入", trigger: "blur" }],
|
||||
},
|
||||
};
|
||||
},
|
||||
computed: {},
|
||||
watch: {},
|
||||
created() {
|
||||
this.getList();
|
||||
},
|
||||
methods: {
|
||||
checkPermission,
|
||||
//设备列表
|
||||
getList() {
|
||||
this.listLoading = true;
|
||||
getCustomerList(this.listQuery).then((response) => {
|
||||
if (response.data) {
|
||||
this.warehouseList = response.data;
|
||||
}
|
||||
this.listLoading = false;
|
||||
});
|
||||
},
|
||||
|
||||
|
||||
handleFilter() {
|
||||
this.listQuery.page = 1;
|
||||
this.getList();
|
||||
},
|
||||
resetFilter() {
|
||||
this.listQuery = {
|
||||
page: 1,
|
||||
page_size: 20,
|
||||
}
|
||||
this.getList();
|
||||
},
|
||||
handleCreate() {
|
||||
this.customer = Object.assign({}, defaultecustomer);
|
||||
this.dialogType = "new";
|
||||
this.dialogVisible = true;
|
||||
this.$nextTick(() => {
|
||||
this.$refs["Form"].clearValidate();
|
||||
});
|
||||
},
|
||||
|
||||
handleEdit(scope) {
|
||||
this.customer = Object.assign({}, scope.row); // copy obj
|
||||
this.dialogType = "edit";
|
||||
this.dialogVisible = true;
|
||||
this.$nextTick(() => {
|
||||
this.$refs["Form"].clearValidate();
|
||||
});
|
||||
},
|
||||
handleDelete(scope) {
|
||||
this.$confirm("确认删除?", "警告", {
|
||||
confirmButtonText: "确认",
|
||||
cancelButtonText: "取消",
|
||||
type: "error",
|
||||
})
|
||||
.then(async () => {
|
||||
await deleteCustomer(scope.row.id);
|
||||
this.getList();
|
||||
this.$message.success("成功");
|
||||
})
|
||||
.catch((err) => {
|
||||
console.error(err);
|
||||
});
|
||||
},
|
||||
|
||||
async confirm(form) {
|
||||
this.$refs[form].validate((valid) => {
|
||||
if (valid) {
|
||||
const isEdit = this.dialogType === "edit";
|
||||
if (isEdit) {
|
||||
updateCustomer(this.customer.id, this.customer).then((res) => {
|
||||
if (res.code >= 200) {
|
||||
this.getList();
|
||||
this.dialogVisible = false;
|
||||
this.$message.success("成功");
|
||||
}
|
||||
});
|
||||
} else {
|
||||
createCustomer(this.customer).then((res) => {
|
||||
if (res.code >= 200) {
|
||||
this.getList();
|
||||
this.dialogVisible = false;
|
||||
this.$message.success("成功");
|
||||
}
|
||||
});
|
||||
}
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
});
|
||||
},
|
||||
},
|
||||
};
|
||||
</script>
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
from numpy import product
|
||||
|
||||
from apps.system.models import CommonAModel
|
||||
from django.db import models
|
||||
from django.contrib.auth.models import AbstractUser
|
||||
|
|
@ -19,7 +19,7 @@ class Customer(CommonAModel):
|
|||
name = models.CharField('客户名称', max_length=50, unique=True)
|
||||
address = models.CharField('详细地址', max_length=20, blank=True, null=True)
|
||||
contact = models.CharField('联系人', max_length=20)
|
||||
contact_phone = models.CharField('联系电话', max_length=11, unique=True)
|
||||
contact_phone = models.CharField('联系电话', max_length=11, unique=True,null=True)
|
||||
description = models.CharField('描述', max_length=200, blank=True, null=True)
|
||||
|
||||
class Meta:
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
from rest_framework import serializers
|
||||
|
||||
from .models import Contact, Customer
|
||||
from .models import Contract, Customer
|
||||
|
||||
|
||||
class CustomerSerializer(serializers.ModelSerializer):
|
||||
|
|
@ -20,10 +20,10 @@ class CustomerSimpleSerializer(serializers.ModelSerializer):
|
|||
class ContractSerializer(serializers.ModelSerializer):
|
||||
|
||||
class Meta:
|
||||
model = Contact
|
||||
model = Contract
|
||||
fields = '__all__'
|
||||
|
||||
class ContractCreateUpdateSerializer(serializers.ModelSerializer):
|
||||
class Meta:
|
||||
model = Contact
|
||||
model = Contract
|
||||
fields = ['name', 'number', 'amount', 'customer', 'sign_date', 'description']
|
||||
|
|
@ -0,0 +1,14 @@
|
|||
from django.db.models import base
|
||||
from rest_framework import urlpatterns
|
||||
from apps.sam.views import CustomerViewSet,ContractViewSet
|
||||
from django.urls import path, include
|
||||
from rest_framework.routers import DefaultRouter
|
||||
|
||||
router = DefaultRouter()
|
||||
router.register('customer', CustomerViewSet, basename='customer')
|
||||
router.register('contract', ContractViewSet, basename='contract')
|
||||
|
||||
urlpatterns = [
|
||||
path('', include(router.urls)),
|
||||
]
|
||||
|
||||
|
|
@ -353,7 +353,7 @@ class FileViewSet(CreateModelMixin, DestroyModelMixin, RetrieveModelMixin, ListM
|
|||
|
||||
|
||||
|
||||
import face_recognition
|
||||
#import face_recognition
|
||||
import uuid
|
||||
import base64
|
||||
import os
|
||||
|
|
@ -382,13 +382,14 @@ class FaceLogin(CreateAPIView):
|
|||
data = tran64(request.data.get('base64').replace(' ', '+'))
|
||||
# data = request.data.get('base64')
|
||||
f.write(base64.urlsafe_b64decode(data))
|
||||
picture_of_me = face_recognition.load_image_file(settings.BASE_DIR +'/temp/me.png')
|
||||
my_face_encoding = face_recognition.face_encodings(picture_of_me)[0]
|
||||
unknown_picture = face_recognition.load_image_file(filepath)
|
||||
unknown_face_encoding = face_recognition.face_encodings(unknown_picture)[0]
|
||||
results = face_recognition.compare_faces([my_face_encoding], unknown_face_encoding, tolerance=0.2)
|
||||
# picture_of_me = face_recognition.load_image_file(settings.BASE_DIR +'/temp/me.png')
|
||||
# my_face_encoding = face_recognition.face_encodings(picture_of_me)[0]
|
||||
# unknown_picture = face_recognition.load_image_file(filepath)
|
||||
# unknown_face_encoding = face_recognition.face_encodings(unknown_picture)[0]
|
||||
#results = face_recognition.compare_faces([my_face_encoding], unknown_face_encoding, tolerance=0.2)
|
||||
os.remove(filepath)
|
||||
if results[0] == True:
|
||||
return Response('这是曹前明')
|
||||
else:
|
||||
return Response('这不是曹前明')
|
||||
# if results[0] == True:
|
||||
# return Response('这是曹前明')
|
||||
# else:
|
||||
# return Response('这不是曹前明')
|
||||
|
||||
|
|
|
|||
|
|
@ -65,6 +65,7 @@ urlpatterns = [
|
|||
path('api/wf/', include('apps.wf.urls')),
|
||||
path('api/mtm/', include('apps.mtm.urls')),
|
||||
path('api/inm/', include('apps.inm.urls')),
|
||||
path('api/sam/', include('apps.sam.urls')),
|
||||
# 工具
|
||||
path('api/utils/signature/', GenSignature.as_view()),
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue