Commit b918ca45 authored by zhengke's avatar zhengke

优化首页空状态

parent 2a27b914
......@@ -49,16 +49,26 @@ export const useMenuStore = defineStore('menu', {
if(userInfo.iv){
userPermissions.push('V')
}
if(userInfo.im){
userPermissions.push('M')
}
const findFreeMenu = menus.filter(x=>userPermissions.includes(x.owner))
if(findFreeMenu){
state.userMenu = findFreeMenu.map(x=>x.menu)
}
}
return state.userMenu
},
getTemplateMenu:(state)=>{
if (!state.userMenu || state.userMenu.length==0) {
const userStore= useUserStore()
const userInfo = userStore.getUser
let userPermissions:MenuOwner[] = ['M']
const findFreeMenu = menus.filter(x=>userPermissions.includes(x.owner))
if(findFreeMenu){
state.userMenu = findFreeMenu.map(x=>x.menu)
}
}
return state.userMenu
},
},
// actions:{
// setUserMenu()
......
......@@ -39,7 +39,7 @@ export const useUserStore = defineStore('user', {
let rate:CustomerRate = 'FREE'
if(state.userInfo.it) rate = 'EN'
else if(state.userInfo.iv) rate = 'VIP'
else if(state.userInfo.im) rate = 'TME'
else if(state.userInfo.isTemplate) rate = 'TME'
const theme = CustomerThemeConfig.find(x=>x.name==rate)
return theme
},
......@@ -58,7 +58,6 @@ export const useUserStore = defineStore('user', {
d.isTemplate = d.IsEditTripTemplate
d.ia = 0
d.it = true
d.im = true
this.userInfo = d
return true
......
......@@ -123,3 +123,9 @@ export const formatDateTimeToRead = (dateStr:string,prefix:string='') =>{
result= "刚刚";
return prefix+result;
}
// 暂无数据img
export const noDataImg = (type:Number) =>{
if(type==1) return require('@/assets/img/noData.png')
if(type==2) return require('@/assets/img/theEend.png')
}
\ No newline at end of file
......@@ -206,11 +206,9 @@
</div>
<div v-else-if="dataList.length == 0 && !loading" class="q-mt-lg bg-white rounded"
style="padding: 30px 10px 30px 10px;">
<el-empty description="暂无数据" />
<el-empty description="暂无数据" :image="noDataImg(1)" />
</div>
<el-divider class="no-bg q-mt-lg" v-if='queryObj.pageCount == queryObj.pageIndex && !loading'>
<span class="text-small" style="background: #f3f6fb;padding: 0 10px;color:#a3a3a3">已加载完成所有数据</span>
</el-divider>
<div v-if='queryObj.pageCount == queryObj.pageIndex && !loading' class="text-center q-pt-lg"><img :src="noDataImg(2)" width="118" /></div>
<div style="height:40px;" class="q-mt-md no-bg" background="transparent" v-loading="loading" element-loading-text="正在加载中"></div>
</div>
</div>
......@@ -339,6 +337,8 @@ import { Delete,View } from '@element-plus/icons-vue';
import { VIEWPORT_SIZE, VIEWPORT_VER_SIZE } from '@/configs/canvas'
import foote from '@/components/footer/index.vue';
import { noDataImg } from "@/utils/common";
const {
userInfo
} = storeToRefs(useUserStore())
......
......@@ -37,14 +37,13 @@ import { useRouter } from "vue-router";
const router = useRouter()
const useMenu = useMenuStore();
const menus = ref(useMenu.getUserMenu);
const menus = ref(useMenu.getTemplateMenu);
const activeIndex = ref(0)
const forwardSpace = () => router.push('/space')
watch(() => router.currentRoute.value.path, (toPath) => {
menus.value = useMenu.getUserMenu
console.log(menus.value,'====')
if(!menus.value) return
activeIndex.value = menus.value.findIndex(x=>x.url==router.currentRoute.value.path)
},{immediate: true,deep: true})
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment