2
0

3 Commity e4b3439745 ... c375bc5206

Autor SHA1 Správa Dátum
  yht c375bc5206 #fix:staticfile2static 1 mesiac pred
  yht 43f6a9a705 #merge 1 mesiac pred
  yht 66005354d7 feat:完成第八章和第十章 1 mesiac pred
63 zmenil súbory, kde vykonal 1188 pridanie a 424 odobranie
  1. 15 0
      pythonweb/contactApp/admin.py
  2. 23 0
      pythonweb/contactApp/forms.py
  3. 53 0
      pythonweb/contactApp/migrations/0001_initial.py
  4. 18 0
      pythonweb/contactApp/migrations/0002_alter_resume_photo.py
  5. 18 0
      pythonweb/contactApp/migrations/0003_alter_resume_birth.py
  6. 115 0
      pythonweb/contactApp/models.py
  7. 79 58
      pythonweb/contactApp/templates/contact.html
  8. 15 27
      pythonweb/contactApp/templates/recruit.html
  9. 1 8
      pythonweb/contactApp/templates/success.html
  10. 22 4
      pythonweb/contactApp/views.py
  11. BIN
      pythonweb/db.sqlite3
  12. 235 89
      pythonweb/homeApp/templates/home.html
  13. 39 4
      pythonweb/homeApp/views.py
  14. 3 3
      pythonweb/newsApp/admin.py
  15. 18 0
      pythonweb/newsApp/migrations/0003_mynew_photo.py
  16. 28 22
      pythonweb/newsApp/models.py
  17. 5 3
      pythonweb/newsApp/search_indexes.py
  18. 3 8
      pythonweb/newsApp/templates/newDetail.html
  19. 1 6
      pythonweb/newsApp/templates/searchList.html
  20. 3 3
      pythonweb/newsApp/urls.py
  21. 29 28
      pythonweb/newsApp/views.py
  22. 1 1
      pythonweb/newsApp/whoosh_backend.py
  23. 19 1
      pythonweb/pythonweb/settings.py
  24. 1 0
      pythonweb/pythonweb/urls.py
  25. 2 2
      pythonweb/serviceApp/admin.py
  26. 29 0
      pythonweb/serviceApp/migrations/0001_initial.py
  27. 17 0
      pythonweb/serviceApp/migrations/0002_alter_doc_options.py
  28. 1 1
      pythonweb/serviceApp/models.py
  29. 8 25
      pythonweb/serviceApp/templates/docList.html
  30. 12 20
      pythonweb/serviceApp/templates/platForm.html
  31. 1 1
      pythonweb/serviceApp/views.py
  32. 121 0
      pythonweb/static/css/home.css
  33. BIN
      pythonweb/static/img/banner1.jpg
  34. BIN
      pythonweb/static/img/banner2.jpg
  35. BIN
      pythonweb/static/img/banner3.jpg
  36. BIN
      pythonweb/static/img/ky.jpg
  37. BIN
      pythonweb/static/img/note.jpg
  38. 12 0
      pythonweb/static/js/jqthumb.min.js
  39. 39 0
      pythonweb/static/js/layDate-v5.0.9/layDate-v5.0.9/test.html
  40. 6 0
      pythonweb/static/js/layDate-v5.0.9/layDate-v5.0.9/文档/官网.url
  41. 8 0
      pythonweb/static/js/layDate-v5.0.9/layDate-v5.0.9/文档/文档.url
  42. 8 0
      pythonweb/static/js/layDate-v5.0.9/layDate-v5.0.9/文档/社区.url
  43. 6 0
      pythonweb/static/js/layDate-v5.0.9/layDate-v5.0.9/更新日志.url
  44. 1 0
      pythonweb/static/js/layDate-v5.0.9/laydate.js
  45. BIN
      pythonweb/static/js/layDate-v5.0.9/theme/default/font/iconfont.eot
  46. 45 0
      pythonweb/static/js/layDate-v5.0.9/theme/default/font/iconfont.svg
  47. BIN
      pythonweb/static/js/layDate-v5.0.9/theme/default/font/iconfont.ttf
  48. BIN
      pythonweb/static/js/layDate-v5.0.9/theme/default/font/iconfont.woff
  49. 1 0
      pythonweb/static/js/layDate-v5.0.9/theme/default/laydate.css
  50. 8 0
      pythonweb/static/web.config
  51. 0 110
      pythonweb/templates/home.html
  52. 63 0
      pythonweb/templates/search/search.html
  53. BIN
      pythonweb/test/face.jpg
  54. 20 0
      pythonweb/test/faceDetectDemo.py
  55. 36 0
      pythonweb/test/generateQRImg.py
  56. BIN
      pythonweb/test/logo.png
  57. BIN
      pythonweb/test/qr.png
  58. 0 0
      pythonweb/whoosh_index/MAIN_WRITELOCK
  59. BIN
      pythonweb/whoosh_index/MAIN_e8yukx7l88n7lc4n.seg
  60. BIN
      pythonweb/whoosh_index/MAIN_qk95h4o4c4flq0wv.seg
  61. BIN
      pythonweb/whoosh_index/MAIN_soyja7uhykk99rp7.seg
  62. BIN
      pythonweb/whoosh_index/MAIN_vylrll3rihl2qkqa.seg
  63. BIN
      pythonweb/whoosh_index/_MAIN_4.toc

+ 15 - 0
pythonweb/contactApp/admin.py

@@ -1,3 +1,18 @@
 from django.contrib import admin
+from .models import Ad
+from django.utils.safestring import mark_safe
+from .models import Resume
 
 # Register your models here.
+class ResumeAdmin(admin.ModelAdmin):
+    list_display = ('name', 'status', 'personID', 'birth', 'edu', 'school',
+                    'major', 'position', 'image_data')
+
+    def image_data(self, obj):
+        return mark_safe(u'<img src="%s" width="120px" />' % obj.photo.url)
+
+    image_data.short_description = u'个人照片'
+
+
+admin.site.register(Resume, ResumeAdmin)
+admin.site.register(Ad)

+ 23 - 0
pythonweb/contactApp/forms.py

@@ -0,0 +1,23 @@
+from django import forms
+from .models import Resume
+
+class ResumeForm(forms.ModelForm):
+    class Meta:
+        model = Resume
+        fields = ('name','sex','personID','email','birth','edu','school','major','experience','position','photo')
+        sex_list = (
+            ('男','男'),
+            ('女','女'),
+        )
+        edu_list = (
+            ('大专','大专'),
+            ('本科','本科'),
+            ('硕士','硕士'),
+            ('博士','博士'),
+            ('其他','其他'),
+        )
+        widgets = {
+            'sex':forms.Select(choices=sex_list),
+            'edu':forms.Select(choices=edu_list),
+            'photo':forms.FileInput(),
+        }

+ 53 - 0
pythonweb/contactApp/migrations/0001_initial.py

@@ -0,0 +1,53 @@
+# Generated by Django 4.2.30 on 2026-05-08 12:11
+
+from django.db import migrations, models
+import django.utils.timezone
+
+
+class Migration(migrations.Migration):
+
+    initial = True
+
+    dependencies = [
+    ]
+
+    operations = [
+        migrations.CreateModel(
+            name='Ad',
+            fields=[
+                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
+                ('title', models.CharField(max_length=50, verbose_name='招聘岗位')),
+                ('description', models.TextField(verbose_name='岗位要求')),
+                ('publishDate', models.DateTimeField(default=django.utils.timezone.now, max_length=20, verbose_name='发布时间')),
+            ],
+            options={
+                'verbose_name': '招聘广告',
+                'verbose_name_plural': '招聘广告',
+                'ordering': ('-publishDate',),
+            },
+        ),
+        migrations.CreateModel(
+            name='Resume',
+            fields=[
+                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
+                ('name', models.CharField(max_length=20, verbose_name='姓名')),
+                ('personID', models.CharField(max_length=30, verbose_name='身份证号')),
+                ('sex', models.CharField(default='男', max_length=5, verbose_name='性别')),
+                ('email', models.EmailField(max_length=30, verbose_name='邮箱')),
+                ('birth', models.DateField(default='2026-05-08', max_length=20, verbose_name='出生日期')),
+                ('edu', models.CharField(default='本科', max_length=5, verbose_name='学历')),
+                ('school', models.CharField(max_length=40, verbose_name='毕业院校')),
+                ('major', models.CharField(max_length=40, verbose_name='专业')),
+                ('position', models.CharField(max_length=40, verbose_name='申请职位')),
+                ('experience', models.TextField(blank=True, null=True, verbose_name='学习或工作经历')),
+                ('photo', models.ImageField(upload_to='contact/recruit/%Y_%n_%d', verbose_name='个人照片')),
+                ('status', models.IntegerField(choices=[(1, '未审'), (2, '通过'), (3, '未通过')], default=1, verbose_name='面试成绩')),
+                ('publishDate', models.DateTimeField(default=django.utils.timezone.now, max_length=20, verbose_name='提交时间')),
+            ],
+            options={
+                'verbose_name': '简历',
+                'verbose_name_plural': '简历',
+                'ordering': ('-status', '-publishDate'),
+            },
+        ),
+    ]

+ 18 - 0
pythonweb/contactApp/migrations/0002_alter_resume_photo.py

@@ -0,0 +1,18 @@
+# Generated by Django 4.2.30 on 2026-05-08 13:20
+
+from django.db import migrations, models
+
+
+class Migration(migrations.Migration):
+
+    dependencies = [
+        ('contactApp', '0001_initial'),
+    ]
+
+    operations = [
+        migrations.AlterField(
+            model_name='resume',
+            name='photo',
+            field=models.ImageField(upload_to='contact/recruit/%Y_%m_%d', verbose_name='个人照片'),
+        ),
+    ]

+ 18 - 0
pythonweb/contactApp/migrations/0003_alter_resume_birth.py

@@ -0,0 +1,18 @@
+# Generated by Django 4.2.30 on 2026-05-09 09:13
+
+from django.db import migrations, models
+
+
+class Migration(migrations.Migration):
+
+    dependencies = [
+        ('contactApp', '0002_alter_resume_photo'),
+    ]
+
+    operations = [
+        migrations.AlterField(
+            model_name='resume',
+            name='birth',
+            field=models.DateField(default='2026-05-09', max_length=20, verbose_name='出生日期'),
+        ),
+    ]

+ 115 - 0
pythonweb/contactApp/models.py

