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 { } } } - + +