日常随笔记录

开封

Eight dynasties ancient capital, cultural city. Located in the hinterland of central China, the start of summer business on the old city, the emperor after the earth, the field for the bucks; Backed by the Yellow River, huaili pingchuan fertile, the cradle of China, agricultural civilization. Watch the vicissitudes of the vicissitudes of the vicissitudes of the vicissitudes of the vicissitudes of the vicissitudes. Sigh world vicissitude, into the cloud, know kaifeng know henan. If you open it, open it. -- 《 menghua song du kaifeng》

Kaifeng is a famous historical and cultural city

The origin of its name is very interesting. In 717 BC, during the spring and autumn period, zheng zhuanggong built granaries and established the granary city here. To the han dynasty, to avoid the name of emperor liu qi, renamed kaifeng, still in use today. Foreigners say that if you don't know henan, you don't know China; Chinese people say that if you don't know kaifeng, you don't know henan! Henan province was founded in the yuan dynasty. From the yuan dynasty to the twenty-eighth year of the yuan dynasty (1291) to 1954, kaifeng was the capital and capital of henan province for seven hundred years. After the founding of new China, in order to promote the development of the central plains, the provincial capital was moved from kaifeng to zhengzhou with more convenient transportation.

The miracle of the city

"Kaifeng city, city pile city, underground buried several cities! ?" With a history of more than 2,000 years, kaifeng city has never changed its site and central axis for thousands of years. It is the only special case in the history of world urban development. Mohican, one thousand due to flooded through all kinds of natural disasters, the Yellow River burst its Banks, the kaifeng city into ruins, again and again but stubborn kaifeng people and rebuild their homes in the ruins, again and again until now kaifeng waste is an important six city, "city of" city and urban construction in the history of archaeological wonders of the world!
Kaifeng culture is a representative and epitome of central plains culture and even Chinese culture. In this city, pick up a piece of old brick old tile, pick up a handful of loess sand, perhaps there is a moving historical story. In this city, history is buried in thick soil, stories are hidden in clear water, legends are hung from branches, and song is in the air. When you step into kaifeng, as if a day dream back a thousand years, picturesque past, relaxed and happy. Everything will be amazing.

Kaifeng is a "water city"

Bianliang in the water Some people say that kaifeng is a city floating from the water, known as the "northern water city". Kaifeng rises and falls because of water. Ancient kaifeng rivers and lakes everywhere, in the song dynasty period, here is the center of water transportation, near, Cai He through the city, the golden stream and five zhangs river, decorated boats on the river Banks and exquisite ancient architecture photograph echo, waterway in album ZhouLu is linked together, extremely rich jiangnan water tungs of hometown.
After the change of dynasties and the changes of times,kaifeng today is not as prosperous as bianliang in Tokyo, but it is also dotted with lakes, covering a quarter of the city. Contemporary kaifeng people are making the "four rivers and five lakes" water system project as the highlight and boutique of kaifeng tourism. Longting lake, baogong lake, northwest lake, sunshine lake and iron tower lake are connected by a river 100 meters wide, like a necklace connecting five pearls together. River built the bridge hundreds of style of the song dynasty, white water rafting river, around the city for a week, and the water scenery and the north of the city LiuChi, dark pools of the north and south, and west of charting the pool and five thousand mu of waters this year and next, the west lake scenic spot things are linked together, slurry boat shadow, small Bridges, a full of kaifeng city, the north shui yun, is the water city people yearn for.

Kaifeng is a city that never sleeps

