目录
一、小程序首页动态数据加载
1.数据库准备
2.后台准备
① pom.xml
② 配置数据源
③ 整合mybatis
④ 代码生成
⑤ mybatis-generator
二、准备前端的首页的数据
1、Promise
2.封装request
3.会议展示
三、通过wxs将首页动态数据优化
新建数据库叫oapro,如下图所示:
导入数据,代码如下:
/*
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;
数据导入完毕如下图所示:
打开IDEA,创建一个stringboot项目
项目创建好了之后,开始导入pom依赖
4.0.0
org.springframework.boot
spring-boot-starter-parent
2.7.7
com.jwj
minoa
0.0.1-SNAPSHOT
minoa
Demo project for Spring Boot
1.8
1.2.70
2.9.8
org.springframework.boot
spring-boot-starter-jdbc
org.springframework.boot
spring-boot-starter-web
org.mybatis.spring.boot
mybatis-spring-boot-starter
2.2.1
mysql
mysql-connector-java
5.1.44
runtime
org.projectlombok
lombok
true
com.alibaba
fastjson
${fastjson.version}
org.springframework.boot
spring-boot-maven-plugin
org.projectlombok
lombok
org.mybatis.generator
mybatis-generator-maven-plugin
1.3.2
mysql
mysql-connector-java
${mysql.version}
true
appliation.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/oapro?useUnicode=true&characterEncoding=UTF-8&useSSL=false
username: root
password: 123456
application.yml
mybatis:
mapper-locations: classpath*:mapper/*.xml #指定mapper文件位置
type-aliases-package: com.jwj.minoa.model #指定自动生成别名所在包
在启动类添加
package com.jwj.minoa;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
@MapperScan("com.jwj.minoa.mapper")//指mapper接口所在包
@SpringBootApplication
public class MinoaApplication {
public static void main(String[] args) {
SpringApplication.run(MinoaApplication.class, args);
}
}
jdbc.properties
jdbc.driver=com.mysql.jdbc.Driver
jdbc.url=jdbc:mysql://localhost:3306/oapro?useUnicode=true&characterEncoding=UTF-8
jdbc.username=root
jdbc.password=123456
jdbc.initialSize=10
jdbc.maxTotal=100
jdbc.maxIdle=50
jdbc.minIdle=10
jdbc.maxWaitMillis=-1
generatorConfig.xml
生成mapper接口,model实体类,mapper映射文件
因为需要跨域,所以添加了一些工具类
启动类
我们的后台就搭建好了。
Promise 是异步编程的一种解决方案,比传统的解决方案——回调函数和事件——更合理和更强大。它由社区最早提出和实现,ES6 将其写进了语言标准,统一了用法,原生提供了Promise对象。
所谓Promise,简单说就是一个容器,里面保存着某个未来才会结束的事件(通常是一个异步操作)的结果。从语法上说,Promise 是一个对象,从它可以获取异步操作的消息。Promise 提供统一的 API,各种异步操作都可以用同样的方法进行处理。
promise运行中有三个状态:
pending: 等待 (进行中) promise一创建出来,就是pending进行中
fulfilled: 成功 (已完成), 调用 resolve, 就会将状态从pending改成fulfilled, 且将来就会执行.then
rejected: 失败 (拒绝), 调用 reject, 就会将状态从pending改成rejected, 且将来就会执行.catch
注意点:
一旦promise的状态发生变化, 状态就会被凝固
如果再调用reject或resolve,进行状态修改就没有意义了
修改API地址
// 以下是业务服务器API地址
// 本机开发API地址
var WxApiRoot = 'http://localhost:8080/wx/';
// 测试环境部署api地址
// var WxApiRoot = 'http://192.168.0.101:8070/demo/wx/';
// 线上平台api地址
//var WxApiRoot = 'https://www.oa-mini.com/demo/wx/';
module.exports = {
IndexUrl: WxApiRoot + 'home/index', //首页数据接口
SwiperImgs: WxApiRoot+'swiperImgs', //轮播图
MettingInfos: WxApiRoot+'meeting/list', //会议信息
};
把假数据删掉
在/utils/util.js中
const formatTime = date => {
const year = date.getFullYear()
const month = date.getMonth() + 1
const day = date.getDate()
const hour = date.getHours()
const minute = date.getMinutes()
const second = date.getSeconds()
return `${[year, month, day].map(formatNumber).join('/')} ${[hour, minute, second].map(formatNumber).join(':')}`
}
/**
* 封装微信的request请求
* $.post(url)
* $.ajaxi({
* url:
* success:
* })
*/
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)
}
})
});
}
const formatNumber = n => {
n = n.toString()
return n[1] ? n : `0${n}`
}
module.exports = {
formatTime,request
}
//引入
const utli = require("../../utils/util")
/**
* 生命周期函数--监听页面加载
*/
onLoad(options) {
this.loadSwiperImgs();
this.loadMeetingInfos();
},
loadMeetingInfos(){
utli.request(api.IndexUrl).then(res=>{
this.setData({
lists:res.data.infoList
})
}).catch(res=>{
console.log('服器没有开启,使用模拟数据!')
})
}
把Mock关闭掉,继续把验证关闭掉,如下图所示:
WXS 模块 | 微信开放文档微信开发者平台文档https://developers.weixin.qq.com/miniprogram/dev/reference/wxs/01wxs-module.html
在utils中新建一个文件page.wxs
function getState(state){
// 状态:0取消会议1待审核2驳回3待开4进行中5开启投票6结束会议,默认值为1
if(state == 0){
return '取消会议';
}else if(state == 1){
return '待审核';
}else if(state == 2){
return '驳回';
}else if(state ==3){
return '待开';
}else if(state == 4){
return '进行中';
}else if(state == 5){
return '开启投票';
}else if(state == 6){
return '结束会议';
}
return '其它';
}
function getNumber(s){
s += ""
var arr = s.split(",");
return arr.length;
}
function formatDate(ts, option) {
var date = getDate(ts)
var year = date.getFullYear()
var month = date.getMonth() + 1
var day = date.getDate()
var week = date.getDay()
var hour = date.getHours()
var minute = date.getMinutes()
var second = date.getSeconds()
//获取 年月日
if (option == 'YY-MM-DD') return [year, month, day].map(formatNumber).join('-')
//获取 年月
if (option == 'YY-MM') return [year, month].map(formatNumber).join('-')
//获取 年
if (option == 'YY') return [year].map(formatNumber).toString()
//获取 月
if (option == 'MM') return [mont].map(formatNumber).toString()
//获取 日
if (option == 'DD') return [day].map(formatNumber).toString()
//获取 年月日 周一 至 周日
if (option == 'YY-MM-DD Week') return [year, month, day].map(formatNumber).join('-') + ' ' + getWeek(week)
//获取 月日 周一 至 周日
if (option == 'MM-DD Week') return [month, day].map(formatNumber).join('-') + ' ' + getWeek(week)
//获取 周一 至 周日
if (option == 'Week') return getWeek(week)
//获取 时分秒
if (option == 'hh-mm-ss') return [hour, minute, second].map(formatNumber).join(':')
//获取 时分
if (option == 'hh-mm') return [hour, minute].map(formatNumber).join(':')
//获取 分秒
if (option == 'mm-dd') return [minute, second].map(formatNumber).join(':')
//获取 时
if (option == 'hh') return [hour].map(formatNumber).toString()
//获取 分
if (option == 'mm') return [minute].map(formatNumber).toString()
//获取 秒
if (option == 'ss') return [second].map(formatNumber).toString()
//默认 时分秒 年月日
return [year, month, day].map(formatNumber).join('-') + ' ' + [hour, minute, second].map(formatNumber).join(':')
}
function formatNumber(n) {
n = n.toString()
return n[1] ? n : '0' + n
}
function getWeek(n) {
switch(n) {
case 1:
return '星期一'
case 2:
return '星期二'
case 3:
return '星期三'
case 4:
return '星期四'
case 5:
return '星期五'
case 6:
return '星期六'
case 7:
return '星期日'
}
}
/**
* 方法导出
*/
module.exports = {
getState: getState,
getNumber: getNumber,
formatDate: formatDate
};
会议信息
{{item.title}}
{{tools.getState(item.state)}}
{{tools.getNumber(item.canyuze)}} 人报名
{{item.location}} |{{tools.formatDate(item.starttime)}}
到底啦
效果如下图所示: