diff --git a/assets/weixinStore.jpg b/assets/weixinStore.jpg new file mode 100644 index 0000000..e69de29 diff --git a/pages/admin.vue b/pages/admin.vue index 28a483c..6d28652 100644 --- a/pages/admin.vue +++ b/pages/admin.vue @@ -10,6 +10,14 @@ Dashboard + + + 文章管理 + + + + 评论管理 + 用户管理 diff --git a/pages/admin/articles.vue b/pages/admin/articles.vue new file mode 100644 index 0000000..bce0196 --- /dev/null +++ b/pages/admin/articles.vue @@ -0,0 +1,213 @@ + + + + + 首页 + 文章管理 + + + + + + + + + + + + + {{ scope.row.articleTitle }} + + + + + + # {{ tag.tagTitle }} + + + + + + + + + + 取消优选 + 设为优选 + 编辑标签 + + 下架 + + 上架 + + + + + + + + + + + + + + + + + + + + + diff --git a/pages/admin/comments.vue b/pages/admin/comments.vue new file mode 100644 index 0000000..079b805 --- /dev/null +++ b/pages/admin/comments.vue @@ -0,0 +1,164 @@ + + + + + 首页 + 评论管理 + + + + + + + + + + + + + + + + + + {{ comment.commenter.userNickname }} + + 回复了 {{comment.commentOriginalAuthorNickname}} + + + 查看原评论 + + + + + {{ comment.commenter.userNickname }} + + + + + + + + + + + {{ comment.timeAgo }} + + + + + + + {{comment.commentOriginalAuthorNickname}} : + + + + + + + + + + + + + + + + + + diff --git a/pages/admin/topic/post/_topic_id.vue b/pages/admin/topic/post/_topic_id.vue index 696102f..c59235b 100644 --- a/pages/admin/topic/post/_topic_id.vue +++ b/pages/admin/topic/post/_topic_id.vue @@ -21,18 +21,64 @@ - - - - + + + + + + + + + + + + + + + + + {{ topic.topicTitle }} + + + + {{ topic.topicDescription }} + + + + + + + + + + + 上传 + + + 重置 + 裁剪 + + * + 上传图片调整至最佳效果后,请点击裁剪按钮截取 + + + import Vue from 'vue'; +import {mapState} from 'vuex'; +import VueCropper from 'vue-cropperjs'; +import 'cropperjs/dist/cropper.css'; export default { name: "adminTopicPost", + components: { + VueCropper + }, computed: { - uploadHeaders() { - let token = this.$store.getters.uploadHeaders; - return {'X-Upload-Token': token} - } + ...mapState({ + uploadHeaders: state => { + return {'X-Upload-Token': state.uploadHeaders} + } + }) }, data() { return { @@ -107,6 +160,7 @@ export default { }, topicIconPath: '', isEdit: false, + autoCrop: true, notificationFlag: true } }, @@ -114,44 +168,44 @@ export default { _initEditor(data) { let _ts = this; - let toolbar = [ - 'emoji', - 'headings', - 'bold', - 'italic', - 'strike', - 'link', - '|', - 'list', - 'ordered-list', - 'check', - 'outdent', - 'indent', - '|', - 'quote', - 'line', - 'code', - 'inline-code', - 'insert-before', - 'insert-after', - '|', - 'upload', - // 'record', - 'table', - '|', - 'undo', - 'redo', - '|', - 'edit-mode', - { - name: 'more', - toolbar: [ - 'fullscreen', - 'both', - 'preview', - 'info' - ], - }] + let toolbar = [ + 'emoji', + 'headings', + 'bold', + 'italic', + 'strike', + 'link', + '|', + 'list', + 'ordered-list', + 'check', + 'outdent', + 'indent', + '|', + 'quote', + 'line', + 'code', + 'inline-code', + 'insert-before', + 'insert-after', + '|', + 'upload', + // 'record', + 'table', + '|', + 'undo', + 'redo', + '|', + 'edit-mode', + { + name: 'more', + toolbar: [ + 'fullscreen', + 'both', + 'preview', + 'info' + ], + }] return new Vue.Vditor(data.id, { toolbar, mode: 'sv', @@ -191,9 +245,7 @@ export default { url: this.tokenURL.URL, linkToImgUrl: this.tokenURL.linkToImageURL, token: this.tokenURL.token, - filename: name => name.replace(/[^(a-zA-Z0-9\u4e00-\u9fa5\.)]/g, ''). - replace(/[\?\\/:|<>\*\[\]\(\)\$%\{\}@~]/g, ''). - replace('/\\s/g', '') + filename: name => name.replace(/[^(a-zA-Z0-9\u4e00-\u9fa5\.)]/g, '').replace(/[\?\\/:|<>\*\[\]\(\)\$%\{\}@~]/g, '').replace('/\\s/g', '') }, height: data.height, counter: 102400, @@ -222,11 +274,24 @@ export default { if (!(isJPG || isPNG)) { this.$message.error('上传图标只能是 JPG 或者 PNG 格式!'); + return false; } if (!isLt2M) { this.$message.error('上传图标大小不能超过 2MB!'); + return false; + } + + this.fileToBase64(file); + return false; + }, + fileToBase64(file) { + let _ts = this; + let reader = new FileReader(); + reader.readAsDataURL(file); + reader.onload = function () { + _ts.$set(_ts, 'topicIconPath', this.result); + _ts.$refs.cropper.replace(this.result); } - return (isJPG || isPNG) && isLt2M; }, async updateTopic() { let _ts = this; @@ -254,6 +319,24 @@ export default { }) } }) + }, + reset() { + this.$refs.cropper.reset(); + }, + // get image data for post processing, e.g. upload or setting image src + cropImage() { + let _ts = this; + try { + _ts.cropImg = _ts.$refs.cropper.getCroppedCanvas().toDataURL(); + let topic = _ts.topic; + topic.topicIconPath = _ts.cropImg; + _ts.$set(_ts, 'topic', topic); + _ts.$set(_ts, 'topicIconPath', _ts.cropImg); + _ts.$message.success('已裁剪 !'); + } catch (e) { + _ts.$message.error('图片获取失败 !'); + return; + } } }, beforeRouteLeave(to, from, next) { @@ -306,7 +389,7 @@ export default { const responseData = await _ts.$axios.$get('/api/admin/topic/detail/' + _ts.$route.params.topic_id); _ts.$set(_ts, 'topic', responseData); if (responseData.topicIconPath) { - _ts.$set(_ts,'topicIconPath',responseData.topicIconPath); + _ts.$set(_ts, 'topicIconPath', responseData.topicIconPath); } } else { _ts.$set(_ts, 'isEdit', false); @@ -329,5 +412,41 @@ export default { diff --git a/pages/portfolio/post/_portfolio_id.vue b/pages/portfolio/post/_portfolio_id.vue index 9cdc3d0..7ebed25 100644 --- a/pages/portfolio/post/_portfolio_id.vue +++ b/pages/portfolio/post/_portfolio_id.vue @@ -97,7 +97,6 @@
+ {{comment.commentOriginalAuthorNickname}} : +