oxy-uni-ui 2.1.1 → 2.1.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (183) hide show
  1. package/attributes.json +1 -1
  2. package/components/common/abstracts/variable.scss +13 -2
  3. package/components/oxy-checkbox/index.scss +37 -2
  4. package/components/oxy-sort-button/index.scss +3 -4
  5. package/components/oxy-tag/index.scss +157 -17
  6. package/components/oxy-tag/oxy-tag.vue +14 -2
  7. package/components/oxy-tag/types.ts +9 -0
  8. package/dev-tools.ts +2 -0
  9. package/devTools/components/DevToolsOverlay.vue +56 -0
  10. package/devTools/components/DevToolsUiHost.vue +589 -0
  11. package/devTools/config.js +55 -0
  12. package/devTools/core/components/mpDevBubble.vue +174 -0
  13. package/devTools/core/libs/createH5Bubble.js +156 -0
  14. package/devTools/core/libs/devCache.js +151 -0
  15. package/devTools/core/libs/devOptions.js +163 -0
  16. package/devTools/core/libs/devUi.js +219 -0
  17. package/devTools/core/libs/drawView.js +140 -0
  18. package/devTools/core/libs/errorReport.js +64 -0
  19. package/devTools/core/libs/jsonCompress.js +334 -0
  20. package/devTools/core/libs/logReport.js +59 -0
  21. package/devTools/core/libs/pageLinkList.js +125 -0
  22. package/devTools/core/libs/timeFormat.js +94 -0
  23. package/devTools/core/proxy/console.js +430 -0
  24. package/devTools/core/proxy/index.js +36 -0
  25. package/devTools/core/proxy/request.js +495 -0
  26. package/devTools/core/proxy/storage.js +113 -0
  27. package/devTools/core/proxy/uniBus.js +153 -0
  28. package/devTools/core/proxy/uniListen.js +192 -0
  29. package/devTools/core/proxy/vueMixin.js +120 -0
  30. package/devTools/index.js +168 -0
  31. package/devTools/page/components/bottomTools.vue +1046 -0
  32. package/devTools/page/components/dialog/addStorage.vue +204 -0
  33. package/devTools/page/components/dialog/createDir.vue +366 -0
  34. package/devTools/page/components/dialog/editDialog.vue +192 -0
  35. package/devTools/page/components/dialog/routeDialog.vue +184 -0
  36. package/devTools/page/components/dialog/sendRequest.vue +603 -0
  37. package/devTools/page/components/dialog/textFileEditDialog.vue +391 -0
  38. package/devTools/page/components/libs/appDelDir.js +86 -0
  39. package/devTools/page/components/libs/dirReader.js +248 -0
  40. package/devTools/page/components/libs/fileSize.js +15 -0
  41. package/devTools/page/components/libs/getRuntimeInfo.js +134 -0
  42. package/devTools/page/components/listItem/consoleItem.vue +314 -0
  43. package/devTools/page/components/listItem/errorItem.vue +292 -0
  44. package/devTools/page/components/listItem/fileSysItem.vue +533 -0
  45. package/devTools/page/components/listItem/infoList.vue +100 -0
  46. package/devTools/page/components/listItem/jsRunnerItem.vue +255 -0
  47. package/devTools/page/components/listItem/logItem.vue +193 -0
  48. package/devTools/page/components/listItem/networkItem.vue +398 -0
  49. package/devTools/page/components/listItem/objectAnalysis.vue +651 -0
  50. package/devTools/page/components/listItem/pages.vue +319 -0
  51. package/devTools/page/components/listItem/routeItem.vue +153 -0
  52. package/devTools/page/components/listItem/setting.vue +734 -0
  53. package/devTools/page/components/listItem/storageList.vue +681 -0
  54. package/devTools/page/components/listItem/tools.vue +315 -0
  55. package/devTools/page/components/listItem/vuexList.vue +599 -0
  56. package/devTools/page/components/main.vue +1867 -0
  57. package/devTools/page/components/mixins/animationControl.js +91 -0
  58. package/devTools/page/components/mixins/mp.js +83 -0
  59. package/devTools/page/components/ui/btnTabs.vue +90 -0
  60. package/devTools/page/components/ui/codeHisPicker.vue +172 -0
  61. package/devTools/page/components/ui/h5Cell.vue +13 -0
  62. package/devTools/page/components/ui/menuBtn.vue +94 -0
  63. package/devTools/page/components/ui/mobileSwiperScroll.vue +74 -0
  64. package/devTools/page/components/ui/requestSpeedLimit.vue +52 -0
  65. package/devTools/page/components/ui/requestTimeoutMock.vue +55 -0
  66. package/devTools/page/components/ui/subTitleBar.vue +101 -0
  67. package/devTools/page/static/copy.png +0 -0
  68. package/devTools/page/static/delete.png +0 -0
  69. package/devTools/page/static/fileSys/AI.png +0 -0
  70. package/devTools/page/static/fileSys/DWG.png +0 -0
  71. package/devTools/page/static/fileSys/EXE.png +0 -0
  72. package/devTools/page/static/fileSys/GIF.png +0 -0
  73. package/devTools/page/static/fileSys/HTML.png +0 -0
  74. package/devTools/page/static/fileSys/PSD.png +0 -0
  75. package/devTools/page/static/fileSys/RVT.png +0 -0
  76. package/devTools/page/static/fileSys/SKP.png +0 -0
  77. package/devTools/page/static/fileSys/SVG.png +0 -0
  78. package/devTools/page/static/fileSys/excel.png +0 -0
  79. package/devTools/page/static/fileSys/pdf.png +0 -0
  80. package/devTools/page/static/fileSys/pptl.png +0 -0
  81. package/devTools/page/static/fileSys/shipin.png +0 -0
  82. package/devTools/page/static/fileSys/tupian.png +0 -0
  83. package/devTools/page/static/fileSys/txt.png +0 -0
  84. package/devTools/page/static/fileSys/weizhiwenjian.png +0 -0
  85. package/devTools/page/static/fileSys/wenjianjia.png +0 -0
  86. package/devTools/page/static/fileSys/word.png +0 -0
  87. package/devTools/page/static/fileSys/yasuo.png +0 -0
  88. package/devTools/page/static/fileSys/yinpin.png +0 -0
  89. package/devTools/page/static/fold.png +0 -0
  90. package/devTools/page/static/menu.png +0 -0
  91. package/devTools/page/static/refresh.png +0 -0
  92. package/devTools/page/static/unfold.png +0 -0
  93. package/devTools/tools.vue +25 -0
  94. package/devTools/type/devTools.d.ts +406 -0
  95. package/oxy-dev-tools/components/DevToolsUiHost.vue +555 -0
  96. package/oxy-dev-tools/config.js +61 -0
  97. package/oxy-dev-tools/core/components/mpDevBubble.vue +176 -0
  98. package/oxy-dev-tools/core/libs/createH5Bubble.js +156 -0
  99. package/oxy-dev-tools/core/libs/devCache.js +149 -0
  100. package/oxy-dev-tools/core/libs/devOptions.js +160 -0
  101. package/oxy-dev-tools/core/libs/devUi.js +219 -0
  102. package/oxy-dev-tools/core/libs/drawView.js +144 -0
  103. package/oxy-dev-tools/core/libs/errorReport.js +60 -0
  104. package/oxy-dev-tools/core/libs/jsonCompress.js +328 -0
  105. package/oxy-dev-tools/core/libs/logReport.js +55 -0
  106. package/oxy-dev-tools/core/libs/pageLinkList.js +121 -0
  107. package/oxy-dev-tools/core/libs/timeFormat.js +93 -0
  108. package/oxy-dev-tools/core/proxy/console.js +398 -0
  109. package/oxy-dev-tools/core/proxy/index.js +33 -0
  110. package/oxy-dev-tools/core/proxy/request.js +473 -0
  111. package/oxy-dev-tools/core/proxy/storage.js +96 -0
  112. package/oxy-dev-tools/core/proxy/uniBus.js +148 -0
  113. package/oxy-dev-tools/core/proxy/uniListen.js +190 -0
  114. package/oxy-dev-tools/core/proxy/vueMixin.js +115 -0
  115. package/oxy-dev-tools/index.ts +183 -0
  116. package/oxy-dev-tools/oxy-dev-tools.vue +62 -0
  117. package/oxy-dev-tools/page/components/bottomTools.vue +933 -0
  118. package/oxy-dev-tools/page/components/dialog/addStorage.vue +184 -0
  119. package/oxy-dev-tools/page/components/dialog/createDir.vue +352 -0
  120. package/oxy-dev-tools/page/components/dialog/editDialog.vue +178 -0
  121. package/oxy-dev-tools/page/components/dialog/routeDialog.vue +170 -0
  122. package/oxy-dev-tools/page/components/dialog/sendRequest.vue +530 -0
  123. package/oxy-dev-tools/page/components/dialog/textFileEditDialog.vue +379 -0
  124. package/oxy-dev-tools/page/components/libs/appDelDir.js +77 -0
  125. package/oxy-dev-tools/page/components/libs/dirReader.js +239 -0
  126. package/oxy-dev-tools/page/components/libs/fileSize.js +15 -0
  127. package/oxy-dev-tools/page/components/libs/getRuntimeInfo.js +132 -0
  128. package/oxy-dev-tools/page/components/listItem/consoleItem.vue +292 -0
  129. package/oxy-dev-tools/page/components/listItem/errorItem.vue +268 -0
  130. package/oxy-dev-tools/page/components/listItem/fileSysItem.vue +511 -0
  131. package/oxy-dev-tools/page/components/listItem/infoList.vue +89 -0
  132. package/oxy-dev-tools/page/components/listItem/jsRunnerItem.vue +236 -0
  133. package/oxy-dev-tools/page/components/listItem/logItem.vue +185 -0
  134. package/oxy-dev-tools/page/components/listItem/networkItem.vue +362 -0
  135. package/oxy-dev-tools/page/components/listItem/objectAnalysis.vue +642 -0
  136. package/oxy-dev-tools/page/components/listItem/pages.vue +285 -0
  137. package/oxy-dev-tools/page/components/listItem/routeItem.vue +140 -0
  138. package/oxy-dev-tools/page/components/listItem/setting.vue +687 -0
  139. package/oxy-dev-tools/page/components/listItem/storageList.vue +623 -0
  140. package/oxy-dev-tools/page/components/listItem/tools.vue +273 -0
  141. package/oxy-dev-tools/page/components/listItem/vuexList.vue +559 -0
  142. package/oxy-dev-tools/page/components/main.vue +1824 -0
  143. package/oxy-dev-tools/page/components/mixins/animationControl.js +80 -0
  144. package/oxy-dev-tools/page/components/mixins/mp.js +76 -0
  145. package/oxy-dev-tools/page/components/ui/btnTabs.vue +77 -0
  146. package/oxy-dev-tools/page/components/ui/codeHisPicker.vue +161 -0
  147. package/oxy-dev-tools/page/components/ui/h5Cell.vue +13 -0
  148. package/oxy-dev-tools/page/components/ui/menuBtn.vue +87 -0
  149. package/oxy-dev-tools/page/components/ui/mobileSwiperScroll.vue +71 -0
  150. package/oxy-dev-tools/page/components/ui/requestSpeedLimit.vue +47 -0
  151. package/oxy-dev-tools/page/components/ui/requestTimeoutMock.vue +50 -0
  152. package/oxy-dev-tools/page/components/ui/subTitleBar.vue +87 -0
  153. package/oxy-dev-tools/page/static/copy.png +0 -0
  154. package/oxy-dev-tools/page/static/delete.png +0 -0
  155. package/oxy-dev-tools/page/static/fileSys/AI.png +0 -0
  156. package/oxy-dev-tools/page/static/fileSys/DWG.png +0 -0
  157. package/oxy-dev-tools/page/static/fileSys/EXE.png +0 -0
  158. package/oxy-dev-tools/page/static/fileSys/GIF.png +0 -0
  159. package/oxy-dev-tools/page/static/fileSys/HTML.png +0 -0
  160. package/oxy-dev-tools/page/static/fileSys/PSD.png +0 -0
  161. package/oxy-dev-tools/page/static/fileSys/RVT.png +0 -0
  162. package/oxy-dev-tools/page/static/fileSys/SKP.png +0 -0
  163. package/oxy-dev-tools/page/static/fileSys/SVG.png +0 -0
  164. package/oxy-dev-tools/page/static/fileSys/excel.png +0 -0
  165. package/oxy-dev-tools/page/static/fileSys/pdf.png +0 -0
  166. package/oxy-dev-tools/page/static/fileSys/pptl.png +0 -0
  167. package/oxy-dev-tools/page/static/fileSys/shipin.png +0 -0
  168. package/oxy-dev-tools/page/static/fileSys/tupian.png +0 -0
  169. package/oxy-dev-tools/page/static/fileSys/txt.png +0 -0
  170. package/oxy-dev-tools/page/static/fileSys/weizhiwenjian.png +0 -0
  171. package/oxy-dev-tools/page/static/fileSys/wenjianjia.png +0 -0
  172. package/oxy-dev-tools/page/static/fileSys/word.png +0 -0
  173. package/oxy-dev-tools/page/static/fileSys/yasuo.png +0 -0
  174. package/oxy-dev-tools/page/static/fileSys/yinpin.png +0 -0
  175. package/oxy-dev-tools/page/static/fold.png +0 -0
  176. package/oxy-dev-tools/page/static/menu.png +0 -0
  177. package/oxy-dev-tools/page/static/refresh.png +0 -0
  178. package/oxy-dev-tools/page/static/unfold.png +0 -0
  179. package/oxy-dev-tools/tools.vue +22 -0
  180. package/oxy-dev-tools/type/devTools.d.ts +406 -0
  181. package/package.json +1 -1
  182. package/tags.json +1 -1
  183. package/web-types.json +1 -1
