diff --git a/Infrastructure/Model/SendEmailDto.cs b/Infrastructure/Model/SendEmailDto.cs
new file mode 100644
index 0000000..749bbb8
--- /dev/null
+++ b/Infrastructure/Model/SendEmailDto.cs
@@ -0,0 +1,18 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace Infrastructure.Model
+{
+ public class SendEmailDto
+ {
+ public string FileUrl { get; set; } = "";
+ public string Subject { get; set; }
+ public string ToUser { get; set; }
+ public string Content { get; set; } = "";
+ public string HtmlContent { get; set; }
+ public DateTime AddTime { get; set; }
+ }
+}
diff --git a/ZR.Common/MailHelper.cs b/ZR.Common/MailHelper.cs
new file mode 100644
index 0000000..c5299a2
--- /dev/null
+++ b/ZR.Common/MailHelper.cs
@@ -0,0 +1,165 @@
+using MailKit.Net.Smtp;
+using MimeKit;
+using MimeKit.Text;
+using System;
+using System.Collections.Generic;
+using System.IO;
+
+namespace ZR.Common
+{
+ public class MailHelper
+ {
+ ///
+ /// 发送人邮箱
+ ///
+ public string FromEmail { get; set; } = "";
+ ///
+ /// 发送人密码
+ ///
+ public string FromPwd { get; set; } = "";
+ ///
+ /// 发送协议
+ ///
+ public string Smtp { get; set; } = "smtp.qq.com";
+ ///
+ /// 协议端口
+ ///
+ public int Port { get; set; } = 587;
+ ///
+ /// 是否使用SSL协议
+ ///
+ public bool UseSsl { get; set; } = false;
+ public string mailSign = @"";
+
+ public MailHelper(string fromEmail, string smtp, int port, string fromPwd)
+ {
+ FromEmail = fromEmail;
+ Smtp = smtp;
+ FromPwd = fromPwd;
+ Port = port;
+ }
+
+ public MailHelper(string fromEmail, string fromPwd)
+ {
+ FromEmail = fromEmail;
+ FromPwd = fromPwd;
+ }
+
+ ///
+ /// 发送一个人
+ ///
+ ///
+ ///
+ ///
+ ///
+ public void SendMail(string toAddress, string subject, string text, string path = "", string html = "")
+ {
+ IEnumerable mailboxes = new List() {
+ new MailboxAddress(toAddress)
+ };
+
+ SendMail(mailboxes, subject, text, path, html);
+ }
+
+ ///
+ /// 发送多个邮箱
+ ///
+ ///
+ ///
+ ///
+ ///
+ public void SendMail(string[] toAddress, string subject, string text, string path = "", string html = "")
+ {
+ IList mailboxes = new List() { };
+ foreach (var item in toAddress)
+ {
+ mailboxes.Add(new MailboxAddress(item));
+ }
+
+ SendMail(mailboxes, subject, text, path, html);
+ }
+
+ ///
+ /// 发送邮件
+ ///
+ ///
+ ///
+ ///
+ ///
+ /// 附件url地址
+ private void SendMail(IEnumerable toAddress, string subject, string text, string path = "", string html = "")
+ {
+ MimeMessage message = new MimeMessage();
+ //发件人
+ message.From.Add(new MailboxAddress(FromEmail, FromEmail));
+
+ //收件人
+ //message.To.Add(new MailboxAddress(toAddress));
+ //IList internets = null;
+ //internets.Add(new MailboxAddress(toAddress));
+
+ message.To.AddRange(toAddress);
+ message.Subject = subject;
+ message.Date = DateTime.Now;
+
+ //创建附件Multipart
+ Multipart multipart = new Multipart("mixed");
+
+ //html内容
+ if (!string.IsNullOrEmpty(html))
+ {
+ var Html = new TextPart(TextFormat.Html)
+ {
+ Text = html
+ };
+ multipart.Add(Html);
+ }
+ //文本内容
+ if (!string.IsNullOrEmpty(text))
+ {
+ var plain = new TextPart(TextFormat.Plain)
+ {
+ Text = text + "\r\n\n\n" + mailSign
+ };
+ multipart.Add(plain);
+ }
+
+ //附件
+ if (!string.IsNullOrEmpty(path))
+ {
+ MimePart attachment = new MimePart()
+ {
+ Content = new MimeContent(File.OpenRead(path), ContentEncoding.Default),
+ //读取文件,只能用绝对路径
+ ContentDisposition = new ContentDisposition(ContentDisposition.Attachment),
+ ContentTransferEncoding = ContentEncoding.Base64,
+ //文件名字
+ FileName = Path.GetFileName(path)
+ };
+ multipart.Add(attachment);
+ }
+
+ //赋值邮件内容
+ message.Body = multipart;
+
+ //开始发送
+ using (var client = new SmtpClient())
+ {
+ client.ServerCertificateValidationCallback = (s, c, h, e) => true;
+
+ //Smtp服务器
+ //client.Connect("smtp.qq.com", 587, false);
+ client.Connect(Smtp, Port, true);
+ //登录,发送
+ //特别说明,对于服务器端的中文相应,Exception中有编码问题,显示乱码了
+ client.Authenticate(FromEmail, FromPwd);
+
+ client.Send(message);
+ //断开
+ client.Disconnect(true);
+ Console.WriteLine($"发送邮件成功{DateTime.Now}");
+ }
+ }
+
+ }
+}
\ No newline at end of file
diff --git a/ZR.Vue/src/views/system/file/index.vue b/ZR.Vue/src/views/tool/file/index.vue
similarity index 84%
rename from ZR.Vue/src/views/system/file/index.vue
rename to ZR.Vue/src/views/tool/file/index.vue
index 86d6824..ef152d8 100644
--- a/ZR.Vue/src/views/system/file/index.vue
+++ b/ZR.Vue/src/views/tool/file/index.vue
@@ -43,16 +43,6 @@
-
-
-
-
-
-
-
-
-
-
@@ -108,20 +98,10 @@ export default {
dictLabel: "本地",
},
],
- uploadUrl: process.env.VUE_APP_BASE_API + "/upload/SaveFile?token=zr",
+ uploadUrl: process.env.VUE_APP_BASE_API + "/upload/SaveFile",
// 数据列表
dataList: [
- {
- id: 1,
- photo:
- "https://ss1.baidu.com/-4o3dSag_xI4khGko9WTAnF6hhy/zhidao/pic/item/d788d43f8794a4c2b124d0000df41bd5ad6e3991.jpg",
- name: "你好",
- userId: 1000001,
- sortId: 1,
- address: "浙江省杭州市西湖区",
- content: "我是一个超长超长的文字啊",
- addtime: "2021-8-7 23:00:00",
- },
+
],
// 总记录数
total: 0,
@@ -129,8 +109,6 @@ export default {
btnSubmitVisible: true,
// 表单校验
rules: {
- name: [{ required: true, message: "名称不能为空", trigger: "blur" }],
- userId: [{ required: true, message: "id不能为空", trigger: "blur" }],
},
};
},
@@ -223,14 +201,9 @@ export default {
this.title = "详情";
// TODO 给表单赋值
this.form = {
- content: row.content,
- userId: row.userId,
- name: row.name,
- sortId: row.sortId,
+
};
},
- handleImport() {},
- handleExport() {},
},
};
diff --git a/ZR.Vue/src/views/tool/gen/index.vue b/ZR.Vue/src/views/tool/gen/index.vue
index 77f0796..cbdba71 100644
--- a/ZR.Vue/src/views/tool/gen/index.vue
+++ b/ZR.Vue/src/views/tool/gen/index.vue
@@ -16,7 +16,7 @@
导入
- 删除
+ 删除
@@ -33,9 +33,9 @@
- 预览
- 编辑
- 删除
+ 预览
+ 编辑
+ 删除
生成代码
diff --git a/document/admin-mysql.sql b/document/admin-mysql.sql
index 720e652..4ec413d 100644
--- a/document/admin-mysql.sql
+++ b/document/admin-mysql.sql
@@ -251,7 +251,7 @@ INSERT INTO sys_menu VALUES (103, '部门管理', 1, 4, 'dept', 'system/dept/ind
INSERT INTO sys_menu VALUES (104, '岗位管理', 1, 5, 'post', 'system/post/index', 0, 0, 'C', '0', '0', 'system:post:list', 'post', '', SYSDATE(), '', NULL, '岗位管理菜单');
INSERT INTO sys_menu VALUES (108, '日志管理', 1, 9, 'log', '', 0, 0, 'M', '0', '0', '', 'log', '', SYSDATE(), '', NULL, '日志管理菜单');
INSERT INTO sys_menu VALUES (105, '字典管理', 1, 5, 'dict', 'system/dict/index', 0, 0, 'C', '0', '0', 'system:dict:list', 'dict', '', SYSDATE(), '', NULL, '');
-INSERT INTO sys_menu VALUES (106, '分配用户', 1, 3, 'roleusers', 'system/roleusers/index', 0, 0, 'C', '0', '0', 'system:role:list', 'people', '', SYSDATE(), '', NULL, NULL);
+INSERT INTO sys_menu VALUES (106, '权限分配', 1, 3, 'roleusers', 'system/roleusers/index', 0, 0, 'C', '0', '0', 'system:role:list', 'people', '', SYSDATE(), '', NULL, NULL);
-- 一级菜单 缓存监控
INSERT INTO sys_menu VALUES (113, '缓存监控', 2, 5, 'cache', 'monitor/cache/index', 0, 0, 'C', '1', '1', 'monitor:cache:list', 'redis', '', SYSDATE(), '', NULL, '缓存监控菜单');
@@ -260,8 +260,7 @@ INSERT INTO sys_menu VALUES (113, '缓存监控', 2, 5, 'cache', 'monitor/cache/
INSERT INTO sys_menu VALUES (114, '表单构建', 3, 1, 'build', 'tool/build/index', 0, 0, 'C', '0', '0', 'tool:build:list', 'build', '', SYSDATE(), '', NULL, '表单构建菜单');
INSERT INTO sys_menu VALUES (115, '代码生成', 3, 1, 'gen', 'tool/gen/index', 0, 0, 'C', '0', '0', 'tool:gen:list', 'code', '', SYSDATE(), '', NULL, '代码生成菜单');
INSERT INTO sys_menu VALUES (116, '系统接口', 3, 3, 'swagger', 'tool/swagger/index', 0, 0, 'C', '0', '0', 'tool:swagger:list', 'swagger', '', SYSDATE(), '', NULL, '系统接口菜单');
-INSERT INTO sys_menu VALUES (117, '编辑表格', 3, 3, 'editTable', 'tool/gen/editTable', 0, 0, 'C', '1', '0', 'tool:gen:edittable', '', '', SYSDATE(), '', NULL, '代码生成编辑表格菜单');
-
+INSERT INTO sys_menu VALUES (117, '发送邮件', 3, 4, '/sendEmail', 'tool/email/sendEmail', 0, 0, 'C', '0', '0', 'tool:email:send', 'message', '', GETDATE(), '', NULL, '发送邮件菜单');
-- 日志管理
INSERT INTO sys_menu VALUES (500, '操作日志', 108, 1, 'operlog', 'monitor/operlog/index', 0, 0, 'C', '0', '0', 'monitor:operlog:list', 'form', '', SYSDATE(), '', NULL, '操作日志菜单');
@@ -324,6 +323,13 @@ INSERT INTO sys_menu VALUES (2062, '新增', 2057, 1, '#', NULL, 0, 0, 'F', '0',
INSERT INTO sys_menu VALUES (2063, '修改', 2057, 2, '#', NULL, 0, 0, 'F', '0', '0', 'system:article:update', '', '', SYSDATE(), '', NULL, NULL);
INSERT INTO sys_menu VALUES (2064, '删除', 2057, 3, '#', NULL, 0, 0, 'F', '0', '0', 'system:article:delete', '', '', SYSDATE(), '', NULL, NULL);
+--代码生成页面权限
+INSERT INTO sys_menu(menuId, menuName, parentId, orderNum, path, component, isFrame, isCache, menuType, visible, status, perms, icon, create_by,create_time) VALUES (2070, '编辑', 115, 1, '#', NULL, 0, 0, 'F', '0', '0', 'tool:ten:edit', '', '', GETDATE());
+INSERT INTO sys_menu(menuId, menuName, parentId, orderNum, path, component, isFrame, isCache, menuType, visible, status, perms, icon, create_by,create_time) VALUES (2071, '预览', 115, 1, '#', NULL, 0, 0, 'F', '0', '0', 'tool:ten:preview', '', '', GETDATE());
+INSERT INTO sys_menu(menuId, menuName, parentId, orderNum, path, component, isFrame, isCache, menuType, visible, status, perms, icon, create_by,create_time) VALUES (2072, '删除', 115, 1, '#', NULL, 0, 0, 'F', '0', '0', 'tool:ten:remove', '', '', GETDATE());
+INSERT INTO sys_menu(menuId, menuName, parentId, orderNum, path, component, isFrame, isCache, menuType, visible, status, perms, icon, create_by,create_time) VALUES (2073, '导入', 115, 1, '#', NULL, 0, 0, 'F', '0', '0', 'tool:ten:import', '', '', GETDATE());
+INSERT INTO sys_menu(menuId, menuName, parentId, orderNum, path, component, isFrame, isCache, menuType, visible, status, perms, icon, create_by,create_time) VALUES (2074, '生成代码', 115, 1, '#', NULL, 0, 0, 'F', '0', '0', 'tool:ten:code', '', '', GETDATE());
+
-- ----------------------------
-- Table structure for sys_oper_log
diff --git a/document/admin-sqlserver.sql b/document/admin-sqlserver.sql
index 28ac3d6..1dc23ef 100644
Binary files a/document/admin-sqlserver.sql and b/document/admin-sqlserver.sql differ