Browse Source

完成 系统信息接口

hzj18279462576@163.com 2 years ago
parent
commit
8d0af89779
7 changed files with 1639 additions and 1101 deletions
  1. 45 11
      src/layout/index.vue
  2. 234 185
      src/views/apply/apply.vue
  3. 22 64
      src/views/caller/caller.vue
  4. 780 276
      src/views/grade/grade.vue
  5. 152 419
      src/views/identity/identity.vue
  6. 280 16
      src/views/info/info.vue
  7. 126 130
      src/views/user/user.vue

+ 45 - 11
src/layout/index.vue

@@ -3,12 +3,10 @@
     <SidevarItem></SidevarItem>
     <div class="content">
       <Navbar></Navbar>
-      <!-- <router-view></router-view> -->
       <router-view v-slot="{ Component }">
-        <transition mode="out-in" :duration="200" enter-active-class="animate__animated animate__fadeIn"
-          leave-active-class="animate__animated animate__fadeOut">
+        <!-- <transition name="fade"> 使用动画会出现bug--> 
           <component :is="Component" />
-        </transition>
+        <!-- </transition> -->
       </router-view>
     </div>
   </div>
@@ -57,14 +55,50 @@ onBeforeMount(async () => {
     :deep(.el-dialog__header .el-dialog__headerbtn) {
       outline: none;
     }
+    .router-view {
+      position: absolute;
+    }
+  }
+  .fade-enter-active {
+    animation: bounce-in 0.3s;
+  }
+  .fade-leave-active {
+    animation: bounce-out 0.3s;
+  }
+  @keyframes bounce-in {
+    0% {
+      transform: translate3d(-100%, 0, 0);
+    }
+    25% {
+      transform: translate3d(-75%, 0, 0);
+    }
+    50% {
+      transform: translate3d(-50%, 0, 0);
+    }
+    75% {
+      transform: translate3d(-25%, 0, 0);
+    }
+    100% {
+      transform: translate3d(0px, 0, 0);
+    }
+  }
+  @keyframes bounce-out {
+    0% {
+      transform: translate3d(0, 0, 0);
+    }
+    25% {
+      transform: translate3d(25%, 0, 0);
+    }
+    50% {
+      transform: translate3d(50%, 0, 0);
+    }
+    75% {
+      transform: translate3d(75%, 0, 0);
+    }
+    100% {
+      transform: translate3d(100%, 0, 0);
+    }
   }
-  .router_animate-enter-active {
-  animation: fadeIn 1s;
-}
-
-.router_animate-leave-active {
-  animation: fadeIn 0s;
-}
 }
 </style>
 <style lang="scss">

+ 234 - 185
src/views/apply/apply.vue

@@ -38,6 +38,7 @@
           />
           <el-table-column align="center" prop="name" label="名称" />
           <el-table-column align="center" prop="category" label="类别" />
+          <el-table-column align="center" prop="updateTime" label="创建时间" />
           <el-table-column align="center" label="操作" width="200">
             <template #default="scope">
               <div class="edit">
@@ -111,14 +112,51 @@
               class="m-2"
               placeholder="请选择类别"
               style="width: 500px"
+              @change="typeSel"
             >
               <el-option label="小程序" value="小程序" />
               <el-option label="管理后台" value="管理后台" />
             </el-select>
           </el-form-item>
-          <el-form-item label="logo图标 :" prop="logoUrl">
-            <input type="file" @change="handleFileUpload" />
-            <img :src="imgUrl" alt="" style="width: 20px; height: 20px" />
+          <el-form-item
+            v-if="editRuleForm.type == '小程序'"
+            label="logo图标 :"
+            prop="logoUrl"
+          >
+            <div class="xcxLogo">
+              <img
+                :src="editRuleForm.logoUrl"
+                alt=""
+                style="width: 80px; height: 80px"
+              />
+              <el-upload
+                class="avatar-uploader"
+                action="#"
+                ref="upload"
+                :auto-upload="false"
+                list-type="picture"
+                :on-preview="handlePreview"
+                :on-remove="handleRemove"
+                :on-change="handleChange"
+                :before-upload="beforeAvatarUpload"
+                :limit="1"
+                :on-exceed="handleExceed"
+              >
+                <template #trigger>
+                  <el-button
+                    type="primary"
+                    color="rgba(41, 109, 227, 1)"
+                    @click="updateImg"
+                    >上传图片</el-button
+                  >
+                </template>
+                <template #tip>
+                  <div class="el-upload__tip">
+                    (注:图片格式必须为JPG/PNG格式,大小不超过50Kb)
+                  </div>
+                </template>
+              </el-upload>
+            </div>
           </el-form-item>
           <el-form-item label="应用链接 :" prop="applyLink">
             <el-input
@@ -178,7 +216,7 @@ import {
   onUnmounted,
 } from "vue";
 import { useRouter } from "vue-router";
-import { ElMessage, ElMessageBox } from "element-plus";
+import { ElMessage, ElMessageBox, genFileId } from "element-plus";
 import { Calendar } from "@element-plus/icons-vue";
 import vidiconsApi from "@/api/vidicons.js";
 import { dayjs } from "element-plus";
@@ -224,22 +262,18 @@ const total = ref(4); // 当前总数
 const titleDialog = ref("");
 const editVisible = ref(false);
 const editRef = ref();
+const upload = ref();
 const editRuleForm = reactive({
   name: "", // 名称
-  applyLink: "", // 应用链接
   type: "", // 类别
+  logoUrl: "", // 图标
+  applyLink: "", // 应用链接
   id: "",
 });
