当前位置: 首页 > news >正文

Django+Vue农产品销售系统的设计与实现

目录

  • 1 项目介绍
  • 2 项目截图
  • 3 核心代码
    • 3.1 需要的环境
    • 3.2 Django接口层
    • 3.3 实体类
    • 3.4 config.ini
    • 3.5 启动类
    • 3.5 Vue
  • 4 数据库表设计
  • 5 文档参考
  • 6 计算机毕设选题推荐
  • 7 源码获取


在这里插入图片描述

1 项目介绍

博主个人介绍:CSDN认证博客专家,CSDN平台Java领域优质创作者,全网30w+粉丝,超300w访问量,专注于大学生项目实战开发、讲解和答疑辅导,对于专业性数据证明一切!
主要项目:javaweb、ssm、springboot、vue、小程序、python、安卓、uniapp等设计与开发,万套源码成品可供选择学习。

👇🏻👇🏻文末获取源码

Django+Vue农产品销售系统的设计与实现(源码+数据库+文档)

项目描述
农产品销售系统是一个涉及信息共享、流通环节优化和市场拓展等多个方面的综合性系统,目前在国内外都得到了广泛的关注和应用。
在我国,随着互联网技术的普及和农业现代化的推进,农产品销售系统得到了快速发展。一方面,电商平台如淘宝、京东等逐渐涉足农产品领域,通过线上线下相结合的方式,实现了农产品的直播销售、农村电商等模式的创新。另一方面,政府也积极推动农产品销售系统的建设,例如农村电商扶贫政策的出台,为农民提供了更多的销售渠道和机会。农产品溯源体系的建设也成为农产品销售系统发展的重要组成部分。通过采用物联网、大数据等技术手段,可以实现对农产品生产、加工、运输等全过程的监控和管理,确保农产品的质量和安全。一些农产品溯源平台如“中国农产品溯源网”等也逐渐涌现,为消费者提供了更多的信息透明度和选择权。
在国外,农产品销售系统的发展相对较早,并取得了一定的成果。例如,美国的农产品销售系统主要以农产品交易市场和农产品电子商务为主导。农产品交易市场如芝加哥期货交易所等,通过集中交易的方式,提供了一个便捷的销售平台,促进了农产品的流通和价格的形成。而农产品电子商务则通过互联网技术,实现了农产品的线上销售和配送,方便了消费者的购买。欧洲的农产品销售系统注重农产品质量和地理标志的保护。例如,法国的AOC(Appellation d’Origine Contrôlée)制度和意大利的DOP(Denominazione di Origine Protetta)制度,通过对农产品产地、生产工艺等进行严格管理和认证,确保了农产品的品质和原产地的信誉,提高了农产品的附加值和市场竞争力。
国内外农产品销售系统的发展现状呈现出多样化的特点。国内主要以电商平台和农产品溯源体系为主导,通过互联网技术的应用,实现了线上线下相结合的销售模式和信息透明度的提升;而国外则注重农产品交易市场和农产品质量保护,通过集中交易和地理标志认证等方式,促进了农产品的流通和品质的保障。未来,随着科技的不断进步和消费者需求的变化,农产品销售系统将继续迎来更多的创新和发展机遇。

在这里插入图片描述

2 项目截图

django基于Python的农产品销售系统的设计与实现演示

3 核心代码

3.1 需要的环境

django==2.0
django-threadlocals
pymysql
click
requests
xlrd==1.2.0
django-cors-headers

3.2 Django接口层


