xiaodai2022 2 years ago
parent
commit
bedef9c3c3
6 changed files with 29 additions and 34 deletions
  1. 1 3
      src/apis/url-config.js
  2. 4 4
      src/apis/user/index.js
  3. 1 1
      src/apis/userAxios.js
  4. 0 1
      src/config/env.company.js
  5. 10 25
      src/store/modules/user.js
  6. 13 0
      src/utils/auth.js

+ 1 - 3
src/apis/url-config.js

@@ -6,11 +6,9 @@ import {
   loginBeian,
   loginBeianUrl,
 } from "@/config";
-const { userApi, baseApi } = api;
+const { baseApi } = api;
 const { CorpId, AgentId } = ding;
 export default {
-  //后端user接口url
-  userURL: userApi,
   //后端接口url
   baseURL: baseApi,
   //企业id

+ 4 - 4
src/apis/user/index.js

@@ -3,7 +3,7 @@ import urlConfig from "@/apis/url-config";
 // 登录
 export function login(data) {
   return http({
-    url: `${urlConfig.userURL}admin/login`,
+    url: `${urlConfig.baseURL}admin/login`,
     method: "post",
     data,
   });
@@ -11,7 +11,7 @@ export function login(data) {
 // 获取个人信息
 export function userinfo(data) {
   return http({
-    url: `${urlConfig.userURL}admin/userinfo`,
+    url: `${urlConfig.baseURL}admin/userinfo`,
     method: "post",
     data,
   });
@@ -27,7 +27,7 @@ export function menuList(data) {
 // 钉钉获取用户信息
 export function dingdingdetail(data) {
   return http({
-    url: `${urlConfig.userURL}Api/dintalk`,
+    url: `${urlConfig.baseURL}Api/dintalk`,
     method: "post",
     data,
   });
@@ -35,7 +35,7 @@ export function dingdingdetail(data) {
 // 获取账号详情
 export function usergetinfo(data) {
   return http({
-    url: `${urlConfig.userURL}admin/userinfo`,
+    url: `${urlConfig.baseURL}admin/userinfo`,
     method: "post",
     data,
   });

+ 1 - 1
src/apis/userAxios.js

@@ -25,7 +25,7 @@ export default async (
   const obj = {
     method: type,
     baseURL: '',
-    url: urlConfig.userURL + url,
+    url: urlConfig.baseURL + url,
     data,
     params,
     // // `onUploadProgress` 允许为上传处理进度事件

+ 0 - 1
src/config/env.company.js

@@ -3,7 +3,6 @@ module.exports = {
   title: '采销平台',
   baseUrl: 'http://wx.wxhr.sit.futurelab.tv',
   api: {
-    userApi: 'http://stockinv.test241.wanyuhengtong.com/',
     baseApi: 'http://stocknew.test241.wanyuhengtong.com/',
   },
   webUrl:'http://project.web.caixiao365.com/#/good-share?id=',

+ 10 - 25
src/store/modules/user.js

@@ -29,6 +29,9 @@ import {
   get_action_data,
   set_action_data,
   remove_action_data,
+  get_role_level,
+  set_role_level,
+  remove_role_level,
 } from "@/utils/auth";
 import store from "..";
 const state = {
@@ -39,6 +42,7 @@ const state = {
   roles: ["admin"],
   btnList: getBtn(),
   navList: getMenu(),
+  role_level:get_role_level() || "1",
   business_company: get_business_company() || "",
   business_companyNo: get_business_companyNo() || "",
   private_field: get_private_field() || [],
@@ -66,13 +70,6 @@ const mutations = {
   SET_ROLES: (state, roles) => {
     state.roles = roles;
   },
-  // mainListFn(state, val) {
-  //   if (!val) {
-  //     val = [];
-  //   }
-  //   state.mainList = val;
-  //   setMainList(val)
-  // },
   navListFn(state, val) {
     if (!val) {
       val = [];
@@ -157,23 +154,13 @@ const actions = {
         } else if (ucode !== 0) {
           resolve({ code: ucode, data: udata, massage: umsg });
         } else {
-          const { business, private_field, roleid } = udata;
-          let business_company = "",
-            business_companyNo = "";
-          if (business && business.length > 0) {
-            business.forEach((e) => {
-              if (e.is_main === "1") {
-                business_company = e.company;
-                business_companyNo = e.companyNo;
-              }
-            });
-          }
-          // 保存默认业务公司名称
-          commit("business_company", business_company);
-          // 保存默认业务公司编号
-          commit("business_companyNo", business_companyNo);
+        
+          // // 保存默认业务公司名称
+          // commit("business_company", business_company);
+          // // 保存默认业务公司编号
+          // commit("business_companyNo", business_companyNo);
           // 关键字段设置
-          commit("private_field", private_field === "" ? [] : private_field);
+          // commit("private_field", private_field === "" ? [] : private_field);
           // const { pcode, pdata, pmsg } = await getRoleProcess(roleid);
           // if (pcode >= 100 && pcode <= 104) {
           //   resolve("noToken");
@@ -189,14 +176,12 @@ const actions = {
               resolve({ code: mcodd, data: {}, massage: mmsg });
             } else {
               const { arrag, isok, btnList } = mdata;
-
               // 生成页面权限
               commit("navListFn", arrag);
               // 生成按钮权限
               commit("btnListFn", btnList);
               // 生成路由
               initRouter(arrag, that);
-              // state.commit("loginInfoCommit", res.data);
               resolve(isok ? "success-dataV" : "success");
             }
           // }

+ 13 - 0
src/utils/auth.js

@@ -9,6 +9,7 @@ const businessCompanyKey = "Purchase-Console-businessCompany";
 const businessCompanyNoKey = "Purchase-Console-businessCompanyNo";
 const privateFieldKey = "Purchase-Console-privateField";
 const actionDataKey = "Purchase-Console-actionData";
+const roleLevelKey="Purchase-Console-roleLevel";
 export function getToken() {
   return Cookies.get(TokenKey);
 }
@@ -120,3 +121,15 @@ export function set_action_data(has) {
 export function remove_action_data() {
   return Cookies.remove(actionDataKey);
 }
+
+export function get_role_level() {
+  return Cookies.get(roleLevelKey);
+}
+
+export function set_role_level(has) {
+  return Cookies.set(roleLevelKey, has);
+}
+
+export function remove_role_level() {
+  return Cookies.remove(roleLevelKey);
+}