Skip to content

Commit 59aaf2d

Browse files
committed
fix: 导入导出数据格式错误修改
1 parent 4fde57a commit 59aaf2d

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

src/renderer/views/homePage/index.vue

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,10 @@ export default {
9595
}
9696
})
9797
if (path) {
98-
fs.writeFile(`${path}`, details.ruleConfig, () => {
98+
fs.writeFile(`${path}`, JSON.stringify({
99+
ruleConfig: details.ruleConfig,
100+
type: app.type
101+
}), () => {
99102
remote.dialog.showMessageBox({
100103
type: 'info',
101104
title: '导出结果',
@@ -175,10 +178,12 @@ export default {
175178
/* eslint-disable */
176179
fs.readFile(filePath[0], 'utf8', (e, res) => {
177180
if (e) throw e
181+
const data = JSON.parse(res)
178182
appCollection
179183
.insert({
180184
appName: filePath[0].match(/([^\.\/\\]+)\.([a-z]+)$/i)[1],
181-
ruleConfig: res
185+
ruleConfig: data.ruleConfig,
186+
type: data.type
182187
})
183188
.write()
184189
this.getAppList()

0 commit comments

Comments
 (0)