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

第11讲投票创建后端实现

投票创建页面实现

文件选择上传组件 uni-file-picker 扩展组件 安装

https://ext.dcloud.net.cn/plugin?name=uni-file-picker

日期选择器uni-datetime-picker组件 安装

https://ext.dcloud.net.cn/plugin?name=uni-datetime-picker

iconfont小图标

https://www.iconfont.cn/

iconfont.css

@font-face {font-family: 'iconfont';  /* Project id 3888696 */src: url('//at.alicdn.com/t/c/font_3888696_rjermxmgmb.woff2?t=1680049466852') format('woff2'),url('//at.alicdn.com/t/c/font_3888696_rjermxmgmb.woff?t=1680049466852') format('woff'),url('//at.alicdn.com/t/c/font_3888696_rjermxmgmb.ttf?t=1680049466852') format('truetype');
}.share {font-family: iconfont;margin-left: 20rpx;font-size: 26rpx;color: blue;
}.uploadImg{font-family: iconfont;font-size: 56rpx;color: #acacac;
}.smallUploadImg{font-family: iconfont;font-size: 36rpx;color: #acacac;
}.removeOption{font-family: iconfont;font-size: 38rpx;color: red;padding-right: 10px;
}.addOption{font-family: iconfont;font-size: 38rpx;padding-right: 10px;
}.chooseOption{font-family: iconfont;font-size: 26rpx;
}.voteListItem{font-family: iconfont;font-size: 26rpx;
}.voteManageItem{font-family: iconfont;font-size: 46rpx;color: blue;padding-bottom: 8px;
}

前端代码:

