From 7000df9ad59627e69fb4e79591f1123b476a6f90 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BC=A0=E5=BF=97=E9=91=AB?= <2030875622@qq.com> Date: Sun, 4 Jan 2026 14:43:43 +0000 Subject: [PATCH 1/6] =?UTF-8?q?add=20=E5=BC=A0=E5=BF=97=E9=91=AB.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 张志鑫 <2030875622@qq.com> --- "\345\274\240\345\277\227\351\221\253" | 0 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 "\345\274\240\345\277\227\351\221\253" diff --git "a/\345\274\240\345\277\227\351\221\253" "b/\345\274\240\345\277\227\351\221\253" new file mode 100644 index 0000000..e69de29 -- Gitee From ffdad30a00c7ed267ca2522af682a0e501465c91 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BC=A0=E5=BF=97=E9=91=AB?= <2030875622@qq.com> Date: Sun, 4 Jan 2026 14:44:02 +0000 Subject: [PATCH 2/6] =?UTF-8?q?=E5=88=A0=E9=99=A4=E6=96=87=E4=BB=B6=20?= =?UTF-8?q?=E5=BC=A0=E5=BF=97=E9=91=AB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- "\345\274\240\345\277\227\351\221\253" | 0 1 file changed, 0 insertions(+), 0 deletions(-) delete mode 100644 "\345\274\240\345\277\227\351\221\253" diff --git "a/\345\274\240\345\277\227\351\221\253" "b/\345\274\240\345\277\227\351\221\253" deleted file mode 100644 index e69de29..0000000 -- Gitee From 1c984b1c1e2d34f583478781f8a00e4d15e770f7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BC=A0=E5=BF=97=E9=91=AB?= <2030875622@qq.com> Date: Sun, 4 Jan 2026 14:44:28 +0000 Subject: [PATCH 3/6] =?UTF-8?q?=E5=BC=A0=E5=BF=97=E9=91=AB=2005?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 张志鑫 <2030875622@qq.com> --- "\345\274\240\345\277\227\351\221\253" | 0 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 "\345\274\240\345\277\227\351\221\253" diff --git "a/\345\274\240\345\277\227\351\221\253" "b/\345\274\240\345\277\227\351\221\253" new file mode 100644 index 0000000..e69de29 -- Gitee From 21fe8f9943ac7d84649852636a87cf6a6b00c1f1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BC=A0=E5=BF=97=E9=91=AB?= <2030875622@qq.com> Date: Sun, 4 Jan 2026 14:49:50 +0000 Subject: [PATCH 4/6] =?UTF-8?q?=E5=BC=A0=E5=BF=97=E9=91=AB=2005?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 张志鑫 <2030875622@qq.com> --- ...76\350\256\241\346\250\241\345\274\217.md" | 81 +++++++++++++++++++ ...vc\346\216\247\345\210\266\345\231\250.md" | 64 +++++++++++++++ "20260104-mvc\350\267\257\347\224\261.md" | 55 +++++++++++++ 3 files changed, 200 insertions(+) create mode 100644 "20251229-mvc\350\256\276\350\256\241\346\250\241\345\274\217.md" create mode 100644 "20251231-mvc\346\216\247\345\210\266\345\231\250.md" create mode 100644 "20260104-mvc\350\267\257\347\224\261.md" diff --git "a/20251229-mvc\350\256\276\350\256\241\346\250\241\345\274\217.md" "b/20251229-mvc\350\256\276\350\256\241\346\250\241\345\274\217.md" new file mode 100644 index 0000000..18e2ce3 --- /dev/null +++ "b/20251229-mvc\350\256\276\350\256\241\346\250\241\345\274\217.md" @@ -0,0 +1,81 @@ +## 笔记 +设计模式类型 +```bash +- 创建型模式 +-- 工厂模式(Factory Pattern) +-- 抽象工厂模式(Abstract Factory Pattern) +-- 单例模式(Singleton Pattern) +-- 建造者模式(Builder Pattern) +-- 原型模式(Prototype Pattern) +``` +## 练习 + +第一题 +```js +for (let i = 1; i <= 9; i++) { + let row = ""; + for (let j = 1; j <= i; j++) { + row += j + "*" + i + "=" + (i * j) + " "; + } + console.log(row); +} + +``` + +第二题 +```js + +let age = 18; +let status; +status = age >= 18 ? '成年' : '未成年'; +if (age >= 18) { + status = '成年'; +} else { + status = '未成年'; +} + +``` + + +第三题 +```js + +let target = Math.floor(Math.random() * 100) + 1; +let guess = 50; + +if (guess > target) { + console.log("太大"); +} else if (guess < target) { + console.log("太小"); +} else { + console.log("猜对了"); +} + +``` + +第四题 +```js +function findDuplicates(arr) { + let duplicates = []; + for (let i = 0; i < arr.length; i++) { + if (arr.indexOf(arr[i], i + 1) !== -1 && duplicates.indexOf(arr[i]) === -1) { + duplicates.push(arr[i]); + } + } + return duplicates; +} +console.log(findDuplicates([1, 2, 4, 4, 3, 3, 1, 5, 3])); + +``` + +第五题 +```js + +function countOccurrences(arr, item) { + let count = 0; + for (let x of arr) { + if (x === item) count++; + } + return count; +} +console.log(countOccurrences([1, 2, 4, 4, 3, 4, 3], 4)); diff --git "a/20251231-mvc\346\216\247\345\210\266\345\231\250.md" "b/20251231-mvc\346\216\247\345\210\266\345\231\250.md" new file mode 100644 index 0000000..9d23ff9 --- /dev/null +++ "b/20251231-mvc\346\216\247\345\210\266\345\231\250.md" @@ -0,0 +1,64 @@ +## 笔记 +mvc控制器简介 +```bash +MVC 控制器负责响应针对 ASP.NET MVC 网站发出的请求。 每个浏览器请求都映射到特定的控制器。 +``` +mvc控制器操作 +```bash +控制器公开控制器操作。 操作是控制器上的一种方法,当你在浏览器地址栏中输入特定 URL 时,将调用该方法。 +``` +## 练习 + +第一题 +```js + +function mergeArrays(arr1, arr2) { + return arr1.concat(arr2); +} +console.log(mergeArrays([1, 2, 3, 4], ['a', 'b', 'c', 1])); + +``` + +第二题 +```js + +const numbersToSum = [10, 20, 30, 40, 50]; +const totalSum = numbersToSum.reduce((acc, curr) => acc + curr, 0); +console.log(totalSum); + +``` + +第三题 +```js + +const nums = [1, 2, 3, 4, 5, 6, 7, 8, 9]; +const odds = nums.filter(num => num % 2 !== 0); +console.log(odds); + +``` + +第四题 + +```js + +const students = [ + {name: "小明", score: 85}, + {name: "小红", score: 55}, + {name: "小刚", score: 90} +]; + +const passNames = students + .filter(s => s.score >= 60) + .map(s => s.name); + +console.log(passNames); + +``` + +第五题 +```js + +function removeItem(arr, item) { + return arr.filter(x => x !== item); +} +console.log(removeItem([1, 2, 3, 4, 2, 5], 2)); \ No newline at end of file diff --git "a/20260104-mvc\350\267\257\347\224\261.md" "b/20260104-mvc\350\267\257\347\224\261.md" new file mode 100644 index 0000000..138add0 --- /dev/null +++ "b/20260104-mvc\350\267\257\347\224\261.md" @@ -0,0 +1,55 @@ +## 笔记 +自定义路由 +```bash +自定义路由将传入请求映射到名为 Archive 的控制器,并调用 Entry () 操作。调用 Entry () 方法时,输入日期将作为名为 entryDate 的参数传递。 +``` +路由约束 +```bash +使用路由约束来限制与特定路由匹配的浏览器请求。 可以使用正则表达式来指定路由约束。 + +定义路由时,可以使用约束来限制与路由匹配的 URL。 +``` +## 练习 + +第一题 +```js +const originArr = [1, 2, 3, 4, 5]; +const doubled = originArr.map(num => num * 2); +console.log(doubled); + +``` +第二题 +```js + +function sumToN(n) { + let sum = 0; + for (let i = 1; i <= n; i++) { + sum += i; + } + return sum; +} + +console.log(sumToN(100)); + + +``` + +第三题 + +```js + +let myNaN = NaN; + +console.log(`NaN === NaN // ${myNaN === myNaN}`); +console.log(`isNaN(NaN) // ${isNaN(myNaN)}`); +console.log(`Number.isNaN(NaN) // ${Number.isNaN(myNaN)}`); + +``` + +第四题 +```js + +let res1 = +"123"; +let res2 = -"45"; +let res3 = !!"hello"; +console.log(`${res1}, ${res2}, ${res3}`); -- Gitee From e6c5ad76e3f8ac3db006fb41ee6638f9da48812b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BC=A0=E5=BF=97=E9=91=AB?= <2030875622@qq.com> Date: Sun, 4 Jan 2026 14:50:06 +0000 Subject: [PATCH 5/6] =?UTF-8?q?=E5=88=A0=E9=99=A4=E6=96=87=E4=BB=B6=20?= =?UTF-8?q?=E5=BC=A0=E5=BF=97=E9=91=AB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- "\345\274\240\345\277\227\351\221\253" | 0 1 file changed, 0 insertions(+), 0 deletions(-) delete mode 100644 "\345\274\240\345\277\227\351\221\253" diff --git "a/\345\274\240\345\277\227\351\221\253" "b/\345\274\240\345\277\227\351\221\253" deleted file mode 100644 index e69de29..0000000 -- Gitee From 48e29be17a8758a5ed3c71e522a9b9bcdec8b214 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BC=A0=E5=BF=97=E9=91=AB?= <2030875622@qq.com> Date: Sun, 11 Jan 2026 12:20:57 +0000 Subject: [PATCH 6/6] =?UTF-8?q?=E5=BC=A0=E5=BF=97=E9=91=AB=2005?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 张志鑫 <2030875622@qq.com> --- "20260105-mvc\346\250\241\345\274\217.md" | 32 +++++++++++++++++++++++ "20260107-mvc\347\254\224\350\256\260.md" | 15 +++++++++++ "20260108-mvc\347\254\224\350\256\260.md" | 22 ++++++++++++++++ "20260109-mvc\347\254\224\350\256\260.md" | 28 ++++++++++++++++++++ 4 files changed, 97 insertions(+) create mode 100644 "20260105-mvc\346\250\241\345\274\217.md" create mode 100644 "20260107-mvc\347\254\224\350\256\260.md" create mode 100644 "20260108-mvc\347\254\224\350\256\260.md" create mode 100644 "20260109-mvc\347\254\224\350\256\260.md" diff --git "a/20260105-mvc\346\250\241\345\274\217.md" "b/20260105-mvc\346\250\241\345\274\217.md" new file mode 100644 index 0000000..da6c838 --- /dev/null +++ "b/20260105-mvc\346\250\241\345\274\217.md" @@ -0,0 +1,32 @@ +## 笔记 +- mvc模式 +```bash +- 模型(Model):负责数据和业务逻辑,通常包含数据存储、检索和业务规则。 +- 视图(View):负责显示数据(模型)的用户界面,不包含业务逻辑。 +- 控制器(Controller):接收用户的输入,调用模型和视图去完成用户的请求。 +``` + +- 主要解决的问题 +```bash +解决了应用程序中业务逻辑、数据和界面显示的耦合问题,使得开发和维护更加清晰和简单。 +使用场景 +``` + +- 优点 +```bash +- 关注点分离:将数据、业务逻辑和界面显示分离,降低耦合度。 +- 易于维护:每个组件负责特定的任务,便于单独开发和维护。 +- 可扩展性:可以独立地替换或更新模型、视图或控制器。 +``` + + +-缺点 +```bash + +- 可能增加复杂性:对于简单项目,引入MVC可能会增加不必要的复杂性。 +- 性能问题:如果不正确使用,可能会导致性能问题。 + +``` + + +## 练习 \ No newline at end of file diff --git "a/20260107-mvc\347\254\224\350\256\260.md" "b/20260107-mvc\347\254\224\350\256\260.md" new file mode 100644 index 0000000..9c97f5e --- /dev/null +++ "b/20260107-mvc\347\254\224\350\256\260.md" @@ -0,0 +1,15 @@ +## 笔记 + +- MVC架构模式的工作流程 +```bash + +- 用户发送请求:用户通过浏览器发送请求到服务器。 +- 控制器接收请求:服务器上的控制器接收用户请求,并根据请求的类型和参数调用相应的业务逻辑。 +- 模型处理业务逻辑:控制器调用模型层中的业务逻辑来处理用户请求。模型层与数据库进行交互,获取或更新数据,并返回处理结果给控制器层。 +- 控制器选择视图:控制器层根据模型层返回的处理结果选择合适的视图层来展示数据。 +- 视图渲染数据:视图层使用HTML、CSS和JavaScript等技术将模型层返回的数据渲染成用户可以看到的网页。 +- 返回响应:服务器将渲染后的网页返回给用户浏览器进行展示。 + +``` + +## 练习 \ No newline at end of file diff --git "a/20260108-mvc\347\254\224\350\256\260.md" "b/20260108-mvc\347\254\224\350\256\260.md" new file mode 100644 index 0000000..219ab19 --- /dev/null +++ "b/20260108-mvc\347\254\224\350\256\260.md" @@ -0,0 +1,22 @@ +## 笔记 + +- mvc视图职责 +```bash + +- 数据展示:将模型数据渲染为HTML/UI +- 用户交互:提供表单、按钮等交互元素 +- 界面结构:定义页面布局和视觉呈现 +- 数据绑定:动态显示模型状态变化 + +``` + +- Razor视图 + +```c# +@model User +
上次登录:@Model.LastLogin
+ +``` + +## 练习 \ No newline at end of file diff --git "a/20260109-mvc\347\254\224\350\256\260.md" "b/20260109-mvc\347\254\224\350\256\260.md" new file mode 100644 index 0000000..dca65e8 --- /dev/null +++ "b/20260109-mvc\347\254\224\350\256\260.md" @@ -0,0 +1,28 @@ +## 笔记 + +- mvc模型核心职责 +```bash + +- 数据管理: 定义数据结构、持久化操作 +- 业务逻辑:实现核心计算规则和业务流程 +- 数据验证:确保数据完整性和有效性 +- 状态管理:维护应用状态变更 + +``` + +- 示例代码 +```c# +public class UserModel { + public User ValidateLogin(string username, string password) { + var user = db.FindUser(username); + return VerifyPassword(user, password) ? user : null; + } + + public bool UpdateProfile(User user) { + return Validate(user) && db.Update(user); + } +} + +``` + +## 练习 \ No newline at end of file -- Gitee