提交 e666a99a 作者: 施汉文

refactor: 优化多个页面UI样式与举报弹窗功能

上级 5629faa0
---
alwaysApply: true
scene: git_message
---
在此处编写规则,自定义 AI 生成提交信息的风格。
必须简洁明了,一眼能看出完成或修改或优化的内容,不要写详细描述,不要超过两行。
\ No newline at end of file
...@@ -2,6 +2,7 @@ ...@@ -2,6 +2,7 @@
<!-- 简单版的图文编辑器 可以上传 截图上传图片 能实现简单的图文编辑功能 --> <!-- 简单版的图文编辑器 可以上传 截图上传图片 能实现简单的图文编辑功能 -->
<div class="textEditor"> <div class="textEditor">
<div <div
v-if="showViewImage"
class="rowFlex columnCenter textEditorTitle" class="rowFlex columnCenter textEditorTitle"
@click.stop="watchImage" @click.stop="watchImage"
> >
...@@ -34,7 +35,9 @@ ...@@ -34,7 +35,9 @@
title="查看大图" title="查看大图"
append-to-body append-to-body
center center
top="80%" width="600px"
top="0"
custom-class="watchImageDialog"
:visible.sync="showScoleImage" :visible.sync="showScoleImage"
> >
<div class="showScoleImageContent columnFlex allCenter" v-html="remark"></div> <div class="showScoleImageContent columnFlex allCenter" v-html="remark"></div>
...@@ -46,7 +49,24 @@ ...@@ -46,7 +49,24 @@
import { base64toFile } from '@/utils/index' import { base64toFile } from '@/utils/index'
export default { export default {
name: 'textEditor', name: 'textEditor',
props: ['remark', 'contenteditable', 'domid'], // remark 原来的图文内容 contenteditable 是否可编辑 domid 编辑器的 DomId resultReamrk 方法吐出最后的编辑好的内容 props: {
remark: {
type: String,
default: ''
},
contenteditable: {
type: Boolean,
default: false
},
domid: {
type: String,
default: ''
},
showViewImage: {
type: Boolean,
default: true
}
}, // remark 原来的图文内容 contenteditable 是否可编辑 domid 编辑器的 DomId resultReamrk 方法吐出最后的编辑好的内容
data() { data() {
return { return {
srcList: [], srcList: [],
...@@ -59,7 +79,9 @@ ...@@ -59,7 +79,9 @@
mounted() { mounted() {
this.$nextTick(() => { this.$nextTick(() => {
this.chatMessage = document.getElementById(`${this.domid}`) this.chatMessage = document.getElementById(`${this.domid}`)
this.remark && this.remark.length > 0 && this.contenteditable ? this.chatMessage.innerHTML = this.remark : '' if (this.remark && this.remark.length > 0 && this.contenteditable && this.chatMessage) {
this.chatMessage.innerHTML = this.remark
}
}) })
}, },
methods: { methods: {
...@@ -71,9 +93,17 @@ ...@@ -71,9 +93,17 @@
}, },
async watchImage() { async watchImage() {
if (this.remark.trim().length > 0) { if (this.remark.trim().length > 0) {
this.chatMessage.innerHTML = this.remark if (!this.chatMessage) {
this.chatMessage = document.getElementById(`${this.domid}`)
}
if (this.chatMessage) {
this.chatMessage.innerHTML = this.remark
}
this.srcList = [] this.srcList = []
const imgList = this.chatMessage.querySelectorAll('img') // 使用临时 div 来解析图片,而不依赖 DOM 元素
const tempDiv = document.createElement('div')
tempDiv.innerHTML = this.remark
const imgList = tempDiv.querySelectorAll('img')
if (imgList && imgList.length > 0) { if (imgList && imgList.length > 0) {
for (let index = 0; index < imgList.length; index++) { for (let index = 0; index < imgList.length; index++) {
this.srcList.push(imgList[index].src) this.srcList.push(imgList[index].src)
...@@ -171,14 +201,26 @@ ...@@ -171,14 +201,26 @@
margin-top:10px; margin-top:10px;
margin-right: 10px; margin-right: 10px;
} }
.watchImageDialog {
position: absolute;
top: 50%;
left: 50%;
margin: 0 !important;
transform: translate(-50%, -50%);
max-width: 90vw;
}
.watchImageDialog .el-dialog__body {
max-height: 70vh;
overflow-y: auto;
}
.showScoleImageContent{ .showScoleImageContent{
width: 100%; width: 100%;
overflow: auto; overflow: auto;
line-height: 16px; line-height: 16px;
} }
.showScoleImageContent img{ .showScoleImageContent img{
max-width: 80%; max-width: 100%;
margin-bottom: 20px; margin-bottom: 20px;
} }
</style> </style>
<template> <template>
<div class="violationRecord"> <div class="violationRecord">
<el-form v-loading="loading" class="violationRecordContent" label-width="90px"> <el-form v-loading="loading" class="violationRecordContent" label-width="90px">
<el-button type="primary" size="small" @click="reportPopupShow = true">举报</el-button> <div class="flex justify-end">
<el-button type="primary" size="small" @click="reportPopupShow = true">举报</el-button>
</div>
<div v-if="violationList.length > 0"> <div v-if="violationList.length > 0">
<div v-for="(item, index) in violationList" :key="index" class="contentItem"> <div v-for="(item, index) in violationList" :key="index" class="contentItem">
<el-form-item label="违规时间:"> <el-form-item label="违规时间:">
...@@ -206,7 +208,7 @@ export default { ...@@ -206,7 +208,7 @@ export default {
.violationRecordContent { .violationRecordContent {
width: 100%; width: 100%;
padding: 20px; padding: 0 20px;
height: auto; height: auto;
} }
......
...@@ -129,12 +129,21 @@ ...@@ -129,12 +129,21 @@
</el-option> </el-option>
</el-select> </el-select>
</el-form-item> </el-form-item>
<el-form-item label="详情" prop="remark" class="detail-form-item"> <el-form-item prop="remark" class="detail-form-item">
<div slot="label" class="detail-label">
<span>详情</span>
<span class="view-image-btn" @mousedown.stop.prevent="handleViewImage">
<i class="el-icon-view"></i>
<span>查看大图</span>
</span>
</div>
<textEditor <textEditor
ref="textEditorRef"
:remark.sync="reportForm.remark" :remark.sync="reportForm.remark"
domid="report_content" domid="report_content"
class="report-editor" class="report-editor"
:contenteditable="true" :contenteditable="true"
:show-view-image="false"
@resultReamrk="resultReamrk" @resultReamrk="resultReamrk"
/> />
</el-form-item> </el-form-item>
...@@ -579,6 +588,15 @@ ...@@ -579,6 +588,15 @@
resultReamrk(text) { resultReamrk(text) {
// console.log(text, '最后编辑器的内容') // console.log(text, '最后编辑器的内容')
}, },
handleViewImage() {
console.log('handleViewImage clicked')
console.log('textEditorRef:', this.$refs.textEditorRef)
if (this.$refs.textEditorRef && this.$refs.textEditorRef.watchImage) {
this.$refs.textEditorRef.watchImage()
} else {
console.log('textEditorRef or watchImage not found')
}
},
/** /**
* 根据 eco_user_list 同步提交字段 eco_user(全部姓名用顿号拼接) * 根据 eco_user_list 同步提交字段 eco_user(全部姓名用顿号拼接)
*/ */
...@@ -1007,9 +1025,39 @@ ...@@ -1007,9 +1025,39 @@
} }
} }
.detail-form-item {
position: relative;
}
::v-deep .detail-form-item { ::v-deep .detail-form-item {
.el-form-item__label { .el-form-item__label {
padding-bottom: 8px; padding-bottom: 8px;
width: 100%;
}
}
.detail-label {
display: flex;
align-items: center;
justify-content: flex-start;
width: 100%;
gap: 12px;
}
.view-image-btn {
display: inline-flex;
align-items: center;
gap: 4px;
cursor: pointer;
color: #00bf8a;
font-family: PingFang SC, sans-serif;
font-size: 13px;
font-weight: 400;
line-height: 22px;
user-select: none;
.el-icon-view {
font-size: 14px;
} }
} }
......
...@@ -68,30 +68,69 @@ export default { ...@@ -68,30 +68,69 @@ export default {
height: 100%; height: 100%;
.el-tabs__header { .el-tabs__header {
margin: 0; margin: 0px 15px 10px 15px !important;
padding: 0 15px; padding: 2px !important;
background: #F5F6F7 !important;
border-radius: 4px !important;
box-sizing: border-box !important;
height: auto !important;
overflow: visible !important;
border: none !important;
}
.el-tabs__nav-wrap {
overflow: visible !important;
height: auto !important;
padding: 0 !important;
margin: 0 !important;
&::after {
display: none !important;
}
}
.el-tabs__nav {
width: 100% !important;
display: flex !important;
border: none !important;
height: auto !important;
margin: 0 !important;
padding: 0 !important;
gap: 2px !important;
} }
.el-tabs__item { .el-tabs__item {
height: 40px; flex: 1 !important;
line-height: 40px; height: 22px !important;
font-size: 16px; line-height: 22px !important;
color: #333333; padding: 0 !important;
margin: 0 !important;
font-family: 'PingFang SC', sans-serif !important;
font-size: 13px !important;
font-weight: 400 !important;
color: #6D7176 !important;
text-align: center !important;
border-radius: 2px !important;
border: none !important;
transition: all 0.2s !important;
white-space: nowrap !important;
overflow: visible !important;
text-overflow: unset !important;
&.is-active { &.is-active {
color: #3491fa; background: #FFFFFF !important;
color: #131920 !important;
box-shadow: 0px 2px 8px 0px rgba(0, 0, 0, 0.05) !important;
} }
}
.el-tabs__active-bar { &:first-child,
background-color: #3491fa; &:last-child {
height: 3px; margin: 0 !important;
border-radius: 1.5px; }
} }
.el-tabs__nav-wrap::after { .el-tabs__active-bar {
height: 1px; display: none !important;
background-color: #e4e7ed;
} }
.el-tab-pane { .el-tab-pane {
...@@ -100,8 +139,8 @@ export default { ...@@ -100,8 +139,8 @@ export default {
} }
.el-tabs__content { .el-tabs__content {
height: calc(100% - 40px); height: calc(100% - 46px);
padding: 0 5px 5px; padding: 0;
} }
} }
} }
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论