管灌系统农户端微信小程序(嘉峪关应用)
zuoxiao
2024-02-26 3f7ec892d68f71e996489d14d9918dc332281b1e
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
<wxs src="./slider.wxs" module="t" />
<wxs src="../common/utils.wxs" module="_" />
 
<view
  style="{{_._style([style, customStyle])}}"
  class="{{_.cls(classPrefix, [['top', label || scaleTextArray.length], ['disabled', disabled], ['range', range]])}} class {{prefix}}-class {{vertical ? classPrefix + '--vertical' : ''}}"
>
  <block wx:if="{{!range}}">
    <text wx:if="{{showExtremeValue}}" class="{{classPrefix}}__value {{classPrefix}}__value--min">
      {{ label ? t.getValue(label, min) : min}}
    </text>
    <view
      id="sliderLine"
      class="{{_.cls(classPrefix + '__bar', [['disabled', disabled], theme, ['marks', isScale && theme == 'capsule']])}} {{prefix}}-class-bar"
      bind:tap="onSingleLineTap"
    >
      <block wx:if="{{isScale}}">
        <view
          class="{{_.cls(classPrefix + '__scale-item', [['active', _value >= item.val], ['disabled', disabled], theme, ['hidden', (index == 0 || index == scaleArray.length - 1) && theme == 'capsule' || value == item.val]])}}"
          wx:for="{{scaleArray}}"
          wx:key="index"
          style="{{vertical ? 'top' :  'left'}}:{{item.left}}px; {{vertical ? 'transform: translate(-50%, -50%);' : 'transform: translateX(-50%);'}}"
          aria-hidden="{{true}}"
        >
          <view wx:if="{{scaleTextArray.length}}" class="{{_.cls(classPrefix + '__scale-desc', [theme])}}">
            {{scaleTextArray[index]}}
          </view>
        </view>
      </block>
      <view
        class="{{_.cls(classPrefix + '__line', [['disabled', disabled], theme, 'single'])}} {{prefix}}-class-bar-active"
        style="{{vertical ? 'height' : 'width'}}: {{lineBarWidth}}"
      >
        <view
          id="singleDot"
          class="{{classPrefix}}__dot {{prefix}}-class-cursor"
          catch:touchstart="onTouchStart"
          catch:touchmove="onSingleLineTap"
          catch:touchend="onTouchEnd"
          catch:touchcancel="onTouchEnd"
        >
          <view
            wx:if="{{label || isVisibleToScreenReader}}"
            class="{{_.cls(classPrefix+'__dot-value', [['sr-only', !label]])}}"
            aria-role="alert"
            aria-live="assertive"
            aria-hidden="{{!isVisibleToScreenReader}}"
          >
            {{t.getValue(label, _value) || _value}}
          </view>
          <view
            class="{{classPrefix}}__dot-slider"
            aria-role="slider"
            aria-disabled="{{disabled}}"
            aria-valuemax="{{max}}"
            aria-valuemin="{{min}}"
            aria-valuenow="{{_value}}"
            aria-valuetext="{{t.getValue(label, _value) || _value}}"
          ></view>
        </view>
      </view>
    </view>
    <!-- <view wx:if="{{label}}" class="{{classPrefix}}__value {{classPrefix}}__value--right">
      <text class="{{classPrefix}}__value--text"> {{t.getValue(label, _value)}}</text>
    </view> -->
    <text wx:if="{{showExtremeValue}}" class="{{classPrefix}}__value {{classPrefix}}__value--max">
      {{ label ? t.getValue(label, max) : max}}
    </text>
  </block>
  <!-- range选择器自定义 -->
  <block wx:if="{{range}}">
    <view wx:if="{{showExtremeValue}}" class="{{classPrefix}}__range-extreme {{classPrefix}}__range-extreme--min">
      {{min}}
    </view>
    <view
      id="sliderLine"
      bind:tap="onLineTap"
      class="{{_.cls(classPrefix + '__bar', [['disabled', disabled], theme, ['marks', isScale && theme == 'capsule']])}} {{prefix}}-class-bar"
    >
      <block wx:if="{{isScale}}">
        <view
          class="{{_.cls(classPrefix + '__scale-item', [['active', dotTopValue[1] >= item.val && item.val >= dotTopValue[0]], ['disabled', disabled], theme, ['hidden', (index == 0 || index == scaleArray.length - 1) && theme == 'capsule' || value == item.val]])}}"
          wx:for="{{scaleArray}}"
          wx:for-index="index"
          wx:key="index"
          style="{{vertical ? 'top' :  'left'}}:{{item.left}}px; {{vertical ? 'transform: translate(-50%, -50%);' : 'transform: translateX(-50%);'}}"
          aria-hidden="{{true}}"
        >
          <view wx:if="{{scaleTextArray.length}}" class="{{_.cls(classPrefix + '__scale-desc', [theme])}}"
            >{{scaleTextArray[index]}}</view
          >
        </view>
      </block>
      <view
        class="{{_.cls(classPrefix + '__line', [['disabled', disabled], theme])}} {{prefix}}-class-bar-active"
        style="{{vertical ? 'top' : 'left'}}: {{lineLeft}}px; {{vertical ? 'bottom' : 'right'}}: {{lineRight}}px"
      >
        <view
          id="leftDot"
          catch:touchstart="onTouchStart"
          catch:touchmove="onTouchMoveLeft"
          catch:touchend="onTouchEnd"
          catch:touchcancel="onTouchEnd"
          class="{{classPrefix}}__dot {{classPrefix}}__dot--left {{prefix}}-class-cursor"
        >
          <view
            wx:if="{{label || isVisibleToScreenReader}}"
            class="{{_.cls(classPrefix+'__dot-value', [['sr-only', !label]])}}"
            aria-role="alert"
            aria-live="assertive"
            aria-hidden="{{!isVisibleToScreenReader}}"
          >
            {{t.getValue(label, dotTopValue[0]) || dotTopValue[0]}}
          </view>
          <view
            class="{{classPrefix}}__dot-slider"
            aria-role="slider"
            aria-disabled="{{disabled}}"
            aria-valuemax="{{max}}"
            aria-valuemin="{{min}}"
            aria-valuenow="{{dotTopValue[0]}}"
            aria-valuetext="{{t.getValue(label, dotTopValue[0]) || dotTopValue[0]}}"
          ></view>
        </view>
        <view
          id="rightDot"
          catch:touchstart="onTouchStart"
          catch:touchmove="onTouchMoveRight"
          catch:touchend="onTouchEnd"
          catch:touchcancel="onTouchEnd"
          class="{{classPrefix}}__dot {{classPrefix}}__dot--right {{prefix}}-class-cursor"
        >
          <view
            wx:if="{{label || isVisibleToScreenReader}}"
            class="{{_.cls(classPrefix+'__dot-value', [['sr-only', !label]])}}"
            aria-role="alert"
            aria-live="assertive"
            aria-hidden="{{!isVisibleToScreenReader}}"
          >
            {{t.getValue(label, dotTopValue[1]) || dotTopValue[1]}}
          </view>
          <view
            class="{{classPrefix}}__dot-slider"
            aria-role="slider"
            aria-disabled="{{disabled}}"
            aria-valuemax="{{max}}"
            aria-valuemin="{{min}}"
            aria-valuenow="{{dotTopValue[1]}}"
            aria-valuetext="{{t.getValue(label, dotTopValue[1]) || dotTopValue[1]}}"
          >
          </view>
        </view>
      </view>
    </view>
    <view wx:if="{{showExtremeValue}}" class="{{classPrefix}}__range-extreme {{classPrefix}}__range-extreme--max">
      {{max}}
    </view>
  </block>
</view>