diff --git a/src/web/app/desktop/api/update-avatar.ts b/src/web/app/desktop/api/update-avatar.ts index eff0728348348e57a19b67c65609ac1e16b5a161..c3e0ce14c70e1b9cb8aeaecac2ac9c8ec98521fc 100644 --- a/src/web/app/desktop/api/update-avatar.ts +++ b/src/web/app/desktop/api/update-avatar.ts @@ -8,7 +8,7 @@ export default (os: OS) => (cb, file = null) => { const w = new CropWindow({ propsData: { - file: file, + image: file, title: 'ã‚¢ãƒã‚¿ãƒ¼ã¨ã—ã¦è¡¨ç¤ºã™ã‚‹éƒ¨åˆ†ã‚’é¸æŠž', aspectRatio: 1 / 1 } @@ -60,7 +60,7 @@ export default (os: OS) => (cb, file = null) => { }; xhr.upload.onprogress = e => { - if (e.lengthComputable) (dialog as any).updateProgress(e.loaded, e.total); + if (e.lengthComputable) (dialog as any).update(e.loaded, e.total); }; xhr.send(data); @@ -70,6 +70,9 @@ export default (os: OS) => (cb, file = null) => { os.api('i/update', { avatar_id: file.id }).then(i => { + os.i.avatar_id = i.avatar_id; + os.i.avatar_url = i.avatar_url; + os.apis.dialog({ title: '%fa:info-circle%ã‚¢ãƒã‚¿ãƒ¼ã‚’æ›´æ–°ã—ã¾ã—ãŸ', text: 'æ–°ã—ã„ã‚¢ãƒã‚¿ãƒ¼ãŒåæ˜ ã•ã‚Œã‚‹ã¾ã§æ™‚é–“ãŒã‹ã‹ã‚‹å ´åˆãŒã‚ã‚Šã¾ã™ã€‚', diff --git a/src/web/app/desktop/api/update-banner.ts b/src/web/app/desktop/api/update-banner.ts index 5751616581b1a49db8a44fc61c59d8bec245b44e..9e94dc423ba6887e8d007bad995fce2ad53784e9 100644 --- a/src/web/app/desktop/api/update-banner.ts +++ b/src/web/app/desktop/api/update-banner.ts @@ -8,7 +8,7 @@ export default (os: OS) => (cb, file = null) => { const w = new CropWindow({ propsData: { - file: file, + image: file, title: 'ãƒãƒŠãƒ¼ã¨ã—ã¦è¡¨ç¤ºã™ã‚‹éƒ¨åˆ†ã‚’é¸æŠž', aspectRatio: 16 / 9 } @@ -60,7 +60,7 @@ export default (os: OS) => (cb, file = null) => { }; xhr.upload.onprogress = e => { - if (e.lengthComputable) (dialog as any).updateProgress(e.loaded, e.total); + if (e.lengthComputable) (dialog as any).update(e.loaded, e.total); }; xhr.send(data); @@ -68,8 +68,11 @@ export default (os: OS) => (cb, file = null) => { const set = file => { os.api('i/update', { - avatar_id: file.id + banner_id: file.id }).then(i => { + os.i.banner_id = i.banner_id; + os.i.banner_url = i.banner_url; + os.apis.dialog({ title: '%fa:info-circle%ãƒãƒŠãƒ¼ã‚’æ›´æ–°ã—ã¾ã—ãŸ', text: 'æ–°ã—ã„ãƒãƒŠãƒ¼ãŒåæ˜ ã•ã‚Œã‚‹ã¾ã§æ™‚é–“ãŒã‹ã‹ã‚‹å ´åˆãŒã‚ã‚Šã¾ã™ã€‚', diff --git a/src/web/app/desktop/views/components/crop-window.vue b/src/web/app/desktop/views/components/crop-window.vue index 2ba62a3a6823ac466c78f78ea9b151c621a06976..27d89a9ff94df24647a446f7a56a45cbdc8b678f 100644 --- a/src/web/app/desktop/views/components/crop-window.vue +++ b/src/web/app/desktop/views/components/crop-window.vue @@ -1,10 +1,12 @@ <template> - <mk-window ref="window" is-modal width="800px"> + <mk-window ref="window" is-modal width="800px" :can-close="false"> <span slot="header">%fa:crop%{{ title }}</span> <div class="body"> - <vue-cropper + <vue-cropper ref="cropper" :src="image.url" :view-mode="1" + :aspect-ratio="aspectRatio" + :container-style="{ width: '100%', 'max-height': '400px' }" /> </div> <div :class="$style.actions"> @@ -17,7 +19,12 @@ <script lang="ts"> import Vue from 'vue'; +import VueCropper from 'vue-cropperjs'; + export default Vue.extend({ + components: { + VueCropper + }, props: { image: { type: Object, diff --git a/src/web/app/desktop/views/components/drive.vue b/src/web/app/desktop/views/components/drive.vue index 064e4de661407d75f4bf3b1b56b6a7d429b0e12a..aed31f2a8c469e23754a981dbcd86f8d7d3aff9f 100644 --- a/src/web/app/desktop/views/components/drive.vue +++ b/src/web/app/desktop/views/components/drive.vue @@ -49,7 +49,7 @@ </div> </div> <div class="dropzone" v-if="draghover"></div> - <mk-uploader @change="onChangeUploaderUploads" @uploaded="onUploaderUploaded"/> + <mk-uploader ref="uploader" @change="onChangeUploaderUploads" @uploaded="onUploaderUploaded"/> <input ref="fileInput" type="file" accept="*/*" multiple="multiple" tabindex="-1" @change="onChangeFileInput"/> </div> </template> diff --git a/src/web/app/desktop/views/components/progress-dialog.vue b/src/web/app/desktop/views/components/progress-dialog.vue index 9a925d5b1deab077856341dd642266dac3fa94e2..ed49b19d7154add2d65dbfb49afce0a5f62010a7 100644 --- a/src/web/app/desktop/views/components/progress-dialog.vue +++ b/src/web/app/desktop/views/components/progress-dialog.vue @@ -1,17 +1,15 @@ <template> <mk-window ref="window" :is-modal="false" :can-close="false" width="500px" @closed="$destroy"> - <span to="header">{{ title }}<mk-ellipsis/></span> - <div to="content"> - <div :class="$style.body"> - <p :class="$style.init" v-if="isNaN(value)">å¾…æ©Ÿä¸<mk-ellipsis/></p> - <p :class="$style.percentage" v-if="!isNaN(value)">{{ Math.floor((value / max) * 100) }}</p> - <progress :class="$style.progress" - v-if="!isNaN(value) && value < max" - :value="isNaN(value) ? 0 : value" - :max="max" - ></progress> - <div :class="[$style.progress, $style.waiting]" v-if="value >= max"></div> - </div> + <span slot="header">{{ title }}<mk-ellipsis/></span> + <div :class="$style.body"> + <p :class="$style.init" v-if="isNaN(value)">å¾…æ©Ÿä¸<mk-ellipsis/></p> + <p :class="$style.percentage" v-if="!isNaN(value)">{{ Math.floor((value / max) * 100) }}</p> + <progress :class="$style.progress" + v-if="!isNaN(value) && value < max" + :value="isNaN(value) ? 0 : value" + :max="max" + ></progress> + <div :class="[$style.progress, $style.waiting]" v-if="value >= max"></div> </div> </mk-window> </template> @@ -30,6 +28,9 @@ export default Vue.extend({ update(value, max) { this.value = parseInt(value, 10); this.max = parseInt(max, 10); + }, + close() { + (this.$refs.window as any).close(); } } }); diff --git a/src/web/app/desktop/views/components/settings.profile.vue b/src/web/app/desktop/views/components/settings.profile.vue index dcc031c27a7ae03756a0a03751d6db272d179e49..97a382d798478f50c77822550f0f0aeae19414b6 100644 --- a/src/web/app/desktop/views/components/settings.profile.vue +++ b/src/web/app/desktop/views/components/settings.profile.vue @@ -45,11 +45,7 @@ export default Vue.extend({ }, methods: { updateAvatar() { - (this as any).apis.chooseDriveFile({ - multiple: false - }).then(file => { - (this as any).apis.updateAvatar(file); - }); + (this as any).apis.updateAvatar(); }, save() { (this as any).api('i/update', { diff --git a/src/web/app/init.ts b/src/web/app/init.ts index b814a18066e0984208e3e65d21a50c7c2c3fdd7e..02c125efefeb701631db26886b7703071307a5f8 100644 --- a/src/web/app/init.ts +++ b/src/web/app/init.ts @@ -90,10 +90,12 @@ export default (callback: (launch: (api: (os: MiOS) => API) => [Vue, MiOS]) => v const launch = (api: (os: MiOS) => API) => { os.apis = api(os); Vue.mixin({ - created() { - (this as any).os = os; - (this as any).api = os.api; - (this as any).apis = os.apis; + data() { + return { + os, + api: os.api, + apis: os.apis + }; } }); diff --git a/webpack/webpack.config.ts b/webpack/webpack.config.ts index fae75059a6c485163bba509b1cc9aae3a4bd1575..3686d0b6515b70e38a287d5d11b8ede265aec3c4 100644 --- a/webpack/webpack.config.ts +++ b/webpack/webpack.config.ts @@ -100,6 +100,12 @@ module.exports = Object.keys(langs).map(lang => { { loader: 'css-loader' }, { loader: 'stylus-loader' } ] + }, { + test: /\.css$/, + use: [ + { loader: 'style-loader' }, + { loader: 'css-loader' } + ] }, { test: /\.ts$/, exclude: /node_modules/,