-const imgUrl = ref();
-
-// 打开项目弹窗
-const applyVisible = ref(false);
-const applyTitle = ref();
-const iframeSrc = ref();
-
 // 表单验证
 const editRules = reactive({
   name: [{ required: true, message: "名称不能为空", trigger: "blur" }],
+  logoUrl: [{ required: true, message: "图标不能为空", trigger: "blur" }],
   type: [
     {
       required: true,
@@ -256,6 +290,11 @@ const editRules = reactive({
   ],
 });
 
+// 打开项目弹窗
+const applyVisible = ref(false);
+const applyTitle = ref();
+const iframeSrc = ref();
+
 // 应用管理分页数据
 const getList = async () => {
   loading.value = true;
@@ -266,7 +305,7 @@ const getList = async () => {
   };
   let res = await axios({
     method: "get",
-    url: api.value + "/smartApply/queryPageSmartApply",
+    url: api.value + "/wanzai/api/smartApply/queryPageSmartApply",
     headers: {
       // token: sessionStorage.getItem("token"),
       // user_head: sessionStorage.getItem("userhead"),
@@ -303,53 +342,188 @@ const searchBtn = lodash.debounce(async () => {
 const addApply = async () => {
   titleDialog.value = "新建应用";
   editVisible.value = true;
-  editRef.value.resetFields();
   editRuleForm.name = "";
   editRuleForm.applyLink = "";
   editRuleForm.type = "";
-  //   let data = {
-  //     linkId: row.id,
-  //   };
-  //   let res = await axios({
-  //     method: "post",
-  //     url: api.value + "/mhotel/uploadgetByLinkId.action",
-  //     headers: {},
-  //     params: data,
-  //   });
-  //   console.log(res, "编辑中查找图片");
-  //   if (res.data.code == 200) {
-  //     // res.data.data.fileInfoList.forEach((item) => {
-  //     //   item.uid = item.id;
-  //     // });
-  //     // fileList.list = res.data.data.fileInfoList;
-  //     // ruleForm.fileListJson = fileList.list;
-  //     res.data.data.forEach((item) => {
-  //       item.uid = item.id;
-  //     });
-  //     fileList.list = res.data.data;
-  //     ruleForm.fileListJson = fileList.list;
-  //     // ElMessage({
-  //     //   type: "success",
-  //     //   showClose: true,
-  //     //   message: res.data.message,
-  //     //   center: true,
-  //     // });
-  //   } else {
-  //     ElMessage({
-  //       type: "error",
-  //       showClose: true,
-  //       message: res.data.message,
-  //       center: true,
-  //     });
-  //   }
+  editRuleForm.logoUrl = "";
+  editRuleForm.id = "";
 };
+// 确定添加应用
 const confirmEdit = (formEl) => {
   if (!formEl) return;
   formEl.validate(async (valid, fields) => {
     if (valid) {
+      let data = {
+        name: editRuleForm.name,
+        category: editRuleForm.type,
+        urlLink: editRuleForm.applyLink,
+      };
+      if (editRuleForm.logoUrl) {
+        data.logo = editRuleForm.logoUrl;
+      }
+      let res = "";
+      if (editRuleForm.id) {
+        data.id = editRuleForm.id;
+        res = await axios({
+          method: "post",
+          url: api.value + "/wanzai/api/smartApply/updateSmartApplyById",
+          headers: {},
+          data: data,
+        });
+      } else {
+        res = await axios({
+          method: "post",
+          url: api.value + "/wanzai/api/smartApply/insertSmartApply",
+          headers: {},
+          data: data,
+        });
+      }
+      console.log(res, "添加/编辑应用");
+      if (res.data.code == 200) {
+        editVisible.value = false;
+        getList();
+        editRef.value.resetFields();
+        ElMessage({
+          type: "success",
+          showClose: true,
+          message: res.data.message,
+          center: true,
+        });
+      } else {
+        ElMessage({
+          type: "error",
+          showClose: true,
+          message: res.data.message,
+          center: true,
+        });
+      }
     }
   });
 };
+// 切换类别 (小程序 管理后台)
+const typeSel = () => {
+  editRuleForm.logoUrl = "";
+};
+// 封面图上传(------------------------------------------------------)
+// 添加照片时往fileList列表中添加图片信息(封面图上传图片)
+const handleChange = (file, fileLists) => {
+  console.log(file, "file11111");
+  if (file.raw.type == "image/jpeg" || file.raw.type == "image/png") {
+    if (file.size /1024 > 50) {
+      ElMessage.error("图片的大小不能超过50Kb!");
+    } else {
+      if (file.raw) {
+        const cos = new COS({
+          SecretId: "AKIDCPVZdcWIxgHpy5FYxVyPiqkZGrhdXUBg",
+          SecretKey: "NkyCN3cz97qKaeXLvHOGxOcdS8f184pL",
+          SecurityToken: "1306339220",
+          Bucket: "wanzai-1306339220",
+          Region: "ap-shanghai",
+        });
+        const files = file.raw;
+        console.log(files, "files文件");
+        const key = file.name; // 设置上传到 COS 后的文件名
+        cos.putObject(
+          {
+            Bucket: "wanzai-1306339220",
+            Region: "ap-shanghai",
+            Key: key,
+            Body: files,
+            onProgress: function (progressData) {
+              console.log(JSON.stringify(progressData));
+            },
+          },
+          function (err, data) {
+            if (err) {
+              console.error(err, "请求失败");
+            } else {
+              console.log(data, "请求成功");
+              editRuleForm.logoUrl = "https://" + data.Location;
+              // 成功
+            }
+          }
+        );
+      }
+    }
+  } else {
+    ElMessage.error("图片格式必须为JPG/PNG格式!");
+  }
+  // ruleForm.coverImg = file.url;
+};
+// 可以获取图片参数(封面图上传图片)
+const handleUpload = async (file) => {
+  console.log(file, "2222");
+  // if (xcxFile.value) {
+  //   const cos = new COS({
+  //     SecretId: "AKIDCPVZdcWIxgHpy5FYxVyPiqkZGrhdXUBg",
+  //     SecretKey: "NkyCN3cz97qKaeXLvHOGxOcdS8f184pL",
+  //     SecurityToken: "1306339220",
+  //     Bucket: "wanzai-1306339220",
+  //     Region: "ap-shanghai",
+  //   });
+
+  //   const files = file.file;
+  //   console.log(files, "files文件");
+
+  //   const key = file.file.name; // 设置上传到 COS 后的文件名
+
+  //   cos.putObject(
+  //     {
+  //       Bucket: "wanzai-1306339220",
+  //       Region: "ap-shanghai",
+  //       Key: key,
+  //       Body: files,
+  //       onProgress: function (progressData) {
+  //         console.log(JSON.stringify(progressData));
+  //       },
+  //     },
+  //     function (err, data) {
+  //       if (err) {
+  //         console.error(err, "请求失败");
+  //       } else {
+  //         console.log(data, "请求成功");
+  //         editRuleForm.logoUrl = "https://" + data.Location;
+  //         // 成功
+  //       }
+  //     }
+  //   );
+
+  //   // datas.set("files", img1File.value);
+  //   // let ress = await axios({
+  //   //   method: "post",
+  //   //   url: api.value + "/file/cos/upload",
+  //   //   headers: {},
+  //   //   data: datas,
+  //   // });
+  //   // console.log(ress, "图片上传成功封面图");
+  //   // ruleForm.coverImg = ress.data.data;
+  // }
+};
+// 移出图片(封面图上传图片)
+const handleRemove = (uploadFile, uploadFiles) => {
+  console.log(uploadFile, uploadFiles, "移出图片");
+  editRuleForm.logoUrl = "";
+};
+// 限制上传图片的大小
+const beforeAvatarUpload = (rawFile) => {
+  console.log(rawFile.type, 333333333333);
+
+  if (rawFile.type !== "image/jpeg" && rawFile.type !== "image/png") {
+    ElMessage.error("图片格式必须为JPG/PNG格式!");
+    return false;
+  } else if (rawFile.size / 1024 > 0.05) {
+    ElMessage.error("图片的大小不能超过50Kb!");
+    return false;
+  }
+  return true;
+};
+// 选中时自动替换上一个文件。
+const handleExceed = (files) => {
+  upload.value.clearFiles();
+  const file = files[0];
+  file.uid = genFileId();
+  upload.value.handleStart(file);
+};
 
 //编辑按钮  (-------------------------------------------)
 const editClick = async (row) => {
@@ -358,156 +532,28 @@ const editClick = async (row) => {
   editRuleForm.name = row.name;
   editRuleForm.type = row.category;
   editRuleForm.applyLink = row.urlLink;
+  editRuleForm.logoUrl = row.logo;
   editRuleForm.id = row.id;
-  //   let data = {
-  //     linkId: row.id,
-  //   };
-  //   let res = await axios({
-  //     method: "post",
-  //     url: api.value + "/mhotel/uploadgetByLinkId.action",
-  //     headers: {},
-  //     params: data,
-  //   });
-  //   console.log(res, "编辑中查找图片");
-  //   if (res.data.code == 200) {
-  //     // res.data.data.fileInfoList.forEach((item) => {
-  //     //   item.uid = item.id;
-  //     // });
-  //     // fileList.list = res.data.data.fileInfoList;
-  //     // ruleForm.fileListJson = fileList.list;
-  //     res.data.data.forEach((item) => {
-  //       item.uid = item.id;
-  //     });
-  //     fileList.list = res.data.data;
-  //     ruleForm.fileListJson = fileList.list;
-  //     // ElMessage({
-  //     //   type: "success",
-  //     //   showClose: true,
-  //     //   message: res.data.message,
-  //     //   center: true,
-  //     // });
-  //   } else {
-  //     ElMessage({
-  //       type: "error",
-  //       showClose: true,
-  //       message: res.data.message,
-  //       center: true,
-  //     });
-  //   }
 };
 const cancelEdit = () => {
   editVisible.value = false;
   editRef.value.resetFields();
+  editRuleForm.name = "";
+  editRuleForm.type = "";
+  editRuleForm.logoUrl = "";
+  editRuleForm.applyLink = "";
+  editRuleForm.id = "";
 };
-const handleFileUpload = (event) => {
-  const cos = new COS({
-    SecretId: "AKIDCPVZdcWIxgHpy5FYxVyPiqkZGrhdXUBg",
-    SecretKey: "NkyCN3cz97qKaeXLvHOGxOcdS8f184pL",
-    SecurityToken: "1306339220",
-    Bucket: "wanzai-1306339220",
-    Region: "ap-shanghai",
-  });
-
-  const file = event.target.files[0];
-  console.log(event.target.files);
-
-  const key = event.target.files[0].name; // 设置上传到 COS 后的文件名
-
-  cos.putObject(
-    {
-      Bucket: "wanzai-1306339220",
-      Region: "ap-shanghai",
-      Key: key,
-      Body: file,
-      onProgress: function (progressData) {
-        console.log(JSON.stringify(progressData));
-      },
-    },
-    function (err, data) {
-      if (err) {
-        console.error(err);
-      } else {
-        console.log(data);
-        imgUrl.value = "https://" + data.Location;
-        // 成功
-      }
-    }
-  );
-};
-
-// const beforePicUpload = async () => {
-//   await getSign();
-// };
-// const getSign = async () => {
-//   //让这个请求变成同步请求
-//   let data = { suffix: ".png" };
-//   let res = await axios({
-//     method: "get",
-//     url: api.value + "/upload/ossSign",
-//     headers: {},
-//     params: data,
-//   });
-//   console.log(res, "编辑中查找图片");
-//   // await this.$http.get("/common/oss/sign").then(response => {
-//   //   //接收预签名url链接
-//   //   console.log(response.data.data);// response.data
-//   // });
-//   uploadUrl.value = response.data.data;
-// };
-// const uploadImage = (file) => {
-//   // 这里的`file`参数是要上传的文件对象
-//   // 在这里根据需要添加一些逻辑,如显示进度条
-//   console.log(file, "upload");
-
-//   return new Promise((resolve, reject) => {
-//     const xhr = new XMLHttpRequest();
-//     //element-ui默认使用post提交,但是我们生成的url需要使用 put 提交
-//     //需要指定 put 直传,以及this.uploadUrl(后端返回的url)
-//     xhr.open("PUT", uploadUrl.value, true);
-//     //设置上传文件的类型
-//     xhr.setRequestHeader("Content-Type", file.file.type); // 或者 file.type
-//     xhr.onreadystatechange = () => {
-//       if (xhr.readyState === 4) {
-//         if (xhr.status === 200) {
-//           resolve(xhr.response);
-//           //进入到这里就表明上传成功了
-//           //我这里对后端返回的url进行截取方便存入数据库,因为前端还需要展示图片
-//           let indexOf = this.uploadUrl.indexOf("?");
-//           this.addForm.pic = this.uploadUrl.slice(0, indexOf);
-//         } else {
-//           reject(xhr.statusText);
-//         }
-//       }
-//     };
-//     xhr.onerror = () => {
-//       reject(xhr.statusText);
-//     };
-//     //发送
-//     xhr.send(file.file); //或者 file
-//   });
-// };
-// // 上传文件之前的钩子,参数为上传的文件
-// const beforeAvatarUpload = (rawFile) => {
-//   if (rawFile.type !== "image/jpeg" && rawFile.type !== "image/png") {
-//     ElMessage.error("图片格式必须为JPG/PNG格式!");
-//     return false;
-//   } else if (rawFile.size / 1024 / 1024 > 10) {
-//     ElMessage.error("图片的大小不能超过10MB!");
-//     return false;
-//   }
-//   return true;
-// };
 
 // (-------------------------------------------------------------)
-
 //删除按钮
 const del = async (row) => {
   let data = {
     id: row.id,
   };
   let res = await axios({
-    method: "post",
-    url: api.value + "/mhotel/housedelHouser.action",
+    method: "get",
+    url: api.value + "/wanzai/api/smartApply/deleteSmartApplyById",
     headers: {
       // token: sessionStorage.getItem("token"),
       // user_head: sessionStorage.getItem("userhead"),
@@ -777,6 +823,9 @@ onBeforeMount(async () => {
           cursor: pointer;
           user-select: none;
         }
+        .el-upload-list{
+          display: none;
+        }
       }
       .options {
         margin: 30px 20px 20px 0;

+ 22 - 64
src/views/caller/caller.vue

@@ -268,68 +268,26 @@ const router = useRouter();
 const loading = ref(false);
 const tableData = reactive({
   list: [
-    {
-      name: "张三",
-      phone: "15012589658",
-      icCard: "362502200202152356",
-      txnum: "5",
-      carNum: "赣K2536",
-      thing: "接人",
-      status: "1",
-      createTime: "2023-12-13 09:39:30",
-      comeTime: "2023-12-13 12:39:30",
-      interviewee: "张四",
-      intervieweeBM: "教师",
-      intervieweePhone: "13646865956",
-    },
-    {
-      name: "李明",
-      phone: "15012589658",
-      icCard: "362502200202152356",
-      txnum: "5",
-      carNum: "赣K2536",
-      thing: "接人",
-      status: "1",
-      createTime: "2023-12-13 09:39:30",
-      comeTime: "2023-12-13 12:39:30",
-      interviewee: "李小",
-      intervieweeBM: "教师",
-      intervieweePhone: "13646865956",
-    },
-    {
-      name: "王五",
-      phone: "15012589658",
-      icCard: "362502200202152356",
-      txnum: "5",
-      carNum: "赣K2536",
-      thing: "接人",
-      status: "2",
-      createTime: "2023-12-13 09:39:30",
-      comeTime: "2023-12-13 12:39:30",
-      interviewee: "王六",
-      intervieweeBM: "教师",
-      intervieweePhone: "13646865956",
-    },
-    {
-      name: "张航",
-      phone: "15012589658",
-      icCard: "362502200202152356",
-      txnum: "5",
-      carNum: "赣K2536",
-      thing: "接人",
-      status: "3",
-      createTime: "2023-12-13 09:39:30",
-      comeTime: "2023-12-13 12:39:30",
-      interviewee: "张利",
-      intervieweeBM: "教师",
-      intervieweePhone: "13646865956",
-    },
+    // {
+    //   name: "张三",
+    //   phone: "15012589658",
+    //   icCard: "362502200202152356",
+    //   txnum: "5",
+    //   carNum: "赣K2536",
+    //   thing: "接人",
+    //   status: "1",
+    //   createTime: "2023-12-13 09:39:30",
+    //   comeTime: "2023-12-13 12:39:30",
+    //   interviewee: "张四",
+    //   intervieweeBM: "教师",
+    //   intervieweePhone: "13646865956",
+    // },
   ],
 });
 
 const searchInput = reactive({
   keyWord: "",
-  type: "",
+  type: "0",
   createTime: "",
 }); // 搜索按钮数据
 
@@ -396,30 +354,30 @@ const editRules = reactive({
 // 删除弹窗
 const selDelVisible = ref(false);
 
-// 查看房型列表
+// 预约记录分页数据
 const getList = async () => {
   // loading.value = true;
   let data = {
     currentPage: currentPage.value,
     pageCount: pageCount.value,
-    userId: "", // 当前用户ID
-    type: searchInput.keyWord, // 类型
+    // userId: "", // 当前用户ID
+    type: searchInput.type, // 类型
     // managerId: sessionStorage.getItem("token"),
   };
   let res = await axios({
     method: "get",
-    url: api.value + "/smartVisitor/appointmentPageRecor",
+    url: api.value + "wanzai/api/smartVisitor/appointmentPageRecord",
     headers: {
       // token: sessionStorage.getItem("token"),
       // user_head: sessionStorage.getItem("userhead"),
     },
     params: data,
   });
-  console.log(res, "房型管理");
+  console.log(res, "预约记录");
   if (res.data.code == 200) {
     loading.value = false;
-    tableData.list = res.data.data.pageList;
-    total.value = res.data.data.total;
+    tableData.list = res.data.data.list;
+    total.value = res.data.data.totalCount;
     // ElMessage({
     //   type: "success",
     //   showClose: true,

File diff suppressed because it is too large
+ 780 - 276
src/views/grade/grade.vue


+ 152 - 419
src/views/identity/identity.vue

@@ -75,8 +75,9 @@
             type="index"
             label="序号"
           />
-          <el-table-column align="center" prop="userName" label="身份" />
-          <el-table-column align="center" prop="userPhone" label="身份id" />
+          <el-table-column align="center" prop="name" label="身份" />
+          <el-table-column align="center" prop="id" label="身份id" />
+          <el-table-column align="center" prop="createTime" label="创建时间" />
           <el-table-column align="center" label="操作" width="200">
             <template #default="scope">
               <div class="edit">
@@ -87,7 +88,7 @@
                   cancel-button-text="取消"
                   :icon="InfoFilled"
                   icon-color="#f89626"
-                  title="是否删除此房型?"
+                  title="是否删除此身份?"
                   @confirm="del(scope.row)"
                   @cancel="cancelEvent"
                 >
@@ -135,25 +136,26 @@
           label-position="left"
           status-icon
         >
-          <el-form-item label="身份 :" prop="userDepartment">
+          <el-form-item label="身份 :" prop="identity">
             <el-input
-              v-model="editRuleForm.userDepartment"
+              v-model="editRuleForm.identity"
               placeholder="请输入身份"
               clearable
               style="width: 500px"
             />
           </el-form-item>
-          <el-form-item label="应用管理 :" prop="userName">
+          <el-form-item label="应用管理 :" prop="apply">
             <el-select
-              v-model="editRuleForm.userName"
+              v-model="editRuleForm.apply"
               multiple
               placeholder="请选择应用管理"
               style="width: 500px"
             >
-              <el-option label="学生肖像" value="1" />
-              <el-option label="车辆预约" value="2" />
-              <el-option label="校园打卡" value="3" />
-              <el-option label="校园报修" value="4" />
+              <el-option
+                v-for="i in applyData"
+                :label="i.name"
+                :value="`${i.id}`"
+              />
             </el-select>
           </el-form-item>
           <!-- <el-form-item label="用户角色 :" prop="userRoles">
@@ -256,30 +258,9 @@ const tableData = reactive({
       userName: "张三",
       userPhone: 15,
       teamName: 12,
-    },
-    {
-      userName: "李四",
-      userPhone: 150,
-      teamName: 12,
-    },
-    {
-      userName: "栗子",
-      userPhone: 10,
-      teamName: 12,
-    },
-    {
-      userName: "王明",
-      userPhone: 50,
-      teamName: 12,
-    },
-    {
-      userName: "小明",
-      userPhone: 50,
-      teamName: 12,
-    },
+    }
   ],
 });
-
 const searchInput = reactive({
   keyWord: "",
   createTime: "",
@@ -294,114 +275,80 @@ const titleDialog = ref("");
 const editVisible = ref(false);
 const editRef = ref();
 const editRuleForm = reactive({
-  userDepartment: "", // 用户部门
-  userName: "", // 用户名
-  userRoles: "", // 用户角色
-  schoolCard: "", // 微校卡号
-  idNumber: "", // 身份证号
-  fingerprint: "", // 指纹
+  identity: "", // 身份
+  apply: "", // 应用
   id: "",
 });
+const applyData = ref(); // 应用管理数据
 
 // 表单验证
 const editRules = reactive({
-  userDepartment: [
-    { required: true, message: "身份不能为空", trigger: "blur" },
-  ],
-  userName: [
+  identity: [{ required: true, message: "身份不能为空", trigger: "blur" }],
+  apply: [
     {
       required: true,
       message: "应用管理不能为空",
       trigger: "blur",
     },
   ],
-  userRoles: [
-    {
-      required: true,
-      message: "用户角色不能为空",
-      trigger: "blur",
-    },
-  ],
-  schoolCard: [
-    {
-      required: true,
-      message: "微校卡号不能为空",
-      trigger: "blur",
-    },
-  ],
-  idNumber: [
-    {
-      required: true,
-      message: "身份证号不能为空",
-      trigger: "blur",
-    },
-  ],
-  fingerprint: [
-    {
-      required: true,
-      message: "指纹不能为空",
-      trigger: "blur",
-    },
-  ],
 });
 
-// 添加指纹弹窗(-----------------------------------------------)
-const addFingerprintVisible = ref(false);
-const stepindex = ref(0); // 录取指纹步骤
-const step = reactive({
-  list: [
-    { id: 1, title: "" },
-    { id: 2, title: "" },
-    { id: 3, title: "" },
-    { id: 4, title: "" },
-  ],
-}); // 指纹步骤数据
-const ws = ref("");
-
-// 添加身份证弹窗(-------------------------------------------)
-const addIdentityCardVisible = ref(false);
-// const wsidentityCard = ref("");
-const identityCardTitle = ref("");
-// const identityCardNum = ref(""); // 身份证卡号
-const identityCardIndex = ref(0); // 读卡步骤
-
 // 身份分页列表
 const getList = async () => {
-    loading.value = true;
-    let data = {
-      currentPage: currentPage.value,
-      pageCount: pageSize.value,
-      name: searchInput.keyWord, // 关键字名称
-    };
-    let res = await axios({
-      method: "get",
-      url: api.value + "/wanzai/api/smartIdentity/queryPageSmartIdentity",
-      headers: {
-        // token: sessionStorage.getItem("token"),
-        // user_head: sessionStorage.getItem("userhead"),
-      },
-      params: data,
+  loading.value = true;
+  let data = {
+    currentPage: currentPage.value,
+    pageCount: pageSize.value,
+    name: searchInput.keyWord, // 关键字名称
+  };
+  let res = await axios({
+    method: "get",
+    url: api.value + "/wanzai/api/smartIdentity/queryPageSmartIdentity",
+    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.list;
+    total.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,
     });
-    console.log(res, "身份分页数据");
-    if (res.data.code == 200) {
-      loading.value = false;
-      tableData.list = res.data.data.list;
-      total.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,
-      });
-    }
+  }
+};
+// 获取应用列表
+const applyList = async () => {
+  let data = {
+    currentPage: 1,
+    pageCount: 100,
+    // managerId: sessionStorage.getItem("token"),
+  };
+  let res = await axios({
+    method: "get",
+    url: api.value + "/wanzai/api/smartApply/queryPageSmartApply",
+    headers: {
+      // token: sessionStorage.getItem("token"),
+      // user_head: sessionStorage.getItem("userhead"),
+    },
+    params: data,
+  });
+  applyData.value = res.data.data.list;
+  console.log(res, "应用管理分页数据");
 };
 
 // 搜索功能
@@ -412,327 +359,112 @@ const searchBtn = lodash.debounce(async () => {
 const addClick = async () => {
   titleDialog.value = "新增";
   editVisible.value = true;
-  //   let data = {
-  //     linkId: row.id,
-  //   };
-  //   let res = await axios({
-  //     method: "post",
-  //     url: api.value + "/mhotel/uploadgetByLinkId.action",
-  //     headers: {},
-  //     params: data,
-  //   });
-  //   console.log(res, "编辑中查找图片");
-  //   if (res.data.code == 200) {
-  //     // res.data.data.fileInfoList.forEach((item) => {
-  //     //   item.uid = item.id;
-  //     // });
-  //     // fileList.list = res.data.data.fileInfoList;
-  //     // ruleForm.fileListJson = fileList.list;
-  //     res.data.data.forEach((item) => {
-  //       item.uid = item.id;
-  //     });
-  //     fileList.list = res.data.data;
-  //     ruleForm.fileListJson = fileList.list;
-  //     // ElMessage({
-  //     //   type: "success",
-  //     //   showClose: true,
-  //     //   message: res.data.message,
-  //     //   center: true,
-  //     // });
-  //   } else {
-  //     ElMessage({
-  //       type: "error",
-  //       showClose: true,
-  //       message: res.data.message,
-  //       center: true,
-  //     });
-  //   }
+  editRuleForm.identity = "";
+  editRuleForm.apply = "";
+  editRuleForm.id = "";
 };
 
 //编辑按钮  (-------------------------------------------)
-const editClick = async () => {
+const editClick = async (row) => {
   titleDialog.value = "编辑";
   editVisible.value = true;
-  //   let data = {
-  //     linkId: row.id,
-  //   };
-  //   let res = await axios({
-  //     method: "post",
-  //     url: api.value + "/mhotel/uploadgetByLinkId.action",
-  //     headers: {},
-  //     params: data,
-  //   });
-  //   console.log(res, "编辑中查找图片");
-  //   if (res.data.code == 200) {
-  //     // res.data.data.fileInfoList.forEach((item) => {
-  //     //   item.uid = item.id;
-  //     // });
-  //     // fileList.list = res.data.data.fileInfoList;
-  //     // ruleForm.fileListJson = fileList.list;
-  //     res.data.data.forEach((item) => {
-  //       item.uid = item.id;
-  //     });
-  //     fileList.list = res.data.data;
-  //     ruleForm.fileListJson = fileList.list;
-  //     // ElMessage({
-  //     //   type: "success",
-  //     //   showClose: true,
-  //     //   message: res.data.message,
-  //     //   center: true,
-  //     // });
-  //   } else {
-  //     ElMessage({
-  //       type: "error",
-  //       showClose: true,
-  //       message: res.data.message,
-  //       center: true,
-  //     });
-  //   }
+  editRuleForm.identity = row.name;
+  editRuleForm.apply = row.applyIds;
+  editRuleForm.id = row.id;
 };
 
 const cancelEdit = () => {
   editVisible.value = false;
   editRef.value.resetFields();
+  editRuleForm.identity = "";
+  editRuleForm.apply = "";
+  editRuleForm.id = "";
 };
-// // 树形结构 复选框被触发
-// const handleCheckChange = (data, checked, indeterminate) => {
-//   //   console.log(data, checked, indeterminate);
-//   if (data.list) {
-//     // console.log(data.list);
-//   } else {
-//     if (checked) {
-//       roomNumRef.value.setCheckedKeys([data.id]);
-//     }
-//     let keys = roomNumRef.value.getCheckedKeys();
-//     console.log(keys);
-//     editRuleForm.roomNum = keys;
-//   }
-// };
-// // 树形结构 被点击时触发
-// const roomNumClick = (data, node, component) => {
-//   //  * @description: node - click 节点被点击时的回调
-//   //  * @param {*} data 该节点所对应的对象
-//   //  * @param {*} node 节点对应的 Node
-//   //  * @param {*} component 节点组件本身
-//   console.log("子组件触发 node-click 事件", data, node, component);
-//   //   buildIdsRef.value.setCheckedKeys(item.build);
-// };
 
 // 确定编辑
 const confirmEdit = (formEl) => {
   if (!formEl) return;
   formEl.validate(async (valid, fields) => {
     if (valid) {
-    }
-  });
-};
-
-//删除按钮
-const del = async (row) => {
-  let data = {
-    id: row.id,
-  };
-  //   let res = await axios({
-  //     method: "post",
-  //     url: api.value + "/mhotel/housedelHouser.action",
-  //     headers: {
-  //       // token: sessionStorage.getItem("token"),
-  //       // user_head: sessionStorage.getItem("userhead"),
-  //     },
-  //     params: data,
-  //   });
-  //   if (res.data.code == 200) {
-  //     if (tableData.list.length == 1 && currentPage.value != 1) {
-  //       currentPage.value = currentPage.value - 1;
-  //     }
-  //     getList();
-  //     ElMessage({
-  //       type: "success",
-  //       showClose: true,
-  //       message: res.data.message,
-  //       center: true,
-  //     });
-  //   } else {
-  //     ElMessage({
-  //       type: "error",
-  //       showClose: true,
-  //       message: res.data.message,
-  //       center: true,
-  //     });
-  //   }
-  // console.log(res);
-};
-
-// 指纹录取 下一步 (-------------------------------------------------)
-const entering = () => {
-  addFingerprintVisible.value = true;
-  step.list = [
-    { id: 1, title: "" },
-    { id: 2, title: "" },
-    { id: 3, title: "" },
-    { id: 4, title: "" },
-  ];
-  stepindex.value = 0;
-  var wsUrl = "ws://localhost:8181/";
-  let websocket = new WebSocket(wsUrl);
-  ws.value = websocket;
-  websocket.onopen = function (evt) {
-    var params = { type: 101, data: null };
-    websocket.send(JSON.stringify(params));
-  };
-  websocket.onmessage = function (evt) {
-    // console.log(evt.data, "输出指纹数据");
-    let data = JSON.parse(evt.data);
-    if (data.type == 0) {
-      console.log(JSON.parse(evt.data).data.portNames[1]); // 获取到 USB接口
-      let params1 = {
-        type: 1,
-        data: {
-          type: 0,
-          portName: JSON.parse(evt.data).data.portNames[1],
-          baudRate: 115200,
-        },
-      };
-      websocket.send(JSON.stringify(params1));
-    } else if (data.type == 110) {
-      console.log("已获取设备信息");
-    } else if (data.type == 11) {
-      var params2 = {
-        type: 2,
-        data: {
-          totalStep: 4,
-        },
+      let data = {
+        name: editRuleForm.identity,
+        applyIds: editRuleForm.apply,
       };
-      websocket.send(JSON.stringify(params2));
-    } else if (data.type == 21) {
-      if (data.data.step == 0) {
-        // console.log("请按压指纹");
+      let res = "";
+      // 根据id判断是编辑还是添加
+      if (editRuleForm.id) {
+        data.id = editRuleForm.id;
+        res = await axios({
+          method: "post",
+          url: api.value + "/wanzai/api/smartIdentity/updateSmartIdentityById",
+          headers: {},
+          data: data,
+        });
+      } else {
+        res = await axios({
+          method: "post",
+          url: api.value + "/wanzai/api/smartIdentity/insertSmartIdentity",
+          headers: {},
+          data: data,
+        });
+      }
+
+      console.log(res, "添加成功");
+      if (res.data.code == 200) {
+        editVisible.value = false;
+        getList();
         ElMessage({
-          message: "请开始按压指纹",
           type: "success",
+          showClose: true,
+          message: res.data.message,
+          center: true,
         });
       } else {
-        // console.log(`请按下同一指纹,第${data.data.step}次按压`);
-        if (data.data.step <= 4) {
-          step.list.forEach((item) => {
-            if (item.id == data.data.step) {
-              item.title = `请按下同一指纹,第${data.data.step}次录入指纹成功`;
-            }
-          });
-        }
-        stepindex.value = data.data.step;
-      }
-      // _this.$message.warning("请将手指按在传感器上");
-      if (data.data.step > 4) {
-        var params = {
-          type: 3,
-          data: {
-            id: data.data.id,
-          },
-        };
-        websocket.send(JSON.stringify(params));
+        ElMessage({
+          type: "error",
+          showClose: true,
+          message: res.data.message,
+          center: true,
+        });
       }
-    } else if (data.type == 31) {
-      editRuleForm.fingerprint = data.data.template;
-
-      console.log(data.data.template, "指纹数据");
-      addFingerprintVisible.value = false;
-      ws.value.close();
-      ElMessage({
-        message: "指纹录取成功",
-        type: "success",
-      });
-      // setTimeout(() => {
-      //   _this.fingerprintShow = false;
-      //   ws.value.close();
-      // }, 1500);
-    } else {
-      ElMessage({
-        message: "设备连接失败,请刷新重新录入",
-        type: "error",
-      });
     }
-  };
-  websocket.onclose = function (evt) {
-    console.log("关闭连接");
-    // ws.value.close();
-  };
-  websocket.onerror = function (evt) {
-    // console.log("错误提示");
-  };
-};
-// 关闭指纹录入
-const cancelAddFingerprint = () => {
-  addFingerprintVisible.value = false;
-  // var wsUrl = "ws://localhost:8181/";
-  // const websocket = new WebSocket(wsUrl);
-  ws.value.close();
+  });
 };
-// 读卡操作(---------------------------------------------)
-const Card = () => {
-  var wsUrl = "ws://localhost:8181/";
-  let websocket = new WebSocket(wsUrl);
-  // wsidentityCard.value = websocket;
-  websocket.onopen = function (evt) {
-    var params = { type: 104, data: null };
-    websocket.send(JSON.stringify(params));
-  };
 
-  websocket.onmessage = function (evt) {
-    let data = JSON.parse(evt.data);
-    console.log(data);
-    if (data.type == 141) {
-      identityCardTitle.value = "请插入设备";
-      identityCardIndex.value = 0;
-    } else if (data.type == 150) {
-      identityCardTitle.value = "配置失败,请放置卡片";
-      identityCardIndex.value = 1;
-    } else if (data.type == 140) {
-      console.log(data.data.uid, "读取的卡号");
-
-      identityCardIndex.value = 2;
-      identityCardTitle.value = "读卡中";
-
-      if (data.data.uid) {
-        setTimeout(() => {
-          identityCardIndex.value = 3;
-          identityCardTitle.value = "读卡成功";
-        }, 1500);
-      }
-      editRuleForm.idNumber = data.data.uid;
-
-      // ElMessage({
-      //   type: "success",
-      //   showClose: true,
-      //   message: "添加卡片成功",
-      //   center: true,
-      // });
-
-      // identityCardTitle.value = "获取卡号成功";
-
-      // addIdentityCardVisible.value = false;
-      // identityCardVisible.value = false;
-      // identityCardRef.value.resetFields();
-
-      // setTimeout(() => {
-      //   _this.icCardShow = false;
-      // }, 2000);
-    }
+//删除按钮
+const del = async (row) => {
+  let data = {
+    id: row.id,
   };
-};
-// 身份证读卡 下一步
-const readCard = () => {
-  addIdentityCardVisible.value = true;
-  Card();
-};
-// 重试 身份卡
-const retry = () => {
-  // identityCardNum.value = "";
-  Card();
-};
-const cancelAddIdentityCard = () => {
-  addIdentityCardVisible.value = false;
-  identityCardIndex.value = 0;
+  let res = await axios({
+    method: "get",
+    url: api.value + "/wanzai/api/smartIdentity/deleteSmartIdentityById",
+    headers: {
+      // token: sessionStorage.getItem("token"),
+      // user_head: sessionStorage.getItem("userhead"),
+    },
+    params: data,
+  });
+  if (res.data.code == 200) {
+    if (tableData.list.length == 1 && currentPage.value != 1) {
+      currentPage.value = currentPage.value - 1;
+    }
+    getList();
+    ElMessage({
+      type: "success",
+      showClose: true,
+      message: res.data.message,
+      center: true,
+    });
+  } else {
+    ElMessage({
+      type: "error",
+      showClose: true,
+      message: res.data.message,
+      center: true,
+    });
+  }
+  // console.log(res);
 };
 
 // 多选框功能
@@ -810,6 +542,7 @@ const handleCurrentChange = (value) => {
 onBeforeMount(async () => {
   api.value = store.state.user.api;
   getList();
+  applyList(); // 应用列表
 });
 onUnmounted(() => {
   // document.removeEventListener("keyup", Enters);

+ 280 - 16
src/views/info/info.vue

@@ -9,11 +9,7 @@
         <el-button type="primary" v-if="showSchool" @click="saveSchool"
           >保存</el-button
         >
-        <el-button
-          type="primary"
-          plain
-          v-if="showSchool"
-          @click="showSchool = false"
+        <el-button type="primary" plain v-if="showSchool" @click="cancelSchool"
           >取消</el-button
         >
 
@@ -44,13 +40,21 @@
       <div class="info info2">
         <span class="info_key">校徽:</span>
 
-        <el-upload action="none">
+        <el-upload
+          class="avatar-uploader"
+          action="#"
+          :auto-upload="false"
+          :on-change="handleChange"
+          ref="upload"
+          :limit="1"
+          :on-exceed="handleExceed"
+        >
           <el-button class="info_btn" type="primary" plain v-if="showSchool">
             点击上传
           </el-button>
         </el-upload>
 
-        <img class="info_img" src="@/assets/school_logo.jpg" fit="cover" />
+        <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">
           <el-icon>
@@ -61,14 +65,22 @@
       <div class="info info2">
         <span class="info_key">管理平台logo:</span>
 
-        <el-upload action="none">
+        <el-upload
+          class="avatar-uploader"
+          action="#"
+          :auto-upload="false"
+          :on-change="handleChange2"
+          ref="upload2"
+          :limit="1"
+          :on-exceed="handleExceed2"
+        >
           <el-button class="info_btn" type="primary" plain v-if="showSchool">
             点击上传
           </el-button>
         </el-upload>
 
-        <img class="info_img" src="@/assets/school_logo.jpg" fit="cover" />
-        <!-- <div class="info_img" v-if="!logoImg">暂无图片</div> -->
+        <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">
           <el-icon>
@@ -84,7 +96,7 @@
         <el-button type="primary" v-if="showApp" @click="saveApp"
           >保存</el-button
         >
-        <el-button type="primary" plain v-if="showApp" @click="showApp = false"
+        <el-button type="primary" plain v-if="showApp" @click="cancelApp"
           >取消</el-button
         >
         <el-button type="primary" v-if="!showApp" @click="editApp"
@@ -126,8 +138,27 @@
 </template>
 
 <script setup>
-import { ref } from "vue";
-
+import {
+  ref,
+  reactive,
+  watch,
+  nextTick,
+  onBeforeMount,
+  onUnmounted,
+} from "vue";
+import COS from "cos-js-sdk-v5";
+import { useRouter } from "vue-router";
+import { ElMessage, ElMessageBox, genFileId } from "element-plus";
+import { Camera } from "@element-plus/icons-vue";
+import { dayjs } from "element-plus";
+import lodash from "lodash";
+import axios from "axios";
+import { useStore } from "vuex";
+const store = useStore();
+const api = ref("");
+const router = useRouter();
+
+const infoId = ref(); // 基本信息id
 // 学校编码
 const schoolCode = ref(4851511515);
 
@@ -135,10 +166,12 @@ const schoolCode = ref(4851511515);
 const schoolName = ref("万载县第三中学");
 
 // 校徽图片地址
-const schoolImg = ref("@/assets/school_logo.jpg");
+const schoolImg = ref();
+const upload = ref();
 
 // 管理平台logo图片地址
 const logoImg = ref("");
+const upload2 = ref();
 
 // 公众号名称
 const appName = ref("万载县第三中学");
@@ -155,14 +188,90 @@ const showSchool = ref(false);
 // 公众号信息展示编辑切换
 const showApp = ref(false);
 
+// 基本信息数据
+const getList = async () => {
+  let data = {
+    // managerId: sessionStorage.getItem("token"),
+  };
+  let res = await axios({
+    method: "get",
+    url: api.value + "/wanzai/api/smartSchool/querySmartSchool",
+    headers: {
+      // token: sessionStorage.getItem("token"),
+      // user_head: sessionStorage.getItem("userhead"),
+    },
+    // params: data,
+  });
+  console.log(res, "学校基本信息");
+  if (res.data.code == 200) {
+    schoolCode.value = res.data.data.schoolCode;
+    schoolImg.value = res.data.data.schoolBadge;
+    schoolName.value = res.data.data.name;
+    logoImg.value = res.data.data.logoImage;
+    appName.value = res.data.data.officialName;
+    appAppid.value = res.data.data.appid;
+    appOldId.value = res.data.data.originalId;
+    infoId.value = res.data.data.id;
+  } else {
+    // loading.value = false;
+    ElMessage({
+      type: "error",
+      showClose: true,
+      message: res.data.message,
+      center: true,
+    });
+  }
+};
+
 // 学校信息修改按钮回调
 const editSchool = () => {
   showSchool.value = true;
 };
 
 // 学校信息保存按钮回调
-const saveSchool = () => {
+const saveSchool = async () => {
+  let data = {
+    id: infoId.value,
+    schoolCode: schoolCode.value,
+    name: schoolName.value,
+    schoolBadge: schoolImg.value,
+    logoImage: logoImg.value,
+    officialName: appName.value,
+    appid: appAppid.value,
+    originalId: appOldId.value,
+  };
+  let res = await axios({
+    method: "post",
+    url: api.value + "/wanzai/api/smartSchool/updateSmartSchoolById",
+    headers: {
+      // token: sessionStorage.getItem("token"),
+      // user_head: sessionStorage.getItem("userhead"),
+    },
+    data: data,
+  });
+  console.log(res, "修改成功");
+  if (res.data.code == 200) {
+    showSchool.value = false;
+    getList();
+    ElMessage({
+      type: "success",
+      showClose: true,
+      message: res.data.message,
+      center: true,
+    });
+  } else {
+    ElMessage({
+      type: "error",
+      showClose: true,
+      message: res.data.message,
+      center: true,
+    });
+  }
+};
+// 学校信息取消按钮回调
+const cancelSchool = () => {
   showSchool.value = false;
+  getList();
 };
 
 // 公众号修改按钮回调
@@ -171,14 +280,166 @@ const editApp = () => {
 };
 
 // 公众号保存按钮回调
-const saveApp = () => {
+const saveApp = async () => {
+  let data = {
+    id: infoId.value,
+    schoolCode: schoolCode.value,
+    name: schoolName.value,
+    schoolBadge: schoolImg.value,
+    logoImage: logoImg.value,
+    officialName: appName.value,
+    appid: appAppid.value,
+    originalId: appOldId.value,
+  };
+  let res = await axios({
+    method: "post",
+    url: api.value + "/wanzai/api/smartSchool/updateSmartSchoolById",
+    headers: {
+      // token: sessionStorage.getItem("token"),
+      // user_head: sessionStorage.getItem("userhead"),
+    },
+    data: data,
+  });
+  console.log(res, "修改成功");
+  if (res.data.code == 200) {
+    showApp.value = false;
+    getList();
+    ElMessage({
+      type: "success",
+      showClose: true,
+      message: res.data.message,
+      center: true,
+    });
+  } else {
+    ElMessage({
+      type: "error",
+      showClose: true,
+      message: res.data.message,
+      center: true,
+    });
+  }
+};
+// 公众号取消按钮回调
+const cancelApp = () => {
   showApp.value = false;
+  getList();
 };
 
 // 删除图标按钮回调
 const handleDelete = () => {
   console.log("删除图片");
 };
+
+// 校徽图上传(------------------------------------------------------)
+const handleChange = (file, fileLists) => {
+  console.log(file, "file11111");
+  if (file.raw.type == "image/jpeg" || file.raw.type == "image/png") {
+    if (file.size / 1024 > 100) {
+      ElMessage.error("图片的大小不能超过100Kb!");
+    } else {
+      if (file.raw) {
+        const cos = new COS({
+          SecretId: "AKIDCPVZdcWIxgHpy5FYxVyPiqkZGrhdXUBg",
+          SecretKey: "NkyCN3cz97qKaeXLvHOGxOcdS8f184pL",
+          SecurityToken: "1306339220",
+          Bucket: "wanzai-1306339220",
+          Region: "ap-shanghai",
+        });
+        const files = file.raw;
+        console.log(files, "files文件");
+        const key = file.name; // 设置上传到 COS 后的文件名
+        cos.putObject(
+          {
+            Bucket: "wanzai-1306339220",
+            Region: "ap-shanghai",
+            Key: key,
+            Body: files,
+            onProgress: function (progressData) {
+              console.log(JSON.stringify(progressData));
+            },
+          },
+          function (err, data) {
+            if (err) {
+              console.error(err, "请求失败");
+            } else {
+              console.log(data, "请求成功");
+              schoolImg.value = "https://" + data.Location;
+              // 成功
+            }
+          }
+        );
+      }
+    }
+  } else {
+    ElMessage.error("图片格式必须为JPG/PNG格式!");
+  }
+  // ruleForm.coverImg = file.url;
+};
+// 选中时自动替换上一个文件。
+const handleExceed = (files) => {
+  upload.value.clearFiles();
+  const file = files[0];
+  file.uid = genFileId();
+  upload.value.handleStart(file);
+};
+
+// 管理平台logo图上传(------------------------------------------------------)
+const handleChange2 = (file, fileLists) => {
+  console.log(file, "file11111");
+  if (file.raw.type == "image/jpeg" || file.raw.type == "image/png") {
+    if (file.size / 1024 > 100) {
+      ElMessage.error("图片的大小不能超过100Kb!");
+    } else {
+      if (file.raw) {
+        const cos = new COS({
+          SecretId: "AKIDCPVZdcWIxgHpy5FYxVyPiqkZGrhdXUBg",
+          SecretKey: "NkyCN3cz97qKaeXLvHOGxOcdS8f184pL",
+          SecurityToken: "1306339220",
+          Bucket: "wanzai-1306339220",
+          Region: "ap-shanghai",
+        });
+        const files = file.raw;
+        console.log(files, "files文件");
+        const key = file.name; // 设置上传到 COS 后的文件名
+        cos.putObject(
+          {
+            Bucket: "wanzai-1306339220",
+            Region: "ap-shanghai",
+            Key: key,
+            Body: files,
+            onProgress: function (progressData) {
+              console.log(JSON.stringify(progressData));
+            },
+          },
+          function (err, data) {
+            if (err) {
+              console.error(err, "请求失败");
+            } else {
+              console.log(data, "请求成功");
+              logoImg.value = "https://" + data.Location;
+              // 成功
+            }
+          }
+        );
+      }
+    }
+  } else {
+    ElMessage.error("图片格式必须为JPG/PNG格式!");
+  }
+  // ruleForm.coverImg = file.url;
+};
+// 选中时自动替换上一个文件。
+const handleExceed2 = (files) => {
+  upload.value.clearFiles();
+  const file = files[0];
+  file.uid = genFileId();
+  upload.value.handleStart(file);
+};
+
+onBeforeMount(async () => {
+  api.value = store.state.user.api;
+  getList();
+});
 </script>
 
 <style scoped lang="scss">
@@ -202,6 +463,9 @@ const handleDelete = () => {
   .scroll {
     height: calc(100% - 61px);
     overflow: auto;
+    :deep(.el-upload-list) {
+      display: none;
+    }
   }
   .title {
     display: flex;

+ 126 - 130
src/views/user/user.vue

@@ -174,7 +174,7 @@
             <el-table-column align="center" label="操作" width="200">
               <template #default="scope">
                 <div class="edit">
-                  <div class="look" @click="editClick(scope.row)">查看</div>
+                  <div class="look" @click="editClick(scope.row)">编辑</div>
                 </div>
               </template>
             </el-table-column>
@@ -283,6 +283,7 @@
                 <el-upload
                   class="avatar-uploader"
                   action="#"
+                  :auto-upload="false"
                   :on-preview="handlePreview"
                   :on-remove="handleRemove"
                   :on-change="handleChange"
@@ -297,7 +298,8 @@
                   </template>
                   <template #tip>
                     <div class="el-upload__tip">
-                      支持扩展名:.jpg .png,五官清晰无遮挡,名字+后缀
+                      支持扩展名:.jpg
+                      .png,五官清晰无遮挡,名字+后缀,大小不超过50kb
                     </div>
                   </template>
                 </el-upload>
@@ -379,7 +381,7 @@
                 remote
                 :remote-method="conteactMethod"
                 :loading="conteactLoading"
-                placeholder="Select"
+                placeholder="请选择联系人"
                 style="width: 500px"
               >
                 <el-option
@@ -1032,71 +1034,17 @@ const treeNodeName = ref();
 // 表格数据
 const loading = ref(false);
 const tableData = reactive({
-  // list: [
-  //   {
-  //     userName: "张三",
-  //     type: "越界",
-  //     position: "教学楼",
-  //     img: "https://nimg.ws.126.net/?url=http%3A%2F%2Fdingyue.ws.126.net%2F2021%2F1123%2F77d07411j00r30gwf004dc000go00b4m.jpg&thumbnail=660x2147483647&quality=80&type=jpg",
-  //     remark: "请规范好学生行为",
-  //     status: "已处理",
-  //     time: "2023-12-02 11:05:30",
-  //   },
-  //   {
-  //     userName: "王卿",
-  //     type: "越界",
-  //     position: "教学楼",
-  //     img: "https://nimg.ws.126.net/?url=http%3A%2F%2Fdingyue.ws.126.net%2F2021%2F1123%2F77d07411j00r30gwf004dc000go00b4m.jpg&thumbnail=660x2147483647&quality=80&type=jpg",
-  //     remark: "请规范好学生行为",
-  //     status: "已处理",
-  //     time: "2023-12-02 11:05:30",
-  //   },
-  //   {
-  //     userName: "李明",
-  //     type: "越界",
-  //     position: "教学楼",
-  //     img: "https://nimg.ws.126.net/?url=http%3A%2F%2Fdingyue.ws.126.net%2F2021%2F1123%2F77d07411j00r30gwf004dc000go00b4m.jpg&thumbnail=660x2147483647&quality=80&type=jpg",
-  //     remark: "请规范好学生行为",
-  //     status: "已处理",
-  //     time: "2023-12-02 11:05:30",
-  //   },
-  //   {
-  //     userName: "涂涂",
-  //     type: "越界",
-  //     position: "教学楼",
-  //     img: "https://nimg.ws.126.net/?url=http%3A%2F%2Fdingyue.ws.126.net%2F2021%2F1123%2F77d07411j00r30gwf004dc000go00b4m.jpg&thumbnail=660x2147483647&quality=80&type=jpg",
-  //     remark: "请规范好学生行为",
-  //     status: "已处理",
-  //     time: "2023-12-02 11:05:30",
-  //   },
-  //   {
-  //     userName: "小红",
-  //     type: "越界",
-  //     position: "教学楼",
-  //     img: "https://nimg.ws.126.net/?url=http%3A%2F%2Fdingyue.ws.126.net%2F2021%2F1123%2F77d07411j00r30gwf004dc000go00b4m.jpg&thumbnail=660x2147483647&quality=80&type=jpg",
-  //     remark: "请规范好学生行为",
-  //     status: "已处理",
-  //     time: "2023-12-02 11:05:30",
-  //   },
-  //   {
-  //     userName: "小明",
-  //     type: "越界",
-  //     position: "教学楼",
-  //     img: "https://nimg.ws.126.net/?url=http%3A%2F%2Fdingyue.ws.126.net%2F2021%2F1123%2F77d07411j00r30gwf004dc000go00b4m.jpg&thumbnail=660x2147483647&quality=80&type=jpg",
-  //     remark: "请规范好学生行为",
-  //     status: "已处理",
-  //     time: "2023-12-02 11:05:30",
-  //   },
-  //   {
-  //     userName: "例子",
-  //     type: "越界",
-  //     position: "教学楼",
-  //     img: "https://nimg.ws.126.net/?url=http%3A%2F%2Fdingyue.ws.126.net%2F2021%2F1123%2F77d07411j00r30gwf004dc000go00b4m.jpg&thumbnail=660x2147483647&quality=80&type=jpg",
-  //     remark: "请规范好学生行为",
-  //     status: "已处理",
-  //     time: "2023-12-02 11:05:30",
-  //   },
-  // ],
+  list: [
+    // {
+    //   userName: "张三",
+    //   type: "越界",
+    //   position: "教学楼",
+    //   img: "https://nimg.ws.126.net/?url=http%3A%2F%2Fdingyue.ws.126.net%2F2021%2F1123%2F77d07411j00r30gwf004dc000go00b4m.jpg&thumbnail=660x2147483647&quality=80&type=jpg",
+    //   remark: "请规范好学生行为",
+    //   status: "已处理",
+    //   time: "2023-12-02 11:05:30",
+    // },
+  ],
 });
 const searchInput = reactive({
   keyWord: "", // 姓名或学号关键字
@@ -1104,7 +1052,7 @@ const searchInput = reactive({
 }); // 搜索按钮数据
 const homeShow = ref(true);
 const currentPage = ref(1); // 当前页
-const pageSize = ref(10);
+const pageSize = ref(7);
 const total = ref(8); // 当前总数
 
 // 修改部门 (----------------------------------------------)
@@ -1451,7 +1399,6 @@ const confirmAmendBM = async (formEl) => {
             center: true,
           });
           amendBMVisible.value = false;
-
           getDepartment();
           console.log(treeNodeId.value, amendBMRuleForm.id);
           if (treeNodeId.value == amendBMRuleForm.id) {
@@ -1729,6 +1676,7 @@ const confirmAddMember = async (formEl) => {
         });
         homeShow.value = true;
         addMemberShow.value = false;
+        addMemberRef.value.resetFields();
         getList();
       } else {
         ElMessage({
@@ -1746,6 +1694,7 @@ const confirmAddMember = async (formEl) => {
 const addMemberConcel = () => {
   addMemberShow.value = false;
   homeShow.value = true;
+  addMemberRef.value.resetFields();
 };
 // 移出照片
 const handleRemove = (uploadFile, uploadFiles) => {
@@ -1759,50 +1708,58 @@ const handlePreview = (file) => {
   // console.log(file, "00000000");
 };
 // 限制上传图片的大小
-const beforeAvatarUpload = (rawFile) => {
-  // console.log(rawFile, 33333);
-  if (rawFile.type !== "image/jpeg" && rawFile.type !== "image/png") {
-    ElMessage.error("图片格式必须为JPG/PNG格式!");
-    return false;
-  } else if (rawFile.size / 1024 / 1024 > 10) {
-    ElMessage.error("图片的大小不能超过10MB!");
-    return false;
-  }
-  return true;
-};
+// const beforeAvatarUpload = (rawFile) => {
+//   console.log(rawFile, 33333);
+//   if (rawFile.type !== "image/jpeg" && rawFile.type !== "image/png") {
+//     ElMessage.error("图片格式必须为JPG/PNG格式!");
+//     return false;
+//   } else if (rawFile.size / 1024 > 150) {
+//     ElMessage.error("图片的大小不能超过150kb!");
+//     return false;
+//   }
+//   return true;
+// };
 // 添加照片时往fileList列表中添加图片信息
 const handleChange = async (file, fileLists) => {
   console.log(file, "1111");
-  const cos = new COS({
-    SecretId: "AKIDCPVZdcWIxgHpy5FYxVyPiqkZGrhdXUBg",
-    SecretKey: "NkyCN3cz97qKaeXLvHOGxOcdS8f184pL",
-    SecurityToken: "1306339220",
-    Bucket: "wanzai-1306339220",
-    Region: "ap-shanghai",
-  });
-  const files = file.raw;
-  console.log(files);
-  const key = file.raw.name; // 设置上传到 COS 后的文件名
-  cos.putObject(
-    {
-      Bucket: "wanzai-1306339220",
-      Region: "ap-shanghai",
-      Key: key,
-      Body: files,
-      onProgress: function (progressData) {
-        console.log(JSON.stringify(progressData));
-      },
-    },
-    function (err, data) {
-      if (err) {
-        console.error(err);
-      } else {
-        console.log(data, "获取成功");
-        addMemberRuleForm.facePhoto = "https://" + data.Location;
-        // 成功
-      }
+  if (file.raw.type == "image/jpeg" || file.raw.type == "image/png") {
+    if (file.size / 1024 <= 150) {
+      const cos = new COS({
+        SecretId: "AKIDCPVZdcWIxgHpy5FYxVyPiqkZGrhdXUBg",
+        SecretKey: "NkyCN3cz97qKaeXLvHOGxOcdS8f184pL",
+        SecurityToken: "1306339220",
+        Bucket: "wanzai-1306339220",
+        Region: "ap-shanghai",
+      });
+      const files = file.raw;
+      console.log(files);
+      const key = file.raw.name; // 设置上传到 COS 后的文件名
+      cos.putObject(
+        {
+          Bucket: "wanzai-1306339220",
+          Region: "ap-shanghai",
+          Key: key,
+          Body: files,
+          onProgress: function (progressData) {
+            console.log(JSON.stringify(progressData));
+          },
+        },
+        function (err, data) {
+          if (err) {
+            console.error(err);
+          } else {
+            console.log(data, "获取成功");
+            addMemberRuleForm.facePhoto = "https://" + data.Location;
+            // 成功
+          }
+        }
+      );
+    } else {
+      ElMessage.error("图片的大小不能超过150kb!");
     }
-  );
+  } else {
+    ElMessage.error("图片格式必须为JPG/PNG格式!");
+  }
 };
 // 可以获取图片参数
 const handleUpload = async (file) => {
@@ -2183,6 +2140,49 @@ const delDelClick = () => {
     });
   }
 };
+// 确定删除
+const confirmSelDel = async () => {
+  let userId = [];
+  selectData.list.forEach((i) => {
+    userId.push(i.id);
+  });
+  let data = {
+    userIds: userId,
+  };
+  let res = await axios({
+    method: "post",
+    url: api.value + "/wanzai/api/smartUser/deleteSmartUserById",
+    headers: {
+      // token: sessionStorage.getItem("token"),
+      // user_head: sessionStorage.getItem("userhead"),
+    },
+    data: data,
+  });
+  console.log(res, "删除成功");
+  if (res.data.code == 200) {
+    selDelVisible.value = false;
+    if (
+      selectData.list.length == tableData.list.length &&
+      currentPage.value != 1
+    ) {
+      currentPage.value = currentPage.value - 1;
+    }
+    getList();
+    ElMessage({
+      type: "success",
+      showClose: true,
+      message: res.data.message,
+      center: true,
+    });
+  } else {
+    ElMessage({
+      type: "error",
+      showClose: true,
+      message: res.data.message,
+      center: true,
+    });
+  }
+};
 const cancelSelDel = () => {
   selDelVisible.value = false;
 };
@@ -2201,26 +2201,19 @@ const importExcel = async () => {
       // user_head: sessionStorage.getItem("userhead"),
     },
     params: data,
+    responseType: "blob",
   });
   console.log(res, "导出用户");
-  if (res.data.code == 200) {
-    // const elt = document.createElement("a");
-    // elt.setAttribute(
-    //   "href",
-    //   "https://chtech.ncjti.edu.cn/carstop" + res.data.downurl
-    // );
-    // elt.setAttribute("download", "file.png");
-    // elt.style.display = "none";
-    // document.body.appendChild(elt);
-    // elt.click();
-    var downloadPath = res.data.data;
-    var downloadLink = document.createElement("a");
-    downloadLink.style.display = "none"; // 使其隐藏
-    downloadLink.href = downloadPath;
-    downloadLink.download = "";
-    downloadLink.click();
-    document.body.appendChild(downloadLink);
-    document.body.removeChild(downloadLink);
+  if (res.status == 200) {
+    let name = `用户信息表`;
+    var content = res.data;
+    var datas = new Blob([content]);
+    var downloadUrl = window.URL.createObjectURL(datas);
+    var anchor = document.createElement("a");
+    anchor.href = downloadUrl;
+    anchor.download = name + ".xlsx";
+    anchor.click();
+    window.URL.revokeObjectURL(datas);
     ElMessage({
       type: "success",
       showClose: true,
@@ -2254,8 +2247,8 @@ const handleCurrentChange = (value) => {
 
 onBeforeMount(async () => {
   api.value = store.state.user.api;
-  getDepartment();
-  classDataList();
+  getDepartment(); // 左边部门树形结构
+  classDataList(); // 添加成员中 获取身份数据下拉、年级数据下拉、班级数据下拉
 });
 onUnmounted(() => {
   // document.removeEventListener("keyup", Enters);
@@ -2573,6 +2566,9 @@ onUnmounted(() => {
               // height:50px;
             }
           }
+          :deep(.el-upload-list) {
+            display: none;
+          }
         }
         .startImport {
           .el-button {