<template><view class="word_vote"><view class="cover_img"><view class="title_tip"><view class="cover">封面图(可以不上传)</view><view class="tip">( 宽高比:650 × 300 )</view></view><view class="upload_img"><uni-file-picker @select="selectCoverFileFunc($event)":auto-upload="false" limit="1":del-icon="false" disable-preview file-mediatype="image" :imageStyles="coverImageStyles"><view class="upload"><text class="uploadImg">&#xe727;</text></view></uni-file-picker></view></view><view class="basic_settings"><view class="title_tip"><view class="title">基础设置</view></view><view class="settings"><view class="title"><input type="text"  v-model="title" placeholder="填写投票标题"  placeholder-style="color:#bababa;font-size:16px"/></view><view class="explanation"><textarea v-model="explanation" placeholder="投票说明 (非必填)" placeholder-style="color:#bababa;font-size:14px"></textarea></view></view></view><view class="vote_options_settings"><view class="title_tip"><view class="title">投票选项设置</view></view><view class="option_list"><view class="option_item" v-for="(item,index) in options" :key="item.id"><text class="removeOption" @click="removeOption(item.id)">&#xe618;</text><input type="text" v-model="item.name" placeholder="输入选项名称" placeholder-style="color:#bababa;font-size:14px"></view></view><view class="option_add" @click="addOption()"><text class="addOption">&#xe660;</text><text>添加选项</text></view></view><view class="vote_rules_settings"><view class="title_tip"><view class="title">投票规则设置</view></view>	<view class="rule_list"><view class="rule_item"><text>投票截止时间</text><view ><uni-datetime-picker :border="false" :clear-icon="false" v-model="voteEndTime":start="startDate":end="endDate"></uni-datetime-picker></view></view></view></view></view><view class="vote_btn" ><button type="primary" @click="submitVote">发起投票</button></view>
</template><script>import {getBaseUrl, requestUtil} from "../../utils/requestUtil.js"import {isEmpty} from "../../utils/stringUtil.js"import {timeFormat} from "../../utils/dateUtil.js"export default{data(){const curDate=new Date();const vv=new Date(curDate.getTime()+24*60*60*1000);return{title:'',explanation:'',coverImageFileName:'',coverImageStyles: {width:"700rpx",height:"400rpx",border:false},voteEndTime:timeFormat(vv),options:[{id:1,name:''},{id:2,name:''}]}},computed:{startDate(){return new Date();},endDate(){const curDate=new Date();const vv=new Date(curDate.getTime()+24*60*60*1000*365);return vv;}},methods:{addOption:function(){var option={id:this.options[this.options.length-1].id+1,name:''}this.options.push(option);},removeOption:function(id){const index=this.options.findIndex(v=>v.id===id)this.options.splice(index,1);},selectCoverFileFunc:function(e){console.log(e.tempFilePaths[0])uni.uploadFile({header:{token:uni.getStorageSync("token")},url:getBaseUrl()+"/vote/uploadCoverImage",filePath:e.tempFilePaths[0],name:"coverImage",success: (res) => {let result=JSON.parse(res.data);if(result.code==0){this.coverImageFileName=result.coverImageFileName;}}})}}}
</script><style lang="scss">@import "/common/css/iconfont.css";.word_vote{padding: 20px;padding-bottom: 70px;.cover_img{.title_tip{margin-left: 10rpx;font-size: 26rpx;color: gray;display: flex;justify-content: space-between;}.upload_img{border-radius: 5px;margin-top: 20rpx;width:100%;height: 360rpx;background-color: white;display: flex;align-items: center;justify-content: center;.upload{margin: 10rpx;background-color: #f4f5f7;width:90%;height: 80%;display: flex;align-items: center;justify-content: center;}}}.basic_settings{margin-top: 20px;.title_tip{margin-left: 10rpx;font-size: 26rpx;color: gray;margin-bottom: 10px;.title{}}.settings{border-radius: 5px;background-color: white;.title{padding: 10px;input{font-size: 1.3rem;border-bottom: 1px solid #e4e4e4;padding-bottom: 15px;}}.explanation{padding: 10px;textarea{height: 100px;}}}}.vote_options_settings{margin-top: 20px;.title_tip{margin-left: 10rpx;font-size: 26rpx;color: gray;margin-bottom: 10px;.title{}}.option_list{.option_item{margin-top: 10px;border-radius: 5px;background-color: white;padding: 10px;display: flex;}}.option_add{margin-top: 10px;border-radius: 5px;background-color: white;padding: 10px;display: flex;color:blue;font-size:14px}}.vote_rules_settings{margin-top: 20px;.title_tip{margin-left: 10rpx;font-size: 26rpx;color: gray;margin-bottom: 10px;.title{}}.rule_list{border-radius: 5px;background-color: white;.rule_item{display: flex;justify-content: space-between;padding: 12px;border-bottom: 1px solid #e4e4e4;font-size: 28rpx;align-items: center;height: 45rpx;}}}}.vote_btn{height: 120rpx;width: 100%;background-color: white;position: fixed;bottom: 0;border-top: 1px solid #e4e4e4;button{margin: 10px;}}
</style>

后端:

coverImagesFilePath: D://uniapp/coverImgs/

封面上传:

/*** 上传封面图片* @param coverImage* @return* @throws Exception*/
@RequestMapping("/uploadCoverImage")
public Map<String,Object> uploadCoverImage(MultipartFile coverImage)throws Exception{System.out.println("filename:"+coverImage.getName());Map<String,Object> resultMap=new HashMap<>();if(!coverImage.isEmpty()){// 获取文件名String originalFilename = coverImage.getOriginalFilename();String suffixName=originalFilename.substring(originalFilename.lastIndexOf("."));String newFileName= DateUtil.getCurrentDateStr()+suffixName;FileUtils.copyInputStreamToFile(coverImage.getInputStream(),new File(coverImagesFilePath+newFileName));resultMap.put("code",0);resultMap.put("msg","上传成功");resultMap.put("coverImageFileName",newFileName);}return resultMap;
}

vote

package com.java1234.entity;import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import lombok.Data;import java.util.Date;
import java.util.List;/*** 投票实体* @author java1234_小锋 (公众号:java1234)* @site www.java1234.vip* @company 南通小锋网络科技有限公司*/
@TableName("t_vote")
@Data
public class Vote {private Integer id; // 编号private String title; // 标题private String explanation; // 投票说明private String coverImage; // 封面图片@JsonSerialize(using=CustomDateTimeSerializer.class)@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")private Date voteEndTime; // 投票结束时间private String openid; // 投票发起人openid@TableField(select=false,exist = false)private List<VoteItem> voteItemList;@TableField(select=false,exist = false)private WxUserInfo wxUserInfo;private Integer type=1; // 1 文字投票  2 图片投票}

VoteMapper

package com.java1234.mapper;import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.java1234.entity.Vote;/*** 投票Mapper接口*/
public interface VoteMapper extends BaseMapper<Vote> {
}

VoteItemMapper

package com.java1234.mapper;import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.java1234.entity.VoteItem;/*** 投票选项Mapper接口*/
public interface VoteItemMapper extends BaseMapper<VoteItem> {
}

IVoteItemService

package com.java1234.service;import com.baomidou.mybatisplus.extension.service.IService;
import com.java1234.entity.VoteItem;/*** 投票选项Service接口*/
public interface IVoteItemService extends IService<VoteItem> {
}

IVoteService

package com.java1234.service;import com.baomidou.mybatisplus.extension.service.IService;
import com.java1234.entity.Vote;/*** 投票Service接口*/
public interface IVoteService extends IService<Vote> {
}

IVoteItemServiceImpl

package com.java1234.service.impl;import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.java1234.entity.VoteItem;
import com.java1234.mapper.VoteItemMapper;
import com.java1234.service.IVoteItemService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;/*** 投票选项Service实现类* @author java1234_小锋 (公众号:java1234)* @site www.java1234.vip* @company 南通小锋网络科技有限公司*/
@Service("voteItemService")
public class IVoteItemServiceImpl extends ServiceImpl<VoteItemMapper,VoteItem> implements IVoteItemService {@Autowiredprivate VoteItemMapper voteItemMapper;}

IVoteServiceImpl

package com.java1234.service.impl;import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.java1234.entity.Vote;
import com.java1234.mapper.VoteMapper;
import com.java1234.service.IVoteService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;/*** 投票Service实现类* @author java1234_小锋 (公众号:java1234)* @site www.java1234.vip* @company 南通小锋网络科技有限公司*/
@Service("voteService")
public class IVoteServiceImpl extends ServiceImpl<VoteMapper, Vote> implements IVoteService {@Autowiredprivate VoteMapper voteMapper;
}

VoteController

package com.java1234.controller;import com.java1234.entity.R;
import com.java1234.entity.Vote;
import com.java1234.entity.VoteItem;
import com.java1234.service.IVoteItemService;
import com.java1234.service.IVoteService;
import com.java1234.util.DateUtil;
import com.java1234.util.JwtUtils;
import io.jsonwebtoken.Claims;
import org.apache.commons.io.FileUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestHeader;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;import java.io.File;
import java.util.HashMap;
import java.util.List;
import java.util.Map;/*** 投票Controller控制器* @author java1234_小锋 (公众号:java1234)* @site www.java1234.vip* @company 南通小锋网络科技有限公司*/
@RestController
@RequestMapping("/vote")
public class VoteController {@Value("${coverImagesFilePath}")private String coverImagesFilePath;@Autowiredprivate IVoteService voteService;@Autowiredprivate IVoteItemService voteItemService;/*** 上传封面图片* @param coverImage* @return* @throws Exception*/@RequestMapping("/uploadCoverImage")public Map<String,Object> uploadCoverImage(MultipartFile coverImage)throws Exception{System.out.println("filename:"+coverImage.getName());Map<String,Object> resultMap=new HashMap<>();if(!coverImage.isEmpty()){// 获取文件名String originalFilename = coverImage.getOriginalFilename();String suffixName=originalFilename.substring(originalFilename.lastIndexOf("."));String newFileName= DateUtil.getCurrentDateStr()+suffixName;FileUtils.copyInputStreamToFile(coverImage.getInputStream(),new File(coverImagesFilePath+newFileName));resultMap.put("code",0);resultMap.put("msg","上传成功");resultMap.put("coverImageFileName",newFileName);}return resultMap;}/*** 添加投票* @param vote* @param token* @return*/@RequestMapping("/add")@Transactionalpublic R add(@RequestBody Vote vote, @RequestHeader String token){Claims claims = JwtUtils.validateJWT(token).getClaims();vote.setOpenid(claims.getId());voteService.save(vote);List<VoteItem> voteItemList = vote.getVoteItemList();for(VoteItem voteItem:voteItemList){voteItem.setVoteId(vote.getId());voteItem.setNumber(0);voteItemService.save(voteItem);}return R.ok();}
}

前端验证以及提交:

submitVote:async function(e){// 验证if(isEmpty(this.title)){uni.showToast({icon:"error",title:"请填写投票标题"})return;}// 投票选项片段 至少2个选项let resultOptions=this.options.filter(function(value,index,self){  // 过滤掉名称为空的投票选项console.log("value="+value.name)return !isEmpty(value.name)})console.log("xx"+JSON.stringify(resultOptions));console.log("length="+resultOptions.length)if(resultOptions.length<2){uni.showToast({icon:"error",title:"请至少填写两个投票选项"})return;}// 提交表单let form={title:this.title,coverImage:this.coverImageFileName,explanation:this.explanation,voteEndTime:this.voteEndTime,voteItemList:resultOptions,type:1}const result=await requestUtil({url:"/vote/add",data:form,method:"post"});if(result.code==0){console.log("发布成功")uni.showToast({icon:"success",title:"投票发起成功!"})}
}

dateUtil.js

// 判断传入日期是否和当前日期比较 const judgeDate=(toDate)=>{return new Date().getTime()-new Date(toDate).getTime();
}var timeFormat = function (msTime) {let time = new Date(msTime);let yy = time.getFullYear();let MM = time.getMonth() + 1;let dd = time.getDate();let hh = time.getHours() < 10 ? "0" + time.getHours() : time.getHours();let min =time.getMinutes() < 10 ? "0" + time.getMinutes() : time.getMinutes();let sec =time.getSeconds() < 10 ? "0" + time.getSeconds() : time.getSeconds();return yy + "-" + MM + "-" + dd + " " + hh + ":" + min + ":" + sec;
}export {timeFormat,judgeDate}

数据库

/*
SQLyog Ultimate v11.33 (64 bit)
MySQL - 5.7.18-log : Database - db_vote3
*********************************************************************
*//*!40101 SET NAMES utf8 */;/*!40101 SET SQL_MODE=''*/;/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
CREATE DATABASE /*!32312 IF NOT EXISTS*/`db_vote3` /*!40100 DEFAULT CHARACTER SET utf8 */;USE `db_vote3`;/*Table structure for table `t_vote` */DROP TABLE IF EXISTS `t_vote`;CREATE TABLE `t_vote` (`id` int(11) NOT NULL AUTO_INCREMENT,`title` varchar(600) DEFAULT NULL,`explanation` varchar(3000) DEFAULT NULL,`cover_image` varchar(600) DEFAULT NULL,`vote_end_time` datetime DEFAULT NULL,`openid` varchar(600) DEFAULT NULL,`type` int(11) DEFAULT NULL,PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8;/*Data for the table `t_vote` */insert  into `t_vote`(`id`,`title`,`explanation`,`cover_image`,`vote_end_time`,`openid`,`type`) values (1,'2','2','20230516092542000000157.jpg','2023-05-17 09:25:33','o30ur5JpAsAUyGBkR0uW4IxvahR8',1);/*Table structure for table `t_vote_item` */DROP TABLE IF EXISTS `t_vote_item`;CREATE TABLE `t_vote_item` (`id` int(11) NOT NULL AUTO_INCREMENT,`vote_id` int(11) DEFAULT NULL,`name` varchar(600) DEFAULT NULL,`image` varchar(600) DEFAULT NULL,`number` int(11) DEFAULT NULL,PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8;/*Data for the table `t_vote_item` */insert  into `t_vote_item`(`id`,`vote_id`,`name`,`image`,`number`) values (1,1,'1',NULL,0),(2,1,'2',NULL,0);/*Table structure for table `t_wxuserinfo` */DROP TABLE IF EXISTS `t_wxuserinfo`;CREATE TABLE `t_wxuserinfo` (`id` int(11) NOT NULL AUTO_INCREMENT,`openid` varchar(90) DEFAULT NULL,`nick_name` varchar(150) DEFAULT NULL,`avatar_url` varchar(600) DEFAULT NULL,`register_date` datetime DEFAULT NULL,`last_login_date` datetime DEFAULT NULL,`status` char(3) DEFAULT NULL,PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=20 DEFAULT CHARSET=utf8;/*Data for the table `t_wxuserinfo` */insert  into `t_wxuserinfo`(`id`,`openid`,`nick_name`,`avatar_url`,`register_date`,`last_login_date`,`status`) values (7,'o30ur5PiPOr52bBsetXcIV93NL-U','小锋四号@java1234','20230410102248000000487.jpg','2023-04-10 10:21:30','2023-05-04 21:20:38','0'),(9,'o30ur5JpAsAUyGBkR0uW4IxvahR0','微信用户','default.png','2023-04-30 07:42:19','2023-04-30 07:42:19','1'),(10,'1',NULL,NULL,NULL,NULL,'1'),(11,'2',NULL,NULL,NULL,NULL,'1'),(12,'3',NULL,NULL,NULL,NULL,'1'),(13,'4',NULL,NULL,NULL,NULL,'1'),(14,'5',NULL,NULL,NULL,NULL,'1'),(15,'6',NULL,NULL,NULL,NULL,'1'),(16,'7',NULL,NULL,NULL,NULL,'1'),(17,'8',NULL,NULL,NULL,NULL,'1'),(19,'o30ur5JpAsAUyGBkR0uW4IxvahR8','小锋111@java1234','20230514112056000000757.jpeg','2023-05-11 08:44:11','2023-05-16 09:25:31','0');/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;

相关文章:

第11讲投票创建后端实现

投票创建页面实现 文件选择上传组件 uni-file-picker 扩展组件 安装 https://ext.dcloud.net.cn/plugin?nameuni-file-picker 日期选择器uni-datetime-picker组件 安装 https://ext.dcloud.net.cn/plugin?nameuni-datetime-picker iconfont小图标 https://www.iconfont…...

SNMP 简单网络管理协议、网络管理

目录 1 网络管理 1.1 网络管理的五大功能 1.2 网络管理的一般模型 1.3 网络管理模型中的主要构件 1.4 被管对象 (Managed Object) 1.5 代理 (agent) 1.6 网络管理协议 1.6.1 简单网络管理协议 SNMP 1.6.2 SNMP 的指导思想 1.6.3 SNMP 的管理站和委托代理 1.6.4 SNMP…...

计算机设计大赛 深度学习YOLOv5车辆颜色识别检测 - python opencv

文章目录 1 前言2 实现效果3 CNN卷积神经网络4 Yolov56 数据集处理及模型训练5 最后 1 前言 &#x1f525; 优质竞赛项目系列&#xff0c;今天要分享的是 &#x1f6a9; **基于深度学习YOLOv5车辆颜色识别检测 ** 该项目较为新颖&#xff0c;适合作为竞赛课题方向&#xff0…...

OpenCV-36 多边形逼近与凸包

目录 一、多边形的逼近 二、凸包 一、多边形的逼近 findContours后的轮廓信息countours可能过于复杂不平滑&#xff0c;可以用approxPolyDP函数对该多边形曲线做适当近似&#xff0c;这就是轮廓的多边形逼近。 apporxPolyDP就是以多边形去逼近轮廓&#xff0c;采用的是Doug…...

transformer中的QKV是如何得到的?

多头自注意力机制&#xff1a;...

console.log导致内存泄露 打包时自动去掉console.log方法

webpack通过工具&#xff1a;terser 使用前需要先安装一下 vue.config.js const { defineConfig } require(vue/cli-servise); module.exports defineConfig({transpileDependencies:true,terser:{terserOptions:{compress:{drop_console:true,drop_debugger:true,},},},}…...

《合成孔径雷达成像算法与实现》FIgure6.20

% rho_r c/(2*Fr)而不是rho_r c/(2*Bw) % Hsrcf exp函数里忘记乘pi了 clc clear close all参数设置 距离向参数设置 R_eta_c 20e3; % 景中心斜距 Tr 2.5e-6; % 发射脉冲时宽 Kr 20e12; % 距离向调频率 alpha_os_r 1.2; …...

Spring Boot 笔记 015 创建接口_更新文章分类

1.1.1 实体类id增加NotNull注释&#xff0c;并做分组校验 1.1.1.1 定义分组 1.1.1.2 实体类中指定校验项属于哪个分组 如果说某个校验项没有指定分组,默认属于Default分组 分组之间可以继承, A extends B 那么A中拥有B中所有的校验项package com.geji.pojo;import com.faste…...

【Java基础题型】判断是否是回文数

需求&#xff1a;如果给你一个正数x。 如果x是一个回文整数&#xff0c;打印true&#xff0c;否则&#xff0c;返回false 解释&#xff1a; 回文数是指正序(从左到右)和从倒序(从右到左)都是一样的整数数字。 eg.121是回文数&#xff0c;123不是&#xff0c;2112是回文数&…...

Linux paste命令教程:并行合并文件的利器(附案例详解和注意事项)

Linux paste命令介绍 paste 是一个在 Unix 或 Linux 操作系统中非常有用的命令。它用于通过在标准输出中输出由每个指定文件的行组成的行&#xff0c;以制表符为分隔符&#xff0c;来水平&#xff08;并行&#xff09;合并文件。 Linux paste命令适用的Linux版本 paste 命令…...

用163邮箱或者outlook接收国科大邮箱的邮件

使用如图下路径&#xff0c;创建一个新的密码&#xff0c;用于在163大师邮箱或者outlook登录即可 如果不行&#xff0c;则需要手动配置邮箱服务器 参考网址&#xff1a;中国科学院邮件系统帮助中心...

VitePress-15- 配置- description 的作用详解

作用描述 1、descriptioin 是站点的描述&#xff0c; 会被解析为 html 页面的 <meta name"description" content "xxx"> 标签 。2、description 本身就是 <meta> 标签的一种&#xff0c;不会在页面上展示出来&#xff0c; 仅仅是作为页面的一…...

寒假学习记录17:包管理器(包管理工具)

概念 包&#xff08;package&#xff09; 包含元数据的库&#xff0c;这些元数据包括&#xff1a;名称&#xff0c;描述&#xff0c;git主页&#xff0c;许可证协议&#xff0c;作者&#xff0c;依赖..... 库&#xff08;library&#xff0c;简称lib&#xff09; 以一个或多个模…...

【AIGC】Stable Diffusion的常见错误

Stable Diffusion 在使用过程中可能会遇到各种各样的错误。以下是一些常见的错误以及可能的解决方案&#xff1a; 模型加载错误&#xff1a;可能出现模型文件损坏或缺失的情况。解决方案包括重新下载模型文件&#xff0c;确保文件完整并放置在正确的位置。 依赖项错误&#x…...

线段树解决-----P1161 开灯 P1047 [NOIP2005 普及组] 校门外的树 python解法

# [NOIP2005 普及组] 校门外的树 ## 题目描述 某校大门外长度为 l 的马路上有一排树&#xff0c;每两棵相邻的树之间的间隔都是 1 米。我们可以把马路看成一个数轴&#xff0c;马路的一端在数轴 0 的位置&#xff0c;另一端在 l的位置&#xff1b;数轴上的每个整数点&#xf…...

学习总结16

# 【模板】最小生成树 ## 题目描述 如题&#xff0c;给出一个无向图&#xff0c;求出最小生成树&#xff0c;如果该图不连通&#xff0c;则输出 orz。 ## 输入格式 第一行包含两个整数 N,M&#xff0c;表示该图共有 N 个结点和 M 条无向边。 接下来 M 行每行包含三个整数 …...

问题:从完整的问题解决过程来看,( )是首要环节。A.理解问题 B.提出假设C.发现问题 D.检验假设 #学习方法#学习方法

问题&#xff1a;从完整的问题解决过程来看&#xff0c;&#xff08; &#xff09;是首要环节。A&#xff0e;理解问题 B&#xff0e;提出假设C&#xff0e;发现问题 D&#xff0e;检验假设 A.理解问题 B.提出假设 C&#xff0e;发现问题 参考答案如图所示...

服务器感染了.mallox勒索病毒,如何确保数据文件完整恢复?

导言&#xff1a; 在当今数字化的世界中&#xff0c;恶意软件已成为企业和个人数据安全的一大威胁&#xff0c;其中.mallox勒索病毒是最为恶劣的之一。本文91数据恢复将介绍.mallox勒索病毒的特点&#xff0c;以及如何恢复被其加密的数据文件以及预防措施。 如果您正在经历勒索…...

Android java基础_多态性

一.Android Java基础_多态性 向上转换:只能定义被子类覆写的方法&#xff0c;不能调用在子类中定义的方法。 class Father {private int money; public int getMoney() {return money; }public void setMoney(int money) {this.money money; }public void printInfo() {Syst…...

面试前的准备

目录&#xff1a; 面试前的准备Java程序员校招与社招的区别校招与社招的区别&#xff1a;Java程序员投递简的正确方式投递简历时的误区简历投递时间Java程序员如何应对面试邀约Java程序员如何对公司做背调面试前的技术准备 面试前的准备 Java程序员校招与社招的区别 校招和社招…...

Linux 文件类型,目录与路径,文件与目录管理

文件类型 后面的字符表示文件类型标志 普通文件&#xff1a;-&#xff08;纯文本文件&#xff0c;二进制文件&#xff0c;数据格式文件&#xff09; 如文本文件、图片、程序文件等。 目录文件&#xff1a;d&#xff08;directory&#xff09; 用来存放其他文件或子目录。 设备…...

Xshell远程连接Kali(默认 | 私钥)Note版

前言:xshell远程连接&#xff0c;私钥连接和常规默认连接 任务一 开启ssh服务 service ssh status //查看ssh服务状态 service ssh start //开启ssh服务 update-rc.d ssh enable //开启自启动ssh服务 任务二 修改配置文件 vi /etc/ssh/ssh_config //第一…...

云启出海,智联未来|阿里云网络「企业出海」系列客户沙龙上海站圆满落地

借阿里云中企出海大会的东风&#xff0c;以**「云启出海&#xff0c;智联未来&#xff5c;打造安全可靠的出海云网络引擎」为主题的阿里云企业出海客户沙龙云网络&安全专场于5.28日下午在上海顺利举办&#xff0c;现场吸引了来自携程、小红书、米哈游、哔哩哔哩、波克城市、…...

CMake基础:构建流程详解

目录 1.CMake构建过程的基本流程 2.CMake构建的具体步骤 2.1.创建构建目录 2.2.使用 CMake 生成构建文件 2.3.编译和构建 2.4.清理构建文件 2.5.重新配置和构建 3.跨平台构建示例 4.工具链与交叉编译 5.CMake构建后的项目结构解析 5.1.CMake构建后的目录结构 5.2.构…...

Vue2 第一节_Vue2上手_插值表达式{{}}_访问数据和修改数据_Vue开发者工具

文章目录 1.Vue2上手-如何创建一个Vue实例,进行初始化渲染2. 插值表达式{{}}3. 访问数据和修改数据4. vue响应式5. Vue开发者工具--方便调试 1.Vue2上手-如何创建一个Vue实例,进行初始化渲染 准备容器引包创建Vue实例 new Vue()指定配置项 ->渲染数据 准备一个容器,例如: …...

linux arm系统烧录

1、打开瑞芯微程序 2、按住linux arm 的 recover按键 插入电源 3、当瑞芯微检测到有设备 4、松开recover按键 5、选择升级固件 6、点击固件选择本地刷机的linux arm 镜像 7、点击升级 &#xff08;忘了有没有这步了 估计有&#xff09; 刷机程序 和 镜像 就不提供了。要刷的时…...

视频字幕质量评估的大规模细粒度基准

大家读完觉得有帮助记得关注和点赞&#xff01;&#xff01;&#xff01; 摘要 视频字幕在文本到视频生成任务中起着至关重要的作用&#xff0c;因为它们的质量直接影响所生成视频的语义连贯性和视觉保真度。尽管大型视觉-语言模型&#xff08;VLMs&#xff09;在字幕生成方面…...

selenium学习实战【Python爬虫】

selenium学习实战【Python爬虫】 文章目录 selenium学习实战【Python爬虫】一、声明二、学习目标三、安装依赖3.1 安装selenium库3.2 安装浏览器驱动3.2.1 查看Edge版本3.2.2 驱动安装 四、代码讲解4.1 配置浏览器4.2 加载更多4.3 寻找内容4.4 完整代码 五、报告文件爬取5.1 提…...

分布式增量爬虫实现方案

之前我们在讨论的是分布式爬虫如何实现增量爬取。增量爬虫的目标是只爬取新产生或发生变化的页面&#xff0c;避免重复抓取&#xff0c;以节省资源和时间。 在分布式环境下&#xff0c;增量爬虫的实现需要考虑多个爬虫节点之间的协调和去重。 另一种思路&#xff1a;将增量判…...

初学 pytest 记录

安装 pip install pytest用例可以是函数也可以是类中的方法 def test_func():print()class TestAdd: # def __init__(self): 在 pytest 中不可以使用__init__方法 # self.cc 12345 pytest.mark.api def test_str(self):res add(1, 2)assert res 12def test_int(self):r…...