Kaifeng "night market" Speaking of kaifeng's delicious food, we have to mention kaifeng's "night market", which originated from the northern song dynasty. At that time, people all over China and even all over the world were "working with the sun and setting the sun". After the sun went down, the whole world was plunged into pieces of darkness. According to "Tokyo dream China records" record: "the night market until the end of the night, before the resumption of the opening night, if you want to make the place, know unconsciously! "" despite the winter snow and rain, there are night markets. At that time, Tokyo had become an unprecedented "city without a night" in the world. Among them, zhouqiao night market across the royal road, near the bianhe river, located in the city of Tokyo, the water and land at the heart of the city, coupled with the spectacular zhouqiao, towering mingyue Lou, here picturesque, visitors like weaving, scholars and poets more than this to the wine poetry. Northern song dynasty litteratologist su dongpo once left a "longjin view of the night market, the lights also huang... Do not know the capital of the small, that is the river's lake township "poem. Now kaifeng has officially approved by the kaifeng municipal government on the gulou night market, xisiqiao night market, wuyi night market and a total of 17 night market south gate. "The sky star, the top of the head lamp, nearby cooking range, all round the human voice, connect bench all is fat, connect person shadow all is sweet, connect breeze all satisfied, connect star all chan -- eat of, be the atmosphere on the night market of kaifeng! However, going to kaifeng night market not only has the atmosphere, but also many authentic food and snacks. There are more than 240 kinds of snacks in kaifeng. There are more than 70 kinds of famous Chinese food and more than 100 kinds of famous henan food. Rich, unique, long laid the position of kaifeng night market. Kaifeng snack after thousands of years, famous, prosperous. Kaifeng snacks from the xia shang, sheng in the northern song dynasty. Kaifeng snack enjoys a high status in the history of Chinese food culture. Kaifeng snack on the national survival and development of a significant impact. Today, kaifeng snacks, kaifeng night market, has become the "name card" of kaifeng. Here I will introduce the most representative snacks in kaifeng:

Soup dumplings

Xiaolongguantang steamed stuffed bun is one of the most representative snacks with the longest history in kaifeng. According to "Tokyo dream China records" record, at that time "wanglou cave plum blossom steamed stuffed bun" so-called "in the Beijing first", the steamed stuffed bun of small cage irrigation soup is exactly from its development. Kaifeng city soup dumplings countless shops, the first floor is especially famous. Steamed bun with eat with steam, cage on the table. Although the bun is delicious and not pleated, but don't forget to enjoy its shape before eating: "lift like a lantern, put down a thin ball. Skin like chrysanthemum core, filling like rose petals." Pick up a bun, you can see the soup in the translucent leather ripples. The soup was delicious, with a delicious filling and an endless aftertaste.

Peanut cake

Peanut cake is a typical kaifeng snack to take away. Peanuts are common, but the sandy soil of kaifeng is good for growing peanuts and watermelons. Good peanut cake is a piece of the color is the kind of Fried peanut yellow, crisp, pine, sweet, non-stick teeth, the mouth is melting. Peanut cakes are almost everywhere in kaifeng, but the most popular peanut cakes are made by the hui people in the area of simen and mujiaqiao.

Mutton kang buns

Mutton kang mo, the name is very strange? Is a thin white bread wrapped in minced mutton in the middle, the cake is hot, minced meat is hot, eat carefully hot mouth ah. Jin dao bread, burnt meat, very chewy. Baked crisp white bread cut, into the preparation of flavorful minced mutton, crisp, entry yu xiang, let a person bite, can not help but bite again. 4, kaifeng is "golden curse" chrysanthemum city

"Chrysanthemum city"

