From f2213bd142d787e3b84b030326f6084375939d8d Mon Sep 17 00:00:00 2001
From: Administrator <admin>
Date: Fri, 31 Dec 2021 15:38:25 +0800
Subject: [PATCH] 保安员管理修改

---
 src/views/securityGuard/securityGuard.vue |   38 +++++++++++++++++++++-----------------
 1 files changed, 21 insertions(+), 17 deletions(-)

diff --git a/src/views/securityGuard/securityGuard.vue b/src/views/securityGuard/securityGuard.vue
index 22eaf77..bdf06ee 100644
--- a/src/views/securityGuard/securityGuard.vue
+++ b/src/views/securityGuard/securityGuard.vue
@@ -2779,25 +2779,29 @@
     //照片上传拦截
     uploadBefore(file, done, loading, column) {
       //如果你想修改file文件,由于上传的file是只读文件,必须复制新的file才可以修改名字,完后赋值到done函数里,如果不修改的话直接写done()即可
-      if (file.type.indexOf("image/") == -1) {
-        MessageBox.alert(
-          "上传图片格式错误,请上传图片类型,如:JPG,PNG后缀的文件。"
-        );
-        loading();
-        return false;
-      }
-      let data = window.URL.createObjectURL(new Blob([file]));
-      this.filename = file;
-      this.option.img = data;
-      //判断文件大小
-      const isLt1M = file.size >= 30 * 1024 && file.size <= 500 * 1024;
-      if (!isLt1M) {
-        MessageBox.alert("上传图片大小必须大于30KB,且小于500KB!");
-        loading();
-        return false;
+      //判断角色
+      if (this.userInfo.role_name != "administrator") {
+        if (file.type.indexOf("image/") == -1) {
+          MessageBox.alert(
+            "上传图片格式错误,请上传图片类型,如:JPG,PNG后缀的文件。"
+          );
+          loading();
+          return false;
+        }
+        let data = window.URL.createObjectURL(new Blob([file]));
+        this.filename = file;
+        this.option.img = data;
+        //判断文件大小
+        const isLt1M = file.size >= 30 * 1024 && file.size <= 500 * 1024;
+        if (!isLt1M) {
+          MessageBox.alert("上传图片大小必须大于30KB,且小于500KB!");
+          loading();
+          return false;
+        }
+        done();
+        return isLt1M;
       }
       done();
-      return isLt1M;
     },
   },
 };

--
Gitblit v1.9.3