From 63288736d45ca5f38698df1b2a66edf7e226abc1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=A5=9D=E6=A2=A6=E5=9B=AD?= Date: Sun, 18 Feb 2024 10:57:49 +0800 Subject: [PATCH 01/12] =?UTF-8?q?=E4=B8=93=E9=A2=98=E9=A1=B5=E9=9D=A2nav?= =?UTF-8?q?=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- components/common/topic/main.vue | 58 +- nuxt.config.js | 2 +- package-lock.json | 31738 +++++++++++++++++++++++++++++ pages/admin/topics.vue | 48 +- yarn.lock | 10300 ++++++++++ 5 files changed, 42092 insertions(+), 54 deletions(-) create mode 100644 package-lock.json create mode 100644 yarn.lock diff --git a/components/common/topic/main.vue b/components/common/topic/main.vue index e0cf6d3..8ab9b7e 100644 --- a/components/common/topic/main.vue +++ b/components/common/topic/main.vue @@ -1,41 +1,45 @@ diff --git a/pages/admin.vue b/pages/admin.vue index 9149f82..d5bd9a0 100644 --- a/pages/admin.vue +++ b/pages/admin.vue @@ -15,18 +15,26 @@ - - + + + + + + + + + + - - + + + diff --git a/pages/admin/topic/_topic_uri.vue b/pages/admin/topic/_topic_uri.vue index 64e1356..3bcb61a 100644 --- a/pages/admin/topic/_topic_uri.vue +++ b/pages/admin/topic/_topic_uri.vue @@ -107,6 +107,7 @@ export default { }) }, handleCommand(command) { + console.log(command) let _ts = this; if ("admin-post-topic" === command) { _ts.$router.push({ @@ -142,7 +143,9 @@ export default { }).catch(() => { }); } - } + }, + + } diff --git a/pages/admin/topic/post/_topic_id.vue b/pages/admin/topic/post/_topic_id.vue index e11f6ed..7a3a1ac 100644 --- a/pages/admin/topic/post/_topic_id.vue +++ b/pages/admin/topic/post/_topic_id.vue @@ -23,17 +23,24 @@ - + + + + + + + + + + + + {{topicIconPath}} + @@ -41,6 +48,7 @@
+ diff --git a/pages/user/settings/account.vue b/pages/user/settings/account.vue index 9872f3f..6db53fd 100644 --- a/pages/user/settings/account.vue +++ b/pages/user/settings/account.vue @@ -1,157 +1,181 @@ From b1322f090d1a064f76f87c021bc44e2d432892c0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=A5=9D=E6=A2=A6=E5=9B=AD?= Date: Tue, 20 Feb 2024 14:03:01 +0800 Subject: [PATCH 06/12] =?UTF-8?q?=E7=B3=BB=E7=BB=9F=E7=AE=A1=E7=90=86-?= =?UTF-8?q?=E4=B8=93=E9=A2=98=E7=AE=A1=E7=90=86-=E7=BC=96=E8=BE=91?= =?UTF-8?q?=E9=A1=B5=E9=9D=A2=E5=9B=BE=E7=89=87=E8=A3=81=E5=89=AA=E4=B8=8A?= =?UTF-8?q?=E4=BC=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- components/ImgCropper.vue | 1 + pages/admin/topic/_topic_uri.vue | 6 +- pages/admin/topic/post/_topic_id.vue | 169 ++++++++++----------------- pages/admin/topics.vue | 17 ++- pages/user/settings/account.vue | 3 +- 5 files changed, 75 insertions(+), 121 deletions(-) diff --git a/components/ImgCropper.vue b/components/ImgCropper.vue index b127bcd..92854fb 100644 --- a/components/ImgCropper.vue +++ b/components/ImgCropper.vue @@ -75,6 +75,7 @@ export default { methods: { onSubmit() { this.$refs.cropper.getCropData(data => { + console.log(data) this.$emit('onSubmit',data) }); diff --git a/pages/admin/topic/_topic_uri.vue b/pages/admin/topic/_topic_uri.vue index 3bcb61a..99d419f 100644 --- a/pages/admin/topic/_topic_uri.vue +++ b/pages/admin/topic/_topic_uri.vue @@ -12,7 +12,7 @@ - + {{ topic.topicTitle }} {{ topic.topicTagCount }} 引用 @@ -28,9 +28,9 @@ -

{{ topic.topicDescription }}

+
-
+
diff --git a/pages/admin/topic/post/_topic_id.vue b/pages/admin/topic/post/_topic_id.vue index 7a3a1ac..673054f 100644 --- a/pages/admin/topic/post/_topic_id.vue +++ b/pages/admin/topic/post/_topic_id.vue @@ -23,71 +23,38 @@ - - - - - - - - - - - - {{topicIconPath}} - - - - - -
- -
- - - - - - - -

{{ topic.topicTitle }}

-
-
- -
{{ topic.topicDescription }}
-
-
-
-
- -
- - - -
- 上传 -
-
- 重置 - 裁剪 - - * - 上传图片调整至最佳效果后,请点击裁剪按钮截取 - +
+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + - -
-
+ 提交 + + @@ -128,12 +95,13 @@ import Vue from 'vue'; import {mapState} from 'vuex'; import VueCropper from 'vue-cropper'; import apiConfig from '~/config/api.config'; +import ImgCropper from "~/components/ImgCropper.vue"; export default { name: "adminTopicPost", middleware: 'auth', components: { - VueCropper + VueCropper, ImgCropper }, computed: { ...mapState({ @@ -170,13 +138,31 @@ export default { topicIconPath: '', isEdit: false, autoCrop: true, - notificationFlag: true + notificationFlag: true, + cropperVisible: false, + contentEditor:{} + } }, methods: { + blurData(){ + + console.log(this.contentEditor) + if(this.contentEditor!={}){ + console.log(this.contentEditor.getValue()) + + this.topic.topicDescription=this.contentEditor.getValue(); + } + + }, + updateUser(data) { + this.topic.topicIconPath = data + this.topicIconPath = data + this.cropperVisible = false + + }, _initEditor(data) { let _ts = this; - let toolbar = [ 'emoji', 'headings', @@ -265,43 +251,6 @@ export default { placeholder: data.placeholder, }) }, - handleAvatarSuccess(res) { - let _ts = this; - if (res && res.data && res.data.url) { - let topic = _ts.topic; - topic.topicIconPath = res.data.url; - _ts.$set(_ts, 'topic', topic); - _ts.$set(_ts, 'topicIconPath', res.data.url); - } else { - _ts.$message.error('上传失败!'); - } - }, - beforeAvatarUpload(file) { - const isJPG = file.type === 'image/jpeg'; - const isPNG = file.type === 'image/png'; - const isLt2M = file.size / 1024 / 1024 < 2; - - 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); - } - }, async updateTopic() { let _ts = this; _ts.$set(_ts, 'loading', true); @@ -409,12 +358,16 @@ export default { _ts.contentEditor = _ts._initEditor({ id: 'contentEditor', mode: 'both', - height: 480, + height: 300, placeholder: '', //this.$t('inputContent', this.$store.state.locale) resize: false, - value: articleContent + value: articleContent, }); - } + setTimeout(()=>{ + _ts.contentEditor.blur() + }) + }, + } diff --git a/pages/admin/topics.vue b/pages/admin/topics.vue index 8d7631e..c684c60 100644 --- a/pages/admin/topics.vue +++ b/pages/admin/topics.vue @@ -16,24 +16,23 @@
- - + + - + - {{ topic.topicTitle }} + {{ topic.topicTitle }}
{{ topic.topicDescription }}
- -
-
+
+