feat: 空图片统一

This commit is contained in:
cgd_mac 2022-02-25 19:47:26 +08:00
parent 94fd5ba1e0
commit d40af76800
7 changed files with 27 additions and 16 deletions

View File

@ -18,7 +18,7 @@ import './permission' // permission control
import './utils/filter' // global filter import './utils/filter' // global filter
import './global.less' import './global.less'
import moment from 'moment' import moment from 'moment'
import { FormModel } from 'ant-design-vue' import { FormModel, Empty } from 'ant-design-vue'
import { hasBtnPermission } from './utils/permissions' import { hasBtnPermission } from './utils/permissions'
window.Vue = Vue window.Vue = Vue
@ -35,7 +35,9 @@ window.Vue = Vue
// } from 'echarts/components' // } from 'echarts/components'
Vue.use(FormModel) Vue.use(FormModel)
Vue.use(Empty)
Vue.prototype.hasPerm = hasBtnPermission Vue.prototype.hasPerm = hasBtnPermission
Vue.prototype.$emptyImg = Empty.PRESENTED_IMAGE_SIMPLE
Vue.config.productionTip = false Vue.config.productionTip = false

View File

@ -1,22 +1,26 @@
<template> <template>
<div> <a-card :bordered="false" style="display: flex;justify-content:center;height: 100%">
<Myhome v-if="currentRole && currentRole.code === 'student'"></Myhome>
<a-card v-else :bordered="false" style="display: flex;justify-content:center;height: 100%">
<div style="margin:100px auto;"> <div style="margin:100px auto;">
<img src="~@/assets/welcome.png" class="logo" alt="logo" /> <img src="~@/assets/welcome.png" class="logo" alt="logo" />
</div> </div>
</a-card> </a-card>
</div>
</template> </template>
<script> <script>
import { mapState } from 'vuex' import { mapState } from 'vuex'
import Myhome from '@/views/myhome/index.vue' // import Myhome from '@/views/myhome/index.vue'
export default { export default {
components: { Myhome },
data () { data () {
return {} return {}
}, },
beforeRouteEnter (to, from, next) {
next(vm => {
const code = vm.$store.state.user && vm.$store.state.user.currentRole.code
if (code === 'student') {
vm.$router.replace({ path: '/myhome' })
}
})
},
computed: { computed: {
...mapState({ ...mapState({
currentRole: state => state.user.currentRole currentRole: state => state.user.currentRole

View File

@ -98,7 +98,7 @@
/> />
</div> </div>
</template> </template>
<a-empty v-else></a-empty> <a-empty v-else :image="$emptyImg"></a-empty>
</a-tab-pane> </a-tab-pane>
</a-tabs> </a-tabs>
</a-card> </a-card>

View File

@ -14,7 +14,7 @@
</a-card> </a-card>
</a-col> </a-col>
</a-row> </a-row>
<a-empty v-else></a-empty> <a-empty v-else :image="$emptyImg"></a-empty>
</a-card> </a-card>
</template> </template>

View File

@ -76,7 +76,7 @@
<!-- 系统推荐课程 start --> <!-- 系统推荐课程 start -->
<a-col :span="24" :style="{ marginBottom: '24px' }"> <a-col :span="24" :style="{ marginBottom: '24px' }">
<a-card :bordered="false" title="系统推荐课程" :style="{ height: '100%' }"> <a-card :bordered="false" title="系统推荐课程" :style="{ height: '100%' }">
<a-row :gutter="16"> <a-row v-if="sysList && sysList.length>0" :gutter="16">
<a-col :span="6" :md="4" :sm="6" v-for="(item, index) in sysList" :key="index"> <a-col :span="6" :md="4" :sm="6" v-for="(item, index) in sysList" :key="index">
<a-card <a-card
@click="handlerContinue(item)" @click="handlerContinue(item)"
@ -94,6 +94,7 @@
</a-card> </a-card>
</a-col> </a-col>
</a-row> </a-row>
<a-empty v-else :image="$emptyImg"></a-empty>
</a-card> </a-card>
</a-col> </a-col>
<!-- 系统推荐课程 end --> <!-- 系统推荐课程 end -->

View File

@ -48,7 +48,7 @@
</a-row> </a-row>
</a-card> </a-card>
</template> </template>
<a-empty v-else /> <a-empty v-else :image="$emptyImg" />
</a-card> </a-card>
</template> </template>

View File

@ -88,7 +88,11 @@ export default {
}, },
loginSuccess (res) { loginSuccess (res) {
this.loading = false this.loading = false
if (this.form.roleCode === 'student') {
this.$router.push({ path: '/myhome' })
} else {
this.$router.push({ path: '/' }) this.$router.push({ path: '/' })
}
// 1 // 1
setTimeout(() => { setTimeout(() => {
this.$notification.success({ this.$notification.success({