Commit 0f149ba15827392a8ef77c6be2ec3d3872ede6af
1 parent
0a41b92e
优化代码
Showing
1 changed file
with
34 additions
and
26 deletions
src/views/layout/layout.vue
| @@ -17,8 +17,9 @@ | @@ -17,8 +17,9 @@ | ||
| 17 | <i class="el-icon-arrow-down el-icon--right"></i> | 17 | <i class="el-icon-arrow-down el-icon--right"></i> |
| 18 | </span> | 18 | </span> |
| 19 | <el-dropdown-menu slot="dropdown"> | 19 | <el-dropdown-menu slot="dropdown"> |
| 20 | - <el-dropdown-item :command="c" v-for="(c,index) in communitys" :key="index">{{ c.name }}</el-dropdown-item> | ||
| 21 | - <el-dropdown-item command="moreCommunity" class="moreCommunity">{{ $t('layout.moreCommunity') }}</el-dropdown-item> | 20 | + <el-dropdown-item :command="c" v-for="(c, index) in communitys" :key="index">{{ c.name }}</el-dropdown-item> |
| 21 | + <el-dropdown-item command="moreCommunity" class="moreCommunity">{{ $t('layout.moreCommunity') | ||
| 22 | + }}</el-dropdown-item> | ||
| 22 | </el-dropdown-menu> | 23 | </el-dropdown-menu> |
| 23 | </el-dropdown> | 24 | </el-dropdown> |
| 24 | <el-dropdown @command="handleCommand"> | 25 | <el-dropdown @command="handleCommand"> |
| @@ -69,15 +70,15 @@ | @@ -69,15 +70,15 @@ | ||
| 69 | <router-view /> | 70 | <router-view /> |
| 70 | </el-main> | 71 | </el-main> |
| 71 | </el-container> | 72 | </el-container> |
| 72 | - <more-community ref="moreCommunity"/> | 73 | + <more-community ref="moreCommunity" /> |
| 73 | </el-container> | 74 | </el-container> |
| 74 | </template> | 75 | </template> |
| 75 | 76 | ||
| 76 | <script> | 77 | <script> |
| 77 | import { _getMenuCatalog, getMenuTree } from '@/api/user/menuApi' | 78 | import { _getMenuCatalog, getMenuTree } from '@/api/user/menuApi' |
| 78 | import { getStoreInfo } from "@/api/user/indexApi" | 79 | import { getStoreInfo } from "@/api/user/indexApi" |
| 79 | -import { deepCopy,setCurrentCommunity } from "@/utils/vc" | ||
| 80 | -import {getCommunityName,_loadCommunityInfo} from '@/api/community/communityApi' | 80 | +import { deepCopy, setCurrentCommunity } from "@/utils/vc" |
| 81 | +import { getCommunityName, _loadCommunityInfo } from '@/api/community/communityApi' | ||
| 81 | import moreCommunity from '@/components/community/moreCommunity.vue' | 82 | import moreCommunity from '@/components/community/moreCommunity.vue' |
| 82 | 83 | ||
| 83 | export default { | 84 | export default { |
| @@ -94,8 +95,8 @@ export default { | @@ -94,8 +95,8 @@ export default { | ||
| 94 | activeSubMenu: 'communityList', | 95 | activeSubMenu: 'communityList', |
| 95 | searchText: '', | 96 | searchText: '', |
| 96 | username: '', | 97 | username: '', |
| 97 | - curCommunityName:'', | ||
| 98 | - communitys:[], | 98 | + curCommunityName: '', |
| 99 | + communitys: [], | ||
| 99 | storeInfo: { | 100 | storeInfo: { |
| 100 | storeTypeCd: '', | 101 | storeTypeCd: '', |
| 101 | storeId: '' | 102 | storeId: '' |
| @@ -111,12 +112,12 @@ export default { | @@ -111,12 +112,12 @@ export default { | ||
| 111 | this.curCommunityName = getCommunityName() | 112 | this.curCommunityName = getCommunityName() |
| 112 | this.loadCommunity() | 113 | this.loadCommunity() |
| 113 | }, | 114 | }, |
| 114 | - components:{ | 115 | + components: { |
| 115 | moreCommunity | 116 | moreCommunity |
| 116 | }, | 117 | }, |
| 117 | methods: { | 118 | methods: { |
| 118 | - async loadCommunity(){ | ||
| 119 | - const {communitys} = await _loadCommunityInfo() | 119 | + async loadCommunity() { |
| 120 | + const { communitys } = await _loadCommunityInfo() | ||
| 120 | this.communitys = communitys | 121 | this.communitys = communitys |
| 121 | }, | 122 | }, |
| 122 | async _loadStoreInfo() { | 123 | async _loadStoreInfo() { |
| @@ -152,17 +153,23 @@ export default { | @@ -152,17 +153,23 @@ export default { | ||
| 152 | _changeMenuCatalog(_catalog) { | 153 | _changeMenuCatalog(_catalog) { |
| 153 | this.activeMenu = _catalog.caId; | 154 | this.activeMenu = _catalog.caId; |
| 154 | 155 | ||
| 155 | - // if (_catalog.caId === '1') { | ||
| 156 | - // vc.jumpToPage('/#/pages/mall/product'); | ||
| 157 | - // } | ||
| 158 | - // if (vm._showModelDiv(_catalog)) { | ||
| 159 | - // return; | ||
| 160 | - // } | ||
| 161 | - // if (_catalog.url != '#') { | ||
| 162 | - // //vc.jumpToPage(_catalog.url); | ||
| 163 | - // window.open(_catalog.url); | ||
| 164 | - // //return; | ||
| 165 | - // } | 156 | + if (_catalog.caId === '1') { |
| 157 | + this.$router.push('/#/pages/mall/product'); | ||
| 158 | + } | ||
| 159 | + if (_catalog.url == 'IOT') { | ||
| 160 | + this._navJumpToIot(); | ||
| 161 | + return; | ||
| 162 | + } | ||
| 163 | + if (_catalog.url == 'MALL') { | ||
| 164 | + //获取用户名 | ||
| 165 | + this.jumpToMall('/'); | ||
| 166 | + return; | ||
| 167 | + } | ||
| 168 | + console.log(_catalog) | ||
| 169 | + if (_catalog.url != '#') { | ||
| 170 | + this._gotoPage(_catalog.url, _catalog.name) | ||
| 171 | + //return; | ||
| 172 | + } | ||
| 166 | this.loadMenuTree(_catalog) | 173 | this.loadMenuTree(_catalog) |
| 167 | }, | 174 | }, |
| 168 | handleCommand(command) { | 175 | handleCommand(command) { |
| @@ -178,8 +185,8 @@ export default { | @@ -178,8 +185,8 @@ export default { | ||
| 178 | localStorage.setItem('language', command) | 185 | localStorage.setItem('language', command) |
| 179 | } | 186 | } |
| 180 | }, | 187 | }, |
| 181 | - changeCommunity(community){ | ||
| 182 | - if(community == 'moreCommunity'){ | 188 | + changeCommunity(community) { |
| 189 | + if (community == 'moreCommunity') { | ||
| 183 | this.$refs.moreCommunity.open() | 190 | this.$refs.moreCommunity.open() |
| 184 | return | 191 | return |
| 185 | } | 192 | } |
| @@ -334,7 +341,7 @@ export default { | @@ -334,7 +341,7 @@ export default { | ||
| 334 | 341 | ||
| 335 | .app-main { | 342 | .app-main { |
| 336 | background-color: #f5f7fa; | 343 | background-color: #f5f7fa; |
| 337 | - height: calc(100vh - 60px) ; | 344 | + height: calc(100vh - 60px); |
| 338 | padding: 0px; | 345 | padding: 0px; |
| 339 | } | 346 | } |
| 340 | 347 | ||
| @@ -421,11 +428,12 @@ export default { | @@ -421,11 +428,12 @@ export default { | ||
| 421 | } | 428 | } |
| 422 | } | 429 | } |
| 423 | 430 | ||
| 424 | -.moreCommunity{ | 431 | +.moreCommunity { |
| 425 | font-weight: 600; | 432 | font-weight: 600; |
| 426 | color: #212529; | 433 | color: #212529; |
| 427 | font-size: 12px; | 434 | font-size: 12px; |
| 428 | } | 435 | } |
| 436 | + | ||
| 429 | .vc-menu-main ul li { | 437 | .vc-menu-main ul li { |
| 430 | height: 45px; | 438 | height: 45px; |
| 431 | line-height: 45px; | 439 | line-height: 45px; |
| @@ -507,4 +515,4 @@ export default { | @@ -507,4 +515,4 @@ export default { | ||
| 507 | bottom: 0; | 515 | bottom: 0; |
| 508 | width: 100px; | 516 | width: 100px; |
| 509 | } | 517 | } |
| 510 | -</style> | ||
| 511 | \ No newline at end of file | 518 | \ No newline at end of file |
| 519 | +</style> | ||
| 512 | \ No newline at end of file | 520 | \ No newline at end of file |