Kaifeng has a long history of chrysanthemum planting. As early as the tang dynasty, kaifeng chrysanthemum was famous all over the country. In his poem "playing white chrysanthemum with the duke of linghu", a great poet of the tang dynasty described that "every chrysanthemum is yellow, and liang yuan is like frost alone". In the song dynasty, the planting of chrysanthemum in kaifeng got an unprecedented development. According to "Tokyo menghualu" records: "September chongyang, are under the appreciation of chrysanthemum, there are several families everywhere, the wine house are tied into a hole chrysanthemum households. At that time, "forbidden and your family all enjoy this chrysanthemum", "ordinary home also city one or two pieces of play. With the in-depth study of chrysanthemum cultivation techniques, the first chrysanthemum monograph "chrysanthemum spectrum" was born in kaifeng. "Chrysanthemum spectrum" recorded in the chrysanthemum species has reached more than 40. The writers and poets of that time were in the late autumn season... In addition to the nine nine height, but also drink chrysanthemum tea, drink chrysanthemum wine, painting chrysanthemum painting, singing chrysanthemum songs, and on the chrysanthemum poem lyrics have become a fashion, in kaifeng left a lot of good chrysanthemum ode. Li qingzhao wrote in "drunk huayin" : "mo dao does not dissipate the soul, curtain volume west wind, people than yellow flower thin. "Su shi in the" gift liu jingwen "a poem wrote:" the lotus has no qing yu cover, chrysanthemum residual still proud frost branch. In the Ming and qing dynasties, kaifeng became more popular for chrysanthemum cultivation. In the imperial tablet of qianlong in the reign of king yu, we can still see the poem "wind falling on the leaves, frost chrysanthemum white heap", which shows how long the history of chrysanthemum cultivation in kaifeng has been. Today's kaifeng chrysanthemum varieties have reached more than one thousand, when the advent of late autumn, the various, colorful chrysanthemum, spray fang tuyan, gorgeous. The whole kaifeng can be described as streets and alleys have flowers, every plant flowers, shops flowers, simply became the world of chrysanthemum, the sea of flowers. Kaifeng chrysanthemum, its size, varieties, shape and other unique advantages in the country, therefore, we say: "luoyang peony, kaifeng chrysanthemum unparalleled. Therefore, people call kaifeng "jucheng". The chrysanthemum was named the "" city flower" "of kaifeng in 1983, and since then it has been the" "chrysanthemum flower party" "in kaifeng every year on l018 solstice and nov 18.

"Collision" between contemporary and history

Once was "richly the world does not have" bianliang city kaifeng, since the modern times although slightly lonely. But in this ancient capital, there are also stories of the upright bao gong, the valiant soldiers of the Yang family and the famous prostitute li shishi. If you come to kaifeng, walk under the ancient city walls to feel the vicissitudes of history, or take a boat tour to enjoy the charm of this "northern water city", the city in front of you does not have the fast pace of modern urban life, every twang and smile is full of ancient flavor. You can savor the "qi tree mingxia five phoenixes building, yi men since ancient times" style... This article is just a collection of the history and culture of the ancient capital of kaifeng by a person who loves his hometown. It is not very comprehensive and does not want to be comprehensive. The city with a strong historical background cannot be described by words. I'll be right here waiting for you...

angular

数据更新视图不刷新

场景:混合开发app,原生调用h5js的方法。这个方法会改变数据,结果打印出来数据是改变的,就是没有反应到视图上。除非用户操作页面。
angular代码部分-测试 解决办法: 手动调用刷新
解决办法

nodejs-get-post-请求探索

