aamin 2 лет назад
Родитель
Сommit
343e821628

+ 1 - 1
houtai/src/pages/A3User/index.tsx

@@ -266,7 +266,7 @@ function A3User() {
   return (
     <div className={styles.A3User}>
       <div className="userTop">
-        <div className="pageTitle">用户管理</div>
+        <div className="pageTitle">后台账号</div>
         <div className="selectBox">
           <div className="selectBoxRow">
             <span>用户昵称:</span>

+ 5 - 0
houtai/src/pages/A4Prize/index.module.scss

@@ -0,0 +1,5 @@
+.AAAAA{
+  :global{
+    
+  }
+}

+ 14 - 0
houtai/src/pages/A4Prize/index.tsx

@@ -0,0 +1,14 @@
+import React from "react";
+import styles from "./index.module.scss";
+ function AAAAA() {
+  
+  return (
+    <div className={styles.AAAAA}>
+      <h1>AAAAA</h1>
+    </div>
+  )
+}
+
+const MemoAAAAA = React.memo(AAAAA);
+
+export default MemoAAAAA;

+ 5 - 0
houtai/src/pages/A5Exchange/index.module.scss

@@ -0,0 +1,5 @@
+.AAAAA{
+  :global{
+    
+  }
+}

+ 14 - 0
houtai/src/pages/A5Exchange/index.tsx

@@ -0,0 +1,14 @@
+import React from "react";
+import styles from "./index.module.scss";
+ function AAAAA() {
+  
+  return (
+    <div className={styles.AAAAA}>
+      <h1>AAAAA</h1>
+    </div>
+  )
+}
+
+const MemoAAAAA = React.memo(AAAAA);
+
+export default MemoAAAAA;

+ 5 - 0
houtai/src/pages/A6IDUser/index.module.scss

@@ -0,0 +1,5 @@
+.AAAAA{
+  :global{
+    
+  }
+}

+ 14 - 0
houtai/src/pages/A6IDUser/index.tsx

@@ -0,0 +1,14 @@
+import React from "react";
+import styles from "./index.module.scss";
+ function AAAAA() {
+  
+  return (
+    <div className={styles.AAAAA}>
+      <h1>AAAAA</h1>
+    </div>
+  )
+}
+
+const MemoAAAAA = React.memo(AAAAA);
+
+export default MemoAAAAA;

+ 30 - 0
houtai/src/pages/C7Log/index.module.scss

@@ -0,0 +1,30 @@
+.C2Log {
+  :global {
+    .logTop {
+      border-radius: 10px;
+      background-color: #fff;
+
+      .tableSelectBox {
+        padding: 15px 24px;
+        display: flex;
+        align-items: center;
+
+        .row {
+          margin-right: 20px;
+        }
+      }
+    }
+
+    .tableMain {
+      border-radius: 10px;
+      margin-top: 15px;
+      height: calc(100% - 75px);
+      background-color: #fff;
+
+      .ant-table-body {
+        height: 625px;
+
+      }
+    }
+  }
+}

+ 138 - 0
houtai/src/pages/C7Log/index.tsx

@@ -0,0 +1,138 @@
+import { RootState } from "@/store";
+import { getLogListAPI } from "@/store/action/A7Log";
+import { Input, DatePicker, Table } from "antd";
+import React, { useEffect, useMemo, useRef, useState } from "react";
+import { useDispatch, useSelector } from "react-redux";
+
+import styles from "./index.module.scss";
+
+const { RangePicker } = DatePicker;
+
+function C2Log() {
+  const dispatch = useDispatch();
+
+  const pageNumRef = useRef(1);
+  const pagePageRef = useRef(10);
+  // 筛选和分页
+  const [tableSelect, setTableSelect] = useState({
+    searchKey: "",
+    pageSize: 10,
+    pageNum: 1,
+    startTime: "",
+    endTime: "",
+  });
+
+  // 账号的输入
+  const nameTime = useRef(-1);
+  const nameChange = (e: React.ChangeEvent<HTMLInputElement>) => {
+    clearTimeout(nameTime.current);
+    nameTime.current = window.setTimeout(() => {
+      setTableSelect({ ...tableSelect, searchKey: e.target.value, pageNum: 1 });
+    }, 500);
+  };
+  // 时间选择器改变
+  const timeChange = (date: any, dateString: any) => {
+    let startTime = "";
+    let endTime = "";
+    if (dateString[0] && dateString[1]) {
+      startTime = dateString[0] + " 00:00:00";
+      endTime = dateString[1] + " 23:59:59";
+    }
+    setTableSelect({ ...tableSelect, startTime, endTime, pageNum: 1 });
+  };
+
+  useEffect(() => {
+    pageNumRef.current = tableSelect.pageNum;
+    pagePageRef.current = tableSelect.pageSize;
+    dispatch(getLogListAPI(tableSelect));
+  }, [dispatch, tableSelect]);
+
+  // ---------关于表格
+
+  // 页码变化
+  const paginationChange = (pageNum: number, pageSize: number) => {
+    pageNumRef.current = pageNum;
+    pagePageRef.current = pageSize;
+    setTableSelect({ ...tableSelect, pageNum, pageSize });
+  };
+
+  const results = useSelector((state: RootState) => state.A7Log.tableInfo);
+
+  const columns = useMemo(() => {
+    return [
+      {
+        width: 100,
+        title: "序号",
+        render: (text: any, record: any, index: any) =>
+          index + 1 + (pageNumRef.current - 1) * pagePageRef.current,
+      },
+      {
+        title: "操作者",
+        dataIndex: "userName",
+      },
+      {
+        title: "操作日期",
+        dataIndex: "createTime",
+      },
+      {
+        title: "IP记录",
+        dataIndex: "ip",
+      },
+      {
+        title: "操作模块",
+        dataIndex: "type",
+      },
+      {
+        title: "操作事件",
+        dataIndex: "description",
+      },
+    ];
+  }, []);
+
+  return (
+    <div className={styles.C2Log}>
+      <div className="pageTitle">系统日志</div>
+      <div className="logTop">
+        <div className="tableSelectBox">
+          <div className="row">
+            <span>操作者:</span>
+            <Input
+              maxLength={15}
+              style={{ width: 150 }}
+              placeholder="请输入"
+              allowClear
+              onChange={(e) => nameChange(e)}
+            />
+          </div>
+          <div className="row">
+            <span>操作日期:</span>
+            <RangePicker onChange={timeChange} />
+          </div>
+        </div>
+      </div>
+
+      {/* 表格主体 */}
+      <div className="tableMain">
+        <Table
+          scroll={{ y: 625 }}
+          dataSource={results.list}
+          columns={columns}
+          rowKey="id"
+          pagination={{
+            showQuickJumper: true,
+            position: ["bottomCenter"],
+            showSizeChanger: true,
+            current: tableSelect.pageNum,
+            pageSize: tableSelect.pageSize,
+            total: results.total,
+            onChange: paginationChange,
+          }}
+        />
+      </div>
+    </div>
+  );
+}
+
+const MemoC2Log = React.memo(C2Log);
+
+export default MemoC2Log;

+ 54 - 11
houtai/src/pages/Layout/index.tsx

@@ -34,13 +34,46 @@ function Layout() {
   const listTemp = useMemo(() => {
     const arr: RouterType = [
       {
-        id: 100,
-        name: "数据管理",
+        id: 101,
+        name: "规则管理",
         path: "/",
+        Com: React.lazy(() => import("../A1Rule")),
+        inco: inco3,
+        done: true,
+      },
+      {
+        id: 102,
+        name: "奖品管理",
+        path: "/prize",
+        Com: React.lazy(() => import("../A4Prize")),
+        inco: inco1,
+        done: true,
+      },
+      {
+        id: 100,
+        name: "积分记录",
+        path: "/integral",
         Com: React.lazy(() => import("../A2Integral")),
         inco: inco1,
         done: true,
       },
+
+      {
+        id: 103,
+        name: "兑换记录",
+        path: "/exchange",
+        Com: React.lazy(() => import("../A5Exchange")),
+        inco: inco1,
+        done: true,
+      },
+      {
+        id: 104,
+        name: "用户管理",
+        path: "/idUser",
+        Com: React.lazy(() => import("../A6IDUser")),
+        inco: inco1,
+        done: true,
+      },
     ];
     return arr;
   }, []);
@@ -54,14 +87,24 @@ function Layout() {
     // 如果是超级管理员
     const userInfo = getTokenInfo().user;
     if (userInfo.isAdmin === 1) {
-      listTemp.push({
-        id: 300,
-        name: "用户管理",
-        path: "/user",
-        Com: React.lazy(() => import("../A3User")),
-        inco: inco3,
-        done: true,
-      });
+      listTemp.push(
+        {
+          id: 300,
+          name: "后台账号",
+          path: "/user",
+          Com: React.lazy(() => import("../A3User")),
+          inco: inco3,
+          done: true,
+        },
+        {
+          id: 309,
+          name: "系统日志",
+          path: "/log",
+          Com: React.lazy(() => import("../C7Log")),
+          inco: inco3,
+          done: true,
+        }
+      );
     }
   }, [listTemp]);
 
@@ -174,7 +217,7 @@ function Layout() {
                 okText="确定"
                 cancelText="取消"
                 onConfirm={loginExit}
-                okButtonProps={{loading: false}}
+                okButtonProps={{ loading: false }}
               >
                 退出登录
               </Popconfirm>

+ 23 - 0
houtai/src/store/action/A4Prise.ts

@@ -0,0 +1,23 @@
+import http from "@/utils/http";
+import { AppDispatch } from "..";
+// import { AxiosRequestConfig } from "axios";
+/**
+ * 获取浏览量信息
+ */
+export const getShareAPI = () => {
+  return async (dispatch: AppDispatch) => {
+    const res = await http.get(`cms/share/detail/museum_cctv_mianyan`);
+    if (res.code === 0) {
+      const data = res.data;
+      dispatch({ type: "Share/getShare", payload: data });
+    }
+  };
+};
+
+/**
+ * 提交参与者基数
+ */
+export const shareEditAPI = (data: any) => {
+  // return http.post(`/cms/share/save/`, data);
+  return http.post(`cms/share/edit/`, data);
+};

+ 17 - 0
houtai/src/store/action/A7Log.ts

@@ -0,0 +1,17 @@
+import http from "@/utils/http";
+import { AppDispatch } from "..";
+/**
+ * 获取日志表格列表
+ */
+export const getLogListAPI = (data: any) => {
+  return async (dispatch: AppDispatch) => {
+    const res = await http.post("sys/log/list", data);
+    if (res.code === 0) {
+      const obj = {
+        list: res.data.records,
+        total: res.data.total,
+      };
+      dispatch({ type: "log/getList", payload: obj });
+    }
+  };
+};

+ 30 - 0
houtai/src/store/reducer/A4Prise.ts

@@ -0,0 +1,30 @@
+import { GoodsTableType } from "@/types";
+
+// 初始化状态
+const initState = {
+  // 列表数据
+  tableInfo: {
+    list: [] as GoodsTableType[],
+    total: 0,
+  },
+};
+
+// 定义 action 类型
+type GoodsActionType = {
+  type: "goods/getList";
+  payload: { list: GoodsTableType[]; total: number };
+};
+
+// 频道 reducer
+export default function goodsReducer(
+  state = initState,
+  action: GoodsActionType
+) {
+  switch (action.type) {
+    // 获取列表数据
+    case "goods/getList":
+      return { ...state, tableInfo: action.payload };
+    default:
+      return state;
+  }
+}

houtai/src/store/reducer/A5Log.ts → houtai/src/store/reducer/A7Log.ts


+ 2 - 2
houtai/src/store/reducer/index.ts

@@ -6,7 +6,7 @@ import { combineReducers } from 'redux'
 import A1Rule from './A1Rule'
 import A0Layout from './layout'
 import A3User from './A3User'
-import A5Log from './A5Log'
+import A7Log from './A7Log'
 import A2Integral from './A2Integral'
 
 // 合并 reducer
@@ -14,7 +14,7 @@ const rootReducer = combineReducers({
   A1Rule,
   A0Layout,
   A3User,
-  A5Log,
+  A7Log,
   A2Integral
 })