From 79f117e8cfb90586753503582dfff2b999d6c436 Mon Sep 17 00:00:00 2001
From: 田源 <lastanimals@163.com>
Date: 星期一, 01 四月 2024 10:11:41 +0800
Subject: [PATCH] 取消登录鉴权注释代码

---
 Source/ProjectWeb/src/router/page/index.js               |   12 --
 Source/ProjectWeb/src/router/axios.js                    |   50 ++++----
 Source/ProjectWeb/src/page/login/userlogin.vue           |   60 +++++-----
 Source/ProjectWeb/src/page/index/sidebar/sidebarItem.vue |  214 +++++++++++++++++-----------------
 4 files changed, 162 insertions(+), 174 deletions(-)

diff --git a/Source/ProjectWeb/src/page/index/sidebar/sidebarItem.vue b/Source/ProjectWeb/src/page/index/sidebar/sidebarItem.vue
index 290ec31..170ffa4 100644
--- a/Source/ProjectWeb/src/page/index/sidebar/sidebarItem.vue
+++ b/Source/ProjectWeb/src/page/index/sidebar/sidebarItem.vue
@@ -2,146 +2,146 @@
   <div class="menu-wrapper">
     <template v-for="item in menu">
       <el-menu-item v-if="validatenull(item[childrenKey]) && vaildRoles(item)"
-                    :index="item[pathKey]"
-                    @click="open(item)"
                     :key="item[labelKey]"
-                    :class="{'is-active':vaildActive(item)}">
+                    :class="{'is-active':vaildActive(item)}"
+                    :index="item[pathKey]"
+                    @click="open(item)">
         <i :class="item[iconKey]"></i>
         <span slot="title"
-              :alt="item[pathKey]">{{generateTitle(item)}}</span>
+              :alt="item[pathKey]">{{ generateTitle(item) }}</span>
       </el-menu-item>
       <el-submenu v-else-if="!validatenull(item[childrenKey])&&vaildRoles(item)"
-                  :index="item[pathKey]"
-                  :key="item[labelKey]">
+                  :key="item[labelKey]"
+                  :index="item[pathKey]">
         <template slot="title">
           <i :class="item[iconKey]"></i>
           <span slot="title"
-                :class="{'el-menu--display':collapse && first}">{{generateTitle(item)}}</span>
+                :class="{'el-menu--display':collapse && first}">{{ generateTitle(item) }}</span>
         </template>
         <template v-for="(child,cindex) in item[childrenKey]">
-          <el-menu-item :index="child[pathKey],cindex"
-                        @click="open(child)"
+          <el-menu-item v-if="validatenull(child[childrenKey])"
+                        :key="child[labelKey]"
                         :class="{'is-active':vaildActive(child)}"
-                        v-if="validatenull(child[childrenKey])"
-                        :key="child[labelKey]">
+                        :index="child[pathKey],cindex"
+                        @click="open(child)">
             <i :class="child[iconKey]"></i>
-            <span slot="title">{{generateTitle(child)}}</span>
+            <span slot="title">{{ generateTitle(child) }}</span>
           </el-menu-item>
           <sidebar-item v-else
-                        :menu="[child]"
                         :key="cindex"
+                        :collapse="collapse"
+                        :menu="[child]"
                         :props="props"
-                        :screen="screen"
-                        :collapse="collapse"></sidebar-item>
+                        :screen="screen"></sidebar-item>
         </template>
       </el-submenu>
     </template>
   </div>
 </template>
 <script>
-  import {mapGetters} from "vuex";
-  import {isURL, validatenull} from "@/util/validate";
-  import config from "./config.js";
+import {mapGetters} from "vuex";
+import {isURL, validatenull} from "@/util/validate";
+import config from "./config.js";
 
