结组作业,第二次冲刺(2)

news/2024/10/4 11:21:53

今天是第二次冲刺的第二天,经过昨天的总结,我们今天准备增加一个信箱功能,用户能够通过信箱给我们提出建议,或者告诉我们有什么问题,我觉得这个功能挺重要的,可以通过这个功能来得到用户的反馈,以便于之后对项目进行修改,以下为今日部分代码:

<%@ page language="java" contentType="text/html; charset=UTF-8"pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="ck" uri="http://com.work/common"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt"%>
<c:set var="ctx" value="${pageContext.request.contextPath}" />
<!DOCTYPE html>
<html lang="en">
<head><meta charset="UTF-8"><title>平台信箱</title><link rel="stylesheet" type="text/css" href="${ctx}/pc/css/common.css"><link rel="stylesheet" type="text/css" href="${ctx}/pc/css/mailbox.css"><link rel="icon" type="image/x-icon" href="${ctx}/pc/images/titleLogo.png">
</head>
<body><div class="top"><div class="div_logo"><a href="${ctx}/pc/index/goIndex.action" title="返回首页"><img src="${systemUpset.companyLogo}"></a></div></div><div class="publish"><div class="publish_zhong"><div class="publish_z"><form class="form_work"><h2 align="center">兼职平台信箱</h2><br><span align="right">主题:</span><input type="text" name="title" class="in input_biao" maxlength="15" placeholder="请输入主题"><br><span class="msg biao_msg"></span><br><span align="right">内容:</span><textarea name="work" class="input_work" maxlength="500" placeholder="请输入内容"></textarea><br><span class="msg work_msg"></span><br><span align="right">图片:</span><input type="file" name="image" class="input_image"><span class="input_ima">自由选填</span><br><span class="msg image_msg"></span><br><ul></ul><input type="button" value="立即发送" class="input_fabu"></form></div></div></div><script type="text/javascript" src="${ctx}/pc/js/jquery-1.11.1.min.js"></script><script type="text/javascript">var headerImage = '';// 判断标题是否为空$(".input_biao").focusout(function(){if ($(".input_biao").val()=="") {$(".biao_msg").text("主题不能为空!");}else{$(".biao_msg").text("");}})// 判断内容$(".input_work").focusout(function(){if ($(".input_work").val()!="") {$(".work_msg").text("");}})//判断图片$(".input_image").change(function(){//获取input file的files文件数组;var file = $(".input_image").get(0).files[0];//获取图片大小kbvar tou_max=file.size;//获取文件名的长度var tou_num=file.name.lastIndexOf(".");//获取后缀名var tou_str=file.name.substr(tou_num);//创建用来读取此文件的对象var reader = new FileReader();//使用该对象读取file文件
        reader.readAsDataURL(file);//读取文件成功后执行的方法函数reader.onload=function(e){var tou_num=$(".input_image").val().lastIndexOf(".");var tou_str=$(".input_image").val().substr(tou_num);if(tou_str != ".jpg" && tou_str != ".png" && tou_str != ".JPG" && tou_str != ".PNG"){$(".image_msg").text("请上传jpg、png格式图片!");$(".input_image").val("");}else{if(tou_max>5194304){$(".image_msg").text("请上传小于5M的图片!");$(".input_image").val("");}else if('${pcUser}' == ''){$(".input_image").val("");alert("您尚未登录,请先登录!");}else{var file =new FormData();file.append('file', $(".input_image").get(0).files[0]);$.ajax({type: "post",url: "${ctx}/imageUpload/mailboxImage.action",data: file,contentType: false, // 注意这里应设为falseprocessData: false,    //falsecache: false,    //缓存
                          success: function(res){if(res.code == 0){$(".form_work ul").html("<li><img src="+res.msg+"></li>");$(".image_msg").text("");headerImage = res.msg;}}});}}}})//发送前,判断所有选项是否为空$(".input_fabu").click(function(){if ($(".input_biao").val()=="") {$(".biao_msg").text("主题不能为空!");}else if($(".input_work").val()==""&&$(".input_image").val()=="") {$(".work_msg").text("内容和图片不能同时为空!");}else if('${pcUser}' == ''){alert("您尚未登录,请先登录!");}else{$.ajax({type: "POST",url: "${ctx}/pc/action/addMailbox.action",data: {title: $(".input_biao").val(),content: $(".input_work").val(),image: headerImage},success: function(res) {if (res.code == 0) {alert("发送成功!");window.location.href = "${ctx}/pc/index/goIndex.action";} else {$(".biao_msg").text(res.msg);}},error: function(res) {$(".biao_msg").text("网络错误");}});} })</script>
</body>
</html>

 

