{{section.header.name}}
-{{section.subheader.name}}
+{{section.header.name}}
+{{section.subheader.name}}
{{section.header.name}}
+{{section.subheader.name}}
+{{item}}
+Text content loading..
` + content: `Text content loading..
`, + carouselWidth: 0 } }, methods: { + setSize: function () { + if (this.$refs.imageCarousel && this.$refs.imageCarousel.length > 0) { + this.carouselWidth = this.$refs.imageCarousel[0].$el.clientWidth + } + }, formatContentNode () { let content = this.$refs.resultContent if (!content || !content.childNodes) return this.contentArr = this.Utils.formatProject(content.childNodes) console.log('contentArr - \n', this.contentArr) + this.setSize() }, showSplit () { let quill = this.$refs.myQuillEditor.quill @@ -164,8 +237,39 @@ export default { }) .catch(_ => {}) }, - handleBeforeUpdate () { + handleBeforeUpdate (file) { + this.uploadImageData.identifier = new Date().getTime() + // 限制上传大小 + }, + handleImageBeforeUpdate (file) { this.uploadImageData.identifier = new Date().getTime() + // 限制上传图片大小 + let originSize = file.size + if (originSize > 15728640) { + // 不能超过 15 M + console.error('Image too large') + this.$message.error('图片太大, 请先本地压缩') + return false + } else if (originSize > 0 && this.isCompressImage) { + const vm = this + return new Promise((resolve) => { + const reader = new FileReader() + const image = new Image() + image.onload = (imageEvent) => { + let dataUrl = vm.Utils.compressImage(image, file.type) + let blobData = vm.Utils.dataURItoBlob(dataUrl, file.type) + let compressedSize = blobData.size + this.$notify({ + type: 'success', + title: '压缩成功', + message: `体积从 ${(originSize / 1024 / 1024).toFixed(2)}M 缩小到了 ${(compressedSize / 1024 / 1024).toFixed(2)}M` + }) + resolve(blobData) + } + reader.onload = e => { image.src = e.target.result } + reader.readAsDataURL(file) + }) + } }, handleUploadProcess () { this.processLoading = true @@ -198,6 +302,38 @@ export default { } // loading动画消失 }, + // 插入音频 + joinAudio: function (state) { + // button is clicked + // this.$refs.myQuillEditor.quill.root.children.push('99999
') + console.log(this.$refs.myQuillEditor.quill.root.children) + document.querySelector('.upload-audio input').click() + console.log('Btn', state) + }, + bindUploadAudioSuccess: function (res, file) { + console.log(res, file) + this.addAudioToQuill(res) + this.processLoading = false + }, + addAudioToQuill: function (res) { + let quill = this.$refs.myQuillEditor.quill + // 如果上传成功 + if (res) { + // 获取光标所在位置 + let length = quill.getSelection().index + // 插入图片 res.info为服务器返回的图片地址 + // quill.insertEmbed(length, 'audio', res) + let content = `` + // 插入 + quill.insertText(length, content, { + 'color': '#666666' + }) + // 调整光标到最后 + quill.setSelection(length + 1) + } else { + this.$message.error('音频插入失败') + } + }, addCarouselImage: function (params) { let imgItem = { type: 'image', @@ -235,9 +371,10 @@ export default { this.closeAddCarousel() }, confirmText: function (params) { - console.log('CONTENT | ', this.content) this.result = this.content - // this.formatContentNode() + setTimeout(() => { + this.formatContentNode() + }, 200) this.$emit('confirmEditorRichText', this.content) }, cancel: function (params) { @@ -268,6 +405,7 @@ export default { }, 1300) var vm = this vm.$refs.myQuillEditor.quill.getModule('toolbar').addHandler('image', this.imgHandler) + // vm.$refs.myQuillEditor.quill.getModule('toolbar').addHandler('audio', this.audioHandler) } } diff --git a/src/views/Home.vue b/src/views/Home.vue index a50c906..59c2b3e 100644 --- a/src/views/Home.vue +++ b/src/views/Home.vue @@ -1,15 +1,9 @@Research-based,
-Problem-solving,
-Experience-creating,
-DESIGNER.
{{element.name}}
{{element.discribe}}
@@ -171,7 +165,7 @@ export default { return { ...item, uuid: item.uuid, - src: item.header_image.replace('Http://', 'Https://'), + src: item.thumbnail.replace('Http://', 'Https://') + '?x-oss-process=style/smaller', name: item.title, discribe: item.explanation, group: item.category @@ -274,15 +268,15 @@ export default { background-size: cover; background-repeat: no-repeat; background-position: center; - cursor: pointer; - background-image: url(/static/images/imgnm.jpg); /* 首页背景图片 */ + /* cursor: pointer; */ + background-image: url(https://static.dubheee.cn/sun/static/imgnm.png?x-oss-process=style/2k); /* 首页背景图片 */ } .mobile-home { height: calc(100vh - 66px); width: 100%; - cursor: pointer; + /* cursor: pointer; */ background-color: black; - background-image: url(/static/images/imgmb.jpg); /* 首页背景图片 */ + background-image: url(https://static.dubheee.cn/sun/static/imgmb.png?x-oss-process=style/2k); /* 首页背景图片 */ background-size: cover; background-repeat: no-repeat; color: #ffffff; @@ -304,6 +298,7 @@ export default { .home-page .project-item { position: relative; overflow: hidden; + cursor: url(https://static.dubheee.cn/sun/static/cursor_pointer.png) 22.8 0, pointer; .hover-show { position: absolute; top: 100%; diff --git a/src/views/Periodic.vue b/src/views/Periodic.vue index 355aa49..634766a 100644 --- a/src/views/Periodic.vue +++ b/src/views/Periodic.vue @@ -496,7 +496,7 @@ body { outline: 1px solid rgba(127,255,255,0.75); border: 0px; padding: 5px 10px; - cursor: pointer; + cursor: url(https://static.dubheee.cn/sun/static/cursor_pointer.png),pointer; } .page-dashboard button:hover { background-color: rgba(0,255,255,0.5); diff --git a/src/views/Post.vue b/src/views/Post.vue index 2826efc..37c382b 100644 --- a/src/views/Post.vue +++ b/src/views/Post.vue @@ -368,7 +368,7 @@ export default { .el-upload { border: 1px dashed #d9d9d9; border-radius: 6px; - cursor: pointer; + cursor: url(https://static.dubheee.cn/sun/static/cursor_pointer.png),pointer; position: relative; } .el-upload:hover { diff --git a/src/views/PostRecord.vue b/src/views/PostRecord.vue index 85b1093..77415e4 100644 --- a/src/views/PostRecord.vue +++ b/src/views/PostRecord.vue @@ -74,7 +74,7 @@ class="grid-item grid-sizer">{{section.header.name}}
@@ -53,14 +55,29 @@ :autoplay="section.images.length > 2 ? true : false" :loop="section.images.length > 2 ? true : false" ref="imageCarousel" - :height="(parseInt(carouselWidth * section.height / section.width) || 400) + 'px'" + :height="elCarouselHeight(section) + 'px'" indicator-position="outside">{{item}}
++
{{selectTypeObj.title}}
+素材库
++
{{media.oss_path}}
+
+