Merge branch 'build' of http://git.sinoecare.com/sinoecare/digital_village_v2/dvcp_v2_webapp into build
This commit is contained in:
		| @@ -58,5 +58,9 @@ export default { | ||||
| <style lang="scss" scoped> | ||||
| .AppAiCode { | ||||
|   height: 100%; | ||||
|  | ||||
|   & > section { | ||||
|     height: 100%; | ||||
|   } | ||||
| } | ||||
| </style> | ||||
|   | ||||
| @@ -251,6 +251,13 @@ export const logs = { | ||||
|       const i = state.pages.findIndex(e => e.id == id) | ||||
|       i > -1 && state.pages.splice(i, 1) | ||||
|     }, | ||||
|     clearAllPages(state) { | ||||
|       state.pages = [] | ||||
|     }, | ||||
|     clearOtherPages(state) { | ||||
|       const id = location.href?.replace(location.origin, "") | ||||
|       state.pages = state.pages.filter(e => e.id == id) || [] | ||||
|     } | ||||
|   }, | ||||
|   actions: { | ||||
|     closePage({commit}, id) { | ||||
|   | ||||
| @@ -1,21 +1,36 @@ | ||||
| <template> | ||||
|   <section class="AiNavTab"> | ||||
|     <el-tabs class="layout" type="card" :value="currentTab" @tab-click="handleTabClick" @tab-remove="handleTabRemove"> | ||||
|       <el-tab-pane label="首页" name="/"/> | ||||
|       <el-tab-pane v-for="(op,i) in tabs" :key="i" :name="op.id" :label="op.label" lazy closable/> | ||||
|     <el-tabs class="layout fill" type="card" :value="currentTab" @tab-click="handleTabClick" @tab-remove="handleTabRemove"> | ||||
|       <el-tab-pane v-for="(op,i) in tabs" :key="i" :name="op.id" :label="op.label" lazy :closable="!op.fixed"/> | ||||
|     </el-tabs> | ||||
|     <el-dropdown flex class="more" @visible-change="handleIcon" trigger="click" @command="handleOpt"> | ||||
|       <ai-icon :icon="dropdownIcon"/> | ||||
|       <el-dropdown-menu> | ||||
|         <el-dropdown-item command="clearAllPages">关闭所有</el-dropdown-item> | ||||
|         <el-dropdown-item command="clearOtherPages">只留当前页</el-dropdown-item> | ||||
|       </el-dropdown-menu> | ||||
|     </el-dropdown> | ||||
|   </section> | ||||
| </template> | ||||
|  | ||||
| <script> | ||||
| import {mapState, mapMutations} from "vuex"; | ||||
|  | ||||
| export default { | ||||
|   name: "AiNavTab", | ||||
|   props: { | ||||
|     fixed: {default: () => ({label: "首页", id: "/"})} | ||||
|   }, | ||||
|   computed: { | ||||
|     ...mapState(['apps', 'logs']), | ||||
|     currentTab: v => v.isHome ? "/" : v.$route.fullPath, | ||||
|     isHome: v => v.$route.path == '/', | ||||
|     tabs: v => v.logs.pages | ||||
|     tabs: v => [{...v.fixed, fixed: 1}, v.logs.pages].flat(), | ||||
|     isHome: v => v.fixed.id == v.$route.fullPath | ||||
|   }, | ||||
|   data() { | ||||
|     return { | ||||
|       dropdownIcon: "iconDouble_Down" | ||||
|     } | ||||
|   }, | ||||
|   watch: { | ||||
|     $route: { | ||||
| @@ -36,10 +51,17 @@ export default { | ||||
|       const {pages} = this.logs | ||||
|       if (id == this.currentTab) { | ||||
|         const index = pages.findIndex(e => e.id == id) | ||||
|         const next = pages?.[index + 1] || pages?.[index - 1] || {name: '/'} | ||||
|         const next = pages?.[index + 1] || pages?.[index - 1] || {name: this.fixed.id || "/"} | ||||
|         this.handleTabClick(next) | ||||
|       } | ||||
|       this.deletePage(id) | ||||
|     }, | ||||
|     handleIcon(v) { | ||||
|       this.dropdownIcon = v ? "iconDouble_Up" : "iconDouble_Down" | ||||
|     }, | ||||
|     handleOpt(v) { | ||||
|       this.$store.commit(v) | ||||
|       v == "clearAllPages" && this.handleTabClick({name: this.fixed.id || "/"}) | ||||
|     } | ||||
|   } | ||||
| } | ||||
| @@ -47,14 +69,26 @@ export default { | ||||
|  | ||||
| <style lang="scss" scoped> | ||||
| .AiNavTab { | ||||
|   display: flex; | ||||
|   background: linear-gradient(180deg, #FCFCFC 0%, #E0E2E4 100%); | ||||
|  | ||||
|   :deep(.layout ) { | ||||
|     background: #F5F6F9; | ||||
|     display: flex; | ||||
|     flex-direction: column; | ||||
|  | ||||
|     .el-tabs__nav-prev, .el-tabs__nav-next { | ||||
|       top: 50%; | ||||
|       line-height: normal; | ||||
|       transform: translateY(-50%); | ||||
|  | ||||
|       & > i { | ||||
|         font-weight: bold !important; | ||||
|       } | ||||
|  | ||||
|     } | ||||
|  | ||||
|     & > .el-tabs__header { | ||||
|       margin-bottom: 0; | ||||
|       background: linear-gradient(180deg, #FCFCFC 0%, #E0E2E4 100%); | ||||
|       height: 40px; | ||||
|       display: flex; | ||||
|       align-items: flex-end; | ||||
| @@ -117,5 +151,17 @@ export default { | ||||
|       } | ||||
|     } | ||||
|   } | ||||
|  | ||||
|   :deep(.more) { | ||||
|     .AiIcon { | ||||
|       height: 100%; | ||||
|  | ||||
|       .iconfont { | ||||
|         display: flex; | ||||
|         align-items: center; | ||||
|         justify-content: center; | ||||
|       } | ||||
|     } | ||||
|   } | ||||
| } | ||||
| </style> | ||||
|   | ||||
		Reference in New Issue
	
	Block a user