acupoint-mixin.js 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  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. const profileId = this.profileId || ''
  24. uni.navigateTo({
  25. url: '/pages/device/acupointEdit/acupointEdit?profileId=' + encodeURIComponent(profileId)
  26. })
  27. return
  28. }
  29. this.picMode = value
  30. },
  31. showTimeDraw(inx) {
  32. this.acupointIndex = inx
  33. this.isShowTimeDrawer = true
  34. },
  35. bindTimeChange(e) {
  36. const val = e.detail.value
  37. this.selectedHour = this.timeRange[0][val[0]]
  38. this.selectedMinute = this.timeRange[1][val[1]]
  39. },
  40. cancelAijiuTime(val) {
  41. this.isShowTimeDrawer = false
  42. if (val == 1 && this.acupointIndex >= 0) {
  43. const sumMinutes = this.selectedHour * 60 + this.selectedMinute
  44. const point = this.acupointList[this.acupointIndex]
  45. this.curCase = [{
  46. id: point.id,
  47. time: sumMinutes,
  48. _x: point._x || 0,
  49. _y: point._y || 0
  50. }]
  51. this.curCaseIndex = this.acupointIndex
  52. }
  53. }
  54. }
  55. }