zhuangyunsheng 1 سال پیش
والد
کامیت
5de3f88642

+ 7 - 5
src/layout/components/NavBar/index.vue

@@ -23,7 +23,10 @@
             </div>
             <div class="tjm_user_container">
                 <el-dropdown>
-                    <el-avatar :size="36" :src="avatar" />
+                    <el-avatar :size="36" src="https://cube.elemecdn.com/3/7c/3ea6beec64369c2642b92c6726f1epng.png" @error="errorHandler">
+                        <img :src="avatar" />
+                    </el-avatar>
+
                     <template #dropdown>
                         <el-dropdown-menu>
                             <el-dropdown-item @click='goUserInfo'>个人信息</el-dropdown-item>
@@ -47,7 +50,8 @@ const settingStore = useSettingStore()
 const { collapse, layoutStyle } = storeToRefs(settingStore)
 import { useUserStore } from '@/store/user.js'
 const router = useRouter()
-const avatar = ref(useUserStore().userInfo.avatar || "https://cube.elemecdn.com/3/7c/3ea6beec64369c2642b92c6726f1epng.png");
+const avatar = ref(useUserStore().userInfo.avatar);
+const errorHandler = () => true
 
 function goUserInfo() {
     router.push('/userInfo')
@@ -58,9 +62,7 @@ const logout = () => {
         cancelButtonText: '取消',
         type: 'warning'
     }).then(() => {
-        useUserStore().logOut().then(() => {
-            location.href = '/index'
-        })
+        useUserStore().logOut().then(() => location.href = "/index");
     }).catch(() => { })
 }
 </script>

+ 1 - 3
src/utils/request.js

