|
|
@@ -218,44 +218,44 @@
|
|
|
@up="upLayer"
|
|
|
@down="downLayer"
|
|
|
/>
|
|
|
- <el-dialog
|
|
|
- :visible.sync="showAssets"
|
|
|
+ <confirm-dialog
|
|
|
+ ref="sourcesDialog"
|
|
|
+ size="medium fixed"
|
|
|
:title="assetDialogType"
|
|
|
- custom-class="c-dialog medium fixed"
|
|
|
- :close-on-click-modal="false"
|
|
|
- @closed="onCloseAssetsDialog"
|
|
|
+ @confirm="onSaveAssets"
|
|
|
>
|
|
|
- <draggable
|
|
|
- v-if="showAssets"
|
|
|
- v-model="sources"
|
|
|
- class="l-grid--info mini"
|
|
|
- :class="{ dragging }"
|
|
|
- animation="300"
|
|
|
- @start="onSourceDragStart"
|
|
|
- @end="onSourceDragEnd"
|
|
|
- >
|
|
|
- <media-card
|
|
|
- v-for="(source, index) in sources"
|
|
|
- :key="index"
|
|
|
- class="o-card"
|
|
|
- :source="source"
|
|
|
- @click="onView"
|
|
|
+ <template #default>
|
|
|
+ <draggable
|
|
|
+ v-model="sources"
|
|
|
+ class="l-grid--info mini"
|
|
|
+ :class="{ dragging }"
|
|
|
+ animation="300"
|
|
|
+ @start="onSourceDragStart"
|
|
|
+ @end="onSourceDragEnd"
|
|
|
>
|
|
|
- <div
|
|
|
- v-if="needTypeTag"
|
|
|
- class="o-card__tag"
|
|
|
+ <media-card
|
|
|
+ v-for="(source, index) in sources"
|
|
|
+ :key="index"
|
|
|
+ class="o-card"
|
|
|
+ :source="source"
|
|
|
+ @click="onView"
|
|
|
>
|
|
|
- {{ source.typeTag }}
|
|
|
- </div>
|
|
|
- <i
|
|
|
- class="o-card__icon el-icon-delete has-active"
|
|
|
- @mousedown.stop
|
|
|
- @pointerdown.stop
|
|
|
- @click.stop="onDelAsset(index)"
|
|
|
- />
|
|
|
- </media-card>
|
|
|
- </draggable>
|
|
|
- <template #footer>
|
|
|
+ <div
|
|
|
+ v-if="needTypeTag"
|
|
|
+ class="o-card__tag"
|
|
|
+ >
|
|
|
+ {{ source.typeTag }}
|
|
|
+ </div>
|
|
|
+ <i
|
|
|
+ class="o-card__icon el-icon-delete has-active"
|
|
|
+ @mousedown.stop
|
|
|
+ @pointerdown.stop
|
|
|
+ @click.stop="onDelAsset(index)"
|
|
|
+ />
|
|
|
+ </media-card>
|
|
|
+ </draggable>
|
|
|
+ </template>
|
|
|
+ <template #footer="{ confirm, cancel }">
|
|
|
<button
|
|
|
class="c-sibling-item o-button"
|
|
|
@click="onAddAssets"
|
|
|
@@ -264,33 +264,35 @@
|
|
|
</button>
|
|
|
<button
|
|
|
class="c-sibling-item o-button"
|
|
|
- @click="onSaveAssets"
|
|
|
+ @click="confirm"
|
|
|
>
|
|
|
确定
|
|
|
</button>
|
|
|
<button
|
|
|
class="c-sibling-item o-button o-button--cancel"
|
|
|
- @click="onCloseAssetsDialog"
|
|
|
+ @click="cancel"
|
|
|
>
|
|
|
取消
|
|
|
</button>
|
|
|
</template>
|
|
|
- </el-dialog>
|
|
|
- <el-dialog
|
|
|
- :visible.sync="showServerAssets"
|
|
|
+ </confirm-dialog>
|
|
|
+ <c-dialog
|
|
|
+ ref="assetDialog"
|
|
|
+ size="lg"
|
|
|
:title="assetDialogTitle"
|
|
|
- custom-class="c-dialog lg"
|
|
|
append-to-body
|
|
|
>
|
|
|
- <grid-table :schema="assetSchema">
|
|
|
- <grid-table-item v-slot="item">
|
|
|
- <media-card
|
|
|
- :source="item"
|
|
|
- @dblclick="onChoosenAsset"
|
|
|
- />
|
|
|
- </grid-table-item>
|
|
|
- </grid-table>
|
|
|
- </el-dialog>
|
|
|
+ <template #default>
|
|
|
+ <grid-table :schema="assetSchema">
|
|
|
+ <grid-table-item v-slot="item">
|
|
|
+ <media-card
|
|
|
+ :source="item"
|
|
|
+ @dblclick="onChoosenAsset"
|
|
|
+ />
|
|
|
+ </grid-table-item>
|
|
|
+ </grid-table>
|
|
|
+ </template>
|
|
|
+ </c-dialog>
|
|
|
<confirm-dialog
|
|
|
ref="assetsDialog"
|
|
|
:title="assetDialogTitle"
|
|
|
@@ -354,7 +356,7 @@
|
|
|
</confirm-dialog>
|
|
|
<preview-dialog
|
|
|
ref="previewDialog"
|
|
|
- @closed="onClosePreview"
|
|
|
+ @closed="onClosedPreview"
|
|
|
/>
|
|
|
<confirm-dialog
|
|
|
ref="rich"
|
|
|
@@ -363,20 +365,22 @@
|
|
|
append-to-body
|
|
|
@confirm="onRichConfirm"
|
|
|
>
|
|
|
- <toolbar
|
|
|
- style="border-bottom: 1px solid #ccc"
|
|
|
- mode="simple"
|
|
|
- :editor="editor"
|
|
|
- :default-config="toolbarConfig"
|
|
|
- />
|
|
|
- <editor
|
|
|
- v-model="richHtml"
|
|
|
- mode="simple"
|
|
|
- style="height: 500px; overflow: hidden;"
|
|
|
- :default-config="editorConfig"
|
|
|
- @onCreated="onEditorCreated"
|
|
|
- @customPaste="onCustomPaste"
|
|
|
- />
|
|
|
+ <template #default>
|
|
|
+ <toolbar
|
|
|
+ style="border-bottom: 1px solid #ccc"
|
|
|
+ mode="simple"
|
|
|
+ :editor="editor"
|
|
|
+ :default-config="toolbarConfig"
|
|
|
+ />
|
|
|
+ <editor
|
|
|
+ v-model="richHtml"
|
|
|
+ mode="simple"
|
|
|
+ style="height: 500px; overflow: hidden;"
|
|
|
+ :default-config="editorConfig"
|
|
|
+ @onCreated="onEditorCreated"
|
|
|
+ @customPaste="onCustomPaste"
|
|
|
+ />
|
|
|
+ </template>
|
|
|
</confirm-dialog>
|
|
|
</div>
|
|
|
</template>
|
|
|
@@ -436,11 +440,9 @@ export default {
|
|
|
visibleContentMenu: false,
|
|
|
styleObj: null,
|
|
|
widgetAttr: null,
|
|
|
- showAssets: false,
|
|
|
sources: null,
|
|
|
dragging: false,
|
|
|
dragScale: false,
|
|
|
- showServerAssets: false,
|
|
|
fileDir: null,
|
|
|
editor: null,
|
|
|
richHtml: '',
|
|
|
@@ -750,10 +752,10 @@ export default {
|
|
|
switch (attr.type) {
|
|
|
case 'data':
|
|
|
if (attr.options && attr.options.solo) {
|
|
|
- this.showServerAssets = true
|
|
|
+ this.$refs.assetDialog.show()
|
|
|
} else {
|
|
|
this.sources = this.widget[attr.key].map(this.transformDataToSource)
|
|
|
- this.showAssets = true
|
|
|
+ this.$refs.sourcesDialog.show()
|
|
|
}
|
|
|
break
|
|
|
case 'rich':
|
|
|
@@ -764,11 +766,6 @@ export default {
|
|
|
break
|
|
|
}
|
|
|
},
|
|
|
- onCloseAssetsDialog () {
|
|
|
- this.widgetAttr = null
|
|
|
- this.showAssets = false
|
|
|
- this.showServerAssets = false
|
|
|
- },
|
|
|
transformAsset ({ tag, type, originalName, keyName, file, duration, size, md5 }) {
|
|
|
const asset = {
|
|
|
selected: false,
|
|
|
@@ -830,7 +827,7 @@ export default {
|
|
|
},
|
|
|
onChoosenAsset (asset) {
|
|
|
this.changeAttr([this.transformToData(asset)])
|
|
|
- this.onCloseAssetsDialog()
|
|
|
+ this.$refs.assetDialog.hide()
|
|
|
},
|
|
|
onAddAssets () {
|
|
|
this.fileDir = null
|
|
|
@@ -869,9 +866,9 @@ export default {
|
|
|
onDirBack () {
|
|
|
this.fileDir = null
|
|
|
},
|
|
|
- onSaveAssets () {
|
|
|
+ onSaveAssets (done) {
|
|
|
+ done()
|
|
|
this.changeAttr(this.sources.map(this.transformToData))
|
|
|
- this.onCloseAssetsDialog()
|
|
|
},
|
|
|
onView ({ type, keyName, files }) {
|
|
|
this.onViewAsset({ type: type || this.widgetAttr.options.type, url: keyName, files })
|
|
|
@@ -883,7 +880,7 @@ export default {
|
|
|
}
|
|
|
this.$refs.previewDialog.show(asset)
|
|
|
},
|
|
|
- onClosePreview () {
|
|
|
+ onClosedPreview () {
|
|
|
this.muted = this.$muted
|
|
|
},
|
|
|
onDelAsset (index) {
|