Compare commits
2 Commits
a59233a6d9
...
3ea08984b7
Author | SHA1 | Date | |
---|---|---|---|
![]() |
3ea08984b7 | ||
![]() |
653b1bf513 |
@ -6,37 +6,37 @@ import 'nprogress/nprogress.css' // 进度条 style
|
|||||||
NProgress.configure({ showSpinner: false }) // 进度条 Configuration
|
NProgress.configure({ showSpinner: false }) // 进度条 Configuration
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @description: 路由守卫
|
* @description: 路由前置守卫
|
||||||
*/
|
*/
|
||||||
router.beforeEach((to, from, next) => {
|
router.beforeEach((to, from, next) => {
|
||||||
// start 进度条
|
|
||||||
NProgress.start()
|
NProgress.start()
|
||||||
// 设置title
|
|
||||||
document.title = getPageTitle(to.meta.title)
|
document.title = getPageTitle(to.meta.title)
|
||||||
|
|
||||||
store.commit('user/initUser') // 用户信息初始化
|
// 初始化用户信息
|
||||||
|
store.commit('user/initUser')
|
||||||
const power = store.state.user.power
|
const power = store.state.user.power
|
||||||
const token = store.state.user.token
|
const token = store.state.user.token
|
||||||
|
|
||||||
|
// 判断 token 是否存在
|
||||||
if (!token) {
|
if (!token) {
|
||||||
if (to.path === '/login') {
|
if (to.path === '/login') {
|
||||||
next()
|
next()
|
||||||
} else {
|
} else {
|
||||||
next('/login') // 直接调用 next('/login')
|
// 安卓端兼容性更强的方式,强制跳转登录页
|
||||||
|
router.replace('/login')
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (to.path === '/login') {
|
if (to.path === '/login') {
|
||||||
next('/')
|
next('/') // 已登录访问登录页,重定向首页
|
||||||
} else {
|
} else {
|
||||||
if (to.meta.roles && to.meta.roles.indexOf(power) >= 0) { // 确保 roles 存在
|
// 校验权限
|
||||||
|
if (!to.meta.roles || to.meta.roles.indexOf(power) >= 0) {
|
||||||
next()
|
next()
|
||||||
} else {
|
} else {
|
||||||
next('/')
|
next('/') // 权限不足时跳转首页
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
NProgress.done()
|
|
||||||
})
|
})
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -1,146 +1,4 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class="app-container">
|
|
||||||
<!-- 组合按钮 -->
|
|
||||||
<el-button-group>
|
|
||||||
<el-button type="primary" icon="el-icon-plus" @click="$router.replace('/site/add')">添加</el-button>
|
|
||||||
<el-button type="danger" icon="el-icon-delete" @click="deleteSite(countSelIdArr($refs.myTable.selection))">删除
|
|
||||||
</el-button>
|
|
||||||
<el-button type="warning" icon="el-icon-edit" @click="toEditPage()">编辑</el-button>
|
|
||||||
</el-button-group>
|
|
||||||
<!-- 用户select选项 -->
|
|
||||||
<el-button-group class="m-l-20">
|
|
||||||
<SelectionShopId v-model="form.shop_id" :allSel="true" />
|
|
||||||
</el-button-group>
|
|
||||||
<!-- 站点表格 -->
|
|
||||||
<el-table class="m-t-20 w-100" ref="myTable"
|
|
||||||
:data="siteListArr.slice((currentPage - 1) * pageSize, currentPage * pageSize)" border tooltip-effect="dark">
|
|
||||||
<el-table-column align="center" type="selection" width="40">
|
|
||||||
</el-table-column>
|
|
||||||
<el-table-column align="center" prop="id" label="id" width="50">
|
|
||||||
</el-table-column>
|
|
||||||
<el-table-column prop="sitename" label="站点名称" width="120" min-width="100">
|
|
||||||
</el-table-column>
|
|
||||||
<el-table-column label="菊花码缩率图" width="120" min-width="150">
|
|
||||||
<template slot-scope="scope">
|
|
||||||
<el-image :src="scope.row.qr" :preview-src-list="[scope.row.qr]">
|
|
||||||
</el-image>
|
|
||||||
</template>
|
|
||||||
</el-table-column>
|
|
||||||
<el-table-column prop="describe" label="站点描述" min-width="80" show-overflow-tooltip>
|
|
||||||
</el-table-column>
|
|
||||||
<el-table-column align="center" label="已绑航线" width="200">
|
|
||||||
<template slot-scope="scope">
|
|
||||||
<el-tag class="iconfont"
|
|
||||||
:class="scope.row.bind_route === null || scope.row.bind_route === '' ? 'icon-ic_tingyong' : 'icon-feihangluxian'"
|
|
||||||
:type="scope.row.bind_route === null || scope.row.bind_route === '' ? 'danger' : ''">
|
|
||||||
<font class="m-l-5">{{ scope.row.bind_route === null || scope.row.bind_route === '' ? "未绑定" :
|
|
||||||
scope.row.bind_route }}</font>
|
|
||||||
</el-tag>
|
|
||||||
</template>
|
|
||||||
</el-table-column>
|
|
||||||
<el-table-column prop="controler" label="操作" width="140" min-width="140">
|
|
||||||
<template slot-scope="scope">
|
|
||||||
<el-button-group>
|
|
||||||
<el-button type="danger" icon="el-icon-delete" @click="deleteSite([scope.row.id])">删除</el-button>
|
|
||||||
</el-button-group>
|
|
||||||
</template>
|
|
||||||
</el-table-column>
|
|
||||||
</el-table>
|
|
||||||
<!-- 分页 -->
|
|
||||||
<el-pagination class="m-t-20" layout="prev, pager, next" :current-page.sync="currentPage" :page-size="pageSize"
|
|
||||||
:total="siteListArr.length">
|
|
||||||
</el-pagination>
|
|
||||||
</div>
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<script>
|
|
||||||
import { countSelIdArr } from '@/utils'
|
|
||||||
import SelectionShopId from '@/components/SelectionShopId'
|
|
||||||
|
|
||||||
export default {
|
|
||||||
name: 'Site',
|
|
||||||
data () {
|
|
||||||
return {
|
|
||||||
pageSize: 8, // 每页显示记录条数
|
|
||||||
currentPage: 1, // 当前页
|
|
||||||
form: {
|
|
||||||
shop_id: ''
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
components: {
|
|
||||||
SelectionShopId
|
|
||||||
},
|
|
||||||
computed: {
|
|
||||||
/**
|
|
||||||
* @description: 获取站点列表
|
|
||||||
*/
|
|
||||||
siteList () {
|
|
||||||
return this.$store.state.siteList
|
|
||||||
},
|
|
||||||
/**
|
|
||||||
* @description: 过滤掉 不对应客户的 站点列表
|
|
||||||
* @return: 站点列表
|
|
||||||
*/
|
|
||||||
siteListArr () {
|
|
||||||
if (this.form.shop_id !== '') {
|
|
||||||
return this.siteList.filter((item) => item.shop_id === this.form.shop_id)
|
|
||||||
} else {
|
|
||||||
return this.siteList
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
methods: {
|
|
||||||
countSelIdArr,
|
|
||||||
/**
|
|
||||||
* @description: 跳转到编辑页面
|
|
||||||
*/
|
|
||||||
toEditPage () {
|
|
||||||
const selId = this.countSelIdArr(this.$refs.myTable.selection)
|
|
||||||
switch (selId.length) {
|
|
||||||
case 0:
|
|
||||||
this.$message.error('请选择一条需要编辑的记录')
|
|
||||||
break
|
|
||||||
case 1:
|
|
||||||
this.$router.push('/site/edit/' + selId['0'])
|
|
||||||
break
|
|
||||||
default:
|
|
||||||
this.$message.error('只能选择一条记录')
|
|
||||||
}
|
|
||||||
},
|
|
||||||
/**
|
|
||||||
* @description: 删除站点
|
|
||||||
*/
|
|
||||||
deleteSite (idArr) {
|
|
||||||
this.$store.dispatch('fetchDelSite', idArr)
|
|
||||||
}
|
|
||||||
},
|
|
||||||
watch: {
|
|
||||||
},
|
|
||||||
created () {
|
|
||||||
},
|
|
||||||
filters: {
|
|
||||||
countSelIdArr
|
|
||||||
}
|
|
||||||
}
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<style lang="scss" scoped>
|
|
||||||
@import "@/styles/theme.scss";
|
|
||||||
|
|
||||||
.el-tag {
|
|
||||||
i {
|
|
||||||
vertical-align: middle
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
.image-placeholder {
|
|
||||||
position: relative;
|
|
||||||
display: inline-block;
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
|
|
||||||
<!-- <template>
|
|
||||||
<div>
|
<div>
|
||||||
<video
|
<video
|
||||||
ref="video"
|
ref="video"
|
||||||
@ -158,7 +16,7 @@ export default {
|
|||||||
export default {
|
export default {
|
||||||
data () {
|
data () {
|
||||||
return {
|
return {
|
||||||
url: 'http://82.156.122.87:80/rtc/v1/whep/?app=live&stream=livestream2',
|
url: 'http://82.156.122.87:80/rtc/v1/whep/?app=live&stream=083AF27BB2D0',
|
||||||
sdk: null
|
sdk: null
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@ -184,4 +42,4 @@ export default {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</script> -->
|
</script>
|
||||||
|
Loading…
Reference in New Issue
Block a user