From 0849fe5fe267cdd08a0dbe107dd3cd94adfaca8f Mon Sep 17 00:00:00 2001 From: 188633308 <188633308@qq.com> Date: Mon, 26 Apr 2021 11:14:20 +0800 Subject: [PATCH] =?UTF-8?q?update=20=E6=81=A2=E5=A4=8D=E6=96=87=E4=BB=B6?= =?UTF-8?q?=E9=A2=84=E8=A7=88=E6=9D=83=E9=99=90=E9=AA=8C=E8=AF=81,?= =?UTF-8?q?=E6=96=B0=E5=A2=9E=E5=9B=BE=E7=89=87=E7=BB=84=E4=BB=B6,?= =?UTF-8?q?=E4=BB=8E=E6=8E=A5=E5=8F=A3=E8=AF=BB=E5=8F=96=E6=96=87=E4=BB=B6?= =?UTF-8?q?=E6=B5=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitignore | 1 + Api/Ewide.Core/Service/File/SysFileService.cs | 1 - Web/src/components/yoImage/index.js | 35 ++++++++ Web/src/main.js | 2 + Web/src/pages/system/user/index.vue | 9 +- Web/src/util/file/index.js | 85 +++++++++++++++++++ Web/src/views/main/_layout/header/user.js | 8 +- 7 files changed, 129 insertions(+), 12 deletions(-) create mode 100644 Web/src/components/yoImage/index.js create mode 100644 Web/src/util/file/index.js diff --git a/.gitignore b/.gitignore index ebe41a5..fb4ecce 100644 --- a/.gitignore +++ b/.gitignore @@ -5,3 +5,4 @@ obj/ /packages .vs Logs/ +/Api/Ewide.Web.Entry/wwwroot/Upload diff --git a/Api/Ewide.Core/Service/File/SysFileService.cs b/Api/Ewide.Core/Service/File/SysFileService.cs index 8990b55..55e22fa 100644 --- a/Api/Ewide.Core/Service/File/SysFileService.cs +++ b/Api/Ewide.Core/Service/File/SysFileService.cs @@ -106,7 +106,6 @@ namespace Ewide.Core.Service /// /// [HttpGet("/sysFileInfo/preview")] - [AllowAnonymous] public async Task PreviewFileInfo([FromQuery] QueryFileInoInput input) { return await DownloadFileInfo(input); diff --git a/Web/src/components/yoImage/index.js b/Web/src/components/yoImage/index.js new file mode 100644 index 0000000..278a46a --- /dev/null +++ b/Web/src/components/yoImage/index.js @@ -0,0 +1,35 @@ +import { ArrayBufferToBase64 } from '@/util/file' + +export default { + props: { + type: { + type: String, + default: 'image' + }, + id: { + type: [String, Number], + require: true + } + }, + data() { + return { + src: '' + } + }, + + created() { + if (this.id) { + this.$api.sysFileInfoPreview({ id: this.id }).then(async ({ data }) => { + const base64 = await ArrayBufferToBase64(data) + this.src = base64 + }) + } + }, + + render() { + return this.type == 'avatar' ? + + : + + }, +} \ No newline at end of file diff --git a/Web/src/main.js b/Web/src/main.js index 3f28849..e59459e 100644 --- a/Web/src/main.js +++ b/Web/src/main.js @@ -53,6 +53,8 @@ import YoTable from './components/yoTable' Vue.component('YoTable', YoTable) import YoTableActions from './components/yoTableActions' Vue.component('YoTableActions', YoTableActions) +import YoImage from './components/yoImage' +Vue.component('YoImage', YoImage) /** * 引入主题样式 diff --git a/Web/src/pages/system/user/index.vue b/Web/src/pages/system/user/index.vue index 8adc43a..18ca910 100644 --- a/Web/src/pages/system/user/index.vue +++ b/Web/src/pages/system/user/index.vue @@ -80,12 +80,13 @@
{{ record.nickName || record.name }}
{{ record.account }}
-
@@ -120,8 +121,6 @@