@@ -1,3 +1,118 @@
 from django.db import models
+from django.utils import timezone
+from datetime import datetime
+from django.db.models.signals import post_init,post_save
+from django.dispatch import receiver
+from django.core.mail import send_mail
+import os
+from docxtpl import DocxTemplate
+from docxtpl import InlineImage
+from docx.shared import Mm, Inches, Pt
 
 # Create your models here.
+class Ad(models.Model):
+    title = models.CharField(max_length = 50, verbose_name = '招聘岗位')
+    description = models.TextField(verbose_name = '岗位要求')
+    publishDate = models.DateTimeField(max_length = 20,
+                                       default = timezone.now,
+                                       verbose_name = '发布时间')
+    
+    def __str__(self):
+        return self.title
+    
+    class Meta:
+        verbose_name = '招聘广告'
+        verbose_name_plural = '招聘广告'
+        ordering = ('-publishDate',)
+
+
+class Resume(models.Model):
+    name = models.CharField(max_length=20, verbose_name='姓名')
+    personID = models.CharField(max_length=30, verbose_name='身份证号')
+    sex = models.CharField(max_length=5, default='男', verbose_name='性别')
+    email = models.EmailField(max_length=30, verbose_name='邮箱')
+    birth = models.DateField(max_length=20,
+                             default=datetime.strftime(datetime.now(),
+                                                       "%Y-%m-%d"),
+                             verbose_name='出生日期')
+    edu = models.CharField(max_length=5, default='本科', verbose_name='学历')
+    school = models.CharField(max_length=40, verbose_name='毕业院校')
+    major = models.CharField(max_length=40, verbose_name='专业')
+    position = models.CharField(max_length=40, verbose_name='申请职位')
+    experience = models.TextField(blank=True,
+                                  null=True,
+                                  verbose_name='学习或工作经历')
+    photo = models.ImageField(upload_to='contact/recruit/%Y_%m_%d',
+                              verbose_name='个人照片')
+    grade_list = (
+        (1, '未审'),
+        (2, '通过'),
+        (3, '未通过'),
+    )
+    status = models.IntegerField(choices=grade_list,
+                                 default=1,
+                                 verbose_name='面试成绩')
+    publishDate = models.DateTimeField(max_length=20,
+                                       default=timezone.now,
+                                       verbose_name='提交时间')
+
+    def __str__(self):
+        return self.name
+
+    class Meta:
+        verbose_name = '简历'
+        verbose_name_plural = '简历'
+        ordering = ('-status', '-publishDate')
+
+@receiver(post_init,sender=Resume)
+def before_save_resume(sender, instance, **kwargs):
+    instance.__original_status = instance.status
+
+@receiver(post_save, sender=Resume)
+def post_save_resume(sender, instance, **kwargs):
+    email = instance.email
+    EMAIL_FEOM = 'xxxxxxxx@qq.com'
+    if instance.__original_status==1 and instance.status==2:
+        template_path = os.getcwd() + '/media/recruit.docx'
+        template = DocxTemplate(template_path)
+        name = instance.name
+        personID = instance.personID
+        sex = instance.sex
+        email = instance.email
+        birth = instance.birth
+        edu = instance.birth
+        school = instance.school
+        major = instance.major
+        position = instance.position
+        experience = instance.experience
+        photo = instance.photo
+
+        context = {
+            'name':name,
+            'personID':personID,
+            'sex':sex,
+            'email':email,
+            'birth':birth,
+            'edu':edu,
+            'school':school,
+            'major':major,
+            'position':position,
+            'experience':experience,
+            'photo':InlineImage(template,photo,width=Mm(30),height=Mm(40)),
+        }
+        template.render(context)
+        filename = '%s/media/contact/recruit/%s_%d.docx'%(
+            os.getcwd(),instance.name,instance.id
+        )
+        template.save(filename)
+    
+    # if instance.__original_status==1 and instance.status==2:
+    #     email_title = '通知:恒达科技招聘初试结果'
+    #     email_body = '恭喜您通过本企业初试'
+    #     send_status = send_mail(email_title,email_body,EMAIL_FEOM,[email])
+    elif instance.__original_status==1 and instance.status==3:
+        email_title = '通知:恒达科技招聘初试结果'
+        email_body = '很遗憾,您未能通过本企业初试,感谢您的关注'
+        send_status = send_mail(email_title,email_body,EMAIL_FEOM,[email])
+    # print(instance.__original_status)
+    # print(instance.status)

+ 79 - 58
pythonweb/contactApp/templates/contact.html

@@ -1,11 +1,4 @@
-{% extends "base.html" %}
-{% load staticfiles %}
-
-{% block title %}
-人才招聘
-{% endblock %}
-
-{% block content %}
+{% extends "base.html" %} {% load static %} {% block title %} 人才招聘 {% endblock %} {% block content %}
 <link href="{% static 'css/contact.css' %}" rel="stylesheet">
 <!--引用百度地图样式-->
 <style type="text/css">
@@ -17,7 +10,7 @@
         padding-right: 13px;
         white-space: nowrap
     }
