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