企业网站设计及相关知识

本文介绍了一个使用Django实现的商品分类和价格筛选功能,通过URL参数传递分类ID和价格ID进行商品过滤,并展示了如何实现瀑布流效果来加载图片。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

1.轮播图——轮播图参数设置

2.组合搜索没整明白(解决)

models.py

class Classification(models.Model):
    name = models.CharField(verbose_name='名称', max_length=32)
    class Meta:
        db_table = 'Classification'
    def __str__(self):
        return self.name


class Price(models.Model):
    name = models.CharField(verbose_name='价格', max_length=32)
    class Meta:
        db_table = 'Price'
    def __str__(self):
        return self.name


class Goods(models.Model):
    name = models.CharField(verbose_name='标题', max_length=32)
    classification = models.ForeignKey(to='Classification',on_delete=models.CASCADE)
    price = models.ForeignKey(to='Price',on_delete=models.CASCADE)
    class Meta:
        db_table = 'Goods'
    def __str__(self):
        return self.name
urls.py

re_path('select-(?P<classification_id>\d+)-(?P<price_id>\d+).html', index.select_goods),
    path('goods.html', index.index_goods),
views.index.py

def index_goods(request):
    print(1)
    classification_list=models.Classification.objects.all()
    price_list=models.Price.objects.all()
    goods_list = models.Goods.objects.all()
    #通过变量为对方设定初值0,为下一步通过变量改变值做准备
    classification_id=0
    price_id=0
    return render(request,'goods.html',locals())

def select_goods(request,*args,**kwargs):
    print(kwargs)
    contains={}
    #注意数据类型
    classification_id=int(kwargs['classification_id'])
    price_id=int(kwargs['price_id'])
    #下面用法值得留意,遍历一个字典,k为键,v为值
    # for k,v in kwargs.items():
    #     if int(v)==0:
    #         pass
    #     else:
    #         contains[k]=v
    if classification_id==0:
        pass
    else:
        contains['classification_id']=classification_id
    if price_id==0:
        pass
    else:
        contains['price_id']=price_id

    goods_list=models.Goods.objects.filter(**contains)
    classification_list = models.Classification.objects.all()
    price_list = models.Price.objects.all()
    return render(request,'goods.html',
                  {'goods_list':goods_list,
                   'classification_list':classification_list,
                   'price_list':price_list,
                   'classification_id':classification_id,
                   'price_id':price_id})
goods.html

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
<div>
    {% if  classification_id == 0 %}
        <a href="/select-0-{{ price_id }}.html" style="background-color: #009999;color: white">全部</a>
        {% else %}
            <a href="/select-0-{{ price_id }}.html" >全部</a>
    {% endif %}

    {% for classification in classification_list %}
        {% if  classification_id == classification.id %}
            <a href="/select-{{ classification.id }}-{{ price_id }}.html" style="background-color: #009999;color: white">{{ classification.name }}</a>
        {% else %}
            <a href="/select-{{ classification.id }}-{{ price_id }}.html" >{{ classification.name }}</a>
        {% endif %}

    {% endfor %}

</div>
<div>
    {% if price_id == 0 %}
        <a href="/select-{{ classification_id }}-0.html" style="background-color: #009999;color: white">全部</a>
        {% else %}
            <a href="/select-{{ classification_id }}-0.html" >全部</a>
    {% endif %}

    {% for price in price_list %}
        {% if price_id == price.id %}
             <a href="/select-{{ classification_id }}-{{ price.id }}.html" style="background-color: #009999;color: white">{{ price.name }}</a>
             {% else %}
                <a href="/select-{{ classification_id }}-{{ price.id }}.html">{{ price.name }}</a>
        {% endif %}

    {% endfor %}

</div>
<br>
<br>
<br>
<br>
<br>
<br>
<div>
    {% for goods in goods_list %}
        <p>{{ goods.name }}</p>
    {% endfor %}

</div>
</body>
</html>




3.瀑布流

在admin 上传图片后,理论上与static文件夹下的图片没有关系,但是修改手动修改static下的图片,不会生效,需要重新修改admin内的上传文件。这是什么玩意???

.py

from django.shortcuts import render
from app01 import models
from django.http import JsonResponse
# Create your views here.

def pubuliu(request):
    if request.method=='GET':

        return render(request,'pubuliu.html')
    if request.method=='POST':
        result={'status':True,'data':None}
        img_list = models.Image.objects.all().values('title', 'href')

        img_list = list(img_list)
        result['data']=img_list
        return JsonResponse(result)
.html

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <script src="/static/jquery-3.3.1.js"></script>
</head>
<style>
    #div02 {
        width: 1000px;
        margin: 0 auto; /*很神奇,上下边距为0,左右自适应(在设定宽度的情况下左右居中)*/
    }

    #item {
        width: 25%;
        float: left;
    }
    #item img{
            width: 100%;
        }
</style>
<body>
<div><h1>图片墙</h1></div>
<div id="div02">
    <div id="item"></div>
    <div id="item"></div>
    <div id="item"></div>
    <div id="item"></div>