# coding:utf-8
__author__ = "ila"from django.http import JsonResponsefrom .users_model import users
from util.codes import *
from util.auth import Auth
import util.message as mes
from dj2.settings import host,port,user,passwd,dbName,hasHadoopdef users_login(request):if request.method in ["POST", "GET"]:msg = {'code': normal_code, "msg": mes.normal_code}req_dict = request.session.get("req_dict")if req_dict.get('role')!=None:del req_dict['role']datas = users.getbyparams(users, users, req_dict)if not datas:msg['code'] = password_error_codemsg['msg'] = mes.password_error_codereturn JsonResponse(msg)req_dict['id'] = datas[0].get('id')return Auth.authenticate(Auth, users, req_dict)def users_register(request):if request.method in ["POST", "GET"]:msg = {'code': normal_code, "msg": mes.normal_code}req_dict = request.session.get("req_dict")error = users.createbyreq(users, users, req_dict)if error != None:msg['code'] = crud_error_codemsg['msg'] = errorreturn JsonResponse(msg)def users_session(request):''''''if request.method in ["POST", "GET"]:msg = {"code": normal_code,"msg":mes.normal_code, "data": {}}req_dict = {"id": request.session.get('params').get("id")}msg['data'] = users.getbyparams(users, users, req_dict)[0]return JsonResponse(msg)def users_logout(request):if request.method in ["POST", "GET"]:msg = {"msg": "退出成功","code": 0}return JsonResponse(msg)def users_page(request):''''''if request.method in ["POST", "GET"]:msg = {"code": normal_code, "msg": mes.normal_code,"data": {"currPage": 1, "totalPage": 1, "total": 1, "pageSize": 10, "list": []}}req_dict = request.session.get("req_dict")tablename = request.session.get("tablename")try:__hasMessage__ = users.__hasMessage__except:__hasMessage__ = Noneif __hasMessage__ and __hasMessage__ != "否":if tablename != "users":req_dict["userid"] = request.session.get("params").get("id")if tablename == "users":msg['data']['list'], msg['data']['currPage'], msg['data']['totalPage'], msg['data']['total'], \msg['data']['pageSize'] = users.page(users, users, req_dict)else:msg['data']['list'], msg['data']['currPage'], msg['data']['totalPage'], msg['data']['total'], \msg['data']['pageSize'] = [],1,0,0,10return JsonResponse(msg)def users_info(request, id_):''''''if request.method in ["POST", "GET"]:msg = {"code": normal_code, "msg": mes.normal_code, "data": {}}data = users.getbyid(users, users, int(id_))if len(data) > 0:msg['data'] = data[0]# 浏览点击次数try:__browseClick__ = users.__browseClick__except:__browseClick__ = Noneif __browseClick__ and "clicknum" in users.getallcolumn(users, users):click_dict = {"id": int(id_), "clicknum": str(int(data[0].get("clicknum", 0)) + 1)}ret = users.updatebyparams(users, users, click_dict)if ret != None:msg['code'] = crud_error_codemsg['msg'] = retreturn JsonResponse(msg)def users_save(request):''''''if request.method in ["POST", "GET"]:msg = {"code": normal_code, "msg": mes.normal_code, "data": {}}req_dict = request.session.get("req_dict")req_dict['role'] = '管理员'error = users.createbyreq(users, users, req_dict)if error != None:msg['code'] = crud_error_codemsg['msg'] = errorreturn JsonResponse(msg)def users_update(request):''''''if request.method in ["POST", "GET"]:msg = {"code": normal_code, "msg": mes.normal_code, "data": {}}req_dict = request.session.get("req_dict")if req_dict.get("mima") and req_dict.get("password"):if "mima" not in users.getallcolumn(users,users):del req_dict["mima"]if "password" not in users.getallcolumn(users,users):del req_dict["password"]try:del req_dict["clicknum"]except:passerror = users.updatebyparams(users, users, req_dict)if error != None:msg['code'] = crud_error_codemsg['msg'] = errorreturn JsonResponse(msg)def users_delete(request):''''''if request.method in ["POST", "GET"]:msg = {"code": normal_code, "msg": mes.normal_code, "data": {}}req_dict = request.session.get("req_dict")error = users.deletes(users,users,req_dict.get("ids"))if error != None:msg['code'] = crud_error_codemsg['msg'] = errorreturn JsonResponse(msg)

3.3 实体类

# coding:utf-8
__author__ = "ila"from django.db import modelsfrom .model import BaseModelclass users(BaseModel):# id=models.BigIntegerField(verbose_name="自增id")username = models.CharField(max_length=100, verbose_name=u'账号')password = models.CharField(max_length=100, verbose_name=u'密码')role = models.CharField(max_length=100, verbose_name=u'角色')addtime = models.DateTimeField(auto_now_add=False, verbose_name=u'创建时间')image = models.CharField(max_length=100, verbose_name=u'头像')__tablename__ = 'users'class Meta:db_table = 'users'verbose_name = verbose_name_plural = u'管理员表'# def __str__(self):#     return self.username

3.4 config.ini

[sql]
;support two sql,mysql and mssql,choice one
type = mysql
host = 127.0.0.1
port = 3306
user = root
passwd = 123456
db = djangoc2e8kave
charset = utf8
hasHadoop=否
[redis]
host = 127.0.0.1
port = 6379
passwd = 123456

3.5 启动类

#!/usr/bin/env python
import os
import sysif __name__ == "__main__":os.environ.setdefault("DJANGO_SETTINGS_MODULE", "dj2.settings")try:from django.core.management import execute_from_command_lineexcept ImportError as exc:raise ImportError("Couldn't import Django. Are you sure it's installed and ""available on your PYTHONPATH environment variable? Did you ""forget to activate a virtual environment?") from excexecute_from_command_line(sys.argv)