koa代码

   const koa = require('koa');
   const fs = require('fs');
   const app = new koa();

   const Router = require('koa-router');

   const cors = require('koa2-cors');
   const koaBody = require('koa-body'); //解析文件流
   app.use(koaBody({
   multipart: true,  // 运行多个文件
   strict: true,  //默认true,不解析GET,HEAD,DELETE请求
   formidable: {
       maxFileSize: 2 * 1024 * 1024   // 设置上传文件大小最大限制,默认2M
   }
   }));

   // const bodyParser = require('koa-bodyparser');  // 不支持 form-data
   // app.use(bodyParser({
   //   extendTypes: {
   //     json: ['application/x-javascript', 'application/x-www-form-urlencoded', 'multipart/form-data', 'text/xml'] // 支持的类型
   //   }
   // })); // post 获取参数

   // 
   app.use(cors({
   origin: function (ctx) {
       if (ctx.url === '/test') {
       return "*"; // 允许来自所有域名请求
       }
       return "*"; // 允许来自所有域名请求
       // return 'http://localhost:8080'; // 这样就能只允许 http://localhost:8080 这个域名的请求了
   },
   exposeHeaders: ['WWW-Authenticate', 'Server-Authorization'],
   maxAge: 0,
   credentials: true,
   allowMethods: ['GET', 'PUT', 'POST', 'PATCH', 'DELETE', 'HEAD', 'OPTIONS'],
   allowHeaders: ['Content-Type', 'Authorization', 'Accept'],
   }));

   // 主路由
   let home = new Router();
   home.get('/', async (ctx) => {
   let url = ctx.url;
   let request = ctx.request;
   let req_query = request.query;
   let req_queryString = request.querystring;
   const body = {
       url,
       req_query,
       req_queryString,
   };
   ctx.body = body;
   });

   // 子路由
   let page = new Router();

   page.get('/404', async (ctx) => {
   ctx.body = '404.page!';
   })
   .get('/helloworld', async (ctx) => {
       ctx.body = 'hello world page';
   })
   .get('/init', async (ctx) => {
       ctx.body = ctx.request.query;
   })
   .post('/post', async (ctx) => {
       console.log(ctx.request.query); // 获取 url 后面参数
       const { a, b } = ctx.request.body;
       const body = {
       a, b
       };
       ctx.body = body;
   })
   .post('/postForm', async (ctx) => {
       const { a, b } = ctx.request.body;
       const body = {
       a, b
       };
       ctx.body = body;
   })
   .post('/postText', async (ctx) => { // text/xml
       const body = `
       <a href="http://www.baidu.com">百度链接</a>
       `;
       ctx.body = body;
   })
   .post('/uploadfile', async (ctx) => { //  上传文件
       const file = ctx.request.files.file; // 获取上传文件
       const size = file.size; // 大小
       const type = file.type; // 类型
       const name = file.name; // 名字
       console.log(size, type, name);

       ctx.body = { name };
   });


   // 装载所有子路由
   let router = new Router();
   router.use('/', home.routes(), home.allowedMethods());
   router.use('/test', page.routes(), page.allowedMethods());

   // 加载路由中间件
   app.use(router.routes()).use(router.allowedMethods());

   app.listen(3000, () => {
   console.log('启动成功');
   });

