# nxrmyy-h5 **Repository Path**: h5-websit/nxrmyy-h5 ## Basic Information - **Project Name**: nxrmyy-h5 - **Description**: No description available - **Primary Language**: Unknown - **License**: Not specified - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2023-10-13 - **Last Updated**: 2023-10-26 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README ## nxrmyy-h5 ` #### 介绍 #### 软件架构 软件架构说明 #### 安装​ 1. Taro 项目基于 node,请确保node 环境(>=8.0.0),推荐使用12.18.2,taro使用的是2.2.13 #### CLI 工具安装(安装2.2.13) 项目采用的是2.2.13` ` npm install -g @tarojs/cli@2.2.13 ` 使用 npm 安装 CLI 1``` $ npm install -g @tarojs/cli OR 使用 yarn 安装 CLI $ yarn global add @tarojs/cli OR 安装了 cnpm,使用 cnpm 安装 CLI $ cnpm install -g @tarojs/cli ``` #### 安装依赖 ``` 使用 yarn 安装依赖 $ yarn OR 使用 cnpm 安装依赖 $ cnpm install OR 使用 npm 安装依赖 $ npm install ``` #### 项目启动 ``` npm run dev:h5 npm run build:h5 ``` ## Commit 提交规范 Header部分只有一行,包括三个字段:`type(必需)`、`scope(可选)`和`subject(必需)`。 ### type type用于说明 commit 的类别,只允许使用下面7个标识。 - feat:新功能(feature) - fix:修补bug - docs:文档(documentation) - style: 格式(不影响代码运行的变动) - refactor:重构(即不是新增功能,也不是修改bug的代码变动) - test:增加测试 - chore:构建过程或辅助工具的变动 如果type为feat和fix,则该 commit 将肯定出现在 Change log 之中。其他情况(docs、chore、style、refactor、test)由你决定,要不要放入 Change log,建议是不要。 ### scope scope用于说明 commit 影响的范围,比如数据层、控制层、视图层等等,视项目不同而不同。 ### subject subject是 commit 目的的简短描述,不超过50个字符。 以动词开头,使用第一人称现在时,比如change,而不是changed或changes 第一个字母小写 结尾不加句号(.) ### 示例 `feat(page): 新增登录页` ## axios 基于promise的网络请求库,作用于node.js 和浏览器中 - 从浏览器创建 XMLHttpRequests - cong node.js 创建http请求 - 支持Promise Api - 拦截请求和响应 - 转换请求和响应数据 - 取消请求 - 自动转换JSON数据 ## 微信电子健康卡 /** apiHealth: { register: `${Health}/registerHealthCard`, // 注册健康卡 healthCardCode: `${Health}/getQRCode`, // 获取健康码二维码图片 getOrderId: `${Health}/getOrderId`, // 获取健康码二维码图片 bind: `${Health}/bind` } */ -- 注册电子健康卡(registerHealthCard) ``` /**非静默授权 */ const AuthHealthCode = () => { const code = GetUrlParam('wechatCode') const local = `${window.location.href}` const sUrl = `https://health.tengmed.com/open/getUserCode?redirect_uri=${encodeURIComponent(local)}` if (code == null || code === '') { window.location.href = `${sUrl}` } } /** 获取url中的wechatCode参数 */ const GetUrlParam = (name) => { var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)", "i"); var r = window.location.search.substr(2).match(reg); if (r != null) return unescape(r[2]); return null; } /** 调用后台接口注册电子健康卡 */ /** registerHealthCard */ async registerHealthCard(params) { const res = await apiHealth.register(params) if(res.rspCode === 100) { params.cardNo = res.record[0].healthCardId params.cardType = '03' this.register(params) } else { this.handleTip(res.rspMsg || '注册失败', 'error') } } ``` -- 一键关联健康卡(registerHealthCard) /** 1、点击一键关联 2、跳转到电子健康卡信息页面, 3、获取url中的wechatCode参数 4、注册健康卡 */ const local = `${locals}/pages/packages/mine/healthCard/detail` const wxUrl = `https://h5-health.tengmed.com/h5/tencent/open/card/regist` window.location.href = `${wxUrl}?redirect_uri=${encodeURIComponent(local)}&hospitalId=${hospitalId}` -- 进入卡包功能 ```async handleOrderId() { const { orderIdParams } = this.state const res = await apiHealth.getOrderId(orderIdParams).then((error) => { return error }) let orderId = res.record[0].orderId || '' if(orderId) { window.location.href = `https://health.tengmed.com/open/takeMsCard?order_id=${orderId}&redirect_uri=${window.window.location.href}` } else { Taro.showToast({ title: '请刷新页面重试!', icon: 'none' }) } } ``` ### nginx配置 ```location ^~/nxrmyy-h5/ { add_header Cache-Control "no-cache, no-store, must-revalidate"; add_header Pragma "no-cache"; add_header Expires 0; alias D:/nginxdist/nxrmyy-h5/dist/; try_files $uri $uri/ /nxrmyy-h5/index.html; index index.html index.htm; } ```