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,184 @@
1
+ <template>
2
+ <view>
3
+ <view
4
+ class="editMask"
5
+ v-if="isShow"
6
+ :style="{
7
+ height: height + 'px'
8
+ }"
9
+ @click.stop
10
+ >
11
+ <view class="editDialog" @click.stop>
12
+ <text class="title">新增缓存</text>
13
+ <input type="text" placeholder="请输入Key" class="input" v-model="key" />
14
+ <input type="text" placeholder="请输入Value" class="input" v-model="value" />
15
+ <view class="btnGroup">
16
+ <view class="btnItem left" @click="hide">
17
+ <text class="btnText">取消</text>
18
+ </view>
19
+ <view class="btnItem right" @click="save">
20
+ <text class="btnText">提交</text>
21
+ </view>
22
+ </view>
23
+ </view>
24
+ </view>
25
+ </view>
26
+ </template>
27
+ <script>
28
+ import devUi from '../../../core/libs/devUi.js'
29
+ let success, error
30
+ export default {
31
+ props: {
32
+ /**
33
+ * 默认缓存类型
34
+ */
35
+ storageType: {
36
+ type: String,
37
+ default: 'localStorage'
38
+ }
39
+ },
40
+ data() {
41
+ return {
42
+ /**
43
+ * 是否展示
44
+ */
45
+ isShow: false,
46
+ /**
47
+ * 键名称
48
+ */
49
+ key: '',
50
+ /**
51
+ * 值
52
+ */
53
+ value: '',
54
+ /**
55
+ * 屏幕高度
56
+ */
57
+ height: uni.getSystemInfoSync().windowHeight
58
+ }
59
+ },
60
+ mounted() {
61
+ let that = this
62
+ /**
63
+ * 挂载弹窗打开事件
64
+ */
65
+ uni.$on('devTools_showAddStorageDialog', () => {
66
+ that.key = ''
67
+ that.value = ''
68
+ that.isShow = true
69
+ })
70
+ },
71
+ unmounted() {
72
+ uni.$off('devTools_showAddStorageDialog')
73
+ },
74
+ methods: {
75
+ /**
76
+ * 关闭弹窗
77
+ */
78
+ hide() {
79
+ this.isShow = false
80
+ },
81
+ /**
82
+ * 保存
83
+ */
84
+ save() {
85
+ let that = this
86
+ if (that.key == '') {
87
+ return devUi.showToast({
88
+ title: '请输入key',
89
+ icon: 'none'
90
+ })
91
+ }
92
+ if (that.storageType == 'localStorage') {
93
+ uni.setStorageSync(that.key, that.value)
94
+ } else if (that.storageType == 'sessionStorage') {
95
+ sessionStorage.setItem(that.key, that.value)
96
+ } else if (that.storageType == 'cookie') {
97
+ let key = encodeURIComponent(that.key)
98
+ let val = encodeURIComponent(that.value)
99
+ let cookie = `${key}=${val}; path=/; expires=` + new Date(new Date().getTime() + 86400 * 1000 * 365).toGMTString()
100
+ document.cookie = cookie
101
+ }
102
+ devUi.showToast({
103
+ title: '添加成功!',
104
+ icon: 'success'
105
+ })
106
+ that.hide()
107
+ setTimeout(() => {
108
+ that.$emit('getPage')
109
+ }, 300)
110
+ }
111
+ }
112
+ }
113
+ </script>
114
+ <style lang="scss" scoped>
115
+ .editMask {
116
+ display: flex;
117
+ flex-direction: column;
118
+ align-items: center;
119
+ justify-content: center;
120
+ background-color: rgba(0, 0, 0, 0.3);
121
+ width: 750rpx;
122
+ flex: 1;
123
+ /* #ifndef APP-PLUS */
124
+ height: 100vh;
125
+ backdrop-filter: blur(1px);
126
+ /* #endif */
127
+ position: fixed;
128
+ left: 0;
129
+ top: 0;
130
+ z-index: 999;
131
+ .editDialog {
132
+ display: flex;
133
+ flex-direction: column;
134
+ align-items: center;
135
+ justify-content: center;
136
+ width: 690rpx;
137
+ background-color: #fff;
138
+ border-radius: 20rpx;
139
+ padding: 20rpx;
140
+ margin-bottom: 300rpx;
141
+ .title {
142
+ font-size: 28rpx;
143
+ color: #333;
144
+ height: 50rpx;
145
+ line-height: 50rpx;
146
+ }
147
+ .input {
148
+ margin-top: 20rpx;
149
+ margin-bottom: 20rpx;
150
+ width: 640rpx;
151
+ height: 70rpx;
152
+ padding: 5rpx;
153
+ border-radius: 8rpx;
154
+ border: 1px solid rgba(0, 0, 0, 0.05);
155
+ }
156
+ .btnGroup {
157
+ display: flex;
158
+ flex-direction: row;
159
+ width: 640rpx;
160
+ justify-content: space-between;
161
+ .btnItem {
162
+ height: 64rpx;
163
+ border-radius: 10rpx;
164
+ display: flex;
165
+ flex-direction: row;
166
+ align-items: center;
167
+ justify-content: center;
168
+ .btnText {
169
+ font-size: 24rpx;
170
+ color: #fff;
171
+ }
172
+ &.left {
173
+ width: 160rpx;
174
+ background-color: #8799a3;
175
+ }
176
+ &.right {
177
+ width: 450rpx;
178
+ background-color: #3cbb45;
179
+ }
180
+ }
181
+ }
182
+ }
183
+ }
184
+ </style>
@@ -0,0 +1,352 @@
1
+ <template>
2
+ <view>
3
+ <view
4
+ class="editMask"
5
+ v-if="isShow"
6
+ :style="{
7
+ height: height + 'px'
8
+ }"
9
+ @click.stop
10
+ >
11
+ <view class="editDialog" @click.stop>
12
+ <text class="title">{{ title }}</text>
13
+ <input type="text" placeholder="请输入" class="input" v-model="value" />
14
+ <view class="btnGroup">
15
+ <view class="btn left" @click="hide">
16
+ <text class="btnText">取消</text>
17
+ </view>
18
+ <view class="btn right" @click="save">
19
+ <text class="btnText">提交</text>
20
+ </view>
21
+ </view>
22
+ </view>
23
+ </view>
24
+ </view>
25
+ </template>
26
+ <script>
27
+ import devUi from '../../../core/libs/devUi.js'
28
+ let success, error
29
+ export default {
30
+ props: {
31
+ /**
32
+ * 路径列表
33
+ */
34
+ dirList: {
35
+ type: Array,
36
+ default: () => []
37
+ },
38
+ /**
39
+ * 路径类型
40
+ */
41
+ dirType: {
42
+ type: String,
43
+ default: ''
44
+ }
45
+ },
46
+ data() {
47
+ return {
48
+ /**
49
+ * 是否展示
50
+ */
51
+ isShow: false,
52
+ /**
53
+ * 是否为操作文件夹
54
+ */
55
+ isDir: false,
56
+ /**
57
+ * 是否编辑模式
58
+ */
59
+ isEdit: true,
60
+ /**
61
+ * 输入框的值
62
+ */
63
+ value: '',
64
+ /**
65
+ * 屏幕高度
66
+ */
67
+ height: uni.getSystemInfoSync().windowHeight,
68
+ /**
69
+ * 更改前名称
70
+ */
71
+ oldValue: ''
72
+ }
73
+ },
74
+ computed: {
75
+ /**
76
+ * 获取标题
77
+ */
78
+ title() {
79
+ if (this.isEdit) {
80
+ return this.isDir ? '更改文件夹名称' : '更改文件名称'
81
+ } else {
82
+ return this.isDir ? '创建文件夹' : '创建文件'
83
+ }
84
+ }
85
+ },
86
+ methods: {
87
+ /**
88
+ * 展示弹窗
89
+ */
90
+ show(options) {
91
+ let that = this
92
+ return new Promise((yes, err) => {
93
+ success = yes
94
+ error = err
95
+
96
+ this.isDir = options.isDir
97
+ this.isEdit = options.isEdit
98
+ this.value = String(options.name ? options.name : '')
99
+ this.oldValue = String(options.name ? options.name : '')
100
+
101
+ that.isShow = true
102
+ })
103
+ },
104
+ /**
105
+ * 关闭弹窗
106
+ */
107
+ hide() {
108
+ this.isShow = false
109
+ },
110
+ /**
111
+ * 获取当前文件绝对路径
112
+ */
113
+ getPath() {
114
+ let that = this
115
+ let path = ''
116
+ switch (that.dirType) {
117
+ case 'wx':
118
+ path = wx.env.USER_DATA_PATH
119
+ break
120
+ case 'PRIVATE_DOC':
121
+ path = '_doc'
122
+ break
123
+ case 'PRIVATE_WWW':
124
+ path = '_www'
125
+ break
126
+ case 'PUBLIC_DOCUMENTS':
127
+ path = '_documents'
128
+ break
129
+ case 'PUBLIC_DOWNLOADS':
130
+ path = '_downloads'
131
+ break
132
+ default:
133
+ break
134
+ }
135
+ that.dirList.map((x) => {
136
+ path += '/' + x
137
+ })
138
+ return path + '/'
139
+ },
140
+ /**
141
+ * 保存
142
+ */
143
+ save() {
144
+ let that = this
145
+ that.value = that.value.replace(' ', '')
146
+ if (that.value == '') {
147
+ return devUi.showToast({
148
+ title: '请输入...',
149
+ icon: 'none'
150
+ })
151
+ }
152
+ let path = that.getPath()
153
+
154
+ function buildSuccess() {
155
+ devUi.showToast({
156
+ title: '操作成功!',
157
+ icon: 'success'
158
+ })
159
+ that.isShow = false
160
+ that.$emit('getPage')
161
+ }
162
+
163
+ function buildError(e) {
164
+ let msg = ''
165
+ if (e && e.message) {
166
+ msg = e.message
167
+ }
168
+ devUi.showToast({
169
+ title: '重命名失败!' + msg,
170
+ icon: 'none'
171
+ })
172
+ }
173
+
174
+ // #ifdef MP-WEIXIN
175
+ if (1) {
176
+ let fs = wx.getFileSystemManager()
177
+ if (that.isEdit) {
178
+ if (that.isDir) {
179
+ // ! 重命名文件夹
180
+ // ! 小程序不支持重命名文件夹
181
+ } else {
182
+ // ! 重命名文件
183
+ fs.rename({
184
+ oldPath: path + that.oldValue,
185
+ newPath: path + that.value,
186
+ success: buildSuccess,
187
+ fail: buildError
188
+ })
189
+ }
190
+ } else {
191
+ if (that.isDir) {
192
+ // ! 创建目录
193
+ fs.mkdir({
194
+ dirPath: path + that.value,
195
+ recursive: false,
196
+ success: buildSuccess,
197
+ fail: buildError
198
+ })
199
+ } else {
200
+ // ! 创建文件
201
+ // fs.open({
202
+ // filePath: path + that.value,
203
+ // flag: "wx+",
204
+ // success({ fd }) {
205
+ // fs.closeSync({ fd });
206
+ // buildSuccess();
207
+ // },
208
+ // fail: buildError,
209
+ // });
210
+ fs.writeFile({
211
+ filePath: path + that.value,
212
+ data: '',
213
+ encoding: 'utf8',
214
+ success() {
215
+ buildSuccess()
216
+ },
217
+ fail: buildError
218
+ })
219
+ }
220
+ }
221
+
222
+ return
223
+ }
224
+ // #endif
225
+
226
+ if (that.isEdit) {
227
+ if (that.isDir) {
228
+ // ! 重命名文件夹
229
+ plus.io.resolveLocalFileSystemURL(
230
+ path + that.oldValue,
231
+ (entry) => {
232
+ plus.io.resolveLocalFileSystemURL(
233
+ path,
234
+ (faEntry) => {
235
+ entry.moveTo(faEntry, that.value, buildSuccess, buildError)
236
+ },
237
+ buildError
238
+ )
239
+ },
240
+ buildError
241
+ )
242
+ } else {
243
+ // ! 重命名文件
244
+ plus.io.resolveLocalFileSystemURL(
245
+ path + that.oldValue,
246
+ (entry) => {
247
+ plus.io.resolveLocalFileSystemURL(
248
+ path,
249
+ (faEntry) => {
250
+ entry.moveTo(faEntry, that.value, buildSuccess, buildError)
251
+ },
252
+ buildError
253
+ )
254
+ },
255
+ buildError
256
+ )
257
+ }
258
+ } else {
259
+ if (that.isDir) {
260
+ // ! 创建文件夹
261
+ plus.io.resolveLocalFileSystemURL(
262
+ path,
263
+ (entry) => {
264
+ entry.getDirectory(that.value, { create: true, exclusive: false }, buildSuccess, buildError)
265
+ },
266
+ buildError
267
+ )
268
+ } else {
269
+ // ! 创建文件
270
+ plus.io.resolveLocalFileSystemURL(
271
+ path,
272
+ (entry) => {
273
+ entry.getFile(that.value, { create: true }, buildSuccess, buildError)
274
+ },
275
+ buildError
276
+ )
277
+ }
278
+ }
279
+ }
280
+ }
281
+ }
282
+ </script>
283
+ <style lang="scss" scoped>
284
+ .editMask {
285
+ display: flex;
286
+ flex-direction: column;
287
+ align-items: center;
288
+ justify-content: center;
289
+ background-color: rgba(0, 0, 0, 0.3);
290
+ width: 750rpx;
291
+ flex: 1;
292
+ /* #ifndef APP-PLUS */
293
+ height: 100vh;
294
+ backdrop-filter: blur(1px);
295
+ /* #endif */
296
+ position: fixed;
297
+ left: 0;
298
+ top: 0;
299
+ z-index: 999;
300
+ .editDialog {
301
+ display: flex;
302
+ flex-direction: column;
303
+ align-items: center;
304
+ justify-content: center;
305
+ width: 690rpx;
306
+ background-color: #fff;
307
+ border-radius: 20rpx;
308
+ padding: 20rpx;
309
+ margin-bottom: 300rpx;
310
+ .title {
311
+ font-size: 28rpx;
312
+ line-height: 28rpx;
313
+ color: #333;
314
+ }
315
+ .input {
316
+ margin-top: 20rpx;
317
+ margin-bottom: 20rpx;
318
+ width: 640rpx;
319
+ height: 70rpx;
320
+ padding: 5rpx;
321
+ border-radius: 8rpx;
322
+ border: 1px solid rgba(0, 0, 0, 0.05);
323
+ }
324
+ .btnGroup {
325
+ display: flex;
326
+ flex-direction: row;
327
+ width: 640rpx;
328
+ justify-content: space-between;
329
+ .btn {
330
+ height: 64rpx;
331
+ border-radius: 10rpx;
332
+ display: flex;
333
+ flex-direction: row;
334
+ align-items: center;
335
+ justify-content: center;
336
+ .btnText {
337
+ font-size: 24rpx;
338
+ color: #fff;
339
+ }
340
+ }
341
+ .left {
342
+ width: 160rpx;
343
+ background-color: #8799a3;
344
+ }
345
+ .right {
346
+ width: 450rpx;
347
+ background-color: #3cbb45;
348
+ }
349
+ }
350
+ }
351
+ }
352
+ </style>
@@ -0,0 +1,178 @@
1
+ <template>
2
+ <view>
3
+ <view
4
+ class="editMask"
5
+ v-if="isShow"
6
+ :style="{
7
+ height: height + 'px'
8
+ }"
9
+ @click.stop
10
+ >
11
+ <view class="editDialog" @click.stop>
12
+ <view>
13
+ <text class="title">{{ title }}</text>
14
+ </view>
15
+ <textarea v-model="value" type="text" placeholder="请输入..." class="textarea" />
16
+ <view class="btnGroup">
17
+ <view class="btnItem left" @click="hide">
18
+ <text class="btnText">取消</text>
19
+ </view>
20
+ <view class="btnItem right" @click="save">
21
+ <text class="btnText">提交</text>
22
+ </view>
23
+ </view>
24
+ </view>
25
+ </view>
26
+ </view>
27
+ </template>
28
+ <script>
29
+ let success, error
30
+ export default {
31
+ data() {
32
+ return {
33
+ /**
34
+ * 是否展示
35
+ */
36
+ isShow: false,
37
+ /**
38
+ * 标题
39
+ */
40
+ title: '',
41
+ /**
42
+ * 输入框的值
43
+ */
44
+ value: '',
45
+ /**
46
+ * 屏幕高度
47
+ */
48
+ height: uni.getSystemInfoSync().windowHeight
49
+ }
50
+ },
51
+ mounted() {
52
+ let that = this
53
+ /**
54
+ * 使用uni.$on打开弹窗
55
+ */
56
+ uni.$on('devTools_showEditDialog', (options) => {
57
+ that
58
+ .show(options.title, options.value)
59
+ .then((val) => {
60
+ uni.$emit('devTools_editDialogSaveSuccess', val)
61
+ })
62
+ .catch(() => {
63
+ uni.$emit('devTools_editDialogClose')
64
+ })
65
+ })
66
+ },
67
+ beforeUnmount() {
68
+ uni.$off('devTools_showEditDialog')
69
+ },
70
+ methods: {
71
+ /**
72
+ * 展示弹窗
73
+ */
74
+ show(title = '标题', value = '') {
75
+ let that = this
76
+ return new Promise((yes, err) => {
77
+ success = yes
78
+ error = err
79
+ that.title = title
80
+ that.value = value ? value : ''
81
+ that.isShow = true
82
+ })
83
+ },
84
+ /**
85
+ * 关闭弹窗
86
+ */
87
+ hide() {
88
+ this.isShow = false
89
+ error()
90
+ },
91
+ /**
92
+ * 保存
93
+ */
94
+ save() {
95
+ this.isShow = false
96
+ success(this.value)
97
+ }
98
+ }
99
+ }
100
+ </script>
101
+ <style lang="scss" scoped>
102
+ .editMask {
103
+ display: flex;
104
+ flex-direction: column;
105
+ align-items: center;
106
+ justify-content: center;
107
+ background-color: rgba(0, 0, 0, 0.3);
108
+ width: 750rpx;
109
+ flex: 1;
110
+ /* #ifndef APP-PLUS */
111
+ height: 100vh;
112
+ backdrop-filter: blur(1px);
113
+ /* #endif */
114
+ position: fixed;
115
+ left: 0;
116
+ top: 0;
117
+ z-index: 999;
118
+ .editDialog {
119
+ display: flex;
120
+ flex-direction: column;
121
+ align-items: center;
122
+ justify-content: center;
123
+ width: 690rpx;
124
+ background-color: #fff;
125
+ border-radius: 20rpx;
126
+ padding: 20rpx;
127
+ .title {
128
+ font-size: 28rpx;
129
+ line-height: 28rpx;
130
+ color: #333;
131
+ /* #ifndef APP-PLUS */
132
+ max-width: 600rpx;
133
+ word-wrap: break-word;
134
+ /* #endif */
135
+ /* #ifdef APP-PLUS */
136
+ width: 600rpx;
137
+ /* #endif */
138
+ }
139
+ .textarea {
140
+ margin-top: 20rpx;
141
+ margin-bottom: 20rpx;
142
+ width: 640rpx;
143
+ /* #ifndef APP-PLUS */
144
+ min-height: 200rpx;
145
+ max-height: 750rpx;
146
+ /* #endif */
147
+ background-color: rgba(0, 0, 0, 0.02);
148
+ padding: 10rpx;
149
+ }
150
+ .btnGroup {
151
+ display: flex;
152
+ flex-direction: row;
153
+ width: 640rpx;
154
+ justify-content: space-between;
155
+ .btnItem {
156
+ height: 64rpx;
157
+ border-radius: 10rpx;
158
+ display: flex;
159
+ flex-direction: row;
160
+ align-items: center;
161
+ justify-content: center;
162
+ .btnText {
163
+ font-size: 24rpx;
164
+ color: #fff;
165
+ }
166
+ &.left {
167
+ width: 160rpx;
168
+ background-color: #8799a3;
169
+ }
170
+ &.right {
171
+ width: 450rpx;
172
+ background-color: #3cbb45;
173
+ }
174
+ }
175
+ }
176
+ }
177
+ }
178
+ </style>