Skip to content

Commit

Permalink
Adapt webdev auto sync
Browse files Browse the repository at this point in the history
  • Loading branch information
Hiram committed Apr 18, 2024
1 parent c6b810a commit d6735d5
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 10 deletions.
8 changes: 6 additions & 2 deletions src/renderer/src/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -23,19 +23,23 @@ const isVisible = reactive({
const theme = computed(() => {
return storeSetting.getStateMode;
});
const webdev = computed(() => {
return storeSetting.webdev;
});
const intervalId = ref();
watch(
() => storeSetting.webdev,
() => webdev.value,
(val) => {
console.log(val);
if (intervalId.value) clearInterval(intervalId.value);
if (val.sync) {
intervalId.value = setInterval(() => {
autoSync(val.data.url, val.data.username, val.data.password);
}, 1000 * 5 * 60);
}
}
}, { deep : true }
);
onMounted(() => {
Expand Down
7 changes: 5 additions & 2 deletions src/renderer/src/pages/setting/base/BaseSetting.vue
Original file line number Diff line number Diff line change
Expand Up @@ -351,14 +351,17 @@ watch(
watch(formData,
(newValue, _) => {
storeSetting.updateConfig({ mode: formData.value.theme });
storeSetting.updateConfig({
mode: formData.value.theme,
webdev: formData.value.webdev
});
storePlayer.updateConfig({
setting: {
playerMode: formData.value.playerMode,
snifferMode: formData.value.snifferMode,
},
});
if(newValue) {
if (newValue) {
updateSetting(newValue)
}
}, {
Expand Down
8 changes: 2 additions & 6 deletions src/renderer/src/pages/setting/base/components/DialogData.vue
Original file line number Diff line number Diff line change
Expand Up @@ -225,8 +225,6 @@ const active = reactive({
}
});
const clientWebdev = ref();
const emit = defineEmits(['update:visible']);
watch(
Expand Down Expand Up @@ -400,7 +398,7 @@ const importData = async() => {
};
};
// 格式化设置数据
const formatSet = (data) => {
const pkgVersion = pkg.version;
Expand Down Expand Up @@ -665,9 +663,7 @@ const clearData = async() => {
// 保存
const saveWebdev = async() => {
try {
await updateSetting({
webdev: formData.webdev
})
await updateSetting({ webdev: formData.webdev })
MessagePlugin.success(t('pages.setting.data.success'));
} catch (err) {
MessagePlugin.error(`${t('pages.setting.data.fail')}:${err}`);
Expand Down

0 comments on commit d6735d5

Please sign in to comment.