Ver código fonte

vue 20241226 页面 修改

贾小兵 5 meses atrás
pai
commit
239d2eb92b

+ 8 - 0
ruoyi-ui/src/api/login.js

@@ -57,4 +57,12 @@ export function getCodeImg() {
     method: 'get',
     timeout: 20000
   })
+}
+
+// 获取用户登陆账号角色info
+export function getroleinfo() {
+  return request({
+    url: '/sim/add-on-user/roleInfo/',
+    method: 'get'
+  })
 }

+ 13 - 13
ruoyi-ui/src/router/index.js

@@ -61,19 +61,19 @@ export const constantRoutes = [
     component: () => import('@/views/error/401'),
     hidden: true
   },
-  {
-    path: '',
-    component: Layout,
-    redirect: 'index',
-    children: [
-      {
-        path: 'index',
-        component: () => import('@/views/system/user/profile/index'),
-        name: 'Index',
-        meta: { title: '个人中心', icon: 'dashboard', affix: true }
-      }
-    ]
-  },
+  // {
+  //   path: '',
+  //   component: Layout,
+  //   redirect: 'index',
+  //   children: [
+  //     {
+  //       path: 'index',
+  //       component: () => import('@/views/system/user/profile/index'),
+  //       name: 'Index',
+  //       meta: { title: '个人中心', icon: 'dashboard', affix: true }
+  //     }
+  //   ]
+  // },
   {
     path: '/user',
     component: Layout,

+ 15 - 9
ruoyi-ui/src/views/login.vue

@@ -63,7 +63,7 @@
 </template>
 
 <script>
-import { getCodeImg } from "@/api/login";
+import { getCodeImg,getroleinfo,getInfo } from "@/api/login";
 import Cookies from "js-cookie";
 import { encrypt, decrypt } from '@/utils/jsencrypt'
 
@@ -145,14 +145,20 @@ export default {
           console.log(this.loginForm.code)
           console.log('this.loginForm.code')
           this.$store.dispatch("Login", this.loginForm).then((res) => {
-            // console.log(res.username)
-            // console.log('res.username')
-            // console.log(res.code)
-            // console.log(this.loginForm)
-            // console.log('this.loginForm')
-            // console.log(this.redirect)
-            // console.log('this.redirect')
-            this.$router.push({ path: this.redirect || "/" }).catch(()=>{});
+
+            getroleinfo().then(res => {
+              if(res.code=200){
+                // 学员登录成功跳转
+                if(res.data.roleId==101){
+                  this.$router.push({ path: "exam/exam" }).catch(()=>{});
+                }
+                // 教师和管理列表、超管
+                if(res.data.roleId==100 || res.data.roleId==102 || res.data.roleId==1){
+                  this.$router.push({ path: "score" }).catch(()=>{});
+                }
+              } 
+            });
+            // this.$router.push({ path: this.redirect || "/" }).catch(()=>{});
           }).catch(() => {
             this.loading = false;
             if (this.captchaEnabled) {

+ 3 - 3
ruoyi-ui/src/views/system/dept/index.vue

@@ -214,9 +214,9 @@ export default {
         deptName: [
           { required: true, message: "名称不能为空", trigger: "blur" }
         ],
-        orderNum: [
-          { required: true, message: "显示排序不能为空", trigger: "blur" }
-        ],
+        // orderNum: [
+        //   { required: true, message: "显示排序不能为空", trigger: "blur" }
+        // ],
         // email: [
         //   {
         //     type: "email",

+ 1 - 38
ruoyi-ui/src/views/teacher/index.vue

@@ -98,7 +98,6 @@
           </el-col>
           <right-toolbar :showSearch.sync="showSearch" @queryTable="getList" :columns="columns"></right-toolbar>
         </el-row>
-
         <el-table v-loading="loading" :data="userList" @selection-change="handleSelectionChange">
           <el-table-column type="selection" width="50" align="center" />
           <el-table-column label="编号" align="center" key="userId" prop="userId" v-if="columns[0].visible"  width="80"/>
@@ -226,11 +225,10 @@
 <script>
 import { listTeacher, getTeacher, delTeacher, addTeacher, updateTeacher } from "@/api/sim/teacher";
 import { resetUserPwd, changeUserStatus } from "@/api/system/user";
-import { getToken } from "@/utils/auth";
 
 export default {
   name: "Teacher",
-  dicts: ['sys_normal_disable', 'sys_user_sex'],
+  dicts: ['sys_normal_disable'],
   data() {
     return {
       // 遮罩层
@@ -249,41 +247,18 @@ export default {
       userList: null,
       // 弹出层标题
       title: "",
-      // 部门树选项
-      deptOptions: undefined,
       // 是否显示弹出层
       open: false,
-      // 部门名称
-      deptName: undefined,
       // 默认密码
       initPassword: undefined,
       // 日期范围
       dateRange: [],
-      // 岗位选项
-      postOptions: [],
-      // 角色选项
-      roleOptions: [],
       // 表单参数
       form: {},
       defaultProps: {
         children: "children",
         label: "label"
       },
-      // 用户导入参数
-      upload: {
-        // 是否显示弹出层(用户导入)
-        open: false,
-        // 弹出层标题(用户导入)
-        title: "",
-        // 是否禁用上传
-        isUploading: false,
-        // 是否更新已经存在的用户数据
-        updateSupport: 0,
-        // 设置上传的请求头部
-        headers: { Authorization: "Bearer " + getToken() },
-        // 上传的地址
-        url: process.env.VUE_APP_BASE_API + "/system/user/importData"
-      },
       // 查询参数
       queryParams: {
         pageNum: 1,
@@ -370,8 +345,6 @@ export default {
         phonenumber: undefined,
         status: "0",
         remark: undefined,
-        postIds: [],
-        roleIds: []
       };
       this.resetForm("form");
     },
@@ -384,7 +357,6 @@ export default {
     resetQuery() {
       this.dateRange = [];
       this.resetForm("queryForm");
-      this.$refs.tree.setCurrentKey(null);
       this.handleQuery();
     },
     // 多选框选中数据
@@ -409,13 +381,9 @@ export default {
     /** 新增按钮操作 */
     handleAdd() {
       this.reset();
-      // getUser().then(response => {
-      //   this.postOptions = response.posts;
-      //   this.roleOptions = response.roles;
         this.open = true;
         this.title = "添加教师";
         this.form.password = this.initPassword;
-      // });
     },
     /** 修改按钮操作 */
     handleUpdate(row) {
@@ -423,13 +391,8 @@ export default {
       const userId = row.userId || this.ids;
       getTeacher(userId).then(response => {
         this.form = response.data;
-        // this.postOptions = response.posts;
-        // this.roleOptions = response.roles;
-        // this.$set(this.form, "postIds", response.postIds);
-        // this.$set(this.form, "roleIds", response.roleIds);
         this.open = true;
         this.title = "修改";
-        // this.form.password = "";
       });
     },
     /** 重置密码按钮操作 */