This commit is contained in:
syuilo
2019-04-17 14:30:31 +09:00
parent 946c3a25b9
commit 85959a3b9b
4 changed files with 26 additions and 23 deletions

View File

@ -525,15 +525,11 @@ export default Vue.extend({
this.$chooseDriveFile({
multiple: false
}).then(file => {
this.$root.api('i/update', {
wallpaperId: file.id
});
this.$store.dispatch('settings/set', { key: 'wallpaper', value: file.url });
});
},
deleteWallpaper() {
this.$root.api('i/update', {
wallpaperId: null
});
this.$store.dispatch('settings/set', { key: 'wallpaper', value: null });
},
checkForUpdate() {
this.checkingForUpdate = true;

View File

@ -1,6 +1,6 @@
<template>
<div class="mk-ui" v-hotkey.global="keymap">
<div class="bg" v-if="$store.getters.isSignedIn && $store.state.i.wallpaperUrl" :style="style"></div>
<div class="bg" v-if="$store.getters.isSignedIn && $store.state.settings.wallpaper" :style="style"></div>
<x-header class="header" v-if="navbar == 'top'" v-show="!zenMode" ref="header"/>
<x-sidebar class="sidebar" v-if="navbar != 'top'" v-show="!zenMode" ref="sidebar"/>
<div class="content" :class="[{ sidebar: navbar != 'top', zen: zenMode }, navbar]">
@ -33,10 +33,9 @@ export default Vue.extend({
},
style(): any {
if (!this.$store.getters.isSignedIn || this.$store.state.i.wallpaperUrl == null) return {};
if (!this.$store.getters.isSignedIn || this.$store.state.settings.wallpaper == null) return {};
return {
backgroundColor: this.$store.state.i.wallpaperColor && this.$store.state.i.wallpaperColor.length == 3 ? `rgb(${ this.$store.state.i.wallpaperColor.join(',') })` : null,
backgroundImage: `url(${ this.$store.state.i.wallpaperUrl })`
backgroundImage: `url(${ this.$store.state.settings.wallpaper })`
};
},

View File

@ -28,6 +28,7 @@ const defaultSettings = {
iLikeSushi: false,
rememberNoteVisibility: false,
defaultNoteVisibility: 'public',
wallpaper: null,
webSearchEngine: 'https://www.google.com/?#q={{query}}',
mutedWords: [],
games: {