From 9859fcfd747a4b8c1d735680aa38bfc13e5fc70d Mon Sep 17 00:00:00 2001 From: guqing <1484563614@qq.com> Date: Wed, 12 Jun 2019 21:29:48 +0800 Subject: [PATCH 01/16] =?UTF-8?q?=E8=A1=A5=E5=85=85=E4=BA=86=E6=97=A5?= =?UTF-8?q?=E5=BF=97=E4=B9=9D=E5=AE=AB=E6=A0=BC=E5=9B=BE=E7=89=87=E4=B8=8A?= =?UTF-8?q?=E4=BC=A0=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/Upload/UploadPhoto.vue | 100 +++++++++++++++++++++++ src/views/dashboard/Dashboard.vue | 54 +++++++++--- src/views/sheet/internal/JournalList.vue | 67 ++++++++++++--- 3 files changed, 196 insertions(+), 25 deletions(-) create mode 100644 src/components/Upload/UploadPhoto.vue diff --git a/src/components/Upload/UploadPhoto.vue b/src/components/Upload/UploadPhoto.vue new file mode 100644 index 00000000..82141b45 --- /dev/null +++ b/src/components/Upload/UploadPhoto.vue @@ -0,0 +1,100 @@ + + + \ No newline at end of file diff --git a/src/views/dashboard/Dashboard.vue b/src/views/dashboard/Dashboard.vue index 8e3016ed..add75bf9 100644 --- a/src/views/dashboard/Dashboard.vue +++ b/src/views/dashboard/Dashboard.vue @@ -199,12 +199,27 @@ v-model="journal.content" placeholder="写点什么吧..." /> - - - 保存 + + + + + + + + + + 保存 + 更多选项 @@ -317,7 +332,8 @@ import postApi from '@/api/post' import logApi from '@/api/log' import adminApi from '@/api/admin' import journalApi from '@/api/journal' -import countTo from 'vue-count-to' +import countTo from 'vue-count-to' +import UploadPhoto from '../../components/Upload/UploadPhoto.vue' export default { name: 'Dashboard', mixins: [mixin, mixinDevice], @@ -325,10 +341,12 @@ export default { PageView, AnalysisCard, RecentCommentTab, - countTo + countTo, + UploadPhoto }, data() { - return { + return { + showMoreOptions: false, startVal: 0, logType: logApi.logType, activityLoading: true, @@ -397,7 +415,7 @@ export default { } next() }, - methods: { + methods: { loadOptions() { optionApi.listAll(this.keys).then(response => { this.options = response.data.data @@ -430,7 +448,11 @@ export default { this.$message.success('发表成功!') this.journal = {} }) - }, + }, + handleUploadPhotoWallClick(){ + // 是否显示上传照片墙组件 + this.showMoreOptions = !this.showMoreOptions + }, handleShowLogDrawer() { this.logDrawerVisiable = true this.loadLogs() @@ -457,4 +479,12 @@ export default { } } } - + + + diff --git a/src/views/sheet/internal/JournalList.vue b/src/views/sheet/internal/JournalList.vue index 5bcfa814..717df78e 100644 --- a/src/views/sheet/internal/JournalList.vue +++ b/src/views/sheet/internal/JournalList.vue @@ -138,24 +138,33 @@ > - + + - + /> + + + + + + 更多选项 + @@ -231,12 +240,13 @@ import { mixin, mixinDevice } from '@/utils/mixin.js' import journalApi from '@/api/journal' import journalCommentApi from '@/api/journalComment' import userApi from '@/api/user' - +import UploadPhoto from '@/components/Upload/UploadPhoto.vue' export default { mixins: [mixin, mixinDevice], - components: { JournalCommentTree }, + components: { JournalCommentTree, UploadPhoto }, data() { - return { + return { + showMoreOptions: false, title: '发表', listLoading: false, visible: false, @@ -255,17 +265,38 @@ export default { }, journals: [], comments: [], - journal: {}, + journal: { + id: null, + content: '', + photos: [] + }, + journalPhotos: [], selectComment: null, replyComment: {}, - user: {} + user: {}, } }, created() { this.loadJournals() this.loadUser() }, - methods: { + methods: { + handlerPhotoUploadSuccess(response, file){ + var callData = response.data.data + var photo = { + name: callData.name, + url: callData.path, + thumbnail: callData.thumbPath, + suffix: callData.suffix, + width: callData.width, + height: callData.height + } + this.journalPhotos.push(photo) + }, + handleUploadPhotoWallClick(){ + // 是否显示上传照片墙组件 + this.showMoreOptions = !this.showMoreOptions + }, loadJournals(isSearch) { this.queryParam.page = this.pagination.page - 1 this.queryParam.size = this.pagination.size @@ -329,7 +360,10 @@ export default { this.handleCommentShow(this.journal) }) }, - createOrUpdateJournal() { + createOrUpdateJournal() { + // 给属性填充数据 + this.journal.photos = this.journalPhotos + if (this.journal.id) { journalApi.update(this.journal.id, this.journal).then(response => { this.$message.success('更新成功!') @@ -355,4 +389,11 @@ export default { } } } - + + From 5547b3b8d967b4959d3bd06644372a1910788d05 Mon Sep 17 00:00:00 2001 From: guqing <1484563614@qq.com> Date: Thu, 13 Jun 2019 14:34:50 +0800 Subject: [PATCH 02/16] =?UTF-8?q?=E5=AE=8C=E5=96=84=E6=97=A5=E5=BF=97?= =?UTF-8?q?=E5=9B=BE=E7=89=87=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/Upload/UploadPhoto.vue | 163 ++++++++----- src/views/dashboard/Dashboard.vue | 103 +++++---- src/views/sheet/internal/JournalList.vue | 282 +++++++++++------------ 3 files changed, 301 insertions(+), 247 deletions(-) diff --git a/src/components/Upload/UploadPhoto.vue b/src/components/Upload/UploadPhoto.vue index 82141b45..86bec4ed 100644 --- a/src/components/Upload/UploadPhoto.vue +++ b/src/components/Upload/UploadPhoto.vue @@ -2,19 +2,19 @@
-
- +
+
Upload
- example + example
@@ -22,79 +22,118 @@ import axios from 'axios' import attachmentApi from '@/api/attachment' export default { - data () { + props: { + photoList: { + type: Array, + required: false, + default: function() { + return [] + } + }, + plusPhotoVisible: { + type: Boolean, + required: false, + default: true + } + }, + data() { return { - name: 'file', + name: 'file', previewVisible: false, previewImage: '', fileList: [], - uploadHandler: attachmentApi.upload + uploadHandler: attachmentApi.upload + } + }, + created() { + // 在生命周期开始时调用一次赋值解决watch没有监控到数据的问题 + this.handlerEditPreviewPhoto(this.photoList) + }, + watch: { + photoList(newValue, oldValue) { + this.handlerEditPreviewPhoto(newValue) } }, methods: { - handleCancel () { + handlerEditPreviewPhoto(data) { + // 先清空 + this.fileList = [] + // 编辑日志时回显图片 + if (data !== null && data !== undefined) { + for (var i = 0; i < data.length; i++) { + // 构造合适的对象 + this.fileList.push({ + uid: data[i].id, + name: data[i].name, + status: 'done', + url: data[i].thumbnail + }) + } + } + }, + handleCancel() { this.previewVisible = false }, - handlePreview (file) { + handlePreview(file) { this.previewImage = file.url || file.thumbUrl this.previewVisible = true }, - handleChange ({ fileList }) { + handleChange({ fileList }) { this.fileList = fileList }, - handleUpload(option) { - this.$log.debug('Uploading option', option) - const CancelToken = axios.CancelToken - const source = CancelToken.source() - - const data = new FormData() - data.append(this.name, option.file) - - this.uploadHandler( - data, - progressEvent => { - if (progressEvent.total > 0) { - progressEvent.percent = (progressEvent.loaded / progressEvent.total) * 100 - } - this.$log.debug('Uploading percent: ', progressEvent.percent) - option.onProgress(progressEvent) - }, - source.token, - option.file - ) - .then(response => { - this.$log.debug('Uploaded successfully', response) - option.onSuccess(response, option.file) - this.$emit('success', response, option.file) - }) - .catch(error => { - this.$log.debug('Failed to upload file', error) - option.onError(error, error.response) - this.$emit('failure', error, option.file) - }) - return { - abort: () => { - this.$log.debug('Upload operation aborted by the user') - source.cancel('Upload operation canceled by the user.') - } - } - } - }, + handleUpload(option) { + this.$log.debug('Uploading option', option) + const CancelToken = axios.CancelToken + const source = CancelToken.source() + + const data = new FormData() + data.append(this.name, option.file) + + this.uploadHandler( + data, + progressEvent => { + if (progressEvent.total > 0) { + progressEvent.percent = (progressEvent.loaded / progressEvent.total) * 100 + } + this.$log.debug('Uploading percent: ', progressEvent.percent) + option.onProgress(progressEvent) + }, + source.token, + option.file + ) + .then(response => { + this.$log.debug('Uploaded successfully', response) + option.onSuccess(response, option.file) + this.$emit('success', response, option.file) + }) + .catch(error => { + this.$log.debug('Failed to upload file', error) + option.onError(error, error.response) + this.$emit('failure', error, option.file) + }) + return { + abort: () => { + this.$log.debug('Upload operation aborted by the user') + source.cancel('Upload operation canceled by the user.') + } + } + } + } } \ No newline at end of file +.ant-upload-select-picture-card .ant-upload-text { + margin-top: 8px; + color: #666; +} +.ant-upload-list-picture-card { + /* 将浮动恢复为默认值,避免出现纵向换行情况 */ + float: initial; +} + diff --git a/src/views/dashboard/Dashboard.vue b/src/views/dashboard/Dashboard.vue index add75bf9..2c31458d 100644 --- a/src/views/dashboard/Dashboard.vue +++ b/src/views/dashboard/Dashboard.vue @@ -199,27 +199,27 @@ v-model="journal.content" placeholder="写点什么吧..." /> - - - - - - - - - - 保存 - 更多选项 + + + + + + + + + 保存 + 更多选项 @@ -332,7 +332,7 @@ import postApi from '@/api/post' import logApi from '@/api/log' import adminApi from '@/api/admin' import journalApi from '@/api/journal' -import countTo from 'vue-count-to' +import countTo from 'vue-count-to' import UploadPhoto from '../../components/Upload/UploadPhoto.vue' export default { name: 'Dashboard', @@ -341,12 +341,13 @@ export default { PageView, AnalysisCard, RecentCommentTab, - countTo, - UploadPhoto + countTo, + UploadPhoto }, data() { - return { - showMoreOptions: false, + return { + photoList: [], + showMoreOptions: false, startVal: 0, logType: logApi.logType, activityLoading: true, @@ -357,7 +358,11 @@ export default { postData: [], logData: [], countsData: {}, - journal: {}, + journal: { + content: '', + photos: [] + }, + journalPhotos: [], // 日志图片集合最多九张 logs: [], options: [], keys: ['blog_url'], @@ -415,7 +420,19 @@ export default { } next() }, - methods: { + methods: { + handlerPhotoUploadSuccess(response, file) { + var callData = response.data.data + var photo = { + name: callData.name, + url: callData.path, + thumbnail: callData.thumbPath, + suffix: callData.suffix, + width: callData.width, + height: callData.height + } + this.journalPhotos.push(photo) + }, loadOptions() { optionApi.listAll(this.keys).then(response => { this.options = response.data.data @@ -444,15 +461,20 @@ export default { this.$router.push({ name: 'PostEdit', query: { postId: post.id } }) }, handleCreateJournalClick() { + // 给属性填充数据 + this.journal.photos = this.journalPhotos + journalApi.create(this.journal).then(response => { this.$message.success('发表成功!') this.journal = {} + this.photoList = [] + this.showMoreOptions = false }) - }, - handleUploadPhotoWallClick(){ - // 是否显示上传照片墙组件 - this.showMoreOptions = !this.showMoreOptions - }, + }, + handleUploadPhotoWallClick() { + // 是否显示上传照片墙组件 + this.showMoreOptions = !this.showMoreOptions + }, handleShowLogDrawer() { this.logDrawerVisiable = true this.loadLogs() @@ -479,12 +501,11 @@ export default { } } } - - - diff --git a/src/views/sheet/internal/JournalList.vue b/src/views/sheet/internal/JournalList.vue index 717df78e..fb89bac0 100644 --- a/src/views/sheet/internal/JournalList.vue +++ b/src/views/sheet/internal/JournalList.vue @@ -6,18 +6,12 @@
- + - + - + 公开 @@ -25,32 +19,19 @@ - + - 查询 - 重置 + 查询 + 重置
- 写日志 + 写日志
- +
- + + + + example + + + + + + + {{ item.createTime | moment }} - +
@@ -132,39 +114,36 @@ + + 发布 + - - - - - - - 更多选项 - + + + + + + + + 更多选项 + + + @@ -175,21 +154,11 @@ v-model="selectCommentVisible" > - + @@ -203,23 +172,16 @@ destroyOnClose @close="()=>this.commentVisiable = false" > - + - +

{{ journal.content }}

{{ journal.createTime | moment }}
- + { @@ -360,10 +347,10 @@ export default { this.handleCommentShow(this.journal) }) }, - createOrUpdateJournal() { - // 给属性填充数据 - this.journal.photos = this.journalPhotos - + createOrUpdateJournal() { + // 给属性填充数据 + this.journal.photos = this.journalPhotos + if (this.journal.id) { journalApi.update(this.journal.id, this.journal).then(response => { this.$message.success('更新成功!') @@ -373,6 +360,7 @@ export default { journalApi.create(this.journal).then(response => { this.$message.success('发表成功!') this.loadJournals() + this.photoList = [] }) } this.visible = false @@ -389,11 +377,17 @@ export default { } } } - - From d811428f0a2adc30c72afed529ea381728476304 Mon Sep 17 00:00:00 2001 From: guqing <1484563614@qq.com> Date: Wed, 26 Jun 2019 16:59:20 +0800 Subject: [PATCH 03/16] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E5=AF=B9=E6=96=87?= =?UTF-8?q?=E4=BB=B6=E7=B1=BB=E5=9E=8B=E7=9A=84=E5=88=A4=E6=96=AD=EF=BC=8C?= =?UTF-8?q?=E4=B8=8D=E6=98=AF=E5=9B=BE=E7=89=87=E5=88=99=E4=B8=8D=E6=94=AF?= =?UTF-8?q?=E6=8C=81=E9=A2=84=E8=A7=88?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../components/AttachmentDetailDrawer.vue | 37 +++++++++++++++++-- 1 file changed, 33 insertions(+), 4 deletions(-) diff --git a/src/views/attachment/components/AttachmentDetailDrawer.vue b/src/views/attachment/components/AttachmentDetailDrawer.vue index 9ff754c2..7d9e347c 100644 --- a/src/views/attachment/components/AttachmentDetailDrawer.vue +++ b/src/views/attachment/components/AttachmentDetailDrawer.vue @@ -18,7 +18,8 @@ :paragraph="{rows: 8}" >
- +
此文件不支持预览
+
@@ -74,7 +75,7 @@ 附件大小: - + 图片尺寸: @@ -100,7 +101,7 @@ - + ![{{ attachment.name }}]({{ attachment.path }}) @@ -156,7 +157,10 @@ export default { return { detailLoading: true, editable: false, - photo: {} + photo: {}, + photoPreviewVisible: false, + vedioPreviewVisible: false, + nonsupportPreviewVisible: false } }, model: { @@ -189,6 +193,13 @@ export default { if (newValue) { this.loadSkeleton() } + }, + attachment: function(newValue, oldValue) { + if (newValue) { + var attachment = newValue + var mediaType = attachment.mediaType + this.handleJudgeMediaType(mediaType) + } } }, methods: { @@ -250,6 +261,24 @@ export default { }, onClose() { this.$emit('close', false) + }, + handleJudgeMediaType(mediaType) { + // 判断文件类型 + if(mediaType) { + var prefix = mediaType.split('/')[0] + + if(prefix === 'video' || prefix==='flv') { + this.vedioPreviewVisible = true + this.nonsupportPreviewVisible = false + } else if(prefix === 'image') { + this.photoPreviewVisible = true + this.nonsupportPreviewVisible = false + } else { + this.nonsupportPreviewVisible = true + this.vedioPreviewVisible = false + this.photoPreviewVisible = false + } + } } } } From a8f2d7030e479fc4fe7f01681753405b15e10b85 Mon Sep 17 00:00:00 2001 From: guqing <1484563614@qq.com> Date: Wed, 26 Jun 2019 19:58:08 +0800 Subject: [PATCH 04/16] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E9=99=84=E5=8A=A0?= =?UTF-8?q?=E8=A7=86=E9=A2=91=E9=A2=84=E8=A7=88=E5=8A=9F=E8=83=BD=EF=BC=8C?= =?UTF-8?q?=E5=B9=B6=E5=AF=B9=E4=B8=8D=E6=94=AF=E6=8C=81=E9=A2=84=E8=A7=88?= =?UTF-8?q?=E7=9A=84=E7=BC=A9=E7=95=A5=E5=9B=BE=E5=81=9A=E4=B8=8D=E6=94=AF?= =?UTF-8?q?=E6=8C=81=E5=A4=84=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- package.json | 5 +- src/views/attachment/AttachmentList.vue | 29 ++++++++- .../components/AttachmentDetailDrawer.vue | 60 ++++++++++++++++--- 3 files changed, 82 insertions(+), 12 deletions(-) diff --git a/package.json b/package.json index 1689866e..18eb587f 100644 --- a/package.json +++ b/package.json @@ -21,12 +21,13 @@ "vue": "^2.6.10", "vue-clipboard2": "^0.3.0", "vue-codemirror-lite": "^1.0.4", + "vue-count-to": "^1.0.13", "vue-cropper": "0.4.9", "vue-ls": "^3.2.1", "vue-router": "^3.0.6", + "vue-video-player": "^5.0.2", "vuejs-logger": "^1.5.3", - "vuex": "^3.1.1", - "vue-count-to": "^1.0.13" + "vuex": "^3.1.1" }, "devDependencies": { "@babel/polyfill": "^7.4.4", diff --git a/src/views/attachment/AttachmentList.vue b/src/views/attachment/AttachmentList.vue index 689c85ac..85aa9c2e 100644 --- a/src/views/attachment/AttachmentList.vue +++ b/src/views/attachment/AttachmentList.vue @@ -99,7 +99,8 @@ @click="handleShowDetailDrawer(item)" >
- + 当前格式不支持预览 +
此文件不支持预览
- + + +
@@ -149,18 +154,41 @@ import { mixin, mixinDevice } from '@/utils/mixin.js' import attachmentApi from '@/api/attachment' import photoApi from '@/api/photo' +import 'video.js/dist/video-js.css' +import { videoPlayer } from 'vue-video-player' export default { name: 'AttachmentDetailDrawer', mixins: [mixin, mixinDevice], + components: { + videoPlayer + }, data() { return { detailLoading: true, editable: false, photo: {}, photoPreviewVisible: false, - vedioPreviewVisible: false, - nonsupportPreviewVisible: false + videoPreviewVisible: false, + nonsupportPreviewVisible: false, + playerOptions: { + // videojs options + muted: true, + language: 'zh-CN', + aspectRatio: '16:9', + fluid: true, + controls: true, + loop: false, + muted: false, + playbackRates: [0.7, 1.0, 1.5, 2.0], + sources: [{ + type: "video/mp4", + src: "https://cdn.theguardian.tv/webM/2015/07/20/150716YesMen_synd_768k_vp8.webm" + }], + poster: "/static/images/author.jpg", + width: document.documentElement.clientWidth, + notSupportedMessage: '此视频暂无法播放,请稍后再试' + } } }, model: { @@ -186,6 +214,11 @@ export default { created() { this.loadSkeleton() }, + computed: { + player() { + return this.$refs.videoPlayer.player + } + }, watch: { visiable: function(newValue, oldValue) { this.$log.debug('old value', oldValue) @@ -197,8 +230,7 @@ export default { attachment: function(newValue, oldValue) { if (newValue) { var attachment = newValue - var mediaType = attachment.mediaType - this.handleJudgeMediaType(mediaType) + this.handleJudgeMediaType(attachment) } } }, @@ -262,20 +294,29 @@ export default { onClose() { this.$emit('close', false) }, - handleJudgeMediaType(mediaType) { + handleJudgeMediaType(attachment) { + var mediaType = attachment.mediaType // 判断文件类型 if(mediaType) { var prefix = mediaType.split('/')[0] if(prefix === 'video' || prefix==='flv') { - this.vedioPreviewVisible = true + this.videoPreviewVisible = true + this.photoPreviewVisible = false this.nonsupportPreviewVisible = false + // 设置视频地址 + this.$set(this.playerOptions.sources, 0, { + type: mediaType, + src: attachment.path + }) + console.log(this.playerOptions.sources) } else if(prefix === 'image') { this.photoPreviewVisible = true + this.videoPreviewVisible = false this.nonsupportPreviewVisible = false } else { this.nonsupportPreviewVisible = true - this.vedioPreviewVisible = false + this.videoPreviewVisible = false this.photoPreviewVisible = false } } @@ -288,4 +329,7 @@ export default { .attach-detail-img img { width: 100%; } +.video-player-box { + width: 100%; +} From 6bf343286ce1d1a8dd65f44ca080c5558e5d138f Mon Sep 17 00:00:00 2001 From: guqing <1484563614@qq.com> Date: Wed, 26 Jun 2019 22:44:25 +0800 Subject: [PATCH 05/16] =?UTF-8?q?=E4=BF=AE=E5=A4=8Deslint?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/attachment/AttachmentList.vue | 12 ++--- .../components/AttachmentDetailDrawer.vue | 46 ++++++++++++------- 2 files changed, 36 insertions(+), 22 deletions(-) diff --git a/src/views/attachment/AttachmentList.vue b/src/views/attachment/AttachmentList.vue index 85aa9c2e..3626e3bf 100644 --- a/src/views/attachment/AttachmentList.vue +++ b/src/views/attachment/AttachmentList.vue @@ -247,18 +247,18 @@ export default { handleJudgeMediaType(attachment) { var mediaType = attachment.mediaType // 判断文件类型 - if(mediaType) { + if (mediaType) { var prefix = mediaType.split('/')[0] - - if(prefix === 'image') { + + if (prefix === 'image') { // 是图片 - return true + return true } else { - // 非图片 + // 非图片 return false } } - //没有获取到文件返回false + // 没有获取到文件返回false return false } } diff --git a/src/views/attachment/components/AttachmentDetailDrawer.vue b/src/views/attachment/components/AttachmentDetailDrawer.vue index bcda0731..ba0d8427 100644 --- a/src/views/attachment/components/AttachmentDetailDrawer.vue +++ b/src/views/attachment/components/AttachmentDetailDrawer.vue @@ -20,11 +20,13 @@
此文件不支持预览
- - + +
@@ -179,13 +181,12 @@ export default { fluid: true, controls: true, loop: false, - muted: false, playbackRates: [0.7, 1.0, 1.5, 2.0], sources: [{ - type: "video/mp4", - src: "https://cdn.theguardian.tv/webM/2015/07/20/150716YesMen_synd_768k_vp8.webm" + type: 'video/mp4', + src: 'https://cdn.theguardian.tv/webM/2015/07/20/150716YesMen_synd_768k_vp8.webm' }], - poster: "/static/images/author.jpg", + poster: '/static/images/author.jpg', width: document.documentElement.clientWidth, notSupportedMessage: '此视频暂无法播放,请稍后再试' } @@ -297,10 +298,10 @@ export default { handleJudgeMediaType(attachment) { var mediaType = attachment.mediaType // 判断文件类型 - if(mediaType) { + if (mediaType) { var prefix = mediaType.split('/')[0] - - if(prefix === 'video' || prefix==='flv') { + + if (prefix === 'video' || prefix === 'flv') { this.videoPreviewVisible = true this.photoPreviewVisible = false this.nonsupportPreviewVisible = false @@ -310,10 +311,10 @@ export default { src: attachment.path }) console.log(this.playerOptions.sources) - } else if(prefix === 'image') { - this.photoPreviewVisible = true - this.videoPreviewVisible = false - this.nonsupportPreviewVisible = false + } else if (prefix === 'image') { + this.photoPreviewVisible = true + this.videoPreviewVisible = false + this.nonsupportPreviewVisible = false } else { this.nonsupportPreviewVisible = true this.videoPreviewVisible = false @@ -321,6 +322,19 @@ export default { } } } + // handleDownLoadPhoto(attachment) { + // var path = attachment.path + + // var index = path.lastIndexOf('/') + // var filename = path.substr(index+1, path.length) + // // chrome/firefox + // var aTag = document.createElement('a') + // aTag.download = filename + // aTag.href = path//URL.createObjectURL(blob) + // aTag.target = '_blank' + // aTag.click() + // URL.revokeObjectURL(aTag.href) + // } } } From 11b9e2c119150f06d50ca28d542cbe9b6565feab Mon Sep 17 00:00:00 2001 From: ruibaby Date: Sun, 30 Jun 2019 13:00:29 +0800 Subject: [PATCH 06/16] Encode when copy attachment url. --- src/views/attachment/components/AttachmentDetailDrawer.vue | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/views/attachment/components/AttachmentDetailDrawer.vue b/src/views/attachment/components/AttachmentDetailDrawer.vue index ba0d8427..4495ce7b 100644 --- a/src/views/attachment/components/AttachmentDetailDrawer.vue +++ b/src/views/attachment/components/AttachmentDetailDrawer.vue @@ -260,7 +260,7 @@ export default { this.editable = false }, handleCopyNormalLink() { - const text = `${this.attachment.path}` + const text = `${encodeURI(this.attachment.path)}` this.$copyText(text) .then(message => { console.log('copy', message) @@ -272,7 +272,7 @@ export default { }) }, handleCopyMarkdownLink() { - const text = `![${this.attachment.name}](${this.attachment.path})` + const text = `![${this.attachment.name}](${encodeURI(this.attachment.path)})` this.$copyText(text) .then(message => { console.log('copy', message) From 24ebf4199d64e211a02ddc2ea765a777b7e2e34d Mon Sep 17 00:00:00 2001 From: ruibaby Date: Sun, 30 Jun 2019 13:36:51 +0800 Subject: [PATCH 07/16] Fixed #28 --- src/views/comment/components/CommentTab.vue | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/views/comment/components/CommentTab.vue b/src/views/comment/components/CommentTab.vue index c7da82f4..584081c1 100644 --- a/src/views/comment/components/CommentTab.vue +++ b/src/views/comment/components/CommentTab.vue @@ -408,7 +408,11 @@ export default { this.selectComment = comment this.replyCommentVisible = true this.replyComment.parentId = comment.id - this.replyComment.postId = comment.post.id + if (this.type === 'posts') { + this.replyComment.postId = comment.post.id + } else { + this.replyComment.postId = comment.sheet.id + } }, handleCreateClick() { commentApi.create(this.type, this.replyComment).then(response => { From ed5af4484059b9f01313410a301b04eeb717a417 Mon Sep 17 00:00:00 2001 From: ruibaby Date: Sun, 30 Jun 2019 23:33:34 +0800 Subject: [PATCH 08/16] Support select gravatar. --- .../components/AttachmentSelectDrawer.vue | 16 +++++++++++++++- src/views/user/Profile.vue | 7 +++++++ 2 files changed, 22 insertions(+), 1 deletion(-) diff --git a/src/views/attachment/components/AttachmentSelectDrawer.vue b/src/views/attachment/components/AttachmentSelectDrawer.vue index 8bddba89..e31f2079 100644 --- a/src/views/attachment/components/AttachmentSelectDrawer.vue +++ b/src/views/attachment/components/AttachmentSelectDrawer.vue @@ -47,8 +47,14 @@ @change="handlePaginationChange" >
- +
+ 使用 Gravatar
@@ -149,6 +151,7 @@ import userApi from '@/api/user' import adminApi from '@/api/admin' import optionApi from '@/api/option' import { mapMutations } from 'vuex' +import MD5 from 'md5.js' export default { components: { @@ -217,6 +220,10 @@ export default { handleSelectAvatar(data) { this.user.avatar = data.path this.attachmentDrawerVisible = false + }, + handleSelectGravatar() { + this.user.avatar = '//cn.gravatar.com/avatar/' + new MD5().update(this.user.email).digest('hex') + '&d=mm' + this.attachmentDrawerVisible = false } } } From 682b2bb61134576191d626e2e68147b053a73cbd Mon Sep 17 00:00:00 2001 From: johnniang Date: Mon, 1 Jul 2019 01:03:17 +0800 Subject: [PATCH 09/16] Fix comment tab bug --- src/views/comment/components/CommentTab.vue | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/views/comment/components/CommentTab.vue b/src/views/comment/components/CommentTab.vue index 584081c1..62cc0c4d 100644 --- a/src/views/comment/components/CommentTab.vue +++ b/src/views/comment/components/CommentTab.vue @@ -127,7 +127,7 @@ target="_blank" >{{ post.title }} Date: Tue, 2 Jul 2019 22:26:36 +0800 Subject: [PATCH 10/16] Support post settings in post list table. --- src/components/global.less | 11 ++ src/views/interface/ThemeList.vue | 2 - src/views/post/PostEdit.vue | 19 --- src/views/post/PostList.vue | 229 +++++++++++++++++++++++++++++- 4 files changed, 237 insertions(+), 24 deletions(-) diff --git a/src/components/global.less b/src/components/global.less index 1e33d699..929a6ab8 100644 --- a/src/components/global.less +++ b/src/components/global.less @@ -697,4 +697,15 @@ body { p{ margin-bottom: 0; } +} + +.post-thum { + .img { + width: 100%; + cursor: pointer; + border-radius: 4px; + } + .post-thum-remove { + margin-top: 16px; + } } \ No newline at end of file diff --git a/src/views/interface/ThemeList.vue b/src/views/interface/ThemeList.vue index 41df9b6f..d27d4542 100644 --- a/src/views/interface/ThemeList.vue +++ b/src/views/interface/ThemeList.vue @@ -427,9 +427,7 @@ export default { this.themeConfiguration = response.data.data themeApi.fetchSettings(theme.id).then(response => { this.themeSettings = response.data.data - setTimeout(() => { - this.visible = true this.optionLoading = false }, 300) }) diff --git a/src/views/post/PostEdit.vue b/src/views/post/PostEdit.vue index 3eeb5559..baed7cf0 100644 --- a/src/views/post/PostEdit.vue +++ b/src/views/post/PostEdit.vue @@ -199,7 +199,6 @@ import FooterToolBar from '@/components/FooterToolbar' import { mixin, mixinDevice } from '@/utils/mixin.js' import { toolbars } from '@/core/const' import 'mavon-editor/dist/css/index.css' -import tagApi from '@/api/tag' import categoryApi from '@/api/category' import postApi from '@/api/post' import optionApi from '@/api/option' @@ -226,7 +225,6 @@ export default { postSettingVisible: false, thumDrawerVisible: false, categoryForm: false, - tags: [], categories: [], selectedCategoryIds: [], selectedTagIds: [], @@ -238,7 +236,6 @@ export default { } }, created() { - this.loadTags() this.loadCategories() this.loadOptions() clearInterval(this.timer) @@ -273,11 +270,6 @@ export default { }) }, methods: { - loadTags() { - tagApi.listAll(true).then(response => { - this.tags = response.data.data - }) - }, loadCategories() { categoryApi.listAll().then(response => { this.categories = response.data.data @@ -365,15 +357,4 @@ export default { z-index: 1000; min-height: 580px; } - -.post-thum { - .img { - width: 100%; - cursor: pointer; - border-radius: 4px; - } - .post-thum-remove { - margin-top: 16px; - } -} diff --git a/src/views/post/PostList.vue b/src/views/post/PostList.vue index c838e910..b12ba513 100644 --- a/src/views/post/PostList.vue +++ b/src/views/post/PostList.vue @@ -209,6 +209,13 @@ > 删除 + + + + 设置
@@ -223,12 +230,165 @@
+ + +
+
+

基本设置

+
+ + + + + + + + + + 开启 + 关闭 + + + +
+
+ + +
+

分类目录

+
+ +
+ + + + + + + + + + + + 保存 + 新增 + 取消 + + +
+
+
+ + +
+

标签

+
+ + + + + +
+
+ + +
+

摘要

+
+ + + + + +
+
+ + +
+

缩略图

+
+
+ + 移除 +
+
+
+ +
+ +
+ 保存 +
+
+ From 4b441e5b87e740a8b79da250cb1c28bc3ccd9d6f Mon Sep 17 00:00:00 2001 From: guqing <1484563614@qq.com> Date: Wed, 3 Jul 2019 17:23:32 +0800 Subject: [PATCH 12/16] =?UTF-8?q?=E8=87=AA=E5=AE=9A=E4=B9=89=E9=A1=B5?= =?UTF-8?q?=E9=9D=A2=E6=96=B0=E5=A2=9E=E7=82=B9=E5=87=BB=E6=A0=87=E9=A2=98?= =?UTF-8?q?=E9=A2=84=E8=A7=88=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/dashboard/Dashboard.vue | 3 +++ src/views/post/PostList.vue | 2 +- src/views/sheet/SheetList.vue | 29 +++++++++++++++++++++++++++-- 3 files changed, 31 insertions(+), 3 deletions(-) diff --git a/src/views/dashboard/Dashboard.vue b/src/views/dashboard/Dashboard.vue index 2c31458d..9db4d6bf 100644 --- a/src/views/dashboard/Dashboard.vue +++ b/src/views/dashboard/Dashboard.vue @@ -508,4 +508,7 @@ export default { margin-left: 15px; text-decoration: none; } + a { + text-decoration: none; + } diff --git a/src/views/post/PostList.vue b/src/views/post/PostList.vue index d7003fd4..ad266199 100644 --- a/src/views/post/PostList.vue +++ b/src/views/post/PostList.vue @@ -659,7 +659,7 @@ a { text-decoration: none; } .post-title { - width: 100px; + max-width: 100px; display: block; white-space: nowrap; overflow: hidden; diff --git a/src/views/sheet/SheetList.vue b/src/views/sheet/SheetList.vue index c858c5c7..39e89684 100644 --- a/src/views/sheet/SheetList.vue +++ b/src/views/sheet/SheetList.vue @@ -96,6 +96,18 @@ :dataSource="formattedSheets" :pagination="false" > + + + {{ text }} + + {{ statusProperty.text }} - + + From e3611a36b205de27b639dfd114e8d007a1fe437a Mon Sep 17 00:00:00 2001 From: ruibaby Date: Sat, 6 Jul 2019 13:16:13 +0800 Subject: [PATCH 13/16] JSLint. --- src/views/post/PostList.vue | 3 ++- src/views/sheet/SheetList.vue | 1 - 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/views/post/PostList.vue b/src/views/post/PostList.vue index ad266199..c9fdfc87 100644 --- a/src/views/post/PostList.vue +++ b/src/views/post/PostList.vue @@ -408,6 +408,7 @@ const columns = [ { title: '标题', dataIndex: 'title', + width: '150px', scopedSlots: { customRender: 'postTitle' } }, { @@ -659,7 +660,7 @@ a { text-decoration: none; } .post-title { - max-width: 100px; + max-width: 150px; display: block; white-space: nowrap; overflow: hidden; diff --git a/src/views/sheet/SheetList.vue b/src/views/sheet/SheetList.vue index 39e89684..4c33157b 100644 --- a/src/views/sheet/SheetList.vue +++ b/src/views/sheet/SheetList.vue @@ -300,4 +300,3 @@ a{ text-overflow: ellipsis; } - From 5cf946a1429b40dbe070e23222925c08866ed5ff Mon Sep 17 00:00:00 2001 From: guqing <1484563614@qq.com> Date: Sun, 7 Jul 2019 21:27:50 +0800 Subject: [PATCH 14/16] =?UTF-8?q?=E8=A7=A3=E5=86=B3=E6=96=87=E7=AB=A0?= =?UTF-8?q?=E7=BC=96=E8=BE=91=E6=97=B6tag=E5=9B=9E=E6=98=BE=E9=97=AE?= =?UTF-8?q?=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/post/components/TagSelect.vue | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/views/post/components/TagSelect.vue b/src/views/post/components/TagSelect.vue index 245f80c3..c960710b 100644 --- a/src/views/post/components/TagSelect.vue +++ b/src/views/post/components/TagSelect.vue @@ -42,7 +42,14 @@ export default { }, created() { this.loadTags() - this.selectedTagNames = this.tagIds.map(tagId => this.tagIdMap[tagId].name) + }, + watch: { + tags(newValue, oldValue) { + // 解决tags未赋上值就使用导致的取值报错问题 + if (newValue) { + this.selectedTagNames = this.tagIds.map(tagId => this.tagIdMap[tagId].name) + } + } }, computed: { tagIdMap() { From 26af12cb82071609186c6a272d0be8aef892f696 Mon Sep 17 00:00:00 2001 From: ruibaby Date: Tue, 9 Jul 2019 21:10:33 +0800 Subject: [PATCH 15/16] released 1.0.3 --- package-lock.json | 2 +- package.json | 2 +- src/views/system/About.vue | 14 ++++++++++++++ 3 files changed, 16 insertions(+), 2 deletions(-) diff --git a/package-lock.json b/package-lock.json index 0ca2d5ad..547348a0 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "halo-admin", - "version": "1.0.2", + "version": "1.0.3", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/package.json b/package.json index 18eb587f..0d1f9621 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "halo-admin", - "version": "1.0.2", + "version": "1.0.3", "private": true, "scripts": { "serve": "vue-cli-service serve", diff --git a/src/views/system/About.vue b/src/views/system/About.vue index 0e3f7a94..8862c8af 100644 --- a/src/views/system/About.vue +++ b/src/views/system/About.vue @@ -136,9 +136,23 @@ export default { avatar: '//cn.gravatar.com/avatar/08cf681fb7c6ad1b4fe70a8269c2103c?s=256&d=mm', website: 'https://www.apkdv.com', github: 'https://github.com/appdev' + }, + { + name: 'guqing', + avatar: '//cn.gravatar.com/avatar/ad062ba572c8b006bfd2cbfc43fdee5e?s=256&d=mm', + website: 'http://www.guqing.xyz', + github: 'https://github.com/guqing' } ], steps: [ + { + date: '2019-07-09', + content: 'Halo v1.0.3 发布' + }, + { + date: '2019-07-08', + content: 'Star 数达到 6500' + }, { date: '2019-06-01', content: '1.0 正式版发布' From 1f48b8f9d4dfa01d2bc3b27041c667a0c9190c65 Mon Sep 17 00:00:00 2001 From: ruibaby Date: Tue, 9 Jul 2019 21:23:06 +0800 Subject: [PATCH 16/16] released 1.0.3 --- src/views/dashboard/Dashboard.vue | 8 ++++---- src/views/sheet/internal/JournalList.vue | 8 ++++---- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/views/dashboard/Dashboard.vue b/src/views/dashboard/Dashboard.vue index 9db4d6bf..bb1de14c 100644 --- a/src/views/dashboard/Dashboard.vue +++ b/src/views/dashboard/Dashboard.vue @@ -202,24 +202,24 @@ - + 保存 - 更多选项 + >更多选项 --> diff --git a/src/views/sheet/internal/JournalList.vue b/src/views/sheet/internal/JournalList.vue index fb89bac0..3e69ca6b 100644 --- a/src/views/sheet/internal/JournalList.vue +++ b/src/views/sheet/internal/JournalList.vue @@ -41,7 +41,7 @@ > - example - + --> - +