优化代码

This commit is contained in:
wuxw 2025-07-03 23:40:40 +08:00
parent 0a41b92eb0
commit 0f149ba158

View File

@ -17,8 +17,9 @@
<i class="el-icon-arrow-down el-icon--right"></i> <i class="el-icon-arrow-down el-icon--right"></i>
</span> </span>
<el-dropdown-menu slot="dropdown"> <el-dropdown-menu slot="dropdown">
<el-dropdown-item :command="c" v-for="(c,index) in communitys" :key="index">{{ c.name }}</el-dropdown-item> <el-dropdown-item :command="c" v-for="(c, index) in communitys" :key="index">{{ c.name }}</el-dropdown-item>
<el-dropdown-item command="moreCommunity" class="moreCommunity">{{ $t('layout.moreCommunity') }}</el-dropdown-item> <el-dropdown-item command="moreCommunity" class="moreCommunity">{{ $t('layout.moreCommunity')
}}</el-dropdown-item>
</el-dropdown-menu> </el-dropdown-menu>
</el-dropdown> </el-dropdown>
<el-dropdown @command="handleCommand"> <el-dropdown @command="handleCommand">
@ -69,15 +70,15 @@
<router-view /> <router-view />
</el-main> </el-main>
</el-container> </el-container>
<more-community ref="moreCommunity"/> <more-community ref="moreCommunity" />
</el-container> </el-container>
</template> </template>
<script> <script>
import { _getMenuCatalog, getMenuTree } from '@/api/user/menuApi' import { _getMenuCatalog, getMenuTree } from '@/api/user/menuApi'
import { getStoreInfo } from "@/api/user/indexApi" import { getStoreInfo } from "@/api/user/indexApi"
import { deepCopy,setCurrentCommunity } from "@/utils/vc" import { deepCopy, setCurrentCommunity } from "@/utils/vc"
import {getCommunityName,_loadCommunityInfo} from '@/api/community/communityApi' import { getCommunityName, _loadCommunityInfo } from '@/api/community/communityApi'
import moreCommunity from '@/components/community/moreCommunity.vue' import moreCommunity from '@/components/community/moreCommunity.vue'
export default { export default {
@ -94,8 +95,8 @@ export default {
activeSubMenu: 'communityList', activeSubMenu: 'communityList',
searchText: '', searchText: '',
username: '', username: '',
curCommunityName:'', curCommunityName: '',
communitys:[], communitys: [],
storeInfo: { storeInfo: {
storeTypeCd: '', storeTypeCd: '',
storeId: '' storeId: ''
@ -111,12 +112,12 @@ export default {
this.curCommunityName = getCommunityName() this.curCommunityName = getCommunityName()
this.loadCommunity() this.loadCommunity()
}, },
components:{ components: {
moreCommunity moreCommunity
}, },
methods: { methods: {
async loadCommunity(){ async loadCommunity() {
const {communitys} = await _loadCommunityInfo() const { communitys } = await _loadCommunityInfo()
this.communitys = communitys this.communitys = communitys
}, },
async _loadStoreInfo() { async _loadStoreInfo() {
@ -152,17 +153,23 @@ export default {
_changeMenuCatalog(_catalog) { _changeMenuCatalog(_catalog) {
this.activeMenu = _catalog.caId; this.activeMenu = _catalog.caId;
// if (_catalog.caId === '1') { if (_catalog.caId === '1') {
// vc.jumpToPage('/#/pages/mall/product'); this.$router.push('/#/pages/mall/product');
// } }
// if (vm._showModelDiv(_catalog)) { if (_catalog.url == 'IOT') {
// return; this._navJumpToIot();
// } return;
// if (_catalog.url != '#') { }
// //vc.jumpToPage(_catalog.url); if (_catalog.url == 'MALL') {
// window.open(_catalog.url); //
// //return; this.jumpToMall('/');
// } return;
}
console.log(_catalog)
if (_catalog.url != '#') {
this._gotoPage(_catalog.url, _catalog.name)
//return;
}
this.loadMenuTree(_catalog) this.loadMenuTree(_catalog)
}, },
handleCommand(command) { handleCommand(command) {
@ -178,8 +185,8 @@ export default {
localStorage.setItem('language', command) localStorage.setItem('language', command)
} }
}, },
changeCommunity(community){ changeCommunity(community) {
if(community == 'moreCommunity'){ if (community == 'moreCommunity') {
this.$refs.moreCommunity.open() this.$refs.moreCommunity.open()
return return
} }
@ -334,7 +341,7 @@ export default {
.app-main { .app-main {
background-color: #f5f7fa; background-color: #f5f7fa;
height: calc(100vh - 60px) ; height: calc(100vh - 60px);
padding: 0px; padding: 0px;
} }
@ -421,11 +428,12 @@ export default {
} }
} }
.moreCommunity{ .moreCommunity {
font-weight: 600; font-weight: 600;
color: #212529; color: #212529;
font-size: 12px; font-size: 12px;
} }
.vc-menu-main ul li { .vc-menu-main ul li {
height: 45px; height: 45px;
line-height: 45px; line-height: 45px;