diff --git "a/\345\210\230\345\256\211\347\246\217/note-000-00-00-\345\205\266\345\256\203.md" "b/\345\210\230\345\256\211\347\246\217/note-000-00-00-\345\205\266\345\256\203.md"
index 672a95a21ec737e821e1559da18d1553ac18375a..ca1b263573787efc5dab816409b09a9f6ecb2d54 100644
--- "a/\345\210\230\345\256\211\347\246\217/note-000-00-00-\345\205\266\345\256\203.md"
+++ "b/\345\210\230\345\256\211\347\246\217/note-000-00-00-\345\205\266\345\256\203.md"
@@ -19,4 +19,29 @@
```
```
-# [git回到之前的某一个提交版本]https://blog.csdn.net/qq_30669833/article/details/105422803
\ No newline at end of file
+# [git回到之前的某一个提交版本]https://blog.csdn.net/qq_30669833/article/details/105422803
+
+## 今日份想问的点
+```
+在做审计日志的时候[Authorize]一定要关闭吗
+
+在新增用户的时候为了查看是否生成 使用[AllowAnonymous]可以吗
+
+```
+
+## 种子数据
+https://docs.microsoft.com/zh-cn/ef/core/modeling/data-seeding
+
+https://blog.csdn.net/weixin_30666943/article/details/95914969
+
+https://blog.csdn.net/weixin_41372626/article/details/105312765
+
+## [添加、修改、删除、查看本地git的用户名和邮箱](https://blog.csdn.net/weixin_46652769/article/details/108028372?utm_term=git%E5%88%A0%E9%99%A4%E9%85%8D%E7%BD%AE%E7%9A%84%E7%94%A8%E6%88%B7%E5%92%8C%E9%82%AE%E7%AE%B1&utm_medium=distribute.pc_aggpage_search_result.none-task-blog-2~all~sobaiduweb~default-2-108028372&spm=3001.4430)
+
+## [配色表](http://tool.c7sky.com/webcolor/#character_6)
+## [给你颜色](https://www.zhihu.com/question/46535237/answer/720174652)
+## [90设计](http://90sheji.com/tupian/default/3.html?skid_3=30&page=7)
+
+## [设置图片旋转](https://www.w3school.com.cn/cssref/pr_animation.asp)
+## [设置图片旋转](https://www.cnblogs.com/zhangcheng001/p/10949191.html)
+## [设置图片旋转](https://blog.csdn.net/qq_23663693/article/details/108101145)
\ No newline at end of file
diff --git "a/\345\210\230\345\256\211\347\246\217/note-2021-07-06-001.md" "b/\345\210\230\345\256\211\347\246\217/note-2021-07-06-001.md"
index 05f8a1e7fed612038495873aa0d743e5b44201a2..cad3839569ff6dd84ba4ab7f5e931cc3718f8092 100644
--- "a/\345\210\230\345\256\211\347\246\217/note-2021-07-06-001.md"
+++ "b/\345\210\230\345\256\211\347\246\217/note-2021-07-06-001.md"
@@ -1,9 +1,11 @@
# 滂沱大雨
-## 克隆项目之后 需要记住(做)的三步骤
+## 克隆项目之后 需要记住(做)的四步骤
```
开服务 : 开启数据库服务
+修复 :dotnet restore
+
装工具 :dotnet tool install --global dotnet-ef
更新数据库: dotnet ef database update (需要进入到项目中)
@@ -130,7 +132,8 @@ namespace Admin3000.Backend.Api.Params
};
}
- var token = TokenHelper.GenerateToekn(_tokenParameter, username);
+ var user = _usersRepository.Table.Where(x => x.Username == username).FirstOrDefault();
+ var token = TokenHelper.GenerateToekn(_tokenParameter, user);
var refreshToken = "112358";
diff --git "a/\345\210\230\345\256\211\347\246\217/note-2021-07-08-001.md" "b/\345\210\230\345\256\211\347\246\217/note-2021-07-08-001.md"
index 2a7b421068ac7a5ba627f09ed53116f21221ada0..0ae719a23c308c83d2885e8693a24c86671ea805 100644
--- "a/\345\210\230\345\256\211\347\246\217/note-2021-07-08-001.md"
+++ "b/\345\210\230\345\256\211\347\246\217/note-2021-07-08-001.md"
@@ -82,3 +82,179 @@ namespace Admin3000.Backend.Api.Entity
该内容为实现审计日志功能主要逻辑,通过过滤器获取当前执行控制器、方法判断是否需要记录审计日志;
其他请求参数、客户端ip等相关基本信息组成审计日志对象,并记录调用时间。
```
++ 在项目中添加Filters文件夹并新建文件AuditLogActionFilter.cs
+```
+
+using System;
+using System.Diagnostics;
+using System.Reflection;
+using System.Threading.Tasks;
+using Admin3000.Backend.Api.Entity;
+using Admin3000.Backend.Api.Repository;
+using Microsoft.AspNetCore.Http;
+using Microsoft.AspNetCore.Mvc;
+using Microsoft.AspNetCore.Mvc.Controllers;
+using Microsoft.AspNetCore.Mvc.Filters;
+using Microsoft.Extensions.Logging;
+using Newtonsoft.Json;
+
+namespace Admin3000.Backend.Api.Filters
+{
+ public class AuditLogActionFilter : IAsyncActionFilter
+ {
+ ///
+ /// 登录用户
+ ///
+ // private readonly ISession _Session;
+ ///
+ /// 日志记录
+ ///
+ private readonly ILogger _logger;
+ private readonly IRepository _auditLogService;
+
+ public AuditLogActionFilter(
+ // ISession Session,
+ ILogger logger,
+ IRepository auditLogService
+
+ )
+ {
+ // _Session = Session;
+ _logger = logger;
+ _auditLogService=auditLogService;
+ }
+
+ public async Task OnActionExecutionAsync(ActionExecutingContext context, ActionExecutionDelegate next)
+ {
+ // 判断是否写日志
+ if (!ShouldSaveAudit(context))
+ {
+ await next();
+ return;
+ }
+ //接口Type
+ var type = (context.ActionDescriptor as ControllerActionDescriptor).ControllerTypeInfo.AsType();
+ //方法信息
+ var method = (context.ActionDescriptor as ControllerActionDescriptor).MethodInfo;
+ //方法参数
+ var arguments = context.ActionArguments;
+ //开始计时
+ var stopwatch = Stopwatch.StartNew();
+ var auditInfo = new AuditInfo
+ {
+ // UserInfo = _Session?.Id,
+ UserInfo = 1.ToString(),
+ ServiceName = type != null ? type.FullName : "",
+ MethodName = method.Name,
+ ////请求参数转Json
+ Parameters = JsonConvert.SerializeObject(arguments),
+ ExecutionTime = DateTime.Now,
+ BrowserInfo = context.HttpContext.Request.Headers["User-Agent"].ToString(),
+ ClientIpAddress = context.HttpContext.Connection.RemoteIpAddress.ToString(),
+ //ClientName = _clientInfoProvider.ComputerName.TruncateWithPostfix(EntityDefault.FieldsLength100),
+ // Id = Guid.NewGuid().ToString()
+ };
+
+ ActionExecutedContext result = null;
+ try
+ {
+ result = await next();
+ if (result.Exception != null && !result.ExceptionHandled)
+ {
+ auditInfo.Exception = result.Exception.ToString();
+ }
+ }
+ catch (Exception ex)
+ {
+ auditInfo.Exception = ex.ToString();
+ throw;
+ }
+ finally
+ {
+ stopwatch.Stop();
+ auditInfo.ExecutionDuration = Convert.ToInt32(stopwatch.Elapsed.TotalMilliseconds);
+
+ if (result != null)
+ {
+ switch (result.Result)
+ {
+ case ObjectResult objectResult:
+ auditInfo.ReturnValue = JsonConvert.SerializeObject(objectResult.Value);
+ break;
+
+ case JsonResult jsonResult:
+ auditInfo.ReturnValue = JsonConvert.SerializeObject(jsonResult.Value);
+ break;
+
+ case ContentResult contentResult:
+ auditInfo.ReturnValue = contentResult.Content;
+ break;
+ }
+ }
+ Console.WriteLine(auditInfo.ToString());
+ //保存审计日志
+ await _auditLogService.InsertAsync(auditInfo);
+ }
+ }
+
+ ///
+ /// 是否需要记录审计
+ ///
+ ///
+ ///
+ private bool ShouldSaveAudit(ActionExecutingContext context)
+ {
+ if (!(context.ActionDescriptor is ControllerActionDescriptor))
+ return false;
+ var methodInfo = (context.ActionDescriptor as ControllerActionDescriptor).MethodInfo;
+
+ if (methodInfo == null)
+ {
+ return false;
+ }
+
+ if (!methodInfo.IsPublic)
+ {
+ return false;
+ }
+
+ // if (methodInfo.GetCustomAttribute() != null)
+ // {
+ // return true;
+ // }
+
+ // if (methodInfo.GetCustomAttribute() != null)
+ // {
+ // return false;
+ // }
+
+ // var classType = methodInfo.DeclaringType;
+ // if (classType != null)
+ // {
+ // if (classType.GetTypeInfo().GetCustomAttribute() != null)
+ // {
+ // return true;
+ // }
+
+ // if (classType.GetTypeInfo().GetCustomAttribute() != null)
+ // {
+ // return false;
+ // }
+ // }
+ return true;
+ }
+
+ }
+}
+```
+#### 注册过滤器
++ 在Startup.cs中 将services.AddControllers()修改为以下形式
+```
+ services.AddControllers(options =>
+ {
+ options.Filters.Add(typeof(AuditLogActionFilter));
+ });
+
+```
++ 去 .http 文件中操作几下
++ 最后去数据库中查看AuditInfo相关的表 有数据就证明成功了
\ No newline at end of file
diff --git "a/\345\210\230\345\256\211\347\246\217/note-2021-07-09-001.md" "b/\345\210\230\345\256\211\347\246\217/note-2021-07-09-001.md"
new file mode 100644
index 0000000000000000000000000000000000000000..ce4ad534006c31721dddbe3d22b83e9ff198d01f
--- /dev/null
+++ "b/\345\210\230\345\256\211\347\246\217/note-2021-07-09-001.md"
@@ -0,0 +1,47 @@
+# [添加种子数据配合文档食用更香](https://docs.microsoft.com/zh-cn/ef/core/modeling/data-seeding)
+
+### [git 文档](https://gitee.com/mirrors_dotnet/EntityFramework.Docs/tree/main/samples/core/Modeling/DataSeeding)
+
+#### 在数据库上下文中添加一个初始化逻辑
+
+- 也就是 Admin3000Db.cs 文件中
+
+```
+
+ public DbSet Users { get; set; } //这行如果之前有可以不用
+
+ protected override void OnModelCreating(ModelBuilder modelBuilder)
+ {
+ modelBuilder.Entity(entity => { entity.Property(e => e.Username).IsRequired(); });
+
+ //以下就是添加的种子数据(根据你添加的表的字段来)注: Id虽然设置是自增长但是在初始化的时候还是要赋值上去
+
+ #region UsersSeed //#region+#endregion 该段内容可折叠
+ modelBuilder.Entity().HasData(
+ new Users
+ {
+ Id = 1,
+ Username = "admin",
+ Password = "113",
+ IsActived = true,
+ IsDeleted = false,
+ CreatedTime = DateTime.Now,
+ UpdatedTime = DateTime.Now,
+ Remarks = "种子数据",
+ DisplayOrder = 0
+
+ });
+ #endregion
+
+ }
+
+```
+
+- 使用数据迁移和数据更新
+
+```
+ dotnet ef migrations add 添加种子数据
+ dotnet ef database update
+```
+
+- 最后去数据库查看就生成了种子数据
diff --git "a/\345\210\230\345\256\211\347\246\217/note-2021-07-09-002.md" "b/\345\210\230\345\256\211\347\246\217/note-2021-07-09-002.md"
new file mode 100644
index 0000000000000000000000000000000000000000..742e15e416eb04098e30bc4479257a45f3b63189
--- /dev/null
+++ "b/\345\210\230\345\256\211\347\246\217/note-2021-07-09-002.md"
@@ -0,0 +1,240 @@
+# 安装Vue脚手架并且封装路由
+[可配合20210605笔记食用](./note-2021-06-08-001.md)
+### 前置
++ 1. 将npm的镜像替换成淘宝镜像
+```
+npm config set registry http://registry.npm.taobao.org
+```
++ 2. 安装yarn的包管理器 已经有了可以跳过
+```
+npm install -g yarn
+```
++ 3. 新建一个全小写的英文文件夹
+### 安装
++ 使用npm安装和yarn安装都可以 区别是npm安装较慢;
++ yarn安装相对快 但是需要手动配置电脑的环境变量
+[如何配置yarn的环境变量](https://blog.csdn.net/wyf521995/article/details/102885887)
+```
+npm install -g @vue/cli
+# OR
+yarn global add @vue/cli
+```
++ 安装完成之后
+ - vue --version 出现vue版本号即安装成功
+ - vue 出现vue的相关提示命令即可
+```
+vue --version
+# OR
+vue
+```
+--------
+### 创建一个项目
++ xxx带表文件名要求全小写我这里是 admin3000.frontend
+```
+vue create xxx
+```
++ 这边选择的是Vue2 所以默认就行
+```
+? Please pick a preset: (Use arrow keys)
+> Default ([Vue 2] babel, eslint)
+ Default (Vue 3) ([Vue 3] babel, eslint)
+ Manually select features
+```
++ 选择包管理器 这里选用的是 yarn 包管理器
+ - 当你有多个包管理器的时候 才会出现选择否则就是默认的包管理器
+```
+? Please pick a preset: Default ([Vue 2] babel, eslint)
+? Pick the package manager to use when installing dependencies: (Use arrow keys)
+> Use Yarn
+ Use NPM
+```
+### 然后等待安装
++ 当出现提示进入文件夹和运行时就成功了
+```
+$ cd admin3000.frontend
+$ yarn serve
+```
+-------
+## 封装路由
++ 首先添加路由
+```
+yarn add vue-router
+```
++ 1. 若成功package.json中的dependencies下会多一个
+```
+ "vue-router": "^3.5.2"
+
+```
++ 2. 若失败 [解决办法](https://blog.csdn.net/wmmhwj/article/details/64444593?locationnum=8&fps=1)
+ - error Received malformed response from registry for "vue-router". The registry may be down.
+```
+npm config set registry https://registry.npm.taobao.org
+
+npm config set disturl https://npm.taobao.org/dist
+```
++ 装个插件 Vetur
+------------
+#### 在main.js 中定义路由
+```
+import Vue from 'vue'
+import App from './App.vue'
+import VueRouter from 'vue-router'
+import HelloWorld from './components/HelloWorld'
+
+Vue.config.productionTip = false
+
+let router = new VueRouter({
+ mode: "history",
+ routes: [
+ {
+ path: '/home',//请求路径
+ component: HelloWorld//加载组件
+ },
+ ],
+})
+
+new Vue({
+ router,
+ render: (h) => h(App),
+}).$mount('#app')
+
+```
+#### 在components中添加一个Home.vue
++ Home.js
+```
+
+
+ Home wodejia
+
+
+
+
+
+
+```
+
++ 修改main.js中的路由为首页显示内容为Home
+```
+import Vue from 'vue'
+import App from './App.vue'
+import VueRouter from 'vue-router'
+// import HelloWorld from './components/HelloWorld'
+import Home from './components/Home'
+
+Vue.config.productionTip = false
+Vue.use(VueRouter) //千万记得要注册
+let router = new VueRouter({
+ mode: "history",
+ routes: [
+ {
+ path: '/',//请求路径
+ component: Home//加载组件
+ },
+ ],
+})
+
+new Vue({
+ router,
+ render: (h) => h(App),
+}).$mount('#app')
+
+```
++ 然后就可以 yarn serve 运行看效果了
+
+### 开始封装
+- 在src文件夹下新建一个router的文件
+ + 新建一个index.js的文件 在这里注册路由
+ + 新建一个rotes.js的文件 在这里定义路由
+- index.js
+```
+import Vue from "vue";
+import VueRouter from "vue-router";
+import routes from './routes'
+
+Vue.use(VueRouter)
+
+let router = new VueRouter({
+ mode:"history",
+ routes
+})
+
+export default router
+```
+- router.js
+```
+//引入所需组件库
+import Vue from "vue";
+import VueRouter from "vue-router";
+import routes from './routes'
+
+//全局注册路由中间件
+Vue.use(VueRouter)
+
+//注册路由实例,并且提供路由的模式和路由定义
+let router = new VueRouter({
+ mode:"history",
+ routes
+})
+
+//暴露路由实例
+export default router
+```
++ 在main.js中修改或引用封装的路由 即可
+```
+import Vue from 'vue'
+import App from './App.vue'
+import router from './router'
+
+Vue.config.productionTip = false
+
+
+new Vue({
+ router,
+ render: (h) => h(App),
+}).$mount('#app')
+
+```
++ 运行成功且显示和上次一样的页面就可以了
+
+### 新添加路由
+- 此时添加路由只需要在routes.js中添加就可以了
+ + 首先要去components文件夹中添加你的组件
+ + 添加组件库 然后添加routes 例如我添加了一个Users
+ + 然后 yarn serve 运行 访问Users 就可以显示内容了 前提是你的组件里敲了内容
+```
+import Home from '../components/Home'
+
+import Users from '../components/Users'//这就是我添加的组件
+let routes = [
+ {
+ path: '/',//请求路径
+ component: Home//加载组件
+ },
+ {
+ path: '/users',//请求路径
+ component: Users//加载组件
+ }
+]
+export default routes
+```
++ 引用组件库的另一种方法 异步加载组件
+ - 不需要import 直接写在component后面即可
+```
+ component: ()=>import("../components/Users")//异步加载组件
+
+```
+
+## 失手
+```
+ 记得注册路由
+ Vue.use(VueRouter)
+
+ mode:"history", history得加上引号
+
+```
\ No newline at end of file
diff --git "a/\345\210\230\345\256\211\347\246\217/note-2021-07-10-001.md" "b/\345\210\230\345\256\211\347\246\217/note-2021-07-10-001.md"
new file mode 100644
index 0000000000000000000000000000000000000000..c01445c8c4e9a68fb9fa5ed0793e8ef94acfe4b0
--- /dev/null
+++ "b/\345\210\230\345\256\211\347\246\217/note-2021-07-10-001.md"
@@ -0,0 +1,111 @@
+# 使用elementui 制作后端管理界面
+# [Elementui官方文档](https://element.eleme.io/#/zh-CN/component/installation)
+### 安装
+```
+yarn add element-ui
+```
++ 然后再main.js中引入
+```
+import ElementUI from 'element-ui';
+import 'element-ui/lib/theme-chalk/index.css';
+
+Vue.use(ElementUI)
+```
+完整main.js
+```
+import Vue from 'vue'
+import App from './App.vue'
+import router from './router'
+import ElementUI from 'element-ui';
+import 'element-ui/lib/theme-chalk/index.css';
+
+Vue.config.productionTip = false
+
+Vue.use(ElementUI)
+
+
+new Vue({
+ router,
+ render: (h) => h(App),
+}).$mount('#app')
+
+```
++ 在conponts注册一个Layout.vue
+ - 同时也要去routes里面去新添路由
+
++ routes.js
+```
+import Home from '../components/Home'
+import Users from '../components/Users'
+import Layout from '../components/Layout'
+let routes = [
+ {
+ path: '/',//请求路径
+ component: Home//显示的内容
+ },
+ {
+ path: '/users',//请求路径
+ component: Users//显示的内容
+ },
+ {
+ path:'/layout',
+ component:Layout
+ }
+]
+
+export default routes
+```
++ Layout.vue 我是从官方文档添加了一个[布局容器](https://element.eleme.io/#/zh-CN/component/container)
+```
+
+
+ 左侧菜单
+
+ 头
+ 内容
+ 底部
+
+
+
+
+
+
+
+```
+# 剩下的就是从官方文档中完成自己的后台界面了
\ No newline at end of file
diff --git "a/\345\210\230\345\256\211\347\246\217/note-2021-07-16-001.md" "b/\345\210\230\345\256\211\347\246\217/note-2021-07-16-001.md"
new file mode 100644
index 0000000000000000000000000000000000000000..123a375f40bc883f54a244f08b751f8cca6652c3
--- /dev/null
+++ "b/\345\210\230\345\256\211\347\246\217/note-2021-07-16-001.md"
@@ -0,0 +1,99 @@
+# 柒月拾陸日
+## 白天有太阳据说会下雨
+-------
+
+# 重定向
+```
+redirect:{path:('/dashborad')},
+children: [
+ {
+ path: 'dashborad',//请求路径
+ component: ()=>import('../views/dashborad'),//显示的内容
+ title:'仪表盘',
+ }
+]
+```
+# 改变左边图标风格
+- 添加一个本身的属性
+```
+ meta:{
+ title:'xxx',
+ icon:'xxx',
+ },
+```
+- NavbarItem.vue遍历meta.icon
+# [收缩时隐藏文字](https://blog.csdn.net/pangji0417/article/details/93353327)
+```
+#OR
+/*隐藏文字*/
+.el-menu--collapse .el-submenu__title span{
+ display: none;
+}
+/*隐藏 > */
+/* 通常是要自己去找到图标所在的class 前提是
+```
\ No newline at end of file
diff --git "a/\345\210\230\345\256\211\347\246\217/note-2021-07-16-002.md" "b/\345\210\230\345\256\211\347\246\217/note-2021-07-16-002.md"
new file mode 100644
index 0000000000000000000000000000000000000000..92aedbac29ff227082349f244485090cb55c529e
--- /dev/null
+++ "b/\345\210\230\345\256\211\347\246\217/note-2021-07-16-002.md"
@@ -0,0 +1,72 @@
+# [axios官方文档](http://www.axios-js.com/zh-cn/docs/)
+## 添加相关的包
+```
+yarn add axios
+#OR
+npm install axios
+
+```
+## 使用axios
+- 在src文件夹中添加一个utils工具文件夹
+ + 添加一个request.js文件
+ ```
+ import axios from "axios"
+
+ const instance = axios.create({
+ baseURL: 'http://localhost:5000/',
+ timeout: 3000,
+ });
+
+ export default instance
+ ```
+- 在src文件夹中添加一个api文件夹
+ + 添加一个users.js文件来获取Id
+ ```
+ import request from "../utils/request"
+
+ export function getById(id) {
+ return request.get(`/users/${id}`)
+ }
+ ```
+- 在views文件夹中的users.vue中
+ + 在JS中引入
+ ```
+ import { getById } from "../api/users";
+ ```
+ + 在生命周期函数mounted中添加
+ ```
+ mounted() {
+
+ getById(1)
+ .then((res) => {
+ console.log(res);
+ })
+ .catch((err) => {
+ console.log(err);
+ });
+ },
+ ```
+- 运行后端与前端 刷新网页 控制器中会打印出res 然后会出现跨域问题
+
+# [解决跨域问题](https://blog.csdn.net/guyang1995/article/details/105833057/)(在后端解决)
+- 在Starup.cs中
+ + class Starup 下添加
+ ```
+ private readonly string _allowCors = "AllowAllCors";
+ ```
+ + 在ConfigureServices中添加
+ ```
+ services.AddCors(options =>
+ {
+ options.AddPolicy(_allowCors,
+ builder => builder.AllowAnyHeader()
+ .AllowAnyMethod()
+ .AllowAnyOrigin());
+ });
+ ```
+ + 在Configure中app.UseEndpoints之上
+ ```
+ //跨域
+ app.UseCors(_allowCors);
+
+ ```