videoTool.vue 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115
  1. <template>
  2. <div class="videoTool">
  3. <h3 class="toolTit">视频</h3>
  4. <div class="toolBox">
  5. <div class="itemBox">
  6. <label>视频地址</label>
  7. <Upload :default-file-list="defaultVideoList" :limit-size="20" :multiple="false" :types="['mp4']" :limit="1" @change="(fileList)=>handleUploadChange(fileList,'videoUrl')" />
  8. <!-- <el-input v-model="activeComponent.componentContent.videoUrl" placeholder="请输入内容"></el-input>-->
  9. </div>
  10. <div class="itemBox">
  11. <label>覆盖页地址(APP)</label>
  12. <Upload :default-file-list="defaultImgList" :limit-size="20" :multiple="false" :types="['jpg','jpeg','png','gif']" :limit="1" @change="(fileList)=>handleUploadChange(fileList,'coverImg')" />
  13. <!-- <el-input v-model="activeComponent.componentContent.videoUrl" placeholder="请输入内容"></el-input>-->
  14. </div>
  15. <!-- <div class="itemBox">-->
  16. <!-- <label>文本</label>-->
  17. <!-- <el-input-->
  18. <!-- type="textarea"-->
  19. <!-- :rows="2"-->
  20. <!-- placeholder="请输入内容"-->
  21. <!-- resize="none"-->
  22. <!-- v-model="textInfo">-->
  23. <!-- </el-input>-->
  24. <!-- </div>-->
  25. <div class="itemBox">
  26. <label>标题</label>
  27. <el-input v-model="activeComponent.componentContent.title" maxlength="20" placeholder="请输入内容"></el-input>
  28. </div>
  29. <div class="itemBox">
  30. <label>正文</label>
  31. <quill-editor
  32. v-model="activeComponent.componentContent.mainBody"
  33. ref="myQuillEditor"
  34. :options="editorOption"
  35. @blur="onEditorBlur($event)" @focus="onEditorFocus($event)"
  36. @change="onEditorChange($event)">
  37. </quill-editor>
  38. </div>
  39. </div>
  40. </div>
  41. </template>
  42. <script>
  43. import { quillEditor } from 'vue-quill-editor'
  44. import Upload from '@@/components/Upload'
  45. import {toolMixin} from '@@/config/mixin'
  46. export default {
  47. mixins: [toolMixin],
  48. name: 'videoTool',
  49. components: {
  50. quillEditor,
  51. Upload
  52. },
  53. mounted() {
  54. this.activeComponent.componentContent.videoUrl && this.defaultVideoList.push(this.activeComponent.componentContent.videoUrl)
  55. this.activeComponent.componentContent.coverImg && this.defaultImgList.push(this.activeComponent.componentContent.coverImg)
  56. },
  57. data () {
  58. return {
  59. defaultVideoList:[],
  60. defaultImgList:[],
  61. editorOption: {
  62. placeholder: '请输入',
  63. modules: {
  64. toolbar: [
  65. ['bold', 'italic', 'link'] // toggled buttons
  66. ]
  67. }
  68. }
  69. }
  70. },
  71. methods: {
  72. onEditorBlur () { // 失去焦点事件
  73. },
  74. onEditorFocus () { // 获得焦点事件
  75. },
  76. onEditorChange () { // 内容改变事件
  77. console.log(this.mainBody)
  78. },
  79. handleUploadChange(fileList,field){
  80. this.activeComponent.componentContent[field] = fileList.length>0 ? fileList[0].url :''
  81. }
  82. }
  83. }
  84. </script>
  85. <style lang="scss" scoped>
  86. .videoTool {
  87. padding: 20px 20px 0 20px;
  88. h3 {
  89. font-size: 18px;
  90. font-weight: 500;
  91. height: 35px;
  92. line-height: 35px;
  93. color: #333333;
  94. margin-bottom: 20px;
  95. }
  96. .toolBox {
  97. padding-bottom: 10px;
  98. .itemBox {
  99. label {
  100. font-size: 14px;
  101. color: #666666;
  102. height: 40px;
  103. line-height: 40px;
  104. }
  105. margin-bottom: 15px;
  106. }
  107. }
  108. ::v-deep .ql-container {
  109. height: 200px;
  110. }
  111. }
  112. </style>