uni-oaview 1.4.0 → 1.4.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.
@@ -88,17 +88,38 @@
88
88
  return `${year}-${month}-${day} ${hours}:${minutes}:${seconds}.${milliseconds}`;
89
89
  };
90
90
 
91
+ const formatTimeShort = (timestamp: number): string => {
92
+ const date = new Date(timestamp);
93
+ const hours = String(date.getHours()).padStart(2, '0');
94
+ const minutes = String(date.getMinutes()).padStart(2, '0');
95
+ const seconds = String(date.getSeconds()).padStart(2, '0');
96
+ return `${hours}:${minutes}:${seconds}`;
97
+ };
98
+
99
+ const extractFileName = (src: string): string => {
100
+ if (!src) return '(未指定)';
101
+ // 移除 URL 查询参数和锚点
102
+ let cleaned = src.split('?')[0];
103
+ cleaned = cleaned.split('#')[0];
104
+ // 提取文件名
105
+ const parts = cleaned.split(/[\/\\]/);
106
+ const fileName = parts[parts.length - 1];
107
+ return fileName || src;
108
+ };
109
+
91
110
  const buildAudioLogId = (log: AudioLog): string => {
92
111
  return `${log.id}-${log.timestamp}`;
93
112
  };
94
113
 
95
114
  const buildMetaFromLog = (log: AudioLog): AudioLogMeta => {
96
115
  const { id, src, duration, currentTime, action, timestamp, data } = log;
97
- const timeStr = formatTime(timestamp);
116
+ const shortTime = formatTimeShort(timestamp);
117
+ const shortSrc = extractFileName(src);
98
118
  const isError = action === 'error';
119
+ const durationStr = duration > 0 ? duration.toFixed(2) : '-';
99
120
  return {
100
121
  id: buildAudioLogId(log),
101
- title: `[${timeStr}] ${action} - ${src || '(未指定)'} [${duration > 0 ? duration.toFixed(2) : '-'}s]`,
122
+ title: `[${shortTime}] ${action} - ${shortSrc} (${durationStr}s)`,
102
123
  instanceId: id,
103
124
  src,
104
125
  duration,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "uni-oaview",
3
- "version": "1.4.00",
3
+ "version": "1.4.02",
4
4
  "description": "uniapp小程序组件库",
5
5
  "main": "dist/index.esm.js",
6
6
  "typings": "dist/index.d.ts",
@@ -51,13 +51,13 @@
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.2.22"
54
+ "uniapp-log-sdk": "^1.7.00"
55
55
  },
56
56
  "peerDependencies": {
57
57
  "@dcloudio/uni-ui": "^1.5.11",
58
58
  "@vueuse/core": "^9.12.0",
59
59
  "dayjs": "1.11.7",
60
- "uniapp-log-sdk": "^1.1.1"
60
+ "uniapp-log-sdk": "^1.7.00"
61
61
  },
62
62
  "dependencies": {
63
63
  "element-china-area-data": "5.0.2"