소스 검색

修改部分

tangning 3 년 전
부모
커밋
080dab2a41

+ 17 - 0
mock/sys/user.ts

@@ -35,6 +35,22 @@ export function createFakeUserList() {
         },
       ],
     },
+    {
+      userId: '2',
+      username: 'test',
+      password: '123456',
+      realName: 'test user',
+      avatar: 'https://q1.qlogo.cn/g?b=qq&nk=339449197&s=640',
+      desc: 'tester',
+      token: 'eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJsb2dpblR5cGUiOiJsb2dpbiIsImxvZ2luSWQiOjEsImRldmljZSI6ImRlZmF1bHQtZGV2aWNlIiwiZWZmIjotMSwicm5TdHIiOiJ6ZjI5a0k2V3RuaXZWeUMzall6NTRzM2ZVSVdSNEdUNSIsInVzZXJJZCI6MSwiaXNBZG1pbiI6MSwidXNlck5hbWUiOiJzdXBlci1hZG1pbiIsIm5pY2tOYW1lIjoic3VwZXItYWRtaW4ifQ.6Ax289ca_YfMnTs9Q5DtBIE3iVfD4cgVVnSRjeXfOuI',
+      homePath: '/dashboard/workbench',
+      roles: [
+        {
+          roleName: 'Tester',
+          value: 'test',
+        },
+      ],
+    },
   ];
 }
 
@@ -51,6 +67,7 @@ export default [
     method: 'post',
     response: ({ body }) => {
       const { username, password } = body;
+      console.log('token',body)
       const checkUser = createFakeUserList().find(
         (item) => item.username === username && password === item.password,
       );

+ 9 - 4
src/api/sys/user.ts

@@ -1,11 +1,12 @@
 import { defHttp } from '/@/utils/http/axios';
 import { LoginParams, LoginResultModel, GetUserInfoModel } from './model/userModel';
-
+import { encodeStr } from '/@/utils/encodeUtil';
 import { ErrorMessageMode } from '/#/axios';
 
 enum Api {
-  Login = '/basic-api/login',
-  Logout = '/logout',
+  // Login = '/basic-api/login',
+  Login = '/newV4/service/manage/login',
+  Logout = '/basic-api/ogout',
   GetUserInfo = '/basic-api/getUserInfo',
   GetPermCode = '/getPermCode',
 }
@@ -17,7 +18,11 @@ export function loginApi(params: LoginParams, mode: ErrorMessageMode = 'modal')
   return defHttp.post<LoginResultModel>(
     {
       url: Api.Login,
-      params,
+      params:{
+        ...params,
+        userName:params.username,
+        password: encodeStr(window.btoa(params.password))
+    },
     },
     {
       errorMessageMode: mode,

+ 1 - 1
src/locales/lang/zh-CN/routes/dashboard.ts

@@ -8,6 +8,7 @@ export default {
   operateNews: '新闻管理',
   operateRecruit: '招聘管理',
   operateMessage: '留言管理',
+  product: '产品管理',
   invoice: '发票管理',
   orderCamera: '相机订单',
   orderList: '订单管理',
@@ -28,7 +29,6 @@ export default {
   scenesLive: '直播',
   scenesRoom: '房间管理',
   devices: '设备管理',
-  product: '商品管理',
   productRef: '商品属性',
   productList: '商品列表',
   productCategory: '商品分类',

+ 3 - 3
src/router/routes/modules/invoice.ts

@@ -5,7 +5,7 @@ import { LAYOUT } from '/@/router/constant';
 export const InvoiceRoute: AppRouteRecordRaw = {
   path: '/invoice',
   name: 'Invoice',
-  redirect: '/invoice/index',
+  redirect: '/invoice/list',
   component: LAYOUT,
   meta: {
     title: t('routes.dashboard.invoice'),
@@ -15,8 +15,8 @@ export const InvoiceRoute: AppRouteRecordRaw = {
   },
   children: [
     {
-      path: 'index',
-      name: 'index',
+      path: 'list',
+      name: 'List',
       component: () => import('/@/views/invoice/index.vue'),
       meta: {
         title: t('routes.dashboard.invoice'),

+ 26 - 0
src/router/routes/modules/product.ts

@@ -0,0 +1,26 @@
+import type { AppRouteRecordRaw } from '/@/router/types';
+import { t } from '/@/hooks/web/useI18n';
+import { LAYOUT } from '/@/router/constant';
+
+export const ProductRoute: AppRouteRecordRaw = {
+  path: '/product',
+  name: 'Product',
+  redirect: '/product/index',
+  component: LAYOUT,
+  meta: {
+    title: t('routes.dashboard.product'),
+    icon: 'la:file-invoice-dollar',
+    orderNo: 20,
+  },
+  children: [
+    {
+      path: 'index',
+      name: 'index',
+      component: () => import('/@/views/invoice/index.vue'),
+      meta: {
+        title: t('routes.dashboard.product'),
+      },
+    },
+  ],
+};
+export default ProductRoute;

+ 99 - 0
src/utils/encodeUtil.ts

@@ -0,0 +1,99 @@
+/*
+ ** 登录密码加密
+  http://face3d.4dage.com:7005/4dzfb-2.0/shop/src/master/platform-admin/src/main/webapp/login.html
+ */
+function randomWord(randomFlag, min, max?) {
+  let str = '';
+  let range = min;
+  const arr = [
+    '0',
+    '1',
+    '2',
+    '3',
+    '4',
+    '5',
+    '6',
+    '7',
+    '8',
+    '9',
+    'a',
+    'b',
+    'c',
+    'd',
+    'e',
+    'f',
+    'g',
+    'h',
+    'i',
+    'j',
+    'k',
+    'l',
+    'm',
+    'n',
+    'o',
+    'p',
+    'q',
+    'r',
+    's',
+    't',
+    'u',
+    'v',
+    'w',
+    'x',
+    'y',
+    'z',
+    'A',
+    'B',
+    'C',
+    'D',
+    'E',
+    'F',
+    'G',
+    'H',
+    'I',
+    'J',
+    'K',
+    'L',
+    'M',
+    'N',
+    'O',
+    'P',
+    'Q',
+    'R',
+    'S',
+    'T',
+    'U',
+    'V',
+    'W',
+    'X',
+    'Y',
+    'Z',
+  ];
+  // 随机产生
+  if (randomFlag) {
+    range = Math.round(Math.random() * (max - min)) + min;
+  }
+  for (let i = 0; i < range; i++) {
+    const pos = Math.round(Math.random() * (arr.length - 1));
+    str += arr[pos];
+  }
+  return str;
+}
+
+export function encodeStr(str, strv = ''): string {
+  const NUM = 2;
+  const front = randomWord(false, 8);
+  const middle = randomWord(false, 8);
+  const end = randomWord(false, 8);
+
+  const str1 = str.substring(0, NUM);
+  const str2 = str.substring(NUM);
+
+  if (strv) {
+    const strv1 = strv.substring(0, NUM);
+    const strv2 = strv.substring(NUM);
+    return [front + str2 + middle + str1 + end, front + strv2 + middle + strv1 + end];
+  }
+
+  return front + str2 + middle + str1 + end;
+}

+ 2 - 2
src/views/sys/login/LoginForm.vue

@@ -119,8 +119,8 @@
   const rememberMe = ref(false);
 
   const formData = reactive({
-    account: 'vben',
-    password: '123456',
+    account: 'super-admin',
+    password: 'Aa123456',
   });
 
   const { validForm } = useFormValid(formRef);