-
+    
     .iw_poi_content {
         font: 12px arial, sans-serif;
         overflow: visible;
@@ -85,81 +78,105 @@
     </div>
     <script type="text/javascript">
         //创建和初始化地图函数:
-        function initMap(){
-            createMap();//创建地图
-            setMapEvent();//设置地图事件
-            addMapControl();//向地图添加控件
-            addMarker();//向地图中添加marker
+        function initMap() {
+            createMap(); //创建地图
+            setMapEvent(); //设置地图事件
+            addMapControl(); //向地图添加控件
+            addMarker(); //向地图中添加marker
         }
-        
+
         //创建地图函数:
-        function createMap(){
-            var map = new BMap.Map("dituContent");//在百度地图容器中创建一个地图
-            var point = new BMap.Point(121.506377,31.245105);//定义一个中心点坐标
-            map.centerAndZoom(point,15);//设定地图的中心点和坐标并将地图显示在地图容器中
-            window.map = map;//将map变量存储在全局
+        function createMap() {
+            var map = new BMap.Map("dituContent"); //在百度地图容器中创建一个地图
+            var point = new BMap.Point(121.506377, 31.245105); //定义一个中心点坐标
+            map.centerAndZoom(point, 15); //设定地图的中心点和坐标并将地图显示在地图容器中
+            window.map = map; //将map变量存储在全局
         }
-        
+
         //地图事件设置函数:
-        function setMapEvent(){
-            map.enableDragging();//启用地图拖拽事件,默认启用(可不写)
-            map.enableScrollWheelZoom();//启用地图滚轮放大缩小
-            map.enableDoubleClickZoom();//启用鼠标双击放大,默认启用(可不写)
-            map.enableKeyboard();//启用键盘上下左右键移动地图
+        function setMapEvent() {
+            map.enableDragging(); //启用地图拖拽事件,默认启用(可不写)
+            map.enableScrollWheelZoom(); //启用地图滚轮放大缩小
+            map.enableDoubleClickZoom(); //启用鼠标双击放大,默认启用(可不写)
+            map.enableKeyboard(); //启用键盘上下左右键移动地图
         }
-        
+
         //地图控件添加函数:
-        function addMapControl(){
+        function addMapControl() {
             //向地图中添加缩放控件
-        var ctrl_nav = new BMap.NavigationControl({anchor:BMAP_ANCHOR_TOP_LEFT,type:BMAP_NAVIGATION_CONTROL_LARGE});
-        map.addControl(ctrl_nav);
+            var ctrl_nav = new BMap.NavigationControl({
+                anchor: BMAP_ANCHOR_TOP_LEFT,
+                type: BMAP_NAVIGATION_CONTROL_LARGE
+            });
+            map.addControl(ctrl_nav);
             //向地图中添加缩略图控件
-        var ctrl_ove = new BMap.OverviewMapControl({anchor:BMAP_ANCHOR_BOTTOM_RIGHT,isOpen:1});
-        map.addControl(ctrl_ove);
+            var ctrl_ove = new BMap.OverviewMapControl({
+                anchor: BMAP_ANCHOR_BOTTOM_RIGHT,
+                isOpen: 1
+            });
+            map.addControl(ctrl_ove);
             //向地图中添加比例尺控件
-        var ctrl_sca = new BMap.ScaleControl({anchor:BMAP_ANCHOR_BOTTOM_LEFT});
-        map.addControl(ctrl_sca);
+            var ctrl_sca = new BMap.ScaleControl({
+                anchor: BMAP_ANCHOR_BOTTOM_LEFT
+            });
+            map.addControl(ctrl_sca);
         }
-        
+
         //标注点数组
-        var markerArr = [{title:"恒达科技有限公司",content:"python web企业门户网站开发实战",point:"121.507015|31.243978",isOpen:0,icon:{w:21,h:21,l:0,t:0,x:6,lb:5}}
-             ];
+        var markerArr = [{
+            title: "恒达科技有限公司",
+            content: "python web企业门户网站开发实战",
+            point: "121.507015|31.243978",
+            isOpen: 0,
+            icon: {
+                w: 21,
+                h: 21,
+                l: 0,
+                t: 0,
+                x: 6,
+                lb: 5
+            }
+        }];
         //创建marker
-        function addMarker(){
-            for(var i=0;i<markerArr.length;i++){
+        function addMarker() {
+            for (var i = 0; i < markerArr.length; i++) {
                 var json = markerArr[i];
                 var p0 = json.point.split("|")[0];
                 var p1 = json.point.split("|")[1];
-                var point = new BMap.Point(p0,p1);
+                var point = new BMap.Point(p0, p1);
                 var iconImg = createIcon(json.icon);
-                var marker = new BMap.Marker(point,{icon:iconImg});
+                var marker = new BMap.Marker(point, {
+                    icon: iconImg
+                });
                 var iw = createInfoWindow(i);
-                var label = new BMap.Label(json.title,{"offset":new BMap.Size(json.icon.lb-json.icon.x+10,-20)});
+                var label = new BMap.Label(json.title, {
+                    "offset": new BMap.Size(json.icon.lb - json.icon.x + 10, -20)
+                });
                 marker.setLabel(label);
                 map.addOverlay(marker);
                 label.setStyle({
-                            borderColor:"#808080",
-                            color:"#333",
-                            cursor:"pointer"
+                    borderColor: "#808080",
+                    color: "#333",
+                    cursor: "pointer"
                 });
-                
-                (function(){
+
+                (function() {
                     var index = i;
                     var _iw = createInfoWindow(i);
                     var _marker = marker;
-                    _marker.addEventListener("click",function(){
+                    _marker.addEventListener("click", function() {
                         this.openInfoWindow(_iw);
                     });
-                    _iw.addEventListener("open",function(){
+                    _iw.addEventListener("open", function() {
                         _marker.getLabel().hide();
                     })
-                    _iw.addEventListener("close",function(){
+                    _iw.addEventListener("close", function() {
                         _marker.getLabel().show();
                     })
-                    label.addEventListener("click",function(){
+                    label.addEventListener("click", function() {
                         _marker.openInfoWindow(_iw);
                     })
-                    if(!!json.isOpen){
+                    if (!!json.isOpen) {
                         label.hide();
                         _marker.openInfoWindow(_iw);
                     }
@@ -167,18 +184,22 @@
             }
         }
         //创建InfoWindow
-        function createInfoWindow(i){
+        function createInfoWindow(i) {
             var json = markerArr[i];
-            var iw = new BMap.InfoWindow("<b class='iw_poi_title' title='" + json.title + "'>" + json.title + "</b><div class='iw_poi_content'>"+json.content+"</div>");
+            var iw = new BMap.InfoWindow("<b class='iw_poi_title' title='" + json.title + "'>" + json.title + "</b><div class='iw_poi_content'>" + json.content + "</div>");
             return iw;
         }
         //创建一个Icon
-        function createIcon(json){
-            var icon = new BMap.Icon("http://map.baidu.com/image/us_mk_icon.png", new BMap.Size(json.w,json.h),{imageOffset: new BMap.Size(-json.l,-json.t),infoWindowOffset:new BMap.Size(json.lb+5,1),offset:new BMap.Size(json.x,json.h)})
+        function createIcon(json) {
+            var icon = new BMap.Icon("http://map.baidu.com/image/us_mk_icon.png", new BMap.Size(json.w, json.h), {
+                imageOffset: new BMap.Size(-json.l, -json.t),
+                infoWindowOffset: new BMap.Size(json.lb + 5, 1),
+                offset: new BMap.Size(json.x, json.h)
+            })
             return icon;
         }
-        
-        initMap();//创建和初始化地图
+
+        initMap(); //创建和初始化地图
     </script>
 </div>
 {% endblock %}

+ 15 - 27
pythonweb/contactApp/templates/recruit.html

@@ -1,12 +1,4 @@
-{% extends "base.html" %}
-{% load staticfiles %}
-{% load widget_tweaks %}
-
-{% block title %}
-人才招聘
-{% endblock %}
-
-{% block content %}
+{% extends "base.html" %} {% load static %} {% load widget_tweaks %} {% block title %} 人才招聘 {% endblock %} {% block content %}
 <link href="{% static 'css/contact.css' %}" rel="stylesheet">
 <script src="{% static 'js/layDate-v5.0.9/laydate.js' %}"></script>
 </script>
@@ -47,8 +39,7 @@
                         <div class="panel-heading" role="tab" id="panel{{ad.id}}">
                             <h4 class="panel-title">
                                 {% if forloop.first %}
-                                <a role="button" data-toggle="collapse" data-parent="#accordion"
-                                    href="#collapse{{ad.id}}">
+                                <a role="button" data-toggle="collapse" data-parent="#accordion" href="#collapse{{ad.id}}">
                                     {% else %}
                                     <a class="collapsed" data-toggle="collapse" data-parent="#accordion"
                                         href="#collapse{{ad.id}}">
@@ -77,8 +68,7 @@
                     </div>
                     <div class="panel-body">
                         <div class="row">
-                            <form action="." name="resumeForm" method="post" class="form-horizontal" role="form"
-                                enctype="multipart/form-data">
+                            <form action="." name="resumeForm" method="post" class="form-horizontal" role="form" enctype="multipart/form-data">
                                 {% csrf_token %}
                                 <!-- 左侧 -->
                                 <div class="col-md-6">
@@ -141,11 +131,9 @@
                                 <div class="col-md-6">
                                     <div class="form-group">
                                         <div class="col-sm-12" style="text-align:center">
-                                            <img id="profileshow" src="{% static 'img/sample.png' %}"
-                                                style="width:120px">
+                                            <img id="profileshow" src="{% static 'img/sample.png' %}" style="width:120px">
                                         </div>
-                                        <label class="col-sm-5 control-label">上传证件照片:</label>
-                                        {{resumeForm.photo}}
+                                        <label class="col-sm-5 control-label">上传证件照片:</label> {{resumeForm.photo}}
                                     </div>
                                     <div class="form-group">
                                         <label class="col-sm-12 control-label">学习或工作经历:</label>
@@ -171,16 +159,16 @@
         });
     </script>
     <script>
-    $(function () {
-        $('#id_photo').on('change', function () {
-            var r = new FileReader();
-            f = document.getElementById('id_photo').files[0];
-            r.readAsDataURL(f);
-            r.onload = function (e) {
-                document.getElementById('profileshow').src = this.result;
-            };
+        $(function() {
+            $('#id_photo').on('change', function() {
+                var r = new FileReader();
+                f = document.getElementById('id_photo').files[0];
+                r.readAsDataURL(f);
+                r.onload = function(e) {
+                    document.getElementById('profileshow').src = this.result;
+                };
+            });
         });
-    });
-</script>
+    </script>
 </div>
 {% endblock %}

+ 1 - 8
pythonweb/contactApp/templates/success.html

@@ -1,11 +1,4 @@
-{% extends "base.html" %}
-{% load staticfiles %}
-
-{% block title %}
-人才招聘
-{% endblock %}
-
-{% block content %}
+{% extends "base.html" %} {% load static %} {% block title %} 人才招聘 {% endblock %} {% block content %}
 <!-- 主体内容 -->
 <div class="container">
     <div class="row">

+ 22 - 4
pythonweb/contactApp/views.py

@@ -1,13 +1,31 @@
 from django.shortcuts import render
 from django.shortcuts import HttpResponse
+from .models import Ad
+from .forms import ResumeForm
 
 
 # Create your views here.
 def contact(request):
-    html = '<html><body>欢迎咨询</body></html>'
-    return HttpResponse(html)
+    return render(request,'contact.html')
 
 
 def recruit(request):
-    html = '<html><body>加入恒达</body></html>'
-    return HttpResponse(html)
+    # html = '<html><body>加入恒达</body></html>'
+    # return HttpResponse(html)
+    AdList = Ad.objects.all().order_by('-publishDate')
+    if request.method == 'POST':
+        resumeForm = ResumeForm(data=request.POST,files=request.FILES)
+        if resumeForm.is_valid():
+            resumeForm.save()
+            return render(request,'success.html',{
+                'active_menu':'contactus',
+                'sub_menu':'recruit',
+            })
+    else:
+        resumeForm = ResumeForm()
+    return render(request, 'recruit.html',{
+        'active_menu':'contactus',
+        'sub_menu':'recruit',
+        'AdList':AdList,
+        'resumeForm':resumeForm,
+    })

BIN
pythonweb/db.sqlite3


+ 235 - 89
pythonweb/homeApp/templates/home.html

@@ -1,105 +1,251 @@
-<!-- <!DOCTYPE html>
-{% load static %}
-<html lang="zh-cn">
-
-<head>
-    <meta charset="utf-8">
-    <meta http-equiv="X-UA-Compatible" content="IE=edge">
-    <meta name="viewport" content="width=device-width, initial-scale=1">
-    <title>恒达科技(教学示例网站)</title>
-    <link href="{% static 'css/bootstrap.css' %}" rel="stylesheet">
-    <link href="{% static 'css/style.css' %}" rel="stylesheet">
-    <script src="{% static 'js/jquery.min.js' %}"></script>
-    <script src="{% static 'js/bootstrap.min.js' %}"></script>
-</head>
-
-<body>
-导航条 -->
-    <!-- <nav class="navbar navbar-default" role="navigation">
-        <div class="container">
-            <div class="navbar-header">
-                <button type="button" class="navbar-toggle collapsed" data-toggle="collapse"
-                    data-target="#bs-example" aria-expanded="false">
-                    <span>导航栏</span>
-                </button>
+{% extends "base.html" %} {% load static %} {% block title %} 首页 {% endblock %} {% block content %}
+<link href="{% static 'css/home.css' %}" rel="stylesheet">
+<script src="{% static 'js/jqthumb.min.js' %}"></script>
+<!-- 广告横幅 -->
+<div id="ad" class="carousel slide" data-ride="carousel" data-interval="5000">
+    <ol class="carousel-indicators">
+        <li data-target="#ad" data-slide-to="0" class="active"></li>
+        <li data-target="#ad" data-slide-to="1"></li>
+        <li data-target="#ad" data-slide-to="2"></li>
+    </ol>
+    <div class="carousel-inner">
+        <div class="item active">
+            <img src="{% static 'img/banner1.jpg' %}" alt="广告横幅1">
+        </div>
+        <div class="item">
+            <img src="{% static 'img/banner2.jpg' %}" alt="广告横幅2">
+        </div>
+        <div class="item">
+            <img src="{% static 'img/banner3.jpg' %}" alt="广告横幅3">
+        </div>
+    </div>
+    <a class="left carousel-control" href="#ad" data-slide="prev"><span
+      class="glyphicon glyphicon-chevron-left"></span></a>
+    <a class="right carousel-control" href="#ad" data-slide="next"><span
+      class="glyphicon glyphicon-chevron-right"></span></a>
+</div>
+<!-- 主体内容 -->
+<div class="container">
+    <div class="row row-3">
+
+        <div class="col-md-4">
+            <!-- 企业概况 -->
+            <span class="part1">
+        <a href="{% url 'aboutApp:survey' %}">企业概况</a>
+      </span>
+            <span class="part1 en">
+        &nbsp;&nbsp;/ About Us
+      </span>
+            <div class="line1">
+                <div class="line2 theme"></div>
             </div>
-            <div class="collapse navbar-collapse" id="bs-example">
-                <ul class="nav navbar-nav" style="width:100%;">
-                    <li class="active nav-top">
-                        <a href="{% url 'home' %}">首页</a>
-                    </li>
-                    <li class="dropdown nav-top">
-                        <a href="#" class="dropdown-toggle on" data-toggle="dropdown">
-                            公司简介</a>
-                        <ul class="dropdown-menu">
-                            <li><a href="{% url 'aboutApp:survey' %}">企业概况</a></li>
-                            <li><a href="{% url 'aboutApp:honor' %}">荣誉资质</a></li>
-                        </ul>
-                    </li>
+            <div style="margin-top:20px;">
+                <img class="img-responsive" src="{% static 'img/aboutCompany.jpg' %}">
+                <p class="text1">
+                    恒达科技有限企业,位于中国某高新技术产业开发区, 以社会公共安全领域为主要应用方向,提供极速、准确和防伪装的人脸识别产品。
+                </p>
+            </div>
+        </div>
 
-                    <li class="dropdown nav-top">
-                        <a href="#" class="dropdown-toggle on" data-toggle="dropdown">
-                            新闻动态</a>
-                        <ul class="dropdown-menu">
-                            <li><a href="{% url 'newsApp:company' %}">公司要闻</a></li>
-                            <li><a href="{% url 'newsApp:industry' %}">行业新闻</a></li>
-                            <li><a href="{% url 'newsApp:notice' %}">通知公告</a></li>
-                        </ul>
-                    </li>
-                    <li class="dropdown nav-top">
-                        <a href="#" class="dropdown-toggle on" data-toggle="dropdown">
-                            产品中心</a>
-                        <ul class="dropdown-menu">
-                            <li><a href="{% url 'productsApp:robot' %}">
-                                    家用机器人</a></li>
-                            <li><a href="{% url 'productsApp:monitoring' %}">
-                                    智能监控</a></li>
-                            <li><a href="{% url 'productsApp:face' %}">
-                                    人脸识别解决方案</a></li>
-                        </ul>
-                    </li>
-                    <li class="dropdown nav-top">
-                        <a href="#" class="dropdown-toggle on" data-toggle="dropdown">
-                            服务支持</a>
-                        <ul class="dropdown-menu">
-                            <li><a href="{% url 'serviceApp:download' %}">
-                                    资料下载</a></li>
-                            <li><a href="{% url 'serviceApp:platform' %}">
-                                    人脸识别开放平台</a></li>
-                        </ul>
-                    </li>
-                    <li class="nav-top">
-                        <a href="{% url 'scienceApp:science' %}">科研基地</a>
+        <div class="col-md-8">
+            <!-- 新闻动态 -->
+            <span class="part1">
+        <a href="#">新闻动态</a>
+      </span>
+            <span class="part1 en">
+        &nbsp;&nbsp;/ News
+      </span>
+            <a class="btn btn-default btn-xs more-btn" href="{% url 'newsApp:news' 'company' %}">
+        +&nbsp;更多
+      </a>
+            <div class="line1">
+                <div class="line2 theme"></div>
+            </div>
+            <div class="col-md-5">
+                <div id="myCarousel" class="carousel slide" data-ride="carousel">
+                    <ol class="carousel-indicators nav-point">
+                        {% for post in postList %}
+                        <li data-target="#myCarousel" data-slide-to="{{forloop.counter0}}" {% if forloop.first %} class="active" {% endif %}>
+                        </li>
+                        {% endfor %}
+                    </ol>
+                    <!-- 轮播(Carousel)项目 -->
+                    <div class="carousel-inner" style="margin-top:15px;">
+                        {% for post in postList %}
+                        <div {% if forloop.first %} class="item active" {% else %} class="item" {% endif %} style="background-size:cover;">
+                            <a href="{% url 'newsApp:newDetail' post.id %}">
+                                <img src="{{post.photo.url}}" class="img-responsive" onload="DrawImage(this)"></a>
+                            <div class="carousel-caption nav-title">{{post.title}}</div>
+                        </div>
+                        {% endfor %}
+                    </div>
+                </div>
+            </div>
+            <div class="col-md-7">
+                <ul class="list-unstyled list-new">
+                    {% for mynew in newList %}
+                    <li>
+                        <a href="{% url 'newsApp:newDetail' mynew.id %}">
+              {{mynew.title|truncatechars:"15"}}</a>
+                        <span>【{{mynew.publishDate|date:"Y-m-d"}}】</span>
                     </li>
-                    <li class="dropdown nav-top">
-                        <a href="#" class="dropdown-toggle on" data-toggle="dropdown">
-                            人才招聘</a>
-                        <ul class="dropdown-menu">
-                            <li><a href="{% url 'contactApp:contact' %}">欢迎咨询</a></li>
-                            <li><a href="{% url 'contactApp:recruit' %}">加入恒达</a></li>
-                        </ul>
+                    {% endfor %}
+                </ul>
+            </div>
+        </div>
+
+    </div>
+
+    <div class="row row-3">
+
+        <div class="col-md-4">
+            <!-- 通知公告 -->
+            <span class="part1">
+        <a href="#">通知公告</a>
+      </span>
+            <span class="part1 en">
+        &nbsp;&nbsp;/ Public Release
+      </span>
+            <a class="btn btn-default btn-xs more-btn" href="{% url 'newsApp:news' 'notice' %}">
+        +&nbsp;更多
+      </a>
+            <div class="line1">
+                <div class="line2 theme"></div>
+            </div>
+            <div>
+                <img class="img-responsive" src="{% static 'img/note.jpg' %}">
+                <ul class="list-unstyled list-new">
+                    {% for note in noteList %}
+                    <li>
+                        <a href="{% url 'newsApp:newDetail' note.id %}">
+              {{note.title|truncatechars:"25"}}
+            </a>
+                        <a href="{% url 'newsApp:newDetail' note.id %}" class="public-detail">
+              查看详情>>
+            </a>
                     </li>
+                    {% endfor %}
                 </ul>
             </div>
+
+
         </div>
-    </nav>
-</body>
 
-</html> --> 
+        <div class="col-md-4">
+            <!-- 科研基地 -->
+            <span class="part1">
+        <a href="{% url 'scienceApp:science' %}">科研基地</a>
+      </span>
+            <span class="part1 en">
+        &nbsp;&nbsp;/ Technology Center
+      </span>
+            <div class="line1">
+                <div class="line2 theme"></div>
+            </div>
+            <div>
+                <a href="{% url 'scienceApp:science' %}">
+                    <img class="img-responsive" src="{% static 'img/ky.jpg' %}">
+                </a>
+                <p class="text1">
+                    <font color="#d30a1c">恒达科技科研基地</font>
+                    恒达科研基地分为计算机视觉、 机器人和视觉深度学习三个事业部,共拥有高级研发人员近30名, 以各领域高级工程师和知名院校博士为主体的多层次研发梯队。当前,科研基地优秀的技术团队 已为恒达在人脸识别、物联网平台搭建、机器人导航等 领域打下了坚实基础
+                </p>
+            </div>
 
+        </div>
 
+        <div class="col-md-4">
+            <!-- 联系我们 -->
+            <span class="part1">
+        <a href="{% url 'contactApp:contact' %}">联系我们</a>
+      </span>
+            <span class="part1 en">
+        &nbsp;&nbsp;/ Contact us
+      </span>
+            <div class="line1">
+                <div class="line2 theme"></div>
+            </div>
+            <div>
+                <ul class="list-unstyled procurement-li">
+                    <li>业务质询一:111-XXXXXX</li>
+                    <li>业务质询二:222-XXXXXX</li>
+                    <li>咨询电话:0111-XXXXXX</li>
+                    <li>企业传真:0222-XXXXXX</li>
+                    <li>地址:某某某新区某某大道1号</li>
+                    <li>邮编:XXXXXX</li>
+                    <li>
+                        网址:<a href="http://python3web.com">http://python3web.com</a>
+                    </li>
+                </ul>
+                <div class="platform"><a href="{% url 'contactApp:contact' %}">详情</a></div>
+            </div>
 
+        </div>
 
+    </div>
 
+    <div class="row row-3">
+        <!-- 产品中心 -->
+        <div class="col-md-12 col-pro">
 
-{% extends "base.html" %}
-{% load static %}
+            <span class="part1">
+        <a href="{% url 'productsApp:products' 'robot' %}">产品中心</a>
+      </span>
+            <span class="part1 en">
+        &nbsp;&nbsp;/ Products
+      </span>
+            <a class="btn btn-default btn-xs more-btn" href="{% url 'productsApp:products' 'robot' %}">
+        +&nbsp;更多
+      </a>
+            <div class="line1" style="margin-bottom:5px;">
+                <div class="line2 theme"></div>
+            </div>
+            <div class="col-md-12 col-pro">
+                <div id="Carousel" class="carousel slide" style="margin-bottom:30px">
+                    <ol class="carousel-indicators" style="display:none;">
+                        <li data-target="#Carousel" data-slide-to="0" class="active"></li>
+                    </ol>
+                    <div class="carousel-inner">
+                        <div class="item active">
+                            <div class="row">
+                                {% for product in productList %}
+                                <div class="col-md-3 pro-images">
+                                    <a href="{% url 'productsApp:productDetail' product.id %}" class="thumbnail">
+                    {% for img in product.productImgs.all %}
+                    {% if forloop.first %}
+                    <img src="{{img.photo.url}}" alt="产品图片" class="img-responsive" onload="DrawImage(this)">
+                    {% endif %}
+                    {% endfor %}
+                  </a>
+                                    <div class="carousel-caption nav-title">{{product.title}}</div>
+                                </div>
+                                {% endfor %}
+                            </div>
+                        </div>
+                    </div>
+                </div>
+            </div>
 
-{% block title %}
-首页
-{% endblock %}
-{% block content %}
-<!-- 广告横幅 -->
- 
-<!-- 主题内容 -->
+        </div>
+    </div>
+
+    <div class="row row-3">
+        <!-- 友情链接 -->
+        <div class="col-md-12">
+        </div>
+    </div>
+
+</div>
+
+<script>
+    //处理缩略图
+    function DrawImage(hotimg) {
+        $(hotimg).jqthumb({
+            width: '100%', // 宽度
+            height: '220px', // 高度
+            zoom: '1', // 缩放比例
+            method: 'auto' // 提交方法,用于不同的浏览器环境,默认为‘auto’
+        });
+    }
+</script>
 {% endblock %}

+ 39 - 4
pythonweb/homeApp/views.py

@@ -1,9 +1,44 @@
 from django.shortcuts import render
 from django.shortcuts import HttpResponse
-
+from newsApp.models import MyNew
+from django.db.models import Q
+from productsApp.models import Product
+from django.views.decorators.cache import cache_page
 
 # Create your views here.
+@cache_page(60 * 15)
+
 def home(request):
-    html='<html><body>首页</body></html>'
-    # return HttpResponse(html)
-    return render(request, 'home.html',{'active_menu':'home',})
+    newList = MyNew.objects.all().filter(~Q(
+        newType='通知公告')).order_by('-publishDate')
+    postList = set()
+    postNum = 0
+    for s in newList:
+        if s.photo:
+            postList.add(s)
+            postNum += 1
+        if postNum == 3:
+            break
+
+    if (len(newList) > 7):
+        newList = newList[0:7]
+
+    noteList = MyNew.objects.all().filter(
+        Q(newType='通知公告')).order_by('-publishDate')
+    if (len(noteList) > 4):
+        noteList = noteList[0:4]
+
+    productList = Product.objects.all().order_by('-views')
+    if(len(productList)>4):
+        productList = productList[0:4]
+
+    return render(request, 'home.html', {
+        'active_menu': 'home',
+        'postList': postList,
+        'newList': newList,
+        'noteList': noteList,
+        'productList':productList,
+    })
+    # html='<html><body>首页</body></html>'
+    # # return HttpResponse(html)
+    # return render(request, 'home.html',{'active_menu':'home',})

+ 3 - 3
pythonweb/newsApp/admin.py

@@ -1,8 +1,8 @@
 from django.contrib import admin
 from .models import MyNew
 
+# Register your models here.
 class MyNewAdmin(admin.ModelAdmin):
-    style_fields={'description':'ueditor'}
+    style_fields = {'description': 'ueditor'}
 
-admin.site.register(MyNew,MyNewAdmin)
-# Register your models here.
+admin.site.register(MyNew, MyNewAdmin)

+ 18 - 0
pythonweb/newsApp/migrations/0003_mynew_photo.py

@@ -0,0 +1,18 @@
+# Generated by Django 4.2.30 on 2026-05-09 09:13
+
+from django.db import migrations, models
+
+
+class Migration(migrations.Migration):
+
+    dependencies = [
+        ('newsApp', '0002_alter_mynew_id'),
+    ]
+
+    operations = [
+        migrations.AddField(
+            model_name='mynew',
+            name='photo',
+            field=models.ImageField(blank=True, null=True, upload_to='news/', verbose_name='展报'),
+        ),
+    ]

+ 28 - 22
pythonweb/newsApp/models.py

@@ -3,32 +3,38 @@ from DjangoUeditor.models import UEditorField
 import django.utils.timezone as timezone
 
 class MyNew(models.Model):
-    NEWS_CHOICES=(
-        ('企业要闻','企业要闻'),
-        ('行业新闻','行业新闻'),
-        ('通知公告','通知公告'),
+    NEWS_CHOICES = (
+        ('企业要闻', '企业要闻'),
+        ('行业新闻', '行业新闻'),
+        ('通知公告', '通知公告'),
     )
-    title=models.CharField(max_length=50,verbose_name='新闻标题')
-    description=UEditorField(u'内容',
-                             default='',
-                             width=1000,
-                             height=300,
-                             imagePath='news/images/',
-                             filePath='news/files/')
-    newType=models.CharField(choices=NEWS_CHOICES,
-                             max_length=50,
-                             verbose_name='新闻类型')
-    publishDate=models.DateTimeField(max_length=20,
-                                     default=timezone.now,
-                                     verbose_name='发布时间')
-    views=models.PositiveIntegerField('浏览量',default=0)
+    title = models.CharField(max_length=50, verbose_name=' 新闻标题')
+    description = UEditorField(u'内容',
+                               default='',
+                               width=1000,
+                               height=300,
+                               imagePath='news/images/',
+                               filePath='news/files/')
+    newType = models.CharField(choices=NEWS_CHOICES,
+                               max_length=50,
+                               verbose_name='新闻类型')
+    publishDate = models.DateTimeField(max_length=20,
+                                       default=timezone.now,
+                                       verbose_name='发布时间')
+    views = models.PositiveIntegerField('浏览量', default=0)
+    photo = models.ImageField(upload_to='news/',
+                              blank=True,
+                              null=True,
+                              verbose_name='展报')
 
     def __str__(self):
         return self.title
-    
+
     class Meta:
-        ordering=['-publishDate']
-        verbose_name="新闻",
-        verbose_name_plural=verbose_name
+        ordering = ['-publishDate']
+        verbose_name = "新闻"
+        verbose_name_plural = verbose_name
+
+
 
 # Create your models here.

+ 5 - 3
pythonweb/newsApp/search_indexes.py

@@ -1,9 +1,11 @@
 from haystack import indexes
 from .models import MyNew
 
-class MyNewIndex(indexes.SearchIndex,indexes.Indexable):
-    text= indexes.CharField(document=True,use_template=True)
+class MyNewIndex(indexes.SearchIndex, indexes.Indexable):
+    text = indexes.CharField(document=True, use_template=True)
+
     def get_model(self):
         return MyNew
-    def index_queryset(self,using=None):
+
+    def index_queryset(self, using=None):
         return self.get_model().objects.all()

+ 3 - 8
pythonweb/newsApp/templates/newDetail.html

@@ -1,16 +1,11 @@
-{% extends "base.html" %}
-{% load staticfiles %}
-{% block title %}
-新闻详情
-{% endblock %}
-{% block content %}
+{% extends "base.html" %} {% load static %} {% block title %} 新闻详情 {% endblock %} {% block content %}
 <link href="{% static 'css/news.css' %}" rel="stylesheet">
 <!-- 主体内容 -->
 <div class="container">
     <div class="model-details-product-title">
         {{mynew.title}}
-        <div class="model-foot">发布时间:{{mynew.publishDate|date:"Y-m-d"}} &nbsp;&nbsp;
-            浏览次数:{{mynew.views}}</div>
+        <div class="model-foot">发布时间:{{mynew.publishDate|date:"Y-m-d"}} &nbsp;&nbsp; 浏览次数:{{mynew.views}}
+        </div>
     </div>
     <div class="model-details">
         {{ mynew.description | safe }}

+ 1 - 6
pythonweb/newsApp/templates/searchList.html

@@ -1,9 +1,4 @@
-{% extends "base.html" %}
-{% load staticfiles %}
-{% block title %}
-{{newName}}
-{% endblock %}
-{% block content %}
+{% extends "base.html" %} {% load static %} {% block title %} {{newName}} {% endblock %} {% block content %}
 <link href="{% static 'css/news.css' %}" rel="stylesheet">
 <!-- 广告横幅 -->
 <div class="container-fluid">

+ 3 - 3
pythonweb/newsApp/urls.py

@@ -7,8 +7,8 @@ urlpatterns = [
     # path('company/', views.company, name='company'),     # 公司要闻
     # path('industry/', views.industry, name='industry'),  # 行业新闻
     # path('notice/', views.notice, name='notice'),        # 通知公告
-    path('news/<str:newName>/',views.news,name='news'),
-    path('newDetail/<int:id>/',views.newDetail,name='newDetail'),
-    path('search/',views.search,name='search'),
+    path('news/<str:newName>/', views.news, name='news'),
+    path('newDetail/<int:id>/', views.newDetail, name='newDetail'),
+    path('search/', views.search, name='search'),
     
 ]

+ 29 - 28
pythonweb/newsApp/views.py

@@ -2,7 +2,7 @@ from django.shortcuts import render
 from django.shortcuts import HttpResponse
 from .models import MyNew
 from django.core.paginator import Paginator
-from django.shortcuts import get_list_or_404
+from django.shortcuts import get_object_or_404
 from pyquery import PyQuery as pq
 
 # Create your views here.
@@ -20,26 +20,27 @@ from pyquery import PyQuery as pq
 #     html = '<html><body>通知公告</body></html>'
 #     return HttpResponse(html)
 
-def news(request,newName):
-    submenu=newName
-    if newName=='company':
-        newName='企业要闻'
-    elif newName=='industry':
-        newName='行业要闻'
+def news(request, newName):
+    submenu = newName
+    if newName == 'company':
+        newName = '企业要闻'
+    elif newName == 'industry':
+        newName = '行业新闻'
     else:
-        newName='通知公告'
+        newName = '通知公告'
 
-    newList=MyNew.objects.all().filter(newType=newName).order_by('-publishDate')
+    newList = MyNew.objects.all().filter(
+        newType=newName).order_by('-publishDate')
     for mynew in newList:
-        html=pq(mynew.description)
-        mynew.mytxt=pq(html)('p').text()
-
+        html = pq(mynew.description)
+        mynew.mytxt = pq(html)('p').text()
+        
     p = Paginator(newList, 5)
     if p.num_pages <= 1:
         pageData = ''
     else:
         page = int(request.GET.get('page', 1))
-        productList = p.page(page)
+        newList = p.page(page)
         left = []
         right = []
         left_has_more = False
@@ -83,30 +84,30 @@ def news(request,newName):
             'page': page,
         }
     return render(
-        request,'newList.html',{
-            'active_menu':'news',
-            'sub_menu':'submenu',
-            'newName':newName,
-            'newList':newList,
-            'pageData':pageData,
-        }
-    )
+        request, 'newList.html', {
+            'active_menu': 'news',
+            'sub_menu': submenu,
+            'newName': newName,
+            'newList': newList,
+            'pageData': pageData,
+        })
 
 
-def newDetail(request,id):
-    mynew=get_object_or_404(MyNew,id=id)
+def newDetail(request, id):
+    mynew = get_object_or_404(MyNew, id=id)
     mynew.views += 1
     mynew.save()
-    return render(request,'newDetail.html',{
-        'active_menu':'news',
-        'mynew':mynew,
+    return render(request, 'newDetail.html', {
+        'active_menu': 'news',
+        'mynew': mynew,
     })
 
+
 def search(request):
     keyword = request.GET.get('keyword')
-    newList = MyNew.objects.filter(title_icontains=keyword)
+    newList = MyNew.objects.filter(title__icontains=keyword)
     newName = "关于 " + "\"" + keyword + "\"" + " 的搜索结果"
-    return render(request,'searchList.html',{
+    return render(request, 'searchList.html', {
         'active_menu': 'news',
         'newName': newName,
         'newList': newList,

+ 1 - 1
pythonweb/newsApp/whoosh_backend.py

@@ -708,7 +708,7 @@ class WhooshSearchBackend(BaseSearchBackend):
             # Leave it alone.
             pass
         else:
-            value = force_text(value)
+            value = force_str(value)
         return value
 
     def _to_python(self, value):

+ 19 - 1
pythonweb/pythonweb/settings.py

@@ -47,6 +47,7 @@ INSTALLED_APPS = [
     'scienceApp',  # 添加"科研基地"应用
     'DjangoUeditor', # 添加富文本应用
     'haystack',
+    'widget_tweaks',
 ]
 
 MIDDLEWARE = [
@@ -146,4 +147,21 @@ HAYSTACK_CONNECTIONS={
     },
 }
 HAYSTACK_SEARCH_RESULTS_PER_PAGE= 10
-HAYSTACK_SIGNAL_PROCESSOR= 'haystack.signals.RealtimeSignalProcessor'
+HAYSTACK_SIGNAL_PROCESSOR= 'haystack.signals.RealtimeSignalProcessor'
+
+EMALL_HOST = 'smtp.qq.com'
+EMALL_PORT = 25
+EMALL_HOST_USER = 'xxxx@qq.com'
+EMALL_HOST_PASSWORD = 'xxxxxxxxxx'
+EMALL_USE_TLS = True
+
+CACHES = {
+    'default':{
+        'BACKEND':'django.core.cache.backends.db.DatabaseCache',
+        'LOCATION':'cache_table_home',
+        'TIMEOUT':600,
+        'OPTIONS':{
+            'MAX_ENTRIES':2000
+        }
+    }
+}

+ 1 - 0
pythonweb/pythonweb/urls.py

@@ -31,6 +31,7 @@ urlpatterns = [
     path('serviceApp/', include('serviceApp.urls')),    # 服务支持
     path('ueditor/',include('DjangoUeditor.urls')),
     path('search/',include('haystack.urls')),
+    
 ]
 
 if settings.DEBUG:

+ 2 - 2
pythonweb/serviceApp/admin.py

@@ -1,6 +1,6 @@
 from django.contrib import admin
-
 from .models import Doc
 
+
 # Register your models here.
-admin.register(Doc)
+admin.register(Doc)

+ 29 - 0
pythonweb/serviceApp/migrations/0001_initial.py

@@ -0,0 +1,29 @@
+# Generated by Django 4.2.30 on 2026-05-08 13:20
+
+from django.db import migrations, models
+import django.utils.timezone
+
+
+class Migration(migrations.Migration):
+
+    initial = True
+
+    dependencies = [
+    ]
+
+    operations = [
+        migrations.CreateModel(
+            name='Doc',
+            fields=[
+                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
+                ('title', models.CharField(max_length=250, verbose_name='资料名称')),
+                ('file', models.FileField(blank=True, upload_to='Service/', verbose_name='文件资料')),
+                ('publishDate', models.DateTimeField(default=django.utils.timezone.now, max_length=20, verbose_name='发布时间')),
+            ],
+            options={
+                'verbose_name': '资料',
+                'verbose_name_plural': '资料',
+                'ordering': ['publishDate'],
+            },
+        ),
+    ]

+ 17 - 0
pythonweb/serviceApp/migrations/0002_alter_doc_options.py

@@ -0,0 +1,17 @@
+# Generated by Django 4.2.30 on 2026-05-09 14:10
+
+from django.db import migrations
+
+
+class Migration(migrations.Migration):
+
+    dependencies = [
+        ('serviceApp', '0001_initial'),
+    ]
+
+    operations = [
+        migrations.AlterModelOptions(
+            name='doc',
+            options={'ordering': ['-publishDate'], 'verbose_name': '资料', 'verbose_name_plural': '资料'},
+        ),
+    ]

+ 1 - 1
pythonweb/serviceApp/models.py

@@ -1,6 +1,6 @@
 from django.db import models
-
 import django.utils.timezone as timezone
+
 # Create your models here.
 class Doc(models.Model):
     title = models.CharField(max_length=250,verbose_name="资料名称")

+ 8 - 25
pythonweb/serviceApp/templates/docList.html

@@ -1,11 +1,4 @@
-{% extends "base.html" %}
-{% load static %}
-
-{% block title %}
-资料下载
-{% endblock %}
-
-{% block content %}
+{% extends "base.html" %} {% load static %} {% block title %} 资料下载 {% endblock %} {% block content %}
 <link href="{% static 'css/news.css' %}" rel="stylesheet">
 <!-- 广告横幅 -->
 <div class="container-fluid">
@@ -44,33 +37,23 @@
                     <a href="{% url 'serviceApp:getDoc' doc.id %}"><b>{{doc.title}}</b></a>
                     <span>【{{doc.publishDate|date:"Y-m-d"}}】</span>
                 </div>
-                {% endfor %}
-
-                {% if pageData %}
+                {% endfor %} {% if pageData %}
                 <div class="paging">
                     <ul id="pages" class="pagination">
                         {% if pageData.first %}
                         <li><a href="?page=1">1</a></li>
-                        {% endif %}
-                        {% if pageData.left %}
-                        {% if pageData.left_has_more %}
+                        {% endif %} {% if pageData.left %} {% if pageData.left_has_more %}
                         <li><span>...</span></li>
-                        {% endif %}
-                        {% for i in pageData.left %}
+                        {% endif %} {% for i in pageData.left %}
                         <li><a href="?page={{i}}">{{i}}</a></li>
-                        {% endfor %}
-                        {% endif %}
+                        {% endfor %} {% endif %}
                         <li class="active"><a href="?page={{pageData.page}}">
                                 {{pageData.page}}</a></li>
-                        {% if pageData.right %}
-                        {% for i in pageData.right %}
+                        {% if pageData.right %} {% for i in pageData.right %}
                         <li><a href="?page={{i}}">{{i}}</a></li>
-                        {% endfor %}
-                        {% if pageData.right_has_more %}
+                        {% endfor %} {% if pageData.right_has_more %}
                         <li><span>...</span></li>
-                        {% endif %}
-                        {% endif %}
-                        {% if pageData.last %}
+                        {% endif %} {% endif %} {% if pageData.last %}
                         <li><a href="?page={{pageData.total_pages}}">
                                 {{pageData.total_pages}}</a></li>
                         {% endif %}

+ 12 - 20
pythonweb/serviceApp/templates/platForm.html

@@ -1,11 +1,4 @@
-{% extends "base.html" %}
-{% load static %}
-
-{% block title %}
-人脸识别开放平台
-{% endblock %}
-
-{% block content %}
+{% extends "base.html" %} {% load static %} {% block title %} 人脸识别开放平台 {% endblock %} {% block content %}
 <link href="{% static 'css/news.css' %}" rel="stylesheet">
 <link rel="stylesheet" href="{% static 'css/codemirror.css' %}">
 <script src="{% static 'js/codemirror.js' %}"></script>
@@ -54,8 +47,7 @@
                     人脸检测
                 </button>
                 <!-- 模态框(Modal) -->
-                <div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel"
-                    aria-hidden="true">
+                <div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
                     <div class="modal-dialog">
                         <div class="modal-content">
                             <div class="modal-header">
@@ -67,8 +59,7 @@
                                 </h4>
                             </div>
                             <div class="modal-body">
-                                <img id="photoIn" src="{% static 'img/sample.png' %}" class="img-responsive"
-                                    style="max-width:250px">
+                                <img id="photoIn" src="{% static 'img/sample.png' %}" class="img-responsive" style="max-width:250px">
                                 <input type="file" id="photo" name="photo" />
                             </div>
                             <div class="modal-footer">
@@ -78,23 +69,25 @@
                                     开始检测
                                 </button>
                             </div>
-                        </div><!-- /.modal-content -->
-                    </div><!-- /.modal -->
+                        </div>
+                        <!-- /.modal-content -->
+                    </div>
+                    <!-- /.modal -->
                 </div>
                 <script>
-                    $(function () {
-                        $('#photo').on('change', function () {
+                    $(function() {
+                        $('#photo').on('change', function() {
                             var r = new FileReader();
                             f = document.getElementById('photo').files[0];
                             r.readAsDataURL(f);
-                            r.onload = function (e) {
+                            r.onload = function(e) {
                                 document.getElementById('photoIn').src = this.result;
                             };
                         });
                     });
                 </script>
                 <script>
-                    $('#compute').click(function () {
+                    $('#compute').click(function() {
                         formdata = new FormData();
                         var file = $("#photo")[0].files[0];
                         formdata.append("image", file);
@@ -127,8 +120,7 @@
                 </br>
                 <h4><strong>接口描述:</strong></h4>
                 <p>
-                    人脸检测,此接口多用于调用人脸识别、人脸比对的接口之前,用于从图像数据中检测出人脸区域,并以
-                    矩形框形式返回人脸检测结果。目前该接口仅供测试使用,调用该接口暂时不限制调用次数。
+                    人脸检测,此接口多用于调用人脸识别、人脸比对的接口之前,用于从图像数据中检测出人脸区域,并以 矩形框形式返回人脸检测结果。目前该接口仅供测试使用,调用该接口暂时不限制调用次数。
                 </p>
 
                 </br>

+ 1 - 1
pythonweb/serviceApp/views.py

@@ -114,4 +114,4 @@ def facedetectDemo(request):
         img64 = base64.b64encode(buffer_img)
         img64 = str(img64, 'utf-8')
         result['img64'] = img64
-        return JsonResponse(result)
+        return JsonResponse(result)

+ 121 - 0
pythonweb/static/css/home.css

@@ -0,0 +1,121 @@
+.part1{
+	font-size:22px;
+}
+.part1 a{
+	text-decoration:none;
+	color:#666;
+}
+.en{	
+	color:#828282;
+	font-size:15px;
+}
+.line1{
+	height:3px;
+	background:#d0d0d0;
+	width:100%;
+	margin-bottom:8px
+}
+.line2{
+	height:3px;
+	background: #005197;
+	width:94px;
+}
+.text1{
+	text-align:justify;
+	font-size:13px;
+	line-height:25px;
+	color:#505050;
+	margin-top:5px;
+}
+
+/*新闻中心*/
+.carousel {
+	margin-bottom: 40px;
+}
+.carousel .item {
+	background-color: #000;
+}
+.carousel .nav-point{
+	bottom:-14px;
+}	
+.carousel .nav-title{
+	font-size:12px;
+	bottom:-14px;
+}
+.carousel .item img {
+    width: 100%;    
+}
+.carousel-caption {
+	z-index: 10;
+}
+.carousel-caption p {
+	margin-bottom: 20px;
+	font-size: 20px;
+	line-height: 1.8;
+}
+.more-btn{
+	float:right;
+	margin-top:7px;
+	color:#828282;
+	font-size:11px;
+}
+.list-new li{
+	border-bottom:1px dashed #eae7e7;
+	line-height:40px;
+}
+.list-new a{
+	text-decoration:none;
+	color:#666;
+	font-size:13px;
+}
+.list-new a:hover{
+	color:#d30a1c;
+}
+.list-new span{
+	float:right;
+	font-size:12px;
+}
+.list-new .public-detail{
+	float:right;
+	color:#d30a1c;
+}
+
+/* 联系我们 */
+.procurement-li{
+	line-height:35px;
+	color:#666;
+	font-size:13px;
+}
+.procurement-li a{
+	text-decoration:none;
+	color:#666;
+}
+.platform{
+	width:100%;
+	height:45px;
+	background:#eae7e7;
+	color:#fff;
+	text-align:center;
+	font-size:17px;
+	line-height:42px;
+}
+.platform a{
+	text-decoration:none;
+	color:#666;
+}
+.platform a:hover{
+	color:#d30a1c;
+}
+
+/* 产品中心 */
+.pro-images{
+	background-color:#f6f6f6; 
+ }
+ .thumbnail{
+	 margin-bottom:0px;
+ }
+ .col-pro{
+	 background-color:#F6F6F6;
+	 padding-top:15px;
+ }
+

BIN
pythonweb/static/img/banner1.jpg


BIN
pythonweb/static/img/banner2.jpg


BIN
pythonweb/static/img/banner3.jpg


BIN
pythonweb/static/img/ky.jpg


BIN
pythonweb/static/img/note.jpg


Rozdielové dáta súboru neboli zobrazené, pretože súbor je príliš veľký
+ 12 - 0
pythonweb/static/js/jqthumb.min.js


+ 39 - 0
pythonweb/static/js/layDate-v5.0.9/layDate-v5.0.9/test.html

@@ -0,0 +1,39 @@
+<!DOCTYPE html>
+<html>
+<head>
+  <meta charset="utf-8">
+  <title>使用 layDate 独立版</title>
+  <meta name="renderer" content="webkit">
+  <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
+  <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
+  <meta name="apple-mobile-web-app-status-bar-style" content="black"> 
+  <meta name="apple-mobile-web-app-capable" content="yes">
+  <meta name="format-detection" content="telephone=no">
+
+  <style>
+  body{padding: 20px;}
+  .demo-input{padding-left: 10px; height: 38px; min-width: 262px; line-height: 38px; border: 1px solid #e6e6e6;  background-color: #fff;  border-radius: 2px;}
+  .demo-footer{padding: 50px 0; color: #999; font-size: 14px;}
+  .demo-footer a{padding: 0 5px; color: #01AAED;}
+  </style>
+</head>
+<body>
+<input type="text" class="demo-input" placeholder="请选择日期" id="test1">
+
+<div class="demo-footer">
+  <a href="http://www.layui.com/laydate/" target="_blank">layDate<cite id="version"></cite></a>
+  <a href="http://www.layui.com/doc/modules/laydate.html" target="_blank">文档</a>
+  <span>&copy; <a href="http://www.layui.com/" target="_blank">layui.com</a> By 贤心<span>
+</div>
+
+<script src="laydate/laydate.js"></script> <!-- 改成你的路径 -->
+<script>
+lay('#version').html('-v'+ laydate.v);
+
+//执行一个laydate实例
+laydate.render({
+  elem: '#test1' //指定元素
+});
+</script>
+</body>
+</html>

+ 6 - 0
pythonweb/static/js/layDate-v5.0.9/layDate-v5.0.9/文档/官网.url

@@ -0,0 +1,6 @@
+[{000214A0-0000-0000-C000-000000000046}]
+Prop3=19,2
+[InternetShortcut]
+URL=http://www.layui.com/laydate/
+IDList=
+HotKey=0

+ 8 - 0
pythonweb/static/js/layDate-v5.0.9/layDate-v5.0.9/文档/文档.url

@@ -0,0 +1,8 @@
+[{000214A0-0000-0000-C000-000000000046}]
+Prop3=19,2
+[InternetShortcut]
+URL=http://www.layui.com/doc/modules/laydate.html
+IDList=
+HotKey=0
+IconIndex=0
+IconFile=C:\Program Files (x86)\Google\Chrome\Application\chrome.exe

+ 8 - 0
pythonweb/static/js/layDate-v5.0.9/layDate-v5.0.9/文档/社区.url

@@ -0,0 +1,8 @@
+[{000214A0-0000-0000-C000-000000000046}]
+Prop3=19,2
+[InternetShortcut]
+URL=http://fly.layui.com/
+IDList=
+HotKey=0
+IconIndex=0
+IconFile=C:\Program Files (x86)\Google\Chrome\Application\chrome.exe

+ 6 - 0
pythonweb/static/js/layDate-v5.0.9/layDate-v5.0.9/更新日志.url

@@ -0,0 +1,6 @@
+[{000214A0-0000-0000-C000-000000000046}]
+Prop3=19,2
+[InternetShortcut]
+URL=http://www.layui.com/laydate/changelog.html
+IDList=
+HotKey=0

Rozdielové dáta súboru neboli zobrazené, pretože súbor je príliš veľký
+ 1 - 0
pythonweb/static/js/layDate-v5.0.9/laydate.js


BIN
pythonweb/static/js/layDate-v5.0.9/theme/default/font/iconfont.eot


+ 45 - 0
pythonweb/static/js/layDate-v5.0.9/theme/default/font/iconfont.svg

@@ -0,0 +1,45 @@
+<?xml version="1.0" standalone="no"?>
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd" >
+<!--
+2013-9-30: Created.
+-->
+<svg>
+<metadata>
+Created by iconfont
+</metadata>
+<defs>
+
+<font id="laydate-icon" horiz-adv-x="1024" >
+  <font-face
+    font-family="laydate-icon"
+    font-weight="500"
+    font-stretch="normal"
+    units-per-em="1024"
+    ascent="896"
+    descent="-128"
+  />
+    <missing-glyph />
+    
+    <glyph glyph-name="x" unicode="x" horiz-adv-x="1001"
+d="M281 543q-27 -1 -53 -1h-83q-18 0 -36.5 -6t-32.5 -18.5t-23 -32t-9 -45.5v-76h912v41q0 16 -0.5 30t-0.5 18q0 13 -5 29t-17 29.5t-31.5 22.5t-49.5 9h-133v-97h-438v97zM955 310v-52q0 -23 0.5 -52t0.5 -58t-10.5 -47.5t-26 -30t-33 -16t-31.5 -4.5q-14 -1 -29.5 -0.5
+t-29.5 0.5h-32l-45 128h-439l-44 -128h-29h-34q-20 0 -45 1q-25 0 -41 9.5t-25.5 23t-13.5 29.5t-4 30v167h911zM163 247q-12 0 -21 -8.5t-9 -21.5t9 -21.5t21 -8.5q13 0 22 8.5t9 21.5t-9 21.5t-22 8.5zM316 123q-8 -26 -14 -48q-5 -19 -10.5 -37t-7.5 -25t-3 -15t1 -14.5
+t9.5 -10.5t21.5 -4h37h67h81h80h64h36q23 0 34 12t2 38q-5 13 -9.5 30.5t-9.5 34.5q-5 19 -11 39h-368zM336 498v228q0 11 2.5 23t10 21.5t20.5 15.5t34 6h188q31 0 51.5 -14.5t20.5 -52.5v-227h-327z" />
+    
+
+    
+    <glyph glyph-name="youyou" unicode="&#58882;" d="M283.648 721.918976 340.873216 780.926976 740.352 383.997952 340.876288-12.925952 283.648 46.077952 619.52 383.997952Z"  horiz-adv-x="1024" />
+
+    
+    <glyph glyph-name="zuozuo" unicode="&#58883;" d="M740.352 721.918976 683.126784 780.926976 283.648 383.997952 683.123712-12.925952 740.352 46.077952 404.48 383.997952Z"  horiz-adv-x="1024" />
+
+    
+    <glyph glyph-name="xiayiye" unicode="&#58970;" d="M62.573 384.103l423.401 423.662c18.985 18.985 49.757 18.985 68.727 0 18.982-18.972 18.985-49.746 0-68.729l-355.058-355.067 356.796-356.796c18.977-18.971 18.976-49.746 0-68.727-18.982-18.976-49.751-18.976-68.727 0l-39.753 39.753 0.269 0.246-385.655 385.661zM451.365 384.103l423.407 423.662c18.985 18.985 49.757 18.985 68.727 0 18.982-18.972 18.985-49.746 0-68.729l-355.058-355.067 356.796-356.796c18.977-18.971 18.976-49.746 0-68.727-18.982-18.976-49.757-18.977-68.727 0l-39.762 39.754 0.273 0.249-385.662 385.661zM451.365 384.103z"  horiz-adv-x="1024" />
+
+    
+    <glyph glyph-name="xiayiye1" unicode="&#58971;" d="M948.066926 382.958838l-411.990051-412.24426c-18.47333-18.47333-48.417689-18.47333-66.875207 0-18.47333 18.461167-18.47333 48.405526 0 66.875207L814.691135 383.088983 467.512212 730.269123c-18.466032 18.458735-18.466032 48.405526 0 66.873991 18.468465 18.464816 48.410391 18.464816 66.872774 0l38.682336-38.682336-0.261507-0.239614 375.259894-375.265975v0.003649m-378.312834 0L157.756743-29.285422c-18.47333-18.47333-48.415256-18.47333-66.872775 0-18.47333 18.461167-18.47333 48.405526 0 66.875207L436.369787 383.088983 89.19208 730.269123c-18.4636 18.458735-18.4636 48.405526 0 66.873991 18.470898 18.464816 48.415256 18.464816 66.872774 0l38.692067-38.682336-0.266372-0.239614 375.267191-375.265975-0.004865 0.003649m0 0z"  horiz-adv-x="1024" />
+
+    
+
+
+  </font>
+</defs></svg>

BIN
pythonweb/static/js/layDate-v5.0.9/theme/default/font/iconfont.ttf


BIN
pythonweb/static/js/layDate-v5.0.9/theme/default/font/iconfont.woff


Rozdielové dáta súboru neboli zobrazené, pretože súbor je príliš veľký
+ 1 - 0
pythonweb/static/js/layDate-v5.0.9/theme/default/laydate.css


+ 8 - 0
pythonweb/static/web.config

@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<configuration>
+  <system.webServer>
+    <handlers>
+      <remove name="Python FastCGI" />
+    </handlers>
+  </system.webServer>
+</configuration>

+ 0 - 110
pythonweb/templates/home.html

@@ -1,110 +0,0 @@
-<!-- {% load static}
-<!DOCTYPE html>
-<html lang="en">
-<head>
-    <meta charset="UTF-8">
-    <meta http-equiv="X-UA-Compatible" content="IE=edge">
-    <meta name="viewport" content="width=device-width, initial-scale=1.0">
-    <title>恒达科技</title>
-    <link rel="stylesheet" href="{% static 'css/bootstrap.css'}">
-    <link rel="stylesheet" href="{% static 'css/style.css'}">
-    <script src="{% static 'js/jquery.min.js'}"></script>
-    <script src="{% static 'js/bootstrap.min.js'}"></script>
-
-</head>
-<body>
-    
-</body>
-</html> -->
-
-
-
-
-
-
-<!DOCTYPE html> {% load static %}
-<html lang="zh-cn">
-
-<head>
-    <meta charset="utf-8">
-    <meta http-equiv="X-UA-Compatible" content="IE=edge">
-    <meta name="viewport" content="width=device-width, initial-scale=1">
-    <title>恒达科技(教学示例网站)</title>
-    <link href="{% static 'css/bootstrap.css' %}" rel="stylesheet">
-    <link href="{% static 'css/style.css' %}" rel="stylesheet">
-    <script src="{% static 'js/jquery.min.js' %}"></script>
-    <script src="{% static 'js/bootstrap.min.js' %}"></script>
-</head>
-
-<body>
-    <!-- 导航条 -->
-    <nav class="navbar navbar-default" role="navigation">
-        <div class="container">
-            <div class="navbar-header">
-                <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#bs-example" aria-expanded="false">
-                    <span>导航栏</span>
-                </button>
-            </div>
-            <div class="collapse navbar-collapse" id="bs-example">
-                <ul class="nav navbar-nav" style="width:100%;">
-                    <li class="active nav-top">
-                        <a href="{% url 'home' %}">首页</a>
-                    </li>
-                    <li class="dropdown nav-top">
-                        <a href="#" class="dropdown-toggle on" data-toggle="dropdown">
-                            公司简介</a>
-                        <ul class="dropdown-menu">
-                            <li><a href="{% url 'aboutApp:survey' %}">企业概况</a></li>
-                            <li><a href="{% url 'aboutApp:honor' %}">荣誉资质</a></li>
-                        </ul>
-                    </li>
-
-                    <li class="dropdown nav-top">
-                        <a href="#" class="dropdown-toggle on" data-toggle="dropdown">
-                            新闻动态</a>
-                        <ul class="dropdown-menu">
-                            <li><a href="{% url 'newsApp:news' newName='company' %}">企业要闻</a></li>
-                            <li><a href="{% url 'newsApp:news' newName='industry' %}">行业新闻</a></li>
-                            <li><a href="{% url 'newsApp:news' newName='notice' %}">通知公告</a></li>
-                        </ul>
-                    </li>
-                    <li class="dropdown nav-top">
-                        <a href="#" class="dropdown-toggle on" data-toggle="dropdown">
-                            产品中心</a>
-                        <ul class="dropdown-menu">
-                            <li><a href="{% url 'productsApp:products' productName='robot' %}">
-                                    家用机器人</a></li>
-                            <li><a href="{% url 'productsApp:products' productName='monitor'%}">
-                                    智能监控</a></li>
-                            <li><a href="{% url 'productsApp:products' productName='face'%}">
-                                    人脸识别解决方案</a></li>
-                        </ul>
-                    </li>
-                    <li class="dropdown nav-top">
-                        <a href="#" class="dropdown-toggle on" data-toggle="dropdown">
-                            服务支持</a>
-                        <ul class="dropdown-menu">
-                            <li><a href="{% url 'serviceApp:download' %}">
-                                    资料下载</a></li>
-                            <li><a href="{% url 'serviceApp:platform' %}">
-                                    人脸识别开放平台</a></li>
-                        </ul>
-                    </li>
-                    <li class="nav-top">
-                        <a href="{% url 'scienceApp:science' %}">科研基地</a>
-                    </li>
-                    <li class="dropdown nav-top">
-                        <a href="#" class="dropdown-toggle on" data-toggle="dropdown">
-                            人才招聘</a>
-                        <ul class="dropdown-menu">
-                            <li><a href="{% url 'contactApp:contact' %}">欢迎咨询</a></li>
-                            <li><a href="{% url 'contactApp:recruit' %}">加入恒达</a></li>
-                        </ul>
-                    </li>
-                </ul>
-            </div>
-        </div>
-    </nav>
-</body>
-
-</html>

+ 63 - 0
pythonweb/templates/search/search.html

@@ -0,0 +1,63 @@
+{% extends "base.html" %}
+{% load staticfiles %}
+{% load highlight %}
+{% block title %}
+新闻搜索
+{% endblock %}
+{% block content %}
+<link href="{% static 'css/news.css' %}" rel="stylesheet">
+<!-- 广告横幅 -->
+<div class="container-fluid">
+    <div class="row">
+        <img class="img-responsive model-img" src="{% static 'img/new.jpg' %}">
+    </div>
+</div>
+<!-- 主体内容 -->
+<div class="container">
+    <div class="row row-3">
+        <div class="model-details-title">
+            关于“{{query}}”的搜索结果
+            <div class="col-md-7 hidden-xs model-details-title-search">
+                <form method="get" id="searchform" action="{% url 'haystack_search' %}">
+                    {% csrf_token %}
+                    <div class="input-group">
+                        <input type="text" name="q" class="form-control" placeholder="请输入关键词" required />
+                        <span class="input-group-btn">
+                            <input type="submit" class="btn btn-default" value="查询" />
+                        </span>
+                    </div>
+                </form>
+            </div>
+        </div>
+        <div class="model-details">
+            {% for result in page.object_list %}
+            <div class="news-model">
+                <img src="{% static 'img/newsicon.gif' %}">
+                <a href="{% url 'newsApp:newDetail' result.object.id %}">
+                    <b>{{result.object.title}}</b>
+                </a>
+                <span>【{{result.object.publishDate|date:"Y-m-d"}}】</span>
+                <!-- 添加新闻简要说明 -->
+                <p class="news-search-model">
+                    {% highlight result.object.description with query %}
+                </p>
+            </div>
+            {% empty %}
+            <p>没有找到相关新闻</p>
+            {% endfor %}
+        </div>
+        {% if page.has_previous or page.has_next %}
+        <div>
+            {% if page.has_previous %}
+            <a href="?q={{ query }}&amp;page={{ page.previous_page_number }}">
+                {% endif %}&laquo; 上一页{% if page.has_previous %}</a>{% endif %}
+            |
+            {% if page.has_next %}
+            <a href="?q={{ query }}&amp;page={{ page.next_page_number }}">
+                {% endif %}下一页
+                &raquo;{% if page.has_next %}</a>{% endif %}
+        </div>
+        {% endif %}
+    </div>
+</div>
+{% endblock %}

BIN
pythonweb/test/face.jpg


+ 20 - 0
pythonweb/test/faceDetectDemo.py

@@ -0,0 +1,20 @@
+import cv2, requests
+url = "http://localhost:8000/serviceApp/facedetect/"  # web地址(http://localhost:8000)+访问接口(facedetect)
+
+# 上传图像并检测
+tracker = None
+imgPath = "face.jpg"  #图像路径
+files = {
+    "image": ("filename2", open(imgPath, "rb"), "image/jpeg"),
+}
+
+req = requests.post(url, data=tracker, files=files).json()
+print("获取信息: {}".format(req))
+
+# 将检测结果框显示在图像上
+img = cv2.imread(imgPath)
+for (w, x, y, z) in req["faces"]:
+    cv2.rectangle(img, (w, x), (y, z), (0, 255, 0), 2)
+
+cv2.imshow("face detection", img)
+cv2.waitKey(0)

+ 36 - 0
pythonweb/test/generateQRImg.py

@@ -0,0 +1,36 @@
+import qrcode
+from PIL import Image
+def create_qrcode(url, filename):
+    qr = qrcode.QRCode(
+        version=1,
+        #设置容错率为最高
+        error_correction=qrcode.ERROR_CORRECT_H,
+        box_size = 10,
+        border = 4,
+    )
+    qr.add_data(url)
+    qr.make(fit = True)
+    img = qr.make_image()
+    #设置二维码为彩色
+    img = img.convert("RGBA")
+    icon = Image.open(filename)
+    w, h = img.size
+    factor = 4
+    size_w = int(w / factor)
+    size_h = int(h / factor)
+    icon_w, icon_h = icon.size
+    if icon_w > size_w:
+        icon_w = size_w
+    if icon_h > size_h:
+        icon_h = size_h
+    icon = icon.resize((icon_w, icon_h), Image.ANTIALIAS)
+    w = int((w - icon_w) / 2)
+    h = int((h - icon_h) / 2)
+    icon = icon.convert("RGBA")
+    newimg = Image.new("RGBA", (icon_w + 8, icon_h + 8), (255, 255, 255))
+    img.paste(newimg, (w-4, h-4), newimg)
+    img.paste(icon, (w, h), icon)
+    img.save('qr.png', quality=100)
+if __name__ == '__main__':
+    create_qrcode("http://python3web.com", 'logo.png')
+    print('完成')

BIN
pythonweb/test/logo.png


BIN
pythonweb/test/qr.png


+ 0 - 0
pythonweb/whoosh_index/MAIN_WRITELOCK


BIN
pythonweb/whoosh_index/MAIN_e8yukx7l88n7lc4n.seg


BIN
pythonweb/whoosh_index/MAIN_qk95h4o4c4flq0wv.seg


BIN
pythonweb/whoosh_index/MAIN_soyja7uhykk99rp7.seg


BIN
pythonweb/whoosh_index/MAIN_vylrll3rihl2qkqa.seg


BIN
pythonweb/whoosh_index/_MAIN_4.toc


Niektoré súbory nie sú zobrazené, pretože je v týchto rozdielových dátach zmenené mnoho súborov