| | |
| | | <div v-for="(item, idx) in components" :key="item.id" class="dynamic-component"> |
| | | <!-- 富文本 --> |
| | | <div v-if="item.type == 'richText'"> |
| | | <AiEditor :ref="`editor_${item.id}`" :value="item.data.content" height="200px" :readOnly="!editable" |
| | | <AiEditor :ref="`editor_${item.id}`" :value="item.data.content" height="400px" :readOnly="!editable" |
| | | placeholder="请输入内容..." :disabled="!editable" /> |
| | | </div> |
| | | <!-- 自定义表格 --> |
| | |
| | | <template v-if="header.type === 'user'"> |
| | | {{ getUserDisplayText(header.name, scope.row) }} |
| | | </template> |
| | | <!-- 图片类型显示 --> |
| | | <!-- 图片类型显示,兼容数组和字符串 --> |
| | | <template v-else-if="header.type === 'image'"> |
| | | <img v-if="scope.row[header.name]" :src="getFullUrl(scope.row[header.name])" alt="头像" |
| | | class="table-image" /> |
| | | <template v-if="Array.isArray(scope.row[header.name])"> |
| | | <el-image |
| | | v-for="(img, i) in scope.row[header.name]" |
| | | :key="i" |
| | | :src="getFullUrl(img)" |
| | | :preview-src-list="scope.row[header.name].map(getFullUrl)" |
| | | class="table-image" |
| | | /> |
| | | </template> |
| | | <template v-else> |
| | | <el-image |
| | | v-if="scope.row[header.name]" |
| | | :src="getFullUrl(scope.row[header.name])" |
| | | :preview-src-list="[getFullUrl(scope.row[header.name])]" |
| | | class="table-image" |
| | | /> |
| | | </template> |
| | | </template> |
| | | <!-- 其他类型 --> |
| | | <template v-else> |
| | |
| | | beforeImageUpload(file) { |
| | | const isJPG = file.type === 'image/jpeg'; |
| | | const isPNG = file.type === 'image/png'; |
| | | const isLt2M = file.size / 1024 / 1024 < 2; |
| | | // 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; |
| | | } |
| | | // if (!isLt2M) { |
| | | // this.$message.error('上传图片大小不能超过 2MB!'); |
| | | // return false; |
| | | // } |
| | | this.imagePreviewVisible = true; |
| | | return true; |
| | | }, |