methods.js 2.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  1. import Apis from '@/common/apis/index'
  2. export default {
  3. async initData() {
  4. try {
  5. uni.showLoading({
  6. title: '加载中...'
  7. })
  8. const res = await Apis.GetAssociation()
  9. this.userList = res.data
  10. this.currentPatient = this.userList.length ? this.userList[0] : null
  11. this.$store.commit('SET_CURRENT_PATIENT', this.currentPatient)
  12. this.initHealthReport();
  13. } catch (e) {
  14. //TODO handle the exception
  15. }
  16. },
  17. async initHealthReport() {
  18. try {
  19. const res = await Apis.GetHealthReport({
  20. id: this.currentPatient.id
  21. })
  22. res.data.forEach((v) => {
  23. v.date = v.time && v.time.split(' ')[0]
  24. })
  25. this.currentPatient = {
  26. ...this.currentPatient,
  27. ...res.data[0]
  28. }
  29. this.data = res.data
  30. uni.hideLoading()
  31. } catch (e) {
  32. //TODO handle the exception
  33. }
  34. },
  35. onEnterPage(page) {
  36. if (!this.userInfo) {
  37. return uni.navigateTo({
  38. url: '../login/index'
  39. })
  40. }
  41. switch (page) {
  42. case 'addPatient':
  43. uni.navigateTo({
  44. url: '../addPatient/index'
  45. })
  46. break
  47. }
  48. },
  49. bindLookMemo(name){
  50. this.popupData.title = name
  51. this.popupData.img = ''
  52. switch (name) {
  53. case '球镜':
  54. this.popupData.content =
  55. '球镜(S)代表近视或者远视的度数,单位为屈光度(D),其屈光力大小在各个方向相同。当球镜符号为(﹣)时代表近视,符号为(+)时代表远视。医学上用于记录的方式与我们生活中所说的眼镜度数略有不同,-3.00DS代表“300度近视”,而+2.50DS则代表“250度远视”。'
  56. break
  57. case '柱镜':
  58. this.popupData.content =
  59. '柱镜(C)表示散光的度数,单位为屈光度(D),散光是指眼睛在不同方向上的屈光力并不相同,使外界的平行光线进入眼睛后不能形成一个焦点,此时需要通过柱镜进行矫正。当柱镜符号为(﹣)时代表近视散光,符号为(+)时代表远视散光。如-0.50DC代表“50度近视散光”,+0.75DC代表“75度远视散光”。'
  60. break
  61. case '轴位':
  62. this.popupData.content =
  63. '轴位(A)代表柱镜所在轴的方向。当眼睛存在散光时,需要通过柱镜对屈光状态进行矫正,此时精确验配柱镜的轴位可以良好的改善视觉效果,如果眼镜散光轴位验配误差较大,则有可能导致镜片适应不良、视物变形、头晕甚至呕吐。'
  64. break
  65. }
  66. this.$refs.popupShow.open()
  67. },
  68. bindChangeUserPopup() {
  69. this.$refs.userPopup.open()
  70. },
  71. bindConfirmUser() {
  72. uni.showLoading({
  73. title: '加载中...'
  74. })
  75. this.currentPatient = this.userList.length ? this.userList[this.userValue[0]] : null
  76. this.$store.commit('SET_CURRENT_PATIENT', this.currentPatient)
  77. this.initHealthReport();
  78. this.$refs.userPopup.close()
  79. },
  80. bindChangeDate(item, index) {
  81. this.dateIndex = index
  82. this.scrollView = 'bl' + item.code
  83. },
  84. bindChangeUserList(event) {
  85. this.userValue = event.detail.value
  86. },
  87. }