uni-oaview 1.4.1 → 1.4.3
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/components/oa-vconsole/audio.vue +46 -17
- package/package.json +2 -2
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
<uni-collapse-item
|
|
4
4
|
v-for="meta in audioLogMetas"
|
|
5
5
|
:key="meta.id"
|
|
6
|
+
:name="meta.id"
|
|
6
7
|
:title="meta.title"
|
|
7
8
|
:class="{
|
|
8
9
|
'uni-collapse-item-error': meta.isError,
|
|
@@ -41,7 +42,7 @@
|
|
|
41
42
|
</template>
|
|
42
43
|
|
|
43
44
|
<script lang="ts" setup>
|
|
44
|
-
import { nextTick, onBeforeUnmount, ref, shallowRef } from 'vue';
|
|
45
|
+
import { nextTick, onBeforeUnmount, ref, shallowRef, watch } from 'vue';
|
|
45
46
|
import awesomeDisplayInfo from './awesome-display-info.vue';
|
|
46
47
|
import { audioSubject, getAudioLogs } from 'uniapp-log-sdk';
|
|
47
48
|
|
|
@@ -88,17 +89,39 @@
|
|
|
88
89
|
return `${year}-${month}-${day} ${hours}:${minutes}:${seconds}.${milliseconds}`;
|
|
89
90
|
};
|
|
90
91
|
|
|
92
|
+
const formatTimeShort = (timestamp: number): string => {
|
|
93
|
+
const date = new Date(timestamp);
|
|
94
|
+
const hours = String(date.getHours()).padStart(2, '0');
|
|
95
|
+
const minutes = String(date.getMinutes()).padStart(2, '0');
|
|
96
|
+
const seconds = String(date.getSeconds()).padStart(2, '0');
|
|
97
|
+
return `${hours}:${minutes}:${seconds}`;
|
|
98
|
+
};
|
|
99
|
+
|
|
100
|
+
const extractFileName = (src: string): string => {
|
|
101
|
+
if (!src) return '(未指定)';
|
|
102
|
+
// 移除 URL 查询参数和锚点
|
|
103
|
+
let cleaned = src.split('?')[0];
|
|
104
|
+
cleaned = cleaned.split('#')[0];
|
|
105
|
+
// 提取文件名
|
|
106
|
+
const parts = cleaned.split(/[\/\\]/);
|
|
107
|
+
const fileName = parts[parts.length - 1];
|
|
108
|
+
return fileName || src;
|
|
109
|
+
};
|
|
110
|
+
|
|
91
111
|
const buildAudioLogId = (log: AudioLog): string => {
|
|
92
112
|
return `${log.id}-${log.timestamp}`;
|
|
93
113
|
};
|
|
94
114
|
|
|
95
115
|
const buildMetaFromLog = (log: AudioLog): AudioLogMeta => {
|
|
96
116
|
const { id, src, duration, currentTime, action, timestamp, data } = log;
|
|
97
|
-
const
|
|
117
|
+
const shortTime = formatTimeShort(timestamp);
|
|
118
|
+
const shortSrc = extractFileName(src);
|
|
98
119
|
const isError = action === 'error';
|
|
120
|
+
const durationStr = duration > 0 ? duration.toFixed(2) : '-';
|
|
99
121
|
return {
|
|
100
122
|
id: buildAudioLogId(log),
|
|
101
|
-
|
|
123
|
+
// ✅ 加入 [实例N] 标识,让用户清晰地看出不同实例的日志
|
|
124
|
+
title: `[实例${id}] [${shortTime}] ${action} - ${shortSrc} (${durationStr}s)`,
|
|
102
125
|
instanceId: id,
|
|
103
126
|
src,
|
|
104
127
|
duration,
|
|
@@ -153,20 +176,26 @@
|
|
|
153
176
|
upsertLogs(data);
|
|
154
177
|
});
|
|
155
178
|
|
|
156
|
-
// 展开项变化时刷新 collapse 高度缓存(小程序端必须手动调用,否则内容高度可能为 0)
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
179
|
+
// ✅ 展开项变化时刷新 collapse 高度缓存(小程序端必须手动调用,否则内容高度可能为 0)
|
|
180
|
+
watch(
|
|
181
|
+
() => getActiveNameList().join('|'),
|
|
182
|
+
() => {
|
|
183
|
+
// #ifdef MP
|
|
184
|
+
nextTick(() => collapseRef.value?.resize?.());
|
|
185
|
+
// #endif
|
|
186
|
+
},
|
|
187
|
+
);
|
|
188
|
+
|
|
189
|
+
// ✅ 列表更新时,如果有已展开项(内容高度可能变化),同步刷新高度缓存
|
|
190
|
+
watch(
|
|
191
|
+
() => audioLogMetas.value,
|
|
192
|
+
() => {
|
|
193
|
+
// #ifdef MP
|
|
194
|
+
if (getActiveNameList().length) nextTick(() => collapseRef.value?.resize?.());
|
|
195
|
+
// #endif
|
|
196
|
+
},
|
|
197
|
+
{ deep: false },
|
|
198
|
+
);
|
|
170
199
|
|
|
171
200
|
onBeforeUnmount(() => {
|
|
172
201
|
stop?.unsubscribe();
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "uni-oaview",
|
|
3
|
-
"version": "1.4.
|
|
3
|
+
"version": "1.4.03",
|
|
4
4
|
"description": "uniapp小程序组件库",
|
|
5
5
|
"main": "dist/index.esm.js",
|
|
6
6
|
"typings": "dist/index.d.ts",
|
|
@@ -51,7 +51,7 @@
|
|
|
51
51
|
"rollup-plugin-typescript2": "^0.27.2",
|
|
52
52
|
"rollup-plugin-vue": "^6.0.0",
|
|
53
53
|
"typescript": "^4.0.2",
|
|
54
|
-
"uniapp-log-sdk": "^1.7.
|
|
54
|
+
"uniapp-log-sdk": "^1.7.1"
|
|
55
55
|
},
|
|
56
56
|
"peerDependencies": {
|
|
57
57
|
"@dcloudio/uni-ui": "^1.5.11",
|