11 |
15 | Edit
16 | components/HelloWorld.vue to test HMR
17 |
21 | Check out 22 | create-vue, the official Vue + Vite starter 25 |
26 |27 | Install 28 | Volar 29 | in your IDE for a better DX 30 |
31 |Click on the Vite and Vue logos to learn more
32 | 33 | 34 | 39 | -------------------------------------------------------------------------------- /backend/apps/system/serializers/apiWhiteListSerializer.py: -------------------------------------------------------------------------------- 1 | ''' 2 | Author: yifeng 3 | Date: 2022-10-16 21:43:34 4 | LastEditors: yifeng 5 | LastEditTime: 2022-10-16 21:48:01 6 | Description: 7 | ''' 8 | from apps.system.models import ApiWhiteList 9 | from apps.system.serializers.customModelSerializer import CustomModelSerializer 10 | 11 | 12 | class ApiWhiteListSerializer(CustomModelSerializer): 13 | """ 14 | 接口白名单-序列化器 15 | """ 16 | 17 | class Meta: 18 | model = ApiWhiteList 19 | fields = "__all__" 20 | read_only_fields = ["id"] 21 | 22 | 23 | class ApiWhiteListInitSerializer(CustomModelSerializer): 24 | """ 25 | 初始化获取数信息(用于生成初始化json文件) 26 | """ 27 | 28 | class Meta: 29 | model = ApiWhiteList 30 | fields = ['url', 'method', 'enable_datasource', 'creator', 'dept_belong_id'] 31 | read_only_fields = ["id"] 32 | extra_kwargs = { 33 | 'creator': {'write_only': True}, 34 | 'dept_belong_id': {'write_only': True} 35 | } 36 | -------------------------------------------------------------------------------- /backend/apps/system/serializers/areaSerializer.py: -------------------------------------------------------------------------------- 1 | ''' 2 | Author: yifeng 3 | Date: 2022-10-18 19:09:00 4 | LastEditors: yifeng 5 | LastEditTime: 2022-10-18 19:11:31 6 | Description: 7 | ''' 8 | from rest_framework import serializers 9 | 10 | from apps.system.models import Area 11 | from apps.system.serializers.customModelSerializer import CustomModelSerializer 12 | from backend.utils.viewSet import CustomModelViewSet 13 | 14 | 15 | class AreaSerializer(CustomModelSerializer): 16 | """ 17 | 地区-序列化器 18 | """ 19 | pcode_count = serializers.SerializerMethodField(read_only=True) 20 | 21 | def get_pcode_count(self, instance: Area): 22 | return Area.objects.filter(pcode=instance).count() 23 | 24 | class Meta: 25 | model = Area 26 | fields = "__all__" 27 | read_only_fields = ["id"] 28 | 29 | 30 | class AreaCreateUpdateSerializer(CustomModelSerializer): 31 | """ 32 | 地区管理 创建/更新时的列化器 33 | """ 34 | 35 | class Meta: 36 | model = Area 37 | fields = '__all__' 38 | 39 | -------------------------------------------------------------------------------- /frontend/src/views/DataManage/DetectDataManage.vue: -------------------------------------------------------------------------------- 1 | 8 | 9 | test DetectData 10 | 23 | 24 | 25 | 34 | -------------------------------------------------------------------------------- /frontend/src/apis/system/apiWhiteList.ts: -------------------------------------------------------------------------------- 1 | /* 2 | * @Author: yifeng 3 | * @Date: 2022-10-16 21:30:53 4 | * @LastEditors: yifeng 5 | * @LastEditTime: 2022-10-16 21:34:34 6 | * @Description: 7 | */ 8 | import axiosInstance from '@/utils/net/axiosInstance' 9 | 10 | export const apiWhiteListBaseUrl = '/api/system/api_white_list/' 11 | 12 | export function getApiWhiteList (query) { 13 | return axiosInstance({ 14 | url: apiWhiteListBaseUrl, 15 | method: 'get', 16 | params: query 17 | }) 18 | } 19 | 20 | export function createApiWhite (obj, id) { 21 | const data = { ...obj, menu: id } 22 | return axiosInstance({ 23 | url: apiWhiteListBaseUrl, 24 | method: 'post', 25 | data: data 26 | }) 27 | } 28 | 29 | export function updateApiWhite (obj) { 30 | return axiosInstance({ 31 | url: apiWhiteListBaseUrl + obj.id + '/', 32 | method: 'put', 33 | data: obj 34 | }) 35 | } 36 | 37 | export function deleteApiWhite (id) { 38 | return axiosInstance({ 39 | url: apiWhiteListBaseUrl + id + '/', 40 | method: 'delete', 41 | data: { id } 42 | }) 43 | } -------------------------------------------------------------------------------- /frontend/src/apis/system/loginRegister.ts: -------------------------------------------------------------------------------- 1 | /* 2 | * @Author: yifeng 3 | * @Date: 2022-09-06 20:14:42 4 | * @LastEditors: yifeng 5 | * @LastEditTime: 2022-10-04 16:49:07 6 | * @Description: 7 | */ 8 | import axiosInstance from '@/utils/net/axiosInstance' 9 | 10 | // 用户登录接口 11 | export function sysUserLogin(data) { 12 | return axiosInstance({ 13 | url: "api/login/", 14 | method: 'post', 15 | data:data 16 | }) 17 | } 18 | 19 | // 用户登出接口 20 | export function sysUserLogout(data) { 21 | return axiosInstance({ 22 | url: "api/logout/", 23 | method: 'post', 24 | data:data 25 | }) 26 | } 27 | 28 | // 获取验证码接口 29 | export function getCaptcha() { 30 | // return axiosInstance.get("api/captcha/") 31 | return axiosInstance({ 32 | url: "api/captcha/", 33 | method: 'get', 34 | }) 35 | } 36 | 37 | // 获取验证码状态接口 38 | export function getCaptchaStatus() { 39 | // return axiosInstance.get("api/captcha/status") 40 | return axiosInstance({ 41 | url: "api/captcha/status", 42 | method: 'get', 43 | }) 44 | } -------------------------------------------------------------------------------- /backend/apps/detect/migrations/0001_initial.py: -------------------------------------------------------------------------------- 1 | # Generated by Django 3.2.14 on 2022-08-31 12:57 2 | 3 | from django.db import migrations, models 4 | 5 | 6 | class Migration(migrations.Migration): 7 | 8 | initial = True 9 | 10 | dependencies = [ 11 | ] 12 | 13 | operations = [ 14 | migrations.CreateModel( 15 | name='DetectImage', 16 | fields=[ 17 | ('id', models.AutoField(primary_key=True, serialize=False, verbose_name='id')), 18 | ('filename', models.CharField(max_length=50, verbose_name='文件名')), 19 | ('detected_filename', models.CharField(max_length=50, verbose_name='文件名')), 20 | ('detect_result', models.CharField(max_length=10, verbose_name='检测结果')), 21 | ('create_date_time', models.DateTimeField(max_length=40, verbose_name='检测时间')), 22 | ], 23 | options={ 24 | 'verbose_name': '检测数据表', 25 | 'verbose_name_plural': '检测数据表', 26 | 'db_table': 'detected_img', 27 | }, 28 | ), 29 | ] 30 | -------------------------------------------------------------------------------- /frontend/src/apis/system/menuButton.ts: -------------------------------------------------------------------------------- 1 | /* 2 | * @Author: yifeng 3 | * @Date: 2022-09-30 20:21:20 4 | * @LastEditors: yifeng 5 | * @LastEditTime: 2022-09-30 20:26:26 6 | * @Description: 7 | */ 8 | import axiosInstance from '@/utils/net/axiosInstance' 9 | 10 | const menuButtonBaseUrl = "/api/system/menu_button/" 11 | 12 | 13 | export function getMenuButtonList (query: any) { 14 | return axiosInstance({ 15 | url: menuButtonBaseUrl, 16 | method: 'get', 17 | params: query 18 | }) 19 | } 20 | 21 | export function addMenuButton (obj: any, id:string) { 22 | const data = { ...obj, menu: id } 23 | return axiosInstance({ 24 | url: menuButtonBaseUrl, 25 | method: 'post', 26 | data: data 27 | }) 28 | } 29 | 30 | export function updateMenuButton (obj: any) { 31 | return axiosInstance({ 32 | url: menuButtonBaseUrl + obj.id + '/', 33 | method: 'put', 34 | data: obj 35 | }) 36 | } 37 | 38 | export function deleteMenuButton (id: string) { 39 | return axiosInstance({ 40 | url: menuButtonBaseUrl + id + '/', 41 | method: 'delete', 42 | data: { id } 43 | }) 44 | } -------------------------------------------------------------------------------- /backend/backend/views.py: -------------------------------------------------------------------------------- 1 | from django.http import HttpResponse, JsonResponse 2 | from thirdparty.detect import getDetectImages 3 | 4 | # Create your views here. 5 | def welcome(request): 6 | return HttpResponse("
18 | {{site_name}}
19 |