Browse Source

完成能耗管理接口

hzj18279462576@163.com 2 years ago
parent
commit
fbf14c0031

+ 1 - 1
index.html

@@ -13,7 +13,7 @@
 
   <body>
     <div id="app"></div>
-    <script src="https://res.wx.qq.com/connect/zh_CN/htmledition/js/wxLogin.js"></script>
+    <!-- <script src="https://res.wx.qq.com/connect/zh_CN/htmledition/js/wxLogin.js"></script> -->
     <script type="module" src="/src/main.js"></script>
   </body>
 </html>

+ 2 - 2
src/layout/sidebar/Navbar.vue

@@ -53,12 +53,12 @@
           </el-avatar>
           <template #dropdown>
             <el-dropdown-menu>
-              <el-dropdown-item @click="uppassword">
+              <!-- <el-dropdown-item @click="uppassword">
                 <el-icon class="switchButton" :size="20" color="#000">
                   <Lock />
                 </el-icon>
                 <span>修改密码</span>
-              </el-dropdown-item>
+              </el-dropdown-item> -->
               <el-dialog
                 :append-to-body="true"
                 custom-class="pw"

+ 11 - 7
src/router/index.js

@@ -6,14 +6,18 @@ import {
 import Layout from "@/layout/index.vue";
 import store from "@/store";
 import { ElMessage, ElMessageBox } from "element-plus";
-import NProgress from 'nprogress'
-import 'nprogress/nprogress.css'
+import NProgress from "nprogress";
+import "nprogress/nprogress.css";
 const routes = [
   {
     path: "/login",
     component: () => import("@/views/login/index.vue"),
   },
   {
+    path: "/bind",
+    component: () => import("@/views/login/bind.vue"),
+  },
+  {
     path: "/",
     redirect: "/login",
   },
@@ -122,14 +126,14 @@ const routes = [
   },
 ];
 const router = createRouter({
-  // history: createWebHashHistory("/business"), // 线上地址
+  // history: createWebHistory("/smartManage"), // 线上地址
   history: createWebHashHistory("/smartManage"), // 测试环境发布地址
   // history: createWebHashHistory("/hotelReservation/pc3/"), // 测试环境发布地址
   routes: routes,
 });
 
 router.beforeEach(async (to, from, next) => {
-  NProgress.start() // 进度条开始
+  NProgress.start(); // 进度条开始
   // let hasRoutes = store.state.user.hasRoutes;
   // if (sessionStorage.getItem("token")) {
   //   if (!hasRoutes || to.path == "/login") {
@@ -176,6 +180,6 @@ router.beforeEach(async (to, from, next) => {
 });
 
 router.afterEach(() => {
-  NProgress.done() // 进度条结束
-})
-export default router;
+  NProgress.done(); // 进度条结束
+});
+export default router;

+ 11 - 8
src/views/apply/apply.vue

@@ -4,7 +4,7 @@
       <!-- <el-icon :size="23" class="camera"><VideoCameraFilled /></el-icon> -->
       <span class="cameratxt">应用管理</span>
     </div>
-    <div style="overflow: auto">
+    <div class="scrollId">
       <div class="middle">
         <div class="filter">
           <el-button
@@ -42,7 +42,7 @@
           <el-table-column align="center" label="操作" width="200">
             <template #default="scope">
               <div class="edit">
-                <div class="look" @click="applyClick(scope.row)">打开项目</div>
+                <!-- <div class="look" @click="applyClick(scope.row)">打开项目</div> -->
                 <div class="look" @click="editClick(scope.row)">编辑</div>
                 <el-popconfirm
                   width="220"
@@ -409,7 +409,7 @@ const typeSel = () => {
 const handleChange = (file, fileLists) => {
   console.log(file, "file11111");
   if (file.raw.type == "image/jpeg" || file.raw.type == "image/png") {
-    if (file.size /1024 > 50) {
+    if (file.size / 1024 > 50) {
       ElMessage.error("图片的大小不能超过50Kb!");
     } else {
       if (file.raw) {
@@ -656,7 +656,10 @@ onBeforeMount(async () => {
       color: rgba(111, 182, 184, 1);
     }
   }
-
+  .scrollId {
+    overflow: auto;
+    height: calc(100% - 61px);
+  }
   .middle {
     width: 96%;
     margin: 0 auto;
@@ -724,12 +727,12 @@ onBeforeMount(async () => {
 
   .footer {
     width: 96%;
-    // height: 550px;
+    height: calc(100% - 170px);
+    min-height: 300px;
     margin: 10px auto 30px;
 
     .el-table--fit {
-      // height: 100%;
-
+      height: 100%;
       :deep(.el-table__header-wrapper) {
         background-color: #000;
         font-size: 14px;
@@ -823,7 +826,7 @@ onBeforeMount(async () => {
           cursor: pointer;
           user-select: none;
         }
-        .el-upload-list{
+        .el-upload-list {
           display: none;
         }
       }

+ 265 - 62
src/views/energy/energy.vue

@@ -12,11 +12,21 @@
           <div class="quantity_title">
             <div class="quantity">
               <div class="dosage">用电量</div>
-              <span class="num">7,865</span><span>kw/h</span>
+              <div class="num">
+                <el-col>
+                  <el-statistic title="" :value="getWaterTj" />
+                </el-col>
+                <div class="unit">kw/h</div>
+              </div>
             </div>
             <div class="quantity">
               <div class="dosage">用水量</div>
-              <span class="num">7,865</span><span>L</span>
+              <div class="num">
+                <el-col>
+                  <el-statistic title="" :value="getElcTj" />
+                </el-col>
+                <div class="unit">L</div>
+              </div>
             </div>
           </div>
         </div>
@@ -48,16 +58,23 @@
           <div class="title">区域能耗统计</div>
           <div class="table1Data">
             <div class="selInput">
-              <span>月份 : </span
-              ><el-select
+              <span>月份 : </span>
+              <!-- <el-select
                 v-model="tableSearch1"
                 class="m-2"
                 placeholder="请选择月份"
               >
-                <!-- size="small" -->
                 <el-option label="1月" value="1" />
                 <el-option label="2月" value="2" />
-              </el-select>
+              </el-select> -->
+              <el-date-picker
+                v-model="tableSearch1"
+                type="month"
+                placeholder="请选择月份"
+                format="YYYY-MM"
+                value-format="YYYY-MM"
+                @change="energyDissipation"
+              />
             </div>
             <el-table
               :row-class-name="tableRowClassName"
@@ -70,10 +87,10 @@
               }"
             >
               <el-table-column align="center " type="index" label="序号" />
-              <el-table-column align="center" prop="dian" label="电(kw/h)" />
-              <el-table-column align="center" prop="shui" label="水(L)" />
-              <el-table-column align="center" prop="build" label="楼栋" />
-              <el-table-column align="center" prop="month" label="月份" />
+              <el-table-column align="center" prop="eNum" label="电(kw/h)" />
+              <el-table-column align="center" prop="wNum" label="水(L)" />
+              <el-table-column align="center" prop="name" label="楼栋" />
+              <el-table-column align="center" prop="date" label="月份" />
             </el-table>
             <!-- 分页组件 -->
             <div class="pageSize">
@@ -102,6 +119,7 @@
                 value-format="YYYY-MM-DD"
                 :prefix-icon="Calendar"
                 placeholder="请选择日期"
+                @change="meterReading"
               />
             </div>
             <el-table
@@ -115,10 +133,10 @@
               }"
             >
               <el-table-column align="center " type="index" label="序号" />
-              <el-table-column align="center" prop="dian" label="电(kw/h)" />
-              <el-table-column align="center" prop="shui" label="水(L)" />
-              <el-table-column align="center" prop="build" label="楼栋" />
-              <el-table-column align="center" prop="month" label="通讯时间" />
+              <el-table-column align="center" prop="eNum" label="电(kw/h)" />
+              <el-table-column align="center" prop="wNum" label="水(L)" />
+              <el-table-column align="center" prop="name" label="楼栋" />
+              <el-table-column align="center" prop="date" label="通讯时间" />
             </el-table>
             <!-- 分页组件 -->
             <div class="pageSize">
@@ -130,7 +148,7 @@
                 :page-size="pageSize2"
                 layout="total, prev, pager, next, jumper, slot"
                 :total="total2"
-                @update:current-page="handleCurrentChange1"
+                @update:current-page="handleCurrentChange2"
               />
             </div>
           </div>
@@ -255,9 +273,13 @@ const router = useRouter();
 
 // 用户类别占比
 const category = shallowRef();
+const getWaterTj = ref(); // 水
+const getElcTj = ref(); // 电
 // 区域统计
 const areaTJEcharts = shallowRef();
-const areaInd = ref(1);
+const areaInd = ref(1); // 默认水
+const areaData = ref();
+const monthList = ref([]);
 
 // 区域能耗统计
 const tableSearch1 = ref(); // 月份搜索
@@ -302,10 +324,10 @@ const table1Data = reactive({
   ],
 });
 const currentPage1 = ref(1); // 当前页
-const pageSize1 = ref(5);
+const pageSize1 = ref(4);
 const total1 = ref(5); // 当前总数
 
-// 区域能耗统计
+// 实时抄表
 const tableSearch2 = ref(); // 月份搜索
 const table2Data = reactive({
   list: [
@@ -348,7 +370,7 @@ const table2Data = reactive({
   ],
 });
 const currentPage2 = ref(1); // 当前页
-const pageSize2 = ref(5);
+const pageSize2 = ref(4);
 const total2 = ref(5); // 当前总数
 
 // 用户类别占比
@@ -383,14 +405,14 @@ const echarts1 = async () => {
         },
         data: [
           {
-            value: 1048,
+            value: getElcTj.value,
             name: "用电",
             itemStyle: {
               color: "rgba(67, 181, 244, 1)",
             },
           },
           {
-            value: 580,
+            value: getWaterTj.value,
             name: "用水",
             itemStyle: {
               color: "#D4EDFB",
@@ -398,7 +420,7 @@ const echarts1 = async () => {
           },
           {
             // make an record to fill the bottom 50%
-            value: 1048 + 580,
+            value: getElcTj.value + getWaterTj.value,
             itemStyle: {
               // stop the chart from rendering this piece
               color: "none",
@@ -415,11 +437,106 @@ const echarts1 = async () => {
     ],
   });
 };
+// 根据页面缩放重置echarts图表
 const resizeChart = () => {
   category.value.resize();
   areaTJEcharts.value.resize();
 };
-// 区域统计
+
+// 获取用电量和用水量 (11111111111111111)
+const getWaterElc = async () => {
+  let res = await axios({
+    method: "post",
+    url: api.value + "/wanzai/api/wechat/getWaterTj",
+    data: data,
+  });
+  console.log(res, "用水量");
+  if (res.data.code == 200) {
+    getWaterTj.value = res.data.data.num;
+    nextTick(() => {
+      echarts1();
+    });
+  } else {
+    ElMessage({
+      type: "error",
+      showClose: true,
+      message: res.data.nessage,
+      center: true,
+    });
+  }
+  let ress = await axios({
+    method: "post",
+    url: api.value + "/wanzai/api/wechat/getWaterTj",
+    data: data,
+  });
+  console.log(ress, "用电量");
+  if (res.data.code == 200) {
+    getElcTj.value = ress.data.data.num;
+    // ElMessage({
+    //   type: "success",
+    //   showClose: true,
+    //   message: res.data.nessage,
+    //   center: true,
+    // });
+  } else {
+    ElMessage({
+      type: "error",
+      showClose: true,
+      message: res.data.nessage,
+      center: true,
+    });
+  }
+};
+// 获取区域统计数据 (22222222222222222222222)
+// 切换水/电
+const areaStatistics = (ind) => {
+  areaInd.value = ind;
+  getMonWaterElc();
+};
+const getMonWaterElc = async () => {
+  let res = "";
+  if (areaInd.value == 1) {
+    res = await axios({
+      method: "post",
+      url: api.value + "/wanzai/api/wechat/getMonWater",
+      data: data,
+    });
+  } else {
+    res = await axios({
+      method: "post",
+      url: api.value + "/wanzai/api/wechat/getMonElc",
+      data: data,
+    });
+  }
+  console.log(res, "水、电费查询");
+  if (res.data.code == 200) {
+    areaData.value = res.data.data;
+    monthList.value = [];
+    res.data.data.forEach((item) => {
+      monthList.value.push(item.date);
+      // item.It.forEach((i) => {});
+      // let arr = {
+      //   date: ["7月", "8月", "9月", "10月"],
+      //   It: [
+      //     { name: "教学楼", value: [2, 3, 2, 3] },
+      //     { name: "图书馆", value: [2, 3, 2, 3] },
+      //   ],
+      // };
+    });
+    console.log(monthList.value, "月份");
+    nextTick(() => {
+      echarts2();
+    });
+  } else {
+    ElMessage({
+      type: "error",
+      showClose: true,
+      message: res.data.nessage,
+      center: true,
+    });
+  }
+};
+// 区域统计图表
 const echarts2 = async () => {
   areaTJEcharts.value = echarts.init(document.getElementById("areaTJ"));
   areaTJEcharts.value.setOption({
@@ -494,7 +611,7 @@ const echarts2 = async () => {
       axisTick: {
         show: false,
       },
-      data: ["1月", "2月", "3月", "4月", "5月", "6月", "7月", "8月"],
+      data: monthList.value,
     },
     yAxis: {
       name: "吨/度",
@@ -546,30 +663,30 @@ const echarts2 = async () => {
           focus: "series",
         },
       },
-      {
-        type: "bar",
-        name: "食堂",
-        data: [102, 120, 105, 48, 75, 101, 103, 26],
-        itemStyle: {
-          color: "#B4E2FB",
-        },
-        barWidth: 20, // 柱子的宽度
-        emphasis: {
-          focus: "series",
-        },
-      },
-      {
-        type: "bar",
-        name: "其他",
-        data: [62, 120, 150, 88, 17, 211, 103, 66],
-        itemStyle: {
-          color: "#D4EDFB",
-        },
-        barWidth: 20, // 柱子的宽度
-        emphasis: {
-          focus: "series",
-        },
-      },
+      // {
+      //   type: "bar",
+      //   name: "食堂",
+      //   data: [102, 120, 105, 48, 75, 101, 103, 26],
+      //   itemStyle: {
+      //     color: "#B4E2FB",
+      //   },
+      //   barWidth: 20, // 柱子的宽度
+      //   emphasis: {
+      //     focus: "series",
+      //   },
+      // },
+      // {
+      //   type: "bar",
+      //   name: "其他",
+      //   data: [62, 120, 150, 88, 17, 211, 103, 66],
+      //   itemStyle: {
+      //     color: "#D4EDFB",
+      //   },
+      //   barWidth: 20, // 柱子的宽度
+      //   emphasis: {
+      //     focus: "series",
+      //   },
+      // },
     ],
   });
   // areaTJEcharts.value.setOption({
@@ -591,14 +708,84 @@ const echarts2 = async () => {
   //   series: [{ type: "bar" }, { type: "bar" }, { type: "bar" }],
   // });
 };
-const areaStatistics = (ind) => {
-  areaInd.value = ind;
-};
 
-// 区域能耗统计
+// 区域能耗统计 (333333333333333333333333)
+const energyDissipation = async () => {
+  let paramsData = {
+    currentPage: currentPage1.value,
+    pageCount: pageSize1.value,
+  };
+  let data = {
+    date: tableSearch1.value,
+  };
+  let res = await axios({
+    method: "post",
+    url: api.value + "/wanzai/api/wechat/getMeterMonthPage",
+    params: paramsData,
+    data: data,
+  });
+  console.log(res, "区域能耗统计");
+  if (res.data.code == 200) {
+    table1Data.list = res.data.data.list;
+    total1.value = res.data.data.total;
+    // ElMessage({
+    //   type: "success",
+    //   showClose: true,
+    //   message: res.data.nessage,
+    //   center: true,
+    // });
+  } else {
+    ElMessage({
+      type: "error",
+      showClose: true,
+      message: res.data.nessage,
+      center: true,
+    });
+  }
+};
 const handleCurrentChange1 = (value) => {
   // console.log(value);
-  currentPage.value = value;
+  currentPage1.value = value;
+  energyDissipation();
+};
+// 实时抄表 (44444444444444444444444444)
+const meterReading = async () => {
+  let paramsData = {
+    currentPage: currentPage2.value,
+    pageCount: pageSize2.value,
+  };
+  let data = {
+    date: tableSearch2.value,
+  };
+  let res = await axios({
+    method: "post",
+    url: api.value + "/wanzai/api/wechat/getMeterDayPage",
+    params: paramsData,
+    data: data,
+  });
+  console.log(res, "实时抄表");
+  if (res.data.code == 200) {
+    table2Data.list = res.data.data.list;
+    total2.value = res.data.data.total;
+    // ElMessage({
+    //   type: "success",
+    //   showClose: true,
+    //   message: res.data.nessage,
+    //   center: true,
+    // });
+  } else {
+    ElMessage({
+      type: "error",
+      showClose: true,
+      message: res.data.nessage,
+      center: true,
+    });
+  }
+};
+const handleCurrentChange2 = (value) => {
+  // console.log(value);
+  currentPage2.value = value;
+  meterReading();
 };
 // 表格斑马纹颜色修改
 const tableRowClassName = ({ row, rowIndex }) => {
@@ -612,8 +799,11 @@ const tableRowClassName = ({ row, rowIndex }) => {
 
 onMounted(() => {
   api.value = store.state.user.api;
-  echarts1();
-  echarts2();
+  getWaterElc(); // 用户类别占比
+  getMonWaterElc(); // 区域统计
+  energyDissipation(); // 区域能耗
+  meterReading(); //实时抄表
+
   window.addEventListener("resize", resizeChart);
 });
 onUnmounted(() => {
@@ -656,17 +846,18 @@ onUnmounted(() => {
   }
 
   .middle {
-    width: calc(100% - 60px);
+    width: 100%;
     height: calc(100% - 61px);
     overflow: auto;
     margin: 0 auto;
     color: #000;
     display: flex;
     flex-direction: column;
+    align-items: center;
     .echarts {
       // flex: 1;
-      height: 360px;
-      width: 100%;
+      height: 345px;
+      width: calc(100% - 40px);
       margin: 10px 0 15px 0;
       display: flex;
 
@@ -699,9 +890,21 @@ onUnmounted(() => {
           .quantity {
             margin-bottom: 20px;
             .num {
-              font-size: 30px;
-              font-weight: 600;
+              display: flex;
+
               color: rgba(42, 42, 42, 1);
+              .el-col {
+                flex: none;
+                display: flex;
+                align-items: center;
+                :deep(.el-statistic__number) {
+                  font-size: 30px;
+                  font-weight: 600;
+                }
+              }
+              .unit {
+                transform: translateY(10px);
+              }
             }
           }
         }
@@ -743,9 +946,9 @@ onUnmounted(() => {
     .table {
       // flex: 1;
       height: 360px;
-      width: 100%;
-      margin: 0 0 20px 0;
+      width: calc(100% - 40px);
       display: flex;
+      justify-content: space-between;
       .table1 {
         width: 50%;
         // min-width: 500px;

+ 8 - 4
src/views/grade/grade.vue

@@ -4,7 +4,7 @@
       <!-- <el-icon :size="23" class="camera"><VideoCameraFilled /></el-icon> -->
       <span class="cameratxt">成绩管理</span>
     </div>
-    <div style="overflow: auto">
+    <div class="scrollId">
       <div class="middle">
         <div class="filter">
           <div class="condition">
@@ -1303,7 +1303,10 @@ onUnmounted(() => {
       color: rgba(111, 182, 184, 1);
     }
   }
-
+  .scrollId {
+    overflow: auto;
+    height: calc(100% - 61px);
+  }
   .middle {
     width: 96%;
     margin: 0 auto;
@@ -1413,11 +1416,12 @@ onUnmounted(() => {
 
   .footer {
     width: 96%;
-    // height: 450px;
+    height: calc(100% - 270px);
+    min-height: 300px;
     margin: 10px auto 30px;
 
     .el-table--fit {
-      // height: 100%;
+      height: 100%;
 
       :deep(.el-table__header-wrapper) {
         background-color: #000;

+ 10 - 1
src/views/home/home.vue

@@ -1105,6 +1105,14 @@ const importTable6 = async () => {
 onMounted(() => {
   api.value = store.state.user.api;
   getList();
+
+  if (router.currentRoute.value.query.token) {
+    console.log(router.currentRoute.value.query.token);
+    sessionStorage.setItem(
+      "token",
+      JSON.stringify(router.currentRoute.value.query.token)
+    );
+  }
 });
 onUnmounted(() => {
   echarts1.value.dispose();
@@ -1142,6 +1150,7 @@ onUnmounted(() => {
       .annulus {
         // width: 520px;
         flex: 1;
+        min-width: 400px;
         height: 300px;
         border-radius: 8px;
         background-color: #fff;
@@ -1232,7 +1241,7 @@ onUnmounted(() => {
             // flex-wrap: wrap;
             justify-content: space-around;
             li {
-              width: 220px;
+              width: 45%;
               height: 100px;
               background-color: rgba(237, 245, 250, 1);
               border-radius: 7px;

+ 10 - 7
src/views/identity/identity.vue

@@ -4,7 +4,7 @@
       <!-- <el-icon :size="23" class="camera"><VideoCameraFilled /></el-icon> -->
       <span class="cameratxt">身份管理</span>
     </div>
-    <div style="overflow: auto">
+    <div class="scrollId">
       <div class="middle">
         <div class="filter">
           <div class="condition">
@@ -258,7 +258,7 @@ const tableData = reactive({
       userName: "张三",
       userPhone: 15,
       teamName: 12,
-    }
+    },
   ],
 });
 const searchInput = reactive({
@@ -408,11 +408,11 @@ const confirmEdit = (formEl) => {
           data: data,
         });
       }
-
       console.log(res, "添加成功");
       if (res.data.code == 200) {
         editVisible.value = false;
         getList();
+        editRef.value.resetFields();
         ElMessage({
           type: "success",
           showClose: true,
@@ -584,7 +584,10 @@ onUnmounted(() => {
       color: rgba(111, 182, 184, 1);
     }
   }
-
+  .scrollId {
+    overflow: auto;
+    height: calc(100% - 61px);
+  }
   .middle {
     width: 96%;
     margin: 0 auto;
@@ -663,11 +666,11 @@ onUnmounted(() => {
 
   .footer {
     width: 96%;
-    // height: 550px;
+    height: calc(100% - 210px);
     margin: 10px auto 30px;
-
+    min-height: 300px;
     .el-table--fit {
-      // height: 100%;
+      height: 100% !important;
 
       :deep(.el-table__header-wrapper) {
         background-color: #000;

+ 4 - 4
src/views/info/info.vue

@@ -56,11 +56,11 @@
 
         <img class="info_img" :src="schoolImg" fit="cover" />
         <div class="info_img" v-if="!schoolImg">暂无图片</div>
-        <div class="icon_delete" v-if="showSchool" @click="handleDelete">
+        <!-- <div class="icon_delete" v-if="showSchool" @click="handleDelete">
           <el-icon>
             <Delete />
           </el-icon>
-        </div>
+        </div> -->
       </div>
       <div class="info info2">
         <span class="info_key">管理平台logo:</span>
@@ -82,11 +82,11 @@
         <img class="info_img" :src="logoImg" fit="cover" />
         <div class="info_img" v-if="!logoImg">暂无图片</div>
 
-        <div class="icon_delete" v-if="showSchool" @click="handleDelete">
+        <!-- <div class="icon_delete" v-if="showSchool" @click="handleDelete">
           <el-icon>
             <Delete />
           </el-icon>
-        </div>
+        </div> -->
       </div>
       <div class="info">在校学生人数:150000</div>
 

+ 372 - 0
src/views/login/bind.vue

@@ -0,0 +1,372 @@
+<template>
+  <div class="box">
+    <div class="top">
+      <div class="box_img"></div>
+      <div class="box_school">万载三中</div>
+    </div>
+    <div class="content">
+      <div class="box_wel">
+        <span>欢迎使用智慧校园管理平台</span>
+      </div>
+      <div class="box_login">
+        <div class="login_title">绑定账号</div>
+        <div class="login_code">
+          <el-form
+            ref="ruleFormRef"
+            :model="ruleForm"
+            status-icon
+            :rules="rules"
+            label-width="120px"
+            class="demo-ruleForm"
+          >
+            <div class="title">绑定后可以使用账号登录,账号更加安全</div>
+            <el-form-item label="" prop="user">
+              <el-input
+                :prefix-icon="User"
+                v-model="ruleForm.user"
+                placeholder="请输入登录名"
+                autocomplete="off"
+              />
+            </el-form-item>
+            <el-form-item label="" prop="pass">
+              <el-input
+                :prefix-icon="Lock"
+                show-password
+                v-model="ruleForm.pass"
+                type="password"
+                autocomplete="off"
+                placeholder="请输入登录密码"
+              />
+            </el-form-item>
+            <el-checkbox v-model="checked" class="remeberPwd el-form-item"
+              >记住密码</el-checkbox
+            >
+            <el-form-item>
+              <el-button
+                :loading="loading"
+                type="primary"
+                @click="submitForm(ruleFormRef)"
+                color="rgba(0, 97, 255, 1)"
+                >确认绑定</el-button
+              >
+            </el-form-item>
+          </el-form>
+        </div>
+      </div>
+    </div>
+  </div>
+</template>
+
+<script setup>
+import {
+  ref,
+  reactive,
+  watch,
+  nextTick,
+  onBeforeMount,
+  onMounted,
+  onUnmounted,
+} from "vue";
+import { useRouter } from "vue-router";
+import { ElMessage, ElMessageBox } from "element-plus";
+import { dayjs } from "element-plus";
+import lodash from "lodash";
+import axios from "axios";
+import QrcodeVue from "qrcode.vue";
+import wxlogin from "vue-wxlogin";
+import { useStore } from "vuex";
+const store = useStore();
+const api = ref("");
+const router = useRouter();
+const ruleFormRef = ref();
+const ruleForm = reactive({
+  user: "",
+  pass: "",
+});
+const checked = ref(false); // 记住密码
+
+const rules = reactive({
+  user: [{ required: true, message: "请填写用户名", trigger: "blur" }],
+  pass: [{ required: true, message: "请填写密码", trigger: "blur" }],
+});
+const submitForm = (formEl) => {
+  if (!formEl) return;
+  formEl.validate(async (valid) => {
+    if (valid) {
+      // loading.value = true;
+      // let data = {
+      //   account: ruleForm.user,
+      //   password: ruleForm.pass,
+      // };
+      // let res = await axios({
+      //   method: "post",
+      //   url: api.value + "/login/Login",
+      //   data: data,
+      // });
+      // console.log(res);
+      // if (res.data.code == 200) {
+      //   if (checked.value) {
+      //     localStorage.setItem("user", ruleForm.user);
+      //     localStorage.setItem("pass", ruleForm.pass);
+      //   } else {
+      //     localStorage.removeItem("user", ruleForm.user);
+      //     localStorage.removeItem("pass", ruleForm.user);
+      //   }
+      //   sessionStorage.setItem("token", res.data.data.token);
+      //   sessionStorage.setItem("userhead", res.data.data.userhead);
+      //   sessionStorage.setItem("schoolId", res.data.data.schoolId);
+      //   sessionStorage.setItem("username", res.data.data.userName);
+      //   sessionStorage.setItem("sidevarItem", 1);
+      //   store.commit("indexUp", 1);
+      //   store.commit("userName", ruleForm.user);
+      //   store.commit("passWord", ruleForm.user);
+      //   router.push({
+      //     path: `/repairs/home`,
+      //   });
+      //   ElMessage({
+      //     type: "success",
+      //     showClose: true,
+      //     message: "登录成功",
+      //     center: true,
+      //   });
+      // } else {
+      //   ElMessage({
+      //     type: "error",
+      //     showClose: true,
+      //     message: "登录失败",
+      //     center: true,
+      //   });
+      //   loading.value = false;
+      // }
+    } else {
+      return false;
+    }
+  });
+};
+// 实例微信js对象
+const setWxerwma = async () => {
+  //生成微信扫码登录二维码页面
+  new WxLogin({
+    self_redirect: true, //true:手机点击确认登录后可以在 iframe 内跳转到 redirect_uri
+    id: "weixin", //显示二维码容器设置
+    appid: "wxa94836d74473fe5c", //应用位置标识appid
+    scope: "snsapi_login", //当前微信扫码登录页面已经授权了
+    redirect_uri: "https://www.campussmartlife.com/smartManage/#/login", //填写授权回调域路径,就是用户授权成功以后,微信服务器向公司后台推送code地址
+    state: "", //state就是后台服务器重定向的地址携带用户信息
+    style: "black",
+    href: "data:text/css;base64,LmltcG93ZXJCb3gge3dpZHRoOiAyMDBweDt9Ci5pbXBvd2VyQm94IC5xcmNvZGUge3dpZHRoOiAyMDBweDttYXJnaW46MDt9Ci5pbXBvd2VyQm94IC50aXRsZSB7ZGlzcGxheTogbm9uZTt9Ci5pbXBvd2VyQm94IC5pbmZvIHtkaXNwbGF5Om5vbmU7fQouc3RhdHVzX2ljb24ge2Rpc3BsYXk6IG5vbmV9Ci5pbXBvd2VyQm94IC5zdGF0dXMge3RleHQtYWxpZ246IGNlbnRlcjt9IA==",
+  });
+};
+onMounted(() => {
+  // setWxerwma();
+});
+</script>
+
+<style lang="scss" scoped>
+.box {
+  // position: relative;
+  min-width: 1300px;
+  min-height: 750px;
+  width: 100vw;
+  height: 100vh;
+  color: #000;
+  background-image: url(@/assets/school/login_bg.png);
+  background-size: 100% 100%;
+  .top {
+    display: flex;
+    align-items: center;
+    padding: 54px 0 0 62px;
+
+    .box_img {
+      // position: absolute;
+      // top: 54px;
+      // left: 62px;
+      width: 56px;
+      height: 56px;
+      border-radius: 50%;
+      background-color: skyblue;
+      margin-right: 20px;
+    }
+
+    .box_school {
+      // position: absolute;
+      // top: 61px;
+      // left: 141px;
+      font-size: 29px;
+      font-weight: bold;
+    }
+  }
+
+  .content {
+    width: 100%;
+    height: calc(100% - 110px);
+    // margin-top: 40px;
+    display: flex;
+    // justify-content: space-between;
+    .box_wel {
+      font-size: 52.5px;
+      font-weight: bold;
+      margin-top: 20px;
+      width: 66%;
+      height: 40%;
+      span {
+        display: block;
+        text-align: center;
+      }
+    }
+
+    .box_login {
+      // position: absolute;
+      // top: 223px;
+      // left: 1286px;
+      width: 24%;
+      height: 70%;
+      box-shadow: 0px 3px 10px rgba(0, 97, 255, 0.2);
+      background-color: #fff;
+      // border: 1px solid red;
+      // margin-top: 100px;
+      padding: 60px 0;
+      box-sizing: border-box;
+      display: flex;
+      flex-direction: column;
+      justify-content: space-between;
+      align-items: center;
+
+      // width: 426px;
+      // height: 536px;
+
+      .login_title {
+        font-size: 24px;
+        font-weight: bold;
+      }
+
+      .login_tips {
+        color: #a6a6a6;
+        font-size: 16px;
+      }
+
+      .login_code {
+        // width: 200px;
+        // height: 250px;
+        .el-form {
+          width: 280px;
+          display: flex;
+          flex-direction: column;
+          justify-content: center;
+          align-items: center;
+          padding: 35px 0;
+          border-radius: 16px;
+          // background: rgba(255, 255, 255, 1);
+
+          .title {
+            color: rgba(0, 185, 170, 1);
+            font-size: 14px;
+            margin: 0 0 10px 0;
+          }
+
+          .el-divider {
+            width: 85%;
+            margin: 20px 0 30px;
+          }
+
+          .el-form-item {
+            width: 280px;
+            height: 40px;
+            // margin-bottom: 0;
+
+            :deep(.el-form-item__content) {
+              margin-left: 0 !important;
+
+              .el-input {
+                height: 40px;
+
+                .el-input__wrapper {
+                  border-radius: 12px;
+
+                  .el-input__prefix {
+                    margin: 0 10px 0 12px;
+                  }
+                }
+
+                // .el-icon {
+                //   width: 24px;
+                //   height: 24px;
+
+                //   svg {
+                //     width: 24px;
+                //     height: 24px;
+                //   }
+                // }
+
+                .el-input__inner {
+                  height: 100%;
+                  font-size: 14px;
+                }
+              }
+
+              // .el-form-item__error {
+              //   font-size: 16px;
+              // }
+
+              .el-button {
+                width: 100%;
+                height: 40px;
+                font-size: 16px;
+                border-radius: 12px;
+              }
+            }
+
+            .el-button--primary {
+              width: 280px;
+            }
+          }
+
+          .remeberPwd {
+            height: 30px;
+            margin-bottom: 30px;
+
+            // :deep(.el-checkbox__input) {
+            //   .el-checkbox__inner {
+            //     width: 15px;
+            //     height: 15px;
+            //   }
+
+            //   .el-checkbox__inner::after {
+            //     width: 6px;
+            //     height: 12px;
+            //     top: 0px;
+            //   }
+            // }
+
+            :deep(.el-checkbox__label) {
+              font-size: 14px;
+            }
+          }
+        }
+      }
+
+      .login_btn {
+        display: flex;
+        align-items: center;
+        justify-content: space-between;
+        width: 210px;
+        height: 40px;
+        display: none;
+
+        .btn {
+          display: flex;
+          justify-content: center;
+          align-items: center;
+          width: 98px;
+          height: 40px;
+          color: #fff;
+          font-size: 16px;
+          border-radius: 8px;
+          background-color: #0061ff;
+          cursor: pointer;
+        }
+      }
+    }
+  }
+}
+</style>

+ 392 - 36
src/views/login/index.vue

@@ -8,9 +8,12 @@
       <div class="box_wel">
         <span>欢迎使用智慧校园管理平台</span>
       </div>
-      <div class="box_login">
-        <div class="login_title">微信扫码登录</div>
-        <div class="login_tips">请使用微信扫描二维码登录</div>
+      <div class="box_login" v-if="bindShow">
+        <!-- <div class="login_title">微信扫码登录</div>
+        <div class="login_tips">请使用微信扫描二维码登录</div> -->
+
+        <div class="login_title">登录</div>
+        <div class="login_tips">点击微信登录扫码授权登录</div>
         <div class="login_code">
           <!-- <qrcode-vue
             value="https://www.campussmartlife.com/smartApi/wanzai/api/wechat/login"
@@ -18,11 +21,74 @@
             level="H"
             @callback="handleScan"
           /> -->
-          <div id="weixin"></div>
+          <!-- <div id="weixin"></div> -->
+          <!-- <wxlogin
+            :appid="appid"
+            :scope="'snsapi_login'"
+            :theme="'black'"
+            :redirect_uri="redirect_uri"
+            :href="bast64css"
+          >
+          </wxlogin> -->
         </div>
+
         <div class="login_btn">
-          <div class="btn" @click="login">单点登录</div>
-          <div class="btn">统一认证</div>
+          <div class="btn">
+            <a
+              href="https://www.campussmartlife.com/smartApi/wanzai/api/wechat/login"
+              >微信登录</a
+            >
+          </div>
+          <div class="btn" @click="loginClick">统一认证</div>
+        </div>
+      </div>
+      <div class="box_login" v-else>
+        <div class="login_title">绑定卡号</div>
+        <div class="bind_code">
+          <el-form
+            ref="ruleFormRef"
+            :model="ruleForm"
+            status-icon
+            :rules="rules"
+            label-width="120px"
+            class="demo-ruleForm"
+          >
+            <!-- <div class="title">绑定后可以使用账号登录,账号更加安全</div> -->
+            <div class="title">用户绑定卡号获取登录权限</div>
+            <el-form-item label="" prop="user">
+              <el-input
+                :prefix-icon="User"
+                v-model="ruleForm.user"
+                placeholder="请输入卡号"
+                autocomplete="off"
+              />
+            </el-form-item>
+            <!-- <el-form-item label="" prop="pass">
+              <el-input
+                :prefix-icon="Lock"
+                show-password
+                v-model="ruleForm.pass"
+                type="password"
+                autocomplete="off"
+                placeholder="请输入登录密码"
+              />
+            </el-form-item> -->
+            <!-- <el-checkbox v-model="checked" class="remeberPwd el-form-item"
+              >记住密码</el-checkbox
+            > -->
+            <el-form-item>
+              <!-- <el-button
+                :loading="loading"
+                type="primary"
+                @click="submitForm(ruleFormRef)"
+                color="rgba(0, 97, 255, 1)"
+                >确认绑定</el-button
+              > -->
+              <div class="btn" @click="bindClick">
+                <a :href="bindWX">微信绑定</a>
+              </div>
+            </el-form-item>
+          </el-form>
         </div>
       </div>
     </div>
@@ -44,42 +110,126 @@ import { ElMessage, ElMessageBox } from "element-plus";
 import { dayjs } from "element-plus";
 import lodash from "lodash";
 import axios from "axios";
-import QrcodeVue from "qrcode.vue";
 import wxlogin from "vue-wxlogin";
 import { useStore } from "vuex";
+
 const store = useStore();
-const api = ref("");
 const router = useRouter();
+const bindWX = ref(); // 绑定微信的卡号的跳转链接
+const bindShow = ref(true); // 判断用户是否绑定
+const ruleFormRef = ref();
+const ruleForm = reactive({
+  user: "",
+  pass: "",
+});
+const checked = ref(false); // 记住密码
 
-const codeUrl = ref("123");
-const codeSize = ref(200);
-const login = () => {
-  router.push({ path: `/wanzai/home` });
-  sessionStorage.setItem("sidevarItem", "/wanzai/home");
+const rules = reactive({
+  user: [{ required: true, message: "请填写用户名", trigger: "blur" }],
+  pass: [{ required: true, message: "请填写密码", trigger: "blur" }],
+});
+const submitForm = (formEl) => {
+  if (!formEl) return;
+  formEl.validate(async (valid) => {
+    if (valid) {
+      // loading.value = true;
+      // let data = {
+      //   account: ruleForm.user,
+      //   password: ruleForm.pass,
+      // };
+      // let res = await axios({
+      //   method: "post",
+      //   url: api.value + "/login/Login",
+      //   data: data,
+      // });
+      // console.log(res);
+      // if (res.data.code == 200) {
+      //   if (checked.value) {
+      //     localStorage.setItem("user", ruleForm.user);
+      //     localStorage.setItem("pass", ruleForm.pass);
+      //   } else {
+      //     localStorage.removeItem("user", ruleForm.user);
+      //     localStorage.removeItem("pass", ruleForm.user);
+      //   }
+      //   sessionStorage.setItem("token", res.data.data.token);
+      //   sessionStorage.setItem("userhead", res.data.data.userhead);
+      //   sessionStorage.setItem("schoolId", res.data.data.schoolId);
+      //   sessionStorage.setItem("username", res.data.data.userName);
+      //   sessionStorage.setItem("sidevarItem", 1);
+      //   store.commit("indexUp", 1);
+      //   store.commit("userName", ruleForm.user);
+      //   store.commit("passWord", ruleForm.user);
+      //   router.push({
+      //     path: `/repairs/home`,
+      //   });
+      //   ElMessage({
+      //     type: "success",
+      //     showClose: true,
+      //     message: "登录成功",
+      //     center: true,
+      //   });
+      // } else {
+      //   ElMessage({
+      //     type: "error",
+      //     showClose: true,
+      //     message: "登录失败",
+      //     center: true,
+      //   });
+      //   loading.value = false;
+      // }
+    } else {
+      return false;
+    }
+  });
+};
+
+const loginClick = () => {
+  // router.push({ path: `/wanzai/home` });
+  // sessionStorage.setItem("sidevarItem", "/wanzai/home");
+};
+// 绑定点击微信
+const bindClick = () => {
+  if (ruleForm.user) {
+    bindWX.value =
+      "https://www.campussmartlife.com/smartApi//wanzai/api/wechat/bind?cardNo=" +
+      ruleForm.user;
+  }
 };
 // 实例微信js对象
-const setWxerwma =async () => {
+const setWxerwma = async () => {
   //生成微信扫码登录二维码页面
-  new WxLogin({
-    self_redirect: true, //true:手机点击确认登录后可以在 iframe 内跳转到 redirect_uri
-    id: "weixin", //显示二维码容器设置
-    appid: "wx539dfc0670acb9c4", //应用位置标识appid
-    scope: "snsapi_login", //当前微信扫码登录页面已经授权了
-    redirect_uri: "https://www.campussmartlife.com/smartApi/wanzai/api/wechat/login", //填写授权回调域路径,就是用户授权成功以后,微信服务器向公司后台推送code地址
-    state: "", //state就是后台服务器重定向的地址携带用户信息
-    style: "black",
-    href: "",
-  });
-}
-onMounted(() => {
-  setWxerwma()
   // var obj = new WxLogin({
+  //   self_redirect: true,
   //   id: "weixin",
-  //   appid: "wx539dfc0670acb9c4",
+  //   appid: appid.value,
   //   scope: "snsapi_login",
-  //   redirect_uri:
-  //     "https://www.campussmartlife.com/smartApi/wanzai/api/wechat/login",
+  //   redirect_uri: redirect_uri.value,
+  //   state: "",
+  //   style: "black",
+  //   href: `data:text/css;base64,${bast64css.value}`,
   // });
+};
+onMounted(() => {
+  // setWxerwma();
+  console.log(router.currentRoute.value.query);
+  console.log(window.location.href);
+  if (router.currentRoute.value.query.message == "请绑定信息") {
+    ElMessage({
+      type: "warning",
+      showClose: true,
+      message: "当前用户未绑定卡号,请先绑定",
+      center: true,
+    });
+    bindShow.value = false;
+  } else if (router.currentRoute.value.query.message == "卡号信息错误") {
+    bindShow.value = false;
+    ElMessage({
+      type: "error",
+      showClose: true,
+      message: "卡号信息错误",
+      center: true,
+    });
+  }
 });
 </script>
 
@@ -146,7 +296,7 @@ onMounted(() => {
       background-color: #fff;
       // border: 1px solid red;
       // margin-top: 100px;
-      padding: 40px 0;
+      padding: 60px 0;
       box-sizing: border-box;
       display: flex;
       flex-direction: column;
@@ -168,11 +318,213 @@ onMounted(() => {
 
       .login_code {
         width: 200px;
-        height: 200px;
-        background-color: skyblue;
-        #weixin{
-          width: 200px;
-          height: 200px;
+        height: 250px;
+        // background-color: skyblue;
+        .el-form {
+          width: 280px;
+          display: flex;
+          flex-direction: column;
+          justify-content: center;
+          align-items: center;
+          padding: 35px 0;
+          border-radius: 16px;
+          // background: rgba(255, 255, 255, 1);
+
+          .title {
+            color: rgba(0, 185, 170, 1);
+            font-size: 14px;
+            margin: 0 0 10px 0;
+          }
+
+          .el-divider {
+            width: 85%;
+            margin: 20px 0 30px;
+          }
+
+          .el-form-item {
+            width: 280px;
+            height: 40px;
+            // margin-bottom: 0;
+
+            :deep(.el-form-item__content) {
+              margin-left: 0 !important;
+
+              .el-input {
+                height: 40px;
+
+                .el-input__wrapper {
+                  border-radius: 12px;
+
+                  .el-input__prefix {
+                    margin: 0 10px 0 12px;
+                  }
+                }
+
+                // .el-icon {
+                //   width: 24px;
+                //   height: 24px;
+
+                //   svg {
+                //     width: 24px;
+                //     height: 24px;
+                //   }
+                // }
+
+                .el-input__inner {
+                  height: 100%;
+                  font-size: 14px;
+                }
+              }
+
+              // .el-form-item__error {
+              //   font-size: 16px;
+              // }
+
+              .el-button {
+                width: 100%;
+                height: 40px;
+                font-size: 16px;
+                border-radius: 12px;
+              }
+            }
+
+            .el-button--primary {
+              width: 280px;
+            }
+          }
+
+          .remeberPwd {
+            height: 30px;
+            margin-bottom: 30px;
+
+            // :deep(.el-checkbox__input) {
+            //   .el-checkbox__inner {
+            //     width: 15px;
+            //     height: 15px;
+            //   }
+
+            //   .el-checkbox__inner::after {
+            //     width: 6px;
+            //     height: 12px;
+            //     top: 0px;
+            //   }
+            // }
+
+            :deep(.el-checkbox__label) {
+              font-size: 14px;
+            }
+          }
+        }
+      }
+      .bind_code {
+        .el-form {
+          width: 280px;
+          display: flex;
+          flex-direction: column;
+          justify-content: center;
+          align-items: center;
+          padding: 35px 0;
+          border-radius: 16px;
+          // background: rgba(255, 255, 255, 1);
+
+          .title {
+            color: rgba(0, 185, 170, 1);
+            font-size: 14px;
+            margin: 0 0 10px 0;
+          }
+
+          .el-divider {
+            width: 85%;
+            margin: 20px 0 30px;
+          }
+
+          .el-form-item {
+            width: 280px;
+            height: 40px;
+            // margin-bottom: 0;
+
+            :deep(.el-form-item__content) {
+              margin-left: 0 !important;
+              .btn {
+                display: flex;
+                justify-content: center;
+                align-items: center;
+                width: 280px;
+                height: 40px;
+                color: #fff;
+                font-size: 16px;
+                border-radius: 8px;
+                background-color: #0061ff;
+                cursor: pointer;
+                a {
+                  color: #fff;
+                }
+              }
+              .el-input {
+                height: 40px;
+
+                .el-input__wrapper {
+                  border-radius: 12px;
+
+                  .el-input__prefix {
+                    margin: 0 10px 0 12px;
+                  }
+                }
+
+                // .el-icon {
+                //   width: 24px;
+                //   height: 24px;
+
+                //   svg {
+                //     width: 24px;
+                //     height: 24px;
+                //   }
+                // }
+
+                .el-input__inner {
+                  height: 100%;
+                  font-size: 14px;
+                }
+              }
+
+              // .el-form-item__error {
+              //   font-size: 16px;
+              // }
+
+              .el-button {
+                width: 100%;
+                height: 40px;
+                font-size: 16px;
+                border-radius: 12px;
+              }
+            }
+
+            .el-button--primary {
+              width: 280px;
+            }
+          }
+
+          .remeberPwd {
+            height: 30px;
+            margin-bottom: 30px;
+
+            // :deep(.el-checkbox__input) {
+            //   .el-checkbox__inner {
+            //     width: 15px;
+            //     height: 15px;
+            //   }
+
+            //   .el-checkbox__inner::after {
+            //     width: 6px;
+            //     height: 12px;
+            //     top: 0px;
+            //   }
+            // }
+
+            :deep(.el-checkbox__label) {
+              font-size: 14px;
+            }
+          }
         }
       }
 
@@ -182,6 +534,7 @@ onMounted(() => {
         justify-content: space-between;
         width: 210px;
         height: 40px;
+        // display: none;
 
         .btn {
           display: flex;
@@ -194,6 +547,9 @@ onMounted(() => {
           border-radius: 8px;
           background-color: #0061ff;
           cursor: pointer;
+          a {
+            color: #fff;
+          }
         }
       }
     }

+ 65 - 78
src/views/screenShot/screenShot.vue

@@ -27,14 +27,35 @@
                 <el-table-column
                   width="250"
                   align="center "
-                  prop="yearInd"
+                  prop="screenshotNum"
                   label="近一年截屏次数"
                 />
                 <el-table-column
                   align="center"
-                  prop="punishment"
+                  prop="triggers"
                   label="触发惩罚"
-                />
+                >
+                  <template #default="scope">
+                    <div class="triggers" v-if="scope.row.triggers == 0">
+                      身份码提醒
+                    </div>
+                    <div class="triggers" v-if="scope.row.triggers == 1">
+                      冻结1小时
+                    </div>
+                    <div class="triggers" v-if="scope.row.triggers == 2">
+                      冻结2小时
+                    </div>
+                    <div class="triggers" v-if="scope.row.triggers == 3">
+                      冻结4小时
+                    </div>
+                    <div class="triggers" v-if="scope.row.triggers == 4">
+                      冻结8小时
+                    </div>
+                    <div class="triggers" v-if="scope.row.triggers == 5">
+                      冻结1天
+                    </div>
+                  </template>
+                </el-table-column>
                 <el-table-column align="center" label="操作" width="200">
                   <template #default="scope">
                     <div class="del" @click="editClick(scope.row)">编辑</div>
@@ -315,30 +336,14 @@ const api = ref("");
 const router = useRouter();
 
 // 头部切换按钮
-const activeName = ref("3");
+const activeName = ref("1");
 
 // 规则表格数据 (-------------------------------------------------------------)
 const loading = ref(false);
 const ruleData = reactive({
   list: [
     {
-      yearInd: "2",
-      punishment: "身份码提醒",
-    },
-    {
-      yearInd: "1",
-      punishment: "身份码提醒",
-    },
-    {
-      yearInd: "3",
-      punishment: "身份码提醒",
-    },
-    {
-      yearInd: "3",
-      punishment: "身份码提醒",
-    },
-    {
-      yearInd: "3",
+      screenshotNum: "2",
       punishment: "身份码提醒",
     },
   ],
@@ -355,27 +360,7 @@ const punishment = ref("1"); // 选择触发惩罚
 const recordData = reactive({
   list: [
     {
-      userEdit: "151502051651561",
-      name: "张三",
-      time: "2023-12-12 12:20:12",
-    },
-    {
-      userEdit: "151502051651561",
-      name: "张三",
-      time: "2023-12-12 12:20:12",
-    },
-    {
-      userEdit: "151502051651561",
-      name: "张三",
-      time: "2023-12-12 12:20:12",
-    },
-    {
-      userEdit: "151502051651561",
-      name: "张三",
-      time: "2023-12-12 12:20:12",
-    },
-    {
-      userEdit: "151502051651561",
+      screenshotNum: "151502051651561",
       name: "张三",
       time: "2023-12-12 12:20:12",
     },
@@ -448,42 +433,41 @@ const totalFreezeList = ref(5); // 当前总数
 
 // 查看房型列表
 const getList = async () => {
-  // loading.value = true;
-  // let data = {
-  //   page: currentPage.value,
-  //   rows: pageSize.value,
-  //   hName: searchInput.keyWord, // 房型名称
-  //   managerId: sessionStorage.getItem("token"),
-  // };
-  // let res = await axios({
-  //   method: "post",
-  //   url: api.value + "/mhotel/housequeryPage.action",
-  //   headers: {
-  //     // token: sessionStorage.getItem("token"),
-  //     // user_head: sessionStorage.getItem("userhead"),
-  //   },
-  //   params: data,
-  // });
-  // console.log(res, "房型管理");
-  // if (res.data.code == 200) {
-  //   loading.value = false;
-  //   tableData.list = res.data.data.pageList;
-  //   total.value = res.data.data.total;
-  //   // ElMessage({
-  //   //   type: "success",
-  //   //   showClose: true,
-  //   //   message: res.data.message,
-  //   //   center: true,
-  //   // });
-  // } else {
-  //   loading.value = false;
-  //   ElMessage({
-  //     type: "error",
-  //     showClose: true,
-  //     message: res.data.message,
-  //     center: true,
-  //   });
-  // }
+  if (activeName.value == 1) {
+    let data = {
+      currentPage: currentPageRule.value,
+      pageCount: pageSizeRule.value,
+    };
+    let res = await axios({
+      method: "get",
+      url: api.value + "/wanzai/api/smartScreenshot/queryPunishs",
+      headers: {
+        // token: sessionStorage.getItem("token"),
+        // user_head: sessionStorage.getItem("userhead"),
+      },
+      params: data,
+    });
+    console.log(res, "规则");
+    if (res.data.code == 200) {
+      loading.value = false;
+      ruleData.list = res.data.data.list;
+      totalRule.value = res.data.data.totalCount;
+      // ElMessage({
+      //   type: "success",
+      //   showClose: true,
+      //   message: res.data.message,
+      //   center: true,
+      // });
+    } else {
+      loading.value = false;
+      ElMessage({
+        type: "error",
+        showClose: true,
+        message: res.data.message,
+        center: true,
+      });
+    }
+  }
 };
 
 // 头部切换功能
@@ -795,6 +779,9 @@ onUnmounted(() => {
               color: rgba(30, 125, 251, 1);
               cursor: pointer;
             }
+            .triggers {
+              color: red;
+            }
 
             // :deep(.look):hover {
             //   color: red;

+ 142 - 40
src/views/user/user.vue

@@ -199,7 +199,7 @@
     <div class="addMember" v-if="addMemberShow">
       <div class="left">
         <img src="@/assets/images/close.png" alt="" @click="addMemberConcel" />
-        <span class="add">添加成员</span>
+        <span class="add">{{ addMemberTitle }}</span>
       </div>
       <div class="content">
         <div class="form">
@@ -261,7 +261,7 @@
               </el-radio-group>
             </el-form-item>
             <el-form-item label="部门 :" prop="department">
-              <el-cascader
+              <!-- <el-cascader
                 v-model="addMemberRuleForm.department"
                 style="width: 500px"
                 filterable
@@ -269,6 +269,15 @@
                 :options="dataSource"
                 :props="{ label: 'name', value: 'id' }"
                 :show-all-levels="false"
+              /> -->
+              <el-tree-select
+                v-model="addMemberRuleForm.department"
+                :data="dataSource"
+                default-expand-all
+                check-strictly
+                :render-after-expand="false"
+                style="width: 500px"
+                :props="{ label: 'name', value: 'id' }"
               />
             </el-form-item>
             <el-form-item label="人脸照片 :" prop="facePhoto">
@@ -310,6 +319,7 @@
                 v-model="addMemberRuleForm.grade"
                 placeholder="请选择年级"
                 style="width: 500px"
+                @change="classsListChange"
               >
                 <el-option
                   v-for="i in gradeData"
@@ -388,7 +398,7 @@
                   v-for="item in conteactListData"
                   :key="item.id"
                   :label="item.name"
-                  :value="item.id"
+                  :value="`${item.id}`"
                 >
                   <span style="float: left">{{ item.name }}</span>
                   <span
@@ -1082,8 +1092,10 @@ const addBMRules = reactive({
     { required: true, message: "部门名称不能为空", trigger: "blur" },
   ],
 });
+
 // 添加成员页面 (---------------------------------------------)
 const addMemberShow = ref(false);
+const addMemberTitle = ref("添加成员");
 const addMemberRef = ref();
 const addMemberRuleForm = reactive({
   serialNumber: "", // 编号
@@ -1126,19 +1138,19 @@ const upload = ref(); // 人脸照片
 const addMemberRules = reactive({
   serialNumber: [{ required: true, message: "编号不能为空", trigger: "blur" }],
   name: [{ required: true, message: "姓名不能为空", trigger: "blur" }],
-  identity: [{ required: true, message: "身份不能为空", trigger: "blur" }],
+  identity: [{ required: true, message: "身份不能为空", trigger: "change" }],
   icCard: [{ required: true, message: "身份证号不能为空", trigger: "blur" }],
   sex: [{ required: true, message: "性别不能为空", trigger: "blur" }],
-  department: [{ required: true, message: "部门不能为空", trigger: "blur" }],
+  department: [{ required: true, message: "部门不能为空", trigger: "change" }],
   facePhoto: [{ required: true, message: "人脸照片不能为空", trigger: "blur" }],
-  grade: [{ required: true, message: "年级不能为空", trigger: "blur" }],
+  grade: [{ required: true, message: "年级不能为空", trigger: "change" }],
   // institute: [{ required: true, message: "学院不能为空", trigger: "blur" }],
   // specialty: [{ required: true, message: "专业不能为空", trigger: "blur" }],
-  class: [{ required: true, message: "班级不能为空", trigger: "blur" }],
+  class: [{ required: true, message: "班级不能为空", trigger: "change" }],
   // school: [{ required: true, message: "校区不能为空", trigger: "blur" }],
   // dormitory: [{ required: true, message: "宿舍号不能为空", trigger: "blur" }],
-  phone: [{ required: true, message: "手机号不能为空", trigger: "blur" }],
-  contact: [{ required: true, message: "联系人不能为空", trigger: "blur" }],
+  // phone: [{ required: true, message: "手机号不能为空", trigger: "blur" }],
+  // contact: [{ required: true, message: "联系人不能为空", trigger: "blur" }],
   // jobName: [{ required: true, message: "职称不能为空", trigger: "blur" }],
   houseAddress: [
     // { required: true, message: "家庭地址不能为空", trigger: "blur" },
@@ -1524,7 +1536,7 @@ const classDataList = async () => {
     },
     // params: data,
   });
-  // console.log(identity,"身份下拉数据");
+  console.log(identity, "身份下拉数据");
   identityData.value = identity.data.data;
   let grade = await axios({
     method: "get",
@@ -1535,19 +1547,8 @@ const classDataList = async () => {
     },
     // params: data,
   });
-  // console.log(grade,"年级下拉数据");
+  console.log(grade, "年级下拉数据");
   gradeData.value = grade.data.data;
-  let classs = await axios({
-    method: "get",
-    url: api.value + "/wanzai/api/smartClass/querySmartClasss",
-    headers: {
-      // token: sessionStorage.getItem("token"),
-      // user_head: sessionStorage.getItem("userhead"),
-    },
-    // params: data,
-  });
-  // console.log(classs,"班级下拉数据");
-  classsData.value = classs.data.data;
 };
 // 联系人分页数据
 const studentList = async () => {
@@ -1571,6 +1572,30 @@ const studentList = async () => {
   conteactListData.value = res.data.data.list;
   conteactListTotalPage.value = res.data.data.totalPage;
 };
+// 班级下拉数据
+const classsList = async () => {
+  let data = {
+    gradeId: addMemberRuleForm.grade,
+  };
+  let classs = await axios({
+    method: "get",
+    url: api.value + "/wanzai/api/smartClass/querySmartClasss",
+    headers: {
+      // token: sessionStorage.getItem("token"),
+      // user_head: sessionStorage.getItem("userhead"),
+    },
+    params: data,
+  });
+  console.log(classs, "班级下拉数据");
+  classsData.value = classs.data.data;
+};
+// 切换年级加载班级数据
+const classsListChange = (value) => {
+  addMemberRuleForm.class = "";
+  if (addMemberRuleForm.grade) {
+    classsList();
+  }
+};
 // 联系人分页触底加载更多
 const addStudentListScroll = () => {
   nextTick(() => {
@@ -1623,10 +1648,71 @@ const conteactMethod = (query) => {
 };
 // 添加成员弹窗
 const addMemberClick = () => {
+  addMemberTitle.value = "添加成员";
   homeShow.value = false;
   addMemberShow.value = true;
   studentList();
   addStudentListScroll();
+  addMemberRuleForm.serialNumber = "";
+  addMemberRuleForm.name = "";
+  addMemberRuleForm.identity = "";
+  addMemberRuleForm.icCard = "";
+  addMemberRuleForm.sex = "";
+  addMemberRuleForm.departmentID = "";
+  addMemberRuleForm.facePhoto = "";
+  addMemberRuleForm.grade = "";
+  addMemberRuleForm.institute = "";
+  addMemberRuleForm.specialty = "";
+  addMemberRuleForm.class = "";
+  addMemberRuleForm.school = "";
+  addMemberRuleForm.dormitory = "";
+  addMemberRuleForm.phone = "";
+  addMemberRuleForm.contact = "";
+  addMemberRuleForm.jobName = "";
+  addMemberRuleForm.houseAddress = "";
+  addMemberRuleForm.nation = "";
+  addMemberRuleForm.originOfStudent = "";
+  addMemberRuleForm.graduateCollege = "";
+  addMemberRuleForm.duty = "";
+  nextTick(() => {
+    addMemberRef.value.resetFields();
+  });
+};
+// 编辑成员弹窗
+const editClick = (row) => {
+  addMemberTitle.value = "编辑成员";
+  homeShow.value = false;
+  addMemberShow.value = true;
+  studentList();
+  addStudentListScroll();
+  console.log(row, "编辑");
+  addMemberRuleForm.serialNumber = row.cardNo; // 编号
+  addMemberRuleForm.name = row.name; // 姓名
+  addMemberRuleForm.identity = row.identityId; // 身份ID
+  addMemberRuleForm.icCard = row.idCard; // 身份证
+  addMemberRuleForm.sex = row.sexId; // 性别 女:0男:1
+  addMemberRuleForm.department = row.departmentId; // 部门ID
+  addMemberRuleForm.facePhoto = row.headImage; // 人脸照片
+  addMemberRuleForm.grade = Number(row.grade); // 年级
+  classsList();
+  addMemberRuleForm.institute = row.college; // 学院
+  addMemberRuleForm.specialty = row.speciality; // 专业
+  addMemberRuleForm.class = row.schoolClass; // 班级
+  addMemberRuleForm.school = row.campus; // 校区
+  addMemberRuleForm.dormitory = row.dormitoryNumber; // 宿舍号
+  addMemberRuleForm.phone = row.phone; // 手机号
+  if (row.affiliate) {
+    addMemberRuleForm.contact = row.affiliate.split(","); // 联系人
+  } else {
+    addMemberRuleForm.contact = "";
+  }
+  addMemberRuleForm.jobName = row.title; // 职称
+  addMemberRuleForm.houseAddress = row.address; // 家庭住址
+  addMemberRuleForm.nation = row.nation; // 民族
+  addMemberRuleForm.originOfStudent = row.ofStudent; // 生源地
+  addMemberRuleForm.graduateCollege = row.graduate; // 毕业学校
+  addMemberRuleForm.duty = row.duties; // 职务
+  addMemberRuleForm.id = row.id;
 };
 // 确定添加成员
 const confirmAddMember = async (formEl) => {
@@ -1639,8 +1725,7 @@ const confirmAddMember = async (formEl) => {
         identityId: addMemberRuleForm.identity, // 身份ID
         idCard: addMemberRuleForm.icCard, // 身份证
         sexId: addMemberRuleForm.sex, // 性别 女:0男:1
-        departmentId:
-          addMemberRuleForm.department[addMemberRuleForm.department.length - 1], // 部门ID
+        departmentId: addMemberRuleForm.department, // 部门ID
         headImage: addMemberRuleForm.facePhoto, // 人脸照片
         grade: addMemberRuleForm.grade, // 年级
         college: addMemberRuleForm.institute, // 学院
@@ -1657,16 +1742,32 @@ const confirmAddMember = async (formEl) => {
         graduate: addMemberRuleForm.graduateCollege, // 毕业学校
         duties: addMemberRuleForm.duty, // 职务
       };
-      let res = await axios({
-        method: "post",
-        url: api.value + "/wanzai/api/smartUser/insertSmartUser",
-        headers: {
-          // token: sessionStorage.getItem("token"),
-          // user_head: sessionStorage.getItem("userhead"),
-        },
-        data: data,
-      });
-      console.log(res, "新增用户");
+      let res = "";
+      if (addMemberRuleForm.id) {
+        data.id = addMemberRuleForm.id;
+        res = await axios({
+          method: "post",
+          url: api.value + "/wanzai/api/smartUser/updateSmartUserById",
+          headers: {
+            // token: sessionStorage.getItem("token"),
+            // user_head: sessionStorage.getItem("userhead"),
+          },
+          data: data,
+        });
+        console.log(res, "编辑用户");
+      } else {
+        res = await axios({
+          method: "post",
+          url: api.value + "/wanzai/api/smartUser/insertSmartUser",
+          headers: {
+            // token: sessionStorage.getItem("token"),
+            // user_head: sessionStorage.getItem("userhead"),
+          },
+          data: data,
+        });
+        console.log(res, "新增用户");
+      }
+
       if (res.data.code == 200) {
         ElMessage({
           type: "success",
@@ -1695,6 +1796,7 @@ const addMemberConcel = () => {
   addMemberShow.value = false;
   homeShow.value = true;
   addMemberRef.value.resetFields();
+  addMemberRuleForm.id = "";
 };
 // 移出照片
 const handleRemove = (uploadFile, uploadFiles) => {
@@ -1723,7 +1825,7 @@ const handlePreview = (file) => {
 const handleChange = async (file, fileLists) => {
   console.log(file, "1111");
   if (file.raw.type == "image/jpeg" || file.raw.type == "image/png") {
-    if (file.size / 1024 <= 150) {
+    if (file.size / 1024 <= 50) {
       const cos = new COS({
         SecretId: "AKIDCPVZdcWIxgHpy5FYxVyPiqkZGrhdXUBg",
         SecretKey: "NkyCN3cz97qKaeXLvHOGxOcdS8f184pL",
@@ -1755,7 +1857,7 @@ const handleChange = async (file, fileLists) => {
         }
       );
     } else {
-      ElMessage.error("图片的大小不能超过150kb!");
+      ElMessage.error("图片的大小不能超过50kb!");
     }
   } else {
     ElMessage.error("图片格式必须为JPG/PNG格式!");
@@ -2417,12 +2519,12 @@ onUnmounted(() => {
 
     .footer {
       width: 96%;
-      // height: 550px;
-      margin: 10px auto 30px;
+      height: calc(100% - 205px);
+      margin: 10px auto 25px;
+      min-height: 300px;
 
       .el-table--fit {
-        // height: 100%;
-
+        height: 100% !important;
         :deep(.el-table__header-wrapper) {
           background-color: #000;
           font-size: 14px;

+ 2 - 1
vite.config.js

@@ -27,7 +27,8 @@ export default defineConfig({
   },
   server: {
     host: "0.0.0.0",
-    port: 6688,
+    port: 8080,
+    // disableHostCheck: true,
     // 是否开启 https
     // https: false,
     // 线上地址 https://chtech.ncjti.edu.cn/hotelReservation/pc3/