@@ -37,9 +37,7 @@ request.interceptors.response.use(
 
         if (error.response.data.code == 401 || error.response.status == 401) {
             ElMessageBox.confirm("登录状态已过期,请重新登录", "系统提示", { confirmButtonText: "重新登录", cancelButtonText: "取消", type: "warning" }).then(() => {
-                useUserStore().logOut().then(() => {
-                    location.href = "/index"
-                })
+                useUserStore().logOut().then(() => location.href = "/index");
             })
         } else {
             if (message == "Network Error") {

+ 1 - 2
src/views/error/noPermission.vue

@@ -13,11 +13,10 @@
 </template>
 
 <script setup>
-import router from "@/router";
 import { useUserStore } from "@/store/user";
 
 function go() {
-    useUserStore().logOut().then(() => router.push("/login"));
+    useUserStore().logOut().then(() => location.href = "/index");
 }
 </script>
 

+ 2 - 2
src/views/home/index.vue

@@ -65,7 +65,7 @@
                             <svg-icon v-if="item.meta.icon.indexOf('tjm') !== -1" :icon-class="item.meta.icon.slice(4)" />
                         </el-icon>
                     </template>
-                    {{ item.label}}
+                    {{ item.name }}
                 </el-button>
             </el-button-group>
         </div>
@@ -106,7 +106,7 @@ export default {
     computed: {
         fixedRouters() {
             const router = usePermissionStore().sidebarRouters.filter(r => r.children && r.children.length == 1).map(r => r.children[0]);
-            return fixedMenus.map(m => router.find(r => m.path == r.path) && Object.assign(m, router.find(r => m.path == r.path)) || null).filter(m => m);
+            return fixedMenus.map(m => router.find(r => m.path == r.path) || null).filter(m => m);
         },
 
         domainTitle() {

+ 2 - 2
src/views/login/index.vue

@@ -159,8 +159,8 @@ const login = () => {
         font-size: 16px;
 
         :deep(.el-input__wrapper) {
-          box-shadow: 0 0;
           border-radius: calc(2 * var(--el-border-radius-base));
+          box-shadow: unset;
 
           .el-input__prefix {
             padding: 0 calc(25px / 2);
@@ -175,7 +175,7 @@ const login = () => {
             padding-left: 11px;
             font-family: PingFang SC;
             font-weight: 600;
-  			box-shadow: 0 0 50px #fff inset;
+            box-shadow: 0 0 1000px #fff inset;
           }
         }
       }

+ 2 - 164
src/views/login/updatePwd.vue

@@ -107,169 +107,7 @@ defineExpose({
 </script>
 
 <style lang='scss' scoped>
-.tjm_login {
-  margin: 0;
-  padding: 0;
-  display: flex;
-  width: 100%;
-  height: 100%;
-  display: flex;
-  justify-content: space-between;
-  .el-carousel {
-    position: fixed; //视频定位方式设为固定
-    right: 0;
-    bottom: 0; //视频位置
-    min-width: 100%;
-    min-height: 100%; //不会因视频尺寸造成页面需要滚动
-    width: auto;
-    height: auto; //尺寸保持原视频大小
-    z-index: -100; //z轴定位,小于0即可
-
-    img {
-      width: 100%;
-      height: 100%;
-    }
-  }
-
-  .left {
-    position: fixed; //视频定位方式设为固定
-    height: 100%;
-    min-height: 100%; //不会因视频尺寸造成页面需要滚动
-    .logo {
-      img {
-        width: 316px;
-        height: 72px;
-        margin: 46px 0 0 80px;
-        // border:1px solid red;
-      }
-    }
-  }
-  .right {
-    position: fixed; //视频定位方式设为固定
-    width: 500px;
-    right: 0;
-    min-height: 100%; //不会因视频尺寸造成页面需要滚动
-    background: rgba(255, 255, 255, 0.68);
-    border-left: 1px solid #ffffff;
-    box-shadow: 2px 0px 0px 0px rgba(255, 255, 255, 1) inset;
-    display: flex;
-    flex-direction: column;
-    align-items: center;
-    .title {
-      width: 81.6%;
-      font-family: PingFang SC;
-      font-size: 36px;
-      font-weight: 600;
-      line-height: 28px;
-      margin: 100px 0 0;
-    }
-
-    .sub-title {
-      font-size: 28px;
-      font-weight: 500;
-    }
-    .select_login_type {
-      width: 81.6%;
-      height: 38px;
-      margin: 86px 0 0 0px;
-      display: flex;
-      .type_item {
-        font-family: PingFang SC;
-        font-size: 16px;
-        font-weight: 500;
-        text-align: left;
-        line-height: 28px;
-        color: rgba(102, 102, 102, 1);
-        margin-right: 40px;
-        cursor: pointer;
-      }
-      .type_item_active {
-        color: rgba(0, 0, 0, 1);
-        font-family: PingFang SC;
-        font-size: 16px;
-        font-weight: 600;
-        line-height: 28px;
-        text-align: left;
-        display: flex;
-        flex-direction: column;
-        justify-content: space-between;
-        .select {
-          width: 65px;
-          height: 4px;
-          gap: 0px;
-          border-radius: 8px 0px 0px 0px;
-          opacity: 0px;
-
-          background: linear-gradient(270.6deg, #165dff 2.71%, #45b1ff 99.81%);
-        }
-      }
-    }
-    .input_tjm {
-      width: 81.6%;
-      position: relative;
-      //
-      .tjm_input_icon {
-        position: absolute;
-        top: 40px;
-        left: 24px;
-        width: 24px;
-        height: 24px;
-        img {
-          width: 24px;
-          height: 24px;
-        }
-      }
-      input {
-        width: 100%;
-        height: 52px;
-        margin-top: 28px;
-        background: rgba(255, 255, 255, 1);
-        border-radius: 8px;
-        border: none;
-        user-select: none;
-        outline: none;
-        font-family: PingFang SC;
-        font-size: 16px;
-        font-weight: 600;
-        line-height: 52px;
-        text-align: left;
-        color: rgba(29, 33, 41, 1);
-        text-indent: 68px;
-      }
-    }
-    .account_ctx {
-      margin-top: 40px;
-    }
-    .tjm_login_btn {
-      cursor: pointer;
-      width: 81.6%;
-      height: 56px;
-      background: linear-gradient(270.6deg, #165dff 2.71%, #45b1ff 99.81%);
-      margin: 72px 0 0 0px;
-      color: rgba(255, 255, 255, 1);
-      font-family: PingFang SC;
-      font-size: 20px;
-      font-weight: 600;
-      line-height: 56px;
-      text-align: center;
-      border-radius: 8px;
-    }
-    .tjm_other_opea {
-      width: 81.6%;
-      height: 22px;
-      margin: 28px 0 0 0px;
-      gap: 0px;
-      opacity: 0px;
-      display: flex;
-      justify-content: space-between;
-      span {
-        cursor: pointer;
-        font-size: 16px;
-        font-weight: 400;
-        text-align: center;
-        color: rgba(29, 33, 41, 0.65);
-      }
-    }
-  }
+.el-form .el-form-item .el-input :deep(.el-input__inner) {
+  box-shadow: 0 0 1000px #fff inset;
 }
 </style>

+ 5 - 1
src/views/system/dept.vue

@@ -173,6 +173,7 @@
 
 <script setup>
 import { getMainList, setDepart, addDepart, deleteDepart } from "@/api/system/depart"
+import API from "@/api/system/log";
 const loading = ref(false) //加载
 const total = ref(0)
 //查询
@@ -268,6 +269,7 @@ function submitForm() {
                 params.state = params.state ? 0 : 1
                 setDepart(params).then(res => {
                     if (res.code === 200) {
+                        API.add("修改", "system_dept");
                         ElMessage({
                             message: "修改成功",
                             type: "success"
@@ -285,6 +287,7 @@ function submitForm() {
                 params.state = params.state ? 0 : 1
                 addDepart(params).then(res => {
                     if (res.code === 200) {
+                        API.add("新增", "system_dept");
                         ElMessage({
                             message: "新增成功",
                             type: "success"
@@ -307,6 +310,7 @@ function deleteDepartClick(row) {
     }).then(() => {
         deleteDepart(row.id).then(res => {
             if (res.code === 200) {
+                API.add("删除", "system_dept");
                 ElMessage({
                     message: "删除成功",
                     type: "success"
@@ -319,7 +323,7 @@ function deleteDepartClick(row) {
                 })
             }
         })
-    })
+    }).catch(() => ElMessage.info("已取消"))
 }
 getList()
 </script>

+ 7 - 2
src/views/system/log/main.js

@@ -2,12 +2,17 @@ export const typeDic = {
     login_system: "登录系统",
     logout_system: "退出系统",
     update_password: "修改密码",
-    system_userInfo: "用户信息",
+    update_userInfo: "用户信息",
+
+    system_user: "用户管理",
+    system_role: "角色管理",
+    system_dept: "部门管理",
+    system_menu: "菜单管理",
+    policy_template: "模板管理",
 
     policy_share: "政策分享",
     policy_strive: "政策争取",
     policy_case: "案例分享",
     policy_message: "留言",
-    policy_template: "模板管理",
     policy_condition: "应填报日期管理"
 }

+ 9 - 19
src/views/system/menu.vue

@@ -267,6 +267,7 @@
 
 <script setup>
 import { getMenuTree, addMenu, modMenu, delMenu } from "@/api/system/menu.js"
+import API from "@/api/system/log";
 import { watch } from "vue"
 
 const { proxy } = getCurrentInstance()
@@ -321,12 +322,13 @@ function submitForm() {
                 modMenu(form.value).then(res => {
                     console.log(res)
                     if (res.code == 200) {
+                        API.add("修改", "system_menu");
+                        open.value = false
                         ElMessage({
                             message: res.msg,
                             type: "success"
                         })
                         getMenuTreeList()
-                        open.value = false
                     } else {
                         ElMessage({
                             message: res.msg,
@@ -338,12 +340,13 @@ function submitForm() {
                 addMenu(form.value).then(res => {
                     console.log(res)
                     if (res.code == 200) {
-                        getMenuTreeList()
+                        API.add("新增", "system_menu");
                         open.value = false
                         ElMessage({
                             message: res.msg,
                             type: "success"
                         })
+                        getMenuTreeList()
                     } else {
                         ElMessage({
                             message: res.msg,
@@ -362,25 +365,11 @@ function cancel() {
     open.value = false
 }
 
-//
-onMounted(() => {
-})
-
 function getMenuTreeList() {
     getMenuTree(10001).then(res => {
         console.log("获取的菜单", res)
         if (res.code === 200) {
-            if (res.data.length && res.data[0].children) {
-                // const array = []
-                // res.data[0].children.forEach((item) => {
-                //   if (item.menuType === 3) {
-                //     array.push(item)
-                //   }
-                // })
-                tableData.value = res.data
-            } else {
-                tableData.value = res.data
-            }
+            tableData.value = res.data
         }
     })
 }
@@ -503,11 +492,12 @@ function handleDelete(row) {
         delMenu({ id: row.id }).then(res => {
             console.log(res)
             if (res.code == 200) {
-                getMenuTreeList()
+                API.add("删除", "system_menu");
                 ElMessage({
                     message: res.msg,
                     type: "success"
                 })
+                getMenuTreeList()
             } else {
                 ElMessage({
                     message: res.msg,
@@ -515,7 +505,7 @@ function handleDelete(row) {
                 })
             }
         })
-    })
+    }).catch(() => ElMessage.info("已取消"))
 }
 
 getMenuTreeList()

+ 40 - 35
src/views/system/role.vue

@@ -201,7 +201,7 @@
             </el-tabs>
             <template #footer>
                 <div class="dialog-footer">
-                    <el-button type="primary" @click="saveAllTree">确 定</el-button>
+                    <el-button type="primary" @click="saveTree">确 定</el-button>
                     <el-button @click="sendShow = false">取 消</el-button>
                 </div>
             </template>
@@ -221,6 +221,7 @@ import {
     setRoleMenuTree,
     setRolePortTree
 } from "@/api/system/role"
+import API from "@/api/system/log";
 
 const activeName = ref("first")
 const defaultProps = ref({
@@ -327,6 +328,7 @@ function submitForm() {
                 params.state = params.state ? 0 : 1
                 setRole(params).then(res => {
                     if (res.code === 200) {
+                        API.add("修改", "system_role");
                         ElMessage({
                             message: "修改成功",
                             type: "success"
@@ -344,6 +346,7 @@ function submitForm() {
                 params.state = params.state ? 0 : 1
                 addRole(params).then(res => {
                     if (res.code === 200) {
+                        API.add("新增", "system_role");
                         ElMessage({
                             message: "新增成功",
                             type: "success"
@@ -391,35 +394,35 @@ function sendPermissions(row) {
         }
     })
 
-    getPortTree().then(res => {
-        if (res.code === 200) {
-            treeData2.value = res.data
-            //获取角色接口菜单树
-            getRolePortTree(row.id).then(resp => {
-                checkedMenuKeys2.value = []
-                if (!resp.data.length) {
-                    proxy.$refs["treeRef2"].setCheckedNodes(checkedMenuKeys2.value, false)
-                    sendShow.value = true
-                    console.log("都没选中接口")
-                } else {
-                    //
-                    let keys = []
-                    for (let li of resp.data) {
-                        keys.push(li.id)
-                    }
-                    // //解决
-                    // //首先拿到 树形数据 所有的最深层的节点
-                    let lastKeys = deepList([], treeData2.value[0].children)
-                    // //拿着接口返回的选中的 去所有深层节点查找  取交集  就是 最终选中的
-                    checkedMenuKeys2.value = [...new Set(lastKeys)].filter(item => {
-                        return keys.includes(item)
-                    })
-                    console.log(checkedMenuKeys2.value, "123")
-                    sendShow.value = true
-                }
-            })
-        }
-    })
+    // getPortTree().then(res => {
+    //     if (res.code === 200) {
+    //         treeData2.value = res.data
+    //         //获取角色接口菜单树
+    //         getRolePortTree(row.id).then(resp => {
+    //             checkedMenuKeys2.value = []
+    //             if (!resp.data.length) {
+    //                 proxy.$refs["treeRef2"].setCheckedNodes(checkedMenuKeys2.value, false)
+    //                 sendShow.value = true
+    //                 console.log("都没选中接口")
+    //             } else {
+    //                 //
+    //                 let keys = []
+    //                 for (let li of resp.data) {
+    //                     keys.push(li.id)
+    //                 }
+    //                 // //解决
+    //                 // //首先拿到 树形数据 所有的最深层的节点
+    //                 let lastKeys = deepList([], treeData2.value[0].children)
+    //                 // //拿着接口返回的选中的 去所有深层节点查找  取交集  就是 最终选中的
+    //                 checkedMenuKeys2.value = [...new Set(lastKeys)].filter(item => {
+    //                     return keys.includes(item)
+    //                 })
+    //                 console.log(checkedMenuKeys2.value, "123")
+    //                 sendShow.value = true
+    //             }
+    //         })
+    //     }
+    // })
 }
 
 function deepList(lastKeys, data) {
@@ -449,10 +452,11 @@ function saveTree() {
     // 调用 API,传递所有必要的节点
     setRoleMenuTree(selectedRow.value.id, { menuIds: allKeys.join(","), roleId: selectedRow.value.id }).then(res => {
         if (res.code === 200) {
-            // ElMessage({
-            //   message: "分配成功",
-            //   type: "success"
-            // })
+            API.add("分配权限", "system_role");
+            ElMessage({
+              message: "分配成功",
+              type: "success"
+            })
             sendShow.value = false
         } else {
             ElMessage({
@@ -496,6 +500,7 @@ function deleteRoleClick(row) {
     }).then(() => {
         deleteRole(row.id).then(res => {
             if (res.code === 200) {
+                API.add("删除", "system_role");
                 ElMessage({
                     message: "删除成功",
                     type: "success"
@@ -508,7 +513,7 @@ function deleteRoleClick(row) {
                 })
             }
         })
-    })
+    }).catch(() => ElMessage.info("已取消"))
 }
 </script>
 

+ 10 - 7
src/views/system/user.vue

@@ -1,6 +1,7 @@
 <script setup>
 import { getMainList } from "@/api/system/depart.js"
 import { getRoleList } from "@/api/system/role"
+import API from "@/api/system/log";
 import {
     getUserList,
     addUser,
@@ -132,6 +133,7 @@ function submitForm() {
         if (valid) {
             if (form.value.id != undefined) {
                 modUser(form.value).then(res => {
+                    API.add("修改", "system_user");
                     if (res.code == 200) {
                         byUserIduPRole(form.value.id, {
                             roleIds: form.value.roleIds.join(",")
@@ -160,6 +162,7 @@ function submitForm() {
             } else {
                 addUser(form.value).then(res => {
                     if (res.code == 200) {
+                        API.add("新增", "system_user");
                         byUserIduPRole(res.data.id, {
                             roleIds: form.value.roleIds.join(",")
                         }).then(result => {
@@ -225,6 +228,7 @@ function delUserBtn(row) {
         delUser({ ids: row.id }).then(res => {
             console.log(res)
             if (res.code == 200) {
+                API.add("删除", "system_user");
                 getUserListData()
                 ElMessage({
                     message: res.msg,
@@ -237,7 +241,7 @@ function delUserBtn(row) {
                 })
             }
         })
-    })
+    }).catch(() => ElMessage.info("已取消"))
 }
 const selectionChangeData = ref([])
 function selectionChange(value) {
@@ -263,6 +267,7 @@ function delUserMoreBtn() {
         delUser({ ids: arr.join(",") }).then(res => {
             console.log(res)
             if (res.code == 200) {
+                API.add("批量删除", "system_user");
                 getUserListData()
                 ElMessage({
                     message: res.msg,
@@ -275,7 +280,7 @@ function delUserMoreBtn() {
                 })
             }
         })
-    })
+    }).catch(() => ElMessage.info("已取消"))
 }
 
 function resetUserPwdBtn(row) {
@@ -286,11 +291,9 @@ function resetUserPwdBtn(row) {
     }).then(() => {
         restPwdUser({ id: row.id }).then(res => {
             if (res.code == 200) {
+                API.add("重置密码", "system_user");
                 getUserListData()
-                ElMessage({
-                    message: res.msg,
-                    type: "success"
-                })
+                ElNotification.success({ title: "提示", message: `密码已重置,密码为:${res.data}` });
             } else {
                 ElMessage({
                     message: res.msg,
@@ -298,7 +301,7 @@ function resetUserPwdBtn(row) {
                 })
             }
         })
-    })
+    }).catch(() => ElMessage.info("已取消"))
 }
 </script>
 

+ 26 - 50
src/views/system/userInfo.vue

@@ -1,25 +1,13 @@
 <template>
     <div class="userInfoWarp">
         <div class="left">
-            <div class="avater">
-                <el-upload
-                    v-if="isEdit"
-                    :show-file-list="false"
-                    :http-request="customRequest"
-                    :before-upload="beforeAvatarUpload"
-                    :limit="1"
-                >
-                    <img v-if="form.avatar" :src="form.avatar" class="avatar" />
-                    <el-icon v-else class="avatar-uploader-icon">
-                        <Plus />
-                    </el-icon>
-                </el-upload>
-                <img
-                    v-else
-                    :src="originForm.avatar"
-                    alt=""
-                />
-            </div>
+            <el-upload v-if="isEdit" class="avatar-upload" :show-file-list="false" accept=".jpg, .png" :limit="1" :before-upload="beforeAvatarUpload" :http-request="customRequest">
+                <el-icon><Plus /></el-icon>
+            </el-upload>
+            <el-avatar v-else :size="113" src="https://cube.elemecdn.com/3/7c/3ea6beec64369c2642b92c6726f1epng.png" @error="errorHandler">
+                <img :src="originForm.avatar" />
+            </el-avatar>
+
             <div class="desc">你好,尊敬的用户 {{ originForm.name }}</div>
             <div class="info">
                 <div class="info_item">
@@ -184,6 +172,8 @@ onMounted(() => {
     getList()
 })
 
+const errorHandler = () => true
+
 function getList() {
     getUserInfo().then((res) => {
         if (res.code == 200) {
@@ -216,7 +206,7 @@ function changeInfo() {
                 if (res.code == 200) {
                     ElMessage.success("修改成功");
                     isEdit.value = false;
-                    API.add("修改", "system_userInfo");
+                    API.add("用户修改信息", "update_userInfo");
                     getList();
                 }
             })
@@ -241,7 +231,7 @@ function changePassword() {
                 if (res.code == 200) {
                     cancelPassword()
                     ElMessage.success('密码修改成功')
-                    API.add("修改密码", "update_password").then(() => useUserStore().logOut().then(() => router.push("/login")));
+                    API.add("用户修改密码", "update_password").then(() => useUserStore().logOut().then(() => location.href = "/index"));
                 } else {
                     ElMessage.error(res.msg)
                 }
@@ -284,53 +274,39 @@ function beforeAvatarUpload(rawFile) {
 </script>
 
 <style lang='scss' scoped>
-.avatar-uploader .el-upload {
-  border: 1px dashed var(--el-border-color);
-  border-radius: 6px;
-  cursor: pointer;
-  position: relative;
-  overflow: hidden;
-  transition: var(--el-transition-duration-fast);
-}
-
-.avatar-uploader .el-upload:hover {
-  border-color: var(--el-color-primary);
-}
-
-.el-icon.avatar-uploader-icon {
-  font-size: 28px;
-  color: #8c939d;
-  width: 113px;
-  height: 113px;
-  text-align: center;
-}
-
 .userInfoWarp {
   width: 100%;
   background: #ffffff;
   display: flex;
 
   .left {
-    width: 40%;
     display: flex;
     flex-direction: column;
     align-items: center;
-
+    width: 40%;
+    padding-top: 60px;
     font-family: Alibaba PuHuiTi 3, Alibaba PuHuiTi 30;
     font-weight: normal;
     font-size: 16px;
     color: #000000;
 
-    .avater {
+    .avatar-upload :deep(.el-upload) {
       width: 113px;
       height: 113px;
       border-radius: 50%;
-      overflow: hidden;
-      margin-top: 60px;
+      border: 1px dashed var(--el-border-color);
 
-      img {
-        width: 100%;
-        height: 100%;
+      .el-icon {
+        font-size: 28px;
+        color: #8c939d;
+      }
+
+      &:hover {
+        border-color: var(--el-color-primary);
+
+        .el-icon {
+          color: var(--el-color-primary);
+        }
       }
     }