</div>
</body>
</html>
<script>
    $(function () {
        uploadImage();
    });

    function uploadImage() {

                $.ajax({
                    url:'/pubuliu/',
                    type:'POST',
                    dataType: 'JSON',
                    success: function (arg) {

                        if (arg.status) {
                            var img_list = arg.data;
                            console.log(img_list);
                            $.each(img_list, function (k, v) {
                                var tag = document.createElement('img');
                                tag.src = '/' + v.href;
                                var label = document.createElement('label');
                                label.innerText = v.title;
                                var index = k % 4;
                                $('#div02').children().eq(index).append(tag,label);
                            })
                        }
                    }
                })

    }
</script>


企业网站项目设计方案计划书 一、企业建设网站前的市场分析 1、相关行业的市场是怎样的,市场有什么样的特点,是否能够在互联网上开展企业业务。 2、市场主要竞争者分析,竞争对手上网情况及其网站规划、功能作用。 3、企业自身条件分析、企业概况、市场优势,可以利用网站提升哪些竞争力,建设网站的能力(费用、技术、人力等)。 二、企业建设网站目的及功能定位 1、为什么要建立网站,是为了宣传产品,进行电子商务,还是建立行业性网站?是企业的需要还是市场开拓的延伸? 2、整合公司资源,确定网站功能。根据公司的需要和计划,确定网站的功能:产品宣传型、网上营销型、客户服务型、电子商务型等。 3、根据网站功能,确定网站设计应达到的目的作用。 4、企业内部网(Intranet)的建设情况和网站的可扩展性。 三、企业网站技术解决方案 根据网站的功能确定网站技术解决方案。 1、采用自建服务器,还是租用虚拟主机。 2、选择操作系统,用unix,Linux还是Window2000/NT。分析投入成本、功能、开发、稳定性和安全性等。 3、采用系统性的解决方案(如IBM,HP)等公司提供的企业上网方案、电子商务解决方案?还是自己开发。 4、网站安全性措施,防黑、防病毒方案。 5、相关程序开发。如网页程序ASP、JSP、CGI、数据库程序等。 四、企业网站内容规划 1、根据网站的目的和功能规划网站内容,一般企业网站应包括:公司简介、产品介绍、服务内容、价格信息、联系方式、网上定单等基本内容。 2、电子商务类网站要提供会员注册、详细的商品服务信息、信息搜索查询、定单确认、付款、个人信息保密措施、相关帮助等。 3、如果网站栏目比较多,则考虑采用网站编程专人负责相关内容。 注意:网站内容是网站吸引浏览者最重要的因素,无内容或不实用的信息不会吸引匆匆浏览的访客。可事先对人们希望阅读的信息进行调查,并在网站发布后调查人们对网站内容的满意度,以及时调整网站内容。 五、企业网站设计 1、网站设计美术设计要求,网页美术设计一般要企业整体形象一致,要符合CI规范。要注意网页色彩、图片的应用及版面规划,保持网站的整体一致性。 2、在新技术的采用上要考虑主要目标访问群体的分布地域、年龄阶层、网络速度、阅读习惯等。 3、制定网页改版计划,如半年到一年时间进行较大规模改版等。 六、企业网站维护 1、服务器及相关软硬件的维护,对可能出现的问题进行评估,制定响应时间。 2、数据库维护,有效地利用数据是网站维护的重要内容,因此数据库的维护要受到重视。 3、内容的更新、调整等。 4、制定相关网站维护的规定,将网站维护制度化、规范化。 七、企业网站测试 网站发布前要进行细致周密的测试,以保证正常浏览和使用。主要测试内容: 1、服务器稳定性、安全性。 2、程序及数据库测试。 3、网页兼容性测试,如浏览器、显示器。 4、根据需要的其他测试。 八、企业网站发布推广 1、网站测试后进行发布的公关,广告活动。 2、搜索引掣登记等。 九、企业网站建设日程表 各项规划任务的开始完成时间,负责人等。 十、企业网站设计费用明细 各项事宜所需费用清单。 以上为网站规划书中应该体现的主要内容,根据不同的需求和建站目的,内容也会在增加或减少。在建设网站之初一定要进行细致的规划,才能达到预期建站目的。
行空浏览器是一款基于IE内核的安全浏览器,体积小巧,占用系统资源少,提高网页浏览速度,没有任何广告插件,同时具有屏蔽广告的功能,绿色小巧的浏览器,完全免费,没有任何功能限制,最方便最简单的浏览器! 功能介绍: 资源占用少,上网速度更快 行空浏览器,体积小,占用系统资源小,上网速度快,给用户一个清新的上网体验。 绿色安全 行空浏览器绝对无插件,绿色,安全的浏览器。通过国内著名的安全公司的安全检查,绝对安全,可靠。是一款真正的绿色浏览器的。 多标签浏览 采用目前主流的多标签浏览方式,排列整齐的标签栏比传统的一层层网页窗口更方便, 行空浏览器提供给用户更人性化的设计。 广告屏蔽 可有效地阻止弹窗(自动弹窗、弹窗列表和欺骗弹窗)屏蔽,网页广告内容过滤保障快捷绿色无忧上网 超级拖拽 在浏览网页中,不管是选中的文字/图片还是链接,往左拖下往右拖下都便捷的快速打开或者进行搜索。 鼠标手势 按下鼠标右键不放,往不同方向移动鼠标可以实现不同的功能。 此次更新主要有以下几点 1:增加了全能搜索引擎,上网更方便,美观大方又实用! 2:解决了错误页面的图片显示问题 3: 解决了搜索框 乱的问题 4:解决了 ActiveX 控件的安装问题 5:增强鼠标手势功能
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值