From c4a23be60c90e4067632e95af119cc5d897e73bd Mon Sep 17 00:00:00 2001
From: sx <2427911852@qq.com>
Date: Fri, 21 Feb 2025 10:03:50 +0800
Subject: [PATCH] =?UTF-8?q?2025.02.20=20=E5=B7=A5=E4=BD=9C=E4=BB=A3?=
=?UTF-8?q?=E7=A0=81=E6=8F=90=E4=BA=A4?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
jiuyi2/common/js/config.js | 1 -
jiuyi2/common/js/util.js | 10 ++--
jiuyi2/components/public/editor/editor.vue | 45 +++++++++++++---
jiuyi2/manifest.json | 4 +-
jiuyi2/pages/login/freezeAccount.vue | 2 +-
jiuyi2/pages/login/unfreezeAccount.vue | 2 +-
jiuyi2/pages/mine/setting/safeCenter.vue | 2 +-
jiuyi2/pages/mine/setting/usePay.vue | 1 -
jiuyi2/pages/mine/switch-accounts/index.vue | 1 -
jiuyi2/pages/release/commodity.vue | 57 +++++++++++++++++++--
jiuyi2/pages/shop/commodity/index.vue | 5 +-
jiuyi2/pages/shop/store/commodities.vue | 23 ++++++++-
jiuyi2/readme.md | 2 +-
jiuyi2/vite.config.js | 3 +-
14 files changed, 128 insertions(+), 30 deletions(-)
diff --git a/jiuyi2/common/js/config.js b/jiuyi2/common/js/config.js
index 6522293b..d9448b2f 100644
--- a/jiuyi2/common/js/config.js
+++ b/jiuyi2/common/js/config.js
@@ -7,7 +7,6 @@ const config = {
// #endif
// #ifndef H5
host: 'http://91f.xyz:8080',
- host: 'https://b433d23.r24.cpolar.top/',
// #endif
// 支付方式配置
payType: {
diff --git a/jiuyi2/common/js/util.js b/jiuyi2/common/js/util.js
index ff57358a..76099e25 100644
--- a/jiuyi2/common/js/util.js
+++ b/jiuyi2/common/js/util.js
@@ -260,11 +260,11 @@ const util = {
})
},
- // 替换图片的宽度为最大宽度100% (移动端解析html富文本专用)
- imgReplace(value, th) {
- if (!th) {
- value = value.replace(//ig, '
')
.replace(/ {
- // 初始化
+ // 创建编辑器上下文对象
onEditorReady()
})
- // 初始化
+ // 创建编辑器上下文对象
function onEditorReady() {
uni.createSelectorQuery().select('#editor').context((res) => {
editorCtx.value = res.context
}).exec()
}
+ // 初始化编辑器上下文对象
+ function init(html) {
+ editorCtx.value.setContents({
+ html,
+ })
+ }
+
+ // 获取内容
+ function getEditorContents() {
+ editorCtx.value.getContents({
+ success: rs => {
+ return rs
+ }
+ })
+ }
+
// 撤销
function undo() {
editorCtx.value.undo()
@@ -65,7 +85,7 @@
} = event.target.dataset
if (!name) return
editorCtx.value.format(name, value)
- }
+ }
/**
* 编辑器状态被变化
@@ -158,6 +178,16 @@
}
})
}
+
+ // 富文本编辑
+ function handleEditorInput(event) {
+ emit('update:modelValue', event.detail.html)
+ }
+
+ defineExpose({
+ init,
+ getEditorContents,
+ })
@@ -221,9 +251,8 @@