imageText.vue 5.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223
  1. <template>
  2. <div class="imageTextTool">
  3. <h3 class="toolTit">图文</h3>
  4. <div class="toolBox">
  5. <tool-single-img :imageUrl.sync='activeComponent.componentContent.imageUrl' tip='建议尺寸: 500*300px, 高度自适应'></tool-single-img>
  6. <tool-select-link :linkObj.sync='activeComponent.componentContent.linkObj' title="图片链接"></tool-select-link>
  7. <tool-select :linkValue.sync='activeComponent.componentContent.positionValue' title="PC图片位置" :options="positionOpt"></tool-select>
  8. <div class="textTit">文本设置</div>
  9. <div class="itemBox">
  10. <label>标题</label>
  11. <el-input v-model="activeComponent.componentContent.title" maxlength="20" placeholder="请输入内容"></el-input>
  12. </div>
  13. <div class="itemBox">
  14. <label>正文</label>
  15. <quill-editor
  16. v-model="activeComponent.componentContent.content"
  17. ref="myQuillEditor"
  18. :options="editorOption"
  19. @blur="onEditorBlur($event)" @focus="onEditorFocus($event)"
  20. @change="onEditorChange($event)">
  21. </quill-editor>
  22. </div>
  23. </div>
  24. <el-dialog :visible.sync="dialogVisible">
  25. <img width="100%" :src="dialogImageUrl" alt="">
  26. </el-dialog>
  27. </div>
  28. </template>
  29. <script>
  30. import { quillEditor } from 'vue-quill-editor'
  31. import {toolMixin} from '@@/config/mixin'
  32. import ToolSingleImg from '../toolModule/tool-single-img'
  33. import ToolSelect from '../toolModule/tool-select'
  34. import ToolSelectLink from '../toolModule/tool-select-link'
  35. export default {
  36. name: 'videoTool',
  37. mixins: [toolMixin],
  38. components: {
  39. ToolSelectLink,
  40. ToolSelect,
  41. ToolSingleImg,
  42. quillEditor
  43. },
  44. data () {
  45. return {
  46. // imageUrl: '',
  47. // title: '', // 标题内容
  48. // linkValue: '',
  49. // positionValue: '',
  50. // content: null,
  51. dialogVisible: false,
  52. dialogImageUrl: '',
  53. linkOptions: [
  54. {
  55. value: '/index',
  56. label: '首页'
  57. },
  58. {
  59. value: '/list',
  60. label: '列表页'
  61. },
  62. {
  63. value: '/detail',
  64. label: '详情页'
  65. },
  66. {
  67. value: '/about',
  68. label: '关于我们'
  69. }
  70. ],
  71. positionOpt: [
  72. {
  73. value: 'left',
  74. label: '左图右文'
  75. },
  76. {
  77. value: 'right',
  78. label: '右图左文'
  79. },
  80. {
  81. value: 'top',
  82. label: '上图下文'
  83. },
  84. {
  85. value: 'bottom',
  86. label: '下图上文'
  87. }
  88. ],
  89. editorOption: {
  90. placeholder: '请输入',
  91. modules: {
  92. toolbar: [
  93. ['bold', 'italic', 'link'] // toggled buttons
  94. ]
  95. }
  96. }
  97. }
  98. }
  99. }
  100. </script>
  101. <style lang="scss" scoped>
  102. .imageTextTool {
  103. padding: 20px 20px 0 20px;
  104. h3 {
  105. font-size: 18px;
  106. font-weight: 500;
  107. height: 35px;
  108. line-height: 35px;
  109. color: #333333;
  110. margin-bottom: 20px;
  111. }
  112. .toolBox {
  113. padding-bottom: 10px;
  114. .textTit {
  115. height: 35px;
  116. line-height: 35px;
  117. font-size: 16px;
  118. color: #333333;
  119. margin-top: 30px;
  120. font-weight: bold;
  121. }
  122. .itemBox {
  123. label {
  124. font-size: 14px;
  125. color: #666666;
  126. height: 40px;
  127. line-height: 40px;
  128. }
  129. margin-bottom: 15px;
  130. ::v-deep .el-select {
  131. display: block;
  132. }
  133. }
  134. .imgBox{
  135. position: relative;
  136. .overlay{
  137. display: none;
  138. }
  139. &:hover .overlay{
  140. position: absolute;
  141. top:0;
  142. left: 0;
  143. width: 100%;
  144. height: 100%;
  145. background-color: rgba(0,0,0,0.3);
  146. color: #fff;
  147. display: flex;
  148. justify-content: center;
  149. align-items: center;
  150. .iconfont{
  151. padding: 5px;
  152. margin: 0 5px;
  153. font-size: 20px;
  154. cursor: pointer;
  155. }
  156. }
  157. }
  158. }
  159. ::v-deep .ql-container {
  160. height: 150px;
  161. }
  162. ::v-deep .avatar-uploader .el-upload {
  163. border: 1px dashed #d9d9d9;
  164. border-radius: 6px;
  165. cursor: pointer;
  166. position: relative;
  167. overflow: hidden;
  168. }
  169. ::v-deep .avatar-uploader-icon {
  170. font-size: 28px;
  171. color: #8c939d;
  172. width: 178px;
  173. height: 178px;
  174. line-height: 178px;
  175. text-align: center;
  176. }
  177. ::v-deep .el-upload__tip {
  178. height: auto;
  179. margin-top: 0;
  180. line-height: normal;
  181. }
  182. ::v-deep .el-upload {
  183. width: 100%;
  184. }
  185. ::v-deep .el-upload-dragger {
  186. width: 100%;
  187. position: relative;
  188. .avatar{
  189. max-width: 100%;
  190. height: 100%;
  191. max-height: 100%;
  192. position: absolute;
  193. margin: auto;
  194. top: 0;
  195. right: 0;
  196. bottom: 0;
  197. left: 0;
  198. }
  199. }
  200. ::v-deep .ql-snow .ql-tooltip{
  201. z-index: 8;
  202. left: 5px!important;
  203. }
  204. ::v-deep .ql-snow .ql-tooltip::before{
  205. content: '链接';
  206. }
  207. ::v-deep .ql-snow .ql-tooltip a.ql-action::after{
  208. content: '编辑';
  209. }
  210. ::v-deep .ql-snow .ql-tooltip a.ql-remove::before{
  211. content: '移除';
  212. }
  213. ::v-deep .ql-snow .ql-tooltip[data-mode=link]::before{
  214. content: '链接';
  215. }
  216. ::v-deep .ql-snow .ql-tooltip.ql-editing a.ql-action::after{
  217. content: '确定';
  218. }
  219. }
  220. </style>