1
0
Code Issues Pull Requests Packages Projects Releases Wiki Activity GitHub Gitee

后台管理 登陆权限问题解决

This commit is contained in:
程序员小墨 2023-03-28 14:01:13 +08:00
parent 614e04ed1b
commit 880e4f8941
13 changed files with 498 additions and 386 deletions

View File

@ -11,7 +11,7 @@
Target Server Version : 80012 Target Server Version : 80012
File Encoding : 65001 File Encoding : 65001
Date: 22/03/2023 16:41:32 Date: 28/03/2023 13:51:00
*/ */
SET NAMES utf8mb4; SET NAMES utf8mb4;
@ -49,10 +49,10 @@ INSERT INTO `apply1` VALUES (11, 2, '1', '飞机', '1', '2022-10-23 16:17:00', '
INSERT INTO `apply1` VALUES (12, 13, '1', '飞机', '1', '2022-10-26 19:25:00', '2022-10-26 21:25:00', 1, ''); INSERT INTO `apply1` VALUES (12, 13, '1', '飞机', '1', '2022-10-26 19:25:00', '2022-10-26 21:25:00', 1, '');
-- ---------------------------- -- ----------------------------
-- Table structure for community_gate -- Table structure for community_gate1
-- ---------------------------- -- ----------------------------
DROP TABLE IF EXISTS `community_gate`; DROP TABLE IF EXISTS `community_gate1`;
CREATE TABLE `community_gate` ( CREATE TABLE `community_gate1` (
`id` bigint(11) NOT NULL AUTO_INCREMENT COMMENT '雪花id', `id` bigint(11) NOT NULL AUTO_INCREMENT COMMENT '雪花id',
`name` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '大门显示名称', `name` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '大门显示名称',
`open` tinyint(1) NOT NULL DEFAULT 1 COMMENT '大门是否开放 1为开放 2为关闭', `open` tinyint(1) NOT NULL DEFAULT 1 COMMENT '大门是否开放 1为开放 2为关闭',
@ -60,7 +60,7 @@ CREATE TABLE `community_gate` (
) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci COMMENT = '社区大门' ROW_FORMAT = DYNAMIC; ) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci COMMENT = '社区大门' ROW_FORMAT = DYNAMIC;
-- ---------------------------- -- ----------------------------
-- Records of community_gate -- Records of community_gate1
-- ---------------------------- -- ----------------------------
-- ---------------------------- -- ----------------------------
@ -281,10 +281,13 @@ CREATE TABLE `order` (
-- ---------------------------- -- ----------------------------
-- Records of order -- Records of order
-- ---------------------------- -- ----------------------------
INSERT INTO `order` VALUES (1748800678865801225, 1, '2023-03-21 15:50:19', 'Pending', 21.99, NULL); INSERT INTO `order` VALUES (1748800678865801225, 3, '2023-03-21 15:50:19', 'Pending', 21.99, NULL);
INSERT INTO `order` VALUES (1749495597129404427, 1, '2023-03-21 16:30:54', 'Pending', 5.99, NULL); INSERT INTO `order` VALUES (1749495597129404427, 3, '2023-03-21 16:30:54', 'Pending', 5.99, NULL);
INSERT INTO `order` VALUES (1749495896040673288, 1, '2023-03-21 16:32:06', 'Pending', 5.99, NULL); INSERT INTO `order` VALUES (1749495896040673288, 3, '2023-03-21 16:32:06', 'Pending', 5.99, NULL);
INSERT INTO `order` VALUES (1749496012575215624, 1, '2023-03-21 16:32:33', 'Pending', 17.97, NULL); INSERT INTO `order` VALUES (1749496012575215624, 3, '2023-03-21 16:32:33', 'Pending', 17.97, NULL);
INSERT INTO `order` VALUES (1750312359831932932, 3, '2023-03-23 22:36:26', 'Cancelled', 87.50, NULL);
INSERT INTO `order` VALUES (1750312445567700999, 3, '2023-03-23 22:36:46', 'Processing', 87.50, NULL);
INSERT INTO `order` VALUES (1750313361633054722, 3, '2023-03-23 22:40:25', 'Processing', 2.50, NULL);
-- ---------------------------- -- ----------------------------
-- Table structure for order_detail -- Table structure for order_detail
@ -301,7 +304,7 @@ CREATE TABLE `order_detail` (
INDEX `good_id`(`good_id`) USING BTREE, INDEX `good_id`(`good_id`) USING BTREE,
CONSTRAINT `order_detail_ibfk_1` FOREIGN KEY (`good_id`) REFERENCES `goods` (`id`) ON DELETE RESTRICT ON UPDATE RESTRICT, CONSTRAINT `order_detail_ibfk_1` FOREIGN KEY (`good_id`) REFERENCES `goods` (`id`) ON DELETE RESTRICT ON UPDATE RESTRICT,
CONSTRAINT `order_detail_ibfk_2` FOREIGN KEY (`order_id`) REFERENCES `order` (`id`) ON DELETE CASCADE ON UPDATE CASCADE CONSTRAINT `order_detail_ibfk_2` FOREIGN KEY (`order_id`) REFERENCES `order` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE = InnoDB AUTO_INCREMENT = 43 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci ROW_FORMAT = DYNAMIC; ) ENGINE = InnoDB AUTO_INCREMENT = 46 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci ROW_FORMAT = DYNAMIC;
-- ---------------------------- -- ----------------------------
-- Records of order_detail -- Records of order_detail
@ -316,6 +319,9 @@ INSERT INTO `order_detail` VALUES (39, 1748800678865801225, 19, 1, 21.99);
INSERT INTO `order_detail` VALUES (40, 1749495597129404427, 16, 1, 5.99); INSERT INTO `order_detail` VALUES (40, 1749495597129404427, 16, 1, 5.99);
INSERT INTO `order_detail` VALUES (41, 1749495896040673288, 16, 1, 5.99); INSERT INTO `order_detail` VALUES (41, 1749495896040673288, 16, 1, 5.99);
INSERT INTO `order_detail` VALUES (42, 1749496012575215624, 16, 3, 5.99); INSERT INTO `order_detail` VALUES (42, 1749496012575215624, 16, 3, 5.99);
INSERT INTO `order_detail` VALUES (43, 1750312359831932932, 55, 25, 3.50);
INSERT INTO `order_detail` VALUES (44, 1750312445567700999, 55, 25, 3.50);
INSERT INTO `order_detail` VALUES (45, 1750313361633054722, 56, 1, 2.50);
-- ---------------------------- -- ----------------------------
-- Table structure for report -- Table structure for report
@ -329,17 +335,18 @@ CREATE TABLE `report` (
`temperature` varchar(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '体温是否正常', `temperature` varchar(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '体温是否正常',
`address` varchar(1000) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '地址', `address` varchar(1000) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '地址',
PRIMARY KEY (`id`) USING BTREE PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 61 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci ROW_FORMAT = DYNAMIC; ) ENGINE = InnoDB AUTO_INCREMENT = 62 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci ROW_FORMAT = DYNAMIC;
-- ---------------------------- -- ----------------------------
-- Records of report -- Records of report
-- ---------------------------- -- ----------------------------
INSERT INTO `report` VALUES (53, 1, '管理员 密码root', '2022-12-26 20:35:38', '1', '湖北省武汉市洪山区文治街南湖雅园(洪山区信访局对面)'); INSERT INTO `report` VALUES (53, 3, '用户 密码user', '2022-12-26 20:35:38', '1', '湖北省武汉市洪山区文治街南湖雅园(洪山区信访局对面)');
INSERT INTO `report` VALUES (55, 1, '管理员 密码root', '2022-12-27 21:03:24', '0', '湖北省武汉市洪山区文治街508号南湖雅园F栋2-104号'); INSERT INTO `report` VALUES (55, 3, '用户 密码user', '2022-12-27 21:03:24', '0', '湖北省武汉市洪山区文治街508号南湖雅园F栋2-104号');
INSERT INTO `report` VALUES (57, 1, '管理员 密码root', '2022-12-28 21:47:57', '0', '湖北省武汉市洪山区文治街南湖雅园(洪山区信访局对面)'); INSERT INTO `report` VALUES (57, 3, '用户 密码user', '2022-12-28 21:47:57', '0', '湖北省武汉市洪山区文治街南湖雅园(洪山区信访局对面)');
INSERT INTO `report` VALUES (58, 1, '管理员 密码root', '2022-12-29 18:20:00', '1', '湖北省武汉市洪山区鲁磨路209号'); INSERT INTO `report` VALUES (58, 3, '用户 密码user', '2022-12-29 18:20:00', '1', '湖北省武汉市洪山区鲁磨路209号');
INSERT INTO `report` VALUES (59, 1, '管理员 密码root', '2023-03-17 00:27:21', '0', '湖北省武汉市洪山区雄楚大道珞狮南路南湖雅园F-4-106'); INSERT INTO `report` VALUES (59, 3, '用户 密码user', '2023-03-17 00:27:21', '0', '湖北省武汉市洪山区雄楚大道珞狮南路南湖雅园F-4-106');
INSERT INTO `report` VALUES (60, 1, '管理员 密码root', '2023-03-20 00:47:22', '0', '湖北省武汉市武昌区武车路'); INSERT INTO `report` VALUES (60, 3, '用户 密码user', '2023-03-20 00:47:22', '0', '湖北省武汉市武昌区武车路');
INSERT INTO `report` VALUES (61, 3, '用户 密码user', '2023-03-23 22:24:14', '0', '湖北省武汉市武昌区修远路');
-- ---------------------------- -- ----------------------------
-- Table structure for setting -- Table structure for setting
@ -355,7 +362,7 @@ CREATE TABLE `setting` (
-- ---------------------------- -- ----------------------------
-- Records of setting -- Records of setting
-- ---------------------------- -- ----------------------------
INSERT INTO `setting` VALUES ('wechat_access_token', '66_k4e3ae12hwRMq2XLW5mW5rOBsLawIcKPsFjNC4ILQS6rYJi4RJN8tYXtwCJLxqimgAHrZ-MV0LqsFn7u_9OVjEOj7b-d3V4tirO3mxLTj59U87V5WhV0XNp1fFULMRhAJASTY', '2023-03-21 00:34:18'); INSERT INTO `setting` VALUES ('wechat_access_token', '66_qSxbHTU4lcXa4l8JgZisZm_2gXUmQH_vVSybGHP229Nv9QeacmXuYeQxpZQ-JNnLWI-HpJ9Zlf18B4Lnif5fR1EvGukoLFZmGWADlcobLsY-JlKZX7lXRzk6tAoRWTiACAZEB', '2023-03-24 00:26:42');
-- ---------------------------- -- ----------------------------
-- Table structure for user -- Table structure for user
@ -368,19 +375,20 @@ CREATE TABLE `user` (
`realname` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '真实姓名', `realname` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '真实姓名',
`id_number` varchar(18) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '身份证号', `id_number` varchar(18) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '身份证号',
`phone_number` varchar(11) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '手机号', `phone_number` varchar(11) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '手机号',
`role` int(11) NOT NULL COMMENT '角色 (0-超级管理员 1-工作人员 2-社区居民_房主 3-社区居民_家庭成员 4-社区居民_租客 5-访客)', `role` int(11) NOT NULL COMMENT '角色 (1-超级管理员 2-工作人员 3-社区居民_房主 4-社区居民_家庭成员 5-社区居民_租客 6-访客)',
`building_id` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '门栋号+单元号', `building_id` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '门栋号+单元号',
`doorplate` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '门牌号', `doorplate` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '门牌号',
`permission` int(11) NOT NULL DEFAULT 0 COMMENT '进出权限 (0-无 1-继承(普通居民) 2-永久 3-限时)', `permission` int(11) NOT NULL DEFAULT 0 COMMENT '进出权限 (0-无 1-继承(普通居民) 2-永久 3-限时)',
`permission_time` datetime NULL DEFAULT NULL COMMENT '进出权限失效时间', `permission_time` datetime NULL DEFAULT NULL COMMENT '进出权限失效时间',
PRIMARY KEY (`id`) USING BTREE PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 22 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci ROW_FORMAT = DYNAMIC; ) ENGINE = InnoDB AUTO_INCREMENT = 4 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci ROW_FORMAT = DYNAMIC;
-- ---------------------------- -- ----------------------------
-- Records of user -- Records of user
-- ---------------------------- -- ----------------------------
INSERT INTO `user` VALUES (1, 'root', '99adc231b045331e514a516b4b7680f588e3823213abe901738bc3ad67b2f6fcb3c64efb93d18002588d3ccc1a49efbae1ce20cb43df36b38651f11fa75678e8', '管理员 密码root', '420111111111111111', NULL, 1, NULL, NULL, 0, NULL); INSERT INTO `user` VALUES (1, 'root', '99adc231b045331e514a516b4b7680f588e3823213abe901738bc3ad67b2f6fcb3c64efb93d18002588d3ccc1a49efbae1ce20cb43df36b38651f11fa75678e8', '管理员 密码root', '420111111111111111', NULL, 1, NULL, NULL, 0, NULL);
INSERT INTO `user` VALUES (2, 'user', 'b14361404c078ffd549c03db443c3fede2f3e534d73f78f77301ed97d4a436a9fd9db05ee8b325c0ad36438b43fec8510c204fc1c1edb21d0941c00e9e2c1ce2', '用户 密码user', '420111111111111111', NULL, 2, NULL, NULL, 0, NULL); INSERT INTO `user` VALUES (2, 'admin', 'c7ad44cbad762a5da0a452f9e854fdc1e0e7a52a38015f23f3eab1d80b931dd472634dfac71cd34ebc35d16ab7fb8a90c81f975113d6c7538dc69dd8de9077ec', '社区管理员 密码admin', '420111111111111111', NULL, 2, NULL, NULL, 0, NULL);
INSERT INTO `user` VALUES (3, 'user', 'b14361404c078ffd549c03db443c3fede2f3e534d73f78f77301ed97d4a436a9fd9db05ee8b325c0ad36438b43fec8510c204fc1c1edb21d0941c00e9e2c1ce2', '用户 密码user', '420111111111111111', NULL, 3, NULL, NULL, 0, NULL);
-- ---------------------------- -- ----------------------------
-- Table structure for visitor1 -- Table structure for visitor1

View File

@ -1,5 +1,5 @@
// Generated by 'unplugin-auto-import' // Generated by 'unplugin-auto-import'
export {} export {}
declare global { declare global {
const ElMessage: typeof import('element-plus/es')['ElMessage']
} }

View File

@ -14,6 +14,7 @@
"element-plus": "^2.2.14", "element-plus": "^2.2.14",
"md-editor-v3": "^2.2.1", "md-editor-v3": "^2.2.1",
"pinia": "^2.0.20", "pinia": "^2.0.20",
"qs": "^6.11.1",
"vue": "^3.2.37", "vue": "^3.2.37",
"vue-cropperjs": "^5.0.0", "vue-cropperjs": "^5.0.0",
"vue-router": "^4.1.3", "vue-router": "^4.1.3",
@ -709,6 +710,15 @@
"node": ">=8" "node": ">=8"
} }
}, },
"node_modules/call-bind": {
"version": "1.0.2",
"resolved": "https://registry.npmmirror.com/call-bind/-/call-bind-1.0.2.tgz",
"integrity": "sha512-7O+FbCihrB5WGbFYesctwmTKae6rOiIzmz1icreWJ+0aA7LJfuqhEso2T9ncpcFtzMQtzXf2QGGueWJGTYsqrA==",
"dependencies": {
"function-bind": "^1.1.1",
"get-intrinsic": "^1.0.2"
}
},
"node_modules/cesium": { "node_modules/cesium": {
"version": "1.102.0", "version": "1.102.0",
"resolved": "https://registry.npmmirror.com/cesium/-/cesium-1.102.0.tgz", "resolved": "https://registry.npmmirror.com/cesium/-/cesium-1.102.0.tgz",
@ -1427,8 +1437,17 @@
"node_modules/function-bind": { "node_modules/function-bind": {
"version": "1.1.1", "version": "1.1.1",
"resolved": "https://registry.npmmirror.com/function-bind/-/function-bind-1.1.1.tgz", "resolved": "https://registry.npmmirror.com/function-bind/-/function-bind-1.1.1.tgz",
"integrity": "sha512-yIovAzMX49sF8Yl58fSCWJ5svSLuaibPxXQJFLmBObTuCr0Mf1KiPopGM9NiFjiYBCbfaa2Fh6breQ6ANVTI0A==", "integrity": "sha512-yIovAzMX49sF8Yl58fSCWJ5svSLuaibPxXQJFLmBObTuCr0Mf1KiPopGM9NiFjiYBCbfaa2Fh6breQ6ANVTI0A=="
"dev": true },
"node_modules/get-intrinsic": {
"version": "1.2.0",
"resolved": "https://registry.npmmirror.com/get-intrinsic/-/get-intrinsic-1.2.0.tgz",
"integrity": "sha512-L049y6nFOuom5wGyRc3/gdTLO94dySVKRACj1RmJZBQXlbTMhtNIgkWkUHq+jYmZvKf14EW1EoJnnjbmoHij0Q==",
"dependencies": {
"function-bind": "^1.1.1",
"has": "^1.0.3",
"has-symbols": "^1.0.3"
}
}, },
"node_modules/glob-parent": { "node_modules/glob-parent": {
"version": "5.1.2", "version": "5.1.2",
@ -1459,7 +1478,6 @@
"version": "1.0.3", "version": "1.0.3",
"resolved": "https://registry.npmmirror.com/has/-/has-1.0.3.tgz", "resolved": "https://registry.npmmirror.com/has/-/has-1.0.3.tgz",
"integrity": "sha512-f2dvO0VU6Oej7RkWJGrehjbzMAjFp5/VKPp5tTpWIV4JHHZK1/BxbFRtf/siA2SWTe09caDmVtYYzWEIbBS4zw==", "integrity": "sha512-f2dvO0VU6Oej7RkWJGrehjbzMAjFp5/VKPp5tTpWIV4JHHZK1/BxbFRtf/siA2SWTe09caDmVtYYzWEIbBS4zw==",
"dev": true,
"dependencies": { "dependencies": {
"function-bind": "^1.1.1" "function-bind": "^1.1.1"
}, },
@ -1467,6 +1485,14 @@
"node": ">= 0.4.0" "node": ">= 0.4.0"
} }
}, },
"node_modules/has-symbols": {
"version": "1.0.3",
"resolved": "https://registry.npmmirror.com/has-symbols/-/has-symbols-1.0.3.tgz",
"integrity": "sha512-l3LCuF6MgDNwTDKkdYGEihYjt5pRPbEg46rtlmnSPlUbgmB8LOIrKJbYYFBSbnPaJexMKtiPO8hmeRjRz2Td+A==",
"engines": {
"node": ">= 0.4"
}
},
"node_modules/http-errors": { "node_modules/http-errors": {
"version": "2.0.0", "version": "2.0.0",
"resolved": "https://registry.npmmirror.com/http-errors/-/http-errors-2.0.0.tgz", "resolved": "https://registry.npmmirror.com/http-errors/-/http-errors-2.0.0.tgz",
@ -1784,6 +1810,11 @@
"dev": true, "dev": true,
"peer": true "peer": true
}, },
"node_modules/object-inspect": {
"version": "1.12.3",
"resolved": "https://registry.npmmirror.com/object-inspect/-/object-inspect-1.12.3.tgz",
"integrity": "sha512-geUvdk7c+eizMNUDkRpW1wJwgfOiOeHbxBR/hLXK1aT6zmVSO0jsQcs7fj6MGw89jC/cjGfLcNOrtMYtGqm81g=="
},
"node_modules/on-finished": { "node_modules/on-finished": {
"version": "2.4.1", "version": "2.4.1",
"resolved": "https://registry.npmmirror.com/on-finished/-/on-finished-2.4.1.tgz", "resolved": "https://registry.npmmirror.com/on-finished/-/on-finished-2.4.1.tgz",
@ -1931,6 +1962,17 @@
"node": ">=12.0.0" "node": ">=12.0.0"
} }
}, },
"node_modules/qs": {
"version": "6.11.1",
"resolved": "https://registry.npmmirror.com/qs/-/qs-6.11.1.tgz",
"integrity": "sha512-0wsrzgTz/kAVIeuxSjnpGC56rzYtr6JT/2BwEvMaPhFIoYa1aGO8LbzuU1R0uUYQkLpWBTOj0l/CLAJB64J6nQ==",
"dependencies": {
"side-channel": "^1.0.4"
},
"engines": {
"node": ">=0.6"
}
},
"node_modules/queue-microtask": { "node_modules/queue-microtask": {
"version": "1.2.3", "version": "1.2.3",
"resolved": "https://registry.npmmirror.com/queue-microtask/-/queue-microtask-1.2.3.tgz", "resolved": "https://registry.npmmirror.com/queue-microtask/-/queue-microtask-1.2.3.tgz",
@ -2133,6 +2175,16 @@
"integrity": "sha512-E5LDX7Wrp85Kil5bhZv46j8jOeboKq5JMmYM3gVGdGH8xFpPWXUMsNrlODCrkoxMEeNi/XZIwuRvY4XNwYMJpw==", "integrity": "sha512-E5LDX7Wrp85Kil5bhZv46j8jOeboKq5JMmYM3gVGdGH8xFpPWXUMsNrlODCrkoxMEeNi/XZIwuRvY4XNwYMJpw==",
"dev": true "dev": true
}, },
"node_modules/side-channel": {
"version": "1.0.4",
"resolved": "https://registry.npmmirror.com/side-channel/-/side-channel-1.0.4.tgz",
"integrity": "sha512-q5XPytqFEIKHkGdiMIrY10mvLRvnQh42/+GoBlFW3b2LXLE2xxJpZFdm94we0BaoV3RwJyGqg5wS7epxTv0Zvw==",
"dependencies": {
"call-bind": "^1.0.0",
"get-intrinsic": "^1.0.2",
"object-inspect": "^1.9.0"
}
},
"node_modules/source-map": { "node_modules/source-map": {
"version": "0.6.1", "version": "0.6.1",
"resolved": "https://registry.npmmirror.com/source-map/-/source-map-0.6.1.tgz", "resolved": "https://registry.npmmirror.com/source-map/-/source-map-0.6.1.tgz",

View File

@ -14,6 +14,7 @@
"element-plus": "^2.2.14", "element-plus": "^2.2.14",
"md-editor-v3": "^2.2.1", "md-editor-v3": "^2.2.1",
"pinia": "^2.0.20", "pinia": "^2.0.20",
"qs": "^6.11.1",
"vue": "^3.2.37", "vue": "^3.2.37",
"vue-cropperjs": "^5.0.0", "vue-cropperjs": "^5.0.0",
"vue-router": "^4.1.3", "vue-router": "^4.1.3",

17
frontend/src/api/user.js Normal file
View File

@ -0,0 +1,17 @@
import send_request from '../utils/send_request';
/**
* 用户登录
* @returns
*/
export function userLogin({ username, password }) {
return send_request({
url: '/user/login',
method: 'POST',
useQS: true,
params: {
"username": username,
"password": password,
}
});
};

View File

@ -1,47 +1,47 @@
<template> <template>
<div class="header"> <div class="header">
<!-- 折叠按钮 --> <!-- 折叠按钮 -->
<div class="collapse-btn" @click="collapseChage"> <div class="collapse-btn" @click="collapseChage">
<el-icon v-if="sidebar.collapse"> <el-icon v-if="sidebar.collapse">
<Expand /> <Expand />
</el-icon> </el-icon>
<el-icon v-else> <el-icon v-else>
<Fold /> <Fold />
</el-icon> </el-icon>
</div> </div>
<div class="logo">{{ settings.siteFullTitle }}</div> <div class="logo">{{ settings.siteFullTitle }}</div>
<div class="header-right"> <div class="header-right">
<div class="header-user-con"> <div class="header-user-con">
<!-- 消息中心 --> <!-- 消息中心 -->
<div class="btn-bell" @click="router.push('/tabs')"> <div class="btn-bell" @click="router.push('/tabs')">
<el-tooltip effect="dark" :content="message ? `有${message}条未读消息` : `消息中心`" placement="bottom"> <el-tooltip effect="dark" :content="message ? `有${message}条未读消息` : `消息中心`" placement="bottom">
<i class="el-icon-lx-notice"></i> <i class="el-icon-lx-notice"></i>
</el-tooltip> </el-tooltip>
<span class="btn-bell-badge" v-if="message"></span> <span class="btn-bell-badge" v-if="message"></span>
</div> </div>
<!-- 用户头像 --> <!-- 用户头像 -->
<el-avatar class="user-avator" :size="30" :src="imgurl" /> <el-avatar class="user-avator" :size="30" :src="imgurl" />
<!-- 用户名下拉菜单 --> <!-- 用户名下拉菜单 -->
<el-dropdown class="user-name" trigger="click" @command="handleCommand"> <el-dropdown class="user-name" trigger="click" @command="handleCommand">
<span class="el-dropdown-link"> <span class="el-dropdown-link">
{{ username }} {{ username }}
<el-icon class="el-icon--right"> <el-icon class="el-icon--right">
<arrow-down /> <arrow-down />
</el-icon> </el-icon>
</span> </span>
<template #dropdown> <template #dropdown>
<el-dropdown-menu> <el-dropdown-menu>
<a href="https://github.com/lin-xin/vue-manage-system" target="_blank"> <a href="https://github.com/lin-xin/vue-manage-system" target="_blank">
<el-dropdown-item>项目仓库</el-dropdown-item> <el-dropdown-item>项目仓库</el-dropdown-item>
</a> </a>
<el-dropdown-item command="user">个人中心</el-dropdown-item> <el-dropdown-item command="user">个人中心</el-dropdown-item>
<el-dropdown-item divided command="loginout">退出登录</el-dropdown-item> <el-dropdown-item divided command="loginout">退出登录</el-dropdown-item>
</el-dropdown-menu> </el-dropdown-menu>
</template> </template>
</el-dropdown> </el-dropdown>
</div> </div>
</div> </div>
</div> </div>
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
import { onMounted } from 'vue'; import { onMounted } from 'vue';
@ -59,131 +59,131 @@ const message: number = 2;
const sidebar = useSidebarStore(); const sidebar = useSidebarStore();
// //
const collapseChage = () => { const collapseChage = () => {
sidebar.handleCollapse(); sidebar.handleCollapse();
}; };
onMounted(() => { onMounted(() => {
// //
// if (document.body.clientWidth < 1500) { // if (document.body.clientWidth < 1500) {
// collapseChage(); // collapseChage();
// } // }
}); });
// //
const router = useRouter(); const router = useRouter();
const handleCommand = (command: string) => { const handleCommand = (command: string) => {
if (command == 'loginout') { if (command == 'loginout') {
// 退 // 退
send_request('v1/user/logout', "POST"); send_request({
// () url: 'v1/user/logout',
const tags = useTagsStore(); method: "POST",
tags.clearTags(); } as any);
// localStorage // ()
localStorage.clear(); const tags = useTagsStore();
// localStorage.removeItem('ms_username'); tags.clearTags();
// localStorage.removeItem('ms_user_id'); // localStorage
// localStorage.removeItem('ms_role_id'); localStorage.clear();
// //
router.push({ router.push({
path: '/login', path: '/login',
query: { query: {
redirectTo: router.currentRoute.value.path // window.location.href redirectTo: router.currentRoute.value.path // window.location.href
}, },
}); });
ElMessage.success('已退出登录'); ElMessage.success('已退出登录');
} else if (command == 'user') { } else if (command == 'user') {
router.push('/user'); router.push('/user');
} }
}; };
</script> </script>
<style scoped> <style scoped>
.header { .header {
position: relative; position: relative;
box-sizing: border-box; box-sizing: border-box;
width: 100%; width: 100%;
height: 70px; height: 70px;
font-size: 22px; font-size: 22px;
color: #fff; color: #fff;
} }
.collapse-btn { .collapse-btn {
display: flex; display: flex;
justify-content: center; justify-content: center;
align-items: center; align-items: center;
height: 100%; height: 100%;
float: left; float: left;
padding: 0 21px; padding: 0 21px;
cursor: pointer; cursor: pointer;
} }
.header .logo { .header .logo {
float: left; float: left;
/* width: 250px; */ /* width: 250px; */
line-height: 70px; line-height: 70px;
/* 系统名称不换行 */ /* 系统名称不换行 */
white-space: nowrap; white-space: nowrap;
} }
.header-right { .header-right {
float: right; float: right;
padding-right: 50px; padding-right: 50px;
} }
.header-user-con { .header-user-con {
display: flex; display: flex;
height: 70px; height: 70px;
align-items: center; align-items: center;
} }
.btn-fullscreen { .btn-fullscreen {
transform: rotate(45deg); transform: rotate(45deg);
margin-right: 5px; margin-right: 5px;
font-size: 24px; font-size: 24px;
} }
.btn-bell, .btn-bell,
.btn-fullscreen { .btn-fullscreen {
position: relative; position: relative;
width: 30px; width: 30px;
height: 30px; height: 30px;
text-align: center; text-align: center;
border-radius: 15px; border-radius: 15px;
cursor: pointer; cursor: pointer;
display: flex; display: flex;
align-items: center; align-items: center;
} }
.btn-bell-badge { .btn-bell-badge {
position: absolute; position: absolute;
right: 4px; right: 4px;
top: 0px; top: 0px;
width: 8px; width: 8px;
height: 8px; height: 8px;
border-radius: 4px; border-radius: 4px;
background: #f56c6c; background: #f56c6c;
color: #fff; color: #fff;
} }
.btn-bell .el-icon-lx-notice { .btn-bell .el-icon-lx-notice {
color: #fff; color: #fff;
} }
.user-name { .user-name {
margin-left: 10px; margin-left: 10px;
} }
.user-avator { .user-avator {
margin-left: 20px; margin-left: 20px;
} }
.el-dropdown-link { .el-dropdown-link {
color: #fff; color: #fff;
cursor: pointer; cursor: pointer;
display: flex; display: flex;
align-items: center; align-items: center;
} }
.el-dropdown-menu__item { .el-dropdown-menu__item {
text-align: center; text-align: center;
} }
</style> </style>

View File

@ -15,11 +15,13 @@ app.use(router);
for (const [key, component] of Object.entries(ElementPlusIconsVue)) { for (const [key, component] of Object.entries(ElementPlusIconsVue)) {
app.component(key, component); app.component(key, component);
} }
// 自定义权限指令 // 自定义权限指令
const permiss = usePermissStore(); const permiss = usePermissStore();
app.directive('permiss', { app.directive('permiss', { // 元素级权限控制
mounted(el, binding) { mounted(el, binding) {
if (!permiss.key.includes(String(binding.value))) { const role = localStorage.getItem('ms_role_id');
if (!permiss[role as string] || !permiss[role as string].includes(binding.value as string)) {
el['hidden'] = true; el['hidden'] = true;
} }
}, },

View File

@ -198,18 +198,26 @@ const router = createRouter({
router.beforeEach((to, from, next) => { router.beforeEach((to, from, next) => {
document.title = `${to.meta.title} | ${settings.siteTitle}`; document.title = `${to.meta.title} | ${settings.siteTitle}`;
const role = localStorage.getItem('ms_username'); const username = localStorage.getItem('ms_username');
const role = localStorage.getItem('ms_role_id');
const permiss = usePermissStore(); const permiss = usePermissStore();
if (!role && to.path !== '/login') { const currentUserPermiss = permiss[role as string];
// console.log("currentUserPermiss", currentUserPermiss)
if (!username && to.path !== '/login') {
next({ next({
path: '/login', path: '/login',
query: { query: {
redirectTo: router.currentRoute.value.path // window.location.href redirectTo: router.currentRoute.value.path // window.location.href
}, },
}); });
} else if (to.meta.permiss && !permiss.key.includes(to.meta.permiss)) { return
} else if (
to.meta.permiss &&
!(currentUserPermiss && currentUserPermiss.includes(to.meta.permiss as string))
) {
// 如果没有权限则进入403 // 如果没有权限则进入403
next('/403'); next('/403');
return
} else { } else {
next(); next();
} }

View File

@ -2,21 +2,61 @@ import { defineStore } from 'pinia';
import send_request from '../utils/send_request'; import send_request from '../utils/send_request';
interface ObjectList { interface ObjectList {
[key: string]: string[]; [key: string]: string[];
} }
// 不同 role 的用户分别有哪些权限
export const usePermissStore = defineStore('permiss', { export const usePermissStore = defineStore('permiss', {
state: () => { state: () => {
const keys = localStorage.getItem('ms_keys'); return {
const defaultList = localStorage.getItem('ms_default_list'); "1": [
return { "dashboard",
key: keys ? JSON.parse(keys) : <string[]>[], "data-integration",
defaultList: JSON.stringify(defaultList) "default",
}; "equipment",
}, "equipment-setting",
actions: { "equipment-setting-manage",
handleSet(val: string[]) { "equipment-view",
this.key = val; "monitor-data",
} "monitor-data-statistics",
} "monitor-data-view",
"privilege",
"privilege-role-setting",
"privilege-user-setting",
"report",
"report-upload",
"resource",
"resource-staff-setting",
"resource-vehicle-setting",
"site-info",
"warning",
"warning-log",
"warning-setting",
"warning-view"
],
"2": [
"dashboard",
"data-integration",
"default",
"equipment",
"equipment-setting",
"equipment-view",
"monitor-data",
"monitor-data-statistics",
"monitor-data-view",
"report",
"report-upload",
"site-info",
"warning",
"warning-log",
"warning-setting",
"warning-view"
]
};
},
// actions: {
// handleSet(val: string[]) {
// this.key = val;
// }
// }
}); });

View File

@ -1,52 +1,67 @@
import request from './request'; import request from './request';
import settings from './settings'; import settings from './settings';
import { ElMessage, ElLoading } from 'element-plus';
async function send_request(url, method = "POST", params, callback) { import qs from 'qs';
if (!url) {
return false; async function send_request({ url, method = "POST", params, useQS = false, callback }) {
} if (!url) {
return false;
let returnData = await request({ }
baseURL: settings.backendHost,
url: url, const loading = ElLoading.service({
method: method, lock: true,
withCredentials: true, text: '请稍候',
// POST 请求参数 background: 'rgba(0, 0, 0, 0.7)',
data: method.toUpperCase() == "POST" ? params : null, });
// GET 请求参数
params: method.toUpperCase() == "GET" ? params : null, let opt = {
}).then((response) => { baseURL: settings.backendHost,
let result = response.data; url: url,
// 判断后端是否处理成功 method: method,
if (!result.isSuccess) { withCredentials: true,
// 用户未登录情况 }
if (result.data && result.data.errCode == 20003) {
ElMessage.error(result?.data?.errMsg || "用户未登录"); if (method.toUpperCase() == "POST") {
localStorage.clear(); // POST 请求参数
// window.location.reload(); opt.headers = { 'content-type': 'application/x-www-form-urlencoded' }
// 如果同时发出多个请求可能会多次进来第二次及之后进入时hash已经变成 #/login 了 opt.data = useQS ? qs.stringify(params) : params
if (!window.location.hash.includes("/login")) { } else if (method.toUpperCase() == "GET") {
let newUrl = '/#/login?redirectTo=' + encodeURIComponent(window.location.hash.substring(1).split('?')[0]) // GET 请求参数
console.log("newUrl", newUrl) opt.params = params
window.location.href = newUrl; }
}
} else { return request(opt).then((response) => {
ElMessage.error(result?.data?.errMsg || "服务器错误"); let result = response.data;
} // 判断后端是否处理成功
return false; if (!result.success) {
} // 用户未登录情况
let data = result.data; // if (result.data && result.data.errCode == 20003) {
if (typeof (callback) === "function") { // ElMessage.error(result?.data?.msg || "用户未登录");
callback(data); // localStorage.clear();
} // // window.location.reload();
return true; // // 如果同时发出多个请求可能会多次进来第二次及之后进入时hash已经变成 #/login 了
}).catch((err) => { // if (!window.location.hash.includes("/login")) {
console.error(err); // let newUrl = '/#/login?redirectTo=' + encodeURIComponent(window.location.hash.substring(1).split('?')[0])
ElMessage.error(err.message); // console.log("newUrl", newUrl)
// ElMessage.error('请求超时,请检查网络连接'); // window.location.href = newUrl;
return false; // }
}) // } else {
return returnData; ElMessage.error(result?.data?.msg || "服务器错误");
} // }
return null;
export default send_request; }
let data = result.data;
if (typeof (callback) === "function") {
callback(data);
}
return data;
}).catch((err) => {
console.error(err);
ElMessage.error(err.message);
return false;
}).finally(() => {
loading.close();
})
}
export default send_request;

View File

@ -11,7 +11,7 @@ export default {
* 网页标题 / 登录页显示 * 网页标题 / 登录页显示
*/ */
siteTitle: "社区疫情防控系统", siteTitle: "社区疫情防控系统",
siteFullTitle: "社区疫情防控系统 - 后台管理系统(社区管理员)", siteFullTitle: "社区疫情防控系统 - 后台管理系统",
/** /**
* 开发公司名称 * 开发公司名称
@ -21,7 +21,7 @@ export default {
/** /**
* 后端接口请求地址 * 后端接口请求地址
* / 结尾 * 结尾加不加 / 都可
*/ */
backendHost: "http://epp.only4.work/", backendHost: "https://epp.only4.work/",
}; };

View File

@ -1,163 +1,136 @@
<template> <template>
<div class="login-wrap"> <div class="login-wrap">
<div class="login-container"> <div class="login-container">
<div class="ms-login"> <div class="ms-login">
<div class="ms-title">{{ settings.siteFullTitle }}</div> <div class="ms-title">{{ settings.siteFullTitle }}</div>
<el-form :model="param" :rules="rules" ref="login" label-width="0px" class="ms-content"> <el-form :model="param" :rules="rules" ref="login" label-width="0px" class="ms-content">
<el-form-item prop="username"> <el-form-item prop="username">
<el-input v-model="param.username" placeholder="用户名"> <el-input v-model="param.username" placeholder="用户名">
<template #prepend> <template #prepend>
<el-button :icon="User"></el-button> <el-button :icon="User"></el-button>
</template> </template>
</el-input> </el-input>
</el-form-item> </el-form-item>
<el-form-item prop="password"> <el-form-item prop="password">
<el-input type="password" placeholder="密码" v-model="param.password" <el-input type="password" placeholder="密码" v-model="param.password"
@keyup.enter="submitForm(login)"> @keyup.enter="submitForm(login)">
<template #prepend> <template #prepend>
<el-button :icon="Lock"></el-button> <el-button :icon="Lock"></el-button>
</template> </template>
</el-input> </el-input>
</el-form-item> </el-form-item>
<div class="login-btn"> <div class="login-btn">
<el-button type="primary" @click="submitForm(login)"> <el-button type="primary" @click="submitForm(login)">
<!-- <el-icon><UserFilled /></el-icon>--> <!-- <el-icon><UserFilled /></el-icon>-->
&nbsp;<el-icon> &nbsp;<el-icon>
<Right /> <Right />
</el-icon> </el-icon>
</el-button> </el-button>
</div> </div>
</el-form> </el-form>
</div> </div>
</div> </div>
<div class="company-info" v-if="settings.companyName"> <div class="company-info" v-if="settings.companyName">
{{ settings.companyName }} {{ settings.companyName }}
</div> </div>
</div> </div>
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
import { ref, reactive } from 'vue'; import { ref, reactive } from 'vue';
import { useTagsStore } from '../store/tags'; import { useTagsStore } from '../store/tags';
import { usePermissStore } from '../store/permiss';
import { useRouter } from 'vue-router'; import { useRouter } from 'vue-router';
import { ElMessage, ElLoading } from 'element-plus'; import { ElMessage } from 'element-plus';
import type { FormInstance, FormRules } from 'element-plus'; import type { FormInstance, FormRules } from 'element-plus';
import { Lock, User } from '@element-plus/icons-vue'; import { Lock, User } from '@element-plus/icons-vue';
import send_request from '../utils/send_request';
import settings from '../utils/settings'; import settings from '../utils/settings';
import * as userApi from '../api/user';
interface LoginInfo { interface LoginInfo {
username: string; username: string;
password: string; password: string;
}
interface UserInfo {
username: string;
id: string;
roleId: string;
} }
interface PrivilegeInfo { interface PrivilegeInfo {
"id": Number, "id": Number,
"roleId": Number, "roleId": Number,
"privilegeName": string, "privilegeName": string,
"module": string "module": string
} }
interface RoleInfo { interface RoleInfo {
id: Number, id: Number,
roleName: string, roleName: string,
comment: any, comment: any,
privileges: Array<PrivilegeInfo>; privileges: Array<PrivilegeInfo>;
} }
const router = useRouter(); const router = useRouter();
const param = reactive<LoginInfo>({ const param = reactive<LoginInfo>({
username: 'admin', username: 'root',
password: '123123' password: 'root'
}); });
const rules: FormRules = { const rules: FormRules = {
username: [ username: [
{ {
required: true, required: true,
message: '请输入用户名', message: '请输入用户名',
trigger: 'blur' trigger: 'blur'
} }
], ],
password: [ password: [
{ {
required: true, required: true,
message: '请输入密码', message: '请输入密码',
trigger: 'blur' trigger: 'blur'
} }
] ]
}; };
const permiss: any = usePermissStore();
const login = ref<FormInstance>(); const login = ref<FormInstance>();
const submitForm = (formEl: FormInstance | undefined) => { const submitForm = (formEl: FormInstance | undefined) => {
if (!formEl) return; if (!formEl) return;
formEl.validate(async (valid: boolean, invalidFields: any) => { formEl.validate(async (valid: boolean, invalidFields: any) => {
if (!valid) { if (!valid) {
// ElMessage.error(''); // ElMessage.error('');
console.log("invalidFields", invalidFields); console.log("invalidFields", invalidFields);
// //
Object.values(invalidFields).forEach((input: any) => { Object.values(invalidFields).forEach((input: any) => {
// console.log("input", input) // console.log("input", input)
// //
input.forEach((element: any) => { input.forEach((element: any) => {
// console.log("element", element) // console.log("element", element)
ElMessage.error({ message: element.message, grouping: true }); ElMessage.error({ message: element.message, grouping: true });
}); });
}); });
return; return;
} }
const loading = ElLoading.service({ userApi.userLogin({
lock: true, username: param.username,
text: '请稍候', password: param.password
background: 'rgba(0, 0, 0, 0.7)', }).then(async (data: any) => {
}); //
if (!data) return;
console.log("login data", data, data.userInfo);
await send_request('v1/user/login', "POST", { ElMessage.success('登录成功');
userName: param.username, localStorage.setItem('ms_username', data.userInfo?.username);
passWord: param.password localStorage.setItem('ms_realname', data.userInfo?.realname);
}, async (data: UserInfo) => { localStorage.setItem('ms_user_id', data.userInfo?.id);
// localStorage.setItem('ms_role_id', data.userInfo?.role);
if (!data) {
ElMessage.error("用户名或密码错误");
return;
}
ElMessage.success('登录成功');
localStorage.setItem('ms_username', data.username);
localStorage.setItem('ms_user_id', data.id);
localStorage.setItem('ms_role_id', data.roleId);
let defaultList = {}; let targetRoute: any = router.currentRoute?.value?.query?.redirectTo
await send_request('v1/role/list', "GET", {}, (roleList: Array<RoleInfo>) => { if (targetRoute && !targetRoute.includes('/login')) {
for (let role of roleList) { router.push(targetRoute);
defaultList[role.id.toString()] = role.privileges.map((i: any) => i.module) } else {
} router.push('/');
}); }
})
permiss.defaultList = defaultList; });
permiss.key = defaultList[data.roleId];
if (typeof (permiss.key) === "undefined") return;
localStorage.setItem('ms_keys', JSON.stringify(permiss.key));
localStorage.setItem('ms_default_list', JSON.stringify(defaultList));
let targetRoute: any = router.currentRoute?.value?.query?.redirectTo
if (targetRoute && !targetRoute.includes('/login')) {
router.push(targetRoute);
} else {
router.push('/');
}
});
loading.close();
});
}; };
const tags = useTagsStore(); const tags = useTagsStore();
@ -166,57 +139,57 @@ tags.clearTags();
<style scoped> <style scoped>
.login-wrap { .login-wrap {
width: 100%; width: 100%;
height: 100%; height: 100%;
} }
.login-container { .login-container {
width: 100%; width: 100%;
height: 100%; height: 100%;
display: grid; display: grid;
place-items: center; place-items: center;
} }
.ms-title { .ms-title {
width: 100%; width: 100%;
padding: 18px 24px; padding: 18px 24px;
box-sizing: border-box; box-sizing: border-box;
text-align: center; text-align: center;
font-size: 20px; font-size: 20px;
color: #fff; color: #fff;
border-bottom: 1px solid #ddd; border-bottom: 1px solid #ddd;
} }
.ms-login { .ms-login {
width: min(380px, 95vw); width: min(380px, 95vw);
padding: 5px 10px; padding: 5px 10px;
border-radius: 5px; border-radius: 5px;
background: rgba(255, 255, 255, 0.3); background: rgba(255, 255, 255, 0.3);
overflow: hidden; overflow: hidden;
} }
.ms-content { .ms-content {
padding: 30px 30px; padding: 30px 30px;
} }
.login-btn { .login-btn {
text-align: center; text-align: center;
} }
.login-btn button { .login-btn button {
width: 100%; width: 100%;
height: 36px; height: 36px;
margin-bottom: 10px; margin-bottom: 10px;
} }
.company-info { .company-info {
color: #7589b6; color: #7589b6;
text-align: center; text-align: center;
position: absolute; position: absolute;
left: 0; left: 0;
right: 0; right: 0;
bottom: 10px; bottom: 10px;
font-size: 13px; font-size: 13px;
letter-spacing: 1px; letter-spacing: 1px;
} }
</style> </style>

View File

@ -114,20 +114,16 @@ Page({
let result = d.data; let result = d.data;
if (result.success) { if (result.success) {
// 登录成功 // 登录成功
if (result.data.userInfo.role != 2) { if ([3, 4, 5, 6].includes(result.data.userInfo.role)) {
wx.showModal({ wx.showModal({
title: '你不是社区居民', title: '你不是社区居民',
content: '请前往网页版登录', content: '管理员请前往网页版登录',
showCancel: false,
complete: (res) => { complete: (res) => {
if (res.cancel) { //
}
if (res.confirm) {
}
} }
}) })
return
} }
wx.setStorageSync("userInfo", result.data.userInfo); wx.setStorageSync("userInfo", result.data.userInfo);
console.log("userInfo", wx.getStorageSync("userInfo")) console.log("userInfo", wx.getStorageSync("userInfo"))