mirror of
https://github.com/NapNeko/NapCatQQ.git
synced 2024-11-21 09:36:35 +00:00
feat: 保存数据
This commit is contained in:
parent
cc93ed3567
commit
2d5b4bc90a
@ -10,7 +10,7 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup>
|
<script setup>
|
||||||
import { ref, shallowRef, onMounted } from 'vue';
|
import { ref, shallowRef, onMounted, watch } from 'vue';
|
||||||
import { defaultOnebotConfig, mergeOnebotConfigs } from '../../../src/onebot/config/config';
|
import { defaultOnebotConfig, mergeOnebotConfigs } from '../../../src/onebot/config/config';
|
||||||
import { QQLoginManager } from '../backend/shell';
|
import { QQLoginManager } from '../backend/shell';
|
||||||
import HttpServerComponent from './network/HttpServerComponent.vue';
|
import HttpServerComponent from './network/HttpServerComponent.vue';
|
||||||
@ -114,6 +114,23 @@ const removeTab = ({ value: val, index }) => {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const syncConfig = async () => {
|
||||||
|
const networkConfig = {};
|
||||||
|
panelData.value.forEach(panel => {
|
||||||
|
const key = panel.value.split('-')[0];
|
||||||
|
if (!networkConfig[key]) {
|
||||||
|
networkConfig[key] = [];
|
||||||
|
}
|
||||||
|
networkConfig[key].push(panel.config);
|
||||||
|
});
|
||||||
|
const userConfig = await getOB11Config();
|
||||||
|
const mergedConfig = mergeOnebotConfigs(defaultOnebotConfig, userConfig);
|
||||||
|
mergedConfig.network = networkConfig;
|
||||||
|
await setOB11Config(mergedConfig);
|
||||||
|
};
|
||||||
|
|
||||||
|
watch(panelData, syncConfig, { deep: true });
|
||||||
|
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
loadConfig();
|
loadConfig();
|
||||||
});
|
});
|
||||||
|
Loading…
x
Reference in New Issue
Block a user