axios

    <!DOCTYPE html>
    <html lang="en">

    <head>
        <meta charset="UTF-8">
        <meta name="viewport" content="width=device-width, initial-scale=1.0">
        <meta http-equiv="X-UA-Compatible" content="ie=edge">
        <title>Document</title>
        <script src="https://unpkg.com/axios/dist/axios.min.js"></script>
        <style>
            li{
                height: 40px;
                margin-top: 10px;
                cursor: pointer;
            }
        </style>
    </head>

    <body>

        <input type="file" name="a" id="file">
        <button type="submit" onclick="sub()">提交,文件上传形式</button>
        <ul>
            <li onclick="post_json()">一般的json形式,最常见</li>
            <li onclick="post_form()">form表单形式</li>
            <li onclick="post_text()">text形式-不常用</li>
            <li onclick="get_init()">get请求</li>
        </ul>
        <div id="box">
            <h3>请求结果</h3>

        </div>
    </body>
    <script>
        const box = document.querySelector('#box');
        // axios.defaults.headers.common['Authorization'] = 'zhangxinyong'; // 自定义头信息
        // 注意 不要写axios.defaults.headers.post 这样无效
        // axios.defaults.headers['Content-Type'] = 'application/x-www-form-urlencoded'; //  默认的form表单就是这种形式
        // axios.defaults.headers['Content-Type'] = 'multipart/form-data'; // 对文件分割上传
        // axios.defaults.headers['Content-Type'] = 'application/json'; // 最常见的方式。
        // axios.defaults.headers['Content-Type'] = 'text/xml'; // 不常见

        const url = 'http://127.0.0.1:3000/';
        axios.get(url + '?a=4&b=4').then((res) => {
            console.log(res.data);
        });
        function get_init() {
            axios.get(url + 'test/init?a=4&b=4').then((res) => {
                console.log(res.data);
            });
        }
        function post_json() {
            const config = {
                headers: {
                    'Content-Type': 'application/json'
                }
            };
            axios.post(url + 'test/post?x=json', { a: 3, b: 4 }, config).then((res) => {
                console.log(res.data);
            });
        }
        // 一般的form 表单形式
        function post_form() {
            const config = {
                headers: {
                    'Content-Type': 'application/x-www-form-urlencoded'
                }
            };
            const formData = new FormData();
            formData.append('a', 4444444);
            formData.append('b', 33333);
            axios.post(url + 'test/postForm?x=form', formData, config).then((res) => {
                console.log(res.data);
            });
        }
        // multipart/form-data 
        function sub() {
            const formData = new FormData();
            formData.append('file', document.querySelector('#file').files[0]);
            formData.append('type', 2);
            const config = {
                headers: {
                    'Content-Type': 'multipart/form-data'
                }
            };
            axios.post(url + 'test/uploadfile', formData, config).then((res) => {
                console.log(res.data);
            });
        }

        // text 不常用。就不介绍了
        function post_text() {
            const config = {
                headers: {
                    'Content-Type': 'text/xml'
                }
            };
            axios.post(url + 'test/postText?x=text', { a: 3, b: 4 }, config).then((res) => {
                box.innerHTML += res.data;
            });
        }

        // const http = axios.create({
        //     url: 'test/post?x=uuuuuuuu',
        //     baseURL: url,
        //     mthod: 'post',
        //     params: { a: 33, b: 000 }, // url 拼接的
        //     data: {
        //         x: 'cans'
        //     },
        //     // headers: {
        //     //     'Content-Type': 'text/xml'
        //     // }
        // });
        // http.post(url + 'test/post?x=uuuuuuuu', { a: 3, b: 4 }).then((res) => {
        //     console.log(res.data);
        // });
    </script>

    </html>

axios请求携带cookie报错

报错 翻译一下他的意思就是说携带cookie的时候后台不能设置为 *

const Koa = require('koa');
 const route = require('koa-route');
 const cors = require('koa-cors');
const app = new Koa();

// app.use(cors());
app.use(cors({
    origin: function (ctx) {
        console.log(ctx);
        if (ctx.url == '/data') { // 携带cookie
            return ctx.header.origin;
        } else {
            return '*';
        }
    },
    exposeHeaders: ['WWW-Authenticate', 'Server-Authorization'],
    maxAge: 5,
    credentials: true,
    allowMethods: ['GET', 'POST', 'DELETE'],
    allowHeaders: ['Content-Type', 'Authorization', 'Accept'],
}));
app.use(route.get('/data', (ctx) => {
    console.log(ctx);
    ctx.set
    ctx.body = { data: [1, 2, 3, 4, 45, 5] };
    // return new Promise((resolve, reject) => {
    //     setTimeout(() => {
    //         resolve(ctx.body = { data: [1, 2, 3, 4, 45, 5] })
    //     }, 1000 * 60 * 2.2);
    // })
}));


app.listen(3000, () => {
    console.log('启动成功');
});
document.cookie = "userId=828";
document.cookie = "userName=zhangsan";
console.log(document.cookie);

const URL = 'http://127.0.0.1:3000';
// axios
axios.defaults.withCredentials = true; // 携带cookie
axios(URL + '/data').then((res) => {
    console.log(res.data);
});
// fetch
fetch(URL + '/data', {
    method: 'GET',
    credentials: 'include' // 允许携带cookie
}).then((res) => {
    console.log(res.data);
});

js部分

js 丢失精度

前端通过ajax请求拿到数据json数据然后在展示到页面。今天发现,后端同学给我说,展示的不对
response response

通过上面的图片,可以很清楚的发现,后台返回的和最后转为json的不一样
原因:js的number类型有个最大值(安全值)。即2的53次方, 为9007199254740992。如果超过这个值,那么js会出现不精确的问题。
解决办法:后台返回string

