From 272eadbaedabcec8a18a26c7c3add405b34a1934 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=A5=9D=E6=A2=A6=E5=9B=AD?= Date: Thu, 5 Jan 2023 17:16:49 +0800 Subject: [PATCH] =?UTF-8?q?refactor(projects):=20=E9=87=8D=E6=9E=84?= =?UTF-8?q?=E5=88=9B=E5=BB=BA/=E4=BF=AE=E6=94=B9=E4=BD=9C=E5=93=81?= =?UTF-8?q?=E9=9B=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- config/api.config.js | 2 +- nuxt.config.js | 2 +- pages/portfolio/post/_portfolio_id.vue | 83 +++++++++++++------------- 3 files changed, 45 insertions(+), 42 deletions(-) diff --git a/config/api.config.js b/config/api.config.js index 85c6e65..21dec96 100644 --- a/config/api.config.js +++ b/config/api.config.js @@ -3,7 +3,7 @@ import {NODE_ENV} from '../environment' const apisMap = { development: { FE: 'http://localhost:3000', - BASE: 'http://localhost:8099/forest', + BASE: 'https://test.rymcu.com', CDN: '', PROXY: '/proxy', SOCKET: 'http://localhost:3000/ws', diff --git a/nuxt.config.js b/nuxt.config.js index 44f13f8..0009c0b 100644 --- a/nuxt.config.js +++ b/nuxt.config.js @@ -114,7 +114,7 @@ export default { proxy: [ //proxy配置 ['/api', { target: apiConfig.BASE, //api请求路径 - pathRewrite: {'^/api': isDevMode ? '/api/v1' : '/api'} //重定向请求路径,防止路由、api路径的冲突 + pathRewrite: {'^/api': isDevMode ? '/api' : '/api'} //重定向请求路径,防止路由、api路径的冲突 }], ['/ws', { target: apiConfig.BASE //api请求路径 diff --git a/pages/portfolio/post/_portfolio_id.vue b/pages/portfolio/post/_portfolio_id.vue index 2a41d76..ec719e2 100644 --- a/pages/portfolio/post/_portfolio_id.vue +++ b/pages/portfolio/post/_portfolio_id.vue @@ -9,15 +9,15 @@ - +

创建作品集

作品集需要有明确的写作方向,如果您在某个领域有深度的研究,欢迎创建自己的作品集分享自己的观点

- - + + - +
@@ -27,10 +27,8 @@
-
-

{{ portfolio.portfolioTitle }}

- +
{{ portfolio.portfolioDescription }} - +
上传 + 重置 + + 裁剪
- 重置 - - 裁剪 +

* 上传图片调整至最佳效果后,请点击裁剪按钮截取

- -
- -
@@ -143,14 +137,14 @@ export default { idPortfolio: 0, portfolioDescription: '' }, - rules: { - portfolioTitle: [ - {required: true, message: '请输入作品集名称', trigger: 'blur'} - ], - portfolioDescription: [ - {required: true, message: '请输入作品集介绍', trigger: 'blur'} - ] - }, + // rules: { + // portfolioTitle: [ + // {required: true, message: '请输入作品集名称', trigger: 'blur'} + // ], + // portfolioDescription: [ + // {required: true, message: '请输入作品集介绍', trigger: 'blur'} + // ] + // }, loading: false, tokenURL: { URL: '', @@ -162,16 +156,13 @@ export default { isEdit: false, autoCrop: true, notificationFlag: true + , contentHtml: {} } }, methods: { - // 覆盖默认的上传行为 - requestUpload(e) { - console.log('e', e) - }, _initEditor(data) { + //初始化 let _ts = this; - let toolbar = [ 'emoji', 'headings', @@ -221,7 +212,12 @@ export default { }, after() { _ts.contentEditor.setValue(data.value ? data.value : ''); + }, + input: (val) => { + this.portfolio.portfolioDescription = val + }, + typewriterMode: true, hint: { emoji: Vue.emoji }, @@ -237,7 +233,7 @@ export default { /*url: `${process.env.Server}/api/console/markdown`,*/ parse: (element) => { if (element.style.display === 'none') { - return + return false } // LazyLoadImage(); // Vue.Vditor.highlightRender({style: 'github'}, element, this.contentEditor); @@ -252,7 +248,7 @@ export default { enable: data.resize, }, lang: this.$store.state.locale, - placeholder: data.placeholder, + // placeholder: data.placeholder, }) }, // handleAvatarSuccess(res) { @@ -285,7 +281,6 @@ export default { // this.$set(_ts, 'headImgUrl', res.data.url); }, fileToBase64(file) { - console.log('我执行了?') let _ts = this; let reader = new FileReader(); reader.readAsDataURL(file); @@ -316,8 +311,6 @@ export default { this.$message.error('请输入必填信息'); return false } - - let title = id ? '更新' : '添加'; _ts.$axios[id ? '$put' : '$post']('/api/portfolio/post', data).then(function (res) { if (res && res.message) { @@ -429,15 +422,19 @@ export default { } }); - this.portfolioContent = ''; + let portfolioContent = ''; if (_ts.idPortfolio) { - _ts.$set(_ts, 'isEdit', true); + this.isEdit = true + // _ts.$set(_ts, 'isEdit', true); _ts.$set(_ts, 'portfolio', JSON.parse(JSON.stringify(_ts.portfolioDetail))); _ts.$set(_ts, 'headImgUrl', _ts.portfolioDetail.headImgUrl); - _ts.$refs.cropper.replace(_ts.portfolioDetail.headImgUrl); - portfolioContent = _ts.portfolioDetail.portfolioDescription; + if (!this.isEdit) { + _ts.$refs?.cropper.replace(_ts.portfolioDetail.headImgUrl); + portfolioContent = _ts.portfolioDetail.portfolioDescription; + } + } else { - _ts.$set(_ts, 'isEdit', false); + this.isEdit = false } this.contentEditor = this._initEditor({ @@ -446,7 +443,7 @@ export default { height: 480, placeholder: '', //this.$t('inputContent', this.$store.state.locale) resize: false, - value: this.portfolioContent + value: this.portfolio.portfolioDescription }); } } @@ -495,4 +492,10 @@ export default { background-color: #ffffff; overflow: hidden; } + +.portfolioDescription { + min-height: 50px; + font-size: 12px; + color: #909399; +}