ol-base-components 2.9.0 → 2.9.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/package.json
CHANGED
package/src/api/api.js
CHANGED
|
@@ -75,6 +75,10 @@ SwaggerClient(swaggerUrl)
|
|
|
75
75
|
|
|
76
76
|
Object.keys(apiModules).forEach(fileName => {
|
|
77
77
|
const outputPath = path.join(modulesDir, `${fileName}.js`);
|
|
78
|
+
// 如果文件已存在,先删除(包括只读文件)
|
|
79
|
+
if (fs.existsSync(outputPath)) {
|
|
80
|
+
fs.unlinkSync(outputPath);
|
|
81
|
+
}
|
|
78
82
|
fs.writeFileSync(outputPath, apiModules[fileName], "utf-8");
|
|
79
83
|
setFileReadOnly(outputPath);
|
|
80
84
|
console.log(`API接口已生成并保存到 ${outputPath}(只读)`);
|
|
@@ -97,6 +101,10 @@ function createIndexFile(apiModules) {
|
|
|
97
101
|
str += `export * from "./${fileName}";\n`;
|
|
98
102
|
});
|
|
99
103
|
const outputPath = path.join(modulesDir, `index.js`);
|
|
104
|
+
// 如果文件已存在,先删除(包括只读文件)
|
|
105
|
+
if (fs.existsSync(outputPath)) {
|
|
106
|
+
fs.unlinkSync(outputPath);
|
|
107
|
+
}
|
|
100
108
|
fs.writeFileSync(outputPath, str, "utf-8");
|
|
101
109
|
// 设置 index.js 也为只读
|
|
102
110
|
setFileReadOnly(outputPath);
|
package/src/api/run.js
CHANGED
|
@@ -77,6 +77,10 @@ http
|
|
|
77
77
|
|
|
78
78
|
// 输出到文件
|
|
79
79
|
// const outputPath = path.join(__dirname, "swagger.js");
|
|
80
|
+
// 如果文件已存在,先删除(包括只读文件)
|
|
81
|
+
if (fs.existsSync(outputPath)) {
|
|
82
|
+
fs.unlinkSync(outputPath);
|
|
83
|
+
}
|
|
80
84
|
fs.writeFileSync(outputPath, apiEndpoints, "utf-8");
|
|
81
85
|
clearInterval(spinner);
|
|
82
86
|
process.stdout.write("\r");
|
package/src/bin/news.js
CHANGED
|
@@ -60,14 +60,14 @@ function toDate(d) {
|
|
|
60
60
|
|
|
61
61
|
function normalizeRssItem(it, sourceName) {
|
|
62
62
|
// 不同RSS字段命名差异处理
|
|
63
|
-
const link = it.link
|
|
63
|
+
const link = (it.link && it.link.href) || it.link || it.guid || "";
|
|
64
64
|
const pubDate = it.pubDate || it.published || it.updated || it["dc:date"] || it["atom:updated"] || "";
|
|
65
65
|
const desc = it.description || it.summary || it.content || "";
|
|
66
66
|
return {
|
|
67
67
|
source: sourceName,
|
|
68
68
|
title: String(it.title || "").trim(),
|
|
69
69
|
link: typeof link === "string" ? link : "",
|
|
70
|
-
publishedAt: toDate(pubDate)
|
|
70
|
+
publishedAt: (toDate(pubDate) && toDate(pubDate).toISOString()) || null,
|
|
71
71
|
description: typeof desc === "string" ? desc.replace(/<[^>]+>/g, "").trim() : "",
|
|
72
72
|
};
|
|
73
73
|
}
|
|
@@ -77,7 +77,7 @@ function normalizeGdeltItem(it) {
|
|
|
77
77
|
source: "GDELT",
|
|
78
78
|
title: String(it.title || "").trim(),
|
|
79
79
|
link: it.url || "",
|
|
80
|
-
publishedAt: toDate(it.seendate || it.publishtime || it.datetime)
|
|
80
|
+
publishedAt: (toDate(it.seendate || it.publishtime || it.datetime) && toDate(it.seendate || it.publishtime || it.datetime).toISOString()) || null,
|
|
81
81
|
description: String(it.excerpt || it.subtitle || "").trim(),
|
|
82
82
|
};
|
|
83
83
|
}
|
|
@@ -109,9 +109,9 @@ async function tryFetchRss(XMLParser) {
|
|
|
109
109
|
let items = [];
|
|
110
110
|
|
|
111
111
|
// 兼容 RSS 2.0 / Atom
|
|
112
|
-
if (data
|
|
112
|
+
if (data && data.rss && data.rss.channel && data.rss.channel.item) {
|
|
113
113
|
items = Array.isArray(data.rss.channel.item) ? data.rss.channel.item : [data.rss.channel.item];
|
|
114
|
-
} else if (data
|
|
114
|
+
} else if (data && data.feed && data.feed.entry) {
|
|
115
115
|
items = Array.isArray(data.feed.entry) ? data.feed.entry : [data.feed.entry];
|
|
116
116
|
}
|
|
117
117
|
|
|
@@ -129,7 +129,7 @@ async function tryFetchRss(XMLParser) {
|
|
|
129
129
|
async function fallbackGdelt() {
|
|
130
130
|
try {
|
|
131
131
|
const data = await fetchJSON(GDELT.url);
|
|
132
|
-
const list = data
|
|
132
|
+
const list = (data && data.articles) || (data && data.documents) || (data && data.matches) || [];
|
|
133
133
|
return list.map(normalizeGdeltItem);
|
|
134
134
|
} catch {
|
|
135
135
|
return [];
|
|
@@ -128,7 +128,7 @@
|
|
|
128
128
|
v-else-if="item.type === 'numberRange'"
|
|
129
129
|
v-model="form.value[item.prop]"
|
|
130
130
|
v-bind="item.props || {}"
|
|
131
|
-
v-on="{ ...item.listeners, change: val => item.listeners
|
|
131
|
+
v-on="{ ...item.listeners, change: val => item.listeners && item.listeners.change && item.listeners.change({ item, val }) }"
|
|
132
132
|
></ol-number-range>
|
|
133
133
|
|
|
134
134
|
<div v-else-if="item.type == 'inputSpecial'">
|
|
@@ -317,7 +317,7 @@ export default {
|
|
|
317
317
|
},
|
|
318
318
|
created() {
|
|
319
319
|
// 默认值复制
|
|
320
|
-
if (Object.keys(this.defaultValue)
|
|
320
|
+
if (Object.keys(this.defaultValue) && Object.keys(this.defaultValue).length) {
|
|
321
321
|
Object.keys(this.defaultValue).forEach(key => {
|
|
322
322
|
form.value[key] = this.defaultValue[key];
|
|
323
323
|
});
|
|
@@ -370,7 +370,7 @@ export default {
|
|
|
370
370
|
if (valid) {
|
|
371
371
|
resolve({
|
|
372
372
|
valid,
|
|
373
|
-
formData: this.form
|
|
373
|
+
formData: (this.form && this.form.value) || {},
|
|
374
374
|
});
|
|
375
375
|
} else {
|
|
376
376
|
reject("表单验证失败");
|
|
@@ -113,7 +113,7 @@
|
|
|
113
113
|
v-else-if="item.inputType === 'numberRange'"
|
|
114
114
|
v-model="formSearch[item.value]"
|
|
115
115
|
v-bind="item.props || {}"
|
|
116
|
-
v-on="{ ...item.listeners, change: val => item.listeners
|
|
116
|
+
v-on="{ ...item.listeners, change: val => item.listeners && item.listeners.change && item.listeners.change({ item, val }) }"
|
|
117
117
|
></ol-number-range>
|
|
118
118
|
<el-input
|
|
119
119
|
v-else
|