index.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371
  1. <template>
  2. <div class="common-layout">
  3. <el-container >
  4. <el-aside :width="sideWidth + 'px'">
  5. <el-menu
  6. active-text-color="#ffd04b"
  7. background-color="#545c64"
  8. default-active="2"
  9. class="el-menu-vertical-demo"
  10. text-color="#fff"
  11. :collapse="isCollapse"
  12. @open="handleOpen"
  13. @close="handleClose"
  14. >
  15. <div class="title">开领智数测试服管理系统</div>
  16. <el-menu-item index="1" @click="gopages()">
  17. <el-icon><icon-menu /></el-icon>
  18. <template #title>
  19. <span>欢迎使用本系统</span>
  20. </template>
  21. </el-menu-item>
  22. <el-sub-menu index="2">
  23. <template #title>
  24. <el-icon><setting /></el-icon>
  25. <span>系统管理</span>
  26. </template>
  27. <el-menu-item index="2-1" @click="gopagesPermiss()">
  28. 权限管理
  29. </el-menu-item>
  30. <el-menu-item index="2-2" @click="gopagesDisposition()">系统配置</el-menu-item>
  31. </el-sub-menu>
  32. <el-sub-menu index="3">
  33. <template #title>
  34. <el-icon><Avatar /></el-icon>
  35. <span>用户管理</span>
  36. </template>
  37. <el-menu-item index="3-1" @click="gopagesBackend()">
  38. 后台管理员
  39. </el-menu-item>
  40. <el-menu-item index="3-2" @click="gopagesClient()">
  41. 客户管理
  42. </el-menu-item>
  43. <el-menu-item index="3-3" @click="gopagesWeiban()">
  44. 微伴管理
  45. </el-menu-item>
  46. <el-menu-item index="3-4" @click="gopagesQrcode()">
  47. 二维码管理
  48. </el-menu-item>
  49. </el-sub-menu>
  50. <el-menu-item index="4">
  51. <el-icon><setting /></el-icon>
  52. <template #title>Navigator Four</template>
  53. </el-menu-item>
  54. </el-menu>
  55. </el-aside>
  56. <el-container>
  57. <el-header>
  58. <!-- <el-radio-group v-model="isCollapse" style="margin-bottom: 20px">
  59. <el-radio-button :value="!isCollapse">{{ isCollapse ? "展示" : "隐藏" }}</el-radio-button>
  60. </el-radio-group> -->
  61. <div class="btn_show">
  62. <SvgIcon
  63. @click="switchShowLogo()"
  64. :style="'width:20px;height:20px;'"
  65. :name="isCollapse? 'svg:indent.svg' : 'svg:outdent.svg'"
  66. >
  67. </SvgIcon>
  68. </div>
  69. <el-breadcrumb :separator-icon="ArrowRight">
  70. <el-breadcrumb-item >homepage</el-breadcrumb-item>
  71. <el-breadcrumb-item>promotion management</el-breadcrumb-item>
  72. <el-breadcrumb-item>promotion list</el-breadcrumb-item>
  73. <el-breadcrumb-item>promotion detail</el-breadcrumb-item>
  74. </el-breadcrumb>
  75. <div class="navbar-cp-container">
  76. <div class="right">
  77. <definDropdown
  78. :show="dataContainer.show_1"
  79. :ifLeftClick="true"
  80. :targetQuery="'.target'"
  81. @onOtherClick="dataContainer.show_1 = false"
  82. @onClick="
  83. () => {
  84. dataContainer.show_1 = !dataContainer.show_1;
  85. }
  86. "
  87. position="outside,bottom,end"
  88. >
  89. <div
  90. :class="{
  91. active: dataContainer.show_1,
  92. 'user-container': true,
  93. target: true,
  94. }"
  95. >
  96. <el-image class="img" :src="dataContainer.userInfo.avatar" fit="cover" />
  97. <div class="name">
  98. {{ dataContainer.userInfo.nickName }}
  99. <div class="other">
  100. {{ dataContainer.userInfo.userName }}
  101. </div>
  102. </div>
  103. <div class="option">
  104. <SvgIcon
  105. :style="'width:15px;height:15px;'"
  106. name="svg:sort-down.svg"
  107. ></SvgIcon>
  108. </div>
  109. </div>
  110. <template v-slot:dropdown>
  111. <div class="bt-list-container">
  112. <div class="item" @click="toPath('/main/mine/info')">
  113. <SvgIcon
  114. :style="'width:16px;height:16px;'"
  115. name="svg:user-fill.svg"
  116. ></SvgIcon>
  117. 个人中心
  118. </div>
  119. <div class="item" @click="toPath('/main/mine/info-password')">
  120. <SvgIcon
  121. :style="'width:16px;height:16px;'"
  122. name="svg:supervise.svg"
  123. ></SvgIcon>
  124. 密码修改
  125. </div>
  126. <div class="item logout-bt" @click.stop="onLogout">
  127. <SvgIcon
  128. :style="'width:16px;height:16px;color:#f56c6c;'"
  129. name="svg:poweroff.svg"
  130. ></SvgIcon>
  131. 退出登录
  132. </div>
  133. </div>
  134. </template>
  135. </definDropdown>
  136. </div>
  137. </div>
  138. </el-header>
  139. <el-main>
  140. <router-view></router-view>
  141. </el-main>
  142. </el-container>
  143. </el-container>
  144. </div>
  145. </template>
  146. <script setup >
  147. import { ref,reactive,computed} from 'vue'
  148. import {
  149. Document,
  150. Menu as IconMenu,
  151. Location,
  152. Setting,
  153. Avatar,
  154. } from '@element-plus/icons-vue'
  155. import { ArrowRight} from '@element-plus/icons-vue'
  156. import { RouterView ,useRouter} from 'vue-router';
  157. const router = useRouter();
  158. const isCollapse = ref(false)
  159. const dataContainer = reactive({
  160. userInfo:{
  161. avatar:'https://s11.ax1x.com/2023/12/15/pihx4js.jpg',
  162. nickName:'管理员',
  163. userName:'admin'
  164. },
  165. show_1: false,
  166. })
  167. const sideWidth = computed(() => {
  168. return isCollapse.value? 60 : 230; // 这里可以根据实际需求调整收缩和展开时的宽度值
  169. });
  170. const handleOpen = (key, keyPath) => {
  171. console.log(key, keyPath)
  172. }
  173. const handleClose = (key, keyPath) => {
  174. console.log(key, keyPath)
  175. }
  176. const switchShowLogo = () =>{
  177. isCollapse.value = !isCollapse.value
  178. }
  179. const gopages = ()=>{
  180. router.push('/index/welcome/index')
  181. }
  182. const gopagesPermiss = ()=>{
  183. router.push('/index/permissions')
  184. }
  185. const gopagesDisposition = ()=>{
  186. router.push('/index/disposition')
  187. }
  188. const gopagesBackend = () => {
  189. router.push('/index/backend')
  190. }
  191. const gopagesClient = ()=>{
  192. router.push ('/index/client')
  193. }
  194. const gopagesWeiban = ()=> {
  195. router.push ('/index/weiban')
  196. }
  197. const gopagesQrcode = ()=> {
  198. router.push ('/index/qrcode')
  199. }
  200. const toPath = (path)=>{
  201. router.push(`${path}`)
  202. }
  203. const onLogout = ()=>{
  204. router.push("/login")
  205. }
  206. </script>
  207. <style scoped lang='scss'>
  208. .common-layout {
  209. display: flex;
  210. flex-direction: row;
  211. height: 100vh;
  212. .el-menu-vertical-demo:not(.el-menu--collapse) {
  213. width: 230px;
  214. min-height: 100vh;
  215. max-width: 100vh;
  216. }
  217. .el-menu-vertical-demo.el-menu--collapse {
  218. height: 100vh; /* 设置收缩状态下的固定高度,和非收缩状态下的min-height保持一致 */
  219. overflow-y: auto; /* 如果内容超出设置的高度,可以添加滚动条来查看隐藏内容 */
  220. }
  221. .el-aside {
  222. transition: width 0.3s ease;
  223. .title{
  224. display: inline-flex;
  225. width: 229px;
  226. height: 40px;
  227. justify-content: center;
  228. font-size: 20px;
  229. font-weight: bold;
  230. flex-wrap: nowrap;
  231. overflow: hidden;
  232. background-color:#545c64;
  233. color:#fff;
  234. }
  235. }
  236. .el-header{
  237. display: flex;
  238. align-items: center;
  239. background-color: white;
  240. --el-header-padding:0px;
  241. > .btn_show{
  242. display: flex;
  243. flex-direction: row;
  244. align-items: center;
  245. justify-content: flex-start;
  246. margin-left: var(--item-gap);
  247. margin: 10px;
  248. > * {
  249. cursor: pointer;
  250. transition: all 0.2s;
  251. &:hover {
  252. color: #0072e5;
  253. }
  254. }
  255. }
  256. .el-breadcrumb{
  257. width: 100%;
  258. display: inline-flex;
  259. flex-wrap: nowrap;
  260. overflow: hidden;
  261. }
  262. @media screen and (max-width: 1000px) {
  263. .el-breadcrumb{
  264. display: none;
  265. }
  266. }
  267. @media screen and (min-width: 700px) {
  268. .el-breadcrumb{
  269. display: inline-flex;
  270. flex-wrap: nowrap;
  271. overflow: hidden;
  272. }
  273. }
  274. .navbar-cp-container{
  275. width: 100%;
  276. > .right {
  277. display: flex;
  278. flex-direction: row;
  279. justify-content: flex-end;
  280. align-items: center;
  281. padding: 0 0 0 0;
  282. box-sizing: border-box;
  283. position: relative;
  284. height: 100%;
  285. > * {
  286. margin-left: var(--item-gap);
  287. }
  288. .user-container {
  289. width: auto;
  290. height: 100%;
  291. cursor: pointer;
  292. border-radius: 0 0 0 0;
  293. transition: all 0.2s;
  294. position: relative;
  295. border: none;
  296. box-shadow: none;
  297. border-left: 1px solid var(--border-color);
  298. box-sizing: border-box;
  299. padding: 0px var(--item-gap);
  300. display: flex;
  301. flex-direction: row;
  302. align-items: center;
  303. &.active {
  304. background-color: #f0f0f0;
  305. box-shadow: inset 0 1px 4px #0000002a;
  306. }
  307. > .img {
  308. width: 43px;
  309. min-width: 43px;
  310. height: 43px;
  311. border-radius: 50%;
  312. margin-right: var(--item-gap);
  313. // border: 2px solid #949494;
  314. margin: 0 10px;
  315. box-shadow: #0000002a 2px 2px 5px;
  316. }
  317. > .name {
  318. font-size: 14px;
  319. font-weight: bold;
  320. margin-right: var(--item-gap);
  321. color: #444954;
  322. display: flex;
  323. flex-direction: column;
  324. margin: 0 10px;
  325. > .other {
  326. font-size: 12px;
  327. opacity: 0.6;
  328. margin-top: 2px;
  329. font-weight: 400;
  330. }
  331. }
  332. > .option {
  333. width: fit-content;
  334. height: fit-content;
  335. display: flex;
  336. flex-direction: row;
  337. justify-content: center;
  338. align-items: center;
  339. }
  340. }
  341. > .defin-drop {
  342. z-index: 9;
  343. }
  344. }
  345. }
  346. }
  347. }
  348. </style>