-  export default {
-    name: "sidebarItem",
-    data() {
-      return {
-        config: config
-      };
+export default {
+  name: "sidebarItem",
+  data() {
+    return {
+      config: config
+    };
+  },
+  props: {
+    menu: {
+      type: Array
+    },
+    screen: {
+      type: Number
+    },
+    first: {
+      type: Boolean,
+      default: false
     },
     props: {
-      menu: {
-        type: Array
-      },
-      screen: {
-        type: Number
-      },
-      first: {
-        type: Boolean,
-        default: false
-      },
-      props: {
-        type: Object,
-        default: () => {
-          return {};
-        }
-      },
-      collapse: {
-        type: Boolean
+      type: Object,
+      default: () => {
+        return {};
       }
     },
-    created() {
+    collapse: {
+      type: Boolean
+    }
+  },
+  created() {
+  },
+  mounted() {
+  },
+  computed: {
+    ...mapGetters(["roles"]),
+    labelKey() {
+      return this.props.label || this.config.propsDefault.label;
     },
-    mounted() {
+    pathKey() {
+      return this.props.path || this.config.propsDefault.path;
     },
-    computed: {
-      ...mapGetters(["roles"]),
-      labelKey() {
-        return this.props.label || this.config.propsDefault.label;
-      },
-      pathKey() {
-        return this.props.path || this.config.propsDefault.path;
-      },
-      iconKey() {
-        return this.props.icon || this.config.propsDefault.icon;
-      },
-      childrenKey() {
-        return this.props.children || this.config.propsDefault.children;
-      },
-      isOpenKey() {
-        return this.props.isOpen || this.config.propsDefault.isOpen;
-      },
-      nowTagValue() {
-        return this.$router.$avueRouter.getValue(this.$route);
+    iconKey() {
+      return this.props.icon || this.config.propsDefault.icon;
+    },
+    childrenKey() {
+      return this.props.children || this.config.propsDefault.children;
+    },
+    isOpenKey() {
+      return this.props.isOpen || this.config.propsDefault.isOpen;
+    },
+    nowTagValue() {
+      return this.$router.$avueRouter.getValue(this.$route);
+    }
+  },
+  methods: {
+    generateTitle(item) {
+      return this.$router.$avueRouter.generateTitle(
+        item[this.labelKey],
+        (item.meta || {}).i18n
+      );
+    },
+    vaildActive(item) {
+      if (this.validIsOpen(item)) {
+        return false;
+      }
+      const groupFlag = (item["group"] || []).some(ele =>
+        this.$route.path.includes(ele)
+      );
+      return this.nowTagValue === item[this.pathKey] || groupFlag;
+    },
+    vaildRoles(item) {
+      item.meta = item.meta || {};
+      return item.meta.roles ? item.meta.roles.includes(this.roles) : true;
+    },
+    validatenull(val) {
+      return validatenull(val);
+    },
+    validIsOpen(item) {
+      if (item[this.isOpenKey] === 2 && isURL(item[this.pathKey])) {
+        return true;
       }
     },
-    methods: {
-      generateTitle(item) {
-        return this.$router.$avueRouter.generateTitle(
-          item[this.labelKey],
-          (item.meta || {}).i18n
-        );
-      },
-      vaildActive(item) {
-        if (this.validIsOpen(item)) {
-          return false;
-        }
-        const groupFlag = (item["group"] || []).some(ele =>
-          this.$route.path.includes(ele)
-        );
-        return this.nowTagValue === item[this.pathKey] || groupFlag;
-      },
-      vaildRoles(item) {
-        item.meta = item.meta || {};
-        return item.meta.roles ? item.meta.roles.includes(this.roles) : true;
-      },
-      validatenull(val) {
-        return validatenull(val);
-      },
-      validIsOpen(item) {
-        if (item[this.isOpenKey] === 2 && isURL(item[this.pathKey])) {
-          return true;
-        }
-      },
-      open(item) {
-        if (this.screen <= 1) this.$store.commit("SET_COLLAPSE");
-        if (this.validIsOpen(item)) {
-          window.open(item[this.pathKey]);
-        } else {
-          this.$router.$avueRouter.group = item.group;
-          this.$router.$avueRouter.meta = item.meta;
-          this.$router.push({
-            path: this.$router.$avueRouter.getPath({
-              name: item[this.labelKey],
-              src: item[this.pathKey]
-            }, item.meta),
-            query: item.query
-          });
-        }
+    open(item) {
+      if (this.screen <= 1) this.$store.commit("SET_COLLAPSE");
+      if (this.validIsOpen(item)) {
+        window.open(item[this.pathKey]);
+      } else {
+        this.$router.$avueRouter.group = item.group;
+        this.$router.$avueRouter.meta = item.meta;
+        this.$router.push({
+          path: this.$router.$avueRouter.getPath({
+            name: item[this.labelKey],
+            src: item[this.pathKey]
+          }, item.meta),
+          query: item.query
+        });
       }
     }
-  };
+  }
+};
 </script>
 <style lang="scss" scoped>
 .el-menu-item:focus, .el-menu-item:hover {
diff --git a/Source/ProjectWeb/src/page/login/userlogin.vue b/Source/ProjectWeb/src/page/login/userlogin.vue
index f753498..77a5801 100644
--- a/Source/ProjectWeb/src/page/login/userlogin.vue
+++ b/Source/ProjectWeb/src/page/login/userlogin.vue
@@ -165,36 +165,36 @@
         done();
       },
       handleLogin() {
-        // this.$router.push({path: this.tagWel.value});
-        // this.$refs.loginForm.validate(valid => {
-        //   if (valid) {
-        //     const loading = this.$loading({
-        //       lock: true,
-        //       text: '鐧诲綍涓�,璇风◢鍚庛�傘�傘��',
-        //       spinner: "el-icon-loading"
-        //     });
-        //     this.$store.dispatch("LoginByUsername", this.loginForm).then(() => {
-        //       if (this.website.switchMode) {
-        //         const deptId = this.userInfo.dept_id;
-        //         const roleId = this.userInfo.role_id;
-        //         if (deptId.includes(",") || roleId.includes(",")) {
-        //           this.loginForm.deptId = deptId;
-        //           this.loginForm.roleId = roleId;
-        //           this.userBox = true;
-        //           this.$store.dispatch("LogOut").then(() => {
-        //             loading.close();
-        //           });
-        //           return false;
-        //         }
-        //       }
-        //       this.$router.push({path: this.tagWel.value});
-        //       loading.close();
-        //     }).catch(() => {
-        //       loading.close();
-        //
-        //     });
-        //   }
-        // });
+        this.$router.push({path: this.tagWel.value});
+        this.$refs.loginForm.validate(valid => {
+          if (valid) {
+            const loading = this.$loading({
+              lock: true,
+              text: '鐧诲綍涓�,璇风◢鍚庛�傘�傘��',
+              spinner: "el-icon-loading"
+            });
+            this.$store.dispatch("LoginByUsername", this.loginForm).then(() => {
+              if (this.website.switchMode) {
+                const deptId = this.userInfo.dept_id;
+                const roleId = this.userInfo.role_id;
+                if (deptId.includes(",") || roleId.includes(",")) {
+                  this.loginForm.deptId = deptId;
+                  this.loginForm.roleId = roleId;
+                  this.userBox = true;
+                  this.$store.dispatch("LogOut").then(() => {
+                    loading.close();
+                  });
+                  return false;
+                }
+              }
+              this.$router.push({path: this.tagWel.value});
+              loading.close();
+            }).catch(() => {
+              loading.close();
+
+            });
+          }
+        });
       },
       getTenant() {
         let domain = getTopUrl();
diff --git a/Source/ProjectWeb/src/router/axios.js b/Source/ProjectWeb/src/router/axios.js
index 1e52529..64b38fe 100644
--- a/Source/ProjectWeb/src/router/axios.js
+++ b/Source/ProjectWeb/src/router/axios.js
@@ -55,30 +55,30 @@
 }, error => {
   return Promise.reject(error)
 });
-// //http response 鎷︽埅
-// axios.interceptors.response.use(res => {
-//   //鍏抽棴 progress bar
-//   NProgress.done();
-//   //鑾峰彇鐘舵�佺爜
-//   const status = res.data.code || res.status;
-//   const statusWhiteList = website.statusWhiteList || [];
-//   const message = res.data.msg || res.data.error_description || '鏈煡閿欒';
-//   //濡傛灉鍦ㄧ櫧鍚嶅崟閲屽垯鑷catch閫昏緫澶勭悊
-//   if (statusWhiteList.includes(status)) return Promise.reject(res);
-//   //濡傛灉鏄�401鍒欒烦杞埌鐧诲綍椤甸潰
-//   if (status === 401) store.dispatch('FedLogOut').then(() => router.push({path: '/login'}));
-//   // 濡傛灉璇锋眰涓洪潪200鍚﹁�呴粯璁ょ粺涓�澶勭悊
-//   if (status !== 200) {
-//     Message({
-//       message: message,
-//       type: 'error'
-//     });
-//     return Promise.reject(new Error(message))
-//   }
-//   return res;
-// }, error => {
-//   NProgress.done();
-//   return Promise.reject(new Error(error));
-// });
+//http response 鎷︽埅
+axios.interceptors.response.use(res => {
+  //鍏抽棴 progress bar
+  NProgress.done();
+  //鑾峰彇鐘舵�佺爜
+  const status = res.data.code || res.status;
+  const statusWhiteList = website.statusWhiteList || [];
+  const message = res.data.msg || res.data.error_description || '鏈煡閿欒';
+  //濡傛灉鍦ㄧ櫧鍚嶅崟閲屽垯鑷catch閫昏緫澶勭悊
+  if (statusWhiteList.includes(status)) return Promise.reject(res);
+  //濡傛灉鏄�401鍒欒烦杞埌鐧诲綍椤甸潰
+  if (status === 401) store.dispatch('FedLogOut').then(() => router.push({path: '/login'}));
+  // 濡傛灉璇锋眰涓洪潪200鍚﹁�呴粯璁ょ粺涓�澶勭悊
+  if (status !== 200) {
+    Message({
+      message: message,
+      type: 'error'
+    });
+    return Promise.reject(new Error(message))
+  }
+  return res;
+}, error => {
+  NProgress.done();
+  return Promise.reject(new Error(error));
+});
 
 export default axios;
diff --git a/Source/ProjectWeb/src/router/page/index.js b/Source/ProjectWeb/src/router/page/index.js
index d4946ac..255d6a9 100644
--- a/Source/ProjectWeb/src/router/page/index.js
+++ b/Source/ProjectWeb/src/router/page/index.js
@@ -77,18 +77,6 @@
     path: '*',
     redirect: '/404'
   },
-  // {
-  //   path: '/UIContentViewer',
-  //   name: 'UI涓婁笅鏂�',
-  //   component: Layout,
-  //   children: [
-  //     {
-  //       path: '',
-  //       component: () => import("@/views/base/UIContentViewer"),
-  //       props: true
-  //     }
-  //   ]
-  // },
   {
     path: '/dynamic-form',
     name: '鍔ㄦ�佽〃鏍奸〉闈�',

--
Gitblit v1.9.3