@@ -0,0 +1,511 @@
1
+ <template>
2
+ <view class="fileItem" @click="fileClick">
3
+ <view class="card">
4
+ <view class="icon">
5
+ <image class="iconImg" :src="icon" mode="aspectFit" />
6
+ </view>
7
+ <view class="fileInfo">
8
+ <text
9
+ class="fileName"
10
+ :style="{
11
+ color: item.type == 'back' ? '#64748b' : '#0f172a'
12
+ }"
13
+ >
14
+ {{ item.name }}
15
+ </text>
16
+ <view v-if="item.type != 'back'" class="fileMeta">
17
+ <text class="textItem">{{ item.date }}</text>
18
+ <text v-if="item.type == 'file'" class="textItem">
19
+ {{ item.sizeText }}
20
+ </text>
21
+ </view>
22
+ <view v-if="item.type != 'back'" class="actionBar">
23
+ <view class="actionBtn" @click.stop="quickCopyPath">
24
+ <text class="actionText">复制路径</text>
25
+ </view>
26
+ <view class="actionBtn more" @click.stop="openMenu">
27
+ <text class="actionText">更多</text>
28
+ </view>
29
+ </view>
30
+ </view>
31
+ </view>
32
+ </view>
33
+ </template>
34
+ <script>
35
+ import appDelDir from '../libs/appDelDir'
36
+ import devUi from '../../../core/libs/devUi.js'
37
+ import iconBack from '../../static/fold.png'
38
+ import iconDir from '../../static/fileSys/wenjianjia.png'
39
+ import iconUnknown from '../../static/fileSys/weizhiwenjian.png'
40
+ import iconDwg from '../../static/fileSys/DWG.png'
41
+ import iconExcel from '../../static/fileSys/excel.png'
42
+ import iconExe from '../../static/fileSys/EXE.png'
43
+ import iconGif from '../../static/fileSys/GIF.png'
44
+ import iconHtml from '../../static/fileSys/HTML.png'
45
+ import iconPdf from '../../static/fileSys/pdf.png'
46
+ import iconPpt from '../../static/fileSys/pptl.png'
47
+ import iconPsd from '../../static/fileSys/PSD.png'
48
+ import iconRvt from '../../static/fileSys/RVT.png'
49
+ import iconVideo from '../../static/fileSys/shipin.png'
50
+ import iconSkp from '../../static/fileSys/SKP.png'
51
+ import iconSvg from '../../static/fileSys/SVG.png'
52
+ import iconImage from '../../static/fileSys/tupian.png'
53
+ import iconTxt from '../../static/fileSys/txt.png'
54
+ import iconWord from '../../static/fileSys/word.png'
55
+ import iconZip from '../../static/fileSys/yasuo.png'
56
+ import iconAudio from '../../static/fileSys/yinpin.png'
57
+
58
+ const fileTypeIconMap = {
59
+ dwg: iconDwg,
60
+ xls: iconExcel,
61
+ xlsx: iconExcel,
62
+ csv: iconExcel,
63
+ exe: iconExe,
64
+ gif: iconGif,
65
+ html: iconHtml,
66
+ pdf: iconPdf,
67
+ ppt: iconPpt,
68
+ psd: iconPsd,
69
+ rvt: iconRvt,
70
+ skp: iconSkp,
71
+ svg: iconSvg,
72
+ png: iconImage,
73
+ jpeg: iconImage,
74
+ jpg: iconImage,
75
+ webp: iconImage,
76
+ bmp: iconImage,
77
+ txt: iconTxt,
78
+ sql: iconTxt,
79
+ js: iconTxt,
80
+ css: iconTxt,
81
+ log: iconTxt,
82
+ json: iconTxt,
83
+ word: iconWord,
84
+ zip: iconZip,
85
+ rar: iconZip,
86
+ gz: iconZip,
87
+ '7z': iconZip,
88
+ mp3: iconAudio,
89
+ wma: iconAudio,
90
+ wav: iconAudio,
91
+ aac: iconAudio,
92
+ flac: iconAudio,
93
+ mp4: iconVideo,
94
+ avi: iconVideo,
95
+ wmv: iconVideo,
96
+ mpg: iconVideo,
97
+ mpeg: iconVideo,
98
+ mov: iconVideo,
99
+ flv: iconVideo,
100
+ '3gp': iconVideo,
101
+ mp3gp: iconVideo,
102
+ mkv: iconVideo,
103
+ rmvb: iconVideo
104
+ }
105
+
106
+ export default {
107
+ props: {
108
+ /**
109
+ * 当前文件路径类型
110
+ */
111
+ dirType: {
112
+ type: String,
113
+ default: ''
114
+ },
115
+ /**
116
+ * 文件路径列表
117
+ */
118
+ dirList: {
119
+ type: Array,
120
+ default: () => []
121
+ },
122
+ /**
123
+ * 单个列表对象
124
+ */
125
+ item: {
126
+ type: Object,
127
+ default() {
128
+ return {
129
+ type: '', // 对象类型 dir back file
130
+ name: '',
131
+ fileType: '', // 文件后缀名称
132
+ size: '', // 文件大小
133
+ icon: '', //图标
134
+ time: '', // 最后更改日期
135
+ date: '',
136
+ fileCount: 0, //文件夹下的文件数量
137
+ directoryCount: 0 //文件夹下的目录数量
138
+ }
139
+ }
140
+ }
141
+ },
142
+ computed: {
143
+ icon() {
144
+ if (this.item.type == 'back') return iconBack
145
+ if (this.item.type == 'dir') return iconDir
146
+ // #ifdef APP-PLUS
147
+ // IOS端直接访问本地图片会报跨域,所以仅支持安卓预览图片
148
+ if (
149
+ uni.getSystemInfoSync().platform == 'android' &&
150
+ this.item.type == 'file' &&
151
+ ['jpg', 'jpeg', 'png', 'gif', 'webp', 'bmp'].indexOf(this.item.fileType) > -1
152
+ ) {
153
+ let path = this.getPath()
154
+ return path
155
+ }
156
+ // #endif
157
+ if (this.item.type == 'file') {
158
+ const ext = String(this.item.fileType || '').toLowerCase()
159
+ return fileTypeIconMap[ext] || iconUnknown
160
+ }
161
+ return iconUnknown
162
+ }
163
+ },
164
+ data() {
165
+ return {}
166
+ },
167
+ methods: {
168
+ /**
169
+ * 点击事件
170
+ */
171
+ fileClick() {
172
+ let that = this
173
+ if (this.item.type == 'dir') {
174
+ this.$emit('goChildDir', this.item.name)
175
+ } else if (this.item.type == 'back') {
176
+ this.$emit('goChildDir', '__back__')
177
+ } else {
178
+ if (
179
+ //? 使用文本编辑器快捷打开文件
180
+ ['txt', 'sql', 'js', 'css', 'html', 'log', 'json'].indexOf(this.item.fileType) != -1
181
+ ) {
182
+ this.openInEdit()
183
+ } else if (['jpg', 'jpeg', 'png', 'gif', 'webp', 'bmp'].indexOf(this.item.fileType) != -1) {
184
+ let path = that.getPath()
185
+ uni.previewImage({
186
+ urls: [path]
187
+ })
188
+ } else {
189
+ this.openMenu()
190
+ }
191
+ }
192
+ },
193
+ /**
194
+ * 使用文本编辑器打开
195
+ */
196
+ openInEdit() {
197
+ let that = this
198
+ let path = that.getPath()
199
+ that.$emit('openEditFileDialog', {
200
+ title: that.item.name,
201
+ canSave: that.dirType != 'PRIVATE_WWW',
202
+ path,
203
+ size: that.item.size
204
+ })
205
+ },
206
+ /**
207
+ * 获取当前文件绝对路径
208
+ */
209
+ getPath() {
210
+ let that = this
211
+ let path = ''
212
+ switch (that.dirType) {
213
+ case 'wx':
214
+ path = wx.env.USER_DATA_PATH
215
+ break
216
+ case 'PRIVATE_DOC':
217
+ path = '_doc'
218
+ break
219
+ case 'PRIVATE_WWW':
220
+ path = '_www'
221
+ break
222
+ case 'PUBLIC_DOCUMENTS':
223
+ path = '_documents'
224
+ break
225
+ case 'PUBLIC_DOWNLOADS':
226
+ path = '_downloads'
227
+ break
228
+ default:
229
+ break
230
+ }
231
+ that.dirList.map((x) => {
232
+ path += '/' + x
233
+ })
234
+ path = path + '/' + that.item.name
235
+ return path
236
+ },
237
+ /**
238
+ * 更多菜单
239
+ */
240
+ openMenu() {
241
+ let that = this
242
+ let path = that.getPath()
243
+
244
+ let menu = [
245
+ {
246
+ text: '复制绝对路径',
247
+ click() {
248
+ // #ifdef APP-PLUS
249
+ path = plus.io.convertLocalFileSystemURL(path)
250
+ // #endif
251
+ that.copyToClipboard(path)
252
+ }
253
+ },
254
+ {
255
+ text: '删除',
256
+ click() {
257
+ devUi.showModal({
258
+ title: '警告',
259
+ content: '是否确认删除' + (that.item.type == 'dir' ? '文件夹:' : '文件:') + that.item.name + '?',
260
+ success(res) {
261
+ if (res.confirm) {
262
+ devUi.showLoading({
263
+ title: '删除中'
264
+ })
265
+
266
+ function delSuccess() {
267
+ devUi.hideLoading()
268
+ devUi.showToast({
269
+ title: '删除成功!',
270
+ icon: 'success'
271
+ })
272
+ that.$emit('getPage')
273
+ }
274
+ function delError() {
275
+ devUi.hideLoading()
276
+ devUi.showToast({
277
+ title: '删除失败',
278
+ icon: 'none'
279
+ })
280
+ }
281
+
282
+ // #ifdef MP-WEIXIN
283
+ if (1) {
284
+ let fs = wx.getFileSystemManager()
285
+
286
+ if (that.item.type == 'file') {
287
+ // ! 删除文件
288
+ fs.unlink({
289
+ filePath: path,
290
+ success: delSuccess,
291
+ fail: delError
292
+ })
293
+ } else {
294
+ // ! 删除文件夹
295
+ fs.rmdir({
296
+ dirPath: path,
297
+ recursive: true,
298
+ success: delSuccess,
299
+ fail: delError
300
+ })
301
+ }
302
+
303
+ return
304
+ }
305
+ // #endif
306
+
307
+ if (that.item.type == 'file') {
308
+ // ! 删除文件
309
+ plus.io.resolveLocalFileSystemURL(
310
+ path,
311
+ (entry) => {
312
+ // 可通过entry对象操作test.html文件
313
+ entry.remove(delSuccess, delError)
314
+ },
315
+ delError
316
+ )
317
+ } else {
318
+ // ! 删除文件夹
319
+ appDelDir(path + '/')
320
+ .then(delSuccess)
321
+ .catch(delError)
322
+ }
323
+ }
324
+ }
325
+ })
326
+ }
327
+ }
328
+ ]
329
+
330
+ let isMp = false
331
+ // #ifdef MP-WEIXIN
332
+ isMp = true
333
+ // #endif
334
+
335
+ if (!isMp || that.item.type != 'dir') {
336
+ menu.push({
337
+ text: '重命名',
338
+ click() {
339
+ that.$emit('editDirName', {
340
+ isDir: that.item.type == 'dir',
341
+ isEdit: true,
342
+ name: that.item.name
343
+ })
344
+ }
345
+ })
346
+ }
347
+
348
+ // #ifdef APP-PLUS
349
+ if (that.item.type == 'file') {
350
+ menu.push({
351
+ text: '调用外部程序打开此文件',
352
+ click() {
353
+ plus.runtime.openFile(path, null, (e) => {
354
+ devUi.showToast({
355
+ title: '文档打开失败!' + e.message,
356
+ icon: 'none'
357
+ })
358
+ })
359
+ }
360
+ })
361
+ }
362
+ // #endif
363
+
364
+ // #ifdef MP-WEIXIN
365
+ if (['doc', 'xls', 'ppt', 'pdf', 'docx', 'xlsx', 'pptx'].indexOf(that.item.fileType) != -1) {
366
+ menu.unshift({
367
+ text: '打开该文档',
368
+ click() {
369
+ let path = that.getPath()
370
+ uni.openDocument({
371
+ filePath: path,
372
+ fail() {
373
+ devUi.showToast({
374
+ title: '文档打开失败!',
375
+ icon: 'none'
376
+ })
377
+ }
378
+ })
379
+ }
380
+ })
381
+ }
382
+ // #endif
383
+
384
+ if (that.item.type == 'file') {
385
+ menu.unshift({
386
+ text: '用文本编辑器打开',
387
+ click() {
388
+ that.openInEdit()
389
+ }
390
+ })
391
+ }
392
+
393
+ devUi.showActionSheet({
394
+ itemList: menu.map((x) => x.text),
395
+ success({ tapIndex }) {
396
+ menu[tapIndex].click()
397
+ }
398
+ })
399
+ },
400
+ quickCopyPath() {
401
+ let path = this.getPath()
402
+ // #ifdef APP-PLUS
403
+ path = plus.io.convertLocalFileSystemURL(path)
404
+ // #endif
405
+ this.copyToClipboard(path)
406
+ },
407
+ copyToClipboard(data) {
408
+ uni.setClipboardData({
409
+ data,
410
+ success: () => {
411
+ devUi.showToast({
412
+ title: '复制成功',
413
+ icon: 'success'
414
+ })
415
+ }
416
+ })
417
+ }
418
+ }
419
+ }
420
+ </script>
421
+ <style lang="scss" scoped>
422
+ .fileItem {
423
+ width: 100%;
424
+ box-sizing: border-box;
425
+ padding: 10rpx 20rpx;
426
+ /* #ifndef APP-PLUS */
427
+ min-height: 96rpx;
428
+ /* #endif */
429
+ .card {
430
+ width: 100%;
431
+ box-sizing: border-box;
432
+ border-radius: 16rpx;
433
+ padding: 14rpx 16rpx 12rpx;
434
+ border: 1px solid rgba(148, 163, 184, 0.2);
435
+ background: #fff;
436
+ box-shadow: 0 4rpx 16rpx rgba(15, 23, 42, 0.05);
437
+ display: flex;
438
+ flex-direction: row;
439
+ align-items: center;
440
+ }
441
+ .icon {
442
+ width: 56rpx;
443
+ height: 56rpx;
444
+ border-radius: 12rpx;
445
+ display: flex;
446
+ flex-direction: row;
447
+ align-items: center;
448
+ justify-content: center;
449
+ background-color: rgba(59, 130, 246, 0.08);
450
+ .iconImg {
451
+ width: 42rpx;
452
+ height: 42rpx;
453
+ }
454
+ }
455
+ .fileInfo {
456
+ margin-left: 14rpx;
457
+ flex: 1;
458
+ min-width: 0;
459
+ display: flex;
460
+ flex-direction: column;
461
+ .fileName {
462
+ width: 100%;
463
+ lines: 1;
464
+ overflow: hidden;
465
+ font-size: 24rpx;
466
+ color: #0f172a;
467
+ line-height: 32rpx;
468
+ }
469
+ .fileMeta {
470
+ margin-top: 4rpx;
471
+ display: flex;
472
+ flex-direction: row;
473
+ align-items: center;
474
+ width: 100%;
475
+ .textItem {
476
+ margin-right: 16rpx;
477
+ font-size: 20rpx;
478
+ line-height: 28rpx;
479
+ color: #64748b;
480
+ }
481
+ }
482
+ .actionBar {
483
+ margin-top: 8rpx;
484
+ display: flex;
485
+ flex-direction: row;
486
+ .actionBtn {
487
+ margin-right: 10rpx;
488
+ height: 40rpx;
489
+ border-radius: 999rpx;
490
+ border: 1px solid #bfdbfe;
491
+ background: #eff6ff;
492
+ padding: 0 12rpx;
493
+ display: flex;
494
+ align-items: center;
495
+ &:active {
496
+ background: #dbeafe;
497
+ }
498
+ &.more {
499
+ border-color: #cbd5e1;
500
+ background: #f8fafc;
501
+ }
502
+ .actionText {
503
+ font-size: 20rpx;
504
+ color: #1e3a8a;
505
+ line-height: 20rpx;
506
+ }
507
+ }
508
+ }
509
+ }
510
+ }
511
+ </style>
@@ -0,0 +1,89 @@
1
+ <template>
2
+ <view class="storageList">
3
+ <objectAnalysis v-if="isLoaded" :data="data" :isOpenFirst="true" :width="710" />
4
+ <view v-else class="dataLoading">
5
+ <text class="status">加载中</text>
6
+ </view>
7
+ </view>
8
+ </template>
9
+ <script>
10
+ import objectAnalysis from './objectAnalysis.vue'
11
+ import getRuntimeInfo from '../libs/getRuntimeInfo'
12
+ export default {
13
+ components: {
14
+ objectAnalysis
15
+ },
16
+ data() {
17
+ return {
18
+ /**
19
+ * 是否完成加载
20
+ */
21
+ isLoaded: false,
22
+ /**
23
+ * 缓存里的数据
24
+ */
25
+ data: {},
26
+ loadToken: 0,
27
+ loadingTimer: 0
28
+ }
29
+ },
30
+ beforeUnmount() {
31
+ this.clearLoadingTimer()
32
+ },
33
+ methods: {
34
+ clearLoadingTimer() {
35
+ if (this.loadingTimer) {
36
+ clearTimeout(this.loadingTimer)
37
+ this.loadingTimer = 0
38
+ }
39
+ },
40
+ /**
41
+ * 加载数据
42
+ */
43
+ async getData() {
44
+ let that = this
45
+ const loadToken = ++that.loadToken
46
+ that.isLoaded = false
47
+ that.clearLoadingTimer()
48
+ let data = await getRuntimeInfo()
49
+ return new Promise((resolve) => {
50
+ that.loadingTimer = setTimeout(() => {
51
+ that.loadingTimer = 0
52
+ if (loadToken != that.loadToken) {
53
+ resolve(false)
54
+ return
55
+ }
56
+ that.data = data
57
+ that.isLoaded = true
58
+ resolve(true)
59
+ }, 80)
60
+ })
61
+ }
62
+ }
63
+ }
64
+ </script>
65
+ <style lang="scss" scoped>
66
+ .storageList {
67
+ padding: 16rpx 20rpx;
68
+ width: 100%;
69
+ box-sizing: border-box;
70
+ }
71
+ .dataLoading {
72
+ width: 100%;
73
+ box-sizing: border-box;
74
+ height: 220rpx;
75
+ margin: 10rpx 0;
76
+ border-radius: 16rpx;
77
+ border: 1px solid rgba(148, 163, 184, 0.2);
78
+ background: #f8fafc;
79
+ display: flex;
80
+ flex-direction: row;
81
+ align-items: center;
82
+ justify-content: center;
83
+ .status {
84
+ font-size: 24rpx;
85
+ color: #64748b;
86
+ line-height: 34rpx;
87
+ }
88
+ }
89
+ </style>