开发语言:Java
框架:ssm
JDK版本:JDK1.8
服务器:tomcat7
数据库:mysql 5.7(一定要5.7版本)
数据库工具:Navicat11
开发软件:eclipse/myeclipse/idea
Maven包:Maven3.3.9
浏览器:谷歌浏览器
数据库脚本:
DROP TABLE IF EXISTS `bisaibaoming`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `bisaibaoming` (
`id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '主键',
`addtime` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
`baomingbianhao` varchar(200) DEFAULT NULL COMMENT '报名编号',
`xiangmumingcheng` varchar(200) DEFAULT NULL COMMENT '项目名称',
`xiangmuleixing` varchar(200) DEFAULT NULL COMMENT '项目类型',
`tupian` varchar(200) DEFAULT NULL COMMENT '图片',
`baomingshijian` datetime DEFAULT NULL COMMENT '报名时间',
`yonghuzhanghao` varchar(200) DEFAULT NULL COMMENT '用户账号',
`yonghuxingming` varchar(200) DEFAULT NULL COMMENT '用户姓名',
`sfsh` varchar(200) DEFAULT '否' COMMENT '是否审核',
`shhf` longtext COMMENT '审核回复',
PRIMARY KEY (`id`),
UNIQUE KEY `baomingbianhao` (`baomingbianhao`)
) ENGINE=InnoDB AUTO_INCREMENT=47 DEFAULT CHARSET=utf8 COMMENT='比赛报名';
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `bisaibaoming`
--
LOCK TABLES `bisaibaoming` WRITE;
/*!40000 ALTER TABLE `bisaibaoming` DISABLE KEYS */;
INSERT INTO `bisaibaoming` VALUES (41,'2022-05-19 06:30:58','1111111111','项目名称1','项目类型1','upload/bisaibaoming_tupian1.jpg','2022-05-19 14:30:58','用户账号1','用户姓名1','是',''),(42,'2022-05-19 06:30:58','2222222222','项目名称2','项目类型2','upload/bisaibaoming_tupian2.jpg','2022-05-19 14:30:58','用户账号2','用户姓名2','是',''),(43,'2022-05-19 06:30:58','3333333333','项目名称3','项目类型3','upload/bisaibaoming_tupian3.jpg','2022-05-19 14:30:58','用户账号3','用户姓名3','是',''),(44,'2022-05-19 06:30:58','4444444444','项目名称4','项目类型4','upload/bisaibaoming_tupian4.jpg','2022-05-19 14:30:58','用户账号4','用户姓名4','是',''),(45,'2022-05-19 06:30:58','5555555555','项目名称5','项目类型5','upload/bisaibaoming_tupian5.jpg','2022-05-19 14:30:58','用户账号5','用户姓名5','是',''),(46,'2022-05-19 06:30:58','6666666666','项目名称6','项目类型6','upload/bisaibaoming_tupian6.jpg','2022-05-19 14:30:58','用户账号6','用户姓名6','是','');
/*!40000 ALTER TABLE `bisaibaoming` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Table structure for table `chengjixinxi`
--
DROP TABLE IF EXISTS `chengjixinxi`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `chengjixinxi` (
`id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '主键',
`addtime` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
`chengjibianhao` varchar(200) DEFAULT NULL COMMENT '成绩编号',
`xiangmumingcheng` varchar(200) DEFAULT NULL COMMENT '项目名称',
`xiangmuleixing` varchar(200) DEFAULT NULL COMMENT '项目类型',
`tupian` varchar(200) DEFAULT NULL COMMENT '图片',
`fabushijian` datetime DEFAULT NULL COMMENT '发布时间',
`bisaichengji` float DEFAULT NULL COMMENT '比赛成绩',
`xiangqing` longtext COMMENT '详情',
`yonghuzhanghao` varchar(200) DEFAULT NULL COMMENT '用户账号',
`yonghuxingming` varchar(200) DEFAULT NULL COMMENT '用户姓名',
`userid` bigint(20) DEFAULT NULL COMMENT '用户id',
PRIMARY KEY (`id`),
UNIQUE KEY `chengjibianhao` (`chengjibianhao`)
) ENGINE=InnoDB AUTO_INCREMENT=57 DEFAULT CHARSET=utf8 COMMENT='成绩信息';
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `chengjixinxi`
--
LOCK TABLES `chengjixinxi` WRITE;
/*!40000 ALTER TABLE `chengjixinxi` DISABLE KEYS */;
INSERT INTO `chengjixinxi` VALUES (51,'2022-05-19 06:30:58','1111111111','项目名称1','项目类型1','upload/1652942004223.png','2022-05-19 14:30:58',1,'<p>详情1</p>','用户账号1','用户姓名1',1),(52,'2022-05-19 06:30:58','2222222222','项目名称2','项目类型2','upload/chengjixinxi_tupian2.jpg','2022-05-19 14:30:58',2,'详情2','用户账号2','用户姓名2',2),(53,'2022-05-19 06:30:58','3333333333','项目名称3','项目类型3','upload/chengjixinxi_tupian3.jpg','2022-05-19 14:30:58',3,'详情3','用户账号3','用户姓名3',3),(54,'2022-05-19 06:30:58','4444444444','项目名称4','项目类型4','upload/chengjixinxi_tupian4.jpg','2022-05-19 14:30:58',4,'详情4','用户账号4','用户姓名4',4),(55,'2022-05-19 06:30:58','5555555555','项目名称5','项目类型5','upload/chengjixinxi_tupian5.jpg','2022-05-19 14:30:58',5,'详情5','用户账号5','用户姓名5',5),(56,'2022-05-19 06:30:58','6666666666','项目名称6','项目类型6','upload/chengjixinxi_tupian6.jpg','2022-05-19 14:30:58',6,'详情6','用户账号6','用户姓名6',6);
/*!40000 ALTER TABLE `chengjixinxi` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Table structure for table `config`
--
DROP TABLE IF EXISTS `config`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `config` (
`id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '主键',
`name` varchar(100) NOT NULL COMMENT '配置参数名称',
`value` varchar(100) DEFAULT NULL COMMENT '配置参数值',
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=utf8 COMMENT='配置文件';
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `config`
--
LOCK TABLES `config` WRITE;
/*!40000 ALTER TABLE `config` DISABLE KEYS */;
INSERT INTO `config` VALUES (1,'picture1','upload/picture1.jpg'),(2,'picture2','upload/picture2.jpg'),(3,'picture3','upload/picture3.jpg');
/*!40000 ALTER TABLE `config` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Table structure for table `news`
--
DROP TABLE IF EXISTS `news`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `news` (
`id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '主键',
`addtime` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
`title` varchar(200) NOT NULL COMMENT '标题',
`introduction` longtext COMMENT '简介',
`picture` varchar(200) NOT NULL COMMENT '图片',
`content` longtext NOT NULL COMMENT '内容',
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=67 DEFAULT CHARSET=utf8 COMMENT='广播信息';
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `news`
前台登录代码:
// 登陆
login() {
if (!this.rulesForm.username) {
this.$message.error("请输入用户名");
return;
}
if (!this.rulesForm.password) {
this.$message.error("请输入密码");
return;
}
if(this.roles.length>1) {
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;
}
}
} else {
this.tableName = this.roles[0].tableName;
this.rulesForm.role = this.roles[0].roleName;
}
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 = '-'+rotate
this.codes[i].rotate = 'rotate('+rotate+'deg)'
// 随机验证码字体大小
let size = Math.floor(Math.random()*sizes.length)
this.codes[i].size = sizes[size]+'px'
}
},
}
};
</script>