123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171 |
- <template>
- <div class="background-music-settings">
- <span class="title">{{set_bgm}}</span>
- <br>
- <button v-if="!(info && info.workBackgroundMusic && info.workBackgroundMusic.name)" @click="onClickMusicSelectionBtn">
- <i class="iconfont icon-editor_add"></i>
- {{add_audio}}
- </button>
- <template v-else>
- <div class="music-display" @click.self="onClickCurrentMusic">
- <Audio ref="my-audio" class="audio-control" :backgroundColor="'#1A1B1D'" :myAudioUrl="info.workBackgroundMusic.ossPath"></Audio>
- <div class="name" v-title="info.workBackgroundMusic.name" @click="onClickCurrentMusic">{{info.workBackgroundMusic.name}}</div>
- <i class="iconfont icon-editor_list_delete" @click.stop="onClickDeleteMusicBtn"></i>
- </div>
- <button @click="onClickMusicSelectionBtn">
- <i class="iconfont icon-editor_update"></i>
- {{change_audio}}
- </button>
- </template>
- <div class="dialog" style="z-index: 2000" v-if="isShowSelectionWindow">
- <MaterialSelector
- :title="select_material"
- @cancel="isShowSelectionWindow = false"
- @submit="handleSubmitFromMaterialSelector"
- :selectableType="['audio']"
- initialMaterialType="audio"
- />
- </div>
- </div>
- </template>
- <script>
- import { mapGetters } from "vuex";
- import MaterialSelector from "@/components/materialSelector.vue";
- import Audio from "@/components/audio/audioButton.vue";
- import {i18n} from "@/lang"
- export default {
- components: {
- MaterialSelector,
- Audio,
- },
- data() {
- return {
- set_bgm:i18n.t("edit_settings.set_bgm"),
- add_audio:i18n.t("edit_settings.add_audio"),
- change_audio:i18n.t("edit_settings.change_audio"),
- select_material:i18n.t("gather.select_material"),
- isShowSelectionWindow: false,
- }
- },
- computed: {
- ...mapGetters({
- // info:'info'
- info:'base/baseInfo'
- }),
- },
- methods: {
- onClickMusicSelectionBtn() {
- this.isShowSelectionWindow = true
- },
- onClickDeleteMusicBtn() {
- this.info.workBackgroundMusic.id = null
- this.info.workBackgroundMusic.name = null
- this.info.workBackgroundMusic.ossPath = null
- },
- handleSubmitFromMaterialSelector(selected) {
- this.isShowSelectionWindow = false
- this.info.workBackgroundMusic.fodderId = selected[0].id
- this.info.workBackgroundMusic.name = selected[0].name
- this.info.workBackgroundMusic.ossPath = selected[0].ossPath
- },
- onClickCurrentMusic() {
- if (this.$refs['my-audio']) {
- this.$refs['my-audio'].switchPlayPause()
- }
- }
- },
- mounted() {
- if (!this.info.workBackgroundMusic) {
- this.info.workBackgroundMusic = {
- id: '',
- name: '',
- ossPath: '',
- }
- }
- }
- }
- </script>
- <style lang="less" scoped>
- .background-music-settings {
- padding: 24px 30px;
- background: #252526;
- height: 546px;
- > .title {
- font-size: 18px;
- color: #FFFFFF;
- }
- > button {
- margin-top: 16px;
- width: 234px;
- height: 40px;
- background: #1A1B1D;
- border-radius: 2px;
- border: 1px solid #404040;
- display: block;
- color: #0076F6;
- font-size: 14px;
- cursor: pointer;
- &:hover {
- border-color: @color;
- }
- i {
- font-size: 14px;
- }
- }
- > .music-display {
- cursor: pointer;
- margin-top: 16px;
- width: 234px;
- height: 40px;
- background: #1A1B1D;
- border-radius: 2px;
- border: 1px solid #404040;
- color: #fff;
- font-size: 14px;
- position: relative;
- text-align: center;
- &:hover {
- color: #0076F6;
- border-color: @color;
- > .audio-control {
- display: inline-block;
- }
- > i {
- display: inline-block;
- }
- }
- > .audio-control {
- position: absolute;
- top: 50%;
- transform: translateY(-50%);
- left: 18px;
- display: none;
- }
- > .name {
- position: absolute;
- left: 50%;
- top: 50%;
- transform: translate(-50%, -50%);
- width: 65%;
- text-overflow: ellipsis;
- overflow: hidden;
- white-space: nowrap;
- display: inline-block;
- }
- > i {
- display: none;
- position: absolute;
- top: 50%;
- transform: translateY(-50%);
- right: 18px;
- &:hover {
- color: #FA5555;
- }
- }
- }
- }
- </style>
|