package com.work.controller;import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.ModelAndView;
import com.work.common.utils.BaseUtil;
import com.work.common.utils.JsonUtil;
import com.work.pojo.Mailbox;
import com.work.service.MailboxService;@Controller
@RequestMapping("/server/mailbox")
public class MailboxController extends BaseUtil{@Autowiredprivate MailboxService mailboxService;//去信箱列表@RequestMapping("/goMailboxList")public ModelAndView goMailboxList(ModelAndView mv){mv.setViewName("server/mailboxManage/mailboxList");return mv;}//获取信箱列表@RequestMapping("/getMailboxList")public void getMailboxList(HttpServletResponse response,Mailbox mailbox,Integer page,Integer limit){if(page == null){page = 1;}if(limit == null){limit = 10;}int totalCount = mailboxService.getMailboxListCount(mailbox);List<Mailbox> list = mailboxService.getMailboxList(mailbox,(page-1) * limit, limit);output(response,JsonUtil.buildJsonByTotalCount(list, totalCount));}//去查看信件@RequestMapping("/goUpdateMailbox")public ModelAndView goUpdateMailbox(ModelAndView mv,Integer id){Mailbox mailbox = mailboxService.getMailboxById(id);mv.addObject("mailbox", mailbox);mv.setViewName("server/mailboxManage/updateMailbox");return mv;}//编辑信件@RequestMapping("/updateMailbox")public void updateMailbox(HttpServletResponse response,Mailbox mailbox){mailboxService.updateMailbox(mailbox);output(response,JsonUtil.buildFalseJson(0, "编辑成功!"));}//删除信件@RequestMapping("/deleteMailbox")public void deleteMailbox(HttpServletResponse response,Integer id){mailboxService.deleteMailboxById(id);output(response,JsonUtil.buildFalseJson(0, "删除成功!"));}}

 

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.ryyt.cn/news/44281.html

如若内容造成侵权/违法违规/事实不符,请联系我们进行投诉反馈,一经查实,立即删除!

相关文章

最流行的部署模式概述

蓝/绿部署:使用两种环境,保证零宕机;一个托管实时版本,而另一个测试新的更新。如果需要,此设置允许轻松回滚。金丝雀部署:首先向一小部分用户推出更改,从而实现性能监控和收集反馈。如果成功,更新可以逐步扩展到更多用户。滚动部署:分阶段更新软件,确保大部分系统保持…

5、Oracle的多表查询

最近项目要用到Oracle,奈何之前没有使用过,所以在B站上面找了一个学习视频,用于记录学习过程以及自己的思考。 视频链接: 【尚硅谷】Oracle数据库全套教程,oracle从安装到实战应用 如果有侵权,请联系删除,谢谢。本文主要讲解以下几点:使用等值和不等值连接在SELECT 语句…

Engineering | 基于机器学习(GS)的作物抗病表型预测

近日,中国农科院植保所联合扬州大学、湖南农大等在中国工程院主刊 Engineering (一区top, IF=12.8)上发表了题为《Development of Machine Learning Methods for Accurate Prediction of Plant Disease Resistance》的研究成果。该研究通过优化多种机器学习流程,开发了基于…

ANSYS 导出节点的位移数据

以位移作为数据输出演示,同理应力,应变等也可采用此流程导出1. 数据保存确定待提取的节点编号; 获取节点位移变量; 将节点位移变量存储到数组中,用于数据传递;! 输出对应节点的位移到csv文件 ! 注意同时导入.db和.rst,并切换到/post26模块 ! --------------------------…

赵春江杨万能 | 植物微观表型综述

北京市农林科学院信息技术研究中心赵春江院士团队联合华中农业大学杨万能教授团队发布在PBJ上的综述文章:Plant microphenotype: from innovative imaging to computational analysis,深入探讨了植物微观表型(microphenotype)的研究进展,从创新成像技术到计算分析方法的应…

结组作业,第一阶段冲刺(1)

今天是结对作业第一阶段冲刺的第一天,今天对整体项目进行了分析,对主界面进行了设计,采用Jsp+css来制作前端页面,以下为今天编写的代码: index.jsp<!DOCTYPE html> <%@ page language="java" contentType="text/html; charset=UTF-8"pageEnc…

水稻遗传育种相关生物信息数据库和工具

本综述系统梳理了近20年来开发的水稻生物信息数据库和在线分析工具,并基于内置数据集和功能对它们进行了分类和总结。水稻基因组数据库水稻转录和转录后调控数据库水稻基因网络数据库水稻种质资源信息数据库水稻常用的基因编辑系统水稻基因编辑生物信息工具与数据库水稻智能育…

我国水稻种质资源创新研究与利用进展

分享一篇水稻种质资源创新研究与利用的相关综述,内容比较全面,包括了我国水稻种质资源收集、评价与精确鉴定、水稻新品系创制、水稻杂种优势利用、水稻种质创制新技术、新方法以及水稻优异基因资源的挖掘与利用等方面。截止到2023 年,我国保存的作物种质资源有超过54 万份,…