1.后台准备
1.1 pom.xml
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.7.7</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
<groupId>com.ruojuan</groupId>
<artifactId>minoa</artifactId>
<version>0.0.1-SNAPSHOT</version>
<name>minoa</name>
<description>Demo project for Spring Boot</description>
<properties>
<java.version>1.8</java.version>
<fastjson.version>1.2.70</fastjson.version>
<jackson.version>2.9.8</jackson.version>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-jdbc</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.mybatis.spring.boot</groupId>
<artifactId>mybatis-spring-boot-starter</artifactId>
<version>2.2.1</version>
</dependency>
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>5.1.44</version>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<optional>true</optional>
</dependency>
<dependency>
<groupId>com.alibaba</groupId>
<artifactId>fastjson</artifactId>
<version>${fastjson.version}</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<configuration>
<excludes>
<exclude>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
</exclude>
</excludes>
</configuration>
</plugin>
<plugin>
<groupId>org.mybatis.generator</groupId>
<artifactId>mybatis-generator-maven-plugin</artifactId>
<version>1.3.2</version>
<dependencies>
<!--使用Mybatis-generator插件不能使用太高版本的mysql驱动 -->
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>${mysql.version}</version>
</dependency>
</dependencies>
<configuration>
<overwrite>true</overwrite>
</configuration>
</plugin>
</plugins>
</build>
</project>
1.2 配置数据资源
Application.yml
spring:
datasource:
#type连接池类型 DBCP,C3P0,Hikari,Druid,默认为Hikari
type: com.zaxxer.hikari.HikariDataSource
driver-class-name: com.mysql.jdbc.Driver
url: jdbc:mysql://localhost:3306/localhost?useUnicode=true&characterEncoding=UTF-8&useSSL=false
username: root
password: 123456
mybatis:
mapper-locations: classpath*:mapper/*.xml #指定mapper文件位置
type-aliases-package: com.ruojuan.minoa.model #指定自动生成别名所在包
1.3 mybatis-generate
1.4 整合mybatis
package com.ruojuan.minoa;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
@MapperScan("com.ruojuan.minoa.mapper")
@SpringBootApplication
public class MinoaApplication {
public static void main(String[] args) {
SpringApplication.run(MinoaApplication.class, args);
}
}
2.准备前端得首页的数据
导入数据库:
oapro.sql:
/*
Navicat Premium Data Transfer
Source Server : mysql273
Source Server Type : MySQL
Source Server Version : 50723
Source Host : localhost:3306
Source Schema : oapro
Target Server Type : MySQL
Target Server Version : 50723
File Encoding : 65001
Date: 02/09/2022 16:46:06
*/
SET NAMES utf8mb4;
SET FOREIGN_KEY_CHECKS = 0;
-- ----------------------------
-- Table structure for t_oa_data_dict
-- ----------------------------
DROP TABLE IF EXISTS `t_oa_data_dict`;
CREATE TABLE `t_oa_data_dict` (
`id` bigint(20) NOT NULL,
`datasource` varchar(32) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL,
`description` varchar(32) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL
) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci ROW_FORMAT = Dynamic;
-- ----------------------------
-- Records of t_oa_data_dict
-- ----------------------------
INSERT INTO `t_oa_data_dict` VALUES (1, 'sys_user_role', '用户角色');
INSERT INTO `t_oa_data_dict` VALUES (2, 'sys_permission_type', '权限类别');
INSERT INTO `t_oa_data_dict` VALUES (3, 'meeting_info_state', '会议状态');
INSERT INTO `t_oa_data_dict` VALUES (4, 'meeting_person_type', '会议人员类别');
INSERT INTO `t_oa_data_dict` VALUES (5, 'meeting_person_result', '会议反馈结果');
INSERT INTO `t_oa_data_dict` VALUES (6, 'meeting_equipment_type', '会议设备类别');
-- ----------------------------
-- Table structure for t_oa_data_item
-- ----------------------------
DROP TABLE IF EXISTS `t_oa_data_item`;
CREATE TABLE `t_oa_data_item` (
`id` bigint(11) NOT NULL,
`datasource` varchar(32) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '数据源标识',
`code` varchar(32) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '据库数存储的值',
`val` varchar(32) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '该值对应的文本内容'
) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci ROW_FORMAT = Dynamic;
-- ----------------------------
-- Records of t_oa_data_item
-- ----------------------------
INSERT INTO `t_oa_data_item` VALUES (1, 'sys_user_role', '1', '管理员');
INSERT INTO `t_oa_data_item` VALUES (2, 'sys_user_role', '2', '发起者');
INSERT INTO `t_oa_data_item` VALUES (3, 'sys_user_role', '3', '审批者');
INSERT INTO `t_oa_data_item` VALUES (4, 'sys_user_role', '4', '参与者');
INSERT INTO `t_oa_data_item` VALUES (5, 'sys_user_role', '5', '会议室管理员');
INSERT INTO `t_oa_data_item` VALUES (6, 'sys_permission_type', '1', '菜单');
INSERT INTO `t_oa_data_item` VALUES (7, 'sys_permission_type', '2', '按钮');
INSERT INTO `t_oa_data_item` VALUES (8, 'meeting_info_state', '1', '待审核');
INSERT INTO `t_oa_data_item` VALUES (9, 'meeting_info_state', '2', '驳回');
INSERT INTO `t_oa_data_item` VALUES (10, 'meeting_info_state', '3', '待开');
INSERT INTO `t_oa_data_item` VALUES (11, 'meeting_info_state', '4', '进行中');
INSERT INTO `t_oa_data_item` VALUES (12, 'meeting_info_state', '5', '开启投票');
INSERT INTO `t_oa_data_item` VALUES (13, 'meeting_info_state', '6', '结束会议');
INSERT INTO `t_oa_data_item` VALUES (14, 'meeting_info_state', '0', '取消会议');
INSERT INTO `t_oa_data_item` VALUES (15, 'meeting_person_type', '1', '参会');
INSERT INTO `t_oa_data_item` VALUES (16, 'meeting_person_type', '2', '列席');
INSERT INTO `t_oa_data_item` VALUES (17, 'meeting_person_result', '1', '参加');
INSERT INTO `t_oa_data_item` VALUES (18, 'meeting_person_result', '0', '不参加');
INSERT INTO `t_oa_data_item` VALUES (19, 'meeting_equipment_type', '1', '投影仪');
INSERT INTO `t_oa_data_item` VALUES (20, 'meeting_equipment_type', '2', '麦克风');
INSERT INTO `t_oa_data_item` VALUES (21, 'meeting_equipment_type', '3', '电子版书屏');
INSERT INTO `t_oa_data_item` VALUES (22, 'meeting_equipment_type', '4', '主持台');
INSERT INTO `t_oa_data_item` VALUES (23, 'meeting_equipment_type', '5', '音响');
-- ----------------------------
-- Table structure for t_oa_meeting_feedback
-- ----------------------------
DROP TABLE IF EXISTS `t_oa_meeting_feedback`;
CREATE TABLE `t_oa_meeting_feedback` (
`id` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL,
`meetingId` bigint(11) NULL DEFAULT NULL COMMENT '外键:会议表主键\r\n',
`personType` int(2) NULL DEFAULT NULL COMMENT '人员类别:1参会2列席\r\n',
`personId` bigint(11) NULL DEFAULT NULL COMMENT '人员ID\r\n',
`result` int(2) NULL DEFAULT NULL COMMENT '反馈结果:1参加0不参加\r\n',
`reason` varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '不参加的原因\r\n',
PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '会议通知反馈表\r\n' ROW_FORMAT = Dynamic;
-- ----------------------------
-- Table structure for t_oa_meeting_info
-- ----------------------------
DROP TABLE IF EXISTS `t_oa_meeting_info`;
CREATE TABLE `t_oa_meeting_info` (
`id` bigint(20) NOT NULL AUTO_INCREMENT,
`title` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '会议标题\r\n',
`content` varchar(2000) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '会议内容\r\n',
`canyuze` varchar(500) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '参会人员\r\n',
`liexize` varchar(500) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '列席人员\r\n',
`zhuchiren` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '主持人\r\n',
`location` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '会议地点\r\n',
`startTime` datetime(0) NULL DEFAULT NULL COMMENT '开始时间\r\n',
`endTime` datetime(0) NULL DEFAULT NULL COMMENT '结束时间\r\n',
`fujian` varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '会议附件\r\n',
`state` int(11) NULL DEFAULT NULL COMMENT '状态:0取消会议1待审核2驳回3待开4进行中5开启投票6结束会议,默认值为1\r\n',
`auditPerson` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '审核人\r\n',
`auditTime` datetime(0) NULL DEFAULT NULL COMMENT '审核时间\r\n',
`seatPic` varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '会议排座图片地址\r\n',
`remark` varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '备注\r\n',
PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 21 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '会议信息表' ROW_FORMAT = Dynamic;
-- ----------------------------
-- Records of t_oa_meeting_info
-- ----------------------------
INSERT INTO `t_oa_meeting_info` VALUES (1, '关于张三的人事任命', '张三工作期间表现优秀,经集团公司领导研究,最终一致同意,张三升为就业组长', '2,3,4,5,6,7,8,9,10,11', '23,24', '1', '会议室1', '2022-03-13 00:00:00', NULL, NULL, 1, '1', NULL, NULL, '/upload/qianzi/0e12bf4d-2a37-43d7-a283-9805687eb596.jpg');
INSERT INTO `t_oa_meeting_info` VALUES (2, '关于李四的开除通告', '李四工作期间无故旷工、办公室传递负能量消息,经公司商议,给予开除决定', '11,12,13,14,15,16,17', '23,24', '1', '会议室1', '2022-03-13 00:00:00', NULL, NULL, 1, '1', NULL, NULL, '');
INSERT INTO `t_oa_meeting_info` VALUES (15, '11', '11', '1', '3,2', '1', '会议室2', '2022-03-13 00:00:00', NULL, NULL, 1, NULL, NULL, NULL, NULL);
INSERT INTO `t_oa_meeting_info` VALUES (16, '22', '22', '1', '2,3', '1', '会议室122', '2022-03-13 00:00:00', NULL, NULL, 1, '1', NULL, '/uploads/ef512ab350814002b4330efe81ccbba2.png', NULL);
INSERT INTO `t_oa_meeting_info` VALUES (17, '11', '22', '1', '3,4', '1', '会议室111', '2022-03-13 10:00:00', NULL, NULL, 2, NULL, NULL, '/uploads/06db5bd3b6674b599f7ade2276c03ab7.png', NULL);
INSERT INTO `t_oa_meeting_info` VALUES (18, '11', '22', '1', '3,4', '1', '会议室111', '2022-03-13 11:00:00', NULL, NULL, 1, NULL, NULL, '/uploads/5b91797446a74da19cad0b921ac79ea5.png', NULL);
INSERT INTO `t_oa_meeting_info` VALUES (19, '22', '22', '1', '2,3', '2', '会议室122', '2022-03-13 12:00:00', NULL, NULL, 2, NULL, NULL, '/uploads/851bda19dfaf494f9abaebe5b691e9ad.png', NULL);
INSERT INTO `t_oa_meeting_info` VALUES (20, 'ee', 'ee', '1,2', '3,4,5', '2', '会议室1111', '2022-03-15 09:00:00', '2022-03-15 11:00:00', NULL, 2, '1', NULL, '/uploads/abab715507314fbd8a9dd42e38e6693c.png', '/uploads/e403fa90455747c399b66054ee06b70e.png');
-- ----------------------------
-- Table structure for t_oa_meeting_option
-- ----------------------------
DROP TABLE IF EXISTS `t_oa_meeting_option`;
CREATE TABLE `t_oa_meeting_option` (
`id` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL,
`meetingId` bigint(11) NULL DEFAULT NULL COMMENT '会议ID\r\n',
`optionValue` varchar(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '选项标识(A/B/C/D)\r\n',
`optionText` varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '选项描述\r\n',
PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '会议投票标题选项表\r\n' ROW_FORMAT = Dynamic;
-- ----------------------------
-- Table structure for t_oa_meeting_room
-- ----------------------------
DROP TABLE IF EXISTS `t_oa_meeting_room`;
CREATE TABLE `t_oa_meeting_room` (
`id` int(11) NOT NULL,
`name` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '会议室名称\r\n',
`equipment` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '会议设备\r\n',
PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '会议室信息\r\n' ROW_FORMAT = Dynamic;
-- ----------------------------
-- Table structure for t_oa_meeting_vote
-- ----------------------------
DROP TABLE IF EXISTS `t_oa_meeting_vote`;
CREATE TABLE `t_oa_meeting_vote` (
`id` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL,
`optionId` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '选项ID(投票标题选项表的主键)\r\n',
`personId` bigint(11) NULL DEFAULT NULL COMMENT '投票人员ID\r\n',
PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '会议投票记录表' ROW_FORMAT = Dynamic;
-- ----------------------------
-- Table structure for t_oa_permission
-- ----------------------------
DROP TABLE IF EXISTS `t_oa_permission`;
CREATE TABLE `t_oa_permission` (
`id` bigint(20) NOT NULL DEFAULT 0 COMMENT '权限id',
`name` varchar(32) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '权限名字',
`description` varchar(128) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '权限描述',
`url` varchar(128) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '菜单路径',
`pid` bigint(20) NULL DEFAULT NULL COMMENT '父权限',
`ismenu` int(11) NULL DEFAULT 1 COMMENT '是否为菜单 1、菜单 2、按钮',
`displayno` bigint(20) NULL DEFAULT 0 COMMENT '展现顺序',
PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci ROW_FORMAT = Dynamic;
-- ----------------------------
-- Records of t_oa_permission
-- ----------------------------
INSERT INTO `t_oa_permission` VALUES (1, '系统管理', '系统管理', NULL, -1, 1, 0);
INSERT INTO `t_oa_permission` VALUES (2, '用户管理', '用户管理', 'admin/user/user_list.jsp', 1, 1, 0);
INSERT INTO `t_oa_permission` VALUES (3, '数据字典', '数据字典', 'admin/dict/dict_list.jsp', 1, 1, 0);
INSERT INTO `t_oa_permission` VALUES (4, '会议管理', '会议管理', NULL, -1, 1, 0);
INSERT INTO `t_oa_permission` VALUES (5, '发布会议', '发布会议', 'admin/meeting/meeting_add.jsp', 4, 1, 0);
INSERT INTO `t_oa_permission` VALUES (6, '我的会议', '我的会议', 'admin/meeting/myMeeting.jsp', 4, 1, 0);
INSERT INTO `t_oa_permission` VALUES (7, '我的审批', '我的审批', 'admin/meeting/myAudit.jsp', 4, 1, 0);
INSERT INTO `t_oa_permission` VALUES (8, '代开会议', '代开会议', 'admin/meeting/meeting_info_list.jsp', 4, 1, 0);
INSERT INTO `t_oa_permission` VALUES (10, '所有会议', '所有会议', 'admin/meeting/meeting_info_list.jsp', 4, 1, 0);
INSERT INTO `t_oa_permission` VALUES (11, '会议室管理', '会议室管理', 'admin/meeting/meeting_info_list.jsp', -1, 1, 0);
INSERT INTO `t_oa_permission` VALUES (12, '历史会议', '历史会议', '/bg/listOrder4.jsp', 4, 1, 0);
-- ----------------------------
-- Table structure for t_oa_role
-- ----------------------------
DROP TABLE IF EXISTS `t_oa_role`;
CREATE TABLE `t_oa_role` (
`id` int(11) NOT NULL,
`name` varchar(25) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL,
PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Dynamic;
-- ----------------------------
-- Records of t_oa_role
-- ----------------------------
INSERT INTO `t_oa_role` VALUES (1, '管理员');
INSERT INTO `t_oa_role` VALUES (2, '普通用户');
-- ----------------------------
-- Table structure for t_oa_role_permission
-- ----------------------------
DROP TABLE IF EXISTS `t_oa_role_permission`;
CREATE TABLE `t_oa_role_permission` (
`rid` bigint(20) NULL DEFAULT NULL,
`pid` bigint(20) NULL DEFAULT NULL
) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci ROW_FORMAT = Dynamic;
-- ----------------------------
-- Records of t_oa_role_permission
-- ----------------------------
INSERT INTO `t_oa_role_permission` VALUES (1, 0);
INSERT INTO `t_oa_role_permission` VALUES (1, 1);
INSERT INTO `t_oa_role_permission` VALUES (1, 2);
INSERT INTO `t_oa_role_permission` VALUES (1, 3);
INSERT INTO `t_oa_role_permission` VALUES (1, 4);
INSERT INTO `t_oa_role_permission` VALUES (1, 5);
INSERT INTO `t_oa_role_permission` VALUES (1, 6);
INSERT INTO `t_oa_role_permission` VALUES (1, 7);
INSERT INTO `t_oa_role_permission` VALUES (1, 8);
INSERT INTO `t_oa_role_permission` VALUES (1, 9);
INSERT INTO `t_oa_role_permission` VALUES (2, 10);
INSERT INTO `t_oa_role_permission` VALUES (2, 11);
INSERT INTO `t_oa_role_permission` VALUES (2, 12);
INSERT INTO `t_oa_role_permission` VALUES (2, 13);
INSERT INTO `t_oa_role_permission` VALUES (1, 14);
-- ----------------------------
-- Table structure for t_oa_user
-- ----------------------------
DROP TABLE IF EXISTS `t_oa_user`;
CREATE TABLE `t_oa_user` (
`id` bigint(20) NOT NULL AUTO_INCREMENT,
`name` varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '用户名: 唯一键 登陆时使用 禁止修改',
`pwd` varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '用户密码:长度6~10位,MD5加密',
`rid` bigint(20) NULL DEFAULT 2 COMMENT '用户角色:1 管理员 2 发起者 3 审批者 4 参与者 5 会议室管理员',
`loginName` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '登录名',
PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 65 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci ROW_FORMAT = Dynamic;
-- ----------------------------
-- Records of t_oa_user
-- ----------------------------
INSERT INTO `t_oa_user` VALUES (1, '唐某', '123', 1, 'admin');
INSERT INTO `t_oa_user` VALUES (2, '陈某', '123', 2, 'cheng');
INSERT INTO `t_oa_user` VALUES (3, '胡某', '123', 2, 'hu');
INSERT INTO `t_oa_user` VALUES (4, '王某', '123', 2, 'wang');
INSERT INTO `t_oa_user` VALUES (5, '潘某', '123', 2, 'pang');
INSERT INTO `t_oa_user` VALUES (6, '李某', '123', 2, '');
INSERT INTO `t_oa_user` VALUES (7, '易某', '123', 2, '');
INSERT INTO `t_oa_user` VALUES (8, '刘某', '123', 2, '');
INSERT INTO `t_oa_user` VALUES (9, '裴某', '123', 2, '');
INSERT INTO `t_oa_user` VALUES (10, '行政部经理王某', '123', 2, '');
INSERT INTO `t_oa_user` VALUES (11, '后勤部主管刘某', '123', 2, '');
INSERT INTO `t_oa_user` VALUES (12, '林科大内务校长文某', '123', 2, '');
INSERT INTO `t_oa_user` VALUES (13, '林科大教学部经理唐某', '123', 2, '');
INSERT INTO `t_oa_user` VALUES (14, '林科大教质部主管洪某', '123', 2, '');
INSERT INTO `t_oa_user` VALUES (15, '民族项目市场部经理李某', '123', 2, '');
INSERT INTO `t_oa_user` VALUES (16, '民族项目教质部经理熊樱', '123', 2, '');
INSERT INTO `t_oa_user` VALUES (17, '民族项目教学部经理李某', '123', 2, '');
INSERT INTO `t_oa_user` VALUES (18, '卓景京项目市场部经理夏某', '123', 2, '');
INSERT INTO `t_oa_user` VALUES (19, '卓景京项目内务校长赵某', '123', 2, '');
INSERT INTO `t_oa_user` VALUES (20, '卓景京项目教质部主管周某', '123', 2, '');
INSERT INTO `t_oa_user` VALUES (21, '电子科技校区市场部经理姚某', '123', 2, '');
INSERT INTO `t_oa_user` VALUES (22, '电子科技校区内务校长田某', '123', 2, '');
INSERT INTO `t_oa_user` VALUES (23, '张三', '123', 2, 'zhangsan');
INSERT INTO `t_oa_user` VALUES (24, '李四', '123', 2, 'lisi');
INSERT INTO `t_oa_user` VALUES (25, 'aa', '11', 1, 'aa');
INSERT INTO `t_oa_user` VALUES (26, 'aa', '11', 1, '11');
INSERT INTO `t_oa_user` VALUES (27, 'aa', '1', 1, 'bb');
INSERT INTO `t_oa_user` VALUES (28, 'cc', '1', 1, 'cc');
INSERT INTO `t_oa_user` VALUES (29, 'vv', '1', 1, 'vv');
INSERT INTO `t_oa_user` VALUES (30, 'dd', '1', 1, 'dd');
INSERT INTO `t_oa_user` VALUES (35, 'aa', '11', 1, 'aa');
INSERT INTO `t_oa_user` VALUES (36, 'bb', 'bb', 2, 'bb');
INSERT INTO `t_oa_user` VALUES (37, 'cc', 'cc', 2, 'cc');
INSERT INTO `t_oa_user` VALUES (38, 'dd', 'dd', 1, 'dd');
INSERT INTO `t_oa_user` VALUES (39, 'ee', 'ee', 2, 'ee');
INSERT INTO `t_oa_user` VALUES (40, 'vv', 'vv', 2, 'vv');
INSERT INTO `t_oa_user` VALUES (41, 'a1', '123', 2, 'lisi');
INSERT INTO `t_oa_user` VALUES (42, 'a1', '123', 2, 'lisi');
INSERT INTO `t_oa_user` VALUES (43, 'a1', '123', 2, 'lisi');
INSERT INTO `t_oa_user` VALUES (44, 'a1', '123', 2, 'lisi');
INSERT INTO `t_oa_user` VALUES (45, 'a1', '123', 2, 'lisi');
INSERT INTO `t_oa_user` VALUES (46, 'a1', '123', 2, 'lisi');
INSERT INTO `t_oa_user` VALUES (47, 'a1', '123', 2, 'lisi');
INSERT INTO `t_oa_user` VALUES (48, 'a1', '123', 2, 'lisi');
INSERT INTO `t_oa_user` VALUES (49, 'a1', '123', 2, 'lisi');
INSERT INTO `t_oa_user` VALUES (50, 'a1', '123', 2, 'lisi');
INSERT INTO `t_oa_user` VALUES (51, 'a1', '123', 2, 'lisi');
INSERT INTO `t_oa_user` VALUES (52, 'a1', '123', 2, 'lisi');
INSERT INTO `t_oa_user` VALUES (53, 'a1', '123', 2, 'lisi');
INSERT INTO `t_oa_user` VALUES (54, 'a1', '123', 2, 'lisi');
INSERT INTO `t_oa_user` VALUES (55, 'a1', '123', 2, 'lisi');
INSERT INTO `t_oa_user` VALUES (56, 'a1', '123', 2, 'lisi');
INSERT INTO `t_oa_user` VALUES (57, 'a1', '123', 2, 'lisi');
INSERT INTO `t_oa_user` VALUES (58, 'a1', '123', 2, 'lisi');
INSERT INTO `t_oa_user` VALUES (59, 'a1', '123', 2, 'lisi');
INSERT INTO `t_oa_user` VALUES (60, 'a1', '123', 2, 'lisi');
INSERT INTO `t_oa_user` VALUES (61, 'a1', '123', 2, 'lisi');
INSERT INTO `t_oa_user` VALUES (62, '文博', '123', NULL, 'wenbo');
INSERT INTO `t_oa_user` VALUES (63, 'cc', '123', NULL, 'cc');
INSERT INTO `t_oa_user` VALUES (64, 'vv', '123', 1, 'vv');
-- ----------------------------
-- Table structure for wx_user
-- ----------------------------
DROP TABLE IF EXISTS `wx_user`;
CREATE TABLE `wx_user` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`username` varchar(63) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '用户名称',
`password` varchar(63) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COMMENT '用户密码',
`gender` tinyint(3) NOT NULL DEFAULT 0 COMMENT '性别:0 未知, 1男, 1 女',
`birthday` date NULL DEFAULT NULL COMMENT '生日',
`last_login_time` datetime(0) NULL DEFAULT NULL COMMENT '最近一次登录时间',
`last_login_ip` varchar(63) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COMMENT '最近一次登录IP地址',
`user_level` tinyint(3) NULL DEFAULT 0 COMMENT '用户层级 0 普通用户,1 VIP用户,2 区域代理用户',
`nickname` varchar(63) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COMMENT '用户昵称或网络名称',
`mobile` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COMMENT '用户手机号码',
`avatar` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COMMENT '用户头像图片',
`weixin_openid` varchar(63) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COMMENT '微信登录openid',
`status` tinyint(3) NOT NULL DEFAULT 0 COMMENT '0 可用, 1 禁用, 2 注销',
`add_time` datetime(0) NULL DEFAULT NULL COMMENT '创建时间',
`update_time` datetime(0) NULL DEFAULT NULL COMMENT '更新时间',
`deleted` tinyint(1) NULL DEFAULT 0 COMMENT '逻辑删除',
`share_user_id` int(11) NULL DEFAULT NULL,
PRIMARY KEY (`id`) USING BTREE,
UNIQUE INDEX `user_name`(`username`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 3 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '用户表' ROW_FORMAT = Compact;
-- ----------------------------
-- Records of wx_user
-- ----------------------------
INSERT INTO `wx_user` VALUES (1, 'of_zY6RGwMfbacRbEngFD4dZMoJ4', 'of_zY6RGwMfbacRbEngFD4dZMoJ4', 0, NULL, '2022-09-02 11:29:55', '0:0:0:0:0:0:0:1', 1, 'donkee', '18008497070', 'https://thirdwx.qlogo.cn/mmopen/vi_32/DYAIOgq83eoQicXQBHibRUP4Ix1x5U1FZOcKgYbRrl8UiaaOMTA5J6Lmr0An4ffnAYrqOIPhz6945wNsExOnianAdg/132', 'of_zY6RGwMfbacRbEngFD4dZMoJ4', 0, NULL, NULL, 0, 1);
INSERT INTO `wx_user` VALUES (2, 'of_zY6UTYaWS7tTOfo9XJ9VyiOcc', 'of_zY6UTYaWS7tTOfo9XJ9VyiOcc', 0, NULL, '2022-08-30 21:28:37', '0:0:0:0:0:0:0:1', 2, '测试号🐷', '12066600001', 'https://thirdwx.qlogo.cn/mmopen/vi_32/Q0j4TwGTfTJhF2keTvcWiaRPXYTrIkpxYhdRQaLLnQp6AJJUFcCDYNLXe3iaywwJbGIeOrD3LKZE7x6zdOl6Lchg/132', 'of_zY6UTYaWS7tTOfo9XJ9VyiOcc', 0, NULL, NULL, 0, 1);
SET FOREIGN_KEY_CHECKS = 1;
wx-user-emoji.txt:
DROP TABLE IF EXISTS `wx_user`;
CREATE TABLE `wx_user` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`username` varchar(63) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '用户名称',
`password` varchar(63) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COMMENT '用户密码',
`gender` tinyint(3) NOT NULL DEFAULT 0 COMMENT '性别:0 未知, 1男, 1 女',
`birthday` date NULL DEFAULT NULL COMMENT '生日',
`last_login_time` datetime(0) NULL DEFAULT NULL COMMENT '最近一次登录时间',
`last_login_ip` varchar(63) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COMMENT '最近一次登录IP地址',
`user_level` tinyint(3) NULL DEFAULT 0 COMMENT '用户层级 0 普通用户,1 VIP用户,2 区域代理用户',
`nickname` varchar(63) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COMMENT '用户昵称或网络名称',
`mobile` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COMMENT '用户手机号码',
`avatar` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COMMENT '用户头像图片',
`weixin_openid` varchar(63) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COMMENT '微信登录openid',
`status` tinyint(3) NOT NULL DEFAULT 0 COMMENT '0 可用, 1 禁用, 2 注销',
`add_time` datetime(0) NULL DEFAULT NULL COMMENT '创建时间',
`update_time` datetime(0) NULL DEFAULT NULL COMMENT '更新时间',
`deleted` tinyint(1) NULL DEFAULT 0 COMMENT '逻辑删除',
`share_user_id` int(11) NULL DEFAULT NULL,
PRIMARY KEY (`id`) USING BTREE,
UNIQUE INDEX `user_name`(`username`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '用户表' ROW_FORMAT = Compact;
3.Promise
Promise 是异步编程的一种解决方案,比传统的解决方案——回调函数和事件——更合理和更强大。它由社区最早提出和实现,ES6 将其写进了语言标准,统一了用法,原生提供了Promise对象。
所谓Promise,简单说就是一个容器,里面保存着某个未来才会结束的事件(通常是一个异步操作)的结果。从语法上说,Promise 是一个对象,从它可以获取异步操作的消息。Promise 提供统一的 API,各种异步操作都可以用同样的方法进行处理。
promise运行中有三个状态:
pending: 等待 (进行中) promise一创建出来,就是pending进行中
fulfilled: 成功 (已完成), 调用 resolve, 就会将状态从pending改成fulfilled, 且将来就会执行.then
rejected: 失败 (拒绝), 调用 reject, 就会将状态从pending改成rejected, 且将来就会执行.catch
注意点:
一旦promise的状态发生变化, 状态就会被凝固
如果再调用reject或resolve,进行状态修改就没有意义了
4.封装request
/**
* 封装微信的request请求
*/
function request(url, data = {}, method = "GET") {
return new Promise(function (resolve, reject) {
wx.request({
url: url,
data: data,
method: method,
header: {
'Content-Type': 'application/json',
},
success: function (res) {
if (res.statusCode == 200) {
resolve(res.data);//会把进行中改变成已成功
} else {
reject(res.errMsg);//会把进行中改变成已失败
}
},
fail: function (err) {
reject(err)
}
})
});
}
5.会议展示
<!--pages/index/index.wxml-->
<!-- <text>pages/index/index.wxml</text> -->
<wxs src="/utils/page.wxs" module="tools" />
<view>
<swiper autoplay="true" indicator-dots="true" indicator-color="#fff" indicator-active-color="#00f">
<block wx:for="{{imgSrcs}}" wx:key="text">
<swiper-item>
<view>
<image src="{{item.img}}" class="swiper-item" />
</view>
</swiper-item>
</block>
</swiper>
</view>
<view class="mobi-title">
<text class="mobi-icon"></text>
<text>会议信息</text>
</view>
<block wx:for-items="{{lists}}" wx:for-item="item" wx:key="item.id">
<view class="list" data-id="{{item.id}}">
<view class="list-img">
<image class="video-img" mode="scaleToFill" src="{{item.image != null ? item.image : '/static/persons/1.jpg'}}"></image>
</view>
<view class="list-detail">
<view class="list-title"><text>{{item.title}}</text></view>
<view class="list-tag">
<view class="state">{{tools.getState(item.state)}}</view>
<view class="join"><text class="list-num">{{tools.getNumber(item.canyuze)}}</text>人报名</view>
</view>
<view class="list-info"><text>{{item.location}}</text>|<text>{{tools.formatDate(item.starttime)}}</text></view>
</view>
</view>
</block>
<view class="section bottom-line">
<text>到底啦</text>
</view>