管灌系统农户端微信小程序(嘉峪关应用)
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
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
<wxs src="../common/utils.wxs" module="_" />
<wxs src="./upload.wxs" module="this" />
<wxs src="./drag.wxs" module="handler" />
 
<view style="{{_._style([style, customStyle])}}" class="{{classPrefix}} class {{prefix}}-class">
  <t-grid
    gutter="{{gutter}}"
    border="{{false}}"
    align="center"
    column="{{column}}"
    style="{{draggable? 'overflow: visible' : ''}}"
  >
    <block wx:if="{{!dragLayout}}">
      <!-- 图片/视频 -->
      <t-grid-item
        wx:for="{{customFiles}}"
        wx:key="url"
        wx:for-item="file"
        t-class="{{classPrefix}}__grid {{classPrefix}}__grid-file"
        t-class-content="{{classPrefix}}__grid-content"
        aria-role="presentation"
      >
        <view
          class="{{classPrefix}}__wrapper {{disabled? classPrefix + '__wrapper--disabled' : '' }}"
          style="{{gridItemStyle}}"
          aria-role="{{ariaRole || this.getWrapperAriaRole(file)}}"
          aria-label="{{ariaLabel || this.getWrapperAriaLabel(file)}}"
        >
          <t-image
            wx:if="{{file.type !== 'video'}}"
            data-file="{{file}}"
            bind:tap="onProofTap"
            data-index="{{index}}"
            t-class="{{classPrefix}}__thumbnail"
            style="{{imageProps && imageProps.style || ''}}"
            src="{{file.url}}"
            mode="{{imageProps && imageProps.mode || 'aspectFill'}}"
            error="{{imageProps && imageProps.error || 'default'}}"
            lazy="{{imageProps && imageProps.lazy || false}}"
            loading="{{imageProps && imageProps.loading || 'default'}}"
            shape="{{imageProps && imageProps.shape || 'round'}}"
            webp="{{imageProps && imageProps.webp || false}}"
            showMenuByLongpress="{{imageProps && imageProps.showMenuByLongpress || false}}"
          />
          <video
            data-file="{{file}}"
            bind:tap="onFileClick"
            wx:if="{{file.type === 'video'}}"
            class="{{classPrefix}}__thumbnail"
            src="{{file.url}}"
            controls
            autoplay="{{false}}"
            objectFit="contain"
          />
          <!-- 失败重试 -->
          <view
            data-index="{{index}}"
            wx:if="{{file.status && file.status != 'done'}}"
            class="{{classPrefix}}__progress-mask"
            data-file="{{file}}"
            bind:tap="onFileClick"
          >
            <block wx:if="{{file.status == 'loading'}}">
              <t-icon t-class="{{classPrefix}}__progress-loading" name="loading" size="24" aria-hidden />
              <view class="{{classPrefix}}__progress-text">{{file.percent ? file.percent + '%' : '上传中...'}}</view>
            </block>
            <t-icon wx:else name="{{file.status == 'reload' ? 'refresh' : 'close-circle'}}" size="24" aria-hidden />
            <view wx:if="{{file.status == 'reload' || file.status == 'failed'}}" class="{{classPrefix}}__progress-text">
              {{file.status == 'reload' ? '重新上传' : '上传失败'}}
            </view>
          </view>
 
          <!-- 删除 -->
          <view
            class="{{classPrefix}}__close-btn hotspot-expanded"
            bindtap="onDelete"
            data-index="{{index}}"
            aria-role="button"
            aria-label="删除"
          >
            <t-icon name="close" size="16" color="#fff" />
          </view>
        </view>
      </t-grid-item>
 
      <!-- 添加 -->
      <t-grid-item
        wx:if="{{customLimit > 0}}"
        t-class="{{classPrefix}}__grid"
        t-class-content="{{classPrefix}}__grid-content"
        bindclick="onAddTap"
        aria-label="上传"
      >
        <view class="{{classPrefix}}__wrapper" style="{{gridItemStyle}}">
          <slot name="add-content" />
          <block wx:if="{{addContent}}">{{addContent}}</block>
          <view wx:else class="{{classPrefix}}__add-icon {{disabled? classPrefix + '__add-icon--disabled' : '' }}">
            <t-icon name="add" />
          </view>
        </view>
      </t-grid-item>
    </block>
    <block wx:else>
      <view
        class="{{classPrefix}}__drag"
        list="{{dragList}}"
        style="{{dragWrapStyle}};"
        dragBaseData="{{dragBaseData}}"
        change:list="{{handler.listObserver}}"
        change:dragBaseData="{{handler.baseDataObserver}}"
      >
        <view
          class="{{classPrefix}}__drag-item"
          wx:for="{{customFiles}}"
          wx:key="url"
          wx:for-item="file"
          style="width: {{100 / column}}%; --td-upload-drag-transition-duration: {{transition.duration}}ms; --td-upload-drag-transition-timing-function: {{transition.timingFunction}}"
          bind:longpress="{{handler.longPress}}"
          catch:touchmove="{{dragging ? handler.touchMove : ''}}"
          catch:touchend="{{dragging ? handler.touchEnd : ''}}"
          data-index="{{index}}"
        >
          <!-- 图片/视频 -->
          <t-grid-item
            t-class="{{classPrefix}}__grid {{classPrefix}}__grid-file"
            t-class-content="{{classPrefix}}__grid-content"
            aria-role="presentation"
            style="width: 100%"
          >
            <view
              class="{{classPrefix}}__wrapper {{disabled? classPrefix + '__wrapper--disabled' : '' }}"
              style="{{gridItemStyle}};"
              aria-role="{{ariaRole || this.getWrapperAriaRole(file)}}"
              aria-label="{{ariaLabel || this.getWrapperAriaLabel(file)}}"
            >
              <t-image
                wx:if="{{file.type !== 'video'}}"
                data-file="{{file}}"
                bind:tap="onProofTap"
                data-index="{{index}}"
                t-class="{{classPrefix}}__thumbnail"
                style="{{imageProps && imageProps.style || ''}}"
                src="{{file.url}}"
                mode="{{imageProps && imageProps.mode || 'aspectFill'}}"
                error="{{imageProps && imageProps.error || 'default'}}"
                lazy="{{imageProps && imageProps.lazy || false}}"
                loading="{{imageProps && imageProps.loading || 'default'}}"
                shape="{{imageProps && imageProps.shape || 'round'}}"
                webp="{{imageProps && imageProps.webp || false}}"
                showMenuByLongpress="{{imageProps && imageProps.showMenuByLongpress || false}}"
              />
              <video
                data-file="{{file}}"
                bind:tap="onFileClick"
                wx:if="{{file.type === 'video'}}"
                class="{{classPrefix}}__thumbnail"
                src="{{file.url}}"
                controls
                autoplay="{{false}}"
                objectFit="contain"
              />
              <!-- 失败重试 -->
              <view
                data-index="{{index}}"
                wx:if="{{file.status && file.status != 'done'}}"
                class="{{classPrefix}}__progress-mask"
                data-file="{{file}}"
                bind:tap="onFileClick"
              >
                <block wx:if="{{file.status == 'loading'}}">
                  <t-icon t-class="{{classPrefix}}__progress-loading" name="loading" size="24" aria-hidden />
                  <view class="{{classPrefix}}__progress-text"
                    >{{file.percent ? file.percent + '%' : '上传中...'}}</view
                  >
                </block>
                <t-icon wx:else name="{{file.status == 'reload' ? 'refresh' : 'close-circle'}}" size="24" aria-hidden />
                <view
                  wx:if="{{file.status == 'reload' || file.status == 'failed'}}"
                  class="{{classPrefix}}__progress-text"
                >
                  {{file.status == 'reload' ? '重新上传' : '上传失败'}}
                </view>
              </view>
 
              <!-- 删除 -->
              <view
                class="{{classPrefix}}__close-btn hotspot-expanded"
                bindtap="onDelete"
                data-index="{{index}}"
                data-url="{{file.url}}"
                aria-role="button"
                aria-label="删除"
              >
                <t-icon name="close" size="16" color="#fff" />
              </view>
            </view>
          </t-grid-item>
          <!-- 添加 -->
        </view>
        <view class="{{classPrefix}}__drag-item" style="width: {{100 / column}}%" wx:if="{{customLimit > 0}}">
          <t-grid-item
            t-class="{{classPrefix}}__grid"
            t-class-content="{{classPrefix}}__grid-content"
            bindclick="onAddTap"
            aria-label="上传"
            style="width: 100%"
          >
            <view class="{{classPrefix}}__wrapper" style="{{gridItemStyle}}">
              <slot name="add-content" />
              <block wx:if="{{addContent}}">{{addContent}}</block>
              <view wx:else class="{{classPrefix}}__add-icon {{disabled? classPrefix + '__add-icon--disabled' : '' }}">
                <t-icon name="add" />
              </view>
            </view>
          </t-grid-item>
        </view>
      </view>
    </block>
  </t-grid>
</view>