acupoint-mixin.js 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. /**
  2. * 穴位编辑与自定义模式 mixin
  3. * 负责:穴位图交互、时间选择、方案管理
  4. */
  5. export default {
  6. data() {
  7. return {
  8. picMode: 1, // 1设备 2穴位
  9. acupointIndex: -1,
  10. acupointList: [],
  11. curCase: [],
  12. curCaseIndex: 0,
  13. isShowTimeDrawer: false,
  14. timeRange: [[0, 1, 2, 3], [0, 5, 10, 15, 20, 25, 30, 35, 40, 45, 50, 55]],
  15. selectedHour: 0,
  16. selectedMinute: 0
  17. }
  18. },
  19. methods: {
  20. picModeChange(value) {
  21. if (value === 2) {
  22. // 穴位编辑跳转到独立vue页面(支持更灵活的坐标渲染)
  23. uni.navigateTo({
  24. url: '/pages/device/acupointEdit/acupointEdit'
  25. })
  26. return
  27. }
  28. this.picMode = value
  29. },
  30. showTimeDraw(inx) {
  31. this.acupointIndex = inx
  32. this.isShowTimeDrawer = true
  33. },
  34. bindTimeChange(e) {
  35. const val = e.detail.value
  36. this.selectedHour = this.timeRange[0][val[0]]
  37. this.selectedMinute = this.timeRange[1][val[1]]
  38. },
  39. cancelAijiuTime(val) {
  40. this.isShowTimeDrawer = false
  41. if (val == 1 && this.acupointIndex >= 0) {
  42. const sumMinutes = this.selectedHour * 60 + this.selectedMinute
  43. const point = this.acupointList[this.acupointIndex]
  44. this.curCase = [{
  45. id: point.id,
  46. time: sumMinutes,
  47. _x: point._x || 0,
  48. _y: point._y || 0
  49. }]
  50. this.curCaseIndex = this.acupointIndex
  51. }
  52. }
  53. }
  54. }