| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140 |
- import Apis from '@/common/apis/index'
- let isOver = false
- export default {
- // 获取已绑定人
- async initData() {
- try {
- uni.showLoading({
- title: '加载中...'
- })
- const res = await Apis.GetAssociation()
- if (!res.data.length) {
- this.userList = []
- this.currentPatient = ''
- return uni.hideLoading()
- }
- this.userList = res.data
- this.initHealthReport()
- } catch (e) {
- //TODO handle the exception
- }
- },
- // 获取报告
- async initHealthReport() {
- try {
- if (this.$store.state.counter.currentPatient) {
- this.currentPatient = this.$store.state.counter.currentPatient;
- } else {
- this.currentPatient = this.userList.length ? this.userList[0] : ''
- }
- if (!this.currentPatient) return
- this.dateIndex = 0
- const res = await Apis.GetHealthReport({
- id: this.currentPatient.id
- })
- res.data.forEach((v) => {
- v.date = v.time && v.time.split(' ')[0]
- })
- this.currentPatient = {
- ...this.currentPatient,
- ...res.data[0]
- }
- this.data = res.data
- uni.hideLoading()
- } catch (e) {
- //TODO handle the exception
- }
- },
- onEnterPage(page, val) {
- if (!this.userInfo) {
- return uni.navigateTo({
- url: '../login/index'
- })
- }
- switch (page) {
- case 'addPatient':
- uni.navigateTo({
- url: '../addPatient/index'
- })
- break
- case 'chart':
- uni.navigateTo({
- url: '../chart/index?id=' + val
- })
- break
- }
- },
- bindLookMemo(name) {
- this.popupData.title = name
- this.popupData.img = ''
- switch (name) {
- case '球镜':
- this.popupData.content =
- '球镜(S)代表近视或者远视的度数,单位为屈光度(D),其屈光力大小在各个方向相同。当球镜符号为(﹣)时代表近视,符号为(+)时代表远视。医学上用于记录的方式与我们生活中所说的眼镜度数略有不同,-3.00DS代表“300度近视”,而+2.50DS则代表“250度远视”。'
- break
- case '柱镜':
- this.popupData.content =
- '柱镜(C)表示散光的度数,单位为屈光度(D),散光是指眼睛在不同方向上的屈光力并不相同,使外界的平行光线进入眼睛后不能形成一个焦点,此时需要通过柱镜进行矫正。当柱镜符号为(﹣)时代表近视散光,符号为(+)时代表远视散光。如-0.50DC代表“50度近视散光”,+0.75DC代表“75度远视散光”。'
- break
- case '轴位':
- this.popupData.content =
- '轴位(A)代表柱镜所在轴的方向。当眼睛存在散光时,需要通过柱镜对屈光状态进行矫正,此时精确验配柱镜的轴位可以良好的改善视觉效果,如果眼镜散光轴位验配误差较大,则有可能导致镜片适应不良、视物变形、头晕甚至呕吐。'
- break
- }
- this.$refs.popupShow.open()
- },
- bindChangeDate(item, index) {
- this.dateIndex = index
- this.scrollView = 'bl' + item.code
- this.currentPatient = {
- ...this.currentPatient,
- ...item
- }
- },
- // 打开切换学生弹窗
- bindOpenUserPopup() {
- this.$refs.userPopup.open()
- },
- // 切换学生
- bindChangeUser(event) {
- this.userValue = event.detail.value
- },
- // 滑动开始
- bindPickStartUser() {
- isOver = true
- },
- // 滑动结束
- bindPickEndUser() {
- isOver = false
- },
- // 确认选择学生
- bindConfirmUser() {
- if (isOver) return
- uni.showLoading({
- title: '加载中...'
- })
- this.currentPatient = this.userList.length ? this.userList[this.userValue[0]] : null
- this.$store.commit('SET_CURRENT_PATIENT', this.currentPatient)
- this.initHealthReport();
- this.$refs.userPopup.close()
- },
- bindScrollPage(event) {
- var scrollfx = event.detail.deltaY;
- if (scrollfx < 0) {
- // 向下滑动
- this.scrollBottom = true
- } else {
- // 向上滑动
- this.scrollBottom = false
- }
- },
- bindContact() {
- wx.openCustomerServiceChat({
- extInfo: {url: 'https://work.weixin.qq.com/kfid/kfc68fd21608ac5e9d0'},
- corpId: 'ww7975bc6b305b44e9',
- complete(res) {
- console.log(res)
- }
- })
- }
- }
|