Răsfoiți Sursa

Merge branch 'dev' into test

lihaiting 1 zi în urmă
părinte
comite
55c62e3def
4 a modificat fișierele cu 340 adăugiri și 323 ștergeri
  1. 19 9
      src/views/login/index.vue
  2. 12 5
      src/views/singleLogin/index.vue
  3. 1 1
      vue.config.js
  4. 308 308
      yarn.lock

+ 19 - 9
src/views/login/index.vue

@@ -29,7 +29,9 @@
           <!-- 标题 -->
           <div class="form-header">
             <h1 class="form-title">
-              <span class="title-dark">{{projectName||'工业互联网平台'}}</span>
+              <span class="title-dark">{{
+                projectName || '工业互联网平台'
+              }}</span>
             </h1>
           </div>
 
@@ -116,7 +118,8 @@
   import {
     login,
     getCaptcha,
-    getLatestVersion,logoByCode,
+    getLatestVersion,
+    logoByCode,
     getParentIdListByDeptId
   } from '@/api/login';
   import xyy from '@/assets/xyy.jpg';
@@ -134,7 +137,7 @@
         // 登录框方向, 0居中, 1居右, 2居左
         xyy,
         direction: 0,
-        projectName:"",
+        projectName: '',
         // 加载状态
         loading: false,
         // 表单数据
@@ -202,7 +205,7 @@
       }
     },
     methods: {
-       getLogo() {
+      getLogo() {
         logoByCode('logoCode').then((res) => {
           this.projectName = res.logoName;
         });
@@ -231,14 +234,21 @@
             .then(async (res) => {
               localStorage.setItem('userId', res.data.userId);
               localStorage.setItem('accountId', res.data.accountId);
-              // 用户信息
-              if (res.data?.loginChangeGroupVOList.length > 0) {
+              // 用户信息:默认部门/角色取主所属部门(isMainGroup=1,后端以 t_main_user.group_id 为基准)
+              const groupList = res.data?.loginChangeGroupVOList || [];
+              const mainGroup = groupList.find((item) => item.isMainGroup == 1);
+              if (!mainGroup && groupList.length) {
+                this.$message.warning(
+                  '登录接口未返回主所属部门(isMainGroup=1),已默认第一个部门,请后端确认'
+                );
+              }
+              const defaultGroup = mainGroup || groupList[0];
+              if (defaultGroup) {
                 setCurrentUser(
                   {
-                    currentGroupId: res.data.loginChangeGroupVOList[0].groupId,
+                    currentGroupId: defaultGroup.groupId,
                     currentRoleId:
-                      res.data.loginChangeGroupVOList[0]
-                        .loginChangeRoleVOList[0].roleId
+                      defaultGroup.loginChangeRoleVOList?.[0]?.roleId
                   },
                   this.form.remember
                 );

+ 12 - 5
src/views/singleLogin/index.vue

@@ -332,14 +332,21 @@
           login(this.form)
             .then(async (res) => {
               localStorage.setItem('userId', res.data.userId);
-              // 用户信息
-              if (res.data?.loginChangeGroupVOList.length > 0) {
+              // 用户信息:默认部门/角色取主所属部门(isMainGroup=1,后端以 t_main_user.group_id 为基准)
+              const groupList = res.data?.loginChangeGroupVOList || [];
+              const mainGroup = groupList.find((item) => item.isMainGroup == 1);
+              if (!mainGroup && groupList.length) {
+                this.$message.warning(
+                  '登录接口未返回主所属部门(isMainGroup=1),已默认第一个部门,请后端确认'
+                );
+              }
+              const defaultGroup = mainGroup || groupList[0];
+              if (defaultGroup) {
                 setCurrentUser(
                   {
-                    currentGroupId: res.data.loginChangeGroupVOList[0].groupId,
+                    currentGroupId: defaultGroup.groupId,
                     currentRoleId:
-                      res.data.loginChangeGroupVOList[0]
-                        .loginChangeRoleVOList[0].roleId
+                      defaultGroup.loginChangeRoleVOList?.[0]?.roleId
                   },
                   this.form.remember
                 );

+ 1 - 1
vue.config.js

@@ -28,7 +28,7 @@ module.exports = {
         // target: 'http://124.71.68.31:50001',
         // target: 'http://192.168.1.105:18086',
         // target: 'http://192.168.1.251:18186',
-        target: 'http://192.168.1.251:18186',
+        target: 'http://192.168.1.113:18086',
         changeOrigin: true, // 只有这个值为true的情况下 才表示开启跨域
         pathRewrite: {
           '^/api': ''

Fișier diff suprimat deoarece este prea mare
+ 308 - 308
yarn.lock


Unele fișiere nu au fost afișate deoarece prea multe fișiere au fost modificate în acest diff