You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

1 lines
12 KiB

{"ast":null,"code":"import { createElementVNode as _createElementVNode, createCommentVNode as _createCommentVNode, createVNode as _createVNode, resolveComponent as _resolveComponent, withCtx as _withCtx, openBlock as _openBlock, createBlock as _createBlock, toDisplayString as _toDisplayString, createTextVNode as _createTextVNode } from \"vue\";\nconst _hoisted_1 = {\n class: \"header-right\"\n};\nexport function render(_ctx, _cache, $props, $setup, $data, $options) {\n const _component_el_icon = _resolveComponent(\"el-icon\");\n const _component_el_menu_item = _resolveComponent(\"el-menu-item\");\n const _component_el_menu = _resolveComponent(\"el-menu\");\n const _component_el_aside = _resolveComponent(\"el-aside\");\n const _component_el_button = _resolveComponent(\"el-button\");\n const _component_el_header = _resolveComponent(\"el-header\");\n const _component_router_view = _resolveComponent(\"router-view\");\n const _component_el_main = _resolveComponent(\"el-main\");\n const _component_el_container = _resolveComponent(\"el-container\");\n return _openBlock(), _createBlock(_component_el_container, {\n class: \"layout-container\"\n }, {\n default: _withCtx(() => [_createVNode(_component_el_aside, {\n width: \"200px\"\n }, {\n default: _withCtx(() => [_cache[4] || (_cache[4] = _createElementVNode(\"div\", {\n class: \"logo\"\n }, \"物流管理系统\", -1 /* HOISTED */)), _createVNode(_component_el_menu, {\n router: true,\n \"default-active\": $setup.route.path\n }, {\n default: _withCtx(() => [_createCommentVNode(\" 普通用户菜单 - 管理员也可见 \"), $setup.userInfo.roles?.includes('ROLE_USER') || $setup.userInfo.roles?.includes('ROLE_ADMIN') ? (_openBlock(), _createBlock(_component_el_menu_item, {\n key: 0,\n index: \"/orders/my\"\n }, {\n default: _withCtx(() => [_createVNode(_component_el_icon, null, {\n default: _withCtx(() => [_createVNode($setup[\"Document\"])]),\n _: 1 /* STABLE */\n }), _cache[0] || (_cache[0] = _createElementVNode(\"span\", null, \"我的订单\", -1 /* HOISTED */))]),\n _: 1 /* STABLE */\n })) : _createCommentVNode(\"v-if\", true), _createCommentVNode(\" 仓库管理员菜单 - 管理员也可见 \"), $setup.userInfo.roles?.includes('ROLE_WAREHOUSE_ADMIN') || $setup.userInfo.roles?.includes('ROLE_ADMIN') ? (_openBlock(), _createBlock(_component_el_menu_item, {\n key: 1,\n index: \"/orders/create\"\n }, {\n default: _withCtx(() => [_createVNode(_component_el_icon, null, {\n default: _withCtx(() => [_createVNode($setup[\"Plus\"])]),\n _: 1 /* STABLE */\n }), _cache[1] || (_cache[1] = _createElementVNode(\"span\", null, \"创建订单\", -1 /* HOISTED */))]),\n _: 1 /* STABLE */\n })) : _createCommentVNode(\"v-if\", true), _createCommentVNode(\" 管理员和物流管理员菜单 \"), $setup.userInfo.roles?.includes('ROLE_ADMIN') || $setup.userInfo.roles?.includes('ROLE_LOGISTICS_ADMIN') ? (_openBlock(), _createBlock(_component_el_menu_item, {\n key: 2,\n index: \"/admin/orders\"\n }, {\n default: _withCtx(() => [_createVNode(_component_el_icon, null, {\n default: _withCtx(() => [_createVNode($setup[\"List\"])]),\n _: 1 /* STABLE */\n }), _cache[2] || (_cache[2] = _createElementVNode(\"span\", null, \"订单管理\", -1 /* HOISTED */))]),\n _: 1 /* STABLE */\n })) : _createCommentVNode(\"v-if\", true), _createCommentVNode(\" 仅管理员菜单 \"), $setup.userInfo.roles?.includes('ROLE_ADMIN') ? (_openBlock(), _createBlock(_component_el_menu_item, {\n key: 3,\n index: \"/admin/users\"\n }, {\n default: _withCtx(() => [_createVNode(_component_el_icon, null, {\n default: _withCtx(() => [_createVNode($setup[\"User\"])]),\n _: 1 /* STABLE */\n }), _cache[3] || (_cache[3] = _createElementVNode(\"span\", null, \"用户管理\", -1 /* HOISTED */))]),\n _: 1 /* STABLE */\n })) : _createCommentVNode(\"v-if\", true)]),\n _: 1 /* STABLE */\n }, 8 /* PROPS */, [\"default-active\"])]),\n _: 1 /* STABLE */\n }), _createVNode(_component_el_container, null, {\n default: _withCtx(() => [_createVNode(_component_el_header, null, {\n default: _withCtx(() => [_createElementVNode(\"div\", _hoisted_1, [_createElementVNode(\"span\", null, _toDisplayString($setup.userInfo.username), 1 /* TEXT */), _createVNode(_component_el_button, {\n type: \"text\",\n onClick: $setup.handleLogout\n }, {\n default: _withCtx(() => _cache[5] || (_cache[5] = [_createTextVNode(\"退出登录\")])),\n _: 1 /* STABLE */\n })])]),\n _: 1 /* STABLE */\n }), _createVNode(_component_el_main, null, {\n default: _withCtx(() => [_createVNode(_component_router_view)]),\n _: 1 /* STABLE */\n })]),\n _: 1 /* STABLE */\n })]),\n _: 1 /* STABLE */\n });\n}","map":{"version":3,"names":["class","_createBlock","_component_el_container","default","_withCtx","_createVNode","_component_el_aside","width","_createElementVNode","_component_el_menu","router","$setup","route","path","_createCommentVNode","userInfo","roles","includes","_component_el_menu_item","key","index","_component_el_icon","_","_component_el_header","_hoisted_1","_toDisplayString","username","_component_el_button","type","onClick","handleLogout","_cache","_createTextVNode","_component_el_main","_component_router_view"],"sources":["D:\\language\\VScode\\Front-end logistics\\src\\components\\layout\\index.vue"],"sourcesContent":["<template>\r\n <el-container class=\"layout-container\">\r\n <el-aside width=\"200px\">\r\n <div class=\"logo\">物流管理系统</div>\r\n <el-menu\r\n :router=\"true\"\r\n :default-active=\"route.path\"\r\n >\r\n <!-- 普通用户菜单 - 管理员也可见 -->\r\n <el-menu-item \r\n v-if=\"userInfo.roles?.includes('ROLE_USER') || userInfo.roles?.includes('ROLE_ADMIN')\"\r\n index=\"/orders/my\"\r\n >\r\n <el-icon><Document /></el-icon>\r\n <span>我的订单</span>\r\n </el-menu-item>\r\n \r\n <!-- 仓库管理员菜单 - 管理员也可见 -->\r\n <template v-if=\"userInfo.roles?.includes('ROLE_WAREHOUSE_ADMIN') || userInfo.roles?.includes('ROLE_ADMIN')\">\r\n <el-menu-item index=\"/orders/create\">\r\n <el-icon><Plus /></el-icon>\r\n <span>创建订单</span>\r\n </el-menu-item>\r\n </template>\r\n\r\n <!-- 管理员和物流管理员菜单 -->\r\n <el-menu-item \r\n v-if=\"userInfo.roles?.includes('ROLE_ADMIN') || userInfo.roles?.includes('ROLE_LOGISTICS_ADMIN')\"\r\n index=\"/admin/orders\"\r\n >\r\n <el-icon><List /></el-icon>\r\n <span>订单管理</span>\r\n </el-menu-item>\r\n\r\n <!-- 仅管理员菜单 -->\r\n <el-menu-item \r\n v-if=\"userInfo.roles?.includes('ROLE_ADMIN')\"\r\n index=\"/admin/users\"\r\n >\r\n <el-icon><User /></el-icon>\r\n <span>用户管理</span>\r\n </el-menu-item>\r\n </el-menu>\r\n </el-aside>\r\n \r\n <el-container>\r\n <el-header>\r\n <div class=\"header-right\">\r\n <span>{{ userInfo.username }}</span>\r\n <el-button type=\"text\" @click=\"handleLogout\">退出登录</el-button>\r\n </div>\r\n </el-header>\r\n \r\n <el-main>\r\n <router-view></router-view>\r\n </el-main>\r\n </el-container>\r\n </el-container>\r\n</template>\r\n\r\n<script setup>\r\nimport { computed } from 'vue'\r\nimport { useRoute, useRouter } from 'vue-router'\r\nimport { useStore } from 'vuex'\r\nimport { Document, Plus, List, User } from '@element-plus/icons-vue'\r\nimport { ElMessage, ElMessageBox } from 'element-plus'\r\n\r\nconst route = useRoute()\r\nconst router = useRouter()\r\nconst store = useStore()\r\n\r\nconst userInfo = computed(() => store.state.userInfo)\r\n\r\nconst handleLogout = async () => {\r\n try {\r\n await ElMessageBox.confirm('确定要退出登录吗?', '提示', {\r\n type: 'warning',\r\n confirmButtonText: '确定',\r\n cancelButtonText: '取消'\r\n })\r\n \r\n // 直接清除本地存储的用户信息和 token\r\n store.dispatch('logout')\r\n ElMessage.success('已退出登录')\r\n router.push('/login')\r\n } catch (error) {\r\n if (error !== 'cancel') {\r\n console.error('退出失败:', error)\r\n }\r\n }\r\n}\r\n</script>\r\n\r\n<style scoped>\r\n.layout-container {\r\n height: 100vh;\r\n}\r\n\r\n.logo {\r\n height: 60px;\r\n line-height: 60px;\r\n text-align: center;\r\n font-size: 20px;\r\n font-weight: bold;\r\n color: #409EFF;\r\n border-bottom: 1px solid #DCDFE6;\r\n}\r\n\r\n.el-aside {\r\n background-color: #fff;\r\n border-right: 1px solid #DCDFE6;\r\n}\r\n\r\n.el-header {\r\n background-color: #fff;\r\n border-bottom: 1px solid #DCDFE6;\r\n display: flex;\r\n align-items: center;\r\n justify-content: flex-end;\r\n padding: 0 20px;\r\n}\r\n\r\n.header-right {\r\n display: flex;\r\n align-items: center;\r\n gap: 20px;\r\n}\r\n\r\n.el-main {\r\n background-color: #f5f5f5;\r\n padding: 20px;\r\n}\r\n</style> "],"mappings":";;EA+CaA,KAAK,EAAC;AAAc;;;;;;;;;;;uBA9C/BC,YAAA,CAwDeC,uBAAA;IAxDDF,KAAK,EAAC;EAAkB;IADxCG,OAAA,EAAAC,QAAA,CAEI,MAyCW,CAzCXC,YAAA,CAyCWC,mBAAA;MAzCDC,KAAK,EAAC;IAAO;MAF3BJ,OAAA,EAAAC,QAAA,CAGM,MAA8B,C,0BAA9BI,mBAAA,CAA8B;QAAzBR,KAAK,EAAC;MAAM,GAAC,QAAM,sBACxBK,YAAA,CAsCUI,kBAAA;QArCPC,MAAM,EAAE,IAAI;QACZ,gBAAc,EAAEC,MAAA,CAAAC,KAAK,CAACC;;QAN/BV,OAAA,EAAAC,QAAA,CAQQ,MAAwB,CAAxBU,mBAAA,qBAAwB,EAEhBH,MAAA,CAAAI,QAAQ,CAACC,KAAK,EAAEC,QAAQ,iBAAiBN,MAAA,CAAAI,QAAQ,CAACC,KAAK,EAAEC,QAAQ,kB,cADzEhB,YAAA,CAMeiB,uBAAA;UAfvBC,GAAA;UAWUC,KAAK,EAAC;;UAXhBjB,OAAA,EAAAC,QAAA,CAaU,MAA+B,CAA/BC,YAAA,CAA+BgB,kBAAA;YAbzClB,OAAA,EAAAC,QAAA,CAamB,MAAY,CAAZC,YAAA,CAAYM,MAAA,c;YAb/BW,CAAA;wCAcUd,mBAAA,CAAiB,cAAX,MAAI,qB;UAdpBc,CAAA;cAAAR,mBAAA,gBAiBQA,mBAAA,sBAAyB,EACTH,MAAA,C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