Snapshot
diff --git a/frontend/src/store/modules/meetingStore.js b/frontend/src/store/modules/meetingStore.js
index ad68a26..09e1035 100644
--- a/frontend/src/store/modules/meetingStore.js
+++ b/frontend/src/store/modules/meetingStore.js
@@ -1,11 +1,17 @@
+import SERVER from '@/api/api'
+import secrets from '@/secrets'
+import axios from 'axios'
+
const meetingStore = {
namespaced: true,
state: {
isGameMode: false,
- isMusicMode: false,
+ isSingingMode: false,
isAnonymousMode: false,
isSnapshotMode: false,
isChatPanel: false,
+ selectedSong: null,
+ songs: null
},
getters: {
},
@@ -13,8 +19,8 @@ const meetingStore = {
SET_ISGAME_MODE(state, value) {
state.isGameMode = value
},
- SET_ISMUSIC_MODE(state, value) {
- state.isGameMode = value
+ SET_ISSINGING_MODE(state, value) {
+ state.isSingingMode = value
},
SET_ISANONYMOUS_MODE(state, value) {
state.isAnonymousMode = value
@@ -24,41 +30,73 @@ const meetingStore = {
},
SET_CHATPANEL(state, value) {
state.isChatPanel = value
+ },
+ SET_SELECTED_SONG(state, song) {
+ state.selectedSong = song
+ },
+ SET_SONGS(state, songs) {
+ state.songs = songs
}
},
actions: {
startGameMode({ commit }) {
commit('SET_ISANONYMOUS_MODE', false)
commit('SET_ISSNAPSHOT_MODE', false)
- commit('SET_ISMUSIC_MODE', false)
+ commit('SET_ISSINGING_MODE', false)
commit('SET_ISGAME_MODE', true)
},
- startMusicMode({ commit }) {
+ startSingingMode({ commit }) {
commit('SET_ISANONYMOUS_MODE', false)
commit('SET_ISSNAPSHOT_MODE', false)
commit('SET_ISGAME_MODE', false)
- commit('SET_ISMUSIC_MODE', true)
+ commit('SET_ISSINGING_MODE', true)
},
startAnonymousMode({ commit }) {
commit('SET_ISGAME_MODE', false)
commit('SET_ISSNAPSHOT_MODE', false)
- commit('SET_ISMUSIC_MODE', false)
+ commit('SET_ISSINGING_MODE', false)
commit('SET_ISANONYMOUS_MODE', true)
},
startSnapshotMode({ commit }) {
commit('SET_ISGAME_MODE', false)
- commit('SET_ISMUSIC_MODE', false)
+ commit('SET_ISSINGING_MODE', false)
commit('SET_ISANONYMOUS_MODE', false)
commit('SET_ISSNAPSHOT_MODE', true)
},
closeMultiPanel({ commit }) {
commit('SET_ISGAME_MODE', false)
- commit('SET_ISMUSIC_MODE', false)
+ commit('SET_ISSINGING_MODE', false)
commit('SET_ISANONYMOUS_MODE', false)
commit('SET_ISSNAPSHOT_MODE', false)
},
clickChatPanel({ commit }, value) {
commit('SET_CHATPANEL', value)
+ },
+ searchSong({ commit }, keyword) {
+ axios.get(SERVER.YOUTUBE_URL, {
+ params: {
+ key: secrets.YOUTUBE.SECRET_KEY,
+ part: 'snippet',
+ type: 'video',
+ q: '[KY 금영노래방]' + keyword,
+ maxResults: 4
+ }
+ })
+ .then(res => {
+ res.data.items.forEach(item => {
+ const parser = new DOMParser()
+ const doc = parser.parseFromString(item.snippet.title, 'text/html')
+ item.snippet.title = doc.body.innerText
+ })
+ commit('SET_SONGS', res.data.items)
+ })
+ },
+ selectSong({ commit }, song) {
+ commit('SET_SELECTED_SONG', song)
+ },
+ closeSingingPanel({ commit }) {
+ commit('SET_SONGS', null)
+ commit('SET_SELECTED_SONG', null)
}
}
diff --git a/frontend/src/views/MeetingPage.vue b/frontend/src/views/MeetingPage.vue
index 9e2216b..f06aa78 100644
--- a/frontend/src/views/MeetingPage.vue
+++ b/frontend/src/views/MeetingPage.vue
@@ -10,7 +10,7 @@
@@ -59,7 +59,7 @@
@@ -121,9 +121,9 @@ export default {
LeftPanel
},
computed: {
- ...mapState('meetingStore', ['isGameMode', 'isMusicMode', 'isAnonymousMode', 'isSnapshotMode', 'isChatPanel']),
+ ...mapState('meetingStore', ['isGameMode', 'isSingingMode', 'isAnonymousMode', 'isSnapshotMode', 'isChatPanel']),
isMultiPanel() {
- if (this.isGameMode || this.isMusicMode || this.isAnonymousMode || this.isSnapshotMode) {
+ if (this.isGameMode || this.isSingingMode || this.isAnonymousMode || this.isSnapshotMode) {
return true
} else {
return false
@@ -131,7 +131,7 @@ export default {
}
},
methods: {
- ...mapActions('meetingStore', ['startGameMode', 'startMusicMode', 'startAnonymousMode', 'startSnapshotMode', 'clickChatPanel']),
+ ...mapActions('meetingStore', ['startGameMode', 'startSingingMode', 'startAnonymousMode', 'startSnapshotMode', 'clickChatPanel']),
clickChatMode() {
if (this.isChatPanel === true) {
this.clickChatPanel(false)
@@ -149,7 +149,6 @@ export default {
}
},
setVolume(e) {
- console.log(e.target.value)
song.volume = e.target.value / 100;
},
clickChangeTheme() {