# ydgx-vue3 **Repository Path**: solidbullet/test ## Basic Information - **Project Name**: ydgx-vue3 - **Description**: No description available - **Primary Language**: JavaScript - **License**: Not specified - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2021-09-23 - **Last Updated**: 2021-10-11 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README ad4c705f24d3 docker run -d -p 3000:80 --name nginx01 --privileged=true -v /usr/local/conf:/etc/nginx ad4c705f24d3 node-v12.14.1-linux-x64.tar.xz cnpm init @vitejs/app ydgx-vue3 cd ydgx-vue3 npm install 需要引入的库 npm install qrcode.vue npm install vue-router@4 cnpm i --save ant-design-vue@next -S 本地跨域: axios跨域问题用axios.request解决,vite.config.js里面设置代理,然后用request设置params和body参数,params主要是根据查询token拼接http的url,body传递post中的data参数 '/api':{ target:'https://api.weixin.qq.com/tcb/invokecloudfunction', } axios 发送post请求的时候,一定要设置header,const options = {url:'/api',method:'post',params:params,data:body,Headers:{'Content-Type':'application/x-www-form-urlencoded'}}; psftp上传文件夹到linux服务器命令,先open care421.top, 然后:put -r c:/dist /usr/share/nginx/html -r 表示文件夹 npm run build 打包上传之后生成dist文件夹,通过psftp上传到服务器的/usr/share/nginx/html/dist,此时需要nginx进行poxy_pass的代理转发 服务器跨域: nginx.conf配置文件(路径:/usr/local/src/nginx-1.6.2/conf/nginx.conf): location /token{ proxy_pass https://api.weixin.qq.com/cgi-bin/token?grant_type=client_credential&appid=wxa623c92306835344&secret=ae840a074538bcd4e72780ea3fec6db9; } location /api{ if ($request_method = 'OPTIONS') { add_header Access-Control-Allow-Origin '$http_origin'; add_header Access-Control-Allow-Headers 'X-Requested-With,aheader, bheader, cheader'; add_header Access-Control-Allow-Methods 'GET,POST,OPTIONS'; add_header Access-Control-Allow-Credentials 'true'; add_header Access-Control-Max-Age 86400; return 204; } proxy_pass https://api.weixin.qq.com/tcb/invokecloudfunction; } nginx 查看进程: ps aux | grep nginx ,关闭进程 kill -QUIT PID nginx运行: nginx -c /usr/local/src/nginx-1.6.2/conf/nginx.conf ---------------docker 管理ydgx-vue3 应用------------ docker exec -it f180fbfd6302 /bin/bash 进入应用 put -r c:/dist /home/www/dist 从本地拷贝dist文件夹道服务器宿主机 docker cp dist f180fbfd6302:/usr/share/nginx/html 从宿主机拷贝到容器 --------------docker种的nginx 端口映射--------------------------- docker容器内 /etc/nginx/nginx.conf 文件最后一句 include /etc/nginx/conf.d/*.conf ,表明了 真正的配置文件在cond.d文件夹里面的conf文件中 conf.d文件夹下面是default.conf,修改这个文件才行。