修复问题
parent
9afafec9d6
commit
60e606a413
|
@ -1,15 +1,12 @@
|
|||
{
|
||||
"extends": [
|
||||
"plugin:vue/vue3-recommended",
|
||||
// "plugin:vue/vue3-recommended",
|
||||
"standard"
|
||||
],
|
||||
"plugins": [
|
||||
"html"
|
||||
],
|
||||
"parser": "vue-eslint-parser",
|
||||
"parserOptions": {
|
||||
"parser": "babel-eslint"
|
||||
},
|
||||
"parser": "babel-eslint",
|
||||
"rules": {
|
||||
"no-new": "off",
|
||||
"camelcase": "off",
|
||||
|
|
|
@ -1,9 +1,7 @@
|
|||
<template>
|
||||
<button
|
||||
:class="[$style.btn, {[$style.min]: min}, {[$style.outline]: outline}]"
|
||||
:disabled="disabled"
|
||||
@click="$emit('click', $event)"
|
||||
>
|
||||
:disabled="disabled">
|
||||
<slot />
|
||||
</button>
|
||||
</template>
|
||||
|
@ -23,7 +21,6 @@ export default {
|
|||
default: false,
|
||||
},
|
||||
},
|
||||
emits: ['click'],
|
||||
}
|
||||
</script>
|
||||
|
||||
|
|
|
@ -32,7 +32,7 @@ export default {
|
|||
default: 'text',
|
||||
},
|
||||
},
|
||||
emits: ['update:modelValue', 'keydown', 'blur', 'submit', 'change', 'focus'],
|
||||
emits: ['update:modelValue', 'submit', 'change'],
|
||||
methods: {
|
||||
handleInput(event) {
|
||||
let value = event.target.value.trim()
|
||||
|
|
|
@ -105,7 +105,7 @@ export default {
|
|||
require: true,
|
||||
},
|
||||
},
|
||||
emits: ['contextmenu', 'scroll'],
|
||||
emits: ['scroll'],
|
||||
setup(props, { emit }) {
|
||||
const views = ref([])
|
||||
const dom_scrollContainer = ref(null)
|
||||
|
|
|
@ -8,7 +8,6 @@ import { debounce } from '@renderer/utils'
|
|||
import {
|
||||
ref,
|
||||
useRoute,
|
||||
useGetter,
|
||||
watch,
|
||||
useRefGetter,
|
||||
useRouter,
|
||||
|
@ -26,14 +25,14 @@ export default {
|
|||
const route = useRoute()
|
||||
const router = useRouter()
|
||||
|
||||
const setting = useGetter('setting')
|
||||
const setting = useRefGetter('setting')
|
||||
|
||||
const clearSearchList = useCommit('search', 'clearList')
|
||||
|
||||
watch(() => route.name, (newValue, oldValue) => {
|
||||
if (newValue.name != 'search') {
|
||||
if (setting.odc.isAutoClearSearchInput && searchText.value) searchText.value = ''
|
||||
if (setting.odc.isAutoClearSearchList) clearSearchList()
|
||||
if (setting.value.odc.isAutoClearSearchInput && searchText.value) searchText.value = ''
|
||||
if (setting.value.odc.isAutoClearSearchList) clearSearchList()
|
||||
}
|
||||
})
|
||||
|
||||
|
@ -50,10 +49,10 @@ export default {
|
|||
const tipSearch = debounce(() => {
|
||||
if (searchText.value === '') {
|
||||
tipList.value = []
|
||||
music[setting.search.tempSearchSource].tempSearch.cancelTempSearch()
|
||||
music[setting.value.search.tempSearchSource].tempSearch.cancelTempSearch()
|
||||
return
|
||||
}
|
||||
music[setting.search.tempSearchSource].tempSearch.search(searchText.value).then(list => {
|
||||
music[setting.value.search.tempSearchSource].tempSearch.search(searchText.value).then(list => {
|
||||
tipList.value = list
|
||||
}).catch(() => {})
|
||||
}, 50)
|
||||
|
|
|
@ -49,6 +49,7 @@ export default ({
|
|||
})
|
||||
|
||||
const rSetConfig = onSetConfig((event, config) => {
|
||||
console.log(config)
|
||||
setSetting(Object.assign({}, toRaw(setting.value), config))
|
||||
window.eventHub.emit(eventBaseName.set_config, config)
|
||||
})
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import { useCommit, useGetter, onBeforeUnmount, toRaw } from '@renderer/utils/vueTools'
|
||||
import { useCommit, useRefGetter, onBeforeUnmount, toRaw } from '@renderer/utils/vueTools'
|
||||
import { sync as eventSyncName } from '@renderer/event/names'
|
||||
import { syncEnable, onSyncStatus } from '@renderer/utils/tools'
|
||||
import { sync } from '@renderer/core/share'
|
||||
|
@ -22,7 +22,7 @@ export default () => {
|
|||
const setMusicPosition = useCommit('list', 'setMusicPosition')
|
||||
const setSyncListData = useCommit('list', 'setSyncListData')
|
||||
|
||||
const setting = useGetter('setting')
|
||||
const setting = useRefGetter('setting')
|
||||
|
||||
const handleSyncAction = ({ action, data }) => {
|
||||
if (typeof data == 'object') data.isSync = true
|
||||
|
@ -115,10 +115,10 @@ export default () => {
|
|||
sync.status.devices = status.devices
|
||||
})
|
||||
|
||||
if (setting.sync.enable && setting.sync.port) {
|
||||
if (setting.value.sync.enable && setting.value.sync.port) {
|
||||
syncEnable({
|
||||
enable: setting.sync.enable,
|
||||
port: setting.sync.port,
|
||||
enable: setting.value.sync.enable,
|
||||
port: setting.value.sync.port,
|
||||
})
|
||||
}
|
||||
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
|
||||
<script>
|
||||
import { getListPrevSelectId } from '@renderer/utils/data'
|
||||
import { isInitedList } from '@renderer/core/share/list'
|
||||
import { isInitedList, defaultList } from '@renderer/core/share/list'
|
||||
import { getList } from '@renderer/core/share/utils'
|
||||
|
||||
import MyLists from './components/MyLists'
|
||||
|
@ -31,51 +31,41 @@ export default {
|
|||
focusTarget: 'listDetail',
|
||||
}
|
||||
},
|
||||
beforeRouteEnter(to, from) {
|
||||
let id = to.query.id
|
||||
if (!id) {
|
||||
id = getListPrevSelectId() || defaultList.id
|
||||
return {
|
||||
path: '/list',
|
||||
query: { id },
|
||||
}
|
||||
}
|
||||
},
|
||||
beforeRouteUpdate(to, from) {
|
||||
// console.log(to, from)
|
||||
if (to.query.updated) return
|
||||
let id = to.query.id
|
||||
if (id == null) return
|
||||
if (!getList(id)) {
|
||||
id = this.$store.state.list.defaultList.id
|
||||
this.handleListToggle(id)
|
||||
if (id == null) {
|
||||
id = defaultList.id
|
||||
} else if (!getList(id)) {
|
||||
id = defaultList.id
|
||||
}
|
||||
this.listId = id
|
||||
const scrollIndex = to.query.scrollIndex
|
||||
if (from.query.id == to.query.id) {
|
||||
if (!scrollIndex) return
|
||||
this.$nextTick(() => {
|
||||
this.$refs.musicList.restoreScroll(scrollIndex, true)
|
||||
|
||||
this.$nextTick(() => {
|
||||
this.$router.replace({
|
||||
path: 'list',
|
||||
query: {
|
||||
id,
|
||||
},
|
||||
})
|
||||
})
|
||||
})
|
||||
const isAnimation = from.query.id == to.query.id
|
||||
this.$nextTick(() => {
|
||||
this.$refs.musicList.restoreScroll(scrollIndex, isAnimation)
|
||||
})
|
||||
return {
|
||||
path: '/list',
|
||||
query: { id, updated: true },
|
||||
}
|
||||
},
|
||||
beforeRouteLeave(to, from) {
|
||||
this.$refs.musicList.saveListPosition()
|
||||
},
|
||||
created() {
|
||||
let id = this.$route.query.id
|
||||
if (!id) {
|
||||
id = getListPrevSelectId() || this.$store.state.list.defaultList.id
|
||||
this.handleListToggle(id)
|
||||
}
|
||||
this.listId = id
|
||||
},
|
||||
methods: {
|
||||
handleListToggle(id) {
|
||||
if (id == this.listId) return
|
||||
this.$router.replace({
|
||||
path: 'list',
|
||||
query: { id },
|
||||
}).catch(_ => _)
|
||||
},
|
||||
this.listId = this.$route.query.id
|
||||
},
|
||||
}
|
||||
</script>
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import { useRoute, useRouter, onMounted, onBeforeUnmount, nextTick, watch } from '@renderer/utils/vueTools'
|
||||
import { useRoute, useRouter, onMounted, onBeforeUnmount } from '@renderer/utils/vueTools'
|
||||
import { setListPosition, getListPosition } from '@renderer/utils/data'
|
||||
|
||||
export default ({ props, listRef, list, setting }) => {
|
||||
|
@ -27,21 +27,6 @@ export default ({ props, listRef, list, setting }) => {
|
|||
handleScrollList(index, isAnimation)
|
||||
}
|
||||
|
||||
watch(() => route.query.id, (id, oId) => {
|
||||
if (!oId || route.path != '/list') return
|
||||
const scrollIndex = route.query.scrollIndex
|
||||
nextTick(() => {
|
||||
restoreScroll(scrollIndex, false)
|
||||
if (scrollIndex != null) {
|
||||
router.replace({
|
||||
path: 'list',
|
||||
query: {
|
||||
id: props.listId,
|
||||
},
|
||||
})
|
||||
}
|
||||
})
|
||||
})
|
||||
onMounted(() => {
|
||||
restoreScroll(route.query.scrollIndex, false)
|
||||
if (route.query.scrollIndex != null) {
|
||||
|
@ -49,6 +34,7 @@ export default ({ props, listRef, list, setting }) => {
|
|||
path: 'list',
|
||||
query: {
|
||||
id: props.listId,
|
||||
updated: true,
|
||||
},
|
||||
})
|
||||
}
|
||||
|
|
|
@ -160,6 +160,9 @@ export default {
|
|||
created() {
|
||||
this.setPrevSelectListId(this.listId)
|
||||
},
|
||||
mounted() {
|
||||
this.setListsScroll()
|
||||
},
|
||||
methods: {
|
||||
...mapMutations('list', [
|
||||
'setUserListName',
|
||||
|
@ -174,6 +177,13 @@ export default {
|
|||
...mapActions('leaderboard', {
|
||||
getBoardListAll: 'getListAll',
|
||||
}),
|
||||
setListsScroll() {
|
||||
let target = this.$refs.dom_lists_list.querySelector('.' + this.$style.active)
|
||||
if (!target) return
|
||||
let offsetTop = target.offsetTop
|
||||
let location = offsetTop - 150
|
||||
if (location > 0) this.$refs.dom_lists_list.scrollTop = location
|
||||
},
|
||||
handleListsSave(index, event) {
|
||||
let dom_target = this.$refs.dom_lists_list.querySelector('.' + this.$style.editing)
|
||||
if (dom_target) dom_target.classList.remove(this.$style.editing)
|
||||
|
@ -351,8 +361,6 @@ export default {
|
|||
})
|
||||
},
|
||||
handleImportList(index) {
|
||||
const list = this.getTargetListInfo(index)
|
||||
|
||||
selectDir({
|
||||
title: this.$t('lists__import_part_desc'),
|
||||
properties: ['openFile'],
|
||||
|
|
|
@ -38,7 +38,7 @@
|
|||
</template>
|
||||
|
||||
<script>
|
||||
import { useRefGetter, watch, useCommit } from '@renderer/utils/vueTools'
|
||||
import { useRefGetter, watch, useCommit, toRaw } from '@renderer/utils/vueTools'
|
||||
import { currentStting } from './setting'
|
||||
|
||||
import SettingBasic from './components/SettingBasic'
|
||||
|
@ -78,10 +78,11 @@ export default {
|
|||
const setting = useRefGetter('setting')
|
||||
|
||||
const setSetting = useCommit('setSetting')
|
||||
currentStting.value = JSON.parse(JSON.stringify(setting.value))
|
||||
currentStting.value = JSON.parse(JSON.stringify(toRaw(setting.value)))
|
||||
watch(currentStting, newSetting => {
|
||||
const newSettingStr = JSON.stringify(newSetting)
|
||||
if (newSettingStr === JSON.stringify(setting.value)) return
|
||||
console.log(newSetting)
|
||||
setSetting(JSON.parse(newSettingStr))
|
||||
}, {
|
||||
deep: true,
|
||||
|
|
|
@ -15,7 +15,7 @@ dd
|
|||
</template>
|
||||
|
||||
<script>
|
||||
import { useCommit, useI18n, onBeforeUnmount, useGetter, toRaw } from '@renderer/utils/vueTools'
|
||||
import { useCommit, useI18n, onBeforeUnmount, toRaw, useRefGetter } from '@renderer/utils/vueTools'
|
||||
import { mergeSetting } from '@common/utils'
|
||||
import { base as eventBaseName } from '@renderer/event/names'
|
||||
import { defaultList, loveList, userLists } from '@renderer/core/share/list'
|
||||
|
@ -34,9 +34,8 @@ export default {
|
|||
name: 'SettingUpdate',
|
||||
setup() {
|
||||
const { t } = useI18n()
|
||||
const setting = useGetter('setting')
|
||||
const settingVersion = useGetter('settingVersion')
|
||||
const setSetting = useCommit('setSetting')
|
||||
const setting = useRefGetter('setting')
|
||||
const settingVersion = useRefGetter('settingVersion')
|
||||
const setSettingVersion = useCommit('setSettingVersion')
|
||||
const setList = useCommit('list', 'setList')
|
||||
|
||||
|
@ -44,9 +43,9 @@ export default {
|
|||
currentStting.value = JSON.parse(JSON.stringify(config))
|
||||
}
|
||||
const refreshSetting = async(newSetting, newVersion) => {
|
||||
await saveSetting(newSetting)
|
||||
await saveSetting(toRaw(newSetting))
|
||||
const { setting, version } = await getSetting()
|
||||
setSetting(setting)
|
||||
currentStting.value = setting
|
||||
setSettingVersion(version)
|
||||
}
|
||||
|
||||
|
@ -112,13 +111,13 @@ export default {
|
|||
})
|
||||
}
|
||||
|
||||
|
||||
const exportSetting = (path) => {
|
||||
console.log(path)
|
||||
const data = {
|
||||
type: 'setting',
|
||||
data: Object.assign({ version: settingVersion.value }, toRaw(setting.value)),
|
||||
}
|
||||
console.log(data)
|
||||
saveLxConfigFile(path, data)
|
||||
}
|
||||
const handleExportSetting = () => {
|
||||
|
|
|
@ -91,6 +91,7 @@ export default {
|
|||
}
|
||||
|
||||
const handleHotKeyFocus = async(event, info, type) => {
|
||||
console.log('object')
|
||||
await hotKeySetEnable(false)
|
||||
window.isEditingHotKey = true
|
||||
isEditHotKey = true
|
||||
|
|
Loading…
Reference in New Issue