From f8e7907bcddb464357095d7d77313a3bc53909f9 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E5=BE=90=E5=BD=AC=E5=BD=AC?= <1953436087@qq.com>
Date: Thu, 19 May 2022 09:29:19 +0800
Subject: [PATCH 1/4] homk
---
.../bootstrap.html" | 78 +++++++++++++++++++
.../arr.js" | 44 +++++++++++
.../\345\217\230\351\207\217.js" | 65 ++++++++++++++++
3 files changed, 187 insertions(+)
create mode 100644 "\345\276\220\345\275\254\345\275\254/0516 \345\223\215\345\272\224\345\274\217/bootstrap.html"
create mode 100644 "\345\276\220\345\275\254\345\275\254/0517 \346\225\260\347\273\204\345\216\273\351\207\215/arr.js"
create mode 100644 "\345\276\220\345\275\254\345\275\254/0518 \345\217\230\351\207\217/\345\217\230\351\207\217.js"
diff --git "a/\345\276\220\345\275\254\345\275\254/0516 \345\223\215\345\272\224\345\274\217/bootstrap.html" "b/\345\276\220\345\275\254\345\275\254/0516 \345\223\215\345\272\224\345\274\217/bootstrap.html"
new file mode 100644
index 0000000..f55dc3e
--- /dev/null
+++ "b/\345\276\220\345\275\254\345\275\254/0516 \345\223\215\345\272\224\345\274\217/bootstrap.html"
@@ -0,0 +1,78 @@
+
+
+
+
+
+
+ 响应式
+
+
+
+
+
+
+
+
+
+
+
+
+
+
.col-md-1
+
.col-md-1
+
.col-md-1
+
.col-md-1
+
.col-md-1
+
.col-md-1
+
.col-md-1
+
.col-md-1
+
.col-md-1
+
.col-md-1
+
.col-md-1
+
.col-md-1
+
+
+
.col-md-8
+
.col-md-4
+
+
+
.col-md-4
+
.col-md-4
+
.col-md-4
+
+
+
.col-md-6
+
.col-md-6
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ This line of text is meant to be treated as no longer accurate.
+
+
+
\ No newline at end of file
diff --git "a/\345\276\220\345\275\254\345\275\254/0517 \346\225\260\347\273\204\345\216\273\351\207\215/arr.js" "b/\345\276\220\345\275\254\345\275\254/0517 \346\225\260\347\273\204\345\216\273\351\207\215/arr.js"
new file mode 100644
index 0000000..86b64a8
--- /dev/null
+++ "b/\345\276\220\345\275\254\345\275\254/0517 \346\225\260\347\273\204\345\216\273\351\207\215/arr.js"
@@ -0,0 +1,44 @@
+let arr = [1,1,2,2,3,3,4,5,6,7,7,8,8,9,9,0,0,0];
+
+//method 1 Set
+let arr2 = new Set(arr);
+console.log(arr2);//{}格式
+let arr3 = [...arr2];
+console.log(arr3);
+
+//method 2 indexOf
+let arr4 = [];
+arr.forEach((value,key) => {
+ if (arr4.indexOf(value)===-1) {
+ arr4[arr4.length] = arr[key];
+ }
+});
+console.log(arr4);
+
+//method 3 for
+for (let i = 0; i < arr.length; i++) {
+ for (let j = i + 1; j < arr.length; j++) {
+ if (arr[i] === arr[j]) {
+ arr.splice(j,1);
+ j--;
+ }
+ }
+}
+console.log(arr);
+
+//method 4 filter+indexOf
+let arr5 = arr.filter((value,key) => {
+ return arr.indexOf(value) === key;
+});
+console.log(arr5);
+
+//method5 sort
+arr = arr.sort();//sort 从小到大排序
+console.log(arr);
+// let arr6 = [];
+// for (let i = 0; i < arr.length; i++) {
+// if (arr[i] !== arr[i - 1]) {
+// arr6.push(arr[i]);
+// }
+// }
+// console.log(arr6);
\ No newline at end of file
diff --git "a/\345\276\220\345\275\254\345\275\254/0518 \345\217\230\351\207\217/\345\217\230\351\207\217.js" "b/\345\276\220\345\275\254\345\275\254/0518 \345\217\230\351\207\217/\345\217\230\351\207\217.js"
new file mode 100644
index 0000000..5aed703
--- /dev/null
+++ "b/\345\276\220\345\275\254\345\275\254/0518 \345\217\230\351\207\217/\345\217\230\351\207\217.js"
@@ -0,0 +1,65 @@
+//undefined
+let num;
+console.log(num);
+if (num) {
+ console.log(111);
+}
+
+//null
+let num2 = null;
+console.log(typeof num);
+if (num2) {
+ console.log(111);
+}
+
+//boolean
+
+//string
+let str = '1111';
+let str2 = '中文';
+console.log(str2.length);
+console.log(str2[1]);
+let str3 = 'abc';
+//首字母变大写
+let str4 = str3[0].toUpperCase() + str3.substr(1);
+console.log(str4);
+//对象展开的方式
+let str5 = [...str3];
+console.log(str5);
+str5[0] = str5[0].toUpperCase();
+console.log(str5.join(''));
+//字符串反转
+console.log(str3.split('').reverse().join(''));
+//charAt 返回指定位置的字符
+console.log(str3.charAt(1));
+//substr
+let str6 = 'shudsffsaf.,daus';
+console.log(str6.substr(5));
+console.log(str6.substr(-3));
+console.log(str6.substr(-3,2));
+//split
+let str7 = 'aiushd,.,.asdhoa13456io4';
+console.log(str7.split(','));
+//join
+console.log(str7.split('.').join('-'));
+
+let str8 = str3 + 'js';
+console.log(str8);
+
+//number
+console.log(Number.MAX_VALUE);
+console.log(0.1+0.9);
+console.log(0.1+0.2);
+let num3 = '101';
+console.log(Number(num3));
+let num4 = null;
+console.log(Number(num4));
+let num5 = '0';
+if(num5){
+ console.log('true or false');
+}
+let num6 = 'ASS';
+console.log(Number(num6));
+if (Number(num6)) {
+ console.log('NAN or true or false');
+}
\ No newline at end of file
--
Gitee
From 4df3fa9ea1820418d3a905d9d1992844acfa7cb0 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E5=BE=90=E5=BD=AC=E5=BD=AC?= <1953436087@qq.com>
Date: Thu, 19 May 2022 17:39:56 +0800
Subject: [PATCH 2/4] homk
---
...60\346\215\256\347\261\273\345\236\213.js" | 53 +++++++++++++++++++
1 file changed, 53 insertions(+)
create mode 100644 "\345\276\220\345\275\254\345\275\254/0519 \345\274\225\347\224\250\346\225\260\346\215\256\347\261\273\345\236\213/\345\274\225\347\224\250\346\225\260\346\215\256\347\261\273\345\236\213.js"
diff --git "a/\345\276\220\345\275\254\345\275\254/0519 \345\274\225\347\224\250\346\225\260\346\215\256\347\261\273\345\236\213/\345\274\225\347\224\250\346\225\260\346\215\256\347\261\273\345\236\213.js" "b/\345\276\220\345\275\254\345\275\254/0519 \345\274\225\347\224\250\346\225\260\346\215\256\347\261\273\345\236\213/\345\274\225\347\224\250\346\225\260\346\215\256\347\261\273\345\236\213.js"
new file mode 100644
index 0000000..98e5b06
--- /dev/null
+++ "b/\345\276\220\345\275\254\345\275\254/0519 \345\274\225\347\224\250\346\225\260\346\215\256\347\261\273\345\236\213/\345\274\225\347\224\250\346\225\260\346\215\256\347\261\273\345\236\213.js"
@@ -0,0 +1,53 @@
+let obj = {
+ study:'webapi',
+ age:15
+};
+let obj2 = obj;
+obj2.age = 20;
+console.log(obj.age);
+
+let num1 = 10;
+let num2 = num1;
+num2 = 20;
+console.log(num1);
+
+let arr = new Array();
+arr.push('java');
+arr.push(20);
+console.log(arr);
+let arr2 = ['java','c'];
+let arr3 = arr2.concat(arr);
+console.log(arr3);
+
+let arr4 = arr3.filter((val,index,arr)=>{
+ return val!=='java';
+})
+console.log(arr4);
+
+let set = new Set(arr3);
+console.log(set);
+console.log(Object.keys(arr3));
+
+let arr6 = [];
+arr6['keys'] = 'kiss';
+arr6['value'] = 'money';
+console.log(arr6);
+console.log(Object.values(arr6));
+
+let arr7 = [9,10,1,4,7];
+let arr8 = arr7.sort();
+console.log(arr8);
+console.log(arr7);
+let arr9 = arr7.sort((a,b)=>{
+ return a - b;
+});
+console.log(arr9);
+
+let arr10 = ['java','js','c'];
+let num = arr10.pop();
+console.log(num);
+console.log(arr10);
+
+let arr11 = [];
+arr11.push(1,3,4,5);
+console.log(arr11);
\ No newline at end of file
--
Gitee
From 2d1cc8d79bb481e3899c17cdbb74002fa2ab0de9 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E5=BE=90=E5=BD=AC=E5=BD=AC?= <1953436087@qq.com>
Date: Fri, 20 May 2022 11:38:41 +0800
Subject: [PATCH 3/4] homk
---
.../0520 \346\227\266\351\227\264\346\210\263/1.js" | 8 ++++++++
1 file changed, 8 insertions(+)
create mode 100644 "\345\276\220\345\275\254\345\275\254/0520 \346\227\266\351\227\264\346\210\263/1.js"
diff --git "a/\345\276\220\345\275\254\345\275\254/0520 \346\227\266\351\227\264\346\210\263/1.js" "b/\345\276\220\345\275\254\345\275\254/0520 \346\227\266\351\227\264\346\210\263/1.js"
new file mode 100644
index 0000000..24a4dae
--- /dev/null
+++ "b/\345\276\220\345\275\254\345\275\254/0520 \346\227\266\351\227\264\346\210\263/1.js"
@@ -0,0 +1,8 @@
+let now = new Date();//当前日期
+let nowMonth = now.getMonth();//当前月
+let nowYear = now.getFullYear();//当前年
+//本月的结束时间
+let monthEndDate = new Date(nowYear, nowMonth+1,0);
+let timeEnd = Date.parse(monthEndDate)/1000-1;//最后一天的时间戳
+console.log('本月最后一天的时间戳'+timeEnd);
+console.log('当前的时间戳'+Date.parse(new Date())/1000);
--
Gitee
From 66511e630c0b8bf9adc078cdc7eb3f61c8e5a11c Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E5=BE=90=E5=BD=AC=E5=BD=AC?= <1953436087@qq.com>
Date: Wed, 8 Jun 2022 11:41:47 +0800
Subject: [PATCH 4/4] hpmk
---
.../wph.sql" | 97 +++++++++++++
...71\347\233\256\345\274\200\345\217\221.md" | 130 ++++++++++++++++++
.../utils/request.js" | 65 +++++++++
...06\346\236\266\346\220\255\345\273\272.md" | 110 +++++++++++++++
4 files changed, 402 insertions(+)
create mode 100644 "\345\276\220\345\275\254\345\275\254/0603 \345\220\216\347\253\257\350\241\250\347\273\223\346\236\204/wph.sql"
create mode 100644 "\345\276\220\345\275\254\345\275\254/0603 \345\220\216\347\253\257\350\241\250\347\273\223\346\236\204/\345\220\216\345\217\260\351\241\271\347\233\256\345\274\200\345\217\221.md"
create mode 100644 "\345\276\220\345\275\254\345\275\254/0608 axios\350\257\267\346\261\202/utils/request.js"
create mode 100644 "\345\276\220\345\275\254\345\275\254/0608 axios\350\257\267\346\261\202/\345\211\215\346\256\265\346\241\206\346\236\266\346\220\255\345\273\272.md"
diff --git "a/\345\276\220\345\275\254\345\275\254/0603 \345\220\216\347\253\257\350\241\250\347\273\223\346\236\204/wph.sql" "b/\345\276\220\345\275\254\345\275\254/0603 \345\220\216\347\253\257\350\241\250\347\273\223\346\236\204/wph.sql"
new file mode 100644
index 0000000..9900610
--- /dev/null
+++ "b/\345\276\220\345\275\254\345\275\254/0603 \345\220\216\347\253\257\350\241\250\347\273\223\346\236\204/wph.sql"
@@ -0,0 +1,97 @@
+/*
+Navicat MySQL Data Transfer
+
+Source Server : localhost
+Source Server Version : 50730
+Source Host : 127.0.0.1:3306
+Source Database : wph
+
+Target Server Type : MYSQL
+Target Server Version : 50730
+File Encoding : 65001
+
+Date: 2022-06-03 11:12:02
+*/
+
+SET FOREIGN_KEY_CHECKS=0;
+
+-- ----------------------------
+-- Table structure for admin
+-- ----------------------------
+DROP TABLE IF EXISTS `admin`;
+CREATE TABLE `admin` (
+ `id` int(11) NOT NULL AUTO_INCREMENT COMMENT '主键',
+ `name` varchar(64) DEFAULT NULL COMMENT '用户名',
+ `password` varchar(32) DEFAULT NULL COMMENT '密码-md5加密',
+ `create_at` int(11) DEFAULT NULL COMMENT '创建的时间戳',
+ `update_at` int(11) DEFAULT NULL COMMENT '更新的时间戳',
+ PRIMARY KEY (`id`)
+) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8mb4;
+
+-- ----------------------------
+-- Records of admin
+-- ----------------------------
+INSERT INTO `admin` VALUES ('1', 'admin', '123456', null, null);
+INSERT INTO `admin` VALUES ('2', 'class8', '654321', null, null);
+
+-- ----------------------------
+-- Table structure for catalog
+-- ----------------------------
+DROP TABLE IF EXISTS `catalog`;
+CREATE TABLE `catalog` (
+ `id` int(11) NOT NULL AUTO_INCREMENT COMMENT '主键',
+ `name` varchar(81) DEFAULT NULL COMMENT '目录名称',
+ `sort` int(4) DEFAULT NULL COMMENT '排序',
+ `status` int(4) DEFAULT '1' COMMENT '状态 0 表示关闭状态 1表示开始状态',
+ `create_at` int(11) DEFAULT NULL COMMENT '创建',
+ `update_at` int(11) DEFAULT NULL COMMENT '更新时间',
+ PRIMARY KEY (`id`)
+) ENGINE=InnoDB AUTO_INCREMENT=7 DEFAULT CHARSET=utf8mb4;
+
+-- ----------------------------
+-- Records of catalog
+-- ----------------------------
+INSERT INTO `catalog` VALUES ('1', null, null, null, null, null);
+INSERT INTO `catalog` VALUES ('2', '测试的名称', null, null, null, null);
+INSERT INTO `catalog` VALUES ('3', '测试的名称2', null, null, null, null);
+INSERT INTO `catalog` VALUES ('4', '测试的名称4', null, null, null, null);
+INSERT INTO `catalog` VALUES ('5', '测试的名称4', '1', null, null, null);
+INSERT INTO `catalog` VALUES ('6', '目录2', null, null, null, null);
+
+-- ----------------------------
+-- Table structure for goods
+-- ----------------------------
+DROP TABLE IF EXISTS `goods`;
+CREATE TABLE `goods` (
+ `id` int(11) NOT NULL AUTO_INCREMENT,
+ `name` varchar(255) DEFAULT NULL,
+ `catalog_id` int(11) DEFAULT NULL COMMENT '关联到catalog的主键',
+ `detail` varchar(255) DEFAULT NULL,
+ `price` int(10) DEFAULT NULL COMMENT '单位就是分',
+ `stock` int(11) DEFAULT NULL COMMENT '库存',
+ `img` varchar(1024) DEFAULT NULL COMMENT '图片utl地址.以逗号区分',
+ `brand_name` varchar(128) DEFAULT NULL COMMENT '品牌名',
+ `create_at` int(11) DEFAULT NULL COMMENT '创建日期',
+ `update_at` int(11) DEFAULT NULL COMMENT '更新时间',
+ PRIMARY KEY (`id`)
+) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8mb4;
+
+-- ----------------------------
+-- Records of goods
+-- ----------------------------
+INSERT INTO `goods` VALUES ('1', 'lv', '1', '3432', null, null, null, null, null, null);
+INSERT INTO `goods` VALUES ('2', '塑料袋', '2', '324324', null, null, null, null, null, null);
+
+-- ----------------------------
+-- Table structure for user
+-- ----------------------------
+DROP TABLE IF EXISTS `user`;
+CREATE TABLE `user` (
+ `id` int(11) NOT NULL,
+ `name` varchar(255) DEFAULT NULL,
+ PRIMARY KEY (`id`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
+
+-- ----------------------------
+-- Records of user
+-- ----------------------------
diff --git "a/\345\276\220\345\275\254\345\275\254/0603 \345\220\216\347\253\257\350\241\250\347\273\223\346\236\204/\345\220\216\345\217\260\351\241\271\347\233\256\345\274\200\345\217\221.md" "b/\345\276\220\345\275\254\345\275\254/0603 \345\220\216\347\253\257\350\241\250\347\273\223\346\236\204/\345\220\216\345\217\260\351\241\271\347\233\256\345\274\200\345\217\221.md"
new file mode 100644
index 0000000..b598c31
--- /dev/null
+++ "b/\345\276\220\345\275\254\345\275\254/0603 \345\220\216\347\253\257\350\241\250\347\273\223\346\236\204/\345\220\216\345\217\260\351\241\271\347\233\256\345\274\200\345\217\221.md"
@@ -0,0 +1,130 @@
+**数据库设计**
+
+varchar 不定长,有最大值,但是存储字节小于,最大值,以实际存储的字节长度为准
+
+时间设计,可以使用datetime,也可以使用时间戳(秒)来表示
+
+
+
+**后端项目稍微优化**
+
+
+```
+实体类的自动生成代码,记得把packageName 改成自己的包名
+
+
+import com.intellij.database.model.DasTable
+import com.intellij.database.model.ObjectKind
+import com.intellij.database.util.Case
+import com.intellij.database.util.DasUtil
+import java.time.LocalDateTime
+import java.time.format.DateTimeFormatter
+/*
+ * Available context bindings:
+ * SELECTION Iterable
+ * PROJECT project
+ * FILES files helper
+ * update by yitianRen 20200324
+ */
+packageName = "com.example.studywebapi.entity;"
+typeMapping = [
+ (~/(?i)int/) : "Integer", //数据库类型和Jave类型映射关系
+ (~/(?i)float|double|decimal|real/): "Double",
+ (~/(?i)bool|boolean/) : "Boolean",
+ (~/(?i)datetime|timestamp/) : "java.util.Date",
+ (~/(?i)date/) : "java.sql.Date",
+ (~/(?i)time/) : "java.sql.Time",
+ (~/(?i)/) : "String"
+]
+FILES.chooseDirectoryAndSave("Choose directory", "Choose where to store generated files") { dir ->
+ SELECTION.filter { it instanceof DasTable }.each { generate(it, dir) }
+}
+def generate(table, dir) {
+ def className = javaName(table.getName(), true)
+ def fields = calcFields(table)//更改实体生成规则
+ new File(dir, className + ".java").withPrintWriter("utf-8") { out -> generate(out, className, fields,table) }
+ //new File(dir, className + ".java").withPrintWriter { out -> generate(out, className, fields, table) }//输出实体类
+}
+def generate(out, className, fields, table) {
+ out.println "package $packageName"
+ out.println ""
+ out.println "/**\n" +
+ " * \n" +
+ " * @Date: " + LocalDateTime.now().format(DateTimeFormatter.ofPattern("yy-MM-dd HH:mm:ss")).toString() + ".
\n" +
+ " *\n" +
+ " * @author linqh03\n" +
+ " */"
+ out.println ""
+ out.println "import lombok.Data;"
+ out.println " import javax.persistence.Entity;"
+ out.println "import javax.persistence.*;"
+ out.println "import java.io.Serializable;"
+ out.println "import io.swagger.annotations.ApiModel;"
+ out.println "import io.swagger.annotations.ApiModelProperty;"
+
+ out.println ""
+ out.println "@Table ( name =\"" + table.getName() + "\" )"
+ out.println "@Data"
+ out.println "@Entity"
+ out.println "@ApiModel"
+ out.println "public class $className implements Serializable{"
+ out.println ""
+ out.println "private static final long serialVersionUID = 1L;"
+ fields.each() {
+ out.println ""
+ // 输出注释 这里和下面的 comm是一一对应的
+/* if (isNotEmpty(it.commoent)) {//定义非空校验,it.commoent != ""手写无效
+ out.println "// ${it.commoent}"
+ }*/
+ if (it.name == "id") out.println " @Id"
+ if (it.annos != "") out.println " ${it.annos}"
+ if (it.name == "id") out.println " @GeneratedValue(strategy = GenerationType.IDENTITY)"
+ out.println " @ApiModelProperty( value=\"${it.commoent}\")"
+ out.println " private ${it.type} ${it.name};"
+ }
+ out.println ""
+ out.println "}"
+}
+def calcFields(table) {
+ DasUtil.getColumns(table).reduce([]) { fields, col ->
+ def spec = Case.LOWER.apply(col.getDataType().getSpecification())
+ def typeStr = typeMapping.find { p, t -> p.matcher(spec).find() }.value
+ def comm = [
+ name : col.getName(),
+ type : typeStr,
+ commoent: col.getComment(),
+ annos: "@Column(name = \"" + col.getName() + "\" )"
+ ]
+ //对于表中主键自定义注解
+ if ("pk".equals(Case.LOWER.apply(col.getName()))){
+ comm.annos = "\t@Id\n"
+ //自增主键需要
+ comm.annos += "@Column(name = \"" + col.getName() + "\")"
+ }
+ fields += [comm]//字段对照
+ }
+}
+def javaName(str, capitalize) {
+ def s = com.intellij.psi.codeStyle.NameUtil.splitNameIntoWords(str)
+ .collect { Case.LOWER.apply(it).capitalize() }
+ .join("")
+ .replaceAll(/[^\p{javaJavaIdentifierPart}[_]]/, "_")
+ capitalize || s.length() == 1? s : Case.LOWER.apply(s[0]) + s[1..-1]
+}
+def isNotEmpty(content) {
+ return content != null && content.toString().trim().length() > 0
+}
+
+
+
+
+```
+
+
+
+
+ 项目类型:h5,app (不会存储cookie)
+
+ 每个表都有一个控制器
+
+
diff --git "a/\345\276\220\345\275\254\345\275\254/0608 axios\350\257\267\346\261\202/utils/request.js" "b/\345\276\220\345\275\254\345\275\254/0608 axios\350\257\267\346\261\202/utils/request.js"
new file mode 100644
index 0000000..d081cfa
--- /dev/null
+++ "b/\345\276\220\345\275\254\345\275\254/0608 axios\350\257\267\346\261\202/utils/request.js"
@@ -0,0 +1,65 @@
+import axios from "axios";
+
+axios.defaults.baseURL = 'https://question.llblog.cc/api.php';
+
+
+ let getUrl=function(path,parmas) {
+ if(!parmas) parmas={};
+ return new Promise((resolve,reject)=>{
+ axios.get(path,parmas).then(response=>{
+ if(response.data.code==200){//后端约定200 表示请求成功
+ resolve(response.data.data);
+ }else{// 非200 表示后端请求异常
+ reject(response.data.msg);
+ }
+ }).catch(err=>{
+ reject(err);
+ })
+ })
+}
+
+
+let postUrl=function(url,parmas) {
+ return new Promise((resolve,reject)=>{
+ axios.post(url,parmas).then(response=>{
+ if(response.data.code==200){//后端约定200 表示请求成功
+ resolve(response.data.data);
+ }else{// 非200 表示后端请求异常
+ reject(response.data.msg);
+ }
+ }).catch(err=>{
+ reject(err);
+ })
+ })
+}
+
+// put ,delete
+let putUrl=function(url,parmas) {
+ return new Promise((resolve,reject)=>{
+ axios.put(url,parmas).then(response=>{
+ if(response.data.code==200){//后端约定200 表示请求成功
+ resolve(response.data.data);
+ }else{// 非200 表示后端请求异常
+ reject(response.data.msg);
+ }
+ }).catch(err=>{
+ reject(err);
+ })
+ })
+}
+
+let deleteUrl=function(url,parmas) {
+ return new Promise((resolve,reject)=>{
+ axios.delete(url,parmas).then(response=>{
+ if(response.data.code==200){//后端约定200 表示请求成功
+ resolve(response.data.data);
+ }else{// 非200 表示后端请求异常
+ reject(response.data.msg);
+ }
+ }).catch(err=>{
+ reject(err);
+ })
+ })
+}
+
+export {get,postUrl,putUrl,deleteUrl};
\ No newline at end of file
diff --git "a/\345\276\220\345\275\254\345\275\254/0608 axios\350\257\267\346\261\202/\345\211\215\346\256\265\346\241\206\346\236\266\346\220\255\345\273\272.md" "b/\345\276\220\345\275\254\345\275\254/0608 axios\350\257\267\346\261\202/\345\211\215\346\256\265\346\241\206\346\236\266\346\220\255\345\273\272.md"
new file mode 100644
index 0000000..e26a976
--- /dev/null
+++ "b/\345\276\220\345\275\254\345\275\254/0608 axios\350\257\267\346\261\202/\345\211\215\346\256\265\346\241\206\346\236\266\346\220\255\345\273\272.md"
@@ -0,0 +1,110 @@
+**脚手架的作用**
+
+开发阶段使用的框架,部署会把js 和html css 压缩打包,再部署到服务器,不会应用到生产环境
+
+**把必需的插件安装**
+
+vue-router
+
+vuex
+
+版本,2022年开始vue的默认版本是3
+
+npm 安装怎么指定版本
+
+vue2 的版本使用的vue-router 版本为3
+
+
+vuex 自己安装
+
+
+**项目的目录结构怎么优化**
+
+
+ utils 工具目录,放置自己的或者百度找来的工具函数
+
+ pages/views 存放路由组件,根据url 渲染的组件
+
+ api 统一管理axios的url
+
+ mixin 统一数据
+
+
+**常用的功能封装**
+
+ 为什么要封装
+
+ axios 用起来,相对繁琐,封装或去请求的统一出相对简易 (比如可能会额外添加头信息)
+
+ 封装的要求, 使用简单,扩展性好
+
+ 封装代码
+
+ ```
+
+ let get=function(url,parmas) {
+ if(!parmas) parmas={};
+ return new Promise((resolve,reject)=>{
+ axios.get(url,parmas).then(response=>{
+ if(response.data.code==200){//后端约定200 表示请求成功
+ resolve(response.data.data);
+ }else{// 非200 表示后端请求异常
+ reject(response.data.msg);
+ }
+ }).catch(err=>{
+ reject(err);
+ })
+ })
+}
+
+ ```
+
+
+ **开发与生产环境的host切换**
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+**微专业的课程**
+
+计算机基础,网络基础,Oracle,linux 应用 一个月课程,一个实训
+
+FTP Email DNS 服务器
+
+
+
+
+
+
--
Gitee