3.5 Vue

<template><div><div class="container loginIn" style="backgroundImage: url(http://codegen.caihongy.cn/20201206/eaa69c2b4fa742f2b5acefd921a772fc.jpg)"><div :class="2 == 1 ? 'left' : 2 == 2 ? 'left center' : 'left right'" style="backgroundColor: rgba(255, 255, 255, 0.71)"><el-form class="login-form" label-position="left" :label-width="1 == 3 ? '56px' : '0px'"><div class="title-container"><h3 class="title" style="color: rgba(84, 88, 179, 1)">在线文档管理系统登录</h3></div><el-form-item :label="1 == 3 ? '用户名' : ''" :class="'style'+1"><span v-if="1 != 3" class="svg-container" style="color:rgba(89, 97, 102, 1);line-height:44px"><svg-icon icon-class="user" /></span><el-input placeholder="请输入用户名" name="username" type="text" v-model="rulesForm.username" /></el-form-item><el-form-item :label="1 == 3 ? '密码' : ''" :class="'style'+1"><span v-if="1 != 3" class="svg-container" style="color:rgba(89, 97, 102, 1);line-height:44px"><svg-icon icon-class="password" /></span><el-input placeholder="请输入密码" name="password" type="password" v-model="rulesForm.password" /></el-form-item><el-form-item v-if="0 == '1'" class="code" :label="1 == 3 ? '验证码' : ''" :class="'style'+1"><span v-if="1 != 3" class="svg-container" style="color:rgba(89, 97, 102, 1);line-height:44px"><svg-icon icon-class="code" /></span><el-input placeholder="请输入验证码" name="code" type="text" v-model="rulesForm.code" /><div class="getCodeBt" @click="getRandCode(4)" style="height:44px;line-height:44px"><span v-for="(item, index) in codes" :key="index" :style="{color:item.color,transform:item.rotate,fontSize:item.size}">{{ item.num }}</span></div></el-form-item><el-form-item label="角色" prop="loginInRole" class="role"><el-radiov-for="item in menus"v-if="item.hasBackLogin=='是'"v-bind:key="item.roleName"v-model="rulesForm.role":label="item.roleName">{{item.roleName}}</el-radio></el-form-item><el-button type="primary" @click="login()" class="loginInBt" style="padding:0;font-size:16px;border-radius:4px;height:44px;line-height:44px;width:100%;backgroundColor:rgba(84, 88, 179, 1); borderColor:rgba(84, 88, 179, 1); color:rgba(255, 255, 255, 1)">{{'1' == '1' ? '登录' : 'login'}}</el-button><el-form-item class="setting"><!-- <div style="color:rgba(255, 255, 255, 1)" class="reset">修改密码</div> --></el-form-item></el-form></div></div></div>
</template>
<script>
import menu from "@/utils/menu";
export default {data() {return {rulesForm: {username: "",password: "",role: "",code: '',},menus: [],tableName: "",codes: [{num: 1,color: '#000',rotate: '10deg',size: '16px'},{num: 2,color: '#000',rotate: '10deg',size: '16px'},{num: 3,color: '#000',rotate: '10deg',size: '16px'},{num: 4,color: '#000',rotate: '10deg',size: '16px'}],};},mounted() {let menus = menu.list();this.menus = menus;},created() {this.setInputColor()this.getRandCode()},methods: {setInputColor(){this.$nextTick(()=>{document.querySelectorAll('.loginIn .el-input__inner').forEach(el=>{el.style.backgroundColor = "rgba(255, 255, 255, 1)"el.style.color = "rgba(0, 0, 0, 1)"el.style.height = "44px"el.style.lineHeight = "44px"el.style.borderRadius = "2px"})document.querySelectorAll('.loginIn .style3 .el-form-item__label').forEach(el=>{el.style.height = "44px"el.style.lineHeight = "44px"})document.querySelectorAll('.loginIn .el-form-item__label').forEach(el=>{el.style.color = "rgba(89, 97, 102, 1)"})setTimeout(()=>{document.querySelectorAll('.loginIn .role .el-radio__label').forEach(el=>{el.style.color = "rgba(84, 88, 179, 1)"})},350)})},register(tableName){this.$storage.set("loginTable", tableName);this.$router.push({path:'/register'})},// 登陆login() {let code = ''for(let i in this.codes) {code += this.codes[i].num}if ('0' == '1' && !this.rulesForm.code) {this.$message.error("请输入验证码");return;}if ('0' == '1' && this.rulesForm.code.toLowerCase() != code.toLowerCase()) {this.$message.error("验证码输入有误");this.getRandCode()return;}if (!this.rulesForm.username) {this.$message.error("请输入用户名");return;}if (!this.rulesForm.password) {this.$message.error("请输入密码");return;}if (!this.rulesForm.role) {this.$message.error("请选择角色");return;}let menus = this.menus;for (let i = 0; i < menus.length; i++) {if (menus[i].roleName == this.rulesForm.role) {this.tableName = menus[i].tableName;}}this.$http({url: `${this.tableName}/login?username=${this.rulesForm.username}&password=${this.rulesForm.password}`,method: "post"}).then(({ data }) => {if (data && data.code === 0) {this.$storage.set("Token", data.token);this.$storage.set("role", this.rulesForm.role);this.$storage.set("sessionTable", this.tableName);this.$storage.set("adminName", this.rulesForm.username);this.$router.replace({ path: "/index/" });} else {this.$message.error(data.msg);}});},getRandCode(len = 4){this.randomString(len)},randomString(len = 4) {let chars = ["a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k","l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v","w", "x", "y", "z", "A", "B", "C", "D", "E", "F", "G","H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R","S", "T", "U", "V", "W", "X", "Y", "Z", "0", "1", "2","3", "4", "5", "6", "7", "8", "9"]let colors = ["0", "1", "2","3", "4", "5", "6", "7", "8", "9", "a", "b", "c", "d", "e", "f"]let sizes = ['14', '15', '16', '17', '18']let output = [];for (let i = 0; i < len; i++) {// 随机验证码let key = Math.floor(Math.random()*chars.length)this.codes[i].num = chars[key]// 随机验证码颜色let code = '#'for (let j = 0; j < 6; j++) {let key = Math.floor(Math.random()*colors.length)code += colors[key]}this.codes[i].color = code// 随机验证码方向let rotate = Math.floor(Math.random()*60)let plus = Math.floor(Math.random()*2)if(plus == 1) rotate = '-'+rotatethis.codes[i].rotate = 'rotate('+rotate+'deg)'// 随机验证码字体大小let size = Math.floor(Math.random()*sizes.length)this.codes[i].size = sizes[size]+'px'}},}
};
</script>
<style lang="scss" scoped>
.loginIn {min-height: 100vh;position: relative;background-repeat: no-repeat;background-position: center center;background-size: cover;.left {position: absolute;left: 0;top: 0;width: 360px;height: 100%;.login-form {background-color: transparent;width: 100%;right: inherit;padding: 0 12px;box-sizing: border-box;display: flex;justify-content: center;flex-direction: column;}.title-container {text-align: center;font-size: 24px;.title {margin: 20px 0;}}.el-form-item {position: relative;.svg-container {padding: 6px 5px 6px 15px;color: #889aa4;vertical-align: middle;display: inline-block;position: absolute;left: 0;top: 0;z-index: 1;padding: 0;line-height: 40px;width: 30px;text-align: center;}.el-input {display: inline-block;height: 40px;width: 100%;& /deep/ input {background: transparent;border: 0px;-webkit-appearance: none;padding: 0 15px 0 30px;color: #fff;height: 40px;}}}}.center {position: absolute;left: 50%;top: 50%;width: 360px;transform: translate3d(-50%,-50%,0);height: 446px;border-radius: 8px;}.right {position: absolute;left: inherit;right: 0;top: 0;width: 360px;height: 100%;}.code {.el-form-item__content {position: relative;.getCodeBt {position: absolute;right: 0;top: 0;line-height: 40px;width: 100px;background-color: rgba(51,51,51,0.4);color: #fff;text-align: center;border-radius: 0 4px 4px 0;height: 40px;overflow: hidden;span {padding: 0 5px;display: inline-block;font-size: 16px;font-weight: 600;}}.el-input {& /deep/ input {padding: 0 130px 0 30px;}}}}.setting {& /deep/ .el-form-item__content {padding: 0 15px;box-sizing: border-box;line-height: 32px;height: 32px;font-size: 14px;color: #999;margin: 0 !important;.register {float: left;width: 50%;}.reset {float: right;width: 50%;text-align: right;}}}.style2 {padding-left: 30px;.svg-container {left: -30px !important;}.el-input {& /deep/ input {padding: 0 15px !important;}}}.code.style2, .code.style3 {.el-input {& /deep/ input {padding: 0 115px 0 15px;}}}.style3 {& /deep/ .el-form-item__label {padding-right: 6px;}.el-input {& /deep/ input {padding: 0 15px !important;}}}.role {& /deep/ .el-form-item__label {width: 56px !important;}& /deep/ .el-radio {margin-right: 12px;}}}
</style>

4 数据库表设计

用户注册实体图如图所示:
在这里插入图片描述

数据库表的设计,如下表:
在这里插入图片描述

5 文档参考

在这里插入图片描述

6 计算机毕设选题推荐

最新计算机软件毕业设计选题大全:整理中…

7 源码获取

👇🏻获取联系方式在文章末尾 如果想入行提升技术的可以看我专栏其他内容:

在这里插入图片描述

相关文章:

  • 北京网站建设多少钱?
  • 辽宁网页制作哪家好_网站建设
  • 高端品牌网站建设_汉中网站制作
  • 《探讨——关于三层架构前在前端项目的应用》第一版
  • 百望云携手春秋航空 迈入航空出行数电票新时代
  • Visual Studio Community 2022 + Win10 编译 OpenCPN 5.9.0 记录
  • 【算法每日一练及解题思路】找出模式匹配字符串的异位词在原始字符串中出现的索引下标
  • 大数据-105 Spark GraphX 基本概述 与 架构基础 概念详解 核心数据结构
  • Java算法之TimSort
  • 【面试经验】京东技术产品笔试 G
  • 生成艺术,作品鉴赏:物似主人形
  • Openldap可视化工具PhpLdapAdmin服务配置
  • 【攻防世界新手入门】simple_js
  • JVM2-JVM组成、字节码文件、类的生命周期、类加载器
  • NetSuite AI 图生代码
  • 多目标应用:基于MOPSO的移动机器人路径规划研究(提供MATLAB代码)
  • RTX5源码全家桶集成emWin6.40, Modbus主从,含FreeRTOS版, 探讨一种移植第3方组件通用方法以及使用注意事项2024-08-30
  • 【电子数据取证】Linux软件包管理器yum和编辑器vim
  • [译]CSS 居中(Center)方法大合集
  • 【编码】-360实习笔试编程题(二)-2016.03.29
  • 0x05 Python数据分析,Anaconda八斩刀
  • Android开源项目规范总结
  • Asm.js的简单介绍
  • Codepen 每日精选(2018-3-25)
  • CSS中外联样式表代表的含义
  • Docker容器管理
  • Python 使用 Tornado 框架实现 WebHook 自动部署 Git 项目
  • Vue.js源码(2):初探List Rendering
  • 表单中readonly的input等标签,禁止光标进入(focus)的几种方式
  • 第十八天-企业应用架构模式-基本模式
  • 分类模型——Logistics Regression
  • 前端技术周刊 2018-12-10:前端自动化测试
  • 如何使用 OAuth 2.0 将 LinkedIn 集成入 iOS 应用
  • 使用docker-compose进行多节点部署
  • 算法之不定期更新(一)(2018-04-12)
  • 通过npm或yarn自动生成vue组件
  • 终端用户监控:真实用户监控还是模拟监控?
  • AI算硅基生命吗,为什么?
  • raise 与 raise ... from 的区别
  • 数据可视化之下发图实践
  • ​LeetCode解法汇总518. 零钱兑换 II
  • # MySQL server 层和存储引擎层是怎么交互数据的?
  • #QT(智能家居界面-界面切换)
  • (4)STL算法之比较
  • (Redis使用系列) Springboot 整合Redisson 实现分布式锁 七
  • (ros//EnvironmentVariables)ros环境变量
  • (二)JAVA使用POI操作excel
  • (附源码)spring boot基于小程序酒店疫情系统 毕业设计 091931
  • (数据大屏)(Hadoop)基于SSM框架的学院校友管理系统的设计与实现+文档
  • (一) 初入MySQL 【认识和部署】
  • (转)eclipse内存溢出设置 -Xms212m -Xmx804m -XX:PermSize=250M -XX:MaxPermSize=356m
  • (转)Sql Server 保留几位小数的两种做法
  • (转)winform之ListView
  • .[hudsonL@cock.li].mkp勒索加密数据库完美恢复---惜分飞
  • .bat批处理(九):替换带有等号=的字符串的子串
  • .Net Core缓存组件(MemoryCache)源码解析
  • .Net Core中的内存缓存实现——Redis及MemoryCache(2个可选)方案的实现
  • .netcore 6.0/7.0项目迁移至.netcore 8.0 注意事项