From 5df11417b2d759248e66ad53646ff2e374d3665f Mon Sep 17 00:00:00 2001 From: loser <690927457@qq.com> Date: Tue, 30 Jan 2024 23:42:34 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B3=A8=E6=84=8F=E4=BA=8B=E9=A1=B9=E5=9B=BE?= =?UTF-8?q?=E7=89=87?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/style/newLogin.scss | 2 +- src/view/hospital/index.vue | 91 ++++++++++++++++++++++++++++++++++++- 2 files changed, 90 insertions(+), 3 deletions(-) diff --git a/src/style/newLogin.scss b/src/style/newLogin.scss index 5d89b3c..aeda14d 100644 --- a/src/style/newLogin.scss +++ b/src/style/newLogin.scss @@ -40,7 +40,7 @@ margin: 30px 0; .login_panel_form_title_logo { width: 90px; - height: 72px; + height: 90px; } .login_panel_form_title_p { font-size: 40px; diff --git a/src/view/hospital/index.vue b/src/view/hospital/index.vue index f34d6b8..777b193 100644 --- a/src/view/hospital/index.vue +++ b/src/view/hospital/index.vue @@ -9,7 +9,7 @@ import _ from 'lodash' // import { toSQLLine } from '@/utils/stringFun' // import WarningBar from '@/components/warningBar/warningBar.vue' import ckEditor from '@/components/richText/ckEditor5.vue' -import { ref, onMounted } from 'vue' +import { ref, onMounted, reactive } from 'vue' import { ElMessage, ElMessageBox } from 'element-plus' import { useRouter, useRoute } from 'vue-router' const router = useRouter() @@ -220,6 +220,55 @@ function del_ro_func(i, type) { todo_list.value.splice(i, 1) } } +// 图片上传 +const uploading_form = reactive({ + uploading:false, + progressStatus:'info', + percentage:0, // 进度条 +}) +function init_uploading() { + uploading_form.uploading = false + uploading_form.progressStatus = 'info' + uploading_form.percentage = 0 +} +function handleAvatarSuccess(res) { + console.log("res is ====",res) + note_list.value[note_list_item_index.value].content = res.data.file.url + + uploading_form.progressStatus = 'info' + uploading_form.percentage = 100 + setTimeout(() => { + init_uploading() + },500) +} +function beforeAvatarUpload(file) { + init_uploading() + uploading_form.uploading = true + const isLt05M = file.size / 1024 / 1024 < 20 + const isJPG = file.type.indexOf('image/') === -1 + if (isJPG) { + uploading_form.uploading = false + uploading_form.progressStatus = 'warning' + ElMessage.error('文件格式错误,请上传图片类型,如:JPG,PNG后缀的文件') + } + if (!isLt05M) { + uploading_form.uploading = false + uploading_form.progressStatus = 'warning' + ElMessage.error('上传头像图片大小不能超过 2M!') + } + let interval = Math.random(100)*100 + console.log("interval is ====",interval) + setInterval(() => { + if(uploading_form.percentage < interval) { + uploading_form.percentage += 1 + } + },10) + return !isJPG && isLt05M +} +const note_list_item_index = ref(0) +function beforeUploadImg(i) { + note_list_item_index.value = i +}