fix: 页面功能修改。
This commit is contained in:
@@ -37,18 +37,9 @@
|
|||||||
<text class="iconfont underline">U</text>
|
<text class="iconfont underline">U</text>
|
||||||
</view>
|
</view>
|
||||||
<view class="toolbar-divider"></view>
|
<view class="toolbar-divider"></view>
|
||||||
<view class="toolbar-item" @click="format('header', 'H1')">
|
|
||||||
<text class="iconfont">H1</text>
|
|
||||||
</view>
|
|
||||||
<view class="toolbar-item" @click="format('header', 'H2')">
|
|
||||||
<text class="iconfont">H2</text>
|
|
||||||
</view>
|
|
||||||
<view class="toolbar-divider"></view>
|
<view class="toolbar-divider"></view>
|
||||||
<view class="toolbar-item" @click="format('insertOrderedList')">
|
<view class="toolbar-item" @click="insertImage">
|
||||||
<text class="iconfont">1.</text>
|
<uni-icons type="image" size="16" color="#333333"></uni-icons>
|
||||||
</view>
|
|
||||||
<view class="toolbar-item" @click="format('insertUnorderedList')">
|
|
||||||
<text class="iconfont">•</text>
|
|
||||||
</view>
|
</view>
|
||||||
<view class="toolbar-divider"></view>
|
<view class="toolbar-divider"></view>
|
||||||
<view class="toolbar-item" @click="undo">
|
<view class="toolbar-item" @click="undo">
|
||||||
@@ -66,9 +57,9 @@
|
|||||||
@input="onEditorInput"
|
@input="onEditorInput"
|
||||||
@focus="editorFocus"
|
@focus="editorFocus"
|
||||||
@blur="editorBlur"
|
@blur="editorBlur"
|
||||||
:show-img-size="false"
|
:show-img-size="true"
|
||||||
:show-img-toolbar="false"
|
:show-img-toolbar="true"
|
||||||
:show-img-resize="false"
|
:show-img-resize="true"
|
||||||
></editor>
|
></editor>
|
||||||
<view class="editor-counter">
|
<view class="editor-counter">
|
||||||
<text>{{ contentLength }}/20000</text>
|
<text>{{ contentLength }}/20000</text>
|
||||||
@@ -194,6 +185,88 @@ onLoad((option) => {
|
|||||||
if (!editorCtx.value) return
|
if (!editorCtx.value) return
|
||||||
editorCtx.value.redo()
|
editorCtx.value.redo()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 插入图片
|
||||||
|
function insertImage() {
|
||||||
|
uni.chooseImage({
|
||||||
|
count: 1,
|
||||||
|
sizeType: ['compressed'],
|
||||||
|
sourceType: ['album', 'camera'],
|
||||||
|
success: (res) => {
|
||||||
|
const tempFilePath = res.tempFilePaths[0]
|
||||||
|
|
||||||
|
// 显示加载提示
|
||||||
|
uni.showLoading({
|
||||||
|
title: '上传中...'
|
||||||
|
})
|
||||||
|
|
||||||
|
// 上传图片到服务器
|
||||||
|
uni.uploadFile({
|
||||||
|
url: proxy.$config.baseUrl + '/common/upload',
|
||||||
|
filePath: tempFilePath,
|
||||||
|
name: 'file',
|
||||||
|
header: {
|
||||||
|
'Authorization': 'Bearer ' + uni.getStorageSync('token')
|
||||||
|
},
|
||||||
|
success: (uploadRes) => {
|
||||||
|
uni.hideLoading()
|
||||||
|
|
||||||
|
try {
|
||||||
|
const data = JSON.parse(uploadRes.data)
|
||||||
|
if (data.code === 200) {
|
||||||
|
// 获取图片URL
|
||||||
|
const imageUrl = proxy.$config.baseUrl + data.fileName
|
||||||
|
|
||||||
|
// 插入图片到编辑器
|
||||||
|
if (editorCtx.value) {
|
||||||
|
editorCtx.value.insertImage({
|
||||||
|
src: imageUrl,
|
||||||
|
width: '100%',
|
||||||
|
height: 'auto',
|
||||||
|
success: () => {
|
||||||
|
uni.showToast({
|
||||||
|
title: '插入成功',
|
||||||
|
icon: 'success'
|
||||||
|
})
|
||||||
|
},
|
||||||
|
fail: (err) => {
|
||||||
|
console.error('插入图片失败', err)
|
||||||
|
uni.showToast({
|
||||||
|
title: '插入失败',
|
||||||
|
icon: 'none'
|
||||||
|
})
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
uni.showToast({
|
||||||
|
title: data.msg || '上传失败',
|
||||||
|
icon: 'none'
|
||||||
|
})
|
||||||
|
}
|
||||||
|
} catch (e) {
|
||||||
|
console.error('解析上传结果失败', e)
|
||||||
|
uni.showToast({
|
||||||
|
title: '上传失败',
|
||||||
|
icon: 'none'
|
||||||
|
})
|
||||||
|
}
|
||||||
|
},
|
||||||
|
fail: (err) => {
|
||||||
|
uni.hideLoading()
|
||||||
|
console.error('上传失败', err)
|
||||||
|
uni.showToast({
|
||||||
|
title: '上传失败',
|
||||||
|
icon: 'none'
|
||||||
|
})
|
||||||
|
}
|
||||||
|
})
|
||||||
|
},
|
||||||
|
fail: (err) => {
|
||||||
|
console.error('选择图片失败', err)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
function getDict() {
|
function getDict() {
|
||||||
// 类型
|
// 类型
|
||||||
getDicts('journey_type').then(res => {
|
getDicts('journey_type').then(res => {
|
||||||
|
|||||||
@@ -195,58 +195,7 @@ onLoad((option) => {
|
|||||||
padding: 20rpx;
|
padding: 20rpx;
|
||||||
background: #f8f9fa;
|
background: #f8f9fa;
|
||||||
border-radius: 8rpx;
|
border-radius: 8rpx;
|
||||||
font-size: 26rpx;
|
|
||||||
color: #2c3e50;
|
|
||||||
line-height: 1.8;
|
|
||||||
word-break: break-all;
|
word-break: break-all;
|
||||||
|
|
||||||
// 富文本样式
|
|
||||||
:deep(p) {
|
|
||||||
margin: 12rpx 0;
|
|
||||||
&:first-child {
|
|
||||||
margin-top: 0;
|
|
||||||
}
|
|
||||||
&:last-child {
|
|
||||||
margin-bottom: 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
:deep(h1) {
|
|
||||||
font-size: 36rpx;
|
|
||||||
font-weight: 600;
|
|
||||||
margin: 20rpx 0 12rpx;
|
|
||||||
color: #1a1a1a;
|
|
||||||
}
|
|
||||||
|
|
||||||
:deep(h2) {
|
|
||||||
font-size: 32rpx;
|
|
||||||
font-weight: 600;
|
|
||||||
margin: 16rpx 0 12rpx;
|
|
||||||
color: #333333;
|
|
||||||
}
|
|
||||||
|
|
||||||
:deep(strong), :deep(b) {
|
|
||||||
font-weight: 600;
|
|
||||||
color: #1a1a1a;
|
|
||||||
}
|
|
||||||
|
|
||||||
:deep(em), :deep(i) {
|
|
||||||
font-style: italic;
|
|
||||||
}
|
|
||||||
|
|
||||||
:deep(u) {
|
|
||||||
text-decoration: underline;
|
|
||||||
}
|
|
||||||
|
|
||||||
:deep(ol), :deep(ul) {
|
|
||||||
margin: 12rpx 0;
|
|
||||||
padding-left: 40rpx;
|
|
||||||
}
|
|
||||||
|
|
||||||
:deep(li) {
|
|
||||||
margin: 8rpx 0;
|
|
||||||
line-height: 1.8;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -547,58 +547,7 @@ page {
|
|||||||
padding: 16rpx;
|
padding: 16rpx;
|
||||||
background: #f8f9fa;
|
background: #f8f9fa;
|
||||||
border-radius: 8rpx;
|
border-radius: 8rpx;
|
||||||
font-size: 26rpx;
|
|
||||||
color: #2c3e50;
|
|
||||||
line-height: 1.8;
|
|
||||||
word-break: break-all;
|
word-break: break-all;
|
||||||
|
|
||||||
// 富文本样式
|
|
||||||
:deep(p) {
|
|
||||||
margin: 12rpx 0;
|
|
||||||
&:first-child {
|
|
||||||
margin-top: 0;
|
|
||||||
}
|
|
||||||
&:last-child {
|
|
||||||
margin-bottom: 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
:deep(h1) {
|
|
||||||
font-size: 34rpx;
|
|
||||||
font-weight: 600;
|
|
||||||
margin: 16rpx 0 12rpx;
|
|
||||||
color: #1a1a1a;
|
|
||||||
}
|
|
||||||
|
|
||||||
:deep(h2) {
|
|
||||||
font-size: 30rpx;
|
|
||||||
font-weight: 600;
|
|
||||||
margin: 16rpx 0 10rpx;
|
|
||||||
color: #333333;
|
|
||||||
}
|
|
||||||
|
|
||||||
:deep(strong), :deep(b) {
|
|
||||||
font-weight: 600;
|
|
||||||
color: #1a1a1a;
|
|
||||||
}
|
|
||||||
|
|
||||||
:deep(em), :deep(i) {
|
|
||||||
font-style: italic;
|
|
||||||
}
|
|
||||||
|
|
||||||
:deep(u) {
|
|
||||||
text-decoration: underline;
|
|
||||||
}
|
|
||||||
|
|
||||||
:deep(ol), :deep(ul) {
|
|
||||||
margin: 12rpx 0;
|
|
||||||
padding-left: 40rpx;
|
|
||||||
}
|
|
||||||
|
|
||||||
:deep(li) {
|
|
||||||
margin: 8rpx 0;
|
|
||||||
line-height: 1.8;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user