0.0.11 • Published 4 years ago

salus-third v0.0.11

Weekly downloads
37
License
-
Repository
-
Last release
4 years ago

安装

yarn add salus-third

Or

npm i salus-third

引入

一般在入口文件中引入

import Salus from 'salus-third'

Vue.use(Salus)

使用 (看下面最新使用方式👇)

在业务代码中 可以通过 this.$salus 直接访问 Salus 实例。目前提供的功能较少,后期会根据业务添加。

比如直接在 app.vue 中调用

export default {
  name: "App",
  mounted() {
    // 监听info事件,获取平台鉴权数据
    this.$salus.addListener('info', this.onInfo)
    // 请在 addListener 之后调用方法,否则监听不到返回的事件
    this.$salus.getInfo()
    // 设置标题
    this.$salus.setTitle('我是标题')
  },
  beforeDestroy() {
    this.$salus.removeListener('info', this.onInfo)
    // 当不需要和平台交互时,可以调用exit关闭监听
    this.$salus.exit()
  },
  methods: {
    onInfo(data){
      // 包含 deviceCode、hospital、token 等
      console.log('onInfo', data)
    },
    handleSuccess(){
      // 业务处理成功后调用可跳转到配置信息里对应的路由
      this.$salus.done()
    }
  }
};

Function

更多的方法将根据业务需求添加

方法名说明
setTitle('标签名')设置当前页面的标签名(只能设置一次)
getInfo()获取鉴权数据,注:调用该方法前请确保已经监听info事件
done()业务逻辑处理成功后调用,平台会根据配置跳转页面
exit()用于移除所有监听,调用后无法监听平台事件
addListener(action, (data)=>{})监听平台事件,具体事件见下文 Action 模块
removeListener(action, func)移除监听

Action

更多的事件将根据业务需求添加

事件名说明
info平台获取到鉴权数据后下发给第三方

最新使用方式

新版的sdk使用更优雅的方式与平台进行交互,去掉了使用监听的方式获取父级事件。

API

选择患者
selectPatient(params)

参数说明

  • type:弹窗类型,doctor、charge、medical、nurse、chargeBack

示例

async getUser() {
  let re = await this.$salus.selectPatient({
    type: 'doctor' 
  });
  console.log("patient info", re);
}
获取token
getToken

示例

async getToken() {
  let re = await this.$salus.getToken();
  console.log("token info", re);
}
查看检查报告
showReportDetail(params)

参数说明

  • visitId

  • emrrecid:报告id

示例

getReport() {
  this.$salus.showReportDetail({
    visitId: 7620,
    emrrecid: 4328
  });
}
查看检验报告
showReportPymolDetail(params)

参数说明

  • visitId
  • emrrecid:报告id

示例

getReport2() {
  this.$salus.showReportPymolDetail({
    visitId: 7674,
    emrrecid: 4339
  });
}
0.0.11

4 years ago

0.0.10

4 years ago

0.0.9

4 years ago

0.0.8

4 years ago

0.0.5

4 years ago

0.0.4

4 years ago

0.0.7

4 years ago

0.0.6

4 years ago

0.0.3

4 years ago

0.0.2

5 years ago

0.0.1

5 years ago