feature:新增搜索功能

This commit is contained in:
charlesxie
2023-04-11 13:47:23 +08:00
parent afd9d191e9
commit 8ab43a0f75
2 changed files with 26 additions and 16 deletions

View File

@@ -70,22 +70,22 @@ TIME_ZONE = "Asia/Shanghai"
LANGUAGE_CODE = "zh-hans"
# Database
# https://docs.djangoproject.com/en/3.2/ref/settings/#databases
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3',
'NAME': os.path.join(BASE_DIR, 'db.sqlite3'),
}
}
# DATABASES = {
# "default": {
# "ENGINE": "django.db.backends.mysql",
# "NAME": 'music', # noqa
# "USER": "root",
# "PASSWORD": "123456",
# "HOST": "localhost",
# "PORT": "3306",
# },
# 'default': {
# 'ENGINE': 'django.db.backends.sqlite3',
# 'NAME': os.path.join(BASE_DIR, 'db.sqlite3'),
# }
# }
DATABASES = {
"default": {
"ENGINE": "django.db.backends.mysql",
"NAME": 'music', # noqa
"USER": "root",
"PASSWORD": "123456",
"HOST": "localhost",
"PORT": "3306",
},
}
# Password validation
# https://docs.djangoproject.com/en/3.2/ref/settings/#auth-password-validators

View File

@@ -10,6 +10,9 @@
behavior="simplicity">
</bk-input>
</div>
<div style="margin-top: 10px;">
<bk-input type="text" v-model="searchWord" placeholder="search..." @enter="handleSearch"></bk-input>
</div>
<transition name="bk-slide-fade-down">
<div style="margin-top: 10px;" v-show="fadeShowDir">
<bk-tree
@@ -273,9 +276,10 @@
export default {
data() {
return {
searchWord: '',
treeListOne: [],
filePath: '/app/media/',
bakDir: '/app/media/',
filePath: '/Users/macbookair/Music/my_music',
bakDir: '/Users/macbookair/Music/my_music',
fileName: '',
resource: 'netease',
resourceList: [{id: 'netease', name: '网易云音乐'}, {id: 'migu', name: '咪咕音乐'}],
@@ -432,6 +436,12 @@
}
})
},
// 过滤搜索
handleSearch() {
this.$refs.tree1.searchNode(this.searchWord)
const searchResult = this.$refs.tree1.getSearchResult()
this.isEmpty = searchResult.isEmpty
},
// 保存音乐信息
handleClick() {
const params = [{