nginx 部分

spa页面不缓存index.html

不缓存 add_header ache-Control 'no-cache, no-store'; #这个是错误的,这样会造成index.html的js css 都不缓存
location = /index.html {
add_header Cache-Control "no-cache, no-store";
}
正确的设置应该是
Cache-Control:max-age=0
Cache-Control的优先级高于Expires
location = /index.html{
expires 0;
}
在客户端向服务端发送http请求时,若返回状态码为304 Not Modified 则表明此次请求为条件请求。在请求头中有两个请求参数:If-Modified-Since 和 If-None-Match。

当客户端缓存了目标资源但不确定该缓存资源是否是最新版本的时候, 就会发送一个条件请求。在进行条件请求时,客户端会提供给服务器一个If-Modified-Since请求头,其值为服务器上次返回响应头中Last-Modified值,还会提供一个If-None-Match请求头,值为服务器上次返回的ETag响应头的值。

服务器会读取到这两个请求头中的值,判断出客户端缓存的资源是否是最新的,如果是的话,服务器就会返回HTTP/304 Not Modified响应头, 但没有响应体.客户端收到304响应后,就会从本地缓存中读取对应的资源。 所以:当访问资源出现304访问的情况下其实就是先在本地缓存了访问的资源。

另一种情况是,如果服务器认为客户端缓存的资源已经过期了,那么服务器就会返回HTTP/200 OK响应,响应体就是该资源当前最新的内容.客户端收到200响应后,就会用新的响应体覆盖掉旧的缓存资源.只有在客户端缓存了对应资源且该资源的响应头中包含了Last-Modified或ETag的情况下,才可能发送条件请求.如果这两个头都不存在,则必须无条件(unconditionally)请求该资源,服务器也就必须返回完整的资源数据.另外,有时候我们浏览器调试的时候不希望本地缓存,可以设置取消缓存即可。

  • index.html header头做缓存
没有做测试
<meta http-equiv="Pragma" content="no-cache">
<meta http-equiv="Cache-Control" content="no-cache">
<meta http-equiv="Expires" content="0">

淋雨一直走

Oh
人都应该有梦
有梦就别怕痛
有雷声在轰不停
雨泼进眼里看不清
谁急速狂飙
溅我一身
的泥泞
我决定我想去哪里
往天堂要跳过地狱
也不恐惧
不逃避
这不是脾气
是所谓志气
与勇气
你能推我下悬崖
我能学会飞行
从不听
谁的命令
很独立
耳朵用来听自己的心灵
淋雨一直走
是一颗宝石就该闪烁
人都应该有梦
Oh
有梦就别怕痛
淋雨一直走
是道阳光就该暖和
人都应该有梦
Oh
有梦就别怕痛
有前面盘旋的秃鹰
有背后尖酸的耳语
黑色的童话
是给长大
的洗礼
要独特才是流行
无法复制的自己
让我连受伤
也有型
这不是脾气
是所谓志气
与勇气
你能推我下悬崖
我能学会飞行
从不听
谁的命令
很独立
耳朵用来听自己的心灵
淋雨一直走
是一颗宝石就该闪烁
人都应该有梦
Oh
有梦就别怕痛
淋雨一直走
是道阳光就该暖和
人都应该有梦
Oh
有梦就别怕痛
有时掉进黑洞
有时候爬上彩虹
在下一秒钟
命运如何转动
没有人会晓得 Oh
我说希望无穷
你猜美梦成空
相信和怀疑
总要决斗
淋雨一直走
是一颗宝石就该闪烁
人都应该有梦
Oh
有梦就别怕痛
淋雨一直走
是道阳光就该暖和
人都应该有梦
Oh
有梦就别怕痛
淋雨一直走
是一颗宝石就该闪烁
人都应该有梦
Oh
有梦就别怕痛
淋雨一直走
是道阳光就该暖和
人都应该有梦
Oh
有梦就别怕痛