Commit 0f149ba15827392a8ef77c6be2ec3d3872ede6af

Authored by wuxw
1 parent 0a41b92e

优化代码

Showing 1 changed file with 34 additions and 26 deletions
src/views/layout/layout.vue
... ... @@ -17,8 +17,9 @@
17 17 <i class="el-icon-arrow-down el-icon--right"></i>
18 18 </span>
19 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 23 </el-dropdown-menu>
23 24 </el-dropdown>
24 25 <el-dropdown @command="handleCommand">
... ... @@ -69,15 +70,15 @@
69 70 <router-view />
70 71 </el-main>
71 72 </el-container>
72   - <more-community ref="moreCommunity"/>
  73 + <more-community ref="moreCommunity" />
73 74 </el-container>
74 75 </template>
75 76  
76 77 <script>
77 78 import { _getMenuCatalog, getMenuTree } from '@/api/user/menuApi'
78 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 82 import moreCommunity from '@/components/community/moreCommunity.vue'
82 83  
83 84 export default {
... ... @@ -94,8 +95,8 @@ export default {
94 95 activeSubMenu: 'communityList',
95 96 searchText: '',
96 97 username: '',
97   - curCommunityName:'',
98   - communitys:[],
  98 + curCommunityName: '',
  99 + communitys: [],
99 100 storeInfo: {
100 101 storeTypeCd: '',
101 102 storeId: ''
... ... @@ -111,12 +112,12 @@ export default {
111 112 this.curCommunityName = getCommunityName()
112 113 this.loadCommunity()
113 114 },
114   - components:{
  115 + components: {
115 116 moreCommunity
116 117 },
117 118 methods: {
118   - async loadCommunity(){
119   - const {communitys} = await _loadCommunityInfo()
  119 + async loadCommunity() {
  120 + const { communitys } = await _loadCommunityInfo()
120 121 this.communitys = communitys
121 122 },
122 123 async _loadStoreInfo() {
... ... @@ -152,17 +153,23 @@ export default {
152 153 _changeMenuCatalog(_catalog) {
153 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 173 this.loadMenuTree(_catalog)
167 174 },
168 175 handleCommand(command) {
... ... @@ -178,8 +185,8 @@ export default {
178 185 localStorage.setItem('language', command)
179 186 }
180 187 },
181   - changeCommunity(community){
182   - if(community == 'moreCommunity'){
  188 + changeCommunity(community) {
  189 + if (community == 'moreCommunity') {
183 190 this.$refs.moreCommunity.open()
184 191 return
185 192 }
... ... @@ -334,7 +341,7 @@ export default {
334 341  
335 342 .app-main {
336 343 background-color: #f5f7fa;
337   - height: calc(100vh - 60px) ;
  344 + height: calc(100vh - 60px);
338 345 padding: 0px;
339 346 }
340 347  
... ... @@ -421,11 +428,12 @@ export default {
421 428 }
422 429 }
423 430  
424   -.moreCommunity{
  431 +.moreCommunity {
425 432 font-weight: 600;
426 433 color: #212529;
427 434 font-size: 12px;
428 435 }
  436 +
429 437 .vc-menu-main ul li {
430 438 height: 45px;
431 439 line-height: 45px;
... ... @@ -507,4 +515,4 @@ export default {
507 515 bottom: 0;
508 516 width: 100px;
509 517 }
510   -</style>
511 518 \ No newline at end of file
  519 +</style>
512 520